protected void onStart() {
super.onStart();
- debug("flow", "MainActivity.onStart()");
+ debug("flow", String.format(Locale.ENGLISH,
+ "MainActivity.onStart(), currentPage is %d, accountFilter is %s", mCurrentPage,
+ (mAccountFilter == null) ? "<NULL>" : mAccountFilter));
mViewPager.setCurrentItem(mCurrentPage, false);
if (mAccountFilter != null) showTransactionsFragment(mAccountFilter);
else Data.accountFilter.setValue(null);
if (mProfileListAdapter == null) mProfileListAdapter = new ProfilesRecyclerViewAdapter();
root.setAdapter(mProfileListAdapter);
- mProfileListAdapter.editingProfiles
- .observe(this, newValue -> {
- if (newValue) {
- profileListHeadMore.setVisibility(View.GONE);
- profileListHeadCancel.setVisibility(View.VISIBLE);
- profileListHeadAddProfile.setVisibility(View.VISIBLE);
- if (drawer.isDrawerOpen(GravityCompat.START)) {
- profileListHeadMore.startAnimation(AnimationUtils
- .loadAnimation(MainActivity.this, R.anim.fade_out));
- profileListHeadCancel.startAnimation(AnimationUtils
- .loadAnimation(MainActivity.this, R.anim.fade_in));
- profileListHeadAddProfile.startAnimation(AnimationUtils
- .loadAnimation(MainActivity.this, R.anim.fade_in));
- }
- }
- else {
- profileListHeadCancel.setVisibility(View.GONE);
- profileListHeadMore.setVisibility(View.VISIBLE);
- profileListHeadAddProfile.setVisibility(View.GONE);
- if (drawer.isDrawerOpen(GravityCompat.START)) {
- profileListHeadCancel.startAnimation(AnimationUtils
- .loadAnimation(MainActivity.this, R.anim.fade_out));
- profileListHeadMore.startAnimation(AnimationUtils
- .loadAnimation(MainActivity.this, R.anim.fade_in));
- profileListHeadAddProfile.startAnimation(AnimationUtils
- .loadAnimation(MainActivity.this, R.anim.fade_out));
- }
- }
+ mProfileListAdapter.editingProfiles.observe(this, newValue -> {
+ if (newValue) {
+ profileListHeadMore.setVisibility(View.GONE);
+ profileListHeadCancel.setVisibility(View.VISIBLE);
+ profileListHeadAddProfile.setVisibility(View.VISIBLE);
+ if (drawer.isDrawerOpen(GravityCompat.START)) {
+ profileListHeadMore.startAnimation(
+ AnimationUtils.loadAnimation(MainActivity.this, R.anim.fade_out));
+ profileListHeadCancel.startAnimation(
+ AnimationUtils.loadAnimation(MainActivity.this, R.anim.fade_in));
+ profileListHeadAddProfile.startAnimation(
+ AnimationUtils.loadAnimation(MainActivity.this, R.anim.fade_in));
+ }
+ }
+ else {
+ profileListHeadCancel.setVisibility(View.GONE);
+ profileListHeadMore.setVisibility(View.VISIBLE);
+ profileListHeadAddProfile.setVisibility(View.GONE);
+ if (drawer.isDrawerOpen(GravityCompat.START)) {
+ profileListHeadCancel.startAnimation(
+ AnimationUtils.loadAnimation(MainActivity.this, R.anim.fade_out));
+ profileListHeadMore.startAnimation(
+ AnimationUtils.loadAnimation(MainActivity.this, R.anim.fade_in));
+ profileListHeadAddProfile.startAnimation(
+ AnimationUtils.loadAnimation(MainActivity.this, R.anim.fade_out));
+ }
+ }
- mProfileListAdapter.notifyDataSetChanged();
- });
+ mProfileListAdapter.notifyDataSetChanged();
+ });
LinearLayoutManager llm = new LinearLayoutManager(this);
profileListHeadCancel.setOnClickListener((v) -> mProfileListAdapter.flipEditingProfiles());
profileListHeadMoreAndCancel
.setOnClickListener((v) -> mProfileListAdapter.flipEditingProfiles());
-
+ if (drawerListener == null) {
+ drawerListener = new DrawerLayout.SimpleDrawerListener() {
+ @Override
+ public void onDrawerClosed(View drawerView) {
+ super.onDrawerClosed(drawerView);
+ mProfileListAdapter.setAnimationsEnabled(false);
+ mProfileListAdapter.editingProfiles.setValue(false);
+ }
+ @Override
+ public void onDrawerOpened(View drawerView) {
+ super.onDrawerOpened(drawerView);
+ mProfileListAdapter.setAnimationsEnabled(true);
+ }
+ };
+ drawer.addDrawerListener(drawerListener);
+ }
setupProfile();
}
private void scheduleDataRetrievalIfStale(Date lastUpdate) {