Added colored black themes

pull/171/head
M66B 5 years ago
parent 986d6eb3bb
commit c02e797bf2

@ -88,6 +88,7 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
Log.i("theme=" + theme + " UI mode=" + uiMode + " night=" + night);
switch (theme) {
// Light
case "light":
case "blue_orange_light":
setTheme(R.style.AppThemeBlueOrangeLight);
@ -110,6 +111,7 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
setTheme(R.style.AppThemeGreenRedLight);
break;
// Dark
case "dark":
case "blue_orange_dark":
setTheme(R.style.AppThemeBlueOrangeDark);
@ -132,16 +134,36 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
setTheme(R.style.AppThemeGreenRedDark);
break;
// Black
case "blue_orange_black":
setTheme(R.style.AppThemeBlueOrangeBlack);
break;
case "orange_blue_black":
setTheme(R.style.AppThemeOrangeBlueBlack);
break;
case "yellow_purple_black":
setTheme(R.style.AppThemeYellowPurpleBlack);
break;
case "purple_yellow_black":
setTheme(R.style.AppThemePurpleYellowBlack);
break;
case "red_green_black":
setTheme(R.style.AppThemeRedGreenBlack);
break;
case "green_red_black":
setTheme(R.style.AppThemeGreenRedBlack);
break;
// Grey
case "grey_light":
setTheme(R.style.AppThemeGreySteelBlueLight);
break;
case "black":
case "grey_dark":
setTheme(R.style.AppThemeGreySteelBlueDark);
break;
case "black":
setTheme(R.style.AppThemeBlack);
break;
// System
case "system":
case "blue_orange_system":
setTheme(night

@ -674,6 +674,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
private RadioGroup rgTheme;
private SwitchCompat swReverse;
private SwitchCompat swDark;
private SwitchCompat swBlack;
private SwitchCompat swSystem;
private void eval() {
@ -686,15 +687,20 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
checkedId == R.id.rbThemeYellowPurple ||
checkedId == R.id.rbThemeRedGreen ||
checkedId == R.id.rbThemeGrey);
swBlack.setEnabled(checkedId == R.id.rbThemeBlueOrange ||
checkedId == R.id.rbThemeYellowPurple ||
checkedId == R.id.rbThemeRedGreen);
swSystem.setEnabled(swDark.isEnabled());
boolean reverse = (swReverse.isEnabled() && swReverse.isChecked());
boolean dark = (swDark.isEnabled() && swDark.isChecked());
boolean black = (swBlack.isEnabled() && swBlack.isChecked());
boolean system = (swSystem.isEnabled() && swSystem.isChecked());
swReverse.setEnabled(swReverse.isEnabled() && !system);
swDark.setEnabled(swDark.isEnabled() && !system);
swSystem.setEnabled(swSystem.isEnabled() && !reverse && !dark);
swBlack.setEnabled(swBlack.isEnabled() && dark);
swSystem.setEnabled(swSystem.isEnabled() && !reverse && !dark && !black);
}
@NonNull
@ -705,10 +711,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
rgTheme = dview.findViewById(R.id.rgTheme);
swReverse = dview.findViewById(R.id.swReverse);
swDark = dview.findViewById(R.id.swDark);
swBlack = dview.findViewById(R.id.swBlack);
swSystem = dview.findViewById(R.id.swSystem);
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
String theme = prefs.getString("theme", "light");
if ("black".equals(theme))
theme = "grey_dark";
itten.setOnClickListener(new View.OnClickListener() {
@Override
@ -732,6 +741,13 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
swBlack.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
eval();
}
});
swSystem.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
@ -746,11 +762,18 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
}
});
swReverse.setChecked(theme.startsWith("orange_blue") ||
theme.startsWith("purple_yellow") ||
theme.startsWith("green_red"));
swDark.setChecked(theme.endsWith("dark"));
swSystem.setChecked(theme.endsWith("system"));
boolean colored =
(theme.startsWith("orange_blue") ||
theme.startsWith("purple_yellow") ||
theme.startsWith("green_red"));
boolean dark = theme.endsWith("dark");
boolean black = theme.endsWith("black");
boolean system = theme.endsWith("system");
swReverse.setChecked(colored);
swDark.setChecked(dark || black);
swBlack.setChecked(black);
swSystem.setChecked(system);
switch (theme) {
case "light":
@ -759,22 +782,28 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
case "blue_orange_system":
case "blue_orange_light":
case "blue_orange_dark":
case "blue_orange_black":
case "orange_blue_light":
case "orange_blue_dark":
case "orange_blue_black":
rgTheme.check(R.id.rbThemeBlueOrange);
break;
case "yellow_purple_system":
case "yellow_purple_light":
case "yellow_purple_dark":
case "yellow_purple_black":
case "purple_yellow_light":
case "purple_yellow_dark":
case "purple_yellow_black":
rgTheme.check(R.id.rbThemeYellowPurple);
break;
case "red_green_system":
case "red_green_light":
case "red_green_dark":
case "red_green_black":
case "green_red_light":
case "green_red_dark":
case "green_red_black":
rgTheme.check(R.id.rbThemeRedGreen);
break;
case "grey_system":
@ -782,9 +811,6 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
case "grey_dark":
rgTheme.check(R.id.rbThemeGrey);
break;
case "black":
rgTheme.check(R.id.rbThemeBlack);
break;
}
return new AlertDialog.Builder(getContext())
@ -798,6 +824,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
boolean reverse = (swReverse.isEnabled() && swReverse.isChecked());
boolean dark = (swDark.isEnabled() && swDark.isChecked());
boolean black = (swBlack.isEnabled() && swBlack.isChecked());
boolean system = (swSystem.isEnabled() && swSystem.isChecked());
switch (rgTheme.getCheckedRadioButtonId()) {
@ -807,7 +834,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
else
prefs.edit().putString("theme",
(reverse ? "orange_blue" : "blue_orange") +
(dark ? "_dark" : "_light")).apply();
(black ? "_black" : dark ? "_dark" : "_light")).apply();
break;
case R.id.rbThemeYellowPurple:
if (system)
@ -815,7 +842,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
else
prefs.edit().putString("theme",
(reverse ? "purple_yellow" : "yellow_purple") +
(dark ? "_dark" : "_light")).apply();
(black ? "_black" : dark ? "_dark" : "_light")).apply();
break;
case R.id.rbThemeRedGreen:
if (system)
@ -823,7 +850,7 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
else
prefs.edit().putString("theme",
(reverse ? "green_red" : "red_green") +
(dark ? "_dark" : "_light")).apply();
(black ? "_black" : dark ? "_dark" : "_light")).apply();
break;
case R.id.rbThemeGrey:
if (system)
@ -832,9 +859,6 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
prefs.edit().putString("theme",
"grey" + (dark ? "_dark" : "_light")).apply();
break;
case R.id.rbThemeBlack:
prefs.edit().putString("theme", "black").apply();
break;
}
}
})

@ -71,14 +71,6 @@
android:padding="6dp"
android:text="@string/title_setup_theme_grey"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<RadioButton
android:id="@+id/rbThemeBlack"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="6dp"
android:text="@string/title_setup_theme_black"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
</RadioGroup>
<androidx.appcompat.widget.SwitchCompat
@ -101,6 +93,16 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swReverse" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swBlack"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_setup_theme_black"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swDark" />
<androidx.appcompat.widget.SwitchCompat
android:id="@+id/swSystem"
android:layout_width="0dp"
@ -109,7 +111,7 @@
android:text="@string/title_setup_theme_system"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/swDark" />
app:layout_constraintTop_toBottomOf="@id/swBlack" />
<TextView
android:id="@+id/tvSystem"

@ -205,10 +205,10 @@
<string name="title_setup_theme_yellow_purple">Yellow/purple</string>
<string name="title_setup_theme_red_green">Red/green</string>
<string name="title_setup_theme_grey">Grey</string>
<string name="title_setup_theme_black">Black (AMOLED)</string>
<string name="title_setup_theme_reverse">Reverse colors</string>
<string name="title_setup_theme_dark">Dark</string>
<string name="title_setup_theme_black">Black (AMOLED)</string>
<string name="title_setup_theme_system">Follow system</string>
<string name="title_setup_theme_system_hint">Follow system theme will automatically switch to light/dark on day/night, if supported by Android</string>

@ -285,9 +285,47 @@
<item name="android:textColorLink">@color/darkRedAccent</item>
</style>
<!-- Black -->
<style name="AppThemeBlueOrangeBlack" parent="AppThemeBlueOrangeDark">
<item name="themeName">black</item>
<item name="android:windowBackground">@color/black</item>
<item name="colorDrawerBackground">@color/black</item>
</style>
<style name="AppThemeOrangeBlueBlack" parent="AppThemeOrangeBlueDark">
<item name="themeName">black</item>
<item name="android:windowBackground">@color/black</item>
<item name="colorDrawerBackground">@color/black</item>
</style>
<style name="AppThemeYellowPurpleBlack" parent="AppThemeYellowPurpleDark">
<item name="themeName">black</item>
<item name="android:windowBackground">@color/black</item>
<item name="colorDrawerBackground">@color/black</item>
</style>
<style name="AppThemePurpleYellowBlack" parent="AppThemePurpleYellowDark">
<item name="themeName">black</item>
<item name="android:windowBackground">@color/black</item>
<item name="colorDrawerBackground">@color/black</item>
</style>
<style name="AppThemeRedGreenBlack" parent="AppThemeRedGreenDark">
<item name="themeName">black</item>
<item name="android:windowBackground">@color/black</item>
<item name="colorDrawerBackground">@color/black</item>
</style>
<style name="AppThemeGreenRedBlack" parent="AppThemeGreenRedDark">
<item name="themeName">black</item>
<item name="android:windowBackground">@color/black</item>
<item name="colorDrawerBackground">@color/black</item>
</style>
<!-- Other -->
<style name="AppThemeBlack" parent="AppThemeBlueOrangeDark">
<style name="_AppThemeBlack" parent="AppThemeBlueOrangeDark">
<item name="themeName">black</item>
<item name="colorPrimary">@color/blackPrimary</item>
<item name="colorPrimaryDark">@color/blackPrimaryDark</item>
@ -315,7 +353,8 @@
<item name="colorInfoBackground">@color/greyPrimary</item>
</style>
<style name="AppThemeGreySteelBlueDark" parent="AppThemeBlack">
<style name="AppThemeGreySteelBlueDark" parent="AppThemeBaseDark">
<item name="themeName">black</item>
<item name="colorPrimary">@color/greyPrimary</item>
<item name="colorPrimaryDark">@color/greyPrimaryDark</item>
<item name="colorAccent">@color/greyAccent</item>
@ -329,6 +368,9 @@
<item name="colorInfoForeground">@color/white</item>
<item name="colorInfoBackground">@color/greyPrimary</item>
<item name="android:windowBackground">@color/black</item>
<item name="colorDrawerBackground">@color/black</item>
</style>
<style name="Theme.AppCompat.Translucent" parent="Theme.AppCompat.NoActionBar">

Loading…
Cancel
Save