aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java/ml/docilealligator
diff options
context:
space:
mode:
authorDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-09-09 21:21:25 +0000
committerDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2024-09-09 21:21:25 +0000
commit2b77e3fcd9b468e080a24295d93c0a0cbb610bd0 (patch)
tree8ee4a34631d0f14baec1bcc4bb1dfd9fd49c2f65 /app/src/main/java/ml/docilealligator
parentfe8a9afec7f9d1a9c5db48aab246bf5530f89a4e (diff)
downloadinfinity-for-reddit-2b77e3fcd9b468e080a24295d93c0a0cbb610bd0.tar
infinity-for-reddit-2b77e3fcd9b468e080a24295d93c0a0cbb610bd0.tar.gz
infinity-for-reddit-2b77e3fcd9b468e080a24295d93c0a0cbb610bd0.tar.bz2
infinity-for-reddit-2b77e3fcd9b468e080a24295d93c0a0cbb610bd0.tar.lz
infinity-for-reddit-2b77e3fcd9b468e080a24295d93c0a0cbb610bd0.tar.xz
infinity-for-reddit-2b77e3fcd9b468e080a24295d93c0a0cbb610bd0.tar.zst
infinity-for-reddit-2b77e3fcd9b468e080a24295d93c0a0cbb610bd0.zip
Use SubscribedThingListingActivity to select a multireddit.
Diffstat (limited to 'app/src/main/java/ml/docilealligator')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/MultiredditSelectionActivity.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java37
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java65
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java58
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/MultiRedditListingFragment.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/settings/CustomizeMainPageTabsFragment.java22
6 files changed, 114 insertions, 74 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 97dc817d..5f9dace8 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MultiredditSelectionActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MultiredditSelectionActivity.java
@@ -142,7 +142,7 @@ public class MultiredditSelectionActivity extends BaseActivity implements Activi
if (initializeFragment) {
mFragment = new MultiRedditListingFragment();
Bundle bundle = new Bundle();
- bundle.putBoolean(MultiRedditListingFragment.EXTRA_IS_GETTING_MULTIREDDIT_INFO, true);
+ bundle.putBoolean(MultiRedditListingFragment.EXTRA_IS_MULTIREDDIT_SELECTION, true);
mFragment.setArguments(bundle);
getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout_multireddit_selection_activity, mFragment).commit();
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java
index 8b3f70a8..fc92dcda 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java
@@ -83,6 +83,7 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti
public static final int EXTRA_THING_SELECTION_TYPE_ALL = 0;
public static final int EXTRA_THING_SELECTION_TYPE_SUBREDDIT = 1;
public static final int EXTRA_THING_SELECTION_TYPE_USER = 2;
+ public static final int EXTRA_THING_SELECTION_TYPE_MULTIREDDIT = 3;
private static final String INSERT_SUBSCRIBED_SUBREDDIT_STATE = "ISSS";
private static final String INSERT_MULTIREDDIT_STATE = "IMS";
@@ -191,8 +192,12 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti
isThingSelectionMode = getIntent().getBooleanExtra(EXTRA_THING_SELECTION_MODE, false);
thingSelectionType = getIntent().getIntExtra(EXTRA_THING_SELECTION_TYPE, EXTRA_THING_SELECTION_TYPE_ALL);
- if (isThingSelectionMode && thingSelectionType == EXTRA_THING_SELECTION_TYPE_SUBREDDIT) {
- getSupportActionBar().setTitle(R.string.subreddit_selection_activity_label);
+ if (isThingSelectionMode) {
+ if (thingSelectionType == EXTRA_THING_SELECTION_TYPE_SUBREDDIT) {
+ getSupportActionBar().setTitle(R.string.subreddit_selection_activity_label);
+ } else if (thingSelectionType == EXTRA_THING_SELECTION_TYPE_MULTIREDDIT) {
+ getSupportActionBar().setTitle(R.string.multireddit_selection_activity_label);
+ }
}
if (isThingSelectionMode && thingSelectionType != EXTRA_THING_SELECTION_TYPE_ALL) {
@@ -307,7 +312,17 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti
intent.putExtra(SearchActivity.EXTRA_SEARCH_ONLY_SUBREDDITS, true);
} else if (thingSelectionType == EXTRA_THING_SELECTION_TYPE_USER) {
intent.putExtra(SearchActivity.EXTRA_SEARCH_ONLY_USERS, true);
- } else {
+ } else if (thingSelectionType == EXTRA_THING_SELECTION_TYPE_MULTIREDDIT) {
+ item.setVisible(false);
+ binding.searchEditTextSubscribedThingListingActivity.setVisibility(View.VISIBLE);
+ binding.searchEditTextSubscribedThingListingActivity.requestFocus();
+ if (binding.searchEditTextSubscribedThingListingActivity.requestFocus()) {
+ InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
+ imm.showSoftInput(binding.searchEditTextSubscribedThingListingActivity, InputMethodManager.SHOW_IMPLICIT);
+ }
+ return true;
+ }
+ else {
intent.putExtra(SearchActivity.EXTRA_SEARCH_SUBREDDITS_AND_USERS, true);
}
requestSearchThingLauncher.launch(intent);
@@ -511,8 +526,11 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti
private class SectionsPagerAdapter extends FragmentPagerAdapter {
+ @Nullable
private SubscribedSubredditsListingFragment subscribedSubredditsListingFragment;
+ @Nullable
private FollowedUsersListingFragment followedUsersListingFragment;
+ @Nullable
private MultiRedditListingFragment multiRedditListingFragment;
public SectionsPagerAdapter(FragmentManager fm) {
@@ -528,6 +546,8 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti
return getSubscribedSubredditListingFragment();
case EXTRA_THING_SELECTION_TYPE_USER:
return getFollowedUserFragment();
+ case EXTRA_THING_SELECTION_TYPE_MULTIREDDIT:
+ return getMultiRedditListingFragment();
default:
switch (position) {
case 0:
@@ -574,7 +594,7 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti
private Fragment getMultiRedditListingFragment() {
MultiRedditListingFragment fragment = new MultiRedditListingFragment();
Bundle bundle = new Bundle();
- bundle.putBoolean(MultiRedditListingFragment.EXTRA_IS_GETTING_MULTIREDDIT_INFO, isThingSelectionMode);
+ bundle.putBoolean(MultiRedditListingFragment.EXTRA_IS_MULTIREDDIT_SELECTION, isThingSelectionMode);
fragment.setArguments(bundle);
return fragment;
}
@@ -587,6 +607,7 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti
return Account.ANONYMOUS_ACCOUNT.equals(accountName) ? 2 : 3;
case EXTRA_THING_SELECTION_TYPE_SUBREDDIT:
case EXTRA_THING_SELECTION_TYPE_USER:
+ case EXTRA_THING_SELECTION_TYPE_MULTIREDDIT:
return 1;
}
}
@@ -610,6 +631,8 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti
return Utils.getTabTextWithCustomFont(typeface, getString(R.string.subreddits));
case EXTRA_THING_SELECTION_TYPE_USER:
return Utils.getTabTextWithCustomFont(typeface, getString(R.string.users));
+ case EXTRA_THING_SELECTION_TYPE_MULTIREDDIT:
+ return Utils.getTabTextWithCustomFont(typeface, getString(R.string.multi_reddits));
}
}
switch (position) {
@@ -628,11 +651,11 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti
@Override
public Object instantiateItem(@NonNull ViewGroup container, int position) {
Fragment fragment = (Fragment) super.instantiateItem(container, position);
- if (position == 0) {
+ if (fragment instanceof SubscribedSubredditsListingFragment) {
subscribedSubredditsListingFragment = (SubscribedSubredditsListingFragment) fragment;
- } else if (position == 1) {
+ } else if (fragment instanceof FollowedUsersListingFragment) {
followedUsersListingFragment = (FollowedUsersListingFragment) fragment;
- } else {
+ } else if (fragment instanceof MultiRedditListingFragment) {
multiRedditListingFragment = (MultiRedditListingFragment) fragment;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java
index f609dde2..e95b0e6f 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java
@@ -24,6 +24,8 @@ import android.view.WindowManager;
import android.view.inputmethod.EditorInfo;
import android.widget.Toast;
+import androidx.activity.result.ActivityResultLauncher;
+import androidx.activity.result.contract.ActivityResultContracts;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
@@ -76,10 +78,10 @@ import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback;
import ml.docilealligator.infinityforreddit.account.Account;
import ml.docilealligator.infinityforreddit.adapters.SubredditAutocompleteRecyclerViewAdapter;
import ml.docilealligator.infinityforreddit.apis.RedditAPI;
+import ml.docilealligator.infinityforreddit.asynctasks.AccountManagement;
import ml.docilealligator.infinityforreddit.asynctasks.AddSubredditOrUserToMultiReddit;
import ml.docilealligator.infinityforreddit.asynctasks.CheckIsSubscribedToSubreddit;
import ml.docilealligator.infinityforreddit.asynctasks.InsertSubredditData;
-import ml.docilealligator.infinityforreddit.asynctasks.AccountManagement;
import ml.docilealligator.infinityforreddit.bottomsheetfragments.CopyTextBottomSheetFragment;
import ml.docilealligator.infinityforreddit.bottomsheetfragments.FABMoreOptionsBottomSheetFragment;
import ml.docilealligator.infinityforreddit.bottomsheetfragments.PostLayoutBottomSheetFragment;
@@ -132,7 +134,6 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
private static final String CURRENT_ONLINE_SUBSCRIBERS_STATE = "COSS";
private static final String MESSAGE_FULLNAME_STATE = "MFS";
private static final String NEW_ACCOUNT_NAME_STATE = "NANS";
- private static final int ADD_TO_MULTIREDDIT_REQUEST_CODE = 1;
public SubredditViewModel mSubredditViewModel;
@Inject
@@ -195,6 +196,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
private MaterialAlertDialogBuilder nsfwWarningBuilder;
private Bitmap subredditIconBitmap;
private ActivityViewSubredditDetailBinding binding;
+ private ActivityResultLauncher<Intent> requestMultiredditSelectionLauncher;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -453,6 +455,31 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
}
}
});
+
+ requestMultiredditSelectionLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> {
+ Intent data = result.getData();
+ if (data != null) {
+ MultiReddit multiReddit = data.getParcelableExtra(SelectThingReturnKey.RETRUN_EXTRA_MULTIREDDIT);
+ if (multiReddit != null) {
+ AddSubredditOrUserToMultiReddit.addSubredditOrUserToMultiReddit(mOauthRetrofit,
+ accessToken, multiReddit.getPath(), subredditName,
+ new AddSubredditOrUserToMultiReddit.AddSubredditOrUserToMultiRedditListener() {
+ @Override
+ public void success() {
+ Toast.makeText(ViewSubredditDetailActivity.this,
+ getString(R.string.add_subreddit_or_user_to_multireddit_success, subredditName, multiReddit.getDisplayName()), Toast.LENGTH_LONG).show();
+ }
+
+ @Override
+ public void failed(int code) {
+ Toast.makeText(ViewSubredditDetailActivity.this,
+ getString(R.string.add_subreddit_or_user_to_multireddit_failed, subredditName, multiReddit.getDisplayName()), Toast.LENGTH_LONG).show();
+ }
+ });
+ }
+
+ }
+ });
}
@Override
@@ -1126,8 +1153,10 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
Toast.makeText(this, R.string.login_first, Toast.LENGTH_SHORT).show();
return true;
}
- Intent intent = new Intent(this, MultiredditSelectionActivity.class);
- startActivityForResult(intent, ADD_TO_MULTIREDDIT_REQUEST_CODE);
+ Intent intent = new Intent(this, SubscribedThingListingActivity.class);
+ intent.putExtra(SubscribedThingListingActivity.EXTRA_THING_SELECTION_MODE, true);
+ intent.putExtra(SubscribedThingListingActivity.EXTRA_THING_SELECTION_TYPE, SubscribedThingListingActivity.EXTRA_THING_SELECTION_TYPE_MULTIREDDIT);
+ requestMultiredditSelectionLauncher.launch(intent);
} else if (itemId == R.id.action_add_to_post_filter_view_subreddit_detail_activity) {
Intent intent = new Intent(this, PostFilterPreferenceActivity.class);
intent.putExtra(PostFilterPreferenceActivity.EXTRA_SUBREDDIT_NAME, subredditName);
@@ -1162,34 +1191,6 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
}
@Override
- protected void onActivityResult(int requestCode, int resultCode, @Nullable Intent data) {
- super.onActivityResult(requestCode, resultCode, data);
- if (requestCode == ADD_TO_MULTIREDDIT_REQUEST_CODE && resultCode == RESULT_OK) {
- if (data != null) {
- MultiReddit multiReddit = data.getParcelableExtra(SelectThingReturnKey.RETRUN_EXTRA_MULTIREDDIT);
- if (multiReddit != null) {
- AddSubredditOrUserToMultiReddit.addSubredditOrUserToMultiReddit(mOauthRetrofit,
- accessToken, multiReddit.getPath(), subredditName,
- new AddSubredditOrUserToMultiReddit.AddSubredditOrUserToMultiRedditListener() {
- @Override
- public void success() {
- Toast.makeText(ViewSubredditDetailActivity.this,
- getString(R.string.add_subreddit_or_user_to_multireddit_success, subredditName, multiReddit.getDisplayName()), Toast.LENGTH_LONG).show();
- }
-
- @Override
- public void failed(int code) {
- Toast.makeText(ViewSubredditDetailActivity.this,
- getString(R.string.add_subreddit_or_user_to_multireddit_failed, subredditName, multiReddit.getDisplayName()), Toast.LENGTH_LONG).show();
- }
- });
- }
-
- }
- }
- }
-
- @Override
protected void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
outState.putBoolean(FETCH_SUBREDDIT_INFO_STATE, mFetchSubredditInfoSuccess);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java
index e70bf372..c5d1889f 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java
@@ -22,6 +22,8 @@ import android.view.WindowManager;
import android.view.inputmethod.EditorInfo;
import android.widget.Toast;
+import androidx.activity.result.ActivityResultLauncher;
+import androidx.activity.result.contract.ActivityResultContracts;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.coordinatorlayout.widget.CoordinatorLayout;
@@ -126,7 +128,6 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
public static final String EXTRA_MESSAGE_FULLNAME = "ENF";
public static final String EXTRA_NEW_ACCOUNT_NAME = "ENAN";
public static final int EDIT_COMMENT_REQUEST_CODE = 300;
- public static final int ADD_TO_MULTIREDDIT_REQUEST_CODE = 400;
private static final String FETCH_USER_INFO_STATE = "FSIS";
private static final String MESSAGE_FULLNAME_STATE = "MFS";
@@ -190,6 +191,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
private String mNewAccountName;
//private MaterialAlertDialogBuilder nsfwWarningBuilder;
private ActivityViewUserDetailBinding binding;
+ private ActivityResultLauncher<Intent> requestMultiredditSelectionLauncher;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -543,6 +545,31 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
karmaInfoBottomSheetFragment.show(getSupportFragmentManager(), karmaInfoBottomSheetFragment.getTag());
}
});
+
+ requestMultiredditSelectionLauncher = registerForActivityResult(new ActivityResultContracts.StartActivityForResult(), result -> {
+ Intent data = result.getData();
+ if (data != null) {
+ MultiReddit multiReddit = data.getParcelableExtra(SelectThingReturnKey.RETRUN_EXTRA_MULTIREDDIT);
+ if (multiReddit != null) {
+ AddSubredditOrUserToMultiReddit.addSubredditOrUserToMultiReddit(mOauthRetrofit,
+ accessToken, multiReddit.getPath(), "u_" + username,
+ new AddSubredditOrUserToMultiReddit.AddSubredditOrUserToMultiRedditListener() {
+ @Override
+ public void success() {
+ Toast.makeText(ViewUserDetailActivity.this,
+ getString(R.string.add_subreddit_or_user_to_multireddit_success, username, multiReddit.getDisplayName()), Toast.LENGTH_LONG).show();
+ }
+
+ @Override
+ public void failed(int code) {
+ Toast.makeText(ViewUserDetailActivity.this,
+ getString(R.string.add_subreddit_or_user_to_multireddit_failed, username, multiReddit.getDisplayName()), Toast.LENGTH_LONG).show();
+ }
+ });
+ }
+
+ }
+ });
}
@Override
@@ -1146,8 +1173,11 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
Toast.makeText(this, R.string.login_first, Toast.LENGTH_SHORT).show();
return true;
}
- Intent intent = new Intent(this, MultiredditSelectionActivity.class);
- startActivityForResult(intent, ADD_TO_MULTIREDDIT_REQUEST_CODE);
+ Intent intent = new Intent(this, SubscribedThingListingActivity.class);
+ intent.putExtra(SubscribedThingListingActivity.EXTRA_THING_SELECTION_MODE, true);
+ intent.putExtra(SubscribedThingListingActivity.EXTRA_THING_SELECTION_TYPE,
+ SubscribedThingListingActivity.EXTRA_THING_SELECTION_TYPE_MULTIREDDIT);
+ requestMultiredditSelectionLauncher.launch(intent);
} else if (itemId == R.id.action_add_to_post_filter_view_user_detail_activity) {
Intent intent = new Intent(this, PostFilterPreferenceActivity.class);
intent.putExtra(PostFilterPreferenceActivity.EXTRA_USER_NAME, username);
@@ -1201,28 +1231,6 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
data.getExtras().getInt(EditCommentActivity.RETURN_EXTRA_EDITED_COMMENT_POSITION));
}
}
- } else if (requestCode == ADD_TO_MULTIREDDIT_REQUEST_CODE) {
- if (data != null) {
- MultiReddit multiReddit = data.getParcelableExtra(SelectThingReturnKey.RETRUN_EXTRA_MULTIREDDIT);
- if (multiReddit != null) {
- AddSubredditOrUserToMultiReddit.addSubredditOrUserToMultiReddit(mOauthRetrofit,
- accessToken, multiReddit.getPath(), "u_" + username,
- new AddSubredditOrUserToMultiReddit.AddSubredditOrUserToMultiRedditListener() {
- @Override
- public void success() {
- Toast.makeText(ViewUserDetailActivity.this,
- getString(R.string.add_subreddit_or_user_to_multireddit_success, username, multiReddit.getDisplayName()), Toast.LENGTH_LONG).show();
- }
-
- @Override
- public void failed(int code) {
- Toast.makeText(ViewUserDetailActivity.this,
- getString(R.string.add_subreddit_or_user_to_multireddit_failed, username, multiReddit.getDisplayName()), Toast.LENGTH_LONG).show();
- }
- });
- }
-
- }
}
}
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/MultiRedditListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/MultiRedditListingFragment.java
index e95a99ea..c603d222 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/MultiRedditListingFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/MultiRedditListingFragment.java
@@ -46,7 +46,7 @@ import retrofit2.Retrofit;
public class MultiRedditListingFragment extends Fragment implements FragmentCommunicator {
- public static final String EXTRA_IS_GETTING_MULTIREDDIT_INFO = "EIGMI";
+ public static final String EXTRA_IS_MULTIREDDIT_SELECTION = "EIMS";
@Inject
RedditDataRoomDatabase mRedditDataRoomDatabase;
@@ -91,7 +91,7 @@ public class MultiRedditListingFragment extends Fragment implements FragmentComm
}
}
- boolean isGettingMultiredditInfo = getArguments().getBoolean(EXTRA_IS_GETTING_MULTIREDDIT_INFO, false);
+ boolean isGettingMultiredditInfo = getArguments().getBoolean(EXTRA_IS_MULTIREDDIT_SELECTION, false);
if (mActivity.accountName.equals(Account.ANONYMOUS_ACCOUNT)) {
binding.swipeRefreshLayoutMultiRedditListingFragment.setEnabled(false);
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 b3753dcf..d352a5e7 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CustomizeMainPageTabsFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CustomizeMainPageTabsFragment.java
@@ -27,7 +27,6 @@ import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.SelectThingReturnKey;
import ml.docilealligator.infinityforreddit.account.Account;
-import ml.docilealligator.infinityforreddit.activities.MultiredditSelectionActivity;
import ml.docilealligator.infinityforreddit.activities.SearchActivity;
import ml.docilealligator.infinityforreddit.activities.SettingsActivity;
import ml.docilealligator.infinityforreddit.activities.SubscribedThingListingActivity;
@@ -510,7 +509,10 @@ public class CustomizeMainPageTabsFragment extends Fragment {
break;
}
case 4: {
- Intent intent = new Intent(activity, MultiredditSelectionActivity.class);
+ Intent intent = new Intent(activity, SubscribedThingListingActivity.class);
+ intent.putExtra(SubscribedThingListingActivity.EXTRA_THING_SELECTION_MODE, true);
+ intent.putExtra(SubscribedThingListingActivity.EXTRA_THING_SELECTION_TYPE,
+ SubscribedThingListingActivity.EXTRA_THING_SELECTION_TYPE_MULTIREDDIT);
startActivityForResult(intent, tab);
break;
}
@@ -533,7 +535,10 @@ public class CustomizeMainPageTabsFragment extends Fragment {
break;
}
case 4: {
- Intent intent = new Intent(activity, MultiredditSelectionActivity.class);
+ Intent intent = new Intent(activity, SubscribedThingListingActivity.class);
+ intent.putExtra(SubscribedThingListingActivity.EXTRA_THING_SELECTION_MODE, true);
+ intent.putExtra(SubscribedThingListingActivity.EXTRA_THING_SELECTION_TYPE,
+ SubscribedThingListingActivity.EXTRA_THING_SELECTION_TYPE_MULTIREDDIT);
startActivityForResult(intent, tab);
break;
}
@@ -556,7 +561,10 @@ public class CustomizeMainPageTabsFragment extends Fragment {
break;
}
case 4: {
- Intent intent = new Intent(activity, MultiredditSelectionActivity.class);
+ Intent intent = new Intent(activity, SubscribedThingListingActivity.class);
+ intent.putExtra(SubscribedThingListingActivity.EXTRA_THING_SELECTION_MODE, true);
+ intent.putExtra(SubscribedThingListingActivity.EXTRA_THING_SELECTION_TYPE,
+ SubscribedThingListingActivity.EXTRA_THING_SELECTION_TYPE_MULTIREDDIT);
startActivityForResult(intent, tab);
break;
}
@@ -582,7 +590,7 @@ public class CustomizeMainPageTabsFragment extends Fragment {
tab1CurrentName = data.getStringExtra(SelectThingReturnKey.RETURN_EXTRA_SUBREDDIT_OR_USER_NAME);
binding.tab1NameSummaryTextViewCustomizeMainPageTabsFragment.setText(tab1CurrentName);
mainActivityTabsSharedPreferences.edit().putString((activity.accountName.equals(Account.ANONYMOUS_ACCOUNT) ? "" : activity.accountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_1_NAME, tab1CurrentName).apply();
- } else if (data.hasExtra(SelectThingReturnKey.RETRUN_EXTRA_MULTIREDDIT)) {
+ } else if (thingType == SelectThingReturnKey.THING_TYPE.MULTIREDDIT) {
MultiReddit multireddit = data.getParcelableExtra(SelectThingReturnKey.RETRUN_EXTRA_MULTIREDDIT);
if (multireddit != null) {
tab1CurrentName = multireddit.getPath();
@@ -600,7 +608,7 @@ public class CustomizeMainPageTabsFragment extends Fragment {
tab2CurrentName = data.getStringExtra(SelectThingReturnKey.RETURN_EXTRA_SUBREDDIT_OR_USER_NAME);
binding.tab2NameSummaryTextViewCustomizeMainPageTabsFragment.setText(tab2CurrentName);
mainActivityTabsSharedPreferences.edit().putString((activity.accountName.equals(Account.ANONYMOUS_ACCOUNT) ? "" : activity.accountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_2_NAME, tab2CurrentName).apply();
- } else if (data.hasExtra(SelectThingReturnKey.RETRUN_EXTRA_MULTIREDDIT)) {
+ } else if (thingType == SelectThingReturnKey.THING_TYPE.MULTIREDDIT) {
MultiReddit multireddit = data.getParcelableExtra(SelectThingReturnKey.RETRUN_EXTRA_MULTIREDDIT);
if (multireddit != null) {
tab2CurrentName = multireddit.getPath();
@@ -618,7 +626,7 @@ public class CustomizeMainPageTabsFragment extends Fragment {
tab3CurrentName = data.getStringExtra(SelectThingReturnKey.RETURN_EXTRA_SUBREDDIT_OR_USER_NAME);
binding.tab3NameSummaryTextViewCustomizeMainPageTabsFragment.setText(tab3CurrentName);
mainActivityTabsSharedPreferences.edit().putString((activity.accountName.equals(Account.ANONYMOUS_ACCOUNT) ? "" : activity.accountName) + SharedPreferencesUtils.MAIN_PAGE_TAB_3_NAME, tab3CurrentName).apply();
- } else if (data.hasExtra(SelectThingReturnKey.RETRUN_EXTRA_MULTIREDDIT)) {
+ } else if (thingType == SelectThingReturnKey.THING_TYPE.MULTIREDDIT) {
MultiReddit multireddit = data.getParcelableExtra(SelectThingReturnKey.RETRUN_EXTRA_MULTIREDDIT);
if (multireddit != null) {
tab3CurrentName = multireddit.getPath();