Fixed cab (contextual action bar) content not visible with light primary colors.

This commit is contained in:
Karim Abou Zeid 2015-09-08 12:03:00 +02:00
commit c0b41f63cc
7 changed files with 27 additions and 5 deletions

View file

@ -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;
}
}

View file

@ -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);