From 143b008be245416ba576446aa5f8cdc486c64426 Mon Sep 17 00:00:00 2001 From: Soren Stoutner Date: Thu, 3 Nov 2022 15:06:20 -0700 Subject: [PATCH] Use SwitchPreferenceCompat in the Settings layout. https://redmine.stoutner.com/issues/759 --- app/build.gradle | 4 +- .../fragments/SettingsFragment.kt | 2 +- app/src/main/res/xml/preferences.xml | 66 +++++++++---------- build.gradle | 4 +- 4 files changed, 38 insertions(+), 38 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index ae0f7fa9..2c4082ce 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,5 +1,5 @@ /* - * Copyright © 2016-2022 Soren Stoutner . + * Copyright 2016-2022 Soren Stoutner . * * This file is part of Privacy Browser Android . * @@ -85,4 +85,4 @@ dependencies { // Include the Google material library. implementation 'com.google.android.material:material:1.7.0' -} \ No newline at end of file +} diff --git a/app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.kt b/app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.kt index e8f2197c..d73c905f 100644 --- a/app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.kt +++ b/app/src/main/java/com/stoutner/privacybrowser/fragments/SettingsFragment.kt @@ -1050,7 +1050,7 @@ class SettingsFragment : PreferenceFragmentCompat() { } getString(R.string.app_theme_key) -> { - // Get the app theme entry number that matches the current app theme. A switch statement cannot be used because the theme entry values string array is not a compile time constant. + // Get the app theme entry number that matches the current app theme. val appThemeEntryNumber: Int = when (sharedPreferences.getString(getString(R.string.app_theme_key), getString(R.string.app_theme_default_value))) { appThemeEntryValuesStringArray[1] -> 1 // The light theme is selected. appThemeEntryValuesStringArray[2] -> 2 // The dark theme is selected. diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 5e72cfad..47fa1d64 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -1,7 +1,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file + diff --git a/build.gradle b/build.gradle index 4c4ece74..dedcda3d 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ /* - * Copyright © 2016-2022 Soren Stoutner . + * Copyright 2016-2022 Soren Stoutner . * * This file is part of Privacy Browser Android . * @@ -39,4 +39,4 @@ allprojects { google() mavenCentral() } -} \ No newline at end of file +} -- 2.45.2