Scaled and Controversial sort types

This commit is contained in:
Balazs Toldi 2024-01-02 18:56:47 +01:00
parent af7148ce58
commit 40a9091b7d
No known key found for this signature in database
GPG Key ID: 6C7D440036F99D58
5 changed files with 73 additions and 1 deletions

View File

@ -48,7 +48,10 @@ public class SortType {
TOP_SIX_MONTHS("TopSixMonths", "Top"), TOP_SIX_MONTHS("TopSixMonths", "Top"),
TOP_NINE_MONTHS("TopNineMonths", "Top"), TOP_NINE_MONTHS("TopNineMonths", "Top"),
TOP_YEAR("TopYear", "Top"), TOP_YEAR("TopYear", "Top"),
TOP_ALL("TopAll", "Top"); TOP_ALL("TopAll", "Top"),
SCALED("Scaled", "Scaled"),
CONTROVERSIAL("Controversial", "Controversial");
public final String value; public final String value;
public final String fullName; public final String fullName;

View File

@ -43,6 +43,12 @@ public class SortTypeBottomSheetFragment extends LandscapeExpandedRoundedBottomS
@BindView(R.id.top_type_text_view_sort_type_bottom_sheet_fragment) @BindView(R.id.top_type_text_view_sort_type_bottom_sheet_fragment)
TextView topTypeTextView; TextView topTypeTextView;
@BindView(R.id.scaled_type_text_view_sort_type_bottom_sheet_fragment)
TextView scaledTypeTextView;
@BindView(R.id.controversial_type_text_view_sort_type_bottom_sheet_fragment)
TextView controversialTypeTextView;
private BaseActivity activity; private BaseActivity activity;
public SortTypeBottomSheetFragment() { public SortTypeBottomSheetFragment() {
@ -89,6 +95,10 @@ public class SortTypeBottomSheetFragment extends LandscapeExpandedRoundedBottomS
oldTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(oldTypeTextView.getCompoundDrawablesRelative()[0], null, AppCompatResources.getDrawable(activity, R.drawable.ic_round_check_circle_day_night_24dp), null); 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)) { } 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); 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.SCALED.fullName)) {
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);
} }
hotTypeTextView.setOnClickListener(view -> { hotTypeTextView.setOnClickListener(view -> {
@ -111,6 +121,16 @@ public class SortTypeBottomSheetFragment extends LandscapeExpandedRoundedBottomS
dismiss(); dismiss();
}); });
scaledTypeTextView.setOnClickListener(view -> {
((SortTypeSelectionCallback) activity).sortTypeSelected(new SortType(SortType.Type.SCALED));
dismiss();
});
controversialTypeTextView.setOnClickListener(view -> {
((SortTypeSelectionCallback) activity).sortTypeSelected(new SortType(SortType.Type.CONTROVERSIAL));
dismiss();
});
if (activity.typeface != null) { if (activity.typeface != null) {
Utils.setFontToAllTextViews(rootView, activity.typeface); Utils.setFontToAllTextViews(rootView, activity.typeface);

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="M14,11V8c4.56,-0.58 8,-3.1 8,-6H2c0,2.9 3.44,5.42 8,6l0,3c-3.68,0.73 -8,3.61 -8,11h6v-2H4.13c0.93,-6.83 6.65,-7.2 7.87,-7.2s6.94,0.37 7.87,7.2H16v2h6C22,14.61 17.68,11.73 14,11zM12,22c-1.1,0 -2,-0.9 -2,-2c0,-0.55 0.22,-1.05 0.59,-1.41C11.39,17.79 16,16 16,16s-1.79,4.61 -2.59,5.41C13.05,21.78 12.55,22 12,22z" />
</vector>

View File

@ -87,6 +87,44 @@
android:textSize="?attr/font_default" android:textSize="?attr/font_default"
app:drawableTint="?attr/primaryTextColor" /> app:drawableTint="?attr/primaryTextColor" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/scaled_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/baseline_scale_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_scaled"
android:textColor="?attr/primaryTextColor"
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" />
<androidx.appcompat.widget.AppCompatTextView <androidx.appcompat.widget.AppCompatTextView
android:id="@+id/top_type_text_view_sort_type_bottom_sheet_fragment" android:id="@+id/top_type_text_view_sort_type_bottom_sheet_fragment"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@ -1321,4 +1321,5 @@
<string name="original_app">The original Reddit app</string> <string name="original_app">The original Reddit app</string>
<string name="settings_credits_original_app_description">"Infinity was created by u/Hostilenemy "</string> <string name="settings_credits_original_app_description">"Infinity was created by u/Hostilenemy "</string>
<string name="the_url_of_you_prefered_lemmy_instance_with_or_without_the_https_prefix">The URL of you prefered Lemmy instance with or without the https:// prefix</string> <string name="the_url_of_you_prefered_lemmy_instance_with_or_without_the_https_prefix">The URL of you prefered Lemmy instance with or without the https:// prefix</string>
<string name="sort_scaled">Scaled</string>
</resources> </resources>