Add more options for tabs in MainActivity.

This commit is contained in:
Alex Ning 2021-03-02 17:08:11 +08:00
parent b9bda129cc
commit 67f2ba955f
3 changed files with 37 additions and 0 deletions

View File

@ -1455,6 +1455,33 @@ public class MainActivity extends BaseActivity implements SortTypeSelectionCallb
bundle.putString(PostFragment.EXTRA_USER_WHERE, PostDataSource.USER_WHERE_SUBMITTED);
bundle.putString(PostFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
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 {

View File

@ -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";

View File

@ -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">