aboutsummaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/SelectThingReturnKey.java16
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/MultiredditSelectionActivity.java11
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java7
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostImageActivity.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostLinkActivity.java7
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostPollActivity.java7
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostTextActivity.java7
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostVideoActivity.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchActivity.java23
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java20
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubmitCrosspostActivity.java7
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubredditSelectionActivity.java5
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java1
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java11
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SearchActivityRecyclerViewAdapter.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/FollowedUsersListingFragment.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/MultiRedditListingFragment.java11
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SubscribedSubredditsListingFragment.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/recentsearchquery/InsertRecentSearchQuery.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/recentsearchquery/RecentSearchQuery.java19
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/settings/CustomizeMainPageTabsFragment.java13
22 files changed, 107 insertions, 78 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/SelectThingReturnKey.java b/app/src/main/java/ml/docilealligator/infinityforreddit/SelectThingReturnKey.java
index a663f36f..d2b72696 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/SelectThingReturnKey.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/SelectThingReturnKey.java
@@ -1,7 +1,21 @@
package ml.docilealligator.infinityforreddit;
+import androidx.annotation.IntDef;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
public class SelectThingReturnKey {
public static final String RETURN_EXTRA_SUBREDDIT_OR_USER_NAME = "RESOUN";
public static final String RETURN_EXTRA_SUBREDDIT_OR_USER_ICON = "RESOUI";
- public static final String RETURN_EXTRA_IS_USER = "REIU";
+ public static final String RETRUN_EXTRA_MULTIREDDIT = "REM";
+ public static final String RETURN_EXTRA_THING_TYPE = "RETT";
+
+ @IntDef({THING_TYPE.SUBREDDIT, THING_TYPE.USER, THING_TYPE.MULTIREDDIT})
+ @Retention(RetentionPolicy.SOURCE)
+ public @interface THING_TYPE {
+ int SUBREDDIT = 0;
+ int USER = 1;
+ int MULTIREDDIT = 2;
+ }
}
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 d6a398ca..97dc817d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MultiredditSelectionActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/MultiredditSelectionActivity.java
@@ -1,7 +1,5 @@
package ml.docilealligator.infinityforreddit.activities;
-import android.app.Activity;
-import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Build;
import android.os.Bundle;
@@ -41,8 +39,6 @@ import retrofit2.Retrofit;
public class MultiredditSelectionActivity extends BaseActivity implements ActivityToolbarInterface {
- 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";
@@ -184,13 +180,6 @@ public class MultiredditSelectionActivity extends BaseActivity implements Activi
return false;
}
- public void getSelectedMultireddit(MultiReddit multiReddit) {
- Intent returnIntent = new Intent();
- returnIntent.putExtra(EXTRA_RETURN_MULTIREDDIT, multiReddit);
- setResult(Activity.RESULT_OK, returnIntent);
- finish();
- }
-
@Override
protected void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java
index efa02503..7bd95ca7 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostGalleryActivity.java
@@ -57,6 +57,7 @@ import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
import ml.docilealligator.infinityforreddit.RedditGalleryPayload;
+import ml.docilealligator.infinityforreddit.SelectThingReturnKey;
import ml.docilealligator.infinityforreddit.account.Account;
import ml.docilealligator.infinityforreddit.adapters.MarkdownBottomBarRecyclerViewAdapter;
import ml.docilealligator.infinityforreddit.adapters.RedditGallerySubmissionRecyclerViewAdapter;
@@ -670,10 +671,10 @@ public class PostGalleryActivity extends BaseActivity implements FlairBottomShee
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == SUBREDDIT_SELECTION_REQUEST_CODE) {
if (resultCode == RESULT_OK) {
- subredditName = data.getExtras().getString(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_NAME);
- iconUrl = data.getExtras().getString(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_ICON_URL);
+ subredditName = data.getStringExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_NAME);
+ iconUrl = data.getStringExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_ICON_URL);
subredditSelected = true;
- subredditIsUser = data.getExtras().getBoolean(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_IS_USER);
+ subredditIsUser = data.getIntExtra(SubredditSelectionActivity.EXTRA_RETURN_THING_TYPE, SelectThingReturnKey.THING_TYPE.SUBREDDIT) == SelectThingReturnKey.THING_TYPE.USER;
binding.subredditNameTextViewPostGalleryActivity.setTextColor(primaryTextColor);
binding.subredditNameTextViewPostGalleryActivity.setText(subredditName);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostImageActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostImageActivity.java
index 5d7e0d53..57b7c2c9 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostImageActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostImageActivity.java
@@ -44,6 +44,7 @@ import ml.docilealligator.infinityforreddit.Flair;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
+import ml.docilealligator.infinityforreddit.SelectThingReturnKey;
import ml.docilealligator.infinityforreddit.account.Account;
import ml.docilealligator.infinityforreddit.adapters.MarkdownBottomBarRecyclerViewAdapter;
import ml.docilealligator.infinityforreddit.asynctasks.LoadSubredditIcon;
@@ -632,7 +633,7 @@ public class PostImageActivity extends BaseActivity implements FlairBottomSheetF
subredditName = data.getExtras().getString(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_NAME);
iconUrl = data.getExtras().getString(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_ICON_URL);
subredditSelected = true;
- subredditIsUser = data.getExtras().getBoolean(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_IS_USER);
+ subredditIsUser = data.getIntExtra(SubredditSelectionActivity.EXTRA_RETURN_THING_TYPE, SelectThingReturnKey.THING_TYPE.SUBREDDIT) == SelectThingReturnKey.THING_TYPE.USER;
binding.subredditNameTextViewPostImageActivity.setTextColor(primaryTextColor);
binding.subredditNameTextViewPostImageActivity.setText(subredditName);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostLinkActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostLinkActivity.java
index 174cf79d..19600d0a 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostLinkActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostLinkActivity.java
@@ -39,6 +39,7 @@ import ml.docilealligator.infinityforreddit.Flair;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
+import ml.docilealligator.infinityforreddit.SelectThingReturnKey;
import ml.docilealligator.infinityforreddit.account.Account;
import ml.docilealligator.infinityforreddit.adapters.MarkdownBottomBarRecyclerViewAdapter;
import ml.docilealligator.infinityforreddit.apis.TitleSuggestion;
@@ -613,10 +614,10 @@ public class PostLinkActivity extends BaseActivity implements FlairBottomSheetFr
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
if (requestCode == SUBREDDIT_SELECTION_REQUEST_CODE) {
- subredditName = data.getExtras().getString(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_NAME);
- iconUrl = data.getExtras().getString(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_ICON_URL);
+ subredditName = data.getStringExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_NAME);
+ iconUrl = data.getStringExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_ICON_URL);
subredditSelected = true;
- subredditIsUser = data.getExtras().getBoolean(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_IS_USER);
+ subredditIsUser = data.getIntExtra(SubredditSelectionActivity.EXTRA_RETURN_THING_TYPE, SelectThingReturnKey.THING_TYPE.SUBREDDIT) == SelectThingReturnKey.THING_TYPE.USER;
binding.subredditNameTextViewPostLinkActivity.setTextColor(primaryTextColor);
binding.subredditNameTextViewPostLinkActivity.setText(subredditName);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostPollActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostPollActivity.java
index b836c718..4d30f7cc 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostPollActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostPollActivity.java
@@ -56,6 +56,7 @@ import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.PollPayload;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
+import ml.docilealligator.infinityforreddit.SelectThingReturnKey;
import ml.docilealligator.infinityforreddit.UploadImageEnabledActivity;
import ml.docilealligator.infinityforreddit.UploadedImage;
import ml.docilealligator.infinityforreddit.account.Account;
@@ -733,10 +734,10 @@ public class PostPollActivity extends BaseActivity implements FlairBottomSheetFr
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
if (requestCode == SUBREDDIT_SELECTION_REQUEST_CODE) {
- subredditName = data.getExtras().getString(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_NAME);
- iconUrl = data.getExtras().getString(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_ICON_URL);
+ subredditName = data.getStringExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_NAME);
+ iconUrl = data.getStringExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_ICON_URL);
subredditSelected = true;
- subredditIsUser = data.getExtras().getBoolean(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_IS_USER);
+ subredditIsUser = data.getIntExtra(SubredditSelectionActivity.EXTRA_RETURN_THING_TYPE, SelectThingReturnKey.THING_TYPE.SUBREDDIT) == SelectThingReturnKey.THING_TYPE.USER;
binding.subredditNameTextViewPostPollActivity.setTextColor(primaryTextColor);
binding.subredditNameTextViewPostPollActivity.setText(subredditName);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostTextActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostTextActivity.java
index cb9960c1..89dfa5d0 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostTextActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostTextActivity.java
@@ -46,6 +46,7 @@ import ml.docilealligator.infinityforreddit.Flair;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
+import ml.docilealligator.infinityforreddit.SelectThingReturnKey;
import ml.docilealligator.infinityforreddit.UploadImageEnabledActivity;
import ml.docilealligator.infinityforreddit.UploadedImage;
import ml.docilealligator.infinityforreddit.account.Account;
@@ -602,10 +603,10 @@ public class PostTextActivity extends BaseActivity implements FlairBottomSheetFr
super.onActivityResult(requestCode, resultCode, data);
if (resultCode == RESULT_OK) {
if (requestCode == SUBREDDIT_SELECTION_REQUEST_CODE) {
- subredditName = data.getExtras().getString(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_NAME);
- iconUrl = data.getExtras().getString(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_ICON_URL);
+ subredditName = data.getStringExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_NAME);
+ iconUrl = data.getStringExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_ICON_URL);
subredditSelected = true;
- subredditIsUser = data.getExtras().getBoolean(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_IS_USER);
+ subredditIsUser = data.getIntExtra(SubredditSelectionActivity.EXTRA_RETURN_THING_TYPE, SelectThingReturnKey.THING_TYPE.SUBREDDIT) == SelectThingReturnKey.THING_TYPE.USER;
binding.subredditNameTextViewPostTextActivity.setTextColor(primaryTextColor);
binding.subredditNameTextViewPostTextActivity.setText(subredditName);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostVideoActivity.java
index 4f097bec..c92944ba 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostVideoActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/PostVideoActivity.java
@@ -50,6 +50,7 @@ import ml.docilealligator.infinityforreddit.Flair;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
+import ml.docilealligator.infinityforreddit.SelectThingReturnKey;
import ml.docilealligator.infinityforreddit.account.Account;
import ml.docilealligator.infinityforreddit.adapters.MarkdownBottomBarRecyclerViewAdapter;
import ml.docilealligator.infinityforreddit.asynctasks.LoadSubredditIcon;
@@ -658,7 +659,7 @@ public class PostVideoActivity extends BaseActivity implements FlairBottomSheetF
subredditName = data.getStringExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_NAME);
iconUrl = data.getStringExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_ICON_URL);
subredditSelected = true;
- subredditIsUser = data.getBooleanExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_IS_USER, false);
+ subredditIsUser = data.getIntExtra(SubredditSelectionActivity.EXTRA_RETURN_THING_TYPE, SelectThingReturnKey.THING_TYPE.SUBREDDIT) == SelectThingReturnKey.THING_TYPE.USER;
binding.subredditNameTextViewPostVideoActivity.setTextColor(primaryTextColor);
binding.subredditNameTextViewPostVideoActivity.setText(subredditName);
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 d9c02988..de0b643f 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchActivity.java
@@ -50,6 +50,7 @@ import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.customviews.slidr.Slidr;
import ml.docilealligator.infinityforreddit.databinding.ActivitySearchBinding;
import ml.docilealligator.infinityforreddit.events.SwitchAccountEvent;
+import ml.docilealligator.infinityforreddit.multireddit.MultiReddit;
import ml.docilealligator.infinityforreddit.recentsearchquery.RecentSearchQuery;
import ml.docilealligator.infinityforreddit.recentsearchquery.RecentSearchQueryViewModel;
import ml.docilealligator.infinityforreddit.subreddit.ParseSubredditData;
@@ -66,7 +67,7 @@ public class SearchActivity extends BaseActivity {
public static final String EXTRA_QUERY = "EQ";
public static final String EXTRA_SEARCH_IN_SUBREDDIT_OR_USER_NAME = "ESISOUN";
- public static final String EXTRA_SEARCH_IN_SUBREDDIT_IS_USER = "ESISIU";
+ public static final String EXTRA_SEARCH_IN_THING_TYPE = "ESITY";
public static final String EXTRA_SEARCH_ONLY_SUBREDDITS = "ESOS";
public static final String EXTRA_SEARCH_ONLY_USERS = "ESOU";
public static final String EXTRA_SEARCH_SUBREDDITS_AND_USERS = "ESSAU";
@@ -80,7 +81,7 @@ public class SearchActivity extends BaseActivity {
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";
+ private static final String SEARCH_IN_THING_TYPE_STATE = "SITTS";
private static final int SUBREDDIT_SELECTION_REQUEST_CODE = 0;
private static final int SUBREDDIT_SEARCH_REQUEST_CODE = 1;
@@ -106,7 +107,9 @@ public class SearchActivity extends BaseActivity {
Executor executor;
private String query;
private String searchInSubredditOrUserName;
- private boolean searchInIsUser;
+ private MultiReddit searchInMultiReddit;
+ @SelectThingReturnKey.THING_TYPE
+ private int searchInThingType;
private boolean searchOnlySubreddits;
private boolean searchOnlyUsers;
private boolean searchSubredditsAndUsers;
@@ -298,7 +301,7 @@ public class SearchActivity extends BaseActivity {
if (savedInstanceState != null) {
searchInSubredditOrUserName = savedInstanceState.getString(SUBREDDIT_NAME_STATE);
- searchInIsUser = savedInstanceState.getBoolean(SUBREDDIT_IS_USER_STATE);
+ searchInThingType = savedInstanceState.getInt(SEARCH_IN_THING_TYPE_STATE);
if (searchInSubredditOrUserName == null) {
binding.subredditNameTextViewSearchActivity.setText(R.string.all_subreddits);
@@ -317,7 +320,7 @@ public class SearchActivity extends BaseActivity {
}
searchInSubredditOrUserName = returnIntent.getStringExtra(SelectThingReturnKey.RETURN_EXTRA_SUBREDDIT_OR_USER_NAME);
- searchInIsUser = returnIntent.getBooleanExtra(SelectThingReturnKey.RETURN_EXTRA_IS_USER, false);
+ searchInThingType = returnIntent.getIntExtra(SelectThingReturnKey.RETURN_EXTRA_THING_TYPE, SelectThingReturnKey.THING_TYPE.SUBREDDIT);
if (searchInSubredditOrUserName == null) {
binding.subredditNameTextViewSearchActivity.setText(R.string.all_subreddits);
@@ -345,7 +348,7 @@ public class SearchActivity extends BaseActivity {
if (intent.hasExtra(EXTRA_SEARCH_IN_SUBREDDIT_OR_USER_NAME)) {
searchInSubredditOrUserName = intent.getStringExtra(EXTRA_SEARCH_IN_SUBREDDIT_OR_USER_NAME);
binding.subredditNameTextViewSearchActivity.setText(searchInSubredditOrUserName);
- searchInIsUser = intent.getBooleanExtra(EXTRA_SEARCH_IN_SUBREDDIT_IS_USER, false);
+ searchInThingType = intent.getIntExtra(EXTRA_SEARCH_IN_THING_TYPE, SelectThingReturnKey.THING_TYPE.SUBREDDIT);
}
}
@@ -355,7 +358,7 @@ public class SearchActivity extends BaseActivity {
@Override
public void onClick(RecentSearchQuery recentSearchQuery) {
searchInSubredditOrUserName = recentSearchQuery.getSearchInSubredditOrUserName();
- searchInIsUser = recentSearchQuery.isSearchInIsUser();
+ searchInThingType = recentSearchQuery.getSearchInThingType();
search(recentSearchQuery.getSearchQuery());
}
@@ -450,7 +453,7 @@ public class SearchActivity extends BaseActivity {
intent.putExtra(SearchResultActivity.EXTRA_QUERY, query);
if (searchInSubredditOrUserName != null) {
intent.putExtra(SearchResultActivity.EXTRA_SEARCH_IN_SUBREDDIT_OR_USER_NAME, searchInSubredditOrUserName);
- intent.putExtra(SearchResultActivity.EXTRA_SEARCH_IN_SUBREDDIT_IS_USER, searchInIsUser);
+ intent.putExtra(SearchResultActivity.EXTRA_SEARCH_IN_THING_TYPE, searchInThingType);
}
startActivity(intent);
finish();
@@ -515,7 +518,7 @@ public class SearchActivity extends BaseActivity {
if (resultCode == RESULT_OK && data != null) {
if (requestCode == SUBREDDIT_SELECTION_REQUEST_CODE) {
searchInSubredditOrUserName = data.getStringExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_NAME);
- searchInIsUser = data.getBooleanExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_IS_USER, false);
+ searchInThingType = data.getIntExtra(SubredditSelectionActivity.EXTRA_RETURN_THING_TYPE, SelectThingReturnKey.THING_TYPE.SUBREDDIT);
if (searchInSubredditOrUserName == null) {
binding.subredditNameTextViewSearchActivity.setText(R.string.all_subreddits);
@@ -568,7 +571,7 @@ public class SearchActivity extends BaseActivity {
public void onSaveInstanceState(@NonNull Bundle outState) {
super.onSaveInstanceState(outState);
outState.putString(SUBREDDIT_NAME_STATE, searchInSubredditOrUserName);
- outState.putBoolean(SUBREDDIT_IS_USER_STATE, searchInIsUser);
+ outState.putInt(SEARCH_IN_THING_TYPE_STATE, searchInThingType);
}
@Override
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java
index 62e33ac3..169cd2a6 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SearchResultActivity.java
@@ -44,6 +44,7 @@ import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.RecyclerViewContentScrollingInterface;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
+import ml.docilealligator.infinityforreddit.SelectThingReturnKey;
import ml.docilealligator.infinityforreddit.SortType;
import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback;
import ml.docilealligator.infinityforreddit.account.Account;
@@ -85,7 +86,7 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
public static final String EXTRA_TRENDING_SOURCE = "ETS";
public static final String EXTRA_SEARCH_IN_SUBREDDIT_OR_USER_NAME = "ESISOUN";
public static final String EXTRA_SHOULD_RETURN_SUBREDDIT_AND_USER_NAME = "ESRSAUN";
- public static final String EXTRA_SEARCH_IN_SUBREDDIT_IS_USER = "ESISIU";
+ public static final String EXTRA_SEARCH_IN_THING_TYPE = "ESITT";
private static final String INSERT_SEARCH_QUERY_SUCCESS_STATE = "ISQSS";
@@ -120,7 +121,8 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
private Call<String> subredditAutocompleteCall;
private String mQuery;
private String mSearchInSubredditOrUserName;
- private boolean mSearchInIsUser;
+ @SelectThingReturnKey.THING_TYPE
+ private int mSearchInThingType;
private boolean mInsertSearchQuerySuccess;
private boolean mReturnSubredditAndUserName;
private FragmentManager fragmentManager;
@@ -179,7 +181,7 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
String query = intent.getStringExtra(EXTRA_QUERY);
mSearchInSubredditOrUserName = intent.getStringExtra(EXTRA_SEARCH_IN_SUBREDDIT_OR_USER_NAME);
- mSearchInIsUser = intent.getBooleanExtra(EXTRA_SEARCH_IN_SUBREDDIT_IS_USER, false);
+ mSearchInThingType = intent.getIntExtra(EXTRA_SEARCH_IN_THING_TYPE, SelectThingReturnKey.THING_TYPE.SUBREDDIT);
mReturnSubredditAndUserName = intent.getBooleanExtra(EXTRA_SHOULD_RETURN_SUBREDDIT_AND_USER_NAME, false);
if (query != null) {
@@ -341,7 +343,7 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
Intent intent = new Intent(this, SearchActivity.class);
if (mSearchInSubredditOrUserName != null && !mSearchInSubredditOrUserName.equals("")) {
intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_SUBREDDIT_OR_USER_NAME, mSearchInSubredditOrUserName);
- intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_SUBREDDIT_IS_USER, mSearchInIsUser);
+ intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_THING_TYPE, mSearchInThingType);
}
startActivity(intent);
break;
@@ -385,9 +387,9 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
return true;
});
- if (!accountName.equals(Account.ANONYMOUS_ACCOUNT)&& mSharedPreferences.getBoolean(SharedPreferencesUtils.ENABLE_SEARCH_HISTORY, true) && !mInsertSearchQuerySuccess && mQuery != null) {
+ if (!accountName.equals(Account.ANONYMOUS_ACCOUNT) && mSharedPreferences.getBoolean(SharedPreferencesUtils.ENABLE_SEARCH_HISTORY, true) && !mInsertSearchQuerySuccess && mQuery != null) {
InsertRecentSearchQuery.insertRecentSearchQueryListener(executor, new Handler(getMainLooper()),
- mRedditDataRoomDatabase, accountName, mQuery, mSearchInSubredditOrUserName, mSearchInIsUser,
+ mRedditDataRoomDatabase, accountName, mQuery, mSearchInSubredditOrUserName, mSearchInThingType,
() -> mInsertSearchQuerySuccess = true);
}
}
@@ -430,7 +432,7 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
Intent intent = new Intent(this, SearchActivity.class);
if (mSearchInSubredditOrUserName != null && !mSearchInSubredditOrUserName.equals("")) {
intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_SUBREDDIT_OR_USER_NAME, mSearchInSubredditOrUserName);
- intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_SUBREDDIT_IS_USER, mSearchInIsUser);
+ intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_THING_TYPE, mSearchInThingType);
}
intent.putExtra(SearchActivity.EXTRA_QUERY, mQuery);
finish();
@@ -543,7 +545,7 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
Intent intent = new Intent(this, SearchActivity.class);
if (mSearchInSubredditOrUserName != null && !mSearchInSubredditOrUserName.equals("")) {
intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_SUBREDDIT_OR_USER_NAME, mSearchInSubredditOrUserName);
- intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_SUBREDDIT_IS_USER, mSearchInIsUser);
+ intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_THING_TYPE, mSearchInThingType);
}
startActivity(intent);
break;
@@ -802,7 +804,7 @@ public class SearchResultActivity extends BaseActivity implements SortTypeSelect
PostFragment mFragment = new PostFragment();
Bundle bundle = new Bundle();
bundle.putInt(PostFragment.EXTRA_POST_TYPE, PostPagingSource.TYPE_SEARCH);
- bundle.putString(PostFragment.EXTRA_NAME, mSearchInIsUser ? "u_" + mSearchInSubredditOrUserName : mSearchInSubredditOrUserName);
+ bundle.putString(PostFragment.EXTRA_NAME, mSearchInThingType == SelectThingReturnKey.THING_TYPE.USER ? "u_" + mSearchInSubredditOrUserName : mSearchInSubredditOrUserName);
bundle.putString(PostFragment.EXTRA_QUERY, mQuery);
bundle.putString(PostFragment.EXTRA_TRENDING_SOURCE, getIntent().getStringExtra(EXTRA_TRENDING_SOURCE));
mFragment.setArguments(bundle);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubmitCrosspostActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubmitCrosspostActivity.java
index 9ad08b40..4645ccb0 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubmitCrosspostActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubmitCrosspostActivity.java
@@ -45,6 +45,7 @@ import ml.docilealligator.infinityforreddit.Flair;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
+import ml.docilealligator.infinityforreddit.SelectThingReturnKey;
import ml.docilealligator.infinityforreddit.account.Account;
import ml.docilealligator.infinityforreddit.asynctasks.LoadSubredditIcon;
import ml.docilealligator.infinityforreddit.bottomsheetfragments.AccountChooserBottomSheetFragment;
@@ -594,10 +595,10 @@ public class SubmitCrosspostActivity extends BaseActivity implements FlairBottom
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == SUBREDDIT_SELECTION_REQUEST_CODE) {
if (resultCode == RESULT_OK) {
- subredditName = data.getExtras().getString(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_NAME);
- iconUrl = data.getExtras().getString(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_ICON_URL);
+ subredditName = data.getStringExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_NAME);
+ iconUrl = data.getStringExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_ICON_URL);
subredditSelected = true;
- subredditIsUser = data.getExtras().getBoolean(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_IS_USER);
+ subredditIsUser = data.getIntExtra(SubredditSelectionActivity.EXTRA_RETURN_THING_TYPE, SelectThingReturnKey.THING_TYPE.SUBREDDIT) == SelectThingReturnKey.THING_TYPE.USER;
binding.subredditNameTextViewSubmitCrosspostActivity.setTextColor(primaryTextColor);
binding.subredditNameTextViewSubmitCrosspostActivity.setText(subredditName);
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 d1a540f9..4dfa2924 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubredditSelectionActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubredditSelectionActivity.java
@@ -31,6 +31,7 @@ import ml.docilealligator.infinityforreddit.FetchSubscribedThing;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
+import ml.docilealligator.infinityforreddit.SelectThingReturnKey;
import ml.docilealligator.infinityforreddit.account.Account;
import ml.docilealligator.infinityforreddit.asynctasks.InsertSubscribedThings;
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
@@ -52,7 +53,7 @@ public class SubredditSelectionActivity extends BaseActivity implements Activity
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";
+ public static final String EXTRA_RETURN_THING_TYPE = "ERTT";
private static final int SUBREDDIT_SEARCH_REQUEST_CODE = 0;
private static final String INSERT_SUBSCRIBED_SUBREDDIT_STATE = "ISSS";
@@ -254,7 +255,7 @@ public class SubredditSelectionActivity extends BaseActivity implements Activity
Intent returnIntent = new Intent();
returnIntent.putExtra(EXTRA_RETURN_SUBREDDIT_NAME, name);
returnIntent.putExtra(EXTRA_RETURN_SUBREDDIT_ICON_URL, iconUrl);
- returnIntent.putExtra(EXTRA_RETURN_SUBREDDIT_IS_USER, false);
+ returnIntent.putExtra(EXTRA_RETURN_THING_TYPE, SelectThingReturnKey.THING_TYPE.SUBREDDIT);
setResult(Activity.RESULT_OK, returnIntent);
finish();
}
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 750f049f..969fc706 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/SubscribedThingListingActivity.java
@@ -490,6 +490,7 @@ public class SubscribedThingListingActivity extends BaseActivity implements Acti
MultiRedditListingFragment fragment = new MultiRedditListingFragment();
Bundle bundle = new Bundle();
+ bundle.putBoolean(MultiRedditListingFragment.EXTRA_IS_GETTING_MULTIREDDIT_INFO, isThingSelectionMode);
fragment.setArguments(bundle);
return 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 939a0fba..f750128a 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewSubredditDetailActivity.java
@@ -70,6 +70,7 @@ import ml.docilealligator.infinityforreddit.MarkPostAsReadInterface;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.RecyclerViewContentScrollingInterface;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
+import ml.docilealligator.infinityforreddit.SelectThingReturnKey;
import ml.docilealligator.infinityforreddit.SortType;
import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback;
import ml.docilealligator.infinityforreddit.account.Account;
@@ -1154,7 +1155,7 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
super.onActivityResult(requestCode, resultCode, data);
if (requestCode == ADD_TO_MULTIREDDIT_REQUEST_CODE && resultCode == RESULT_OK) {
if (data != null) {
- MultiReddit multiReddit = data.getParcelableExtra(MultiredditSelectionActivity.EXTRA_RETURN_MULTIREDDIT);
+ MultiReddit multiReddit = data.getParcelableExtra(SelectThingReturnKey.RETRUN_EXTRA_MULTIREDDIT);
if (multiReddit != null) {
AddSubredditOrUserToMultiReddit.addSubredditOrUserToMultiReddit(mOauthRetrofit,
accessToken, multiReddit.getPath(), subredditName,
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 18ed5b5e..57d60542 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewUserDetailActivity.java
@@ -67,6 +67,7 @@ import ml.docilealligator.infinityforreddit.MarkPostAsReadInterface;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.RecyclerViewContentScrollingInterface;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
+import ml.docilealligator.infinityforreddit.SelectThingReturnKey;
import ml.docilealligator.infinityforreddit.SortType;
import ml.docilealligator.infinityforreddit.SortTypeSelectionCallback;
import ml.docilealligator.infinityforreddit.account.Account;
@@ -828,7 +829,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_FAB_SEARCH: {
Intent intent = new Intent(this, SearchActivity.class);
intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_SUBREDDIT_OR_USER_NAME, username);
- intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_SUBREDDIT_IS_USER, true);
+ intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_THING_TYPE, SelectThingReturnKey.THING_TYPE.USER);
startActivity(intent);
break;
}
@@ -918,7 +919,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
case SharedPreferencesUtils.OTHER_ACTIVITIES_BOTTOM_APP_BAR_OPTION_SEARCH: {
Intent intent = new Intent(this, SearchActivity.class);
intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_SUBREDDIT_OR_USER_NAME, username);
- intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_SUBREDDIT_IS_USER, true);
+ intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_THING_TYPE, SelectThingReturnKey.THING_TYPE.USER);
startActivity(intent);
break;
}
@@ -1097,7 +1098,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
} else if (itemId == R.id.action_search_view_user_detail_activity) {
Intent intent = new Intent(this, SearchActivity.class);
intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_SUBREDDIT_OR_USER_NAME, username);
- intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_SUBREDDIT_IS_USER, true);
+ intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_THING_TYPE, SelectThingReturnKey.THING_TYPE.USER);
startActivity(intent);
return true;
} else if (itemId == R.id.action_refresh_view_user_detail_activity) {
@@ -1191,7 +1192,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
}
} else if (requestCode == ADD_TO_MULTIREDDIT_REQUEST_CODE) {
if (data != null) {
- MultiReddit multiReddit = data.getParcelableExtra(MultiredditSelectionActivity.EXTRA_RETURN_MULTIREDDIT);
+ MultiReddit multiReddit = data.getParcelableExtra(SelectThingReturnKey.RETRUN_EXTRA_MULTIREDDIT);
if (multiReddit != null) {
AddSubredditOrUserToMultiReddit.addSubredditOrUserToMultiReddit(mOauthRetrofit,
accessToken, multiReddit.getPath(), "u_" + username,
@@ -1283,7 +1284,7 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
case FABMoreOptionsBottomSheetFragment.FAB_OPTION_SEARCH:
Intent intent = new Intent(this, SearchActivity.class);
intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_SUBREDDIT_OR_USER_NAME, username);
- intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_SUBREDDIT_IS_USER, true);
+ intent.putExtra(SearchActivity.EXTRA_SEARCH_IN_THING_TYPE, SelectThingReturnKey.THING_TYPE.USER);
startActivity(intent);
break;
case FABMoreOptionsBottomSheetFragment.FAB_OPTION_GO_TO_SUBREDDIT: {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SearchActivityRecyclerViewAdapter.java b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SearchActivityRecyclerViewAdapter.java
index 084324ba..8008e497 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SearchActivityRecyclerViewAdapter.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/adapters/SearchActivityRecyclerViewAdapter.java
@@ -10,6 +10,7 @@ import androidx.recyclerview.widget.RecyclerView;
import java.util.List;
import ml.docilealligator.infinityforreddit.R;
+import ml.docilealligator.infinityforreddit.SelectThingReturnKey;
import ml.docilealligator.infinityforreddit.activities.BaseActivity;
import ml.docilealligator.infinityforreddit.customtheme.CustomThemeWrapper;
import ml.docilealligator.infinityforreddit.databinding.ItemRecentSearchQueryBinding;
@@ -54,7 +55,7 @@ public class SearchActivityRecyclerViewAdapter extends RecyclerView.Adapter<Recy
RecentSearchQuery recentSearchQuery = recentSearchQueries.get(position);
((RecentSearchQueryViewHolder) holder).binding.recentSearchQueryTextViewItemRecentSearchQuery.setText(recentSearchQuery.getSearchQuery());
if (recentSearchQuery.getSearchInSubredditOrUserName() != null && !recentSearchQuery.getSearchInSubredditOrUserName().isEmpty()) {
- if (recentSearchQuery.isSearchInIsUser()) {
+ if (recentSearchQuery.getSearchInThingType() == SelectThingReturnKey.THING_TYPE.USER) {
((RecentSearchQueryViewHolder) holder).binding.recentSearchQueryWhereTextViewItemRecentSearchQuery
.setTextColor(userTextColor);
((RecentSearchQueryViewHolder) holder).binding.recentSearchQueryWhereTextViewItemRecentSearchQuery
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/FollowedUsersListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/FollowedUsersListingFragment.java
index 3f51bcaf..8fe7ea2e 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/FollowedUsersListingFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/FollowedUsersListingFragment.java
@@ -106,7 +106,7 @@ public class FollowedUsersListingFragment extends Fragment implements FragmentCo
if (getArguments().getBoolean(EXTRA_IS_USER_SELECTION)) {
Intent returnIntent = new Intent();
returnIntent.putExtra(SelectThingReturnKey.RETURN_EXTRA_SUBREDDIT_OR_USER_NAME, subscribedUserData.getName());
- returnIntent.putExtra(SelectThingReturnKey.RETURN_EXTRA_IS_USER, true);
+ returnIntent.putExtra(SelectThingReturnKey.RETURN_EXTRA_THING_TYPE, SelectThingReturnKey.THING_TYPE.USER);
mActivity.setResult(Activity.RESULT_OK, returnIntent);
mActivity.finish();
} else {
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 2a0f1a16..316dc871 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/MultiRedditListingFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/MultiRedditListingFragment.java
@@ -1,5 +1,6 @@
package ml.docilealligator.infinityforreddit.fragments;
+import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
@@ -28,9 +29,9 @@ import ml.docilealligator.infinityforreddit.FragmentCommunicator;
import ml.docilealligator.infinityforreddit.Infinity;
import ml.docilealligator.infinityforreddit.R;
import ml.docilealligator.infinityforreddit.RedditDataRoomDatabase;
+import ml.docilealligator.infinityforreddit.SelectThingReturnKey;
import ml.docilealligator.infinityforreddit.account.Account;
import ml.docilealligator.infinityforreddit.activities.BaseActivity;
-import ml.docilealligator.infinityforreddit.activities.MultiredditSelectionActivity;
import ml.docilealligator.infinityforreddit.activities.SubscribedThingListingActivity;
import ml.docilealligator.infinityforreddit.activities.ViewMultiRedditDetailActivity;
import ml.docilealligator.infinityforreddit.adapters.MultiRedditListingRecyclerViewAdapter;
@@ -105,8 +106,12 @@ public class MultiRedditListingFragment extends Fragment implements FragmentComm
mActivity.accountName, new MultiRedditListingRecyclerViewAdapter.OnItemClickListener() {
@Override
public void onClick(MultiReddit multiReddit) {
- if (mActivity instanceof MultiredditSelectionActivity) {
- ((MultiredditSelectionActivity) mActivity).getSelectedMultireddit(multiReddit);
+ if (isGettingMultiredditInfo) {
+ Intent returnIntent = new Intent();
+ returnIntent.putExtra(SelectThingReturnKey.RETRUN_EXTRA_MULTIREDDIT, multiReddit);
+ returnIntent.putExtra(SelectThingReturnKey.RETURN_EXTRA_THING_TYPE, SelectThingReturnKey.THING_TYPE.MULTIREDDIT);
+ mActivity.setResult(Activity.RESULT_OK, returnIntent);
+ mActivity.finish();
} else {
Intent intent = new Intent(mActivity, ViewMultiRedditDetailActivity.class);
intent.putExtra(ViewMultiRedditDetailActivity.EXTRA_MULTIREDDIT_DATA, multiReddit);
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SubscribedSubredditsListingFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SubscribedSubredditsListingFragment.java
index 7eb624f7..459e3d91 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SubscribedSubredditsListingFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/SubscribedSubredditsListingFragment.java
@@ -110,7 +110,7 @@ public class SubscribedSubredditsListingFragment extends Fragment implements Fra
Intent returnIntent = new Intent();
returnIntent.putExtra(SelectThingReturnKey.RETURN_EXTRA_SUBREDDIT_OR_USER_NAME, name);
returnIntent.putExtra(SelectThingReturnKey.RETURN_EXTRA_SUBREDDIT_OR_USER_ICON, iconUrl);
- returnIntent.putExtra(SelectThingReturnKey.RETURN_EXTRA_IS_USER, subredditIsUser);
+ returnIntent.putExtra(SelectThingReturnKey.RETURN_EXTRA_THING_TYPE, subredditIsUser ? SelectThingReturnKey.THING_TYPE.USER : SelectThingReturnKey.THING_TYPE.SUBREDDIT);
mActivity.setResult(Activity.RESULT_OK, returnIntent);
mActivity.finish();
});
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/recentsearchquery/InsertRecentSearchQuery.java b/app/src/main/java/ml/docilealligator/infinityforreddit/recentsearchquery/InsertRecentSearchQuery.java
index 5980128b..130feb1e 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/recentsearchquery/InsertRecentSearchQuery.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/recentsearchquery/InsertRecentSearchQuery.java
@@ -17,7 +17,7 @@ public class InsertRecentSearchQuery {
String username,
String recentSearchQuery,
String searchInSubredditOrUserName,
- boolean searchInIsUser,
+ int searchInThingType,
InsertRecentSearchQueryListener insertRecentSearchQueryListener) {
executor.execute(() -> {
RecentSearchQueryDao recentSearchQueryDao = redditDataRoomDatabase.recentSearchQueryDao();
@@ -28,7 +28,7 @@ public class InsertRecentSearchQuery {
}
}
- recentSearchQueryDao.insert(new RecentSearchQuery(username, recentSearchQuery, searchInSubredditOrUserName, searchInIsUser));
+ recentSearchQueryDao.insert(new RecentSearchQuery(username, recentSearchQuery, searchInSubredditOrUserName, searchInThingType));
handler.post(insertRecentSearchQueryListener::success);
});
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/recentsearchquery/RecentSearchQuery.java b/app/src/main/java/ml/docilealligator/infinityforreddit/recentsearchquery/RecentSearchQuery.java
index a951243f..c903d46a 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/recentsearchquery/RecentSearchQuery.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/recentsearchquery/RecentSearchQuery.java
@@ -6,6 +6,7 @@ import androidx.room.ColumnInfo;
import androidx.room.Entity;
import androidx.room.ForeignKey;
+import ml.docilealligator.infinityforreddit.SelectThingReturnKey;
import ml.docilealligator.infinityforreddit.account.Account;
@Entity(tableName = "recent_search_queries", primaryKeys = {"username", "search_query"},
@@ -21,17 +22,18 @@ public class RecentSearchQuery {
@Nullable
@ColumnInfo(name = "search_in_subreddit_or_user_name")
private String searchInSubredditOrUserName;
- @ColumnInfo(name = "search_in_is_user")
- private boolean searchInIsUser;
+ @SelectThingReturnKey.THING_TYPE
+ @ColumnInfo(name = "search_in_thing_type")
+ private int searchInThingType;
@ColumnInfo(name = "time")
private long time;
public RecentSearchQuery(@NonNull String username, @NonNull String searchQuery,
- @Nullable String searchInSubredditOrUserName, boolean searchInIsUser) {
+ @Nullable String searchInSubredditOrUserName, @SelectThingReturnKey.THING_TYPE int searchInThingType) {
this.username = username;
this.searchQuery = searchQuery;
this.searchInSubredditOrUserName = searchInSubredditOrUserName;
- this.searchInIsUser = searchInIsUser;
+ this.searchInThingType = searchInThingType;
this.time = System.currentTimeMillis();
}
@@ -62,12 +64,13 @@ public class RecentSearchQuery {
this.searchInSubredditOrUserName = searchInSubredditOrUserName;
}
- public boolean isSearchInIsUser() {
- return searchInIsUser;
+ @SelectThingReturnKey.THING_TYPE
+ public int getSearchInThingType() {
+ return searchInThingType;
}
- public void setSearchInIsUser(boolean searchInIsUser) {
- this.searchInIsUser = searchInIsUser;
+ public void setSearchInThingType(@SelectThingReturnKey.THING_TYPE int searchInThingType) {
+ this.searchInThingType = searchInThingType;
}
public long getTime() {
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 55beeac2..398180d8 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CustomizeMainPageTabsFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/settings/CustomizeMainPageTabsFragment.java
@@ -25,6 +25,7 @@ import javax.inject.Named;
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;
@@ -571,8 +572,8 @@ public class CustomizeMainPageTabsFragment extends Fragment {
tab1CurrentName = data.getStringExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_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(MultiredditSelectionActivity.EXTRA_RETURN_MULTIREDDIT)) {
- MultiReddit multireddit = data.getParcelableExtra(MultiredditSelectionActivity.EXTRA_RETURN_MULTIREDDIT);
+ } else if (data.hasExtra(SelectThingReturnKey.RETRUN_EXTRA_MULTIREDDIT)) {
+ MultiReddit multireddit = data.getParcelableExtra(SelectThingReturnKey.RETRUN_EXTRA_MULTIREDDIT);
if (multireddit != null) {
tab1CurrentName = multireddit.getPath();
binding.tab1NameSummaryTextViewCustomizeMainPageTabsFragment.setText(tab1CurrentName);
@@ -589,8 +590,8 @@ public class CustomizeMainPageTabsFragment extends Fragment {
tab2CurrentName = data.getStringExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_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(MultiredditSelectionActivity.EXTRA_RETURN_MULTIREDDIT)) {
- MultiReddit multireddit = data.getParcelableExtra(MultiredditSelectionActivity.EXTRA_RETURN_MULTIREDDIT);
+ } else if (data.hasExtra(SelectThingReturnKey.RETRUN_EXTRA_MULTIREDDIT)) {
+ MultiReddit multireddit = data.getParcelableExtra(SelectThingReturnKey.RETRUN_EXTRA_MULTIREDDIT);
if (multireddit != null) {
tab2CurrentName = multireddit.getPath();
binding.tab2NameSummaryTextViewCustomizeMainPageTabsFragment.setText(tab2CurrentName);
@@ -607,8 +608,8 @@ public class CustomizeMainPageTabsFragment extends Fragment {
tab3CurrentName = data.getStringExtra(SubredditSelectionActivity.EXTRA_RETURN_SUBREDDIT_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(MultiredditSelectionActivity.EXTRA_RETURN_MULTIREDDIT)) {
- MultiReddit multireddit = data.getParcelableExtra(MultiredditSelectionActivity.EXTRA_RETURN_MULTIREDDIT);
+ } else if (data.hasExtra(SelectThingReturnKey.RETRUN_EXTRA_MULTIREDDIT)) {
+ MultiReddit multireddit = data.getParcelableExtra(SelectThingReturnKey.RETRUN_EXTRA_MULTIREDDIT);
if (multireddit != null) {
tab3CurrentName = multireddit.getPath();
binding.tab3NameSummaryTextViewCustomizeMainPageTabsFragment.setText(tab3CurrentName);