+
+ NumberFormat newNumberFormatter = NumberFormat.getNumberInstance();
+ newNumberFormatter.setParseIntegerOnly(false);
+ newNumberFormatter.setGroupingUsed(true);
+ newNumberFormatter.setGroupingUsed(true);
+ newNumberFormatter.setMinimumIntegerDigits(1);
+ newNumberFormatter.setMinimumFractionDigits(2);
+
+ numberFormatter = newNumberFormatter;
+ }
+ public static String formatCurrency(float number) {
+ NumberFormat formatter = NumberFormat.getCurrencyInstance(locale.getValue());
+ return formatter.format(number);
+ }
+ public static String formatNumber(float number) {
+ return numberFormatter.format(number);
+ }
+ public static void observeProfile(LifecycleOwner lifecycleOwner,
+ Observer<MobileLedgerProfile> observer) {
+ profile.observe(lifecycleOwner, observer);
+ }
+ public synchronized static MobileLedgerProfile initProfile() {
+ MobileLedgerProfile currentProfile = profile.getValue();
+ if (currentProfile != null)
+ return currentProfile;
+
+ long profileId = MLDB.getLongOption(MLDB.OPT_PROFILE_ID, 0);
+ MobileLedgerProfile startupProfile = getProfile(profileId);
+ if (startupProfile != null)
+ setCurrentProfile(startupProfile);
+ Logger.debug("profile", "initProfile() returning " + startupProfile);
+ return startupProfile;