Fix default tab in profile

This commit is contained in:
Grishka 2023-05-23 12:17:26 +03:00
parent bd7157c172
commit 36f1a557d7
1 changed files with 9 additions and 2 deletions

View File

@ -362,6 +362,15 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
aboutFragment.setFields(fields); aboutFragment.setFields(fields);
} }
pager.getAdapter().notifyDataSetChanged(); pager.getAdapter().notifyDataSetChanged();
pager.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener(){
@Override
public boolean onPreDraw(){
pager.getViewTreeObserver().removeOnPreDrawListener(this);
pager.setCurrentItem(1, false);
tabbar.selectTab(tabbar.getTabAt(1));
return true;
}
});
super.dataLoaded(); super.dataLoaded();
} }
@ -391,8 +400,6 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
refreshLayout.setEnabled(state!=ViewPager2.SCROLL_STATE_DRAGGING); refreshLayout.setEnabled(state!=ViewPager2.SCROLL_STATE_DRAGGING);
} }
}); });
pager.setCurrentItem(1, false);
tabbar.selectTab(tabbar.getTabAt(1));
return true; return true;
} }
}); });