/*
- * Copyright © 2021 Damyan Ivanov.
+ * Copyright © 2024 Damyan Ivanov.
* This file is part of MoLe.
* MoLe is free software: you can distribute it and/or modify it
* under the term of the GNU General Public License as published by
public static final String PREF_NAME = "MoLe";
public static final String PREF_THEME_HUE = "theme-hue";
public static final String PREF_PROFILE_ID = "profile-id";
+ public static final String PREF_SHOW_ZERO_BALANCE_ACCOUNTS = "show-zero-balance-accounts";
public static App instance;
private static ProfileDetailModel profileModel;
private boolean monthNamesPrepared = false;
SharedPreferences prefs = instance.getSharedPreferences(PREF_NAME, MODE_PRIVATE);
return prefs.getInt(PREF_THEME_HUE, Colors.DEFAULT_HUE_DEG);
}
+ public static boolean getShowZeroBalanceAccounts() {
+ SharedPreferences prefs = instance.getSharedPreferences(PREF_NAME, MODE_PRIVATE);
+ return prefs.getBoolean(PREF_SHOW_ZERO_BALANCE_ACCOUNTS, true);
+ }
+ public static void storeShowZeroBalanceAccounts(boolean value) {
+ SharedPreferences prefs = instance.getSharedPreferences(PREF_NAME, MODE_PRIVATE);
+ SharedPreferences.Editor editor = prefs.edit();
+ editor.putBoolean(PREF_SHOW_ZERO_BALANCE_ACCOUNTS, value);
+ editor.apply();
+ }
private String getAuthURL() {
if (profileModel != null)
return profileModel.getUrl();
import androidx.recyclerview.widget.RecyclerView;
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout;
+import net.ktnx.mobileledger.App;
import net.ktnx.mobileledger.R;
import net.ktnx.mobileledger.async.GeneralBackgroundTasks;
import net.ktnx.mobileledger.databinding.AccountSummaryFragmentBinding;
Data.observeProfile(this, profile -> onProfileChanged(profile, Boolean.TRUE.equals(
model.getShowZeroBalanceAccounts()
.getValue())));
+ model.getShowZeroBalanceAccounts()
+ .setValue(App.getShowZeroBalanceAccounts());
}
@Override
public void onCreateOptionsMenu(@NotNull Menu menu, @NotNull MenuInflater inflater) {
.observe(this, v -> {
menuShowZeroBalances.setChecked(v);
onProfileChanged(Data.getProfile(), v);
+ App.storeShowZeroBalanceAccounts(v);
});
super.onCreateOptionsMenu(menu, inflater);