aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-09-04 17:48:23 +0000
committerDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-09-04 17:48:23 +0000
commit478b2db4e583ff4577e421f1f115ef8d4d7626ef (patch)
tree106180929cb977c24339d8251e1d317a191e7ee8 /app/src/main/java
parent5d12ff78efcccbdf8c2c6bd8c99ef357703c06f0 (diff)
downloadinfinity-for-reddit-478b2db4e583ff4577e421f1f115ef8d4d7626ef.tar
infinity-for-reddit-478b2db4e583ff4577e421f1f115ef8d4d7626ef.tar.gz
infinity-for-reddit-478b2db4e583ff4577e421f1f115ef8d4d7626ef.tar.bz2
infinity-for-reddit-478b2db4e583ff4577e421f1f115ef8d4d7626ef.tar.lz
infinity-for-reddit-478b2db4e583ff4577e421f1f115ef8d4d7626ef.tar.xz
infinity-for-reddit-478b2db4e583ff4577e421f1f115ef8d4d7626ef.tar.zst
infinity-for-reddit-478b2db4e583ff4577e421f1f115ef8d4d7626ef.zip
Fix app crashes when loading multireddit posts. Rename some variables in MultiRedditListingFragment.
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/MultiRedditListingFragment.java12
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/post/PostPagingSource.java2
3 files changed, 9 insertions, 13 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java
index f674d09d..8b3f70a8 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java
@@ -191,12 +191,8 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti
isThingSelectionMode = getIntent().getBooleanExtra(EXTRA_THING_SELECTION_MODE, false);
thingSelectionType = getIntent().getIntExtra(EXTRA_THING_SELECTION_TYPE, EXTRA_THING_SELECTION_TYPE_ALL);
- if (isThingSelectionMode) {
- switch (thingSelectionType) {
- case EXTRA_THING_SELECTION_TYPE_SUBREDDIT:
- getSupportActionBar().setTitle(R.string.subreddit_selection_activity_label);
- break;
- }
+ if (isThingSelectionMode && thingSelectionType == EXTRA_THING_SELECTION_TYPE_SUBREDDIT) {
+ getSupportActionBar().setTitle(R.string.subreddit_selection_activity_label);
}
if (isThingSelectionMode && thingSelectionType != EXTRA_THING_SELECTION_TYPE_ALL) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/MultiRedditListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/MultiRedditListingFragment.java
index 316dc871..e95a99ea 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/MultiRedditListingFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/MultiRedditListingFragment.java
@@ -146,8 +146,8 @@ public class MultiRedditListingFragment extends Fragment implements FragmentComm
new MultiRedditViewModel.Factory(mRedditDataRoomDatabase, mActivity.accountName))
.get(MultiRedditViewModel.class);
- mMultiRedditViewModel.getAllMultiReddits().observe(getViewLifecycleOwner(), subscribedUserData -> {
- if (subscribedUserData == null || subscribedUserData.size() == 0) {
+ mMultiRedditViewModel.getAllMultiReddits().observe(getViewLifecycleOwner(), multiReddits -> {
+ if (multiReddits == null || multiReddits.size() == 0) {
binding.recyclerViewMultiRedditListingFragment.setVisibility(View.GONE);
binding.fetchMultiRedditListingInfoLinearLayoutMultiRedditListingFragment.setVisibility(View.VISIBLE);
mGlide.load(R.drawable.error_image).into(binding.fetchMultiRedditListingInfoImageViewMultiRedditListingFragment);
@@ -156,16 +156,16 @@ public class MultiRedditListingFragment extends Fragment implements FragmentComm
binding.recyclerViewMultiRedditListingFragment.setVisibility(View.VISIBLE);
mGlide.clear(binding.fetchMultiRedditListingInfoImageViewMultiRedditListingFragment);
}
- adapter.setMultiReddits(subscribedUserData);
+ adapter.setMultiReddits(multiReddits);
});
- mMultiRedditViewModel.getAllFavoriteMultiReddits().observe(getViewLifecycleOwner(), favoriteSubscribedUserData -> {
- if (favoriteSubscribedUserData != null && favoriteSubscribedUserData.size() > 0) {
+ mMultiRedditViewModel.getAllFavoriteMultiReddits().observe(getViewLifecycleOwner(), favoriteMultiReddits -> {
+ if (favoriteMultiReddits != null && favoriteMultiReddits.size() > 0) {
binding.fetchMultiRedditListingInfoLinearLayoutMultiRedditListingFragment.setVisibility(View.GONE);
binding.recyclerViewMultiRedditListingFragment.setVisibility(View.VISIBLE);
mGlide.clear(binding.fetchMultiRedditListingInfoImageViewMultiRedditListingFragment);
}
- adapter.setFavoriteMultiReddits(favoriteSubscribedUserData);
+ adapter.setFavoriteMultiReddits(favoriteMultiReddits);
});
return binding.getRoot();
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostPagingSource.java b/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostPagingSource.java
index 72038fba..1611dd99 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostPagingSource.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/post/PostPagingSource.java
@@ -118,7 +118,7 @@ public class PostPagingSource extends ListenableFuturePagingSource<String, Post>
this.sharedPreferences = sharedPreferences;
this.postFeedScrolledPositionSharedPreferences = postFeedScrolledPositionSharedPreferences;
if (path.endsWith("/")) {
- multiRedditPath = path.substring(0, multiRedditPath.length() - 1);
+ multiRedditPath = path.substring(0, path.length() - 1);
} else {
multiRedditPath = path;
}