aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewPostDetailActivity.java10
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/MorePostsInfoFragment.java12
2 files changed, 19 insertions, 3 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