diff options
author | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2022-11-06 06:22:15 +0000 |
---|---|---|
committer | Docile-Alligator <25734209+Docile-Alligator@users.noreply.github.com> | 2022-11-06 06:22:15 +0000 |
commit | 93e98b4cb57c2105880a2005c95ba37866fa1e1d (patch) | |
tree | 7fdf4c90607bb006e80672265d8152b8c80448c9 /app/src/main | |
parent | ff10eb5f92810f2f1a1ca2ba5617a035957509ad (diff) | |
download | infinity-for-reddit-93e98b4cb57c2105880a2005c95ba37866fa1e1d.tar infinity-for-reddit-93e98b4cb57c2105880a2005c95ba37866fa1e1d.tar.gz infinity-for-reddit-93e98b4cb57c2105880a2005c95ba37866fa1e1d.tar.bz2 infinity-for-reddit-93e98b4cb57c2105880a2005c95ba37866fa1e1d.tar.lz infinity-for-reddit-93e98b4cb57c2105880a2005c95ba37866fa1e1d.tar.xz infinity-for-reddit-93e98b4cb57c2105880a2005c95ba37866fa1e1d.tar.zst infinity-for-reddit-93e98b4cb57c2105880a2005c95ba37866fa1e1d.zip |
Retry loading more posts.
Diffstat (limited to 'app/src/main')
4 files changed, 21 insertions, 4 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java index 78eef4e4..651dbfd1 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java @@ -294,6 +294,11 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele searchTextInputEditText.setImeOptions(searchTextInputEditText.getImeOptions() | EditorInfoCompat.IME_FLAG_NO_PERSONALIZED_LEARNING); } + if (loadingMorePostsStatus == LoadingMorePostsStatus.LOADING) { + loadingMorePostsStatus = LoadingMorePostsStatus.NOT_LOADING; + fetchMorePosts(); + } + checkNewAccountAndBindView(savedInstanceState); } @@ -515,6 +520,11 @@ public class ViewPostDetailActivity extends BaseActivity implements SortTypeSele loadingMorePostsStatus = LoadingMorePostsStatus.LOADING; + MorePostsInfoFragment morePostsFragment = sectionsPagerAdapter.getMorePostsInfoFragment(); + if (morePostsFragment != null) { + morePostsFragment.setStatus(LoadingMorePostsStatus.LOADING); + } + Handler handler = new Handler(Looper.getMainLooper()); if (postType != HistoryPostPagingSource.TYPE_READ_POSTS) { diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/MorePostsInfoFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/MorePostsInfoFragment.java index c5ec1266..151d5ec4 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/MorePostsInfoFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/MorePostsInfoFragment.java @@ -14,7 +14,7 @@ import javax.inject.Inject; import ml.docilealligator.infinityforreddit.Infinity; import ml.docilealligator.infinityforreddit.LoadingMorePostsStatus; import ml.docilealligator.infinityforreddit.R; -import ml.docilealligator.infinityforreddit.activities.BaseActivity; +import ml.docilealligator.infinityforreddit.activities.ViewPostDetailActivity; import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper; import ml.docilealligator.infinityforreddit.databinding.FragmentMorePostsInfoBinding; @@ -25,7 +25,7 @@ public class MorePostsInfoFragment extends Fragment { @Inject CustomThemeWrapper mCustomThemeWrapper; private FragmentMorePostsInfoBinding binding; - private BaseActivity mActivity; + private ViewPostDetailActivity mActivity; @LoadingMorePostsStatus int status; @@ -44,6 +44,12 @@ public class MorePostsInfoFragment extends Fragment { setStatus(getArguments().getInt(EXTRA_STATUS, LoadingMorePostsStatus.LOADING)); + binding.getRoot().setOnClickListener(view -> { + if (status == LoadingMorePostsStatus.FAILED) { + mActivity.fetchMorePosts(); + } + }); + return binding.getRoot(); } @@ -74,6 +80,6 @@ public class MorePostsInfoFragment extends Fragment { @Override public void onAttach(@NonNull Context context) { super.onAttach(context); - mActivity = (BaseActivity) context; + mActivity = (ViewPostDetailActivity) context; } }
\ No newline at end of file diff --git a/app/src/main/res/layout/fragment_more_posts_info.xml b/app/src/main/res/layout/fragment_more_posts_info.xml index 86e9e06e..55193887 100644 --- a/app/src/main/res/layout/fragment_more_posts_info.xml +++ b/app/src/main/res/layout/fragment_more_posts_info.xml @@ -22,6 +22,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="16dp" + android:gravity="center" android:fontFamily="?attr/font_family" android:textSize="?attr/font_18" app:layout_constraintBottom_toBottomOf="parent" diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 8d983cae..f7bb044b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1312,7 +1312,7 @@ <string name="invalid_regex">Invalid regex pattern</string> - <string name="load_more_posts_failed">Failed to load more posts</string> + <string name="load_more_posts_failed">Failed to load more posts.\nTap to retry.</string> <string name="no_more_posts">No more posts</string> </resources> |