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();
public static MutableLiveData<Currency.Position> currencySymbolPosition =
new MutableLiveData<>();
public static MutableLiveData<Boolean> currencyGap = new MutableLiveData<>(true);
+ public static MutableLiveData<Locale> locale = new MutableLiveData<>(Locale.getDefault());
private static AtomicInteger backgroundTaskCount = new AtomicInteger(0);
private static Locker profilesLocker = new Locker();
private static RetrieveTransactionsTask retrieveTransactionsTask;
private Observer<Boolean> editableObserver;
private Observer<Boolean> commentVisibleObserver;
private Observer<String> commentObserver;
+ private Observer<Locale> localeObserver;
private boolean inUpdate = false;
private boolean syncingData = false;
private View commentButton;
tvComment.addTextChangedListener(tw);
tvAmount.addTextChangedListener(amountWatcher);
- // FIXME: react on locale changes
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
tvAmount.setKeyListener(DigitsKeyListener.getInstance(Locale.getDefault(), true, true));
else
else
tvAmount.setImeOptions(EditorInfo.IME_ACTION_NEXT);
};
+
+ localeObserver = locale -> {
+ if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O)
+ tvAmount.setKeyListener(DigitsKeyListener.getInstance(locale, true, true));
+ };
}
private void setEditable(Boolean editable) {
tvDate.setEnabled(editable);
.stopObservingFocusedItem(focusedAccountObserver);
this.item.getModel()
.stopObservingAccountCount(accountCountObserver);
+ Data.locale.removeObserver(localeObserver);
this.item = null;
}
.observeFocusedItem(activity, focusedAccountObserver);
item.getModel()
.observeAccountCount(activity, accountCountObserver);
+ Data.locale.observe(activity, localeObserver);
}
}
finally {