Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanGarf committed Jun 15, 2020
1 parent 5d36c85 commit 1e2d83a
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,9 @@ public AccountViewPagerAdapter(FragmentManager fm){
@Override
public Fragment getItem(int i) {
AccountsListFragment currentFragment = (AccountsListFragment) mFragmentPageReferenceMap.get(i);

if (currentFragment == null) {

switch (i) {
case INDEX_RECENT_ACCOUNTS_FRAGMENT:
currentFragment = AccountsListFragment.newInstance(AccountsListFragment.DisplayMode.RECENT);
Expand All @@ -169,13 +171,16 @@ public Fragment getItem(int i) {
currentFragment = AccountsListFragment.newInstance(AccountsListFragment.DisplayMode.TOP_LEVEL);
break;
}

mFragmentPageReferenceMap.put(i, currentFragment);

}
return currentFragment;
}

@Override
public void destroyItem(ViewGroup container, int position, Object object) {
// #586 By putting this in comment, there is no more crash, but I don't know if there are side effects
super.destroyItem(container, position, object);
mFragmentPageReferenceMap.remove(position);
}
Expand Down Expand Up @@ -376,6 +381,7 @@ private void init() {
@Override
protected void onDestroy() {
super.onDestroy();

SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(this);
preferences.edit().putInt(LAST_OPEN_TAB_INDEX, mViewPager.getCurrentItem()).apply();
}
Expand Down

0 comments on commit 1e2d83a

Please sign in to comment.