mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2025-03-27 20:15:28 +01:00
Added "Most comments" and "new comments" sort type
This commit is contained in:
parent
133dc4a69c
commit
ba5b533cb9
@ -35,8 +35,8 @@ public class SortType {
|
|||||||
NEW("New", "New"),
|
NEW("New", "New"),
|
||||||
OLD("Old", "Old"),
|
OLD("Old", "Old"),
|
||||||
TOP("Top", "Top"),
|
TOP("Top", "Top"),
|
||||||
MOST_COMMENTS("MostCommentes", "Most Commentes"),
|
MOST_COMMENTS("MostComments", "Most Comments"),
|
||||||
NEW_COMMENTS("NewCommentes", "New Commentes"),
|
NEW_COMMENTS("NewComments", "New Comments"),
|
||||||
|
|
||||||
TOP_HOUR("TopHour", "Top"),
|
TOP_HOUR("TopHour", "Top"),
|
||||||
TOP_SIX_HOURS("TopSixHour", "Top"),
|
TOP_SIX_HOURS("TopSixHour", "Top"),
|
||||||
|
@ -58,6 +58,12 @@ public class SortTypeBottomSheetFragment extends LandscapeExpandedRoundedBottomS
|
|||||||
@BindView(R.id.controversial_type_text_view_sort_type_bottom_sheet_fragment)
|
@BindView(R.id.controversial_type_text_view_sort_type_bottom_sheet_fragment)
|
||||||
TextView controversialTypeTextView;
|
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;
|
private BaseActivity activity;
|
||||||
|
|
||||||
public SortTypeBottomSheetFragment() {
|
public SortTypeBottomSheetFragment() {
|
||||||
@ -93,6 +99,10 @@ public class SortTypeBottomSheetFragment extends LandscapeExpandedRoundedBottomS
|
|||||||
case PAGE_TYPE_ANONYMOUS_FRONT_PAGE:
|
case PAGE_TYPE_ANONYMOUS_FRONT_PAGE:
|
||||||
activeTypeTextView.setVisibility(View.GONE);
|
activeTypeTextView.setVisibility(View.GONE);
|
||||||
hotTypeTextView.setVisibility(View.GONE);
|
hotTypeTextView.setVisibility(View.GONE);
|
||||||
|
scaledTypeTextView.setVisibility(View.GONE);
|
||||||
|
controversialTypeTextView.setVisibility(View.GONE);
|
||||||
|
mostCommentsTypeTextView.setVisibility(View.GONE);
|
||||||
|
newCommentsTypeTextView.setVisibility(View.GONE);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
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);
|
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)) {
|
} 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);
|
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 -> {
|
activeTypeTextView.setOnClickListener(view -> {
|
||||||
@ -154,6 +168,16 @@ public class SortTypeBottomSheetFragment extends LandscapeExpandedRoundedBottomS
|
|||||||
dismiss();
|
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) {
|
if (activity.typeface != null) {
|
||||||
Utils.setFontToAllTextViews(rootView, activity.typeface);
|
Utils.setFontToAllTextViews(rootView, activity.typeface);
|
||||||
|
10
app/src/main/res/drawable/ic_new_comments_24.xml
Normal file
10
app/src/main/res/drawable/ic_new_comments_24.xml
Normal 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="M21.99,4c0,-1.1 -0.89,-2 -1.99,-2H4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h14l4,4 -0.01,-18zM17,11h-4v4h-2v-4H7V9h4V5h2v4h4v2z" />
|
||||||
|
</vector>
|
@ -144,6 +144,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/most_comments_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_comment_black_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_most_comments"
|
||||||
|
android:textColor="?attr/primaryTextColor"
|
||||||
|
android:textSize="?attr/font_default"
|
||||||
|
app:drawableTint="?attr/primaryTextColor" />
|
||||||
|
|
||||||
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
|
android:id="@+id/new_comments_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_new_comments_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_new_comments"
|
||||||
|
android:textColor="?attr/primaryTextColor"
|
||||||
|
android:textSize="?attr/font_default"
|
||||||
|
app:drawableTint="?attr/primaryTextColor" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.core.widget.NestedScrollView>
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
@ -1321,4 +1321,6 @@
|
|||||||
<string name="sort_scaled">Scaled</string>
|
<string name="sort_scaled">Scaled</string>
|
||||||
<string name="token_expired">Token Expired</string>
|
<string name="token_expired">Token Expired</string>
|
||||||
<string name="token_expired_message">"Your token has been expired. As Eternity does not store your password, you need to manually log back in! "</string>
|
<string name="token_expired_message">"Your token has been expired. As Eternity does not store your password, you need to manually log back in! "</string>
|
||||||
|
<string name="sort_most_comments">Most Comments</string>
|
||||||
|
<string name="sort_new_comments">New Comments</string>
|
||||||
</resources>
|
</resources>
|
Loading…
x
Reference in New Issue
Block a user