aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-10-16 06:46:01 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-10-16 06:46:01 +0000
commit1d7fbe3a993da8cc1ce5c64dc1cf29bf1659e005 (patch)
tree017834e7d5d863fc959360b5902291d8d4c1f1b6 /app/src
parent1d18e2c75ba35bb304c8dbac1823642b3bcf96d1 (diff)
downloadinfinity-for-reddit-1d7fbe3a993da8cc1ce5c64dc1cf29bf1659e005.tar
infinity-for-reddit-1d7fbe3a993da8cc1ce5c64dc1cf29bf1659e005.tar.gz
infinity-for-reddit-1d7fbe3a993da8cc1ce5c64dc1cf29bf1659e005.tar.bz2
infinity-for-reddit-1d7fbe3a993da8cc1ce5c64dc1cf29bf1659e005.tar.lz
infinity-for-reddit-1d7fbe3a993da8cc1ce5c64dc1cf29bf1659e005.tar.xz
infinity-for-reddit-1d7fbe3a993da8cc1ce5c64dc1cf29bf1659e005.tar.zst
infinity-for-reddit-1d7fbe3a993da8cc1ce5c64dc1cf29bf1659e005.zip
Add a button to directly select subreddit, user or multireddit in CustomizeMainPageTabsFragment.
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/MultiredditSelectionActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchActivity.java26
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubredditSelectionActivity.java8
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/settings/CustomizeMainPageTabsFragment.java203
-rw-r--r--app/src/main/res/layout/fragment_customize_main_page_tabs.xml114
-rw-r--r--app/src/main/res/values/strings.xml2
6 files changed, 282 insertions, 73 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MultiredditSelectionActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MultiredditSelectionActivity.java
index 943dbf2d..d5ae4f84 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MultiredditSelectionActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MultiredditSelectionActivity.java
@@ -46,7 +46,7 @@ import retrofit2.Retrofit;
public class MultiredditSelectionActivity extends BaseActivity implements ActivityToolbarInterface {
- static final String EXTRA_RETURN_MULTIREDDIT = "ERM";
+ public static final String EXTRA_RETURN_MULTIREDDIT = "ERM";
private static final String INSERT_SUBSCRIBED_MULTIREDDIT_STATE = "ISSS";
private static final String FRAGMENT_OUT_STATE = "FOS";
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchActivity.java
index eab43461..6daffcce 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchActivity.java
@@ -58,19 +58,19 @@ import retrofit2.Retrofit;
public class SearchActivity extends BaseActivity {
- static final String EXTRA_QUERY = "EQ";
- static final String EXTRA_SUBREDDIT_NAME = "ESN";
- static final String EXTRA_SUBREDDIT_IS_USER = "ESIU";
- static final String EXTRA_SEARCH_ONLY_SUBREDDITS = "ESOS";
- static final String EXTRA_SEARCH_ONLY_USERS = "ESOU";
- static final String EXTRA_RETURN_SUBREDDIT_NAME = "ERSN";
- static final String EXTRA_RETURN_SUBREDDIT_ICON_URL = "ERSIU";
- static final String RETURN_EXTRA_SELECTED_SUBREDDIT_NAMES = "RESSN";
- static final String RETURN_EXTRA_SELECTED_USERNAMES = "RESU";
- static final String EXTRA_RETURN_USER_NAME = "ERUN";
- static final String EXTRA_RETURN_USER_ICON_URL = "ERUIU";
- static final String EXTRA_IS_MULTI_SELECTION = "EIMS";
- static final int SUICIDE_PREVENTION_ACTIVITY_REQUEST_CODE = 101;
+ public static final String EXTRA_QUERY = "EQ";
+ public static final String EXTRA_SUBREDDIT_NAME = "ESN";
+ public static final String EXTRA_SUBREDDIT_IS_USER = "ESIU";
+ public static final String EXTRA_SEARCH_ONLY_SUBREDDITS = "ESOS";
+ public static final String EXTRA_SEARCH_ONLY_USERS = "ESOU";
+ public static final String EXTRA_RETURN_SUBREDDIT_NAME = "ERSN";
+ public static final String EXTRA_RETURN_SUBREDDIT_ICON_URL = "ERSIU";
+ public static final String RETURN_EXTRA_SELECTED_SUBREDDIT_NAMES = "RESSN";
+ public static final String RETURN_EXTRA_SELECTED_USERNAMES = "RESU";
+ public static final String EXTRA_RETURN_USER_NAME = "ERUN";
+ public static final String EXTRA_RETURN_USER_ICON_URL = "ERUIU";
+ public static final String EXTRA_IS_MULTI_SELECTION = "EIMS";
+ public static final int SUICIDE_PREVENTION_ACTIVITY_REQUEST_CODE = 101;
private static final String SUBREDDIT_NAME_STATE = "SNS";
private static final String SUBREDDIT_IS_USER_STATE = "SIUS";
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubredditSelectionActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubredditSelectionActivity.java
index e1458042..3db45c00 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubredditSelectionActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubredditSelectionActivity.java
@@ -49,10 +49,10 @@ import retrofit2.Retrofit;
public class SubredditSelectionActivity extends BaseActivity implements ActivityToolbarInterface {
- static final String EXTRA_EXTRA_CLEAR_SELECTION = "EECS";
- static final String EXTRA_RETURN_SUBREDDIT_NAME = "ERSN";
- static final String EXTRA_RETURN_SUBREDDIT_ICON_URL = "ERSIURL";
- static final String EXTRA_RETURN_SUBREDDIT_IS_USER = "ERSIU";
+ public static final String EXTRA_EXTRA_CLEAR_SELECTION = "EECS";
+ public static final String EXTRA_RETURN_SUBREDDIT_NAME = "ERSN";
+ public static final String EXTRA_RETURN_SUBREDDIT_ICON_URL = "ERSIURL";
+ public static final String EXTRA_RETURN_SUBREDDIT_IS_USER = "ERSIU";
private static final int SUBREDDIT_SEARCH_REQUEST_CODE = 0;
private static final String INSERT_SUBSCRIBED_SUBREDDIT_STATE = "ISSS";
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 18327e8c..dddbda85 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CustomizeMainPageTabsFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CustomizeMainPageTabsFragment.java
@@ -2,6 +2,7 @@ package ml.docilealligator.infinityforreddit.settings;
import android.app.Activity;
import android.content.Context;
+import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.LayoutInflater;
@@ -9,10 +10,13 @@ import android.view.View;
import android.view.ViewGroup;
import android.view.inputmethod.InputMethodManager;
import android.widget.EditText;
+import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.fragment.app.Fragment;
import com.google.android.material.dialog.MaterialAlertDialogBuilder;
@@ -25,6 +29,10 @@ import butterknife.BindView;
import butterknife.ButterKnife;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
+import ml.docilealligator.infinityforreddit.activities.MultiredditSelectionActivity;
+import ml.docilealligator.infinityforreddit.activities.SearchActivity;
+import ml.docilealligator.infinityforreddit.activities.SubredditSelectionActivity;
+import ml.docilealligator.infinityforreddit.multireddit.MultiReddit;
import ml.docilealligator.infinityforreddit.utils.SharedPreferencesUtils;
public class CustomizeMainPageTabsFragment extends Fragment {
@@ -53,12 +61,14 @@ public class CustomizeMainPageTabsFragment extends Fragment {
LinearLayout tab1TypeLinearLayout;
@BindView(R.id.tab_1_type_summary_text_view_customize_main_page_tabs_fragment)
TextView tab1TypeSummaryTextView;
- @BindView(R.id.tab_1_name_linear_layout_customize_main_page_tabs_fragment)
- LinearLayout tab1NameLinearLayout;
+ @BindView(R.id.tab_1_name_constraint_layout_customize_main_page_tabs_fragment)
+ ConstraintLayout tab1NameConstraintLayout;
@BindView(R.id.tab_1_name_title_text_view_customize_main_page_tabs_fragment)
TextView tab1NameTitleTextView;
@BindView(R.id.tab_1_name_summary_text_view_customize_main_page_tabs_fragment)
TextView tab1NameSummaryTextView;
+ @BindView(R.id.tab_1_name_add_image_view_customize_main_page_tabs_fragment)
+ ImageView tab1AddImageView;
@BindView(R.id.divider_2_customize_main_page_tabs_fragment)
View divider2;
@BindView(R.id.tab_2_group_summary_customize_main_page_tabs_fragment)
@@ -71,12 +81,14 @@ public class CustomizeMainPageTabsFragment extends Fragment {
LinearLayout tab2TypeLinearLayout;
@BindView(R.id.tab_2_type_summary_text_view_customize_main_page_tabs_fragment)
TextView tab2TypeSummaryTextView;
- @BindView(R.id.tab_2_name_linear_layout_customize_main_page_tabs_fragment)
- LinearLayout tab2NameLinearLayout;
+ @BindView(R.id.tab_2_name_constraint_layout_customize_main_page_tabs_fragment)
+ ConstraintLayout tab2NameConstraintLayout;
@BindView(R.id.tab_2_name_title_text_view_customize_main_page_tabs_fragment)
TextView tab2NameTitleTextView;
@BindView(R.id.tab_2_name_summary_text_view_customize_main_page_tabs_fragment)
TextView tab2NameSummaryTextView;
+ @BindView(R.id.tab_2_name_add_image_view_customize_main_page_tabs_fragment)
+ ImageView tab2AddImageView;
@BindView(R.id.divider_3_customize_main_page_tabs_fragment)
View divider3;
@BindView(R.id.tab_3_group_summary_customize_main_page_tabs_fragment)
@@ -89,12 +101,14 @@ public class CustomizeMainPageTabsFragment extends Fragment {
LinearLayout tab3TypeLinearLayout;
@BindView(R.id.tab_3_type_summary_text_view_customize_main_page_tabs_fragment)
TextView tab3TypeSummaryTextView;
- @BindView(R.id.tab_3_name_linear_layout_customize_main_page_tabs_fragment)
- LinearLayout tab3NameLinearLayout;
+ @BindView(R.id.tab_3_name_constraint_layout_customize_main_page_tabs_fragment)
+ ConstraintLayout tab3NameConstraintLayout;
@BindView(R.id.tab_3_name_title_text_view_customize_main_page_tabs_fragment)
TextView tab3NameTitleTextView;
@BindView(R.id.tab_3_name_summary_text_view_customize_main_page_tabs_fragment)
TextView tab3NameSummaryTextView;
+ @BindView(R.id.tab_3_name_add_image_view_customize_main_page_tabs_fragment)
+ ImageView tab3AddImageView;
@BindView(R.id.divider_4_customize_main_page_tabs_fragment)
View divider4;
@BindView(R.id.more_tabs_group_summary_customize_main_page_tabs_fragment)
@@ -121,6 +135,7 @@ public class CustomizeMainPageTabsFragment extends Fragment {
@Named("main_activity_tabs")
SharedPreferences mainActivityTabsSharedPreferences;
private Activity activity;
+ private String accountName;
private int tabCount;
private String tab1CurrentTitle;
private int tab1CurrentPostType;
@@ -146,7 +161,7 @@ public class CustomizeMainPageTabsFragment extends Fragment {
ButterKnife.bind(this, rootView);
- String accountName = getArguments().getString(EXTRA_ACCOUNT_NAME);
+ accountName = getArguments().getString(EXTRA_ACCOUNT_NAME);
String[] typeValues;
if (accountName == null) {
@@ -180,7 +195,7 @@ public class CustomizeMainPageTabsFragment extends Fragment {
tab1TypeSummaryTextView.setText(typeValues[tab1CurrentPostType]);
tab1TitleSummaryTextView.setText(tab1CurrentTitle);
tab1NameSummaryTextView.setText(tab1CurrentName);
- applyTab1NameView(tab1NameLinearLayout, tab1NameTitleTextView, tab1CurrentPostType);
+ applyTab1NameView(tab1NameConstraintLayout, tab1NameTitleTextView, tab1CurrentPostType);
View dialogView = activity.getLayoutInflater().inflate(R.layout.dialog_edit_text, null);
EditText editText = dialogView.findViewById(R.id.edit_text_edit_text_dialog);
@@ -223,14 +238,14 @@ public class CustomizeMainPageTabsFragment extends Fragment {
tab1CurrentPostType = i;
mainActivityTabsSharedPreferences.edit().putInt((accountName == null ? "" : accountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_1_POST_TYPE, i).apply();
tab1TypeSummaryTextView.setText(typeValues[i]);
- applyTab1NameView(tab1NameLinearLayout, tab1NameTitleTextView, i);
+ applyTab1NameView(tab1NameConstraintLayout, tab1NameTitleTextView, i);
dialogInterface.dismiss();
})
.setNegativeButton(R.string.cancel, null)
.show();
});
- tab1NameLinearLayout.setOnClickListener(view -> {
+ tab1NameConstraintLayout.setOnClickListener(view -> {
int titleId;
switch (tab1CurrentPostType) {
case SharedPreferencesUtils.MAIN_PAGE_TAB_POST_TYPE_SUBREDDIT:
@@ -275,13 +290,15 @@ public class CustomizeMainPageTabsFragment extends Fragment {
.show();
});
+ tab1AddImageView.setOnClickListener(view -> selectName(0));
+
tab2CurrentTitle = mainActivityTabsSharedPreferences.getString((accountName == null ? "" : accountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_2_TITLE, getString(R.string.popular));
tab2CurrentPostType = mainActivityTabsSharedPreferences.getInt((accountName == null ? "" : accountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_2_POST_TYPE, SharedPreferencesUtils.MAIN_PAGE_TAB_POST_TYPE_POPULAR);
tab2CurrentName = mainActivityTabsSharedPreferences.getString((accountName == null ? "" : accountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_2_NAME, "");
tab2TypeSummaryTextView.setText(typeValues[tab2CurrentPostType]);
tab2TitleSummaryTextView.setText(tab2CurrentTitle);
tab2NameSummaryTextView.setText(tab2CurrentName);
- applyTab2NameView(tab2NameLinearLayout, tab2NameTitleTextView, tab2CurrentPostType);
+ applyTab2NameView(tab2NameConstraintLayout, tab2NameTitleTextView, tab2CurrentPostType);
tab2TitleLinearLayout.setOnClickListener(view -> {
editText.setHint(R.string.settings_tab_title);
@@ -321,14 +338,14 @@ public class CustomizeMainPageTabsFragment extends Fragment {
tab2CurrentPostType = i;
mainActivityTabsSharedPreferences.edit().putInt((accountName == null ? "" : accountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_2_POST_TYPE, i).apply();
tab2TypeSummaryTextView.setText(typeValues[i]);
- applyTab2NameView(tab2NameLinearLayout, tab2NameTitleTextView, i);
+ applyTab2NameView(tab2NameConstraintLayout, tab2NameTitleTextView, i);
dialogInterface.dismiss();
})
.setNegativeButton(R.string.cancel, null)
.show();
});
- tab2NameLinearLayout.setOnClickListener(view -> {
+ tab2NameConstraintLayout.setOnClickListener(view -> {
int titleId;
switch (tab2CurrentPostType) {
case SharedPreferencesUtils.MAIN_PAGE_TAB_POST_TYPE_SUBREDDIT:
@@ -373,13 +390,15 @@ public class CustomizeMainPageTabsFragment extends Fragment {
.show();
});
+ tab2AddImageView.setOnClickListener(view -> selectName(1));
+
tab3CurrentTitle = mainActivityTabsSharedPreferences.getString((accountName == null ? "" : accountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_3_TITLE, getString(R.string.all));
tab3CurrentPostType = mainActivityTabsSharedPreferences.getInt((accountName == null ? "" : accountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_3_POST_TYPE, SharedPreferencesUtils.MAIN_PAGE_TAB_POST_TYPE_ALL);
tab3CurrentName = mainActivityTabsSharedPreferences.getString((accountName == null ? "" : accountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_3_NAME, "");
tab3TypeSummaryTextView.setText(typeValues[tab3CurrentPostType]);
tab3TitleSummaryTextView.setText(tab3CurrentTitle);
tab3NameSummaryTextView.setText(tab3CurrentName);
- applyTab3NameView(tab3NameLinearLayout, tab3NameTitleTextView, tab3CurrentPostType);
+ applyTab3NameView(tab3NameConstraintLayout, tab3NameTitleTextView, tab3CurrentPostType);
tab3TitleLinearLayout.setOnClickListener(view -> {
editText.setHint(R.string.settings_tab_title);
@@ -419,14 +438,14 @@ public class CustomizeMainPageTabsFragment extends Fragment {
tab3CurrentPostType = i;
mainActivityTabsSharedPreferences.edit().putInt((accountName == null ? "" : accountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_3_POST_TYPE, i).apply();
tab3TypeSummaryTextView.setText(typeValues[i]);
- applyTab3NameView(tab3NameLinearLayout, tab3NameTitleTextView, i);
+ applyTab3NameView(tab3NameConstraintLayout, tab3NameTitleTextView, i);
dialogInterface.dismiss();
})
.setNegativeButton(R.string.cancel, null)
.show();
});
- tab3NameLinearLayout.setOnClickListener(view -> {
+ tab3NameConstraintLayout.setOnClickListener(view -> {
int titleId;
switch (tab3CurrentPostType) {
case SharedPreferencesUtils.MAIN_PAGE_TAB_POST_TYPE_SUBREDDIT:
@@ -471,6 +490,8 @@ public class CustomizeMainPageTabsFragment extends Fragment {
.show();
});
+ tab3AddImageView.setOnClickListener(view -> selectName(2));
+
showMultiredditsSwitchMaterial.setChecked(mainActivityTabsSharedPreferences.getBoolean(accountName + SharedPreferencesUtils.MAIN_PAGE_SHOW_MULTIREDDITS, false));
showMultiredditsSwitchMaterial.setOnCheckedChangeListener((compoundButton, b) -> mainActivityTabsSharedPreferences.edit().putBoolean(accountName + SharedPreferencesUtils.MAIN_PAGE_SHOW_MULTIREDDITS, b).apply());
showMultiredditsLinearLayout.setOnClickListener(view -> {
@@ -498,26 +519,26 @@ public class CustomizeMainPageTabsFragment extends Fragment {
return rootView;
}
- private void applyTab1NameView(LinearLayout linearLayout, TextView titleTextView, int postType) {
+ private void applyTab1NameView(ConstraintLayout constraintLayout, TextView titleTextView, int postType) {
switch (postType) {
case SharedPreferencesUtils.MAIN_PAGE_TAB_POST_TYPE_SUBREDDIT:
- linearLayout.setVisibility(View.VISIBLE);
+ constraintLayout.setVisibility(View.VISIBLE);
titleTextView.setText(R.string.settings_tab_subreddit_name);
break;
case SharedPreferencesUtils.MAIN_PAGE_TAB_POST_TYPE_MULTIREDDIT:
- linearLayout.setVisibility(View.VISIBLE);
+ constraintLayout.setVisibility(View.VISIBLE);
titleTextView.setText(R.string.settings_tab_multi_reddit_name);
break;
case SharedPreferencesUtils.MAIN_PAGE_TAB_POST_TYPE_USER:
- linearLayout.setVisibility(View.VISIBLE);
+ constraintLayout.setVisibility(View.VISIBLE);
titleTextView.setText(R.string.settings_tab_username);
break;
default:
- linearLayout.setVisibility(View.GONE);
+ constraintLayout.setVisibility(View.GONE);
}
}
- private void applyTab2NameView(LinearLayout linearLayout, TextView titleTextView, int postType) {
+ private void applyTab2NameView(ConstraintLayout linearLayout, TextView titleTextView, int postType) {
switch (postType) {
case SharedPreferencesUtils.MAIN_PAGE_TAB_POST_TYPE_SUBREDDIT:
linearLayout.setVisibility(View.VISIBLE);
@@ -536,22 +557,150 @@ public class CustomizeMainPageTabsFragment extends Fragment {
}
}
- private void applyTab3NameView(LinearLayout linearLayout, TextView titleTextView, int postType) {
+ private void applyTab3NameView(ConstraintLayout constraintLayout, TextView titleTextView, int postType) {
switch (postType) {
case SharedPreferencesUtils.MAIN_PAGE_TAB_POST_TYPE_SUBREDDIT:
- linearLayout.setVisibility(View.VISIBLE);
+ constraintLayout.setVisibility(View.VISIBLE);
titleTextView.setText(R.string.settings_tab_subreddit_name);
break;
case SharedPreferencesUtils.MAIN_PAGE_TAB_POST_TYPE_MULTIREDDIT:
- linearLayout.setVisibility(View.VISIBLE);
+ constraintLayout.setVisibility(View.VISIBLE);
titleTextView.setText(R.string.settings_tab_multi_reddit_name);
break;
case SharedPreferencesUtils.MAIN_PAGE_TAB_POST_TYPE_USER:
- linearLayout.setVisibility(View.VISIBLE);
+ constraintLayout.setVisibility(View.VISIBLE);
titleTextView.setText(R.string.settings_tab_username);
break;
default:
- linearLayout.setVisibility(View.GONE);
+ constraintLayout.setVisibility(View.GONE);
+ }
+ }
+
+ private void selectName(int tab) {
+ switch (tab) {
+ case 0:
+ switch (tab1CurrentPostType) {
+ case 3: {
+ Intent intent = new Intent(activity, SubredditSelectionActivity.class);
+ startActivityForResult(intent, tab);
+ break;
+ }
+ case 4: {
+ Intent intent = new Intent(activity, MultiredditSelectionActivity.class);
+ startActivityForResult(intent, tab);
+ break;
+ }
+ case 5: {
+ Intent intent = new Intent(activity, SearchActivity.class);
+ intent.putExtra(SearchActivity.EXTRA_SEARCH_ONLY_USERS, true);
+ startActivityForResult(intent, tab);
+ break;
+ }
+ }
+ break;
+ case 1:
+ switch (tab2CurrentPostType) {
+ case 3: {
+ Intent intent = new Intent(activity, SubredditSelectionActivity.class);
+ startActivityForResult(intent, tab);
+ break;
+ }
+ case 4: {
+ Intent intent = new Intent(activity, MultiredditSelectionActivity.class);
+ startActivityForResult(intent, tab);
+ break;
+ }
+ case 5: {
+ Intent intent = new Intent(activity, SearchActivity.class);
+ intent.putExtra(SearchActivity.EXTRA_SEARCH_ONLY_USERS, true);
+ startActivityForResult(intent, tab);
+ break;
+ }
+ }
+ break;
+ case 2:
+ switch (tab3CurrentPostType) {
+ case 3: {
+ Intent intent = new Intent(activity, SubredditSelectionActivity.class);
+ startActivityForResult(intent, tab);
+ break;
+ }
+ case 4: {
+ Intent intent = new Intent(activity, MultiredditSelectionActivity.class);
+ startActivityForResult(intent, tab);
+ break;
+ }
+ case 5: {
+ Intent intent = new Intent(activity, SearchActivity.class);
+ intent.putExtra(SearchActivity.EXTRA_SEARCH_ONLY_USERS, true);
+ startActivityForResult(intent, tab);
+ break;
+ }
+ }
+ break;
+ }
+ }
+
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
+ super.onActivityResult(requestCode, resultCode, data);
+ if (resultCode == Activity.RESULT_OK && data != null) {
+ switch (requestCode) {
+ case 0:
+ if (data.hasExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_NAME)) {
+ tab1CurrentName = data.getStringExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_NAME);
+ tab1NameSummaryTextView.setText(tab1CurrentName);
+ mainActivityTabsSharedPreferences.edit().putString((accountName == null ? "" : accountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_1_NAME, tab1CurrentName).apply();
+ } else if (data.hasExtra(MultiredditSelectionActivity.EXTRA_RETURN_MULTIREDDIT)) {
+ MultiReddit multireddit = data.getParcelableExtra(MultiredditSelectionActivity.EXTRA_RETURN_MULTIREDDIT);
+ if (multireddit != null) {
+ tab1CurrentName = multireddit.getPath();
+ tab1NameSummaryTextView.setText(tab1CurrentName);
+ mainActivityTabsSharedPreferences.edit().putString((accountName == null ? "" : accountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_1_NAME, tab1CurrentName).apply();
+ }
+ } else if (data.hasExtra(SearchActivity.EXTRA_RETURN_USER_NAME)) {
+ tab1CurrentName = data.getStringExtra(SearchActivity.EXTRA_RETURN_USER_NAME);
+ tab1NameSummaryTextView.setText(tab1CurrentName);
+ mainActivityTabsSharedPreferences.edit().putString((accountName == null ? "" : accountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_1_NAME, tab1CurrentName).apply();
+ }
+ break;
+ case 1:
+ if (data.hasExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_NAME)) {
+ tab2CurrentName = data.getStringExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_NAME);
+ tab2NameSummaryTextView.setText(tab2CurrentName);
+ mainActivityTabsSharedPreferences.edit().putString((accountName == null ? "" : accountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_2_NAME, tab2CurrentName).apply();
+ } else if (data.hasExtra(MultiredditSelectionActivity.EXTRA_RETURN_MULTIREDDIT)) {
+ MultiReddit multireddit = data.getParcelableExtra(MultiredditSelectionActivity.EXTRA_RETURN_MULTIREDDIT);
+ if (multireddit != null) {
+ tab2CurrentName = multireddit.getPath();
+ tab2NameSummaryTextView.setText(tab2CurrentName);
+ mainActivityTabsSharedPreferences.edit().putString((accountName == null ? "" : accountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_2_NAME, tab2CurrentName).apply();
+ }
+ } else if (data.hasExtra(SearchActivity.EXTRA_RETURN_USER_NAME)) {
+ tab2CurrentName = data.getStringExtra(SearchActivity.EXTRA_RETURN_USER_NAME);
+ tab2NameSummaryTextView.setText(tab2CurrentName);
+ mainActivityTabsSharedPreferences.edit().putString((accountName == null ? "" : accountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_2_NAME, tab2CurrentName).apply();
+ }
+ break;
+ case 2:
+ if (data.hasExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_NAME)) {
+ tab3CurrentName = data.getStringExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_NAME);
+ tab3NameSummaryTextView.setText(tab3CurrentName);
+ mainActivityTabsSharedPreferences.edit().putString((accountName == null ? "" : accountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_3_NAME, tab3CurrentName).apply();
+ } else if (data.hasExtra(MultiredditSelectionActivity.EXTRA_RETURN_MULTIREDDIT)) {
+ MultiReddit multireddit = data.getParcelableExtra(MultiredditSelectionActivity.EXTRA_RETURN_MULTIREDDIT);
+ if (multireddit != null) {
+ tab3CurrentName = multireddit.getPath();
+ tab3NameSummaryTextView.setText(tab3CurrentName);
+ mainActivityTabsSharedPreferences.edit().putString((accountName == null ? "" : accountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_3_NAME, tab3CurrentName).apply();
+ }
+ } else if (data.hasExtra(SearchActivity.EXTRA_RETURN_USER_NAME)) {
+ tab3CurrentName = data.getStringExtra(SearchActivity.EXTRA_RETURN_USER_NAME);
+ tab3NameSummaryTextView.setText(tab3CurrentName);
+ mainActivityTabsSharedPreferences.edit().putString((accountName == null ? "" : accountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_3_NAME, tab3CurrentName).apply();
+ }
+ break;
+ }
}
}
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 2a5f19d0..0d710862 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
@@ -175,37 +175,57 @@
</LinearLayout>
- <LinearLayout
- android:id="@+id/tab_1_name_linear_layout_customize_main_page_tabs_fragment"
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:id="@+id/tab_1_name_constraint_layout_customize_main_page_tabs_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
+ android:background="?attr/selectableItemBackground"
+ android:clickable="true"
+ android:focusable="true"
android:orientation="vertical"
- android:paddingTop="16dp"
- android:paddingBottom="16dp"
android:paddingStart="72dp"
+ android:paddingTop="16dp"
android:paddingEnd="16dp"
- android:clickable="true"
- android:focusable="true"
- android:background="?attr/selectableItemBackground"
+ android:paddingBottom="16dp"
android:visibility="gone">
<TextView
android:id="@+id/tab_1_name_title_text_view_customize_main_page_tabs_fragment"
- android:layout_width="match_parent"
+ android:layout_width="0dp"
android:layout_height="wrap_content"
+ android:fontFamily="?attr/font_family"
android:textColor="@color/primaryTextColor"
android:textSize="?attr/font_16"
- android:fontFamily="?attr/font_family" />
+ app:layout_constraintEnd_toStartOf="@id/tab_1_name_add_image_view_customize_main_page_tabs_fragment"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tab_1_name_summary_text_view_customize_main_page_tabs_fragment"
- android:layout_width="match_parent"
+ android:layout_width="0dp"
android:layout_height="wrap_content"
+ android:fontFamily="?attr/font_family"
android:textColor="?attr/secondaryTextColor"
android:textSize="?attr/font_default"
- android:fontFamily="?attr/font_family" />
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toStartOf="@id/tab_1_name_add_image_view_customize_main_page_tabs_fragment"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/tab_1_name_title_text_view_customize_main_page_tabs_fragment" />
- </LinearLayout>
+ <ImageView
+ android:id="@+id/tab_1_name_add_image_view_customize_main_page_tabs_fragment"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="8dp"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ android:src="@drawable/ic_add_day_night_24dp"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
+
+ </androidx.constraintlayout.widget.ConstraintLayout>
<View
android:id="@+id/divider_2_customize_main_page_tabs_fragment"
@@ -287,8 +307,8 @@
</LinearLayout>
- <LinearLayout
- android:id="@+id/tab_2_name_linear_layout_customize_main_page_tabs_fragment"
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:id="@+id/tab_2_name_constraint_layout_customize_main_page_tabs_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
@@ -303,21 +323,41 @@
<TextView
android:id="@+id/tab_2_name_title_text_view_customize_main_page_tabs_fragment"
- android:layout_width="match_parent"
+ android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="@color/primaryTextColor"
android:textSize="?attr/font_16"
- android:fontFamily="?attr/font_family" />
+ android:fontFamily="?attr/font_family"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toStartOf="@id/tab_2_name_add_image_view_customize_main_page_tabs_fragment" />
<TextView
android:id="@+id/tab_2_name_summary_text_view_customize_main_page_tabs_fragment"
- android:layout_width="match_parent"
+ android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="?attr/secondaryTextColor"
android:textSize="?attr/font_default"
- android:fontFamily="?attr/font_family" />
+ android:fontFamily="?attr/font_family"
+ app:layout_constraintTop_toBottomOf="@id/tab_2_name_title_text_view_customize_main_page_tabs_fragment"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toStartOf="@id/tab_2_name_add_image_view_customize_main_page_tabs_fragment" />
+
+ <ImageView
+ android:id="@+id/tab_2_name_add_image_view_customize_main_page_tabs_fragment"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="8dp"
+ android:src="@drawable/ic_add_day_night_24dp"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent" />
- </LinearLayout>
+ </androidx.constraintlayout.widget.ConstraintLayout>
<View
android:id="@+id/divider_3_customize_main_page_tabs_fragment"
@@ -399,8 +439,8 @@
</LinearLayout>
- <LinearLayout
- android:id="@+id/tab_3_name_linear_layout_customize_main_page_tabs_fragment"
+ <androidx.constraintlayout.widget.ConstraintLayout
+ android:id="@+id/tab_3_name_constraint_layout_customize_main_page_tabs_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
@@ -415,21 +455,41 @@
<TextView
android:id="@+id/tab_3_name_title_text_view_customize_main_page_tabs_fragment"
- android:layout_width="match_parent"
+ android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="@color/primaryTextColor"
android:textSize="?attr/font_16"
- android:fontFamily="?attr/font_family" />
+ android:fontFamily="?attr/font_family"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toStartOf="@id/tab_3_name_add_image_view_customize_main_page_tabs_fragment" />
<TextView
android:id="@+id/tab_3_name_summary_text_view_customize_main_page_tabs_fragment"
- android:layout_width="match_parent"
+ android:layout_width="0dp"
android:layout_height="wrap_content"
android:textColor="?attr/secondaryTextColor"
android:textSize="?attr/font_default"
- android:fontFamily="?attr/font_family" />
-
- </LinearLayout>
+ android:fontFamily="?attr/font_family"
+ app:layout_constraintTop_toBottomOf="@id/tab_3_name_title_text_view_customize_main_page_tabs_fragment"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintEnd_toStartOf="@id/tab_3_name_add_image_view_customize_main_page_tabs_fragment" />
+
+ <ImageView
+ android:id="@+id/tab_3_name_add_image_view_customize_main_page_tabs_fragment"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:padding="8dp"
+ android:src="@drawable/ic_add_day_night_24dp"
+ android:background="?actionBarItemBackground"
+ android:clickable="true"
+ android:focusable="true"
+ app:layout_constraintTop_toTopOf="parent"
+ app:layout_constraintBottom_toBottomOf="parent"
+ app:layout_constraintEnd_toEndOf="parent" />
+
+ </androidx.constraintlayout.widget.ConstraintLayout>
<View
android:id="@+id/divider_4_customize_main_page_tabs_fragment"
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 78c0e0cb..f5654e8e 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -507,7 +507,7 @@
<string name="settings_tab_title">Title</string>
<string name="settings_tab_post_type">Type</string>
<string name="settings_tab_subreddit_name">Subreddit Name (Without r/ prefix)</string>
- <string name="settings_tab_multi_reddit_name">MultiReddit Name (/user/yourusername/m/yourmultiredditname)</string>
+ <string name="settings_tab_multi_reddit_name">MultiReddit Path (/user/yourusername/m/yourmultiredditname)</string>
<string name="settings_tab_username">Username (Without u/ prefix)</string>
<string name="no_developer_easter_egg">There\'s no developer options here</string>
<string name="settings_download_location_title">Download Location</string>