mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-07 03:07:26 +01:00
Minor changes to loading more posts.
This commit is contained in:
parent
cf3595f22d
commit
0ae9b74729
@ -373,7 +373,7 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele
|
||||
viewPager2.registerOnPageChangeCallback(new ViewPager2.OnPageChangeCallback() {
|
||||
@Override
|
||||
public void onPageSelected(int position) {
|
||||
if (posts != null && position > posts.size() - 2) {
|
||||
if (posts != null && position > posts.size() - 5) {
|
||||
fetchMorePosts();
|
||||
}
|
||||
}
|
||||
|
@ -50,14 +50,20 @@ public class MorePostsInfoFragment extends Fragment {
|
||||
public void setStatus(@LoadingMorePostsStatus int status) {
|
||||
this.status = status;
|
||||
switch (status) {
|
||||
case LoadingMorePostsStatus.NOT_LOADING:
|
||||
binding.progressBarViewMorePostsInfoFragment.setVisibility(View.GONE);
|
||||
break;
|
||||
case LoadingMorePostsStatus.LOADING:
|
||||
binding.infoTextViewMorePostsInfoFragment.setText(R.string.loading);
|
||||
binding.progressBarViewMorePostsInfoFragment.setVisibility(View.VISIBLE);
|
||||
break;
|
||||
case LoadingMorePostsStatus.FAILED:
|
||||
binding.infoTextViewMorePostsInfoFragment.setText(R.string.load_more_posts_failed);
|
||||
binding.progressBarViewMorePostsInfoFragment.setVisibility(View.GONE);
|
||||
break;
|
||||
case LoadingMorePostsStatus.NO_MORE_POSTS:
|
||||
binding.infoTextViewMorePostsInfoFragment.setText(R.string.no_more_posts);
|
||||
binding.progressBarViewMorePostsInfoFragment.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,22 +1,34 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
tools:context=".fragments.MorePostsInfoFragment">
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_bar_view_more_posts_info_fragment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toTopOf="@+id/info_text_view_more_posts_info_fragment"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintVertical_chainStyle="packed" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/info_text_view_more_posts_info_fragment"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp"
|
||||
android:textSize="?attr/font_default"
|
||||
android:fontFamily="?attr/font_family"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
android:textSize="?attr/font_18"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintHorizontal_bias="0.5"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent" />
|
||||
app:layout_constraintTop_toBottomOf="@+id/progress_bar_view_more_posts_info_fragment" />
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
Loading…
Reference in New Issue
Block a user