Added Material You monochrome theme

This commit is contained in:
M66B 2022-09-22 09:00:33 +02:00
parent 5f2e1ff435
commit f1b94d35cf
5 changed files with 154 additions and 3 deletions

View File

@ -29,6 +29,7 @@ public class FragmentDialogTheme extends FragmentDialogBase {
private RadioGroup rgTheme;
private SwitchCompat swReverse;
private RadioButton rbThemeYou;
private RadioButton rbThemeYouMono;
private TextView tvYou;
private RadioGroup rgThemeOptions;
private TextView tvSystem;
@ -44,7 +45,7 @@ public class FragmentDialogTheme extends FragmentDialogBase {
boolean grey = (checkedId == R.id.rbThemeGrey);
boolean bw = (checkedId == R.id.rbThemeBlackOrWhite);
boolean solarized = (checkedId == R.id.rbThemeSolarized);
boolean you = (checkedId == R.id.rbThemeYou);
boolean you = (checkedId == R.id.rbThemeYou || checkedId == R.id.rbThemeYouMono);
boolean colored = (grey || bw || solarized || you ||
checkedId == R.id.rbThemeBlueOrange ||
checkedId == R.id.rbThemeRedGreen ||
@ -81,6 +82,7 @@ public class FragmentDialogTheme extends FragmentDialogBase {
View dview = LayoutInflater.from(context).inflate(R.layout.dialog_theme, null);
rgTheme = dview.findViewById(R.id.rgTheme);
rbThemeYou = dview.findViewById(R.id.rbThemeYou);
rbThemeYouMono = dview.findViewById(R.id.rbThemeYouMono);
tvYou = dview.findViewById(R.id.tvYou);
swReverse = dview.findViewById(R.id.swReverse);
rgThemeOptions = dview.findViewById(R.id.rgThemeOptions);
@ -100,6 +102,7 @@ public class FragmentDialogTheme extends FragmentDialogBase {
});
rbThemeYou.setVisibility(Build.VERSION.SDK_INT < Build.VERSION_CODES.S ? View.GONE : View.VISIBLE);
rbThemeYouMono.setVisibility(Build.VERSION.SDK_INT < Build.VERSION_CODES.S ? View.GONE : View.VISIBLE);
tvYou.setVisibility(Build.VERSION.SDK_INT < Build.VERSION_CODES.S ? View.GONE : View.VISIBLE);
tvYou.setOnClickListener(new View.OnClickListener() {
@ -214,6 +217,7 @@ public class FragmentDialogTheme extends FragmentDialogBase {
case "black_and_white":
rgTheme.check(R.id.rbThemeBlackAndWhite);
break;
case "you_light":
case "you_dark":
case "you_black":
@ -226,6 +230,19 @@ public class FragmentDialogTheme extends FragmentDialogBase {
case "you_reversed_system_black":
rgTheme.check(R.id.rbThemeYou);
break;
case "you_mono_light":
case "you_mono_dark":
case "you_mono_black":
case "you_mono_system":
case "you_mono_system_black":
case "you_mono_reversed_light":
case "you_mono_reversed_dark":
case "you_mono_reversed_black":
case "you_mono_reversed_system":
case "you_mono_reversed_system_black":
rgTheme.check(R.id.rbThemeYouMono);
break;
}
tvMore.setPaintFlags(tvMore.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
@ -323,6 +340,15 @@ public class FragmentDialogTheme extends FragmentDialogBase {
editor.putString("theme",
(reverse ? "you_reversed" : "you") +
(black ? "_black" : dark ? "_dark" : "_light")).apply();
} else if (checkedRadioButtonId == R.id.rbThemeYouMono) {
if (system)
editor.putString("theme",
(reverse ? "you_mono_reversed_system" : "you_mono_system") +
(black ? "_black" : "")).apply();
else
editor.putString("theme",
(reverse ? "you_mono_reversed" : "you_mono") +
(black ? "_black" : dark ? "_dark" : "_light")).apply();
}
editor.putBoolean("default_light", swHtmlLight.isChecked());
@ -517,6 +543,8 @@ public class FragmentDialogTheme extends FragmentDialogBase {
return (night
? R.style.AppThemeBlack : R.style.AppThemeWhite);
// Material You
case "you_light":
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
return R.style.AppThemeYouLight;
@ -549,8 +577,42 @@ public class FragmentDialogTheme extends FragmentDialogBase {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
return (night ? R.style.AppThemeYouReversedBlack : R.style.AppThemeYouReversedLight);
// Material You monochrome
case "you_mono_light":
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
return R.style.AppThemeYouMonoLight;
case "you_mono_dark":
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
return (light ? R.style.AppThemeYouMonoLight : R.style.AppThemeYouMonoDark);
case "you_mono_black":
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
return (light ? R.style.AppThemeYouMonoLight : R.style.AppThemeYouMonoBlack);
case "you_mono_system":
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
return (night ? R.style.AppThemeYouMonoDark : R.style.AppThemeYouMonoLight);
case "you_mono_system_black":
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
return (night ? R.style.AppThemeYouMonoBlack : R.style.AppThemeYouMonoLight);
case "you_mono_reversed_light":
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
return R.style.AppThemeYouMonoReversedLight;
case "you_mono_reversed_dark":
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
return (light ? R.style.AppThemeYouMonoReversedLight : R.style.AppThemeYouMonoReversedDark);
case "you_mono_reversed_black":
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
return (light ? R.style.AppThemeYouMonoReversedLight : R.style.AppThemeYouMonoReversedBlack);
case "you_mono_reversed_system":
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
return (night ? R.style.AppThemeYouMonoReversedDark : R.style.AppThemeYouMonoReversedLight);
case "you_mono_reversed_system_black":
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S)
return (night ? R.style.AppThemeYouMonoReversedBlack : R.style.AppThemeYouMonoReversedLight);
default:
if (!theme.startsWith("you_"))
if (!theme.startsWith("you_") && !theme.startsWith("you_mono_"))
Log.e("Unknown theme=" + theme);
return R.style.AppThemeBlueOrangeLight;
}

View File

@ -96,6 +96,14 @@
android:padding="6dp"
android:text="@string/title_setup_theme_you"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<RadioButton
android:id="@+id/rbThemeYouMono"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="6dp"
android:text="@string/title_setup_theme_you_mono"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
</RadioGroup>
<eu.faircode.email.FixedTextView

View File

@ -96,6 +96,14 @@
android:padding="6dp"
android:text="@string/title_setup_theme_you"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<RadioButton
android:id="@+id/rbThemeYouMono"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="6dp"
android:text="@string/title_setup_theme_you_mono"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
</RadioGroup>
<TextView
@ -216,10 +224,10 @@
android:layout_marginTop="12dp"
android:drawableEnd="@drawable/twotone_open_in_new_12"
android:drawablePadding="6dp"
app:drawableTint="?android:attr/textColorLink"
android:text="@string/title_setup_theme_more_colors"
android:textAppearance="@style/TextAppearance.AppCompat.Medium"
android:textColor="?android:attr/textColorLink"
app:drawableTint="?android:attr/textColorLink"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/btnMore" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -72,4 +72,76 @@
<item name="android:windowBackground">@drawable/background_black</item>
<item name="colorDrawerBackground">@color/black</item>
</style>
<style name="AppThemeYouMonoLight" parent="AppThemeBaseLight">
<item name="colorPrimary">@android:color/system_accent1_500</item>
<item name="colorPrimaryDark">@android:color/system_accent1_700</item>
<item name="colorAccent">@android:color/system_accent1_500</item>
<item name="colorUnreadHighlight">@android:color/system_accent1_700</item>
<item name="colorFabBackground">@android:color/system_accent1_500</item>
<item name="colorInfoForeground">@android:color/system_accent1_0</item>
<item name="colorInfoBackground">@android:color/system_accent1_500</item>
<item name="android:textColorLink">@android:color/system_accent1_700</item>
</style>
<style name="AppThemeYouMonoDark" parent="AppThemeBaseDark">
<item name="colorPrimary">@android:color/system_accent1_500</item>
<item name="colorPrimaryDark">@android:color/system_accent1_700</item>
<item name="colorAccent">@android:color/system_accent1_300</item>
<item name="colorUnreadHighlight">@android:color/system_accent1_300</item>
<item name="colorFabBackground">@android:color/system_accent1_500</item>
<item name="colorInfoForeground">@android:color/system_accent1_0</item>
<item name="colorInfoBackground">@android:color/system_accent1_500</item>
<item name="android:textColorLink">@android:color/system_accent1_300</item>
</style>
<style name="AppThemeYouMonoBlack" parent="AppThemeYouMonoDark">
<item name="themeName">black</item>
<item name="android:windowBackground">@drawable/background_black</item>
<item name="colorDrawerBackground">@color/black</item>
</style>
<style name="AppThemeYouMonoReversedLight" parent="AppThemeBaseLight">
<item name="colorPrimary">@android:color/system_accent3_500</item>
<item name="colorPrimaryDark">@android:color/system_accent3_700</item>
<item name="colorAccent">@android:color/system_accent3_500</item>
<item name="colorUnreadHighlight">@android:color/system_accent3_700</item>
<item name="colorFabBackground">@android:color/system_accent3_500</item>
<item name="colorInfoForeground">@android:color/system_accent3_0</item>
<item name="colorInfoBackground">@android:color/system_accent3_500</item>
<item name="android:textColorLink">@android:color/system_accent3_700</item>
</style>
<style name="AppThemeYouMonoReversedDark" parent="AppThemeBaseDark">
<item name="colorPrimary">@android:color/system_accent3_500</item>
<item name="colorPrimaryDark">@android:color/system_accent3_700</item>
<item name="colorAccent">@android:color/system_accent3_300</item>
<item name="colorUnreadHighlight">@android:color/system_accent3_300</item>
<item name="colorFabBackground">@android:color/system_accent3_500</item>
<item name="colorInfoForeground">@android:color/system_accent3_0</item>
<item name="colorInfoBackground">@android:color/system_accent3_500</item>
<item name="android:textColorLink">@android:color/system_accent3_300</item>
</style>
<style name="AppThemeYouMonoReversedBlack" parent="AppThemeYouMonoReversedDark">
<item name="themeName">black</item>
<item name="android:windowBackground">@drawable/background_black</item>
<item name="colorDrawerBackground">@color/black</item>
</style>
</resources>

View File

@ -333,6 +333,7 @@
<string name="title_setup_theme_black_or_white">Black or white</string>
<string name="title_setup_theme_black_and_white">Black and white</string>
<string name="title_setup_theme_you" translatable="false">Material You</string>
<string name="title_setup_theme_you_mono" translatable="false">Material You mono</string>
<string name="title_setup_theme_reverse">Swap colors</string>
<string name="title_setup_theme_light">Light</string>