SortTypes updated for current Lemmy specific types

Signed-off-by: Balazs Toldi <balazs@toldi.eu>
This commit is contained in:
Balazs Toldi 2023-07-24 17:11:03 +02:00
parent e1eadab7ba
commit d70d117acf
No known key found for this signature in database
GPG Key ID: 6C7D440036F99D58
18 changed files with 215 additions and 197 deletions

View File

@ -33,17 +33,22 @@ public class SortType {
ACTIVE("Active", "Active"),
HOT("Hot", "Hot"),
NEW("New", "New"),
RANDOM("random", "Random"),
RISING("rising", "Rising"),
OLD("Old", "Old"),
TOP("Top", "Top"),
CONTROVERSIAL("controversial", "Controversial"),
RELEVANCE("relevance", "Relevance"),
COMMENTS("comments", "Comments"),
ACTIVITY("activity", "Activity"),
CONFIDENCE("confidence", "Best"),
OLD("old", "Old"),
QA("qa", "QA"),
LIVE("live", "Live");
MOST_COMMENTS("MostCommentes", "Most Commentes"),
NEW_COMMENTS("NewCommentes", "New Commentes"),
TOP_HOUR("TopHour", "Top"),
TOP_SIX_HOURS("TopSixHour", "Top"),
TOP_TWELVE_HOURS("TopTwelveHour", "Top"),
TOP_DAY("TopDay", "Top"),
TOP_WEEK("TopWeek", "Top"),
TOP_MONTH("month", "Top"),
TOP_THREE_MONTHS("TopThreeMonths", "Top"),
TOP_SIX_MONTHS("TopSixMonths", "Top"),
TOP_NINE_MONTHS("TopNineMonths", "Top"),
TOP_YEAR("TopYear", "Top"),
TOP_ALL("TopAll", "Top");
public final String value;
public final String fullName;
@ -55,10 +60,15 @@ public class SortType {
}
public enum Time {
HOUR("hour", "Hour"),
HOUR("TopHour", "Top Hour"),
SIX_HOURS("TopSixHour", "Top Six Hours"),
TWELVE_HOURS("TopTwelveHour", "Top Twelve Hours"),
DAY("day", "Day"),
WEEK("week", "Week"),
MONTH("month", "Month"),
THREE_MONTHS("TopThreeMonth", "Top Three Months"),
SIX_MONTHS("TopSixMonth", "Top Six Months"),
NINE_MONTHS("TopNineMonth", "Top Nine Months"),
YEAR("year", "Year"),
ALL("all", "All Time");

View File

@ -30,22 +30,16 @@ public class PostCommentSortTypeBottomSheetFragment extends LandscapeExpandedRou
public static final String EXTRA_CURRENT_SORT_TYPE = "ECST";
@BindView(R.id.best_type_text_view_post_comment_sort_type_bottom_sheet_fragment)
TextView confidenceTypeTextView;
@BindView(R.id.hot_type_text_view_post_comment_sort_type_bottom_sheet_fragment)
TextView hotTypeTextView;
@BindView(R.id.top_type_text_view_post_comment_sort_type_bottom_sheet_fragment)
TextView topTypeTextView;
@BindView(R.id.new_type_text_view_post_comment_sort_type_bottom_sheet_fragment)
TextView newTypeTextView;
@BindView(R.id.controversial_type_text_view_post_comment_sort_type_bottom_sheet_fragment)
TextView controversialTypeTextView;
@BindView(R.id.old_type_text_view_post_comment_sort_type_bottom_sheet_fragment)
TextView oldTypeTextView;
@BindView(R.id.random_type_text_view_post_comment_sort_type_bottom_sheet_fragment)
TextView randomTypeTextView;
@BindView(R.id.qa_type_text_view_post_comment_sort_type_bottom_sheet_fragment)
TextView qaTypeTextView;
@BindView(R.id.live_type_text_view_post_comment_sort_type_bottom_sheet_fragment)
TextView liveTypeTextView;
private BaseActivity activity;
public PostCommentSortTypeBottomSheetFragment() {
@ -69,22 +63,14 @@ public class PostCommentSortTypeBottomSheetFragment extends LandscapeExpandedRou
ButterKnife.bind(this, rootView);
SortType.Type currentSortType = (SortType.Type) getArguments().getSerializable(EXTRA_CURRENT_SORT_TYPE);
if (currentSortType.equals(SortType.Type.ACTIVE) || currentSortType.equals(SortType.Type.CONFIDENCE)) {
confidenceTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(confidenceTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
} else if (currentSortType.equals(SortType.Type.TOP)) {
if (currentSortType.equals(SortType.Type.TOP)) {
topTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(topTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
} else if (currentSortType.equals(SortType.Type.NEW)) {
newTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(newTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
} else if (currentSortType.equals(SortType.Type.CONTROVERSIAL)) {
controversialTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(controversialTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
} else if (currentSortType.equals(SortType.Type.HOT)) {
hotTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(hotTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
} else if (currentSortType.equals(SortType.Type.OLD)) {
oldTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(oldTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
} else if (currentSortType.equals(SortType.Type.RANDOM)) {
randomTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(randomTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
} else if (currentSortType.equals(SortType.Type.QA)) {
qaTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(qaTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
} else if (currentSortType.equals(SortType.Type.LIVE)) {
liveTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(liveTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
@ -92,8 +78,8 @@ public class PostCommentSortTypeBottomSheetFragment extends LandscapeExpandedRou
rootView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
}
confidenceTypeTextView.setOnClickListener(view -> {
((SortTypeSelectionCallback) activity).sortTypeSelected(new SortType(SortType.Type.CONFIDENCE));
hotTypeTextView.setOnClickListener(view -> {
((SortTypeSelectionCallback) activity).sortTypeSelected(new SortType(SortType.Type.HOT));
dismiss();
});
@ -107,31 +93,11 @@ public class PostCommentSortTypeBottomSheetFragment extends LandscapeExpandedRou
dismiss();
});
controversialTypeTextView.setOnClickListener(view -> {
((SortTypeSelectionCallback) activity).sortTypeSelected(new SortType(SortType.Type.CONTROVERSIAL));
dismiss();
});
oldTypeTextView.setOnClickListener(view -> {
((SortTypeSelectionCallback) activity).sortTypeSelected(new SortType(SortType.Type.OLD));
dismiss();
});
randomTypeTextView.setOnClickListener(view -> {
((SortTypeSelectionCallback) activity).sortTypeSelected(new SortType(SortType.Type.RANDOM));
dismiss();
});
qaTypeTextView.setOnClickListener(view -> {
((SortTypeSelectionCallback) activity).sortTypeSelected(new SortType(SortType.Type.QA));
dismiss();
});
liveTypeTextView.setOnClickListener(view -> {
((SortTypeSelectionCallback) activity).sortTypeSelected(new SortType(SortType.Type.LIVE));
dismiss();
});
if (activity.typeface != null) {
Utils.setFontToAllTextViews(rootView, activity.typeface);
}

View File

@ -61,15 +61,13 @@ public class SearchPostSortTypeBottomSheetFragment extends LandscapeExpandedRoun
ButterKnife.bind(this, rootView);
String currentSortType = getArguments().getString(EXTRA_CURRENT_SORT_TYPE);
if (currentSortType.equals(SortType.Type.RELEVANCE.fullName)) {
relevanceTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(relevanceTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
} else if (currentSortType.equals(SortType.Type.HOT.fullName)) {
if (currentSortType.equals(SortType.Type.HOT.fullName)) {
hotTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(hotTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
} else if (currentSortType.equals(SortType.Type.TOP.fullName)) {
topTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(topTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
} else if (currentSortType.equals(SortType.Type.NEW.fullName)) {
newTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(newTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
} else if (currentSortType.equals(SortType.Type.RISING.fullName)) {
} else if (currentSortType.equals(SortType.Type.OLD.fullName)) {
commentsTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(commentsTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
}
@ -78,10 +76,10 @@ public class SearchPostSortTypeBottomSheetFragment extends LandscapeExpandedRoun
rootView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
}
relevanceTypeTextView.setOnClickListener(view -> {
/*relevanceTypeTextView.setOnClickListener(view -> {
((SortTypeSelectionCallback) activity).sortTypeSelected(SortType.Type.RELEVANCE.name());
dismiss();
});
});*/
hotTypeTextView.setOnClickListener(view -> {
((SortTypeSelectionCallback) activity).sortTypeSelected(SortType.Type.HOT.name());
@ -99,7 +97,7 @@ public class SearchPostSortTypeBottomSheetFragment extends LandscapeExpandedRoun
});
commentsTypeTextView.setOnClickListener(view -> {
((SortTypeSelectionCallback) activity).sortTypeSelected(SortType.Type.COMMENTS.name());
((SortTypeSelectionCallback) activity).sortTypeSelected(SortType.Type.MOST_COMMENTS.name());
dismiss();
});

View File

@ -58,9 +58,9 @@ public class SearchUserAndSubredditSortTypeBottomSheetFragment extends Landscape
ButterKnife.bind(this, rootView);
String currentSortType = getArguments().getString(EXTRA_CURRENT_SORT_TYPE);
if (currentSortType.equals(SortType.Type.RELEVANCE.fullName)) {
if (currentSortType.equals(SortType.Type.TOP.fullName)) {
relevanceTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(relevanceTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
} else if (currentSortType.equals(SortType.Type.ACTIVITY.fullName)) {
} else if (currentSortType.equals(SortType.Type.ACTIVE.fullName)) {
activityTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(activityTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
}
@ -75,13 +75,13 @@ public class SearchUserAndSubredditSortTypeBottomSheetFragment extends Landscape
return rootView;
}
relevanceTypeTextView.setOnClickListener(view -> {
/* relevanceTypeTextView.setOnClickListener(view -> {
((SortTypeSelectionCallback) activity).searchUserAndSubredditSortTypeSelected(new SortType(SortType.Type.RELEVANCE), position);
dismiss();
});
});*/
activityTypeTextView.setOnClickListener(view -> {
((SortTypeSelectionCallback) activity).searchUserAndSubredditSortTypeSelected(new SortType(SortType.Type.ACTIVITY), position);
((SortTypeSelectionCallback) activity).searchUserAndSubredditSortTypeSelected(new SortType(SortType.Type.ACTIVE), position);
dismiss();
});

View File

@ -31,17 +31,35 @@ public class SortTimeBottomSheetFragment extends LandscapeExpandedRoundedBottomS
@BindView(R.id.hour_text_view_sort_time_bottom_sheet_fragment)
TextView hourTextView;
@BindView(R.id.six_hours_text_view_sort_time_bottom_sheet_fragment)
TextView sixHourTextView;
@BindView(R.id.twelve_hours_text_view_sort_time_bottom_sheet_fragment)
TextView twelveHourTextView;
@BindView(R.id.day_text_view_sort_time_bottom_sheet_fragment)
TextView dayTextView;
@BindView(R.id.week_text_view_sort_time_bottom_sheet_fragment)
TextView weekTextView;
@BindView(R.id.month_text_view_sort_time_bottom_sheet_fragment)
TextView monthTextView;
@BindView(R.id.three_months_text_view_sort_time_bottom_sheet_fragment)
TextView threeMonthTextView;
@BindView(R.id.six_months_text_view_sort_time_bottom_sheet_fragment)
TextView sixMonthTextView;
@BindView(R.id.nine_months_text_view_sort_time_bottom_sheet_fragment)
TextView nineMonthTextView;
@BindView(R.id.year_text_view_sort_time_bottom_sheet_fragment)
TextView yearTextView;
@BindView(R.id.all_time_text_view_sort_time_bottom_sheet_fragment)
TextView allTimeTextView;
private BaseActivity activity;
public SortTimeBottomSheetFragment() {
// Required empty public constructor
}
@ -67,37 +85,67 @@ public class SortTimeBottomSheetFragment extends LandscapeExpandedRoundedBottomS
hourTextView.setOnClickListener(view -> {
((SortTypeSelectionCallback) activity)
.sortTypeSelected(new SortType(SortType.Type.valueOf(sortType), SortType.Time.HOUR));
.sortTypeSelected(new SortType(SortType.Type.TOP_HOUR, SortType.Time.HOUR));
dismiss();
});
sixHourTextView.setOnClickListener(view -> {
((SortTypeSelectionCallback) activity)
.sortTypeSelected(new SortType(SortType.Type.TOP_SIX_HOURS, SortType.Time.SIX_HOURS));
dismiss();
});
twelveHourTextView.setOnClickListener(view -> {
((SortTypeSelectionCallback) activity)
.sortTypeSelected(new SortType(SortType.Type.TOP_TWELVE_HOURS, SortType.Time.TWELVE_HOURS));
dismiss();
});
dayTextView.setOnClickListener(view -> {
((SortTypeSelectionCallback) activity)
.sortTypeSelected(new SortType(SortType.Type.valueOf(sortType), SortType.Time.DAY));
.sortTypeSelected(new SortType(SortType.Type.TOP_DAY, SortType.Time.DAY));
dismiss();
});
weekTextView.setOnClickListener(view -> {
((SortTypeSelectionCallback) activity)
.sortTypeSelected(new SortType(SortType.Type.valueOf(sortType), SortType.Time.WEEK));
.sortTypeSelected(new SortType(SortType.Type.TOP_WEEK, SortType.Time.WEEK));
dismiss();
});
monthTextView.setOnClickListener(view -> {
((SortTypeSelectionCallback) activity)
.sortTypeSelected(new SortType(SortType.Type.valueOf(sortType), SortType.Time.MONTH));
.sortTypeSelected(new SortType(SortType.Type.TOP_MONTH, SortType.Time.MONTH));
dismiss();
});
threeMonthTextView.setOnClickListener(view -> {
((SortTypeSelectionCallback) activity)
.sortTypeSelected(new SortType(SortType.Type.TOP_THREE_MONTHS, SortType.Time.THREE_MONTHS));
dismiss();
});
sixMonthTextView.setOnClickListener(view -> {
((SortTypeSelectionCallback) activity)
.sortTypeSelected(new SortType(SortType.Type.TOP_SIX_MONTHS, SortType.Time.SIX_MONTHS));
dismiss();
});
nineMonthTextView.setOnClickListener(view -> {
((SortTypeSelectionCallback) activity)
.sortTypeSelected(new SortType(SortType.Type.TOP_NINE_MONTHS, SortType.Time.NINE_MONTHS));
dismiss();
});
yearTextView.setOnClickListener(view -> {
((SortTypeSelectionCallback) activity)
.sortTypeSelected(new SortType(SortType.Type.valueOf(sortType), SortType.Time.YEAR));
.sortTypeSelected(new SortType(SortType.Type.TOP_YEAR, SortType.Time.YEAR));
dismiss();
});
allTimeTextView.setOnClickListener(view -> {
((SortTypeSelectionCallback) activity)
.sortTypeSelected(new SortType(SortType.Type.valueOf(sortType), SortType.Time.ALL));
.sortTypeSelected(new SortType(SortType.Type.TOP_ALL, SortType.Time.ALL));
dismiss();
});

View File

@ -38,13 +38,13 @@ public class SortTypeBottomSheetFragment extends LandscapeExpandedRoundedBottomS
TextView hotTypeTextView;
@BindView(R.id.new_type_text_view_sort_type_bottom_sheet_fragment)
TextView newTypeTextView;
@BindView(R.id.rising_type_text_view_sort_type_bottom_sheet_fragment)
TextView risingTypeTextView;
@BindView(R.id.old_type_text_view_sort_type_bottom_sheet_fragment)
TextView oldTypeTextView;
@BindView(R.id.top_type_text_view_sort_type_bottom_sheet_fragment)
TextView topTypeTextView;
@BindView(R.id.controversial_type_text_view_sort_type_bottom_sheet_fragment)
TextView controversialTypeTextView;
private BaseActivity activity;
public SortTypeBottomSheetFragment() {
// Required empty public constructor
}
@ -85,12 +85,10 @@ public class SortTypeBottomSheetFragment extends LandscapeExpandedRoundedBottomS
hotTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(hotTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
} else if (currentSortType.equals(SortType.Type.NEW.fullName)) {
newTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(newTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
} else if (currentSortType.equals(SortType.Type.RISING.fullName)) {
risingTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(risingTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
} else if (currentSortType.equals(SortType.Type.OLD.fullName)) {
oldTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(oldTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
} else if (currentSortType.equals(SortType.Type.TOP.fullName)) {
topTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(topTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
} else if (currentSortType.equals(SortType.Type.CONTROVERSIAL.fullName)) {
controversialTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(controversialTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
}
hotTypeTextView.setOnClickListener(view -> {
@ -103,8 +101,8 @@ public class SortTypeBottomSheetFragment extends LandscapeExpandedRoundedBottomS
dismiss();
});
risingTypeTextView.setOnClickListener(view -> {
((SortTypeSelectionCallback) activity).sortTypeSelected(new SortType(SortType.Type.RISING));
oldTypeTextView.setOnClickListener(view -> {
((SortTypeSelectionCallback) activity).sortTypeSelected(new SortType(SortType.Type.OLD));
dismiss();
});
@ -113,10 +111,6 @@ public class SortTypeBottomSheetFragment extends LandscapeExpandedRoundedBottomS
dismiss();
});
controversialTypeTextView.setOnClickListener(view -> {
((SortTypeSelectionCallback) activity).sortTypeSelected(SortType.Type.CONTROVERSIAL.name());
dismiss();
});
if (activity.typeface != null) {
Utils.setFontToAllTextViews(rootView, activity.typeface);

View File

@ -67,8 +67,6 @@ public class UserThingSortTypeBottomSheetFragment extends LandscapeExpandedRound
hotTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(hotTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
} else if (currentSortType.equals(SortType.Type.TOP.fullName)) {
topTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(topTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
} else if (currentSortType.equals(SortType.Type.CONTROVERSIAL.fullName)) {
controversialTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(controversialTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
@ -97,12 +95,12 @@ public class UserThingSortTypeBottomSheetFragment extends LandscapeExpandedRound
dismiss();
});
controversialTypeTextView.setOnClickListener(view -> {
/* controversialTypeTextView.setOnClickListener(view -> {
if (activity != null) {
((SortTypeSelectionCallback) activity).sortTypeSelected(SortType.Type.CONTROVERSIAL.name());
}
dismiss();
});
});*/
if (activity.typeface != null) {
Utils.setFontToAllTextViews(rootView, activity.typeface);

View File

@ -270,7 +270,7 @@ public class CommentsListingFragment extends Fragment implements FragmentCommuni
String username = getArguments().getString(EXTRA_USERNAME);
String sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_USER_COMMENT, SortType.Type.NEW.name());
if (sort.equals(SortType.Type.CONTROVERSIAL.name()) || sort.equals(SortType.Type.TOP.name())) {
if (sort.equals(SortType.Type.TOP.name())) {
String sortTime = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_USER_COMMENT, SortType.Time.ALL.name());
sortType = new SortType(SortType.Type.valueOf(sort.toUpperCase()), SortType.Time.valueOf(sortTime.toUpperCase()));
} else {

View File

@ -458,7 +458,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
usage = PostFilterUsage.SEARCH_TYPE;
nameOfUsage = PostFilterUsage.NO_USAGE;
String sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_SEARCH_POST, SortType.Type.RELEVANCE.name());
String sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_SEARCH_POST, SortType.Type.TOP.value);
String sortTime = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_SEARCH_POST, SortType.Time.ALL.name());
sortType = new SortType(SortType.Type.valueOf(sort), SortType.Time.valueOf(sortTime));
postLayout = mPostLayoutSharedPreferences.getInt(SharedPreferencesUtils.POST_LAYOUT_SEARCH_POST, defaultPostLayout);
@ -527,7 +527,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_SUBREDDIT_POST_BASE + subredditName,
mSharedPreferences.getString(SharedPreferencesUtils.SUBREDDIT_DEFAULT_SORT_TYPE, SortType.Type.HOT.name()));
if (sort.equals(SortType.Type.CONTROVERSIAL.name()) || sort.equals(SortType.Type.TOP.name())) {
if (sort.equals(sort.equals(SortType.Type.TOP.name()))) {
sortTime = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_SUBREDDIT_POST_BASE + subredditName,
mSharedPreferences.getString(SharedPreferencesUtils.SUBREDDIT_DEFAULT_SORT_TIME, SortType.Time.ALL.name()));
}
@ -598,7 +598,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_MULTI_REDDIT_POST_BASE + multiRedditPath,
SortType.Type.HOT.name());
if (sort.equals(SortType.Type.CONTROVERSIAL.name()) || sort.equals(SortType.Type.TOP.name())) {
if (sort.equals(SortType.Type.TOP.name())) {
sortTime = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_MULTI_REDDIT_POST_BASE + multiRedditPath,
SortType.Time.ALL.name());
}
@ -667,7 +667,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
String sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_USER_POST_BASE + username,
mSharedPreferences.getString(SharedPreferencesUtils.USER_DEFAULT_SORT_TYPE, SortType.Type.NEW.name()));
if (sort.equals(SortType.Type.CONTROVERSIAL.name()) || sort.equals(SortType.Type.TOP.name())) {
if (sort.equals(SortType.Type.TOP.name())) {
String sortTime = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_USER_POST_BASE + username,
mSharedPreferences.getString(SharedPreferencesUtils.USER_DEFAULT_SORT_TIME, SortType.Time.ALL.name()));
sortType = new SortType(SortType.Type.valueOf(sort), SortType.Time.valueOf(sortTime));
@ -729,7 +729,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
subredditName = getArguments().getString(EXTRA_NAME);
String sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_SUBREDDIT_POST_BASE + "-", SortType.Type.HOT.name());
if (sort.equals(SortType.Type.CONTROVERSIAL.name()) || sort.equals(SortType.Type.TOP.name())) {
if (sort.equals(SortType.Type.TOP.name())) {
String sortTime = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_SUBREDDIT_POST_BASE + "-", SortType.Time.ALL.name());
sortType = new SortType(SortType.Type.valueOf(sort), SortType.Time.valueOf(sortTime));
} else {
@ -789,7 +789,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
nameOfUsage = multiRedditPath;
String sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_MULTI_REDDIT_POST_BASE + multiRedditPath, SortType.Type.HOT.name());
if (sort.equals(SortType.Type.CONTROVERSIAL.name()) || sort.equals(SortType.Type.TOP.name())) {
if (sort.equals(SortType.Type.TOP.name())) {
String sortTime = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_MULTI_REDDIT_POST_BASE + multiRedditPath, SortType.Time.ALL.name());
sortType = new SortType(SortType.Type.valueOf(sort), SortType.Time.valueOf(sortTime));
} else {
@ -847,7 +847,7 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
nameOfUsage = PostFilterUsage.NO_USAGE;
subredditName = getArguments().getString(EXTRA_NAME);
String sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_BEST_POST, SortType.Type.ACTIVE.name());
if (sort.equals(SortType.Type.CONTROVERSIAL.name()) || sort.equals(SortType.Type.TOP.name())) {
if (sort.equals(SortType.Type.TOP.name())) {
String sortTime = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_BEST_POST, SortType.Time.ALL.name());
sortType = new SortType(SortType.Type.valueOf(sort), SortType.Time.valueOf(sortTime));
} else {

View File

@ -139,7 +139,7 @@ public class SubredditListingFragment extends Fragment implements FragmentCommun
String accessToken = getArguments().getString(EXTRA_ACCESS_TOKEN);
String accountName = getArguments().getString(EXTRA_ACCOUNT_NAME);
String sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_SEARCH_SUBREDDIT, SortType.Type.RELEVANCE.value);
String sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_SEARCH_SUBREDDIT, SortType.Type.TOP.value);
sortType = new SortType(SortType.Type.valueOf(sort.toUpperCase()));
boolean nsfw = !mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_NSFW_FOREVER, false) && mNsfwAndSpoilerSharedPreferences.getBoolean((accountName == null ? "" : accountName) + SharedPreferencesUtils.NSFW_BASE, false);

View File

@ -139,7 +139,7 @@ public class UserListingFragment extends Fragment implements FragmentCommunicato
boolean isGettingUserInfo = getArguments().getBoolean(EXTRA_IS_GETTING_USER_INFO);
String accessToken = getArguments().getString(EXTRA_ACCESS_TOKEN);
String accountName = getArguments().getString(EXTRA_ACCOUNT_NAME);
String sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_SEARCH_USER, SortType.Type.RELEVANCE.value);
String sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_SEARCH_USER, SortType.Type.TOP.value);
sortType = new SortType(SortType.Type.valueOf(sort.toUpperCase()));
boolean nsfw = !mSharedPreferences.getBoolean(SharedPreferencesUtils.DISABLE_NSFW_FOREVER, false) && mNsfwAndSpoilerSharedPreferences.getBoolean((accountName == null ? "" : accountName) + SharedPreferencesUtils.NSFW_BASE, false);

View File

@ -816,15 +816,7 @@ public class ViewPostDetailFragment extends Fragment implements FragmentCommunic
@NonNull
private SortType.Type loadSortType() {
String sortTypeName = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_POST_COMMENT, SortType.Type.CONFIDENCE.name());
if (SortType.Type.ACTIVE.name().equals(sortTypeName)) {
// migrate from BEST to CONFIDENCE
// key guaranteed to exist because got non-default value
mSortTypeSharedPreferences.edit()
.putString(SharedPreferencesUtils.SORT_TYPE_POST_COMMENT, SortType.Type.CONFIDENCE.name())
.apply();
return SortType.Type.CONFIDENCE;
}
String sortTypeName = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_POST_COMMENT, SortType.Type.NEW.name());
return SortType.Type.valueOf(sortTypeName);
}

View File

@ -150,7 +150,7 @@ public class PostPagingSource extends ListenableFuturePagingSource<Integer, Post
this.query = query;
this.trendingSource = trendingSource;
this.postType = postType;
this.sortType = sortType == null ? new SortType(SortType.Type.RELEVANCE) : sortType;
this.sortType = sortType == null ? new SortType(SortType.Type.TOP) : sortType;
this.postFilter = postFilter;
postLinkedHashSet = new LinkedHashSet<>();
this.readPostList = readPostList;

View File

@ -0,0 +1,10 @@
<vector android:height="24dp"
android:tint="#000000"
android:viewportHeight="24"
android:viewportWidth="24"
android:width="24dp"
xmlns:android="http://schemas.android.com/apk/res/android">
<path
android:fillColor="@android:color/white"
android:pathData="M18,22l-0.01,-6L14,12l3.99,-4.01L18,2H6v6l4,4l-4,3.99V22H18zM8,7.5V4h8v3.5l-4,4L8,7.5z" />
</vector>

View File

@ -12,7 +12,7 @@
android:orientation="vertical">
<TextView
android:id="@+id/best_type_text_view_post_comment_sort_type_bottom_sheet_fragment"
android:id="@+id/hot_type_text_view_post_comment_sort_type_bottom_sheet_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
@ -59,22 +59,6 @@
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />
<TextView
android:id="@+id/controversial_type_text_view_post_comment_sort_type_bottom_sheet_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:paddingStart="32dp"
android:paddingTop="16dp"
android:paddingEnd="32dp"
android:paddingBottom="16dp"
android:text="@string/sort_controversial"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />
<TextView
android:id="@+id/old_type_text_view_post_comment_sort_type_bottom_sheet_fragment"
android:layout_width="match_parent"
@ -91,54 +75,6 @@
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />
<TextView
android:id="@+id/random_type_text_view_post_comment_sort_type_bottom_sheet_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:paddingStart="32dp"
android:paddingTop="16dp"
android:paddingEnd="32dp"
android:paddingBottom="16dp"
android:text="@string/sort_random"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />
<TextView
android:id="@+id/qa_type_text_view_post_comment_sort_type_bottom_sheet_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:paddingStart="32dp"
android:paddingTop="16dp"
android:paddingEnd="32dp"
android:paddingBottom="16dp"
android:text="@string/sort_qa"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />
<TextView
android:id="@+id/live_type_text_view_post_comment_sort_type_bottom_sheet_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:paddingStart="32dp"
android:paddingTop="16dp"
android:paddingEnd="32dp"
android:paddingBottom="16dp"
android:text="@string/sort_live"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View File

@ -28,6 +28,38 @@
android:focusable="true"
android:background="?attr/selectableItemBackground" />
<TextView
android:id="@+id/six_hours_text_view_sort_time_bottom_sheet_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/sort_time_6hours"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:paddingStart="32dp"
android:paddingEnd="32dp"
android:clickable="true"
android:focusable="true"
android:background="?attr/selectableItemBackground" />
<TextView
android:id="@+id/twelve_hours_text_view_sort_time_bottom_sheet_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/sort_time_12hours"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:paddingStart="32dp"
android:paddingEnd="32dp"
android:clickable="true"
android:focusable="true"
android:background="?attr/selectableItemBackground" />
<TextView
android:id="@+id/day_text_view_sort_time_bottom_sheet_fragment"
android:layout_width="match_parent"
@ -76,6 +108,54 @@
android:focusable="true"
android:background="?attr/selectableItemBackground" />
<TextView
android:id="@+id/three_months_text_view_sort_time_bottom_sheet_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/sort_time_3months"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:paddingStart="32dp"
android:paddingEnd="32dp"
android:clickable="true"
android:focusable="true"
android:background="?attr/selectableItemBackground" />
<TextView
android:id="@+id/six_months_text_view_sort_time_bottom_sheet_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/sort_time_6months"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:paddingStart="32dp"
android:paddingEnd="32dp"
android:clickable="true"
android:focusable="true"
android:background="?attr/selectableItemBackground" />
<TextView
android:id="@+id/nine_months_text_view_sort_time_bottom_sheet_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/sort_time_9months"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default"
android:fontFamily="?attr/font_family"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:paddingStart="32dp"
android:paddingEnd="32dp"
android:clickable="true"
android:focusable="true"
android:background="?attr/selectableItemBackground" />
<TextView
android:id="@+id/year_text_view_sort_time_bottom_sheet_fragment"
android:layout_width="match_parent"

View File

@ -69,12 +69,12 @@
app:drawableTint="?attr/primaryTextColor" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/rising_type_text_view_sort_type_bottom_sheet_fragment"
android:id="@+id/old_type_text_view_sort_type_bottom_sheet_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:drawableStart="@drawable/ic_rising_24"
android:drawableStart="@drawable/ic_old"
android:drawablePadding="48dp"
android:focusable="true"
android:fontFamily="?attr/font_family"
@ -82,7 +82,7 @@
android:paddingTop="16dp"
android:paddingEnd="32dp"
android:paddingBottom="16dp"
android:text="@string/sort_rising"
android:text="@string/sort_old"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default"
app:drawableTint="?attr/primaryTextColor" />
@ -106,25 +106,6 @@
android:textSize="?attr/font_default"
app:drawableTint="?attr/primaryTextColor" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/controversial_type_text_view_sort_type_bottom_sheet_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:drawableStart="@drawable/ic_controversial_24"
android:drawablePadding="48dp"
android:focusable="true"
android:fontFamily="?attr/font_family"
android:paddingStart="32dp"
android:paddingTop="16dp"
android:paddingEnd="32dp"
android:paddingBottom="16dp"
android:text="@string/sort_controversial"
android:textColor="?attr/primaryTextColor"
android:textSize="?attr/font_default"
app:drawableTint="?attr/primaryTextColor" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View File

@ -1330,4 +1330,9 @@
<string name="user_password">Password</string>
<string name="user_2fa_token">2FA token (if needed)</string>
<string name="user_login">Login</string>
<string name="sort_time_6hours">6 Hours</string>
<string name="sort_time_12hours">12 Hours</string>
<string name="sort_time_3months">3 Months</string>
<string name="sort_time_6months">6 Months</string>
<string name="sort_time_9months">9 Months</string>
</resources>