Added grey system theme

This commit is contained in:
M66B 2019-09-09 11:40:14 +02:00
parent 3867ad25fa
commit ad0e77ecc6
4 changed files with 82 additions and 54 deletions

View File

@ -87,6 +87,13 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
Log.i("UI mode=" + uiMode);
if ((uiMode & Configuration.UI_MODE_NIGHT_YES) != 0)
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);
}
}

View File

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

View File

@ -1,69 +1,83 @@
<?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"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="12dp">
<RadioGroup
android:id="@+id/rgTheme"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
android:layout_height="wrap_content">
<RadioButton
android:id="@+id/rbThemeLight"
<RadioGroup
android:id="@+id/rgTheme"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="6dp"
android:text="@string/title_setup_light_theme"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
android:orientation="vertical"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<RadioButton
android:id="@+id/rbThemeDark"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:padding="6dp"
android:text="@string/title_setup_dark_theme"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<RadioButton
android:id="@+id/rbThemeLight"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="6dp"
android:text="@string/title_setup_light_theme"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<RadioButton
android:id="@+id/rbThemeBlack"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:padding="6dp"
android:text="@string/title_setup_black_theme"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<RadioButton
android:id="@+id/rbThemeDark"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:padding="6dp"
android:text="@string/title_setup_dark_theme"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<RadioButton
android:id="@+id/rbThemeGreyLight"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:padding="6dp"
android:text="@string/title_setup_grey_light_theme"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<RadioButton
android:id="@+id/rbThemeBlack"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:padding="6dp"
android:text="@string/title_setup_black_theme"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<RadioButton
android:id="@+id/rbThemeGreyDark"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:padding="6dp"
android:text="@string/title_setup_grey_dark_theme"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<RadioButton
android:id="@+id/rbThemeGreyLight"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:padding="6dp"
android:text="@string/title_setup_grey_light_theme"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<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" />
</RadioGroup>
</androidx.constraintlayout.widget.ConstraintLayout>
<RadioButton
android:id="@+id/rbThemeGreyDark"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:padding="6dp"
android:text="@string/title_setup_grey_dark_theme"
android:textAppearance="@style/TextAppearance.AppCompat.Medium" />
<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>

View File

@ -185,6 +185,7 @@
<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_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_options">Options</string>