diff options
Diffstat (limited to 'app/src')
4 files changed, 12 insertions, 16 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java index f62fbc2e..daddd979 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewSubredditDetailActivity.java @@ -735,10 +735,6 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp @Override public void sortTypeSelected(SortType sortType) { - mSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TYPE_SUBREDDIT_POST, sortType.getType().name()).apply(); - if(sortType.getTime() != null) { - mSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TIME_SUBREDDIT_POST, sortType.getTime().name()).apply(); - } sectionsPagerAdapter.changeSortType(sortType); } @@ -918,9 +914,9 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp public void changeSortType(SortType sortType) { if (postFragment != null) { - mSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TYPE_USER_POST, sortType.getType().name()).apply(); + mSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TYPE_SUBREDDIT_POST_BASE + subredditName, sortType.getType().name()).apply(); if(sortType.getTime() != null) { - mSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TIME_USER_POST, sortType.getTime().name()).apply(); + mSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TIME_SUBREDDIT_POST_BASE + subredditName, sortType.getTime().name()).apply(); } postFragment.changeSortType(sortType); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java index e7a6876a..95ce79e1 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Activity/ViewUserDetailActivity.java @@ -811,9 +811,9 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele public void changeSortType(SortType sortType) { if (viewPager.getCurrentItem() == 0) { if (postFragment != null) { - mSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TYPE_USER_POST, sortType.getType().name()).apply(); + mSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TYPE_USER_POST_BASE + username, sortType.getType().name()).apply(); if(sortType.getTime() != null) { - mSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TIME_USER_POST, sortType.getTime().name()).apply(); + mSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TIME_USER_POST_BASE + username, sortType.getTime().name()).apply(); } postFragment.changeSortType(sortType); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java index 40b10116..25a850bc 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Fragment/PostFragment.java @@ -386,9 +386,9 @@ public class PostFragment extends Fragment implements FragmentCommunicator { postLayout = mSharedPreferences.getInt(SharedPreferencesUtils.POST_LAYOUT_ALL_POST, defaultPostLayout); } } else { - sort = mSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_SUBREDDIT_POST, SortType.Type.HOT.name()); + sort = mSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_SUBREDDIT_POST_BASE + subredditName, SortType.Type.HOT.name()); if(sort.equals(SortType.Type.CONTROVERSIAL.name()) || sort.equals(SortType.Type.TOP.name())) { - sortTime = mSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_SUBREDDIT_POST, SortType.Time.ALL.name()); + sortTime = mSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_SUBREDDIT_POST_BASE + subredditName, SortType.Time.ALL.name()); } postLayout = mSharedPreferences.getInt(SharedPreferencesUtils.POST_LAYOUT_SUBREDDIT_POST_BASE + subredditName, defaultPostLayout); } @@ -487,10 +487,10 @@ public class PostFragment extends Fragment implements FragmentCommunicator { mFetchPostInfoLinearLayout.setLayoutParams(params); } - String sort = mSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_USER_POST, SortType.Type.NEW.name()); + String sort = mSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_USER_POST_BASE + username, SortType.Type.NEW.name()); SortType sortType; if(sort.equals(SortType.Type.CONTROVERSIAL.name()) || sort.equals(SortType.Type.TOP.name())) { - String sortTime = mSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_USER_POST, SortType.Time.ALL.name()); + String sortTime = mSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_USER_POST_BASE + username, SortType.Time.ALL.name()); sortType = new SortType(SortType.Type.valueOf(sort), SortType.Time.valueOf(sortTime)); } else { sortType = new SortType(SortType.Type.valueOf(sort)); diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java index 08f55dfe..11613fdb 100644 --- a/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java +++ b/app/src/main/java/ml/docilealligator/infinityforreddit/Utils/SharedPreferencesUtils.java @@ -41,12 +41,12 @@ public class SharedPreferencesUtils { public static final String SORT_TIME_POPULAR_POST = "sort_time_popular_post"; public static final String SORT_TYPE_SEARCH_POST = "sort_type_search_post"; public static final String SORT_TIME_SEARCH_POST = "sort_time_search_post"; - public static final String SORT_TYPE_SUBREDDIT_POST = "sort_type_subreddit_post"; - public static final String SORT_TIME_SUBREDDIT_POST = "sort_time_subreddit_post"; + public static final String SORT_TYPE_SUBREDDIT_POST_BASE = "sort_type_subreddit_post_"; + public static final String SORT_TIME_SUBREDDIT_POST_BASE = "sort_time_subreddit_post_"; public static final String SORT_TYPE_MULTI_REDDIT_POST_BASE = "sort_type_multi_reddit_post_"; public static final String SORT_TIME_MULTI_REDDIT_POST_BASE = "sort_time_multi_reddit_post_"; - public static final String SORT_TYPE_USER_POST = "sort_type_user_post"; - public static final String SORT_TIME_USER_POST = "sort_time_user_post"; + public static final String SORT_TYPE_USER_POST_BASE = "sort_type_user_post_"; + public static final String SORT_TIME_USER_POST_BASE = "sort_time_user_post_"; public static final String SORT_TYPE_USER_COMMENT = "sort_type_user_comment"; public static final String SORT_TIME_USER_COMMENT = "sort_time_user_comment"; public static final String SORT_TYPE_SEARCH_SUBREDDIT = "sort_type_search_subreddit"; |