Fix setting passwd string and vpn checkbox titles.

* Add min length requirement in setting passwd string.
* Do not change vpn checkbox title with state changes.
This commit is contained in:
Hung-ying Tyan
2009-09-12 01:31:11 +08:00
parent 5f23cb39a1
commit a3aaf19e09
4 changed files with 5 additions and 12 deletions

View File

@@ -2057,7 +2057,7 @@ found in the list of installed applications.</string>
<!-- Description for the confirm-new-password input box -->
<string name="cstor_confirm_password">Confirm new password:</string>
<!-- Description when user set up the storage for the very first time -->
<string name="cstor_first_time_hint">Set a password for the credential storage.</string>
<string name="cstor_first_time_hint">Set a password for the credential storage (at least 8 characters).</string>
<!-- Description when user set up the storage for the very first time from an action that requires the credential storage-->
<string name="cstor_first_time_hint_from_action">Set a password for the credential storage.</string>
<string name="cstor_password_error">Please enter the correct password.</string>

View File

@@ -57,7 +57,7 @@ class L2tpEditor extends VpnProfileEditor {
final L2tpProfile profile = (L2tpProfile) getProfile();
CheckBoxPreference secret = mSecret = new CheckBoxPreference(c);
boolean enabled = profile.isSecretEnabled();
setSecretTitle(secret, R.string.vpn_l2tp_secret, enabled);
setCheckBoxTitle(secret, R.string.vpn_l2tp_secret);
secret.setChecked(enabled);
setSecretSummary(secret, enabled);
secret.setOnPreferenceChangeListener(
@@ -67,8 +67,6 @@ class L2tpEditor extends VpnProfileEditor {
boolean enabled = (Boolean) newValue;
profile.setSecretEnabled(enabled);
mSecretHandler.getPreference().setEnabled(enabled);
setSecretTitle(mSecret, R.string.vpn_l2tp_secret,
enabled);
setSecretSummary(mSecret, enabled);
return true;
}

View File

@@ -45,7 +45,7 @@ class PptpEditor extends VpnProfileEditor {
final PptpProfile profile = (PptpProfile) getProfile();
CheckBoxPreference encryption = mEncryption = new CheckBoxPreference(c);
boolean enabled = profile.isEncryptionEnabled();
setSecretTitle(encryption, R.string.vpn_pptp_encryption_title, enabled);
setCheckBoxTitle(encryption, R.string.vpn_pptp_encryption_title);
encryption.setChecked(enabled);
setEncryptionSummary(encryption, enabled);
encryption.setOnPreferenceChangeListener(
@@ -54,8 +54,6 @@ class PptpEditor extends VpnProfileEditor {
Preference pref, Object newValue) {
boolean enabled = (Boolean) newValue;
profile.setEncryptionEnabled(enabled);
setSecretTitle(mEncryption,
R.string.vpn_pptp_encryption_title, enabled);
setEncryptionSummary(mEncryption, enabled);
return true;
}

View File

@@ -174,12 +174,9 @@ class VpnProfileEditor {
: v);
}
protected void setSecretTitle(
CheckBoxPreference pref, int fieldNameId, boolean enabled) {
protected void setCheckBoxTitle(CheckBoxPreference pref, int fieldNameId) {
Context c = pref.getContext();
String formatString = enabled
? c.getString(R.string.vpn_disable_field)
: c.getString(R.string.vpn_enable_field);
String formatString = c.getString(R.string.vpn_enable_field);
pref.setTitle(String.format(formatString, c.getString(fieldNameId)));
}