Fixed wrong NavigationBar- and TaskDescription colors
This commit is contained in:
parent
66e5ac0bb6
commit
9ab4cde93c
2 changed files with 36 additions and 5 deletions
|
|
@ -12,6 +12,7 @@ import android.os.Build;
|
|||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.os.Message;
|
||||
import android.support.annotation.ColorInt;
|
||||
import android.support.annotation.LayoutRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
|
|
@ -139,6 +140,9 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
private int lastTitleTextColor = -2;
|
||||
private int lastCaptionTextColor = -2;
|
||||
|
||||
private int navigationBarColor;
|
||||
private int taskColor;
|
||||
|
||||
private Handler progressViewsUpdateHandler;
|
||||
|
||||
private boolean opaqueStatusBar;
|
||||
|
|
@ -373,6 +377,10 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
|
||||
@Override
|
||||
public void onPanelCollapsed(View view) {
|
||||
super.notifyTaskColorChange(taskColor);
|
||||
if (shouldColorNavigationBar()) {
|
||||
super.setNavigationBarColor(navigationBarColor);
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
mediaControllerContainer.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
|
|
@ -380,7 +388,10 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
|
||||
@Override
|
||||
public void onPanelExpanded(View view) {
|
||||
onPanelSlide(view, 1);
|
||||
super.notifyTaskColorChange(lastFooterColor);
|
||||
if (shouldColorNavigationBar()) {
|
||||
super.setNavigationBarColor(lastFooterColor);
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
if (mediaControllerContainer.getVisibility() == View.INVISIBLE) {
|
||||
int cx = (dummyFab.getLeft() + dummyFab.getRight()) / 2;
|
||||
|
|
@ -770,6 +781,13 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
private void setColors(int color) {
|
||||
animateColorChange(color);
|
||||
animateTextColorChange(ColorUtil.getPrimaryTextColorForBackground(this, color), ColorUtil.getSecondaryTextColorForBackground(this, color));
|
||||
|
||||
if (slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.EXPANDED) {
|
||||
super.notifyTaskColorChange(color);
|
||||
if (shouldColorNavigationBar()) {
|
||||
super.setNavigationBarColor(color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void animateColorChange(final int newColor) {
|
||||
|
|
@ -812,9 +830,6 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
playerStatusbar.setBackgroundColor(Color.TRANSPARENT);
|
||||
}
|
||||
}
|
||||
|
||||
if (shouldColorNavigationBar())
|
||||
setNavigationBarColor(newColor);
|
||||
lastFooterColor = newColor;
|
||||
}
|
||||
|
||||
|
|
@ -972,4 +987,20 @@ public abstract class AbsSlidingMusicPanelActivity extends AbsMusicServiceActivi
|
|||
})
|
||||
.start();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setNavigationBarColor(@ColorInt int color) {
|
||||
this.navigationBarColor = color;
|
||||
if (slidingUpPanelLayout == null || slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
|
||||
super.setNavigationBarColor(color);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void notifyTaskColorChange(@ColorInt int color) {
|
||||
this.taskColor = color;
|
||||
if (slidingUpPanelLayout == null || slidingUpPanelLayout.getPanelState() == SlidingUpPanelLayout.PanelState.COLLAPSED) {
|
||||
super.notifyTaskColorChange(color);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -127,7 +127,7 @@ public abstract class AbsThemeActivity extends AppCompatActivity implements KabV
|
|||
Util.setStatusBarTranslucent(getWindow());
|
||||
}
|
||||
|
||||
protected final void setNavigationBarColor(@ColorInt int color) {
|
||||
protected void setNavigationBarColor(@ColorInt int color) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP)
|
||||
getWindow().setNavigationBarColor(ColorUtil.shiftColorDown(color));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue