Merge pull request #8790 from osmandapp/Fix_profile_appearance_scroll

Fix cursor at the end of profile name
This commit is contained in:
max-klaus 2020-04-16 11:35:58 +03:00 committed by GitHub
commit ab6edbfcba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

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