mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-11-07 11:17:25 +01:00
Changing individual sort types of subreddits and users is now available.
This commit is contained in:
parent
3adac8a074
commit
01b2a04057
@ -735,10 +735,6 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void sortTypeSelected(SortType sortType) {
|
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);
|
sectionsPagerAdapter.changeSortType(sortType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -918,9 +914,9 @@ public class ViewSubredditDetailActivity extends BaseActivity implements SortTyp
|
|||||||
|
|
||||||
public void changeSortType(SortType sortType) {
|
public void changeSortType(SortType sortType) {
|
||||||
if (postFragment != null) {
|
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) {
|
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);
|
postFragment.changeSortType(sortType);
|
||||||
|
@ -811,9 +811,9 @@ public class ViewUserDetailActivity extends BaseActivity implements SortTypeSele
|
|||||||
public void changeSortType(SortType sortType) {
|
public void changeSortType(SortType sortType) {
|
||||||
if (viewPager.getCurrentItem() == 0) {
|
if (viewPager.getCurrentItem() == 0) {
|
||||||
if (postFragment != null) {
|
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) {
|
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);
|
postFragment.changeSortType(sortType);
|
||||||
|
@ -386,9 +386,9 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
|||||||
postLayout = mSharedPreferences.getInt(SharedPreferencesUtils.POST_LAYOUT_ALL_POST, defaultPostLayout);
|
postLayout = mSharedPreferences.getInt(SharedPreferencesUtils.POST_LAYOUT_ALL_POST, defaultPostLayout);
|
||||||
}
|
}
|
||||||
} else {
|
} 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())) {
|
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);
|
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);
|
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;
|
SortType sortType;
|
||||||
if(sort.equals(SortType.Type.CONTROVERSIAL.name()) || sort.equals(SortType.Type.TOP.name())) {
|
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));
|
sortType = new SortType(SortType.Type.valueOf(sort), SortType.Time.valueOf(sortTime));
|
||||||
} else {
|
} else {
|
||||||
sortType = new SortType(SortType.Type.valueOf(sort));
|
sortType = new SortType(SortType.Type.valueOf(sort));
|
||||||
|
@ -41,12 +41,12 @@ public class SharedPreferencesUtils {
|
|||||||
public static final String SORT_TIME_POPULAR_POST = "sort_time_popular_post";
|
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_TYPE_SEARCH_POST = "sort_type_search_post";
|
||||||
public static final String SORT_TIME_SEARCH_POST = "sort_time_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_TYPE_SUBREDDIT_POST_BASE = "sort_type_subreddit_post_";
|
||||||
public static final String SORT_TIME_SUBREDDIT_POST = "sort_time_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_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_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_TYPE_USER_POST_BASE = "sort_type_user_post_";
|
||||||
public static final String SORT_TIME_USER_POST = "sort_time_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_TYPE_USER_COMMENT = "sort_type_user_comment";
|
||||||
public static final String SORT_TIME_USER_COMMENT = "sort_time_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";
|
public static final String SORT_TYPE_SEARCH_SUBREDDIT = "sort_type_search_subreddit";
|
||||||
|
Loading…
Reference in New Issue
Block a user