From 5a53ca0076efd27e5585edacb6f99ac28dcf6f25 Mon Sep 17 00:00:00 2001 From: Dima-1 Date: Mon, 13 Apr 2020 11:48:58 +0300 Subject: [PATCH] Fix cursor at the end of profile name --- .../plus/settings/ProfileAppearanceFragment.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/settings/ProfileAppearanceFragment.java b/OsmAnd/src/net/osmand/plus/settings/ProfileAppearanceFragment.java index 8af4450a62..b9e724a1ae 100644 --- a/OsmAnd/src/net/osmand/plus/settings/ProfileAppearanceFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/ProfileAppearanceFragment.java @@ -268,6 +268,9 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment { super.onScrollStateChanged(recyclerView, newState); if (newState != RecyclerView.SCROLL_STATE_IDLE) { hideKeyboard(); + if (profileName != null) { + profileName.clearFocus(); + } } } }); @@ -359,13 +362,21 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment { } } }); + profileName.setOnFocusChangeListener(new View.OnFocusChangeListener() { + @Override + public void onFocusChange(View v, boolean hasFocus) { + if(hasFocus){ + profileName.setSelection(profileName.getText().length()); + AndroidUtils.showSoftKeyboard(profileName); + } + } + }); if (getSelectedAppMode().equals(ApplicationMode.DEFAULT) && !isNewProfile) { profileName.setFocusableInTouchMode(false); profileName.setFocusable(false); - } else { - profileName.requestFocus(); } profileNameOtfb = (OsmandTextFieldBoxes) holder.findViewById(R.id.profile_name_otfb); + updateProfileNameAppearance(); } else if (MASTER_PROFILE.equals(preference.getKey())) { baseProfileName = (EditText) holder.findViewById(R.id.master_profile_et); baseProfileName.setFocusable(false);