mirror of
https://codeberg.org/Bazsalanszky/Infinity-For-Lemmy.git
synced 2024-12-27 11:28:22 +01:00
parent
0b76390069
commit
1bb1d3b9af
@ -31,16 +31,12 @@ public class SearchPostSortTypeBottomSheetFragment extends LandscapeExpandedRoun
|
||||
|
||||
public static final String EXTRA_CURRENT_SORT_TYPE = "ECST";
|
||||
|
||||
@BindView(R.id.relevance_type_text_view_search_sort_type_bottom_sheet_fragment)
|
||||
TextView relevanceTypeTextView;
|
||||
@BindView(R.id.hot_type_text_view_search_sort_type_bottom_sheet_fragment)
|
||||
TextView hotTypeTextView;
|
||||
@BindView(R.id.top_type_text_view_search_sort_type_bottom_sheet_fragment)
|
||||
TextView topTypeTextView;
|
||||
@BindView(R.id.new_type_text_view_search_sort_type_bottom_sheet_fragment)
|
||||
TextView newTypeTextView;
|
||||
@BindView(R.id.comments_type_text_view_search_sort_type_bottom_sheet_fragment)
|
||||
TextView commentsTypeTextView;
|
||||
@BindView(R.id.old_type_text_view_search_sort_type_bottom_sheet_fragment)
|
||||
TextView oldTypeTextView;
|
||||
private BaseActivity activity;
|
||||
public SearchPostSortTypeBottomSheetFragment() {
|
||||
// Required empty public constructor
|
||||
@ -61,14 +57,12 @@ public class SearchPostSortTypeBottomSheetFragment extends LandscapeExpandedRoun
|
||||
ButterKnife.bind(this, rootView);
|
||||
|
||||
String currentSortType = getArguments().getString(EXTRA_CURRENT_SORT_TYPE);
|
||||
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)) {
|
||||
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.OLD.fullName)) {
|
||||
commentsTypeTextView.setCompoundDrawablesRelativeWithIntrinsicBounds(commentsTypeTextView.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);
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O
|
||||
@ -76,15 +70,6 @@ public class SearchPostSortTypeBottomSheetFragment extends LandscapeExpandedRoun
|
||||
rootView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR);
|
||||
}
|
||||
|
||||
/*relevanceTypeTextView.setOnClickListener(view -> {
|
||||
((SortTypeSelectionCallback) activity).sortTypeSelected(SortType.Type.RELEVANCE.name());
|
||||
dismiss();
|
||||
});*/
|
||||
|
||||
hotTypeTextView.setOnClickListener(view -> {
|
||||
((SortTypeSelectionCallback) activity).sortTypeSelected(SortType.Type.HOT.name());
|
||||
dismiss();
|
||||
});
|
||||
|
||||
topTypeTextView.setOnClickListener(view -> {
|
||||
((SortTypeSelectionCallback) activity).sortTypeSelected(SortType.Type.TOP.name());
|
||||
@ -92,12 +77,12 @@ public class SearchPostSortTypeBottomSheetFragment extends LandscapeExpandedRoun
|
||||
});
|
||||
|
||||
newTypeTextView.setOnClickListener(view -> {
|
||||
((SortTypeSelectionCallback) activity).sortTypeSelected(new SortType(SortType.Type.NEW));
|
||||
((SortTypeSelectionCallback) activity).sortTypeSelected(new SortType(SortType.Type.NEW,null));
|
||||
dismiss();
|
||||
});
|
||||
|
||||
commentsTypeTextView.setOnClickListener(view -> {
|
||||
((SortTypeSelectionCallback) activity).sortTypeSelected(SortType.Type.MOST_COMMENTS.name());
|
||||
oldTypeTextView.setOnClickListener(view -> {
|
||||
((SortTypeSelectionCallback) activity).sortTypeSelected(new SortType(SortType.Type.OLD,null));
|
||||
dismiss();
|
||||
});
|
||||
|
||||
|
@ -460,9 +460,9 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
||||
nameOfUsage = PostFilterUsage.NO_USAGE;
|
||||
|
||||
String sort = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TYPE_SEARCH_POST, SortType.Type.TOP_ALL.value);
|
||||
String sortTime = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_SEARCH_POST, SortType.Time.ALL.name());
|
||||
String sortTime = mSortTypeSharedPreferences.getString(SharedPreferencesUtils.SORT_TIME_SEARCH_POST, sort.equalsIgnoreCase(SortType.Type.TOP.value) ? SortType.Time.ALL.name() : null);
|
||||
SortType.Type st = SortType.Type.fromValue(sort);
|
||||
sortType = new SortType(st == null ? SortType.Type.TOP_ALL : st, SortType.Time.valueOf(sortTime));
|
||||
sortType = new SortType(st == null ? SortType.Type.TOP_ALL : st,sortTime != null ? SortType.Time.valueOf(sortTime) : null);
|
||||
postLayout = mPostLayoutSharedPreferences.getInt(SharedPreferencesUtils.POST_LAYOUT_SEARCH_POST, defaultPostLayout);
|
||||
|
||||
mAdapter = new PostRecyclerViewAdapter(activity, this, mExecutor, mRetrofit.getRetrofit(), mGfycatRetrofit,
|
||||
@ -1385,6 +1385,8 @@ public class PostFragment extends Fragment implements FragmentCommunicator {
|
||||
mSortTypeSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TYPE_SEARCH_POST, sortType.getType().name()).apply();
|
||||
if (sortType.getTime() != null) {
|
||||
mSortTypeSharedPreferences.edit().putString(SharedPreferencesUtils.SORT_TIME_SEARCH_POST, sortType.getTime().name()).apply();
|
||||
}else {
|
||||
mSortTypeSharedPreferences.edit().remove(SharedPreferencesUtils.SORT_TIME_SEARCH_POST).apply();
|
||||
}
|
||||
break;
|
||||
case PostPagingSource.TYPE_MULTI_REDDIT:
|
||||
|
@ -11,43 +11,6 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/relevance_type_text_view_search_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_best_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_relevance"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/font_default"
|
||||
app:drawableTint="?attr/primaryTextColor" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/hot_type_text_view_search_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_hot_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_hot"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/font_default"
|
||||
app:drawableTint="?attr/primaryTextColor" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/top_type_text_view_search_sort_type_bottom_sheet_fragment"
|
||||
@ -88,7 +51,7 @@
|
||||
app:drawableTint="?attr/primaryTextColor" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/comments_type_text_view_search_sort_type_bottom_sheet_fragment"
|
||||
android:id="@+id/old_type_text_view_search_sort_type_bottom_sheet_fragment"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
@ -101,7 +64,7 @@
|
||||
android:paddingTop="16dp"
|
||||
android:paddingEnd="32dp"
|
||||
android:paddingBottom="16dp"
|
||||
android:text="@string/sort_comments"
|
||||
android:text="@string/sort_old"
|
||||
android:textColor="?attr/primaryTextColor"
|
||||
android:textSize="?attr/font_default"
|
||||
app:drawableTint="?attr/primaryTextColor" />
|
||||
|
Loading…
Reference in New Issue
Block a user