X-Git-Url: https://git.ktnx.net/?a=blobdiff_plain;f=app%2Fsrc%2Fmain%2Fjava%2Fnet%2Fktnx%2Fmobileledger%2Fui%2Factivity%2FMainActivity.java;h=33bcbb005c32a855819091f4bedebf21b4a1d802;hb=0a73337c99e2074aa7e7228204289896342ec636;hp=3a210ef07720d04b9396e5b36d37ca504952e987;hpb=d08ab8235d0fd152c772b2dd5ffa1ca5747f67b1;p=mobile-ledger.git diff --git a/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java b/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java index 3a210ef0..33bcbb00 100644 --- a/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java +++ b/app/src/main/java/net/ktnx/mobileledger/ui/activity/MainActivity.java @@ -30,7 +30,6 @@ import android.os.Build; import android.os.Bundle; import android.util.Log; import android.view.View; -import android.view.ViewGroup; import android.view.animation.AnimationUtils; import android.widget.LinearLayout; import android.widget.ProgressBar; @@ -55,7 +54,6 @@ import net.ktnx.mobileledger.R; import net.ktnx.mobileledger.async.RefreshDescriptionsTask; import net.ktnx.mobileledger.async.RetrieveTransactionsTask; import net.ktnx.mobileledger.model.Data; -import net.ktnx.mobileledger.model.LedgerAccount; import net.ktnx.mobileledger.model.MobileLedgerProfile; import net.ktnx.mobileledger.ui.account_summary.AccountSummaryFragment; import net.ktnx.mobileledger.ui.profiles.ProfileDetailFragment; @@ -387,6 +385,15 @@ public class MainActivity extends ProfileThemedActivity { * called when the current profile has changed */ private void onProfileChanged(MobileLedgerProfile profile) { + if (this.profile == null) { + if (profile == null) + return; + } + else { + if (this.profile.equals(profile)) + return; + } + boolean haveProfile = profile != null; if (haveProfile) @@ -395,7 +402,7 @@ public class MainActivity extends ProfileThemedActivity { setTitle(R.string.app_name); if (this.profile != null) - this.profile.getAccounts() + this.profile.getDisplayedAccounts() .removeObservers(this); this.profile = profile; @@ -525,7 +532,7 @@ public class MainActivity extends ProfileThemedActivity { public void onLatestTransactionsClicked(View view) { drawer.closeDrawers(); - showTransactionsFragment((String) null); + showTransactionsFragment(null); } public void showTransactionsFragment(String accName) { Data.accountFilter.setValue(accName); @@ -630,36 +637,8 @@ public class MainActivity extends ProfileThemedActivity { public void fabHide() { fab.hide(); } - public void onAccountSummaryRowViewClicked(View view) { - ViewGroup row; - switch (view.getId()) { - case R.id.account_expander: - row = (ViewGroup) view.getParent() - .getParent() - .getParent(); - break; - case R.id.account_expander_container: - case R.id.account_row_acc_name: - row = (ViewGroup) view.getParent() - .getParent(); - break; - default: - row = (ViewGroup) view.getParent(); - break; - } - - LedgerAccount acc = (LedgerAccount) row.getTag(); - switch (view.getId()) { - case R.id.account_row_acc_name: - case R.id.account_expander: - case R.id.account_expander_container: - break; - case R.id.account_row_acc_amounts: - break; - } - } - public class SectionsPagerAdapter extends FragmentPagerAdapter { + public static class SectionsPagerAdapter extends FragmentPagerAdapter { SectionsPagerAdapter(FragmentManager fm) { super(fm, BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT);