From 583757908bccf8283cd27e5c5981f5b248e1037f Mon Sep 17 00:00:00 2001 From: Amith Yamasani Date: Tue, 9 Apr 2013 17:26:43 -0700 Subject: [PATCH] Select text in user name dialog Enables quickly changing the name without moving the cursor. Also use cap words style. Bug: 8518507 Change-Id: I6841cad221b56bb4c3d51c21d30b3858d1ee3e1c --- res/xml/app_restrictions.xml | 2 +- .../settings/users/AppRestrictionsFragment.java | 10 ++++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/res/xml/app_restrictions.xml b/res/xml/app_restrictions.xml index df02907c8e6..c99d5e78215 100644 --- a/res/xml/app_restrictions.xml +++ b/res/xml/app_restrictions.xml @@ -18,7 +18,7 @@ android:title="@string/application_restrictions" xmlns:settings="http://schemas.android.com/apk/res/com.android.settings"> - diff --git a/src/com/android/settings/users/AppRestrictionsFragment.java b/src/com/android/settings/users/AppRestrictionsFragment.java index 6154bdfc5a6..84db9e16898 100644 --- a/src/com/android/settings/users/AppRestrictionsFragment.java +++ b/src/com/android/settings/users/AppRestrictionsFragment.java @@ -47,6 +47,7 @@ import android.preference.Preference.OnPreferenceChangeListener; import android.preference.Preference.OnPreferenceClickListener; import android.preference.PreferenceGroup; import android.preference.SwitchPreference; +import android.text.InputType; import android.text.TextUtils; import android.util.Log; import android.view.View; @@ -57,6 +58,7 @@ import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.Switch; import com.android.settings.R; +import com.android.settings.SelectableEditTextPreference; import com.android.settings.SettingsPreferenceFragment; import java.util.ArrayList; @@ -82,7 +84,7 @@ public class AppRestrictionsFragment extends SettingsPreferenceFragment implemen private UserManager mUserManager; private UserHandle mUser; - private EditTextPreference mUserPreference; + private SelectableEditTextPreference mUserPreference; private PreferenceGroup mAppList; private static final int MAX_APP_RESTRICTIONS = 100; @@ -188,8 +190,12 @@ public class AppRestrictionsFragment extends SettingsPreferenceFragment implemen mUserManager = (UserManager) getActivity().getSystemService(Context.USER_SERVICE); addPreferencesFromResource(R.xml.app_restrictions); mAppList = getPreferenceScreen(); - mUserPreference = (EditTextPreference) findPreference(KEY_USER_INFO); + mUserPreference = (SelectableEditTextPreference) findPreference(KEY_USER_INFO); mUserPreference.setOnPreferenceChangeListener(this); + mUserPreference.getEditText().setInputType( + InputType.TYPE_TEXT_VARIATION_NORMAL | InputType.TYPE_TEXT_FLAG_CAP_WORDS); + mUserPreference.setInitialSelectionMode( + SelectableEditTextPreference.SELECTION_SELECT_ALL); setHasOptionsMenu(true); }