From 2a4cfd9ce1d6f7ce6f0cd69e8700f2dceef27a3a Mon Sep 17 00:00:00 2001 From: Your NameerliteHq Date: Thu, 21 Jan 2021 17:38:52 +0100 Subject: [PATCH] Activate Library --- .../main/java/com/erlite/themelite/ThemeLite.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/themelite/src/main/java/com/erlite/themelite/ThemeLite.java b/themelite/src/main/java/com/erlite/themelite/ThemeLite.java index d7503b6..937ad18 100644 --- a/themelite/src/main/java/com/erlite/themelite/ThemeLite.java +++ b/themelite/src/main/java/com/erlite/themelite/ThemeLite.java @@ -9,7 +9,7 @@ public class ThemeLite { SharedPreferences sharedPreferences; SharedPreferences.Editor editor; - public int setTheme; + public int getTheme, dark, light; public ThemeLite(Context context){ @@ -18,26 +18,28 @@ public ThemeLite(Context context){ //fetch theme for shared prefs - setTheme = sharedPreferences.getInt("ThemeValue", 1); + getTheme = sharedPreferences.getInt("ThemeValue", 1); + dark = AppCompatDelegate.MODE_NIGHT_YES; + light = AppCompatDelegate.MODE_NIGHT_NO; } //save the theme state public void saveTheme(Context context){ - setTheme = AppCompatDelegate.getDefaultNightMode(); + getTheme = AppCompatDelegate.getDefaultNightMode(); sharedPreferences = context.getSharedPreferences("darkLite", Context.MODE_PRIVATE); editor = sharedPreferences.edit(); - editor.putInt("ThemeValue", setTheme); + editor.putInt("ThemeValue", getTheme); editor.apply(); } public void setTheme(){ - AppCompatDelegate.setDefaultNightMode(setTheme); + AppCompatDelegate.setDefaultNightMode(getTheme); } public void light(){