packages/apps/Settings
Revision | 79f9fa073cf3311b552a0a055a44a26c06e395d3 (tree) |
---|---|
Zeit | 2009-08-01 11:08:03 |
Autor | Hung-ying Tyan <tyanh@goog...> |
Commiter | Hung-ying Tyan |
Reduce the number of keystore connections.
@@ -233,9 +233,10 @@ public class SecuritySettings extends PreferenceActivity implements | ||
233 | 233 | PreferenceCategory credStoreCat = new PreferenceCategory(this); |
234 | 234 | credStoreCat.setTitle(R.string.cstor_settings_category); |
235 | 235 | root.addPreference(credStoreCat); |
236 | - credStoreCat.addPreference(mCstorHelper.createAccessCheckBox()); | |
236 | + boolean i = mCstorHelper.isCstorInitialized(); | |
237 | + credStoreCat.addPreference(mCstorHelper.createAccessCheckBox(i)); | |
237 | 238 | credStoreCat.addPreference(mCstorHelper.createSetPasswordPreference()); |
238 | - credStoreCat.addPreference(mCstorHelper.createResetPreference()); | |
239 | + credStoreCat.addPreference(mCstorHelper.createResetPreference(i)); | |
239 | 240 | |
240 | 241 | return root; |
241 | 242 | } |
@@ -793,12 +794,12 @@ public class SecuritySettings extends PreferenceActivity implements | ||
793 | 794 | mResetButton.setEnabled(enabled); |
794 | 795 | } |
795 | 796 | |
796 | - private Preference createAccessCheckBox() { | |
797 | + private Preference createAccessCheckBox(boolean isInitialized) { | |
797 | 798 | CheckBoxPreference pref = new CheckBoxPreference( |
798 | 799 | SecuritySettings.this); |
799 | 800 | pref.setTitle(R.string.cstor_access_title); |
800 | 801 | pref.setSummary(R.string.cstor_access_summary); |
801 | - pref.setChecked(isCstorUnlocked()); | |
802 | + if (isInitialized) pref.setChecked(isCstorUnlocked()); | |
802 | 803 | pref.setOnPreferenceChangeListener( |
803 | 804 | new Preference.OnPreferenceChangeListener() { |
804 | 805 | public boolean onPreferenceChange( |
@@ -813,7 +814,7 @@ public class SecuritySettings extends PreferenceActivity implements | ||
813 | 814 | return true; |
814 | 815 | } |
815 | 816 | }); |
816 | - pref.setEnabled(isCstorInitialized()); | |
817 | + pref.setEnabled(isInitialized); | |
817 | 818 | mAccessCheckBox = pref; |
818 | 819 | return pref; |
819 | 820 | } |
@@ -834,7 +835,7 @@ public class SecuritySettings extends PreferenceActivity implements | ||
834 | 835 | return pref; |
835 | 836 | } |
836 | 837 | |
837 | - private Preference createResetPreference() { | |
838 | + private Preference createResetPreference(boolean isInitialized) { | |
838 | 839 | Preference pref = new Preference(SecuritySettings.this); |
839 | 840 | pref.setTitle(R.string.cstor_reset_title); |
840 | 841 | pref.setSummary(R.string.cstor_reset_summary); |
@@ -845,7 +846,7 @@ public class SecuritySettings extends PreferenceActivity implements | ||
845 | 846 | return true; |
846 | 847 | } |
847 | 848 | }); |
848 | - pref.setEnabled(isCstorInitialized()); | |
849 | + pref.setEnabled(isInitialized); | |
849 | 850 | mResetButton = pref; |
850 | 851 | return pref; |
851 | 852 | } |