Merge "Update the required or optional styles of EditText in VPN settings" into main
This commit is contained in:
committed by
Android (Google) Code Review
commit
838cc2526c
@@ -76,7 +76,6 @@ class ConfigDialog extends AlertDialog implements TextWatcher,
|
||||
private TextInputGroup mServerInput;
|
||||
private TextInputGroup mUsernameInput;
|
||||
private TextInputGroup mPasswordInput;
|
||||
private TextView mPassword;
|
||||
private Spinner mProxySettings;
|
||||
private TextView mProxyHost;
|
||||
private TextView mProxyPort;
|
||||
@@ -211,8 +210,10 @@ class ConfigDialog extends AlertDialog implements TextWatcher,
|
||||
setTitle(context.getString(R.string.vpn_connect_to, mProfile.name));
|
||||
|
||||
setUsernamePasswordVisibility(mProfile.type);
|
||||
mUsernameInput.setHelperText(context.getString(R.string.vpn_required));
|
||||
mPasswordInput.setHelperText(context.getString(R.string.vpn_required));
|
||||
mUsernameInput.setLabel(context.getString(R.string.vpn_username_required));
|
||||
mUsernameInput.setHelperText(context.getString(R.string.vpn_field_required));
|
||||
mPasswordInput.setLabel(context.getString(R.string.vpn_password_required));
|
||||
mPasswordInput.setHelperText(context.getString(R.string.vpn_field_required));
|
||||
|
||||
// Create a button to connect the network.
|
||||
setButton(DialogInterface.BUTTON_POSITIVE,
|
||||
|
||||
@@ -59,6 +59,12 @@ open class TextInputGroup(
|
||||
editText.addTextChangedListener(watcher)
|
||||
}
|
||||
|
||||
var label: String
|
||||
get() = layout.hint?.toString() ?: ""
|
||||
set(value) {
|
||||
layout.setHint(value)
|
||||
}
|
||||
|
||||
var text: String
|
||||
get() = editText.text?.toString() ?: ""
|
||||
set(value) {
|
||||
@@ -75,6 +81,7 @@ open class TextInputGroup(
|
||||
get() = layout.error?.toString() ?: ""
|
||||
set(value) {
|
||||
layout.setError(value)
|
||||
if (value.isEmpty()) layout.isErrorEnabled = false
|
||||
}
|
||||
|
||||
open fun validate(): Boolean {
|
||||
|
||||
Reference in New Issue
Block a user