aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml
diff options
context:
space:
mode:
authorDocile-Alligator <chineseperson5@gmail.com>2022-04-30 09:56:31 +0000
committerDocile-Alligator <chineseperson5@gmail.com>2022-04-30 09:56:31 +0000
commit3d374491b344a77c5bb55d34ce5a86e6e50f5f58 (patch)
tree9084cdf873cb1e59a1a569c833a859af96b6ef56 /app/src/main/java/ml
parentd40fc595401ebb299b2e5ba4b4f723fd14f57fe5 (diff)
downloadinfinity-for-reddit-3d374491b344a77c5bb55d34ce5a86e6e50f5f58.tar
infinity-for-reddit-3d374491b344a77c5bb55d34ce5a86e6e50f5f58.tar.gz
infinity-for-reddit-3d374491b344a77c5bb55d34ce5a86e6e50f5f58.tar.bz2
infinity-for-reddit-3d374491b344a77c5bb55d34ce5a86e6e50f5f58.tar.lz
infinity-for-reddit-3d374491b344a77c5bb55d34ce5a86e6e50f5f58.tar.xz
infinity-for-reddit-3d374491b344a77c5bb55d34ce5a86e6e50f5f58.tar.zst
infinity-for-reddit-3d374491b344a77c5bb55d34ce5a86e6e50f5f58.zip
targetSdkVersion 31. Fix sort type problems in anonymous home page and multireddits.
Diffstat (limited to 'app/src/main/java/ml')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/FilteredPostsActivity.java26
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java13
3 files changed, 18 insertions, 23 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FilteredPostsActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FilteredPostsActivity.java
index cadadd68..804197e5 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FilteredPostsActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/FilteredPostsActivity.java
@@ -371,26 +371,14 @@ public class FilteredPostsActivity extends BaseActivity implements SortTypeSelec
searchPostSortTypeBottomSheetFragment.show(getSupportFragmentManager(), searchPostSortTypeBottomSheetFragment.getTag());
break;
case PostPagingSource.TYPE_SUBREDDIT:
- if (name.equals("popular") || name.equals("all")) {
- SortTypeBottomSheetFragment popularAndAllSortTypeBottomSheetFragment = new SortTypeBottomSheetFragment();
- Bundle popularBundle = new Bundle();
- popularBundle.putBoolean(SortTypeBottomSheetFragment.EXTRA_NO_BEST_TYPE, true);
- popularAndAllSortTypeBottomSheetFragment.setArguments(popularBundle);
- popularAndAllSortTypeBottomSheetFragment.show(getSupportFragmentManager(), popularAndAllSortTypeBottomSheetFragment.getTag());
- } else {
- SortTypeBottomSheetFragment subredditSortTypeBottomSheetFragment = new SortTypeBottomSheetFragment();
- Bundle subredditSheetBundle = new Bundle();
- subredditSheetBundle.putBoolean(SortTypeBottomSheetFragment.EXTRA_NO_BEST_TYPE, true);
- subredditSortTypeBottomSheetFragment.setArguments(subredditSheetBundle);
- subredditSortTypeBottomSheetFragment.show(getSupportFragmentManager(), subredditSortTypeBottomSheetFragment.getTag());
- }
- break;
case PostPagingSource.TYPE_MULTI_REDDIT:
- SortTypeBottomSheetFragment multiRedditSortTypeBottomSheetFragment = new SortTypeBottomSheetFragment();
- Bundle multiRedditBundle = new Bundle();
- multiRedditBundle.putBoolean(SortTypeBottomSheetFragment.EXTRA_NO_BEST_TYPE, true);
- multiRedditSortTypeBottomSheetFragment.setArguments(multiRedditBundle);
- multiRedditSortTypeBottomSheetFragment.show(getSupportFragmentManager(), multiRedditSortTypeBottomSheetFragment.getTag());
+ case PostPagingSource.TYPE_ANONYMOUS_MULTIREDDIT:
+ case PostPagingSource.TYPE_ANONYMOUS_FRONT_PAGE:
+ SortTypeBottomSheetFragment sortTypeBottomSheetFragment = new SortTypeBottomSheetFragment();
+ Bundle popularBundle = new Bundle();
+ popularBundle.putBoolean(SortTypeBottomSheetFragment.EXTRA_NO_BEST_TYPE, true);
+ sortTypeBottomSheetFragment.setArguments(popularBundle);
+ sortTypeBottomSheetFragment.show(getSupportFragmentManager(), sortTypeBottomSheetFragment.getTag());
break;
case PostPagingSource.TYPE_USER:
UserThingSortTypeBottomSheetFragment userThingSortTypeBottomSheetFragment = new UserThingSortTypeBottomSheetFragment();
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 957e77ed..ad5d1746 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java
@@ -156,7 +156,7 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti
int navBarHeight = getNavBarHeight();
if (navBarHeight > 0) {
CoordinatorLayout.LayoutParams params = (CoordinatorLayout.LayoutParams) fab.getLayoutParams();
- params.bottomMargin = navBarHeight;
+ params.bottomMargin += navBarHeight;
fab.setLayoutParams(params);
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java
index e982a512..b691c4b2 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/PostFragment.java
@@ -718,9 +718,9 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
usage = PostFilterUsage.HOME_TYPE;
nameOfUsage = PostFilterUsage.NO_USAGE;
- String sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_BEST_POST, SortType.Type.BEST.name());
+ String sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_SUBREDDIT_POST_BASE + "-", SortType.Type.HOT.name());
if (sort.equals(SortType.Type.CONTROVERSIAL.name()) || sort.equals(SortType.Type.TOP.name())) {
- String sortTime = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_BEST_POST, SortType.Time.ALL.name());
+ String sortTime = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_SUBREDDIT_POST_BASE + "-", SortType.Time.ALL.name());
sortType = new SortType(SortType.Type.valueOf(sort), SortType.Time.valueOf(sortTime));
} else {
sortType = new SortType(SortType.Type.valueOf(sort));
@@ -778,7 +778,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
usage = PostFilterUsage.MULTIREDDIT_TYPE;
nameOfUsage = multiRedditPath;
- String sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_MULTI_REDDIT_POST_BASE + multiRedditPath, SortType.Type.BEST.name());
+ String sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_MULTI_REDDIT_POST_BASE + multiRedditPath, SortType.Type.HOT.name());
if (sort.equals(SortType.Type.CONTROVERSIAL.name()) || sort.equals(SortType.Type.TOP.name())) {
String sortTime = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_MULTI_REDDIT_POST_BASE + multiRedditPath, SortType.Time.ALL.name());
sortType = new SortType(SortType.Type.valueOf(sort), SortType.Time.valueOf(sortTime));
@@ -1355,6 +1355,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
}
break;
case PostPagingSource.TYPE_MULTI_REDDIT:
+ case PostPagingSource.TYPE_ANONYMOUS_MULTIREDDIT:
mSortTypeSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TYPE_MULTI_REDDIT_POST_BASE + multiRedditPath,
sortType.getType().name()).apply();
if (sortType.getTime() != null) {
@@ -1362,6 +1363,12 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
sortType.getTime().name()).apply();
}
break;
+ case PostPagingSource.TYPE_ANONYMOUS_FRONT_PAGE:
+ mSortTypeSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TYPE_SUBREDDIT_POST_BASE + "-", sortType.getType().name()).apply();
+ if (sortType.getTime() != null) {
+ mSortTypeSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TIME_SUBREDDIT_POST_BASE + "-", sortType.getTime().name()).apply();
+ }
+ break;
}
}
if (mFetchPostInfoLinearLayout.getVisibility() != View.GONE) {