diff --git a/app/src/main/java/eu/toldi/infinityforlemmy/SortType.java b/app/src/main/java/eu/toldi/infinityforlemmy/SortType.java index 9b7f4acf..6cac55f6 100644 --- a/app/src/main/java/eu/toldi/infinityforlemmy/SortType.java +++ b/app/src/main/java/eu/toldi/infinityforlemmy/SortType.java @@ -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"); diff --git a/app/src/main/java/eu/toldi/infinityforlemmy/bottomsheetfragments/PostCommentSortTypeBottomSheetFragment.java b/app/src/main/java/eu/toldi/infinityforlemmy/bottomsheetfragments/PostCommentSortTypeBottomSheetFragment.java index 9d006c49..3a22a05d 100644 --- a/app/src/main/java/eu/toldi/infinityforlemmy/bottomsheetfragments/PostCommentSortTypeBottomSheetFragment.java +++ b/app/src/main/java/eu/toldi/infinityforlemmy/bottomsheetfragments/PostCommentSortTypeBottomSheetFragment.java @@ -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); } diff --git a/app/src/main/java/eu/toldi/infinityforlemmy/bottomsheetfragments/SearchPostSortTypeBottomSheetFragment.java b/app/src/main/java/eu/toldi/infinityforlemmy/bottomsheetfragments/SearchPostSortTypeBottomSheetFragment.java index 65aa2a31..f64c5833 100644 --- a/app/src/main/java/eu/toldi/infinityforlemmy/bottomsheetfragments/SearchPostSortTypeBottomSheetFragment.java +++ b/app/src/main/java/eu/toldi/infinityforlemmy/bottomsheetfragments/SearchPostSortTypeBottomSheetFragment.java @@ -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(); }); diff --git a/app/src/main/java/eu/toldi/infinityforlemmy/bottomsheetfragments/SearchUserAndSubredditSortTypeBottomSheetFragment.java b/app/src/main/java/eu/toldi/infinityforlemmy/bottomsheetfragments/SearchUserAndSubredditSortTypeBottomSheetFragment.java index 6d2801e7..0f6acfda 100644 --- a/app/src/main/java/eu/toldi/infinityforlemmy/bottomsheetfragments/SearchUserAndSubredditSortTypeBottomSheetFragment.java +++ b/app/src/main/java/eu/toldi/infinityforlemmy/bottomsheetfragments/SearchUserAndSubredditSortTypeBottomSheetFragment.java @@ -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(); }); diff --git a/app/src/main/java/eu/toldi/infinityforlemmy/bottomsheetfragments/SortTimeBottomSheetFragment.java b/app/src/main/java/eu/toldi/infinityforlemmy/bottomsheetfragments/SortTimeBottomSheetFragment.java index 8ae8278d..02fbeb0d 100644 --- a/app/src/main/java/eu/toldi/infinityforlemmy/bottomsheetfragments/SortTimeBottomSheetFragment.java +++ b/app/src/main/java/eu/toldi/infinityforlemmy/bottomsheetfragments/SortTimeBottomSheetFragment.java @@ -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(); }); diff --git a/app/src/main/java/eu/toldi/infinityforlemmy/bottomsheetfragments/SortTypeBottomSheetFragment.java b/app/src/main/java/eu/toldi/infinityforlemmy/bottomsheetfragments/SortTypeBottomSheetFragment.java index 66e588e9..3facf63a 100644 --- a/app/src/main/java/eu/toldi/infinityforlemmy/bottomsheetfragments/SortTypeBottomSheetFragment.java +++ b/app/src/main/java/eu/toldi/infinityforlemmy/bottomsheetfragments/SortTypeBottomSheetFragment.java @@ -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); diff --git a/app/src/main/java/eu/toldi/infinityforlemmy/bottomsheetfragments/UserThingSortTypeBottomSheetFragment.java b/app/src/main/java/eu/toldi/infinityforlemmy/bottomsheetfragments/UserThingSortTypeBottomSheetFragment.java index 8603a04b..337a94cc 100644 --- a/app/src/main/java/eu/toldi/infinityforlemmy/bottomsheetfragments/UserThingSortTypeBottomSheetFragment.java +++ b/app/src/main/java/eu/toldi/infinityforlemmy/bottomsheetfragments/UserThingSortTypeBottomSheetFragment.java @@ -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); diff --git a/app/src/main/java/eu/toldi/infinityforlemmy/fragments/CommentsListingFragment.java b/app/src/main/java/eu/toldi/infinityforlemmy/fragments/CommentsListingFragment.java index 258b93dd..e9ce58ab 100644 --- a/app/src/main/java/eu/toldi/infinityforlemmy/fragments/CommentsListingFragment.java +++ b/app/src/main/java/eu/toldi/infinityforlemmy/fragments/CommentsListingFragment.java @@ -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 { diff --git a/app/src/main/java/eu/toldi/infinityforlemmy/fragments/PostFragment.java b/app/src/main/java/eu/toldi/infinityforlemmy/fragments/PostFragment.java index cfdd68f3..74fba058 100644 --- a/app/src/main/java/eu/toldi/infinityforlemmy/fragments/PostFragment.java +++ b/app/src/main/java/eu/toldi/infinityforlemmy/fragments/PostFragment.java @@ -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 { diff --git a/app/src/main/java/eu/toldi/infinityforlemmy/fragments/SubredditListingFragment.java b/app/src/main/java/eu/toldi/infinityforlemmy/fragments/SubredditListingFragment.java index f9ce5cc0..11f4a7ad 100644 --- a/app/src/main/java/eu/toldi/infinityforlemmy/fragments/SubredditListingFragment.java +++ b/app/src/main/java/eu/toldi/infinityforlemmy/fragments/SubredditListingFragment.java @@ -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); diff --git a/app/src/main/java/eu/toldi/infinityforlemmy/fragments/UserListingFragment.java b/app/src/main/java/eu/toldi/infinityforlemmy/fragments/UserListingFragment.java index 9fb8742e..45a72ce0 100644 --- a/app/src/main/java/eu/toldi/infinityforlemmy/fragments/UserListingFragment.java +++ b/app/src/main/java/eu/toldi/infinityforlemmy/fragments/UserListingFragment.java @@ -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); diff --git a/app/src/main/java/eu/toldi/infinityforlemmy/fragments/ViewPostDetailFragment.java b/app/src/main/java/eu/toldi/infinityforlemmy/fragments/ViewPostDetailFragment.java index 9bed73cb..091bfacb 100644 --- a/app/src/main/java/eu/toldi/infinityforlemmy/fragments/ViewPostDetailFragment.java +++ b/app/src/main/java/eu/toldi/infinityforlemmy/fragments/ViewPostDetailFragment.java @@ -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); } diff --git a/app/src/main/java/eu/toldi/infinityforlemmy/post/PostPagingSource.java b/app/src/main/java/eu/toldi/infinityforlemmy/post/PostPagingSource.java index 6aca0f9f..fe4d6c92 100644 --- a/app/src/main/java/eu/toldi/infinityforlemmy/post/PostPagingSource.java +++ b/app/src/main/java/eu/toldi/infinityforlemmy/post/PostPagingSource.java @@ -150,7 +150,7 @@ public class PostPagingSource extends ListenableFuturePagingSource(); this.readPostList = readPostList; diff --git a/app/src/main/res/drawable/ic_old.xml b/app/src/main/res/drawable/ic_old.xml new file mode 100644 index 00000000..e0186bab --- /dev/null +++ b/app/src/main/res/drawable/ic_old.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/layout/fragment_post_comment_sort_type_bottom_sheet.xml b/app/src/main/res/layout/fragment_post_comment_sort_type_bottom_sheet.xml index d26e7bcb..812055b5 100644 --- a/app/src/main/res/layout/fragment_post_comment_sort_type_bottom_sheet.xml +++ b/app/src/main/res/layout/fragment_post_comment_sort_type_bottom_sheet.xml @@ -12,7 +12,7 @@ android:orientation="vertical"> - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_sort_time_bottom_sheet.xml b/app/src/main/res/layout/fragment_sort_time_bottom_sheet.xml index bcd346fb..50323d2b 100644 --- a/app/src/main/res/layout/fragment_sort_time_bottom_sheet.xml +++ b/app/src/main/res/layout/fragment_sort_time_bottom_sheet.xml @@ -28,6 +28,38 @@ android:focusable="true" android:background="?attr/selectableItemBackground" /> + + + + + + + + + + @@ -106,25 +106,6 @@ android:textSize="?attr/font_default" app:drawableTint="?attr/primaryTextColor" /> - - diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index be8a9eae..e7dde047 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1330,4 +1330,9 @@ Password 2FA token (if needed) Login + 6 Hours + 12 Hours + 3 Months + 6 Months + 9 Months