aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-06-10 08:21:27 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-06-10 08:21:27 +0000
commitafbebebde1ec3b52c4f5140c1aa106001bd4055b (patch)
tree6015a485f89002e612c326306b20d5be797564ce /app/src
parent907e3483999646b3e2ddc79a218629f7689f17dc (diff)
downloadinfinity-for-reddit-afbebebde1ec3b52c4f5140c1aa106001bd4055b.tar
infinity-for-reddit-afbebebde1ec3b52c4f5140c1aa106001bd4055b.tar.gz
infinity-for-reddit-afbebebde1ec3b52c4f5140c1aa106001bd4055b.tar.bz2
infinity-for-reddit-afbebebde1ec3b52c4f5140c1aa106001bd4055b.tar.lz
infinity-for-reddit-afbebebde1ec3b52c4f5140c1aa106001bd4055b.tar.xz
infinity-for-reddit-afbebebde1ec3b52c4f5140c1aa106001bd4055b.tar.zst
infinity-for-reddit-afbebebde1ec3b52c4f5140c1aa106001bd4055b.zip
Starting adding showing favorite multireddits and multireddits in main page.
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/settings/CustomizeMainPageTabsFragment.java30
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java2
-rw-r--r--app/src/main/res/layout/fragment_customize_main_page_tabs.xml62
-rw-r--r--app/src/main/res/values/strings.xml2
4 files changed, 92 insertions, 4 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CustomizeMainPageTabsFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CustomizeMainPageTabsFragment.java
index 7a2cca00..51813f8f 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CustomizeMainPageTabsFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CustomizeMainPageTabsFragment.java
@@ -101,6 +101,14 @@ public class CustomizeMainPageTabsFragment extends Fragment {
TextView moreTabsGroupSummaryTextView;
@BindView(R.id.more_tabs_info_text_view_customize_main_page_tabs_fragment)
TextView moreTabsInfoTextView;
+ @BindView(R.id.show_favorite_multireddits_linear_layout_customize_main_page_tabs_fragment)
+ LinearLayout showFavoriteMultiredditsLinearLayout;
+ @BindView(R.id.show_favorite_multireddits_switch_material_customize_main_page_tabs_fragment)
+ SwitchMaterial showFavoriteMultiredditsSwitchMaterial;
+ @BindView(R.id.show_multireddits_linear_layout_customize_main_page_tabs_fragment)
+ LinearLayout showMultiredditsLinearLayout;
+ @BindView(R.id.show_multireddits_switch_material_customize_main_page_tabs_fragment)
+ SwitchMaterial showMultiredditsSwitchMaterial;
@BindView(R.id.show_subscribed_subreddits_linear_layout_customize_main_page_tabs_fragment)
LinearLayout showSubscribedSubredditsLinearLayout;
@BindView(R.id.show_subscribed_subreddits_switch_material_customize_main_page_tabs_fragment)
@@ -159,6 +167,8 @@ public class CustomizeMainPageTabsFragment extends Fragment {
divider4.setVisibility(View.GONE);
moreTabsGroupSummaryTextView.setVisibility(View.GONE);
moreTabsInfoTextView.setVisibility(View.GONE);
+ showFavoriteMultiredditsLinearLayout.setVisibility(View.GONE);
+ showMultiredditsLinearLayout.setVisibility(View.GONE);
showSubscribedSubredditsLinearLayout.setVisibility(View.GONE);
showFavoriteSubscribedSubredditsLinearLayout.setVisibility(View.GONE);
@@ -483,14 +493,26 @@ public class CustomizeMainPageTabsFragment extends Fragment {
.show();
});
- showSubscribedSubredditsSwitchMaterial.setChecked(sharedPreferences.getBoolean((accountName == null ? "" : accountName) + SharedPreferencesUtils.MAIN_PAGE_SHOW_SUBSCRIBED_SUBREDDITS, false));
- showSubscribedSubredditsSwitchMaterial.setOnCheckedChangeListener((compoundButton, b) -> sharedPreferences.edit().putBoolean((accountName == null ? "" : accountName) + SharedPreferencesUtils.MAIN_PAGE_SHOW_SUBSCRIBED_SUBREDDITS, b).apply());
+ showMultiredditsSwitchMaterial.setChecked(sharedPreferences.getBoolean(accountName + SharedPreferencesUtils.MAIN_PAGE_SHOW_MULTIREDDITS, false));
+ showMultiredditsSwitchMaterial.setOnCheckedChangeListener((compoundButton, b) -> sharedPreferences.edit().putBoolean(accountName + SharedPreferencesUtils.MAIN_PAGE_SHOW_MULTIREDDITS, b).apply());
+ showMultiredditsLinearLayout.setOnClickListener(view -> {
+ showMultiredditsSwitchMaterial.performClick();
+ });
+
+ showFavoriteMultiredditsSwitchMaterial.setChecked(sharedPreferences.getBoolean(accountName + SharedPreferencesUtils.MAIN_PAGE_SHOW_FAVORITE_MULTIREDDITS, false));
+ showFavoriteMultiredditsSwitchMaterial.setOnCheckedChangeListener((compoundButton, b) -> sharedPreferences.edit().putBoolean(accountName + SharedPreferencesUtils.MAIN_PAGE_SHOW_FAVORITE_MULTIREDDITS, b).apply());
+ showFavoriteMultiredditsLinearLayout.setOnClickListener(view -> {
+ showFavoriteMultiredditsSwitchMaterial.performClick();
+ });
+
+ showSubscribedSubredditsSwitchMaterial.setChecked(sharedPreferences.getBoolean(accountName + SharedPreferencesUtils.MAIN_PAGE_SHOW_SUBSCRIBED_SUBREDDITS, false));
+ showSubscribedSubredditsSwitchMaterial.setOnCheckedChangeListener((compoundButton, b) -> sharedPreferences.edit().putBoolean(accountName + SharedPreferencesUtils.MAIN_PAGE_SHOW_SUBSCRIBED_SUBREDDITS, b).apply());
showSubscribedSubredditsLinearLayout.setOnClickListener(view -> {
showSubscribedSubredditsSwitchMaterial.performClick();
});
- showFavoriteSubscribedSubredditsSwitchMaterial.setChecked(sharedPreferences.getBoolean((accountName == null ? "" : accountName) + SharedPreferencesUtils.MAIN_PAGE_SHOW_FAVORITE_SUBSCRIBED_SUBREDDITS, false));
- showFavoriteSubscribedSubredditsSwitchMaterial.setOnCheckedChangeListener((compoundButton, b) -> sharedPreferences.edit().putBoolean((accountName == null ? "" : accountName) + SharedPreferencesUtils.MAIN_PAGE_SHOW_FAVORITE_SUBSCRIBED_SUBREDDITS, b).apply());
+ showFavoriteSubscribedSubredditsSwitchMaterial.setChecked(sharedPreferences.getBoolean(accountName + SharedPreferencesUtils.MAIN_PAGE_SHOW_FAVORITE_SUBSCRIBED_SUBREDDITS, false));
+ showFavoriteSubscribedSubredditsSwitchMaterial.setOnCheckedChangeListener((compoundButton, b) -> sharedPreferences.edit().putBoolean(accountName + SharedPreferencesUtils.MAIN_PAGE_SHOW_FAVORITE_SUBSCRIBED_SUBREDDITS, b).apply());
showFavoriteSubscribedSubredditsLinearLayout.setOnClickListener(view -> {
showFavoriteSubscribedSubredditsSwitchMaterial.performClick();
});
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 011e40cf..2795138d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java
@@ -205,6 +205,8 @@ public class SharedPreferencesUtils {
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_MULTIREDDITS = "_main_page_show_multireddits";
+ public static final String MAIN_PAGE_SHOW_FAVORITE_MULTIREDDITS = "_main_page_show_favorite_multireddits";
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/layout/fragment_customize_main_page_tabs.xml b/app/src/main/res/layout/fragment_customize_main_page_tabs.xml
index 85297183..2a5f19d0 100644
--- a/app/src/main/res/layout/fragment_customize_main_page_tabs.xml
+++ b/app/src/main/res/layout/fragment_customize_main_page_tabs.xml
@@ -463,6 +463,68 @@
app:drawableStartCompat="@drawable/ic_info_preference_24dp" />
<LinearLayout
+ android:id="@+id/show_favorite_multireddits_linear_layout_customize_main_page_tabs_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingTop="4dp"
+ android:paddingBottom="4dp"
+ android:paddingStart="72dp"
+ android:paddingEnd="16dp"
+ android:clickable="true"
+ android:focusable="true"
+ android:background="?attr/selectableItemBackground">
+
+ <TextView
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:layout_marginEnd="16dp"
+ android:layout_gravity="center_vertical"
+ android:text="@string/settings_more_tabs_show_favorite_multireddits_title"
+ android:textColor="?attr/primaryTextColor"
+ android:textSize="?attr/font_16"
+ android:fontFamily="?attr/font_family" />
+
+ <com.google.android.material.switchmaterial.SwitchMaterial
+ android:id="@+id/show_favorite_multireddits_switch_material_customize_main_page_tabs_fragment"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical" />
+
+ </LinearLayout>
+
+ <LinearLayout
+ android:id="@+id/show_multireddits_linear_layout_customize_main_page_tabs_fragment"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:paddingTop="4dp"
+ android:paddingBottom="4dp"
+ android:paddingStart="72dp"
+ android:paddingEnd="16dp"
+ android:clickable="true"
+ android:focusable="true"
+ android:background="?attr/selectableItemBackground">
+
+ <TextView
+ android:layout_width="0dp"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:layout_marginEnd="16dp"
+ android:layout_gravity="center_vertical"
+ android:text="@string/settings_more_tabs_show_multireddits_title"
+ android:textColor="?attr/primaryTextColor"
+ android:textSize="?attr/font_16"
+ android:fontFamily="?attr/font_family" />
+
+ <com.google.android.material.switchmaterial.SwitchMaterial
+ android:id="@+id/show_multireddits_switch_material_customize_main_page_tabs_fragment"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical" />
+
+ </LinearLayout>
+
+ <LinearLayout
android:id="@+id/show_favorite_subscribed_subreddits_linear_layout_customize_main_page_tabs_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 118d8002..ce33e48f 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -476,6 +476,8 @@
<string name="settings_tab_3_summary">Tab 3</string>
<string name="settings_more_tabs_summary">More Tabs</string>
<string name="settings_more_tabs_info_summary">Enabling the following options will cause an unintended behaviour:\nTabs may lose all the content after switching to others. This is the same as refreshing the page.</string>
+ <string name="settings_more_tabs_show_favorite_multireddits_title">Show Favorite Multireddits</string>
+ <string name="settings_more_tabs_show_multireddits_title">Show Multireddits</string>
<string name="settings_more_tabs_show_favorite_subscribed_subreddits_title">Show Favorite Subscribed Subreddits</string>
<string name="settings_more_tabs_show_subscribed_subreddits_title">Show Subscribed Subreddits</string>
<string name="settings_tab_title">Title</string>