aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/Activity/FilteredThingActivity.java22
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSourceFactory.java4
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/PostViewModel.java1
3 files changed, 19 insertions, 8 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/FilteredThingActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/FilteredThingActivity.java
index b5412522..1f6fc1e3 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/FilteredThingActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/FilteredThingActivity.java
@@ -71,6 +71,7 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec
private boolean mNullAccessToken = false;
private String mAccessToken;
private String name;
+ private String userWhere;
private int postType;
private Fragment mFragment;
private Menu mMenu;
@@ -145,6 +146,13 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec
postType = getIntent().getIntExtra(EXTRA_POST_TYPE, PostDataSource.TYPE_FRONT_PAGE);
int filter = getIntent().getIntExtra(EXTRA_FILTER, Post.TEXT_TYPE);
+ if (postType == PostDataSource.TYPE_USER) {
+ userWhere = getIntent().getStringExtra(EXTRA_USER_WHERE);
+ if (userWhere != null && !PostDataSource.USER_WHERE_SUBMITTED.equals(userWhere) && mMenu != null) {
+ mMenu.findItem(R.id.action_sort_filtered_thing_activity).setVisible(false);
+ }
+ }
+
if (savedInstanceState != null) {
isInLazyMode = savedInstanceState.getBoolean(IS_IN_LAZY_MODE_STATE);
mNullAccessToken = savedInstanceState.getBoolean(NULL_ACCESS_TOKEN_STATE);
@@ -248,14 +256,16 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec
if (initializeFragment) {
mFragment = new PostFragment();
Bundle bundle = new Bundle();
- bundle.putString(PostFragment.EXTRA_NAME, name);
bundle.putInt(PostFragment.EXTRA_POST_TYPE, postType);
bundle.putInt(PostFragment.EXTRA_FILTER, filter);
bundle.putString(PostFragment.EXTRA_ACCESS_TOKEN, mAccessToken);
if (postType == PostDataSource.TYPE_USER) {
- bundle.putString(PostFragment.EXTRA_USER_WHERE, getIntent().getStringExtra(EXTRA_USER_WHERE));
- }
- if (postType == PostDataSource.TYPE_SEARCH) {
+ bundle.putString(PostFragment.EXTRA_USER_NAME, name);
+ bundle.putString(PostFragment.EXTRA_USER_WHERE, userWhere);
+ } else if (postType == PostDataSource.TYPE_SUBREDDIT) {
+ bundle.putString(PostFragment.EXTRA_NAME, name);
+ } else if (postType == PostDataSource.TYPE_SEARCH) {
+ bundle.putString(PostFragment.EXTRA_NAME, name);
bundle.putString(PostFragment.EXTRA_QUERY, getIntent().getStringExtra(EXTRA_QUERY));
}
mFragment.setArguments(bundle);
@@ -277,6 +287,10 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec
params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_ENTER_ALWAYS);
collapsingToolbarLayout.setLayoutParams(params);
}
+
+ if (userWhere != null && !PostDataSource.USER_WHERE_SUBMITTED.equals(userWhere)) {
+ mMenu.findItem(R.id.action_sort_filtered_thing_activity).setVisible(false);
+ }
return true;
}
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSourceFactory.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSourceFactory.java
index 77b5199d..52015450 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSourceFactory.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostDataSourceFactory.java
@@ -105,10 +105,6 @@ class PostDataSourceFactory extends DataSource.Factory {
return postDataSource;
}
- void changeSortType(SortType sortType) {
- this.sortType = sortType;
- }
-
void changeNSFWAndSortType(boolean nsfw, SortType sortType) {
this.nsfw = nsfw;
this.sortType = sortType;
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/PostViewModel.java b/app/src/main/java/ml/docilealligator/infinityforreddit/PostViewModel.java
index 16ad30f0..487ef5b1 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/PostViewModel.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/PostViewModel.java
@@ -216,6 +216,7 @@ public class PostViewModel extends ViewModel {
this.nsfw = nsfw;
}
+ //User posts
public Factory(Retrofit retrofit, String accessToken, Locale locale, String subredditName, int postType,
SortType sortType, String where, int filter, boolean nsfw) {
this.retrofit = retrofit;