Fixed cab (contextual action bar) content not visible with light primary colors.
This commit is contained in:
parent
49a2b97933
commit
c0b41f63cc
7 changed files with 27 additions and 5 deletions
|
|
@ -25,6 +25,12 @@
|
|||
|
||||
<p>You can view the changelog dialog again at any time from the <i>about</i> section.</p>
|
||||
|
||||
<h3>Version 0.9.46 beta 2</h3>
|
||||
|
||||
<ol>
|
||||
<li><b>FIX:</b> Cab (contextual action bar) content not visible with light primary colors</li>
|
||||
</ol>
|
||||
|
||||
<h3>Version 0.9.46 beta 1</h3>
|
||||
|
||||
<ol>
|
||||
|
|
|
|||
|
|
@ -384,7 +384,7 @@ public class AlbumDetailActivity extends AbsSlidingMusicPanelActivity implements
|
|||
cab = new MaterialCab(this, R.id.cab_stub)
|
||||
.setMenu(menuRes)
|
||||
.setCloseDrawableRes(R.drawable.ic_close_white_24dp)
|
||||
.setBackgroundColor(getPaletteColor())
|
||||
.setBackgroundColor(ColorUtil.shiftBackgroundColorForLightText(getPaletteColor()))
|
||||
.start(new MaterialCab.Callback() {
|
||||
@Override
|
||||
public boolean onCabCreated(MaterialCab materialCab, Menu menu) {
|
||||
|
|
|
|||
|
|
@ -448,7 +448,7 @@ public class ArtistDetailActivity extends AbsSlidingMusicPanelActivity implement
|
|||
cab = new MaterialCab(this, R.id.cab_stub)
|
||||
.setMenu(menuRes)
|
||||
.setCloseDrawableRes(R.drawable.ic_close_white_24dp)
|
||||
.setBackgroundColor(getPaletteColor())
|
||||
.setBackgroundColor(ColorUtil.shiftBackgroundColorForLightText(getPaletteColor()))
|
||||
.start(new MaterialCab.Callback() {
|
||||
@Override
|
||||
public boolean onCabCreated(MaterialCab materialCab, Menu menu) {
|
||||
|
|
|
|||
|
|
@ -541,7 +541,7 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
|
|||
cab = new MaterialCab(this, R.id.cab_stub)
|
||||
.setMenu(menu)
|
||||
.setCloseDrawableRes(R.drawable.ic_close_white_24dp)
|
||||
.setBackgroundColor(getThemeColorPrimary())
|
||||
.setBackgroundColor(ColorUtil.shiftBackgroundColorForLightText(getThemeColorPrimary()))
|
||||
.start(callback);
|
||||
return cab;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -191,7 +191,7 @@ public class PlaylistDetailActivity extends AbsSlidingMusicPanelActivity impleme
|
|||
cab = new MaterialCab(this, R.id.cab_stub)
|
||||
.setMenu(menu)
|
||||
.setCloseDrawableRes(R.drawable.ic_close_white_24dp)
|
||||
.setBackgroundColor(getThemeColorPrimary())
|
||||
.setBackgroundColor(ColorUtil.shiftBackgroundColorForLightText(getThemeColorPrimary()))
|
||||
.start(callback);
|
||||
return cab;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,4 +121,20 @@ public class ColorUtil {
|
|||
public static int getSecondaryTextColorForBackground(final Context context, @ColorInt int backgroundColor) {
|
||||
return getSecondaryTextColor(context, useDarkTextColorOnBackground(backgroundColor));
|
||||
}
|
||||
|
||||
@ColorInt
|
||||
public static int shiftBackgroundColorForLightText(@ColorInt int backgroundColor) {
|
||||
while (ColorUtil.useDarkTextColorOnBackground(backgroundColor)) {
|
||||
backgroundColor = ColorUtil.shiftColorDown(backgroundColor);
|
||||
}
|
||||
return backgroundColor;
|
||||
}
|
||||
|
||||
@ColorInt
|
||||
public static int shiftBackgroundColorForDarkText(@ColorInt int backgroundColor) {
|
||||
while (!ColorUtil.useDarkTextColorOnBackground(backgroundColor)) {
|
||||
backgroundColor = ColorUtil.shiftColorUp(backgroundColor);
|
||||
}
|
||||
return backgroundColor;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,7 +22,6 @@ import android.view.View;
|
|||
import android.view.ViewTreeObserver;
|
||||
import android.view.animation.PathInterpolator;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.EditText;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.RadioButton;
|
||||
|
|
@ -160,6 +159,7 @@ public class ViewUtil {
|
|||
setToolbarIconColor(context, toolbar, getToolbarIconColor(context, dark));
|
||||
}
|
||||
|
||||
@ColorInt
|
||||
public static int getToolbarIconColor(Context context, boolean dark) {
|
||||
if (dark) {
|
||||
return ColorUtil.getSecondaryTextColor(context, true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue