improved theme
This commit is contained in:
parent
f789020ff9
commit
320fa8e28f
|
@ -1287,12 +1287,11 @@ public class ThemeUtils implements Constants {
|
|||
}
|
||||
|
||||
public static Context getActionBarThemedContext(Context base, int themeId, int accentColor) {
|
||||
if (isDarkTheme(themeId)) return base;
|
||||
final int actionBarThemeId;
|
||||
if (TwidereColorUtils.getYIQLuminance(accentColor) > ACCENT_COLOR_THRESHOLD) {
|
||||
actionBarThemeId = R.style.Theme_Twidere_Light;
|
||||
} else {
|
||||
if (isDarkTheme(themeId) || TwidereColorUtils.getYIQLuminance(accentColor) <= ACCENT_COLOR_THRESHOLD) {
|
||||
actionBarThemeId = R.style.Theme_Twidere_Dark;
|
||||
} else {
|
||||
actionBarThemeId = R.style.Theme_Twidere_Light;
|
||||
}
|
||||
final Resources.Theme baseTheme = base.getTheme();
|
||||
final Resources.Theme actionBarTheme = base.getResources().newTheme();
|
||||
|
|
|
@ -165,7 +165,7 @@ public class ThemedLayoutInflaterFactory implements LayoutInflaterFactory {
|
|||
}
|
||||
}
|
||||
if (view instanceof IThemeAccentView) {
|
||||
if (isAccentOptimal) {
|
||||
if (isAccentOptimal || !isColorTint) {
|
||||
((IThemeAccentView) view).setAccentTintColor(ColorStateList.valueOf(accentColor));
|
||||
} else {
|
||||
final int defaultAccentColor = ThemeUtils.getColorFromAttribute(view.getContext(),
|
||||
|
@ -187,7 +187,7 @@ public class ThemedLayoutInflaterFactory implements LayoutInflaterFactory {
|
|||
((TwidereToolbar) view).setItemColor(itemColor);
|
||||
} else if (view instanceof EditText) {
|
||||
if (isAccentOptimal || !isColorTint) {
|
||||
ViewCompat.setBackgroundTintList(view, ColorStateList.valueOf(accentColor));
|
||||
ViewCompat.setBackgroundTintList(view, ColorStateList.valueOf(backgroundTintColor));
|
||||
}
|
||||
} else if (view instanceof ProgressBar) {
|
||||
if (isAccentOptimal) {
|
||||
|
|
Loading…
Reference in New Issue