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>
|
<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>
|
<h3>Version 0.9.46 beta 1</h3>
|
||||||
|
|
||||||
<ol>
|
<ol>
|
||||||
|
|
|
||||||
|
|
@ -384,7 +384,7 @@ public class AlbumDetailActivity extends AbsSlidingMusicPanelActivity implements
|
||||||
cab = new MaterialCab(this, R.id.cab_stub)
|
cab = new MaterialCab(this, R.id.cab_stub)
|
||||||
.setMenu(menuRes)
|
.setMenu(menuRes)
|
||||||
.setCloseDrawableRes(R.drawable.ic_close_white_24dp)
|
.setCloseDrawableRes(R.drawable.ic_close_white_24dp)
|
||||||
.setBackgroundColor(getPaletteColor())
|
.setBackgroundColor(ColorUtil.shiftBackgroundColorForLightText(getPaletteColor()))
|
||||||
.start(new MaterialCab.Callback() {
|
.start(new MaterialCab.Callback() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCabCreated(MaterialCab materialCab, Menu menu) {
|
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)
|
cab = new MaterialCab(this, R.id.cab_stub)
|
||||||
.setMenu(menuRes)
|
.setMenu(menuRes)
|
||||||
.setCloseDrawableRes(R.drawable.ic_close_white_24dp)
|
.setCloseDrawableRes(R.drawable.ic_close_white_24dp)
|
||||||
.setBackgroundColor(getPaletteColor())
|
.setBackgroundColor(ColorUtil.shiftBackgroundColorForLightText(getPaletteColor()))
|
||||||
.start(new MaterialCab.Callback() {
|
.start(new MaterialCab.Callback() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onCabCreated(MaterialCab materialCab, Menu menu) {
|
public boolean onCabCreated(MaterialCab materialCab, Menu menu) {
|
||||||
|
|
|
||||||
|
|
@ -541,7 +541,7 @@ public class MainActivity extends AbsSlidingMusicPanelActivity
|
||||||
cab = new MaterialCab(this, R.id.cab_stub)
|
cab = new MaterialCab(this, R.id.cab_stub)
|
||||||
.setMenu(menu)
|
.setMenu(menu)
|
||||||
.setCloseDrawableRes(R.drawable.ic_close_white_24dp)
|
.setCloseDrawableRes(R.drawable.ic_close_white_24dp)
|
||||||
.setBackgroundColor(getThemeColorPrimary())
|
.setBackgroundColor(ColorUtil.shiftBackgroundColorForLightText(getThemeColorPrimary()))
|
||||||
.start(callback);
|
.start(callback);
|
||||||
return cab;
|
return cab;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -191,7 +191,7 @@ public class PlaylistDetailActivity extends AbsSlidingMusicPanelActivity impleme
|
||||||
cab = new MaterialCab(this, R.id.cab_stub)
|
cab = new MaterialCab(this, R.id.cab_stub)
|
||||||
.setMenu(menu)
|
.setMenu(menu)
|
||||||
.setCloseDrawableRes(R.drawable.ic_close_white_24dp)
|
.setCloseDrawableRes(R.drawable.ic_close_white_24dp)
|
||||||
.setBackgroundColor(getThemeColorPrimary())
|
.setBackgroundColor(ColorUtil.shiftBackgroundColorForLightText(getThemeColorPrimary()))
|
||||||
.start(callback);
|
.start(callback);
|
||||||
return cab;
|
return cab;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -121,4 +121,20 @@ public class ColorUtil {
|
||||||
public static int getSecondaryTextColorForBackground(final Context context, @ColorInt int backgroundColor) {
|
public static int getSecondaryTextColorForBackground(final Context context, @ColorInt int backgroundColor) {
|
||||||
return getSecondaryTextColor(context, useDarkTextColorOnBackground(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.ViewTreeObserver;
|
||||||
import android.view.animation.PathInterpolator;
|
import android.view.animation.PathInterpolator;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.EditText;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.RadioButton;
|
import android.widget.RadioButton;
|
||||||
|
|
@ -160,6 +159,7 @@ public class ViewUtil {
|
||||||
setToolbarIconColor(context, toolbar, getToolbarIconColor(context, dark));
|
setToolbarIconColor(context, toolbar, getToolbarIconColor(context, dark));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ColorInt
|
||||||
public static int getToolbarIconColor(Context context, boolean dark) {
|
public static int getToolbarIconColor(Context context, boolean dark) {
|
||||||
if (dark) {
|
if (dark) {
|
||||||
return ColorUtil.getSecondaryTextColor(context, true);
|
return ColorUtil.getSecondaryTextColor(context, true);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue