From b4a230d07411f762753f2c5140ec88363d5be1dd Mon Sep 17 00:00:00 2001 From: Matthew Wong Date: Sun, 12 Jun 2016 15:46:59 -0400 Subject: [PATCH] fix #187 --- .../com/zeapo/pwdstore/UserPreference.java | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/app/src/main/java/com/zeapo/pwdstore/UserPreference.java b/app/src/main/java/com/zeapo/pwdstore/UserPreference.java index 57919624..77600b2b 100644 --- a/app/src/main/java/com/zeapo/pwdstore/UserPreference.java +++ b/app/src/main/java/com/zeapo/pwdstore/UserPreference.java @@ -58,22 +58,7 @@ public class UserPreference extends AppCompatActivity { addPreferencesFromResource(R.xml.preference); - Preference keyPref = findPreference("openpgp_key_id_pref"); - Set selectedKeys = sharedPreferences.getStringSet("openpgp_key_ids_set", new HashSet()); - if (selectedKeys.isEmpty()) { - keyPref.setSummary("No key selected"); - } else { - keyPref.setSummary( - Joiner.on(',') - .join(Iterables.transform(selectedKeys, new Function() { - @Override - public Object apply(String input) { - return OpenPgpUtils.convertKeyIdToHex(Long.valueOf(input)); - } - })) - ); - } - keyPref.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { + findPreference("openpgp_key_id_pref").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @Override public boolean onPreferenceClick(Preference preference) { Intent intent = new Intent(callingActivity, PgpHandler.class); @@ -235,6 +220,21 @@ public class UserPreference extends AppCompatActivity { findPreference("pref_select_external").setSummary(getPreferenceManager().getSharedPreferences().getString("git_external_repo", "No external repository selected")); findPreference("ssh_see_key").setEnabled(sharedPreferences.getBoolean("use_generated_key", false)); findPreference("git_delete_repo").setEnabled(!sharedPreferences.getBoolean("git_external", false)); + Preference keyPref = findPreference("openpgp_key_id_pref"); + Set selectedKeys = sharedPreferences.getStringSet("openpgp_key_ids_set", new HashSet()); + if (selectedKeys.isEmpty()) { + keyPref.setSummary("No key selected"); + } else { + keyPref.setSummary( + Joiner.on(',') + .join(Iterables.transform(selectedKeys, new Function() { + @Override + public Object apply(String input) { + return OpenPgpUtils.convertKeyIdToHex(Long.valueOf(input)); + } + })) + ); + } // see if the autofill service is enabled and check the preference accordingly ((CheckBoxPreference) findPreference("autofill_enable"))