Minor fixes from our boy grishka himself
This commit is contained in:
parent
4ab1c61262
commit
87164dc469
|
@ -80,6 +80,7 @@ public class InstanceCatalogSignupFragment extends InstanceCatalogFragment imple
|
||||||
private LinearLayout filtersWrap;
|
private LinearLayout filtersWrap;
|
||||||
private HorizontalScrollView filtersScroll;
|
private HorizontalScrollView filtersScroll;
|
||||||
private ImageButton backBtn, clearSearchBtn;
|
private ImageButton backBtn, clearSearchBtn;
|
||||||
|
private View focusThing;
|
||||||
|
|
||||||
private FilterChipView categoryGeneral, categorySpecialInterests;
|
private FilterChipView categoryGeneral, categorySpecialInterests;
|
||||||
private List<FilterChipView> regionalFilters;
|
private List<FilterChipView> regionalFilters;
|
||||||
|
@ -285,7 +286,13 @@ public class InstanceCatalogSignupFragment extends InstanceCatalogFragment imple
|
||||||
|
|
||||||
FilterChipView langFilter=new FilterChipView(getActivity());
|
FilterChipView langFilter=new FilterChipView(getActivity());
|
||||||
langFilter.setDrawableEnd(R.drawable.ic_baseline_arrow_drop_down_18);
|
langFilter.setDrawableEnd(R.drawable.ic_baseline_arrow_drop_down_18);
|
||||||
langFilter.setText(R.string.server_filter_any_language);
|
if(currentLanguage==null){
|
||||||
|
langFilter.setText(R.string.server_filter_any_language);
|
||||||
|
}else{
|
||||||
|
Locale locale=Locale.forLanguageTag(currentLanguage);
|
||||||
|
langFilter.setText(locale.getDisplayLanguage(locale));
|
||||||
|
langFilter.setSelected(true);
|
||||||
|
}
|
||||||
langFilterMenu=new PopupMenu(getContext(), langFilter);
|
langFilterMenu=new PopupMenu(getContext(), langFilter);
|
||||||
langFilter.setOnTouchListener(langFilterMenu.getDragToOpenListener());
|
langFilter.setOnTouchListener(langFilterMenu.getDragToOpenListener());
|
||||||
langFilter.setOnClickListener(v->langFilterMenu.show());
|
langFilter.setOnClickListener(v->langFilterMenu.show());
|
||||||
|
@ -301,8 +308,12 @@ public class InstanceCatalogSignupFragment extends InstanceCatalogFragment imple
|
||||||
speedFilterMenu.getMenu().add(0, 2, 0, R.string.server_filter_manual_review);
|
speedFilterMenu.getMenu().add(0, 2, 0, R.string.server_filter_manual_review);
|
||||||
speedFilter.setOnTouchListener(speedFilterMenu.getDragToOpenListener());
|
speedFilter.setOnTouchListener(speedFilterMenu.getDragToOpenListener());
|
||||||
speedFilter.setOnClickListener(v->speedFilterMenu.show());
|
speedFilter.setOnClickListener(v->speedFilterMenu.show());
|
||||||
speedFilter.setText(R.string.server_filter_instant_signup);
|
speedFilter.setText(switch(currentSignupSpeedFilter){
|
||||||
speedFilter.setSelected(true);
|
case ANY -> R.string.server_filter_any_signup_speed;
|
||||||
|
case INSTANT -> R.string.server_filter_instant_signup;
|
||||||
|
case REVIEWED -> R.string.server_filter_manual_review;
|
||||||
|
});
|
||||||
|
speedFilter.setSelected(currentSignupSpeedFilter!=SignupSpeedFilter.ANY);
|
||||||
filtersWrap.addView(speedFilter, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
filtersWrap.addView(speedFilter, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||||
|
|
||||||
speedFilterMenu.setOnMenuItemClickListener(item->{
|
speedFilterMenu.setOnMenuItemClickListener(item->{
|
||||||
|
@ -328,11 +339,13 @@ public class InstanceCatalogSignupFragment extends InstanceCatalogFragment imple
|
||||||
categoryGeneral.setText(R.string.category_general);
|
categoryGeneral.setText(R.string.category_general);
|
||||||
categoryGeneral.setTag(CategoryChoice.GENERAL);
|
categoryGeneral.setTag(CategoryChoice.GENERAL);
|
||||||
categoryGeneral.setOnClickListener(this::onCategoryFilterClick);
|
categoryGeneral.setOnClickListener(this::onCategoryFilterClick);
|
||||||
|
categoryGeneral.setSelected(categoryChoice==CategoryChoice.GENERAL);
|
||||||
filtersWrap.addView(categoryGeneral, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
filtersWrap.addView(categoryGeneral, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||||
categorySpecialInterests=new FilterChipView(getActivity());
|
categorySpecialInterests=new FilterChipView(getActivity());
|
||||||
categorySpecialInterests.setText(R.string.category_special_interests);
|
categorySpecialInterests.setText(R.string.category_special_interests);
|
||||||
categorySpecialInterests.setTag(CategoryChoice.SPECIAL);
|
categorySpecialInterests.setTag(CategoryChoice.SPECIAL);
|
||||||
categorySpecialInterests.setOnClickListener(this::onCategoryFilterClick);
|
categorySpecialInterests.setOnClickListener(this::onCategoryFilterClick);
|
||||||
|
categorySpecialInterests.setSelected(categoryChoice==CategoryChoice.SPECIAL);
|
||||||
filtersWrap.addView(categorySpecialInterests, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
filtersWrap.addView(categorySpecialInterests, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||||
|
|
||||||
regionalFilters=Arrays.stream(CatalogInstance.Region.values()).map(r->{
|
regionalFilters=Arrays.stream(CatalogInstance.Region.values()).map(r->{
|
||||||
|
@ -351,6 +364,8 @@ public class InstanceCatalogSignupFragment extends InstanceCatalogFragment imple
|
||||||
filtersWrap.addView(fv, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
filtersWrap.addView(fv, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
|
||||||
return fv;
|
return fv;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
focusThing=view.findViewById(R.id.focus_thing);
|
||||||
|
focusThing.requestFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onRegionFilterClick(View v){
|
private void onRegionFilterClick(View v){
|
||||||
|
@ -550,7 +565,7 @@ public class InstanceCatalogSignupFragment extends InstanceCatalogFragment imple
|
||||||
searchEdit.setCompoundDrawableTintList(ColorStateList.valueOf(0));
|
searchEdit.setCompoundDrawableTintList(ColorStateList.valueOf(0));
|
||||||
}else{
|
}else{
|
||||||
filtersScroll.setVisibility(View.VISIBLE);
|
filtersScroll.setVisibility(View.VISIBLE);
|
||||||
searchEdit.clearFocus();
|
focusThing.requestFocus();
|
||||||
searchEdit.setText("");
|
searchEdit.setText("");
|
||||||
lp.addRule(RelativeLayout.END_OF, R.id.btn_back);
|
lp.addRule(RelativeLayout.END_OF, R.id.btn_back);
|
||||||
getActivity().getSystemService(InputMethodManager.class).hideSoftInputFromWindow(searchEdit.getWindowToken(), 0);
|
getActivity().getSystemService(InputMethodManager.class).hideSoftInputFromWindow(searchEdit.getWindowToken(), 0);
|
||||||
|
|
|
@ -40,6 +40,14 @@
|
||||||
android:backgroundTint="?colorM3SurfaceVariant"
|
android:backgroundTint="?colorM3SurfaceVariant"
|
||||||
android:hint="@string/search_communities"/>
|
android:hint="@string/search_communities"/>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/focus_thing"
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:focusable="true"
|
||||||
|
android:focusableInTouchMode="true"
|
||||||
|
android:importantForAccessibility="no"/>
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
android:id="@+id/btn_back"
|
android:id="@+id/btn_back"
|
||||||
android:layout_width="24dp"
|
android:layout_width="24dp"
|
||||||
|
|
Loading…
Reference in New Issue