diff options
author | Mohamed Zenadi <mohamed@zenadi.com> | 2015-06-17 21:04:14 +0200 |
---|---|---|
committer | Mohamed Zenadi <mohamed@zenadi.com> | 2015-06-17 21:04:14 +0200 |
commit | bfdccf4d920f5172a3d88ac0358e0b06ad5fe520 (patch) | |
tree | f5c79cd8a87609eaf3b187bc1d122324133d06cf /app | |
parent | 05cfe6f7170dd88680dda87e0171cab95f243014 (diff) |
fix bug where key ids were not shown in settings
fixes #95
Diffstat (limited to 'app')
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/UserPreference.java | 10 |
1 files 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<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(Arrays.asList(selectedKeys.split(",")), new Function<String, Object>() { + .join(Iterables.transform(selectedKeys, new Function<String, Object>() { @Override public Object apply(String input) { return OpenPgpUtils.convertKeyIdToHex(Long.valueOf(input)); |