Fix Name field, change keyboard "New line" button to "Apply".

This commit is contained in:
Dima-1 2019-12-30 10:57:04 +02:00
parent 706f47891c
commit c63f3045a5
2 changed files with 4 additions and 1 deletions

View file

@ -21,7 +21,7 @@
android:id="@+id/profile_name_et" android:id="@+id/profile_name_et"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:inputType="text|textMultiLine|textCapSentences" android:inputType="textMultiLine"
android:scrollHorizontally="false" android:scrollHorizontally="false"
android:maxLines="4" android:maxLines="4"
tools:text="@string/lorem_ipsum" /> tools:text="@string/lorem_ipsum" />

View file

@ -15,6 +15,7 @@ import android.support.v7.app.AlertDialog;
import android.support.v7.preference.Preference; import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceViewHolder; import android.support.v7.preference.PreferenceViewHolder;
import android.text.Editable; import android.text.Editable;
import android.text.InputType;
import android.text.TextWatcher; import android.text.TextWatcher;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@ -201,6 +202,7 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (getActivity() != null) { if (getActivity() != null) {
hideKeyboard();
if (isChanged()) { if (isChanged()) {
if (saveNewProfile()) { if (saveNewProfile()) {
profile = changedProfile; profile = changedProfile;
@ -281,6 +283,7 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
if (PROFILE_NAME.equals(preference.getKey())) { if (PROFILE_NAME.equals(preference.getKey())) {
profileName = (EditText) holder.findViewById(R.id.profile_name_et); profileName = (EditText) holder.findViewById(R.id.profile_name_et);
profileName.setImeOptions(EditorInfo.IME_ACTION_DONE); profileName.setImeOptions(EditorInfo.IME_ACTION_DONE);
profileName.setRawInputType(InputType.TYPE_CLASS_TEXT);
profileName.setText(changedProfile.name); profileName.setText(changedProfile.name);
profileName.requestFocus(); profileName.requestFocus();
profileName.addTextChangedListener(new TextWatcher() { profileName.addTextChangedListener(new TextWatcher() {