mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-28 11:58:23 +01:00
Fix screen staying at MorePostsInfoFragment after retrying.
This commit is contained in:
parent
93e98b4cb5
commit
fd63dba91b
@ -296,7 +296,7 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele
|
|||||||
|
|
||||||
if (loadingMorePostsStatus == LoadingMorePostsStatus.LOADING) {
|
if (loadingMorePostsStatus == LoadingMorePostsStatus.LOADING) {
|
||||||
loadingMorePostsStatus = LoadingMorePostsStatus.NOT_LOADING;
|
loadingMorePostsStatus = LoadingMorePostsStatus.NOT_LOADING;
|
||||||
fetchMorePosts();
|
fetchMorePosts(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
checkNewAccountAndBindView(savedInstanceState);
|
checkNewAccountAndBindView(savedInstanceState);
|
||||||
@ -379,7 +379,7 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele
|
|||||||
@Override
|
@Override
|
||||||
public void onPageSelected(int position) {
|
public void onPageSelected(int position) {
|
||||||
if (posts != null && position > posts.size() - 5) {
|
if (posts != null && position > posts.size() - 5) {
|
||||||
fetchMorePosts();
|
fetchMorePosts(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -513,7 +513,7 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void fetchMorePosts() {
|
public void fetchMorePosts(boolean changePage) {
|
||||||
if (loadingMorePostsStatus == LoadingMorePostsStatus.LOADING || loadingMorePostsStatus == LoadingMorePostsStatus.NO_MORE_POSTS) {
|
if (loadingMorePostsStatus == LoadingMorePostsStatus.LOADING || loadingMorePostsStatus == LoadingMorePostsStatus.NO_MORE_POSTS) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -670,6 +670,9 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele
|
|||||||
} else {
|
} else {
|
||||||
posts = new ArrayList<>(postLinkedHashSet);
|
posts = new ArrayList<>(postLinkedHashSet);
|
||||||
handler.post(() -> {
|
handler.post(() -> {
|
||||||
|
if (changePage) {
|
||||||
|
viewPager2.setCurrentItem(currentPostsSize - 1, false);
|
||||||
|
}
|
||||||
sectionsPagerAdapter.notifyItemRangeInserted(currentPostsSize, postLinkedHashSet.size() - currentPostsSize);
|
sectionsPagerAdapter.notifyItemRangeInserted(currentPostsSize, postLinkedHashSet.size() - currentPostsSize);
|
||||||
loadingMorePostsStatus = LoadingMorePostsStatus.NOT_LOADING;
|
loadingMorePostsStatus = LoadingMorePostsStatus.NOT_LOADING;
|
||||||
MorePostsInfoFragment fragment = sectionsPagerAdapter.getMorePostsInfoFragment();
|
MorePostsInfoFragment fragment = sectionsPagerAdapter.getMorePostsInfoFragment();
|
||||||
@ -749,6 +752,9 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele
|
|||||||
} else {
|
} else {
|
||||||
posts = new ArrayList<>(postLinkedHashSet);
|
posts = new ArrayList<>(postLinkedHashSet);
|
||||||
handler.post(() -> {
|
handler.post(() -> {
|
||||||
|
if (changePage) {
|
||||||
|
viewPager2.setCurrentItem(currentPostsSize - 1, false);
|
||||||
|
}
|
||||||
sectionsPagerAdapter.notifyItemRangeInserted(currentPostsSize, postLinkedHashSet.size() - currentPostsSize);
|
sectionsPagerAdapter.notifyItemRangeInserted(currentPostsSize, postLinkedHashSet.size() - currentPostsSize);
|
||||||
loadingMorePostsStatus = LoadingMorePostsStatus.NOT_LOADING;
|
loadingMorePostsStatus = LoadingMorePostsStatus.NOT_LOADING;
|
||||||
MorePostsInfoFragment fragment = sectionsPagerAdapter.getMorePostsInfoFragment();
|
MorePostsInfoFragment fragment = sectionsPagerAdapter.getMorePostsInfoFragment();
|
||||||
|
@ -46,7 +46,7 @@ public class MorePostsInfoFragment extends Fragment {
|
|||||||
|
|
||||||
binding.getRoot().setOnClickListener(view -> {
|
binding.getRoot().setOnClickListener(view -> {
|
||||||
if (status == LoadingMorePostsStatus.FAILED) {
|
if (status == LoadingMorePostsStatus.FAILED) {
|
||||||
mActivity.fetchMorePosts();
|
mActivity.fetchMorePosts(true);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user