From e0febda372808ec1ea8b9c4a5a5bae290d8a3ed9 Mon Sep 17 00:00:00 2001 From: Grishka Date: Thu, 15 Dec 2022 20:16:32 +0300 Subject: [PATCH] Minor fixes --- mastodon/build.gradle | 4 ++-- .../InstanceCatalogSignupFragment.java | 23 +++++++++++++++---- .../res/layout/fragment_onboarding_common.xml | 8 +++++++ 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/mastodon/build.gradle b/mastodon/build.gradle index 34056816e..1f27990b7 100644 --- a/mastodon/build.gradle +++ b/mastodon/build.gradle @@ -9,8 +9,8 @@ android { applicationId "org.joinmastodon.android" minSdk 23 targetSdk 33 - versionCode 45 - versionName "1.1.4" + versionCode 46 + versionName "1.1.5" 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" } diff --git a/mastodon/src/main/java/org/joinmastodon/android/fragments/onboarding/InstanceCatalogSignupFragment.java b/mastodon/src/main/java/org/joinmastodon/android/fragments/onboarding/InstanceCatalogSignupFragment.java index 1ddf2e46e..fd33891d0 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/fragments/onboarding/InstanceCatalogSignupFragment.java +++ b/mastodon/src/main/java/org/joinmastodon/android/fragments/onboarding/InstanceCatalogSignupFragment.java @@ -80,6 +80,7 @@ public class InstanceCatalogSignupFragment extends InstanceCatalogFragment imple private LinearLayout filtersWrap; private HorizontalScrollView filtersScroll; private ImageButton backBtn, clearSearchBtn; + private View focusThing; private FilterChipView categoryGeneral, categorySpecialInterests; private List regionalFilters; @@ -285,7 +286,13 @@ public class InstanceCatalogSignupFragment extends InstanceCatalogFragment imple FilterChipView langFilter=new FilterChipView(getActivity()); 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); langFilter.setOnTouchListener(langFilterMenu.getDragToOpenListener()); 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); speedFilter.setOnTouchListener(speedFilterMenu.getDragToOpenListener()); speedFilter.setOnClickListener(v->speedFilterMenu.show()); - speedFilter.setText(R.string.server_filter_instant_signup); - speedFilter.setSelected(true); + speedFilter.setText(switch(currentSignupSpeedFilter){ + 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)); speedFilterMenu.setOnMenuItemClickListener(item->{ @@ -328,11 +339,13 @@ public class InstanceCatalogSignupFragment extends InstanceCatalogFragment imple categoryGeneral.setText(R.string.category_general); categoryGeneral.setTag(CategoryChoice.GENERAL); categoryGeneral.setOnClickListener(this::onCategoryFilterClick); + categoryGeneral.setSelected(categoryChoice==CategoryChoice.GENERAL); filtersWrap.addView(categoryGeneral, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); categorySpecialInterests=new FilterChipView(getActivity()); categorySpecialInterests.setText(R.string.category_special_interests); categorySpecialInterests.setTag(CategoryChoice.SPECIAL); categorySpecialInterests.setOnClickListener(this::onCategoryFilterClick); + categorySpecialInterests.setSelected(categoryChoice==CategoryChoice.SPECIAL); filtersWrap.addView(categorySpecialInterests, new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); 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)); return fv; }).collect(Collectors.toList()); + focusThing=view.findViewById(R.id.focus_thing); + focusThing.requestFocus(); } private void onRegionFilterClick(View v){ @@ -550,7 +565,7 @@ public class InstanceCatalogSignupFragment extends InstanceCatalogFragment imple searchEdit.setCompoundDrawableTintList(ColorStateList.valueOf(0)); }else{ filtersScroll.setVisibility(View.VISIBLE); - searchEdit.clearFocus(); + focusThing.requestFocus(); searchEdit.setText(""); lp.addRule(RelativeLayout.END_OF, R.id.btn_back); getActivity().getSystemService(InputMethodManager.class).hideSoftInputFromWindow(searchEdit.getWindowToken(), 0); diff --git a/mastodon/src/main/res/layout/fragment_onboarding_common.xml b/mastodon/src/main/res/layout/fragment_onboarding_common.xml index a4c68577c..d3e7ef23f 100644 --- a/mastodon/src/main/res/layout/fragment_onboarding_common.xml +++ b/mastodon/src/main/res/layout/fragment_onboarding_common.xml @@ -40,6 +40,14 @@ android:backgroundTint="?colorM3SurfaceVariant" android:hint="@string/search_communities"/> + +