summaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/PasswordStore.java14
-rw-r--r--app/src/main/java/com/zeapo/pwdstore/UserPreference.java24
-rw-r--r--app/src/main/res/xml/preference.xml4
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<String>()).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() {
@@ -445,14 +429,6 @@ public class UserPreference extends AppCompatActivity {
}
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: {
final Uri uri = data.getData();
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 @@
<org.openintents.openpgp.util.OpenPgpAppPreference
android:key="openpgp_provider_list"
android:title="@string/pref_provider_title" />
- <org.openintents.openpgp.util.OpenPgpKeyPreference
- android:enabled="false"
- android:key="openpgp_key"
- android:title="Select key" />
<Preference
android:key="openpgp_key_id_pref"
android:title="@string/pref_key_title" />