X-Git-Url: http://gitweb.fperrin.net/?a=blobdiff_plain;f=src%2Fcom%2Fhughes%2Fandroid%2Fdictionary%2FDictionaryApplication.java;h=840f8ffa30ce7523d7c517155f835049a9edcc56;hb=9007f9e11eb1f784a588e0526827e768307e4f8d;hp=1e3788be869e7d830511705e391282e1af33c0ca;hpb=c76660b2772122109529d3616289980a7084eeeb;p=Dictionary.git diff --git a/src/com/hughes/android/dictionary/DictionaryApplication.java b/src/com/hughes/android/dictionary/DictionaryApplication.java index 1e3788b..840f8ff 100644 --- a/src/com/hughes/android/dictionary/DictionaryApplication.java +++ b/src/com/hughes/android/dictionary/DictionaryApplication.java @@ -18,6 +18,7 @@ import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; import android.content.SharedPreferences.OnSharedPreferenceChangeListener; +import android.content.res.Configuration; import android.net.Uri; import android.os.Build; import android.os.Environment; @@ -313,6 +314,12 @@ public enum DictionaryApplication { final String theme = prefs.getString(appContext.getString(R.string.themeKey), "themeLight"); if (theme.equals("themeLight")) { return Theme.LIGHT; + } else if (theme.equals("themeSystem")) { + int mode = (appContext.getResources().getConfiguration().uiMode & + Configuration.UI_MODE_NIGHT_MASK); + return ((mode == Configuration.UI_MODE_NIGHT_NO) ? + Theme.LIGHT: + Theme.DEFAULT); } else { return Theme.DEFAULT; }