Resets recents color when it is needed.
This commit is contained in:
parent
f48301800d
commit
5ab9a75c3c
5 changed files with 26 additions and 18 deletions
|
|
@ -208,9 +208,9 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
|
||||||
toolbarColor = swatch.getRgb();
|
toolbarColor = swatch.getRgb();
|
||||||
albumTitleView.setBackgroundColor(toolbarColor);
|
albumTitleView.setBackgroundColor(toolbarColor);
|
||||||
albumTitleView.setTextColor(swatch.getTitleTextColor());
|
albumTitleView.setTextColor(swatch.getTitleTextColor());
|
||||||
notifyTaskColorChange(toolbarColor);
|
|
||||||
if (Util.hasLollipopSDK() && PreferenceUtils.getInstance(AlbumDetailActivity.this).coloredNavigationBarAlbumEnabled())
|
if (Util.hasLollipopSDK() && PreferenceUtils.getInstance(AlbumDetailActivity.this).coloredNavigationBarAlbumEnabled())
|
||||||
getWindow().setNavigationBarColor(toolbarColor);
|
getWindow().setNavigationBarColor(toolbarColor);
|
||||||
|
notifyTaskColorChange(toolbarColor);
|
||||||
} else {
|
} else {
|
||||||
resetColors();
|
resetColors();
|
||||||
}
|
}
|
||||||
|
|
@ -229,10 +229,12 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
|
||||||
|
|
||||||
if (Util.hasLollipopSDK() && PreferenceUtils.getInstance(this).coloredNavigationBarArtistEnabled())
|
if (Util.hasLollipopSDK() && PreferenceUtils.getInstance(this).coloredNavigationBarArtistEnabled())
|
||||||
getWindow().setNavigationBarColor(DialogUtils.resolveColor(this, R.attr.default_bar_color));
|
getWindow().setNavigationBarColor(DialogUtils.resolveColor(this, R.attr.default_bar_color));
|
||||||
|
|
||||||
|
notifyTaskColorChange(toolbarColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean overrideTaskColor() {
|
protected boolean overridesTaskColor() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -302,9 +302,9 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
|
||||||
toolbarColor = swatch.getRgb();
|
toolbarColor = swatch.getRgb();
|
||||||
artistNameTv.setBackgroundColor(swatch.getRgb());
|
artistNameTv.setBackgroundColor(swatch.getRgb());
|
||||||
artistNameTv.setTextColor(swatch.getTitleTextColor());
|
artistNameTv.setTextColor(swatch.getTitleTextColor());
|
||||||
notifyTaskColorChange(toolbarColor);
|
|
||||||
if (Util.hasLollipopSDK() && PreferenceUtils.getInstance(ArtistDetailActivity.this).coloredNavigationBarArtistEnabled())
|
if (Util.hasLollipopSDK() && PreferenceUtils.getInstance(ArtistDetailActivity.this).coloredNavigationBarArtistEnabled())
|
||||||
getWindow().setNavigationBarColor(swatch.getRgb());
|
getWindow().setNavigationBarColor(swatch.getRgb());
|
||||||
|
notifyTaskColorChange(toolbarColor);
|
||||||
} else {
|
} else {
|
||||||
resetColors();
|
resetColors();
|
||||||
}
|
}
|
||||||
|
|
@ -313,7 +313,7 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean overrideTaskColor() {
|
protected boolean overridesTaskColor() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -340,6 +340,8 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
|
||||||
|
|
||||||
if (Util.hasLollipopSDK() && PreferenceUtils.getInstance(this).coloredNavigationBarArtistEnabled())
|
if (Util.hasLollipopSDK() && PreferenceUtils.getInstance(this).coloredNavigationBarArtistEnabled())
|
||||||
getWindow().setNavigationBarColor(DialogUtils.resolveColor(this, R.attr.default_bar_color));
|
getWindow().setNavigationBarColor(DialogUtils.resolveColor(this, R.attr.default_bar_color));
|
||||||
|
|
||||||
|
notifyTaskColorChange(toolbarColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getIntentExtras() {
|
private void getIntentExtras() {
|
||||||
|
|
|
||||||
|
|
@ -289,7 +289,7 @@ public class MusicControllerActivity extends AbsFabActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean overrideTaskColor() {
|
protected boolean overridesTaskColor() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -325,10 +325,11 @@ public class MusicControllerActivity extends AbsFabActivity {
|
||||||
public void onGenerated(Palette palette) {
|
public void onGenerated(Palette palette) {
|
||||||
Palette.Swatch swatch = palette.getVibrantSwatch();
|
Palette.Swatch swatch = palette.getVibrantSwatch();
|
||||||
if (swatch != null) {
|
if (swatch != null) {
|
||||||
animateColorChange(swatch.getRgb());
|
final int swatchRgb = swatch.getRgb();
|
||||||
|
animateColorChange(swatchRgb);
|
||||||
songTitle.setTextColor(swatch.getTitleTextColor());
|
songTitle.setTextColor(swatch.getTitleTextColor());
|
||||||
songArtist.setTextColor(swatch.getBodyTextColor());
|
songArtist.setTextColor(swatch.getBodyTextColor());
|
||||||
notifyTaskColorChange(swatch.getRgb());
|
notifyTaskColorChange(swatchRgb);
|
||||||
} else {
|
} else {
|
||||||
resetColors();
|
resetColors();
|
||||||
}
|
}
|
||||||
|
|
@ -337,14 +338,16 @@ public class MusicControllerActivity extends AbsFabActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void resetColors() {
|
private void resetColors() {
|
||||||
int songTitleTextColor = DialogUtils.resolveColor(this, R.attr.title_text_color);
|
final int songTitleTextColor = DialogUtils.resolveColor(this, R.attr.title_text_color);
|
||||||
int artistNameTextColor = DialogUtils.resolveColor(this, R.attr.caption_text_color);
|
final int artistNameTextColor = DialogUtils.resolveColor(this, R.attr.caption_text_color);
|
||||||
int defaultBarColor = DialogUtils.resolveColor(this, R.attr.default_bar_color);
|
final int defaultBarColor = DialogUtils.resolveColor(this, R.attr.default_bar_color);
|
||||||
|
|
||||||
animateColorChange(defaultBarColor);
|
animateColorChange(defaultBarColor);
|
||||||
|
|
||||||
songTitle.setTextColor(songTitleTextColor);
|
songTitle.setTextColor(songTitleTextColor);
|
||||||
songArtist.setTextColor(artistNameTextColor);
|
songArtist.setTextColor(artistNameTextColor);
|
||||||
|
|
||||||
|
notifyTaskColorChange(defaultBarColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||||
|
|
|
||||||
|
|
@ -66,12 +66,12 @@ public abstract class ThemeBaseActivity extends ActionBarActivity implements Kab
|
||||||
// Dark theme
|
// Dark theme
|
||||||
ThemeSingleton.get().darkTheme = PreferenceUtils.getInstance(this).getGeneralTheme() == R.style.Theme_MaterialMusic;
|
ThemeSingleton.get().darkTheme = PreferenceUtils.getInstance(this).getGeneralTheme() == R.style.Theme_MaterialMusic;
|
||||||
|
|
||||||
if (!overrideTaskColor()) {
|
if (!overridesTaskColor()) {
|
||||||
notifyTaskColorChange(PreferenceUtils.getInstance(this).getThemeColorPrimary());
|
notifyTaskColorChange(PreferenceUtils.getInstance(this).getThemeColorPrimary());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean overrideTaskColor() {
|
protected boolean overridesTaskColor() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -202,12 +202,13 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
|
||||||
private void restoreStandardColors() {
|
private void restoreStandardColors() {
|
||||||
final int vibrantColor = PreferenceUtils.getInstance(this).getThemeColorPrimary();
|
final int primaryColor = PreferenceUtils.getInstance(this).getThemeColorPrimary();
|
||||||
paletteColorPrimary = vibrantColor;
|
paletteColorPrimary = primaryColor;
|
||||||
observableScrollViewCallbacks.onScrollChanged(scrollView.getCurrentScrollY(), false, false);
|
observableScrollViewCallbacks.onScrollChanged(scrollView.getCurrentScrollY(), false, false);
|
||||||
setStatusBarColor(ColorChooserDialog.shiftColorDown(vibrantColor), false);
|
setStatusBarColor(ColorChooserDialog.shiftColorDown(primaryColor), false);
|
||||||
if (Util.hasLollipopSDK() && PreferenceUtils.getInstance(this).coloredNavigationBarTagEditorEnabled())
|
if (Util.hasLollipopSDK() && PreferenceUtils.getInstance(this).coloredNavigationBarTagEditorEnabled())
|
||||||
getWindow().setNavigationBarColor(vibrantColor);
|
getWindow().setNavigationBarColor(primaryColor);
|
||||||
|
notifyTaskColorChange(primaryColor);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getIntentExtras() {
|
private void getIntentExtras() {
|
||||||
|
|
@ -298,9 +299,9 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
|
||||||
paletteColorPrimary = vibrantColor;
|
paletteColorPrimary = vibrantColor;
|
||||||
observableScrollViewCallbacks.onScrollChanged(scrollView.getCurrentScrollY(), false, false);
|
observableScrollViewCallbacks.onScrollChanged(scrollView.getCurrentScrollY(), false, false);
|
||||||
setStatusBarColor(ColorChooserDialog.shiftColorDown(vibrantColor), false);
|
setStatusBarColor(ColorChooserDialog.shiftColorDown(vibrantColor), false);
|
||||||
notifyTaskColorChange(paletteColorPrimary);
|
|
||||||
if (Util.hasLollipopSDK() && PreferenceUtils.getInstance(AbsTagEditorActivity.this).coloredNavigationBarTagEditorEnabled())
|
if (Util.hasLollipopSDK() && PreferenceUtils.getInstance(AbsTagEditorActivity.this).coloredNavigationBarTagEditorEnabled())
|
||||||
getWindow().setNavigationBarColor(vibrantColor);
|
getWindow().setNavigationBarColor(vibrantColor);
|
||||||
|
notifyTaskColorChange(vibrantColor);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -309,7 +310,7 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean overrideTaskColor() {
|
protected boolean overridesTaskColor() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue