- // Get a handle for the shared preferences.
- SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getContext());
-
- // Get the screenshot and theme preferences.
- boolean darkTheme = sharedPreferences.getBoolean("dark_theme", false);
- boolean allowScreenshots = sharedPreferences.getBoolean("allow_screenshots", false);
+ // Get the current theme status.
+ int currentThemeStatus = getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK;