From bfdccf4d920f5172a3d88ac0358e0b06ad5fe520 Mon Sep 17 00:00:00 2001 From: Mohamed Zenadi Date: Wed, 17 Jun 2015 21:04:14 +0200 Subject: [PATCH] fix bug where key ids were not shown in settings fixes #95 --- .../main/java/com/zeapo/pwdstore/UserPreference.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/zeapo/pwdstore/UserPreference.java b/app/src/main/java/com/zeapo/pwdstore/UserPreference.java index 437333ac..ff6f5048 100644 --- a/app/src/main/java/com/zeapo/pwdstore/UserPreference.java +++ b/app/src/main/java/com/zeapo/pwdstore/UserPreference.java @@ -15,7 +15,6 @@ import android.widget.Toast; import com.google.common.base.Function; import com.google.common.base.Joiner; -import com.google.common.base.Strings; import com.google.common.collect.Iterables; import com.zeapo.pwdstore.crypto.PgpHandler; import com.zeapo.pwdstore.git.GitActivity; @@ -31,7 +30,8 @@ import org.openintents.openpgp.util.OpenPgpUtils; import java.io.File; import java.io.IOException; import java.io.InputStream; -import java.util.Arrays; +import java.util.HashSet; +import java.util.Set; public class UserPreference extends AppCompatActivity { private final static int IMPORT_SSH_KEY = 1; @@ -50,13 +50,13 @@ public class UserPreference extends AppCompatActivity { addPreferencesFromResource(R.xml.preference); Preference keyPref = findPreference("openpgp_key_id_pref"); - String selectedKeys = sharedPreferences.getString("openpgp_key_ids", ""); - if (Strings.isNullOrEmpty(selectedKeys)) { + 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(Arrays.asList(selectedKeys.split(",")), new Function() { + .join(Iterables.transform(selectedKeys, new Function() { @Override public Object apply(String input) { return OpenPgpUtils.convertKeyIdToHex(Long.valueOf(input));