diff options
author | Matthew Wong <wongma7@outlook.com> | 2016-06-12 15:46:59 -0400 |
---|---|---|
committer | Matthew Wong <wongma7@outlook.com> | 2016-06-12 15:46:59 -0400 |
commit | b4a230d07411f762753f2c5140ec88363d5be1dd (patch) | |
tree | 64ff227d8ff919d2f18c0a0f583d83dfcf65704b /app | |
parent | f739b1c56482f2683a9c2a917921c6d0654fdd2f (diff) |
fix #187
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/UserPreference.java | 32 |
1 files 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<String> selectedKeys = sharedPreferences.getStringSet("openpgp_key_ids_set", new HashSet<String>()); - if (selectedKeys.isEmpty()) { - keyPref.setSummary("No key selected"); - } else { - keyPref.setSummary( - Joiner.on(',') - .join(Iterables.transform(selectedKeys, new Function<String, Object>() { - @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<String> selectedKeys = sharedPreferences.getStringSet("openpgp_key_ids_set", new HashSet<String>()); + if (selectedKeys.isEmpty()) { + keyPref.setSummary("No key selected"); + } else { + keyPref.setSummary( + Joiner.on(',') + .join(Iterables.transform(selectedKeys, new Function<String, Object>() { + @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")) |