Minor fixes

This commit is contained in:
Grishka 2022-12-15 20:16:32 +03:00
parent 069d141451
commit e0febda372
3 changed files with 29 additions and 6 deletions

View File

@ -9,8 +9,8 @@ android {
applicationId "org.joinmastodon.android" applicationId "org.joinmastodon.android"
minSdk 23 minSdk 23
targetSdk 33 targetSdk 33
versionCode 45 versionCode 46
versionName "1.1.4" versionName "1.1.5"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
resConfigs "ar-rSA", "be-rBY", "bn-rBD", "bs-rBA", "ca-rES", "cs-rCZ", "de-rDE", "el-rGR", "es-rES", "eu-rES", "fi-rFI", "fil-rPH", "fr-rFR", "ga-rIE", "gd-rGB", "gl-rES", "hi-rIN", "hr-rHR", "hu-rHU", "hy-rAM", "in-rID", "is-rIS", "it-rIT", "iw-rIL", "ja-rJP", "kab", "ko-rKR", "nl-rNL", "oc-rFR", "pl-rPL", "pt-rBR", "pt-rPT", "ro-rRO", "ru-rRU", "si-rLK", "sl-rSI", "sv-rSE", "th-rTH", "tr-rTR", "uk-rUA", "vi-rVN", "zh-rCN", "zh-rTW" resConfigs "ar-rSA", "be-rBY", "bn-rBD", "bs-rBA", "ca-rES", "cs-rCZ", "de-rDE", "el-rGR", "es-rES", "eu-rES", "fi-rFI", "fil-rPH", "fr-rFR", "ga-rIE", "gd-rGB", "gl-rES", "hi-rIN", "hr-rHR", "hu-rHU", "hy-rAM", "in-rID", "is-rIS", "it-rIT", "iw-rIL", "ja-rJP", "kab", "ko-rKR", "nl-rNL", "oc-rFR", "pl-rPL", "pt-rBR", "pt-rPT", "ro-rRO", "ru-rRU", "si-rLK", "sl-rSI", "sv-rSE", "th-rTH", "tr-rTR", "uk-rUA", "vi-rVN", "zh-rCN", "zh-rTW"
} }

View File

@ -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);

View File

@ -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"