Resets recents color when it is needed.

This commit is contained in:
Karim Abou Zeid 2015-04-19 21:07:35 +02:00
commit 5ab9a75c3c
5 changed files with 26 additions and 18 deletions

View file

@ -208,9 +208,9 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
toolbarColor = swatch.getRgb();
albumTitleView.setBackgroundColor(toolbarColor);
albumTitleView.setTextColor(swatch.getTitleTextColor());
notifyTaskColorChange(toolbarColor);
if (Util.hasLollipopSDK() && PreferenceUtils.getInstance(AlbumDetailActivity.this).coloredNavigationBarAlbumEnabled())
getWindow().setNavigationBarColor(toolbarColor);
notifyTaskColorChange(toolbarColor);
} else {
resetColors();
}
@ -229,10 +229,12 @@ public class AlbumDetailActivity extends AbsFabActivity implements PaletteColorH
if (Util.hasLollipopSDK() && PreferenceUtils.getInstance(this).coloredNavigationBarArtistEnabled())
getWindow().setNavigationBarColor(DialogUtils.resolveColor(this, R.attr.default_bar_color));
notifyTaskColorChange(toolbarColor);
}
@Override
protected boolean overrideTaskColor() {
protected boolean overridesTaskColor() {
return true;
}

View file

@ -302,9 +302,9 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
toolbarColor = swatch.getRgb();
artistNameTv.setBackgroundColor(swatch.getRgb());
artistNameTv.setTextColor(swatch.getTitleTextColor());
notifyTaskColorChange(toolbarColor);
if (Util.hasLollipopSDK() && PreferenceUtils.getInstance(ArtistDetailActivity.this).coloredNavigationBarArtistEnabled())
getWindow().setNavigationBarColor(swatch.getRgb());
notifyTaskColorChange(toolbarColor);
} else {
resetColors();
}
@ -313,7 +313,7 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
}
@Override
protected boolean overrideTaskColor() {
protected boolean overridesTaskColor() {
return true;
}
@ -340,6 +340,8 @@ public class ArtistDetailActivity extends AbsFabActivity implements PaletteColor
if (Util.hasLollipopSDK() && PreferenceUtils.getInstance(this).coloredNavigationBarArtistEnabled())
getWindow().setNavigationBarColor(DialogUtils.resolveColor(this, R.attr.default_bar_color));
notifyTaskColorChange(toolbarColor);
}
private void getIntentExtras() {

View file

@ -289,7 +289,7 @@ public class MusicControllerActivity extends AbsFabActivity {
}
@Override
protected boolean overrideTaskColor() {
protected boolean overridesTaskColor() {
return true;
}
@ -325,10 +325,11 @@ public class MusicControllerActivity extends AbsFabActivity {
public void onGenerated(Palette palette) {
Palette.Swatch swatch = palette.getVibrantSwatch();
if (swatch != null) {
animateColorChange(swatch.getRgb());
final int swatchRgb = swatch.getRgb();
animateColorChange(swatchRgb);
songTitle.setTextColor(swatch.getTitleTextColor());
songArtist.setTextColor(swatch.getBodyTextColor());
notifyTaskColorChange(swatch.getRgb());
notifyTaskColorChange(swatchRgb);
} else {
resetColors();
}
@ -337,14 +338,16 @@ public class MusicControllerActivity extends AbsFabActivity {
}
private void resetColors() {
int songTitleTextColor = DialogUtils.resolveColor(this, R.attr.title_text_color);
int artistNameTextColor = DialogUtils.resolveColor(this, R.attr.caption_text_color);
int defaultBarColor = DialogUtils.resolveColor(this, R.attr.default_bar_color);
final int songTitleTextColor = DialogUtils.resolveColor(this, R.attr.title_text_color);
final int artistNameTextColor = DialogUtils.resolveColor(this, R.attr.caption_text_color);
final int defaultBarColor = DialogUtils.resolveColor(this, R.attr.default_bar_color);
animateColorChange(defaultBarColor);
songTitle.setTextColor(songTitleTextColor);
songArtist.setTextColor(artistNameTextColor);
notifyTaskColorChange(defaultBarColor);
}
@TargetApi(Build.VERSION_CODES.LOLLIPOP)

View file

@ -66,12 +66,12 @@ public abstract class ThemeBaseActivity extends ActionBarActivity implements Kab
// Dark theme
ThemeSingleton.get().darkTheme = PreferenceUtils.getInstance(this).getGeneralTheme() == R.style.Theme_MaterialMusic;
if (!overrideTaskColor()) {
if (!overridesTaskColor()) {
notifyTaskColorChange(PreferenceUtils.getInstance(this).getThemeColorPrimary());
}
}
protected boolean overrideTaskColor() {
protected boolean overridesTaskColor() {
return false;
}

View file

@ -202,12 +202,13 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void restoreStandardColors() {
final int vibrantColor = PreferenceUtils.getInstance(this).getThemeColorPrimary();
paletteColorPrimary = vibrantColor;
final int primaryColor = PreferenceUtils.getInstance(this).getThemeColorPrimary();
paletteColorPrimary = primaryColor;
observableScrollViewCallbacks.onScrollChanged(scrollView.getCurrentScrollY(), false, false);
setStatusBarColor(ColorChooserDialog.shiftColorDown(vibrantColor), false);
setStatusBarColor(ColorChooserDialog.shiftColorDown(primaryColor), false);
if (Util.hasLollipopSDK() && PreferenceUtils.getInstance(this).coloredNavigationBarTagEditorEnabled())
getWindow().setNavigationBarColor(vibrantColor);
getWindow().setNavigationBarColor(primaryColor);
notifyTaskColorChange(primaryColor);
}
private void getIntentExtras() {
@ -298,9 +299,9 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
paletteColorPrimary = vibrantColor;
observableScrollViewCallbacks.onScrollChanged(scrollView.getCurrentScrollY(), false, false);
setStatusBarColor(ColorChooserDialog.shiftColorDown(vibrantColor), false);
notifyTaskColorChange(paletteColorPrimary);
if (Util.hasLollipopSDK() && PreferenceUtils.getInstance(AbsTagEditorActivity.this).coloredNavigationBarTagEditorEnabled())
getWindow().setNavigationBarColor(vibrantColor);
notifyTaskColorChange(vibrantColor);
}
});
} else {
@ -309,7 +310,7 @@ public abstract class AbsTagEditorActivity extends AbsBaseActivity {
}
@Override
protected boolean overrideTaskColor() {
protected boolean overridesTaskColor() {
return true;
}