Fixed FilteredThingActivity for multireddits.

This commit is contained in:
Alex Ning 2019-12-17 22:49:39 +08:00
parent 0d56a81206
commit ee02d63345

View File

@ -233,6 +233,21 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec
subredditSortTypeBottomSheetFragment.setArguments(bottomSheetBundle); subredditSortTypeBottomSheetFragment.setArguments(bottomSheetBundle);
} }
break; break;
case PostDataSource.TYPE_MULTI_REDDIT:
String multiRedditName;
if (name.endsWith("/")) {
multiRedditName = name.substring(0, name.length() - 1);
multiRedditName = multiRedditName.substring(multiRedditName.lastIndexOf("/") + 1);
} else {
multiRedditName = name.substring(name.lastIndexOf("/") + 1);
}
getSupportActionBar().setTitle(multiRedditName);
subredditSortTypeBottomSheetFragment = new SortTypeBottomSheetFragment();
Bundle bottomSheetBundle = new Bundle();
bottomSheetBundle.putBoolean(SortTypeBottomSheetFragment.EXTRA_NO_BEST_TYPE, true);
subredditSortTypeBottomSheetFragment.setArguments(bottomSheetBundle);
break;
case PostDataSource.TYPE_USER: case PostDataSource.TYPE_USER:
String usernamePrefixed = "u/" + name; String usernamePrefixed = "u/" + name;
getSupportActionBar().setTitle(usernamePrefixed); getSupportActionBar().setTitle(usernamePrefixed);
@ -273,7 +288,7 @@ public class FilteredThingActivity extends BaseActivity implements SortTypeSelec
if (postType == PostDataSource.TYPE_USER) { if (postType == PostDataSource.TYPE_USER) {
bundle.putString(PostFragment.EXTRA_USER_NAME, name); bundle.putString(PostFragment.EXTRA_USER_NAME, name);
bundle.putString(PostFragment.EXTRA_USER_WHERE, userWhere); bundle.putString(PostFragment.EXTRA_USER_WHERE, userWhere);
} else if (postType == PostDataSource.TYPE_SUBREDDIT) { } else if (postType == PostDataSource.TYPE_SUBREDDIT || postType == PostDataSource.TYPE_MULTI_REDDIT) {
bundle.putString(PostFragment.EXTRA_NAME, name); bundle.putString(PostFragment.EXTRA_NAME, name);
} else if (postType == PostDataSource.TYPE_SEARCH) { } else if (postType == PostDataSource.TYPE_SEARCH) {
bundle.putString(PostFragment.EXTRA_NAME, name); bundle.putString(PostFragment.EXTRA_NAME, name);