From 8ea049c9569ec938895e06b90d4c3fb8f3281c2f Mon Sep 17 00:00:00 2001 From: Grishka Date: Thu, 7 Nov 2024 14:04:40 +0300 Subject: [PATCH] Fix refresh --- .../android/fragments/ProfileFragment.java | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java index 15b13d9c..3949c678 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/ProfileFragment.java @@ -442,16 +442,18 @@ public class ProfileFragment extends LoaderFragment implements ScrollableToTop, if(savedFragment==null && isOwnProfile){ savedFragment=SavedPostsTimelineFragment.newInstance(accountID, account, false); } - 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; - } - }); + if(!refreshing){ + 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(); }