diff options
Diffstat (limited to 'src/com/android/settings/profiles')
-rw-r--r-- | src/com/android/settings/profiles/SetupActionsFragment.java | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/com/android/settings/profiles/SetupActionsFragment.java b/src/com/android/settings/profiles/SetupActionsFragment.java index 485981a..7203b48 100644 --- a/src/com/android/settings/profiles/SetupActionsFragment.java +++ b/src/com/android/settings/profiles/SetupActionsFragment.java @@ -42,6 +42,9 @@ import android.os.Bundle; import android.provider.Settings; import android.telecom.TelecomManager; import android.telephony.TelephonyManager; +import android.text.Editable; +import android.text.TextUtils; +import android.text.TextWatcher; import android.util.Log; import android.view.LayoutInflater; import android.view.Menu; @@ -50,6 +53,7 @@ import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.AdapterView; +import android.widget.Button; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.EditText; @@ -702,7 +706,7 @@ public class SetupActionsFragment extends SettingsPreferenceFragment entry.setText(mProfile.getName()); entry.setSelectAllOnFocus(true); - new AlertDialog.Builder(getActivity()) + final AlertDialog alertDialog = new AlertDialog.Builder(getActivity()) .setTitle(R.string.rename_dialog_title) .setView(dialogView) .setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { @@ -715,7 +719,27 @@ public class SetupActionsFragment extends SettingsPreferenceFragment } }) .setNegativeButton(android.R.string.cancel, null) - .show(); + .create(); + + entry.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + + } + + @Override + public void afterTextChanged(Editable s) { + final boolean empty = TextUtils.isEmpty(s.toString()); + alertDialog.getButton(AlertDialog.BUTTON_POSITIVE).setEnabled(!empty); + } + }); + + alertDialog.show(); } @Override |