]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/App.java
completely abandon fiddling with KeyListener's
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / App.java
index 920187e9fb54d98b69e0766ff097031ae0b53c7a..d6b1ffaf7afc784ebd41ccb5a1227bf2e1bb47ac 100644 (file)
 package net.ktnx.mobileledger;
 
 import android.app.Application;
-import android.content.SharedPreferences;
 import android.content.res.Configuration;
 import android.content.res.Resources;
 import android.database.sqlite.SQLiteDatabase;
-import android.preference.PreferenceManager;
 import android.util.Log;
 
 import net.ktnx.mobileledger.model.Data;
@@ -35,8 +33,7 @@ import java.net.Authenticator;
 import java.net.MalformedURLException;
 import java.net.PasswordAuthentication;
 import java.net.URL;
-
-import static net.ktnx.mobileledger.ui.activity.SettingsActivity.PREF_KEY_SHOW_ONLY_STARRED_ACCOUNTS;
+import java.util.Locale;
 
 public class App extends Application {
     public static App instance;
@@ -52,12 +49,7 @@ public class App extends Application {
         instance = this;
         super.onCreate();
         updateMonthNames();
-        SharedPreferences p = PreferenceManager.getDefaultSharedPreferences(this);
-        Data.optShowOnlyStarred.set(p.getBoolean(PREF_KEY_SHOW_ONLY_STARRED_ACCOUNTS, false));
-        SharedPreferences.OnSharedPreferenceChangeListener handler =
-                (preference, value) -> Data.optShowOnlyStarred
-                        .set(preference.getBoolean(PREF_KEY_SHOW_ONLY_STARRED_ACCOUNTS, false));
-        p.registerOnSharedPreferenceChangeListener(handler);
+        Data.refreshCurrencyData(Locale.getDefault());
         Authenticator.setDefault(new Authenticator() {
             @Override
             protected PasswordAuthentication getPasswordAuthentication() {
@@ -97,6 +89,8 @@ public class App extends Application {
     public void onConfigurationChanged(Configuration newConfig) {
         super.onConfigurationChanged(newConfig);
         updateMonthNames();
+        Data.refreshCurrencyData(Locale.getDefault());
+        Data.locale.setValue(Locale.getDefault());
     }
     public SQLiteDatabase getDB() {
         if (dbHelper == null) initDb();