diff --git a/app/src/main/java/eu/toldi/infinityforlemmy/SortType.java b/app/src/main/java/eu/toldi/infinityforlemmy/SortType.java index f6c726e5..b720fe68 100644 --- a/app/src/main/java/eu/toldi/infinityforlemmy/SortType.java +++ b/app/src/main/java/eu/toldi/infinityforlemmy/SortType.java @@ -35,8 +35,8 @@ public class SortType { NEW("New", "New"), OLD("Old", "Old"), TOP("Top", "Top"), - MOST_COMMENTS("MostCommentes", "Most Commentes"), - NEW_COMMENTS("NewCommentes", "New Commentes"), + MOST_COMMENTS("MostComments", "Most Comments"), + NEW_COMMENTS("NewComments", "New Comments"), TOP_HOUR("TopHour", "Top"), TOP_SIX_HOURS("TopSixHour", "Top"), 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 3087111f..87a51795 100644 --- a/app/src/main/java/eu/toldi/infinityforlemmy/bottomsheetfragments/SortTypeBottomSheetFragment.java +++ b/app/src/main/java/eu/toldi/infinityforlemmy/bottomsheetfragments/SortTypeBottomSheetFragment.java @@ -58,6 +58,12 @@ public class SortTypeBottomSheetFragment extends LandscapeExpandedRoundedBottomS @BindView(R.id.controversial_type_text_view_sort_type_bottom_sheet_fragment) TextView controversialTypeTextView; + @BindView(R.id.most_comments_type_text_view_sort_type_bottom_sheet_fragment) + TextView mostCommentsTypeTextView; + + @BindView(R.id.new_comments_type_text_view_sort_type_bottom_sheet_fragment) + TextView newCommentsTypeTextView; + private BaseActivity activity; public SortTypeBottomSheetFragment() { @@ -93,6 +99,10 @@ public class SortTypeBottomSheetFragment extends LandscapeExpandedRoundedBottomS case PAGE_TYPE_ANONYMOUS_FRONT_PAGE: activeTypeTextView.setVisibility(View.GONE); hotTypeTextView.setVisibility(View.GONE); + scaledTypeTextView.setVisibility(View.GONE); + controversialTypeTextView.setVisibility(View.GONE); + mostCommentsTypeTextView.setVisibility(View.GONE); + newCommentsTypeTextView.setVisibility(View.GONE); break; default: @@ -117,6 +127,10 @@ public class SortTypeBottomSheetFragment extends LandscapeExpandedRoundedBottomS scaledTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(scaledTypeTextView.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); + } else if (currentSortType.equals(SortType.Type.MOST_COMMENTS.fullName)) { + mostCommentsTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(mostCommentsTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null); + } else if (currentSortType.equals(SortType.Type.NEW_COMMENTS.fullName)) { + newCommentsTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(newCommentsTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null); } activeTypeTextView.setOnClickListener(view -> { @@ -154,6 +168,16 @@ public class SortTypeBottomSheetFragment extends LandscapeExpandedRoundedBottomS dismiss(); }); + mostCommentsTypeTextView.setOnClickListener(view -> { + ((SortTypeSelectionCallback) activity).sortTypeSelected(new SortType(SortType.Type.MOST_COMMENTS)); + dismiss(); + }); + + newCommentsTypeTextView.setOnClickListener(view -> { + ((SortTypeSelectionCallback) activity).sortTypeSelected(new SortType(SortType.Type.NEW_COMMENTS)); + dismiss(); + }); + if (activity.typeface != null) { Utils.setFontToAllTextViews(rootView, activity.typeface); diff --git a/app/src/main/res/drawable/ic_new_comments_24.xml b/app/src/main/res/drawable/ic_new_comments_24.xml new file mode 100644 index 00000000..dee15d49 --- /dev/null +++ b/app/src/main/res/drawable/ic_new_comments_24.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/layout/fragment_sort_type_bottom_sheet.xml b/app/src/main/res/layout/fragment_sort_type_bottom_sheet.xml index 13d15f2e..30022671 100644 --- a/app/src/main/res/layout/fragment_sort_type_bottom_sheet.xml +++ b/app/src/main/res/layout/fragment_sort_type_bottom_sheet.xml @@ -144,6 +144,44 @@ 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 21aa3a64..299690b6 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1321,4 +1321,6 @@ Scaled Token Expired "Your token has been expired. As Eternity does not store your password, you need to manually log back in! " + Most Comments + New Comments \ No newline at end of file