Skip to content

Commit

Permalink
minor finetuning theming
Browse files Browse the repository at this point in the history
  • Loading branch information
edeso committed Apr 9, 2024
1 parent 49ff0fe commit a2eaf9b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion app/src/main/java/com/nkanaev/comics/MainApplication.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.app.Application;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.res.Configuration;
import androidx.appcompat.app.AppCompatDelegate;
import androidx.multidex.MultiDexApplication;

Expand All @@ -22,7 +23,6 @@ public void onCreate() {
switch (mode) {
case AppCompatDelegate.MODE_NIGHT_NO:
case AppCompatDelegate.MODE_NIGHT_YES:
case AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM:
break;
default:
mode = default_mode;
Expand All @@ -37,4 +37,9 @@ public static Context getAppContext() {
public static SharedPreferences getPreferences() {
return instance.getSharedPreferences(Constants.SETTINGS_NAME, 0);
}

public static boolean isNightModeEnabled(){
return ( getAppContext().getResources().getConfiguration().uiMode &
Configuration.UI_MODE_NIGHT_MASK ) == Configuration.UI_MODE_NIGHT_YES;
}
}

0 comments on commit a2eaf9b

Please sign in to comment.