Added grey system theme

pull/162/head
M66B 5 years ago
parent 3867ad25fa
commit ad0e77ecc6

@ -87,6 +87,13 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
Log.i("UI mode=" + uiMode); Log.i("UI mode=" + uiMode);
if ((uiMode & Configuration.UI_MODE_NIGHT_YES) != 0) if ((uiMode & Configuration.UI_MODE_NIGHT_YES) != 0)
setTheme(R.style.AppThemeBlack); setTheme(R.style.AppThemeBlack);
} else if ("grey_system".equals(theme)) {
int uiMode = getResources().getConfiguration().uiMode;
Log.i("UI mode=" + uiMode);
if ((uiMode & Configuration.UI_MODE_NIGHT_YES) != 0)
setTheme(R.style.AppThemeGreyDark);
else
setTheme(R.style.AppThemeGreyLight);
} }
} }

@ -401,6 +401,9 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
case "system": case "system":
rgTheme.check(R.id.rbThemeSystem); rgTheme.check(R.id.rbThemeSystem);
break; break;
case "grey_system":
rgTheme.check(R.id.rbThemeGreySystem);
break;
default: default:
rgTheme.check(R.id.rbThemeLight); rgTheme.check(R.id.rbThemeLight);
} }
@ -429,6 +432,9 @@ public class FragmentOptionsDisplay extends FragmentBase implements SharedPrefer
case R.id.rbThemeSystem: case R.id.rbThemeSystem:
prefs.edit().putString("theme", "system").apply(); prefs.edit().putString("theme", "system").apply();
break; break;
case R.id.rbThemeGreySystem:
prefs.edit().putString("theme", "grey_system").apply();
break;
} }
} }
}); });

@ -1,69 +1,83 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="12dp"> android:padding="12dp">
<RadioGroup <androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/rgTheme"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content">
android:orientation="vertical"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<RadioButton <RadioGroup
android:id="@+id/rbThemeLight" android:id="@+id/rgTheme"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="6dp" android:orientation="vertical"
android:text="@string/title_setup_light_theme" app:layout_constraintStart_toStartOf="parent"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" /> app:layout_constraintTop_toTopOf="parent">
<RadioButton <RadioButton
android:id="@+id/rbThemeDark" android:id="@+id/rbThemeLight"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="12dp" android:padding="6dp"
android:padding="6dp" android:text="@string/title_setup_light_theme"
android:text="@string/title_setup_dark_theme" android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<RadioButton <RadioButton
android:id="@+id/rbThemeBlack" android:id="@+id/rbThemeDark"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="12dp" android:layout_marginTop="12dp"
android:padding="6dp" android:padding="6dp"
android:text="@string/title_setup_black_theme" android:text="@string/title_setup_dark_theme"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" /> android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<RadioButton <RadioButton
android:id="@+id/rbThemeGreyLight" android:id="@+id/rbThemeBlack"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="12dp" android:layout_marginTop="12dp"
android:padding="6dp" android:padding="6dp"
android:text="@string/title_setup_grey_light_theme" android:text="@string/title_setup_black_theme"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" /> android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<RadioButton <RadioButton
android:id="@+id/rbThemeGreyDark" android:id="@+id/rbThemeGreyLight"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="12dp" android:layout_marginTop="12dp"
android:padding="6dp" android:padding="6dp"
android:text="@string/title_setup_grey_dark_theme" android:text="@string/title_setup_grey_light_theme"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" /> android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<RadioButton <RadioButton
android:id="@+id/rbThemeSystem" android:id="@+id/rbThemeGreyDark"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="12dp" android:layout_marginTop="12dp"
android:padding="6dp" android:padding="6dp"
android:text="@string/title_setup_system_theme" android:text="@string/title_setup_grey_dark_theme"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" /> android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
</RadioGroup>
</androidx.constraintlayout.widget.ConstraintLayout> <RadioButton
android:id="@+id/rbThemeSystem"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:padding="6dp"
android:text="@string/title_setup_system_theme"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<RadioButton
android:id="@+id/rbThemeGreySystem"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:padding="6dp"
android:text="@string/title_setup_grey_system_theme"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
</RadioGroup>
</androidx.constraintlayout.widget.ConstraintLayout>
</ScrollView>

@ -185,6 +185,7 @@
<string name="title_setup_grey_light_theme">Grey light theme</string> <string name="title_setup_grey_light_theme">Grey light theme</string>
<string name="title_setup_grey_dark_theme">Grey dark theme</string> <string name="title_setup_grey_dark_theme">Grey dark theme</string>
<string name="title_setup_system_theme">System theme</string> <string name="title_setup_system_theme">System theme</string>
<string name="title_setup_grey_system_theme">Grey system theme</string>
<string name="title_setup_advanced">Advanced</string> <string name="title_setup_advanced">Advanced</string>
<string name="title_setup_options">Options</string> <string name="title_setup_options">Options</string>

Loading…
Cancel
Save