aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-03-02 09:08:11 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-03-02 09:08:11 +0000
commit67f2ba955f8f94ec8b72c1fb963b618ba5c32788 (patch)
tree7bb1721366a9a75dc94fa72dc3293bd2079e2766
parentb9bda129cc321fb8d3c0c120ff70f1721da7a9ca (diff)
downloadinfinity-for-reddit-67f2ba955f8f94ec8b72c1fb963b618ba5c32788.tar
infinity-for-reddit-67f2ba955f8f94ec8b72c1fb963b618ba5c32788.tar.gz
infinity-for-reddit-67f2ba955f8f94ec8b72c1fb963b618ba5c32788.tar.bz2
infinity-for-reddit-67f2ba955f8f94ec8b72c1fb963b618ba5c32788.tar.lz
infinity-for-reddit-67f2ba955f8f94ec8b72c1fb963b618ba5c32788.tar.xz
infinity-for-reddit-67f2ba955f8f94ec8b72c1fb963b618ba5c32788.tar.zst
infinity-for-reddit-67f2ba955f8f94ec8b72c1fb963b618ba5c32788.zip
Add more options for tabs in MainActivity.
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java27
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java5
-rw-r--r--app/src/main/res/values/arrays.xml5
3 files changed, 37 insertions, 0 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java
index 18955498..98e2306b 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MainActivity.java
@@ -1457,6 +1457,33 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
bundle.putString(PostFragment.EXTRA_ACCOUNT_NAME, mAccountName);
fragment.setArguments(bundle);
return fragment;
+ } else if (postType == SharedPreferencesUtils.MAIN_PAGE_TAB_POST_TYPE_UPVOTED
+ || postType == SharedPreferencesUtils.MAIN_PAGE_TAB_POST_TYPE_DOWNVOTED
+ || postType == SharedPreferencesUtils.MAIN_PAGE_TAB_POST_TYPE_HIDDEN
+ || postType == SharedPreferencesUtils.MAIN_PAGE_TAB_POST_TYPE_SAVED
+ || postType == SharedPreferencesUtils.MAIN_PAGE_TAB_POST_TYPE_GILDED) {
+ PostFragment fragment = new PostFragment();
+ Bundle bundle = new Bundle();
+ bundle.putInt(PostFragment.EXTRA_POST_TYPE, PostDataSource.TYPE_USER);
+ bundle.putString(PostFragment.EXTRA_USER_NAME, mAccountName);
+ bundle.putString(PostFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
+ bundle.putString(PostFragment.EXTRA_ACCOUNT_NAME, mAccountName);
+ bundle.putBoolean(PostFragment.EXTRA_DISABLE_READ_POSTS, true);
+
+ if (postType == SharedPreferencesUtils.MAIN_PAGE_TAB_POST_TYPE_UPVOTED) {
+ bundle.putString(PostFragment.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_UPVOTED);
+ } else if (postType == SharedPreferencesUtils.MAIN_PAGE_TAB_POST_TYPE_DOWNVOTED) {
+ bundle.putString(PostFragment.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_DOWNVOTED);
+ } else if (postType == SharedPreferencesUtils.MAIN_PAGE_TAB_POST_TYPE_HIDDEN) {
+ bundle.putString(PostFragment.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_HIDDEN);
+ } else if (postType == SharedPreferencesUtils.MAIN_PAGE_TAB_POST_TYPE_SAVED) {
+ bundle.putString(PostFragment.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_SAVED);
+ } else {
+ bundle.putString(PostFragment.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_GILDED);
+ }
+
+ fragment.setArguments(bundle);
+ return fragment;
} else {
PostFragment fragment = new PostFragment();
Bundle bundle = new Bundle();
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java
index be8489a9..5670b82f 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java
@@ -188,6 +188,11 @@ public class SharedPreferencesUtils {
public static final int MAIN_PAGE_TAB_POST_TYPE_SUBREDDIT = 3;
public static final int MAIN_PAGE_TAB_POST_TYPE_MULTIREDDIT = 4;
public static final int MAIN_PAGE_TAB_POST_TYPE_USER = 5;
+ public static final int MAIN_PAGE_TAB_POST_TYPE_UPVOTED = 6;
+ public static final int MAIN_PAGE_TAB_POST_TYPE_DOWNVOTED = 7;
+ public static final int MAIN_PAGE_TAB_POST_TYPE_HIDDEN = 8;
+ public static final int MAIN_PAGE_TAB_POST_TYPE_SAVED = 9;
+ public static final int MAIN_PAGE_TAB_POST_TYPE_GILDED = 10;
public static final String MAIN_PAGE_SHOW_SUBSCRIBED_SUBREDDITS = "_main_page_show_subscribed_subreddits";
public static final String MAIN_PAGE_SHOW_FAVORITE_SUBSCRIBED_SUBREDDITS = "_main_page_show_favorite_subscribed_subreddits";
diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml
index 132c8cbc..cb475059 100644
--- a/app/src/main/res/values/arrays.xml
+++ b/app/src/main/res/values/arrays.xml
@@ -172,6 +172,11 @@
<item>Subreddit</item>
<item>MultiReddit</item>
<item>User</item>
+ <item>Upvoted</item>
+ <item>Downvoted</item>
+ <item>Hidden</item>
+ <item>Saved</item>
+ <item>Gilded</item>
</string-array>
<string-array name="settings_time_format">