am 7c20380e: am a3aaf19e: Fix setting passwd string and vpn checkbox titles.

Merge commit '7c20380ee1602f03e25583136825304c51fcb794'

* commit '7c20380ee1602f03e25583136825304c51fcb794':
  Fix setting passwd string and vpn checkbox titles.
This commit is contained in:
Hung-ying Tyan
2009-09-16 23:54:02 -07:00
committed by Android Git Automerger
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 --> <!-- Description for the confirm-new-password input box -->
<string name="cstor_confirm_password">Confirm new password:</string> <string name="cstor_confirm_password">Confirm new password:</string>
<!-- Description when user set up the storage for the very first time --> <!-- 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--> <!-- 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_first_time_hint_from_action">Set a password for the credential storage.</string>
<string name="cstor_password_error">Please enter the correct password.</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(); final L2tpProfile profile = (L2tpProfile) getProfile();
CheckBoxPreference secret = mSecret = new CheckBoxPreference(c); CheckBoxPreference secret = mSecret = new CheckBoxPreference(c);
boolean enabled = profile.isSecretEnabled(); boolean enabled = profile.isSecretEnabled();
setSecretTitle(secret, R.string.vpn_l2tp_secret, enabled); setCheckBoxTitle(secret, R.string.vpn_l2tp_secret);
secret.setChecked(enabled); secret.setChecked(enabled);
setSecretSummary(secret, enabled); setSecretSummary(secret, enabled);
secret.setOnPreferenceChangeListener( secret.setOnPreferenceChangeListener(
@@ -67,8 +67,6 @@ class L2tpEditor extends VpnProfileEditor {
boolean enabled = (Boolean) newValue; boolean enabled = (Boolean) newValue;
profile.setSecretEnabled(enabled); profile.setSecretEnabled(enabled);
mSecretHandler.getPreference().setEnabled(enabled); mSecretHandler.getPreference().setEnabled(enabled);
setSecretTitle(mSecret, R.string.vpn_l2tp_secret,
enabled);
setSecretSummary(mSecret, enabled); setSecretSummary(mSecret, enabled);
return true; return true;
} }

View File

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

View File

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