New options: hide favorite subreddits and subscribed subreddits in the navigation drawer.

This commit is contained in:
Alex Ning 2021-03-15 00:18:25 +08:00
parent c0937304cc
commit 57fd9edaff
3 changed files with 17 additions and 4 deletions

View File

@ -126,7 +126,7 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re
- (collapsePostSection ? POST_SECTION_ITEMS : 0)
- (collapsePreferencesSection ? PREFERENCES_SECTION_ITEMS : 0)) {
return VIEW_TYPE_MENU_GROUP_TITLE;
} else if (!favoriteSubscribedSubreddits.isEmpty() && position == CURRENT_MENU_ITEMS
} else if (!hideFavoriteSubredditsSection && !favoriteSubscribedSubreddits.isEmpty() && position == CURRENT_MENU_ITEMS
- (collapseAccountSection ? ACCOUNT_SECTION_ITEMS : 0)
- (collapsePostSection ? POST_SECTION_ITEMS : 0)
- (collapsePreferencesSection ? PREFERENCES_SECTION_ITEMS : 0)
@ -135,7 +135,8 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re
} else if (position > CURRENT_MENU_ITEMS - (collapseAccountSection ? ACCOUNT_SECTION_ITEMS : 0)
- (collapsePostSection ? POST_SECTION_ITEMS : 0)
- (collapsePreferencesSection ? PREFERENCES_SECTION_ITEMS : 0)) {
if (!favoriteSubscribedSubreddits.isEmpty() && !collapseFavoriteSubredditsSection && position <= CURRENT_MENU_ITEMS
if (!favoriteSubscribedSubreddits.isEmpty() && !hideFavoriteSubredditsSection &&
!collapseFavoriteSubredditsSection && position <= CURRENT_MENU_ITEMS
- (collapseAccountSection ? ACCOUNT_SECTION_ITEMS : 0)
- (collapsePostSection ? POST_SECTION_ITEMS : 0)
- (collapsePreferencesSection ? PREFERENCES_SECTION_ITEMS : 0)
@ -314,7 +315,7 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re
}
type = 2;
} else {
if (!favoriteSubscribedSubreddits.isEmpty() && position == CURRENT_MENU_ITEMS
if (!hideFavoriteSubredditsSection && !favoriteSubscribedSubreddits.isEmpty() && position == CURRENT_MENU_ITEMS
- (collapseAccountSection ? ACCOUNT_SECTION_ITEMS : 0)
- (collapsePostSection ? POST_SECTION_ITEMS : 0)
- (collapsePreferencesSection ? PREFERENCES_SECTION_ITEMS : 0)) {
@ -571,7 +572,7 @@ public class NavigationDrawerRecyclerViewAdapter extends RecyclerView.Adapter<Re
itemClickListener.onSubscribedSubredditClick(subredditName);
});
} else if (holder instanceof SubscribedThingViewHolder) {
SubscribedSubredditData subreddit = favoriteSubscribedSubreddits.isEmpty() ? subscribedSubreddits.get(position - (CURRENT_MENU_ITEMS
SubscribedSubredditData subreddit = favoriteSubscribedSubreddits.isEmpty() || hideFavoriteSubredditsSection ? subscribedSubreddits.get(position - (CURRENT_MENU_ITEMS
- (collapseAccountSection ? ACCOUNT_SECTION_ITEMS : 0)
- (collapsePostSection ? POST_SECTION_ITEMS : 0)
- (collapsePreferencesSection ? PREFERENCES_SECTION_ITEMS : 0))

View File

@ -553,6 +553,8 @@
<string name="settings_collapse_preferences_section_title">Collapse Preferences Section</string>
<string name="settings_collapse_favorite_subreddits_section_title">Collapse Favorite Subreddits Section</string>
<string name="settings_collapse_subscribed_subreddits_section_title">Collapse Subscribed Subreddits Section</string>
<string name="settings_hide_favorite_subreddits_sections_title">Hide Favorite Subreddits Section</string>
<string name="settings_hide_subscribed_subreddits_sections_title">Hide Subscribed Subreddits Section</string>
<string name="no_link_available">Cannot get the link</string>

View File

@ -31,4 +31,14 @@
app:key="collapse_subscribed_subreddits_section"
app:title="@string/settings_collapse_subscribed_subreddits_section_title" />
<SwitchPreference
app:defaultValue="false"
app:key="hide_favorite_subreddits_sections"
app:title="@string/settings_hide_favorite_subreddits_sections_title" />
<SwitchPreference
app:defaultValue="false"
app:key="hide_subscribed_subreddits_sections"
app:title="@string/settings_hide_subscribed_subreddits_sections_title" />
</PreferenceScreen>