diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java index f6f6ae7..90896e4 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/MainActivity.java @@ -60,7 +60,6 @@ import org.secuso.privacyfriendlysudoku.game.GameDifficulty; import org.secuso.privacyfriendlysudoku.game.GameType; import org.secuso.privacyfriendlysudoku.ui.listener.IImportDialogFragmentListener; import org.secuso.privacyfriendlysudoku.ui.view.R; -import org.secuso.privacyfriendlysudoku.ui.SettingsActivity; import org.secuso.privacyfriendlysudoku.ui.view.databinding.DialogFragmentImportBoardBinding; import java.util.LinkedList; diff --git a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/SettingsActivity.java b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/SettingsActivity.java index c597c5e..da9baf6 100644 --- a/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/SettingsActivity.java +++ b/app/src/main/java/org/secuso/privacyfriendlysudoku/ui/SettingsActivity.java @@ -1,3 +1,22 @@ +/* + * qqwing - Sudoku solver and generator + * Copyright (C) 2014 Stephen Ostermiller + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ + package org.secuso.privacyfriendlysudoku.ui; import android.content.SharedPreferences; @@ -21,22 +40,23 @@ import org.secuso.privacyfriendlysudoku.ui.view.R; public class SettingsActivity extends AppCompatActivity { - private static PreferenceScreen prefScreen; + private static SettingsFragment settingsFragment; private static void recheckNightModeProperties(SharedPreferences sharedPreferences) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) { if (sharedPreferences.getBoolean("pref_dark_mode_setting", false)) { - prefScreen.findPreference("pref_dark_mode_automatically_by_system").setEnabled(false); - prefScreen.findPreference("pref_dark_mode_automatically_by_battery").setEnabled(false); + + settingsFragment.findPreference("pref_dark_mode_automatically_by_system").setEnabled(false); + settingsFragment.findPreference("pref_dark_mode_automatically_by_battery").setEnabled(false); } else { if (sharedPreferences.getBoolean("pref_dark_mode_automatically_by_battery", false) && sharedPreferences.getBoolean("pref_dark_mode_automatically_by_system", false) ) { sharedPreferences.edit().putBoolean("pref_dark_mode_automatically_by_battery", false).commit(); } - prefScreen.findPreference("pref_dark_mode_automatically_by_system").setEnabled(!sharedPreferences.getBoolean("pref_dark_mode_automatically_by_battery", false)); - prefScreen.findPreference("pref_dark_mode_automatically_by_battery").setEnabled(!sharedPreferences.getBoolean("pref_dark_mode_automatically_by_system", false)); + settingsFragment.findPreference("pref_dark_mode_automatically_by_system").setEnabled(!sharedPreferences.getBoolean("pref_dark_mode_automatically_by_battery", false)); + settingsFragment.findPreference("pref_dark_mode_automatically_by_battery").setEnabled(!sharedPreferences.getBoolean("pref_dark_mode_automatically_by_system", false)); }} if (sharedPreferences.getBoolean("pref_dark_mode_setting", false )) { @@ -51,7 +71,7 @@ public class SettingsActivity extends AppCompatActivity { } } - static SharedPreferences.OnSharedPreferenceChangeListener x = new SharedPreferences.OnSharedPreferenceChangeListener() { + static SharedPreferences.OnSharedPreferenceChangeListener sharedPreferenceChangeListener = new SharedPreferences.OnSharedPreferenceChangeListener() { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { @@ -65,19 +85,17 @@ public class SettingsActivity extends AppCompatActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.settings_activity); + settingsFragment = new SettingsFragment(); getSupportFragmentManager() .beginTransaction() - .replace(R.id.settings, new SettingsFragment()) + .replace(R.id.settings, settingsFragment) .commit(); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); } - SharedPreferences preferenceManager = PreferenceManager - .getDefaultSharedPreferences(this); - preferenceManager.registerOnSharedPreferenceChangeListener(x); } @Override @@ -92,14 +110,14 @@ public class SettingsActivity extends AppCompatActivity { public static class SettingsFragment extends PreferenceFragmentCompat { + @Override public void onCreatePreferences(Bundle savedInstanceState, String rootKey) { setPreferencesFromResource(R.xml.pref_settings_general, rootKey); - prefScreen = getPreferenceScreen(); SharedPreferences preferenceManager = PreferenceManager .getDefaultSharedPreferences(getActivity()); + preferenceManager.registerOnSharedPreferenceChangeListener(sharedPreferenceChangeListener); recheckNightModeProperties(preferenceManager); - } } } \ No newline at end of file diff --git a/app/src/main/res/layout-land/activity_main_menu.xml b/app/src/main/res/layout-land/activity_main_menu.xml index 3c80fef..5389f69 100644 --- a/app/src/main/res/layout-land/activity_main_menu.xml +++ b/app/src/main/res/layout-land/activity_main_menu.xml @@ -188,6 +188,8 @@ android:layout_gravity="start" android:fitsSystemWindows="true" android:background="?attr/lightestBackGround" + app:itemTextColor="?attr/menuTextColor" + app:itemIconTint="?attr/menuTextColor" app:menu="@menu/menu_drawer_main" app:headerLayout="@layout/nav_header" /> diff --git a/app/src/main/res/layout-small/activity_main_menu.xml b/app/src/main/res/layout-small/activity_main_menu.xml index bc4f56e..4e1a425 100644 --- a/app/src/main/res/layout-small/activity_main_menu.xml +++ b/app/src/main/res/layout-small/activity_main_menu.xml @@ -264,6 +264,8 @@ android:layout_gravity="start" android:fitsSystemWindows="true" android:background="?attr/lightestBackGround" + app:itemTextColor="?attr/menuTextColor" + app:itemIconTint="?attr/menuTextColor" app:menu="@menu/menu_drawer_main" app:headerLayout="@layout/nav_header" /> diff --git a/app/src/main/res/layout-xlarge/activity_main_menu.xml b/app/src/main/res/layout-xlarge/activity_main_menu.xml index efc0bf4..9d7e4d7 100644 --- a/app/src/main/res/layout-xlarge/activity_main_menu.xml +++ b/app/src/main/res/layout-xlarge/activity_main_menu.xml @@ -258,6 +258,8 @@ android:layout_gravity="start" android:fitsSystemWindows="true" android:background="?attr/lightestBackGround" + app:itemTextColor="?attr/menuTextColor" + app:itemIconTint="?attr/menuTextColor" app:menu="@menu/menu_drawer_main" app:headerLayout="@layout/nav_header" /> diff --git a/app/src/main/res/layout/activity_main_menu.xml b/app/src/main/res/layout/activity_main_menu.xml index 994640b..d9d2314 100644 --- a/app/src/main/res/layout/activity_main_menu.xml +++ b/app/src/main/res/layout/activity_main_menu.xml @@ -259,6 +259,8 @@ android:layout_gravity="start" android:fitsSystemWindows="true" android:background="?attr/lightestBackGround" + app:itemTextColor="?attr/menuTextColor" + app:itemIconTint="?attr/menuTextColor" app:menu="@menu/menu_drawer_main" app:headerLayout="@layout/nav_header" /> diff --git a/app/src/main/res/values-night/styles.xml b/app/src/main/res/values-night/styles.xml index caa711a..7c98ec8 100644 --- a/app/src/main/res/values-night/styles.xml +++ b/app/src/main/res/values-night/styles.xml @@ -24,6 +24,7 @@ @color/cardview_dark_background @color/colorPrimaryDark @color/colorPrimaryDark + @color/white