From 5644c06f2a51bf495ceaab2a27b0482436093c31 Mon Sep 17 00:00:00 2001 From: Mohamed Zenadi Date: Sun, 11 Dec 2016 17:32:53 +0100 Subject: remove useless and confusing option from the preferences --- .../java/com/zeapo/pwdstore/PasswordStore.java | 14 +++++++++++++ .../java/com/zeapo/pwdstore/UserPreference.java | 24 ---------------------- app/src/main/res/xml/preference.xml | 4 ---- 3 files changed, 14 insertions(+), 28 deletions(-) diff --git a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java index 3f6d225e..6449ca65 100644 --- a/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java +++ b/app/src/main/java/com/zeapo/pwdstore/PasswordStore.java @@ -415,6 +415,20 @@ public class PasswordStore extends AppCompatActivity { return; } + if (settings.getStringSet("openpgp_key_ids_set", new HashSet()).isEmpty()) { + new AlertDialog.Builder(this) + .setTitle("OpenPGP key not selected") + .setMessage("We will redirect you to settings. Please select your OpenPGP Key.") + .setPositiveButton(this.getResources().getString(R.string.dialog_ok), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialogInterface, int i) { + Intent intent = new Intent(activity, UserPreference.class); + startActivity(intent); + } + }).show(); + return; + } + this.currentDir = getCurrentDir(); Log.i("PWDSTR", "Adding file to : " + this.currentDir.getAbsolutePath()); diff --git a/app/src/main/java/com/zeapo/pwdstore/UserPreference.java b/app/src/main/java/com/zeapo/pwdstore/UserPreference.java index 8a38de1b..8c612771 100644 --- a/app/src/main/java/com/zeapo/pwdstore/UserPreference.java +++ b/app/src/main/java/com/zeapo/pwdstore/UserPreference.java @@ -40,7 +40,6 @@ import com.zeapo.pwdstore.utils.PasswordRepository; import org.apache.commons.io.FileUtils; import org.apache.commons.io.IOUtils; -import org.openintents.openpgp.util.OpenPgpKeyPreference; import org.openintents.openpgp.util.OpenPgpUtils; import java.io.File; @@ -54,7 +53,6 @@ public class UserPreference extends AppCompatActivity { private final static int IMPORT_SSH_KEY = 1; private final static int IMPORT_PGP_KEY = 2; private final static int EDIT_GIT_INFO = 3; - private OpenPgpKeyPreference mKey; private final static int SELECT_GIT_DIRECTORY = 4; private final static int REQUEST_EXTERNAL_STORAGE = 50; private PrefsFragment prefsFragment; @@ -151,20 +149,6 @@ public class UserPreference extends AppCompatActivity { } }); - callingActivity.mKey = (OpenPgpKeyPreference) findPreference("openpgp_key"); - - if (sharedPreferences.getString("openpgp_provider_list", null) != null) { - ((UserPreference) getActivity()).mKey.setOpenPgpProvider(sharedPreferences.getString("openpgp_provider_list", "")); - } - - findPreference("openpgp_provider_list").setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { - @Override - public boolean onPreferenceChange(Preference preference, Object o) { - callingActivity.mKey.setOpenPgpProvider((String) o); - return true; - } - }); - final Preference externalRepo = findPreference("pref_select_external"); externalRepo.setSummary(getPreferenceManager().getSharedPreferences().getString("git_external_repo", callingActivity.getString(R.string.no_repo_selected))); externalRepo.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { @@ -443,14 +427,6 @@ public class UserPreference extends AppCompatActivity { break; case EDIT_GIT_INFO: { - } - break; - case OpenPgpKeyPreference.REQUEST_CODE_KEY_PREFERENCE: { - if (mKey.handleOnActivityResult(requestCode, resultCode, data)) { - // handled by OpenPgpKeyPreference - PreferenceManager.getDefaultSharedPreferences(this.getApplicationContext()).edit().putLong("openpgp_sign_key", mKey.getValue()).apply(); - return; - } } break; case SELECT_GIT_DIRECTORY: { diff --git a/app/src/main/res/xml/preference.xml b/app/src/main/res/xml/preference.xml index f99bcb95..b605058c 100644 --- a/app/src/main/res/xml/preference.xml +++ b/app/src/main/res/xml/preference.xml @@ -31,10 +31,6 @@ - -- cgit v1.2.3