Skip to content
This repository was archived by the owner on Oct 15, 2024. It is now read-only.

Commit 5644c06

Browse files
committed
remove useless and confusing option from the preferences
1 parent 737d281 commit 5644c06

File tree

3 files changed

+14
-28
lines changed

3 files changed

+14
-28
lines changed

app/src/main/java/com/zeapo/pwdstore/PasswordStore.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,20 @@ public void onClick(DialogInterface dialogInterface, int i) {
415415
return;
416416
}
417417

418+
if (settings.getStringSet("openpgp_key_ids_set", new HashSet<String>()).isEmpty()) {
419+
new AlertDialog.Builder(this)
420+
.setTitle("OpenPGP key not selected")
421+
.setMessage("We will redirect you to settings. Please select your OpenPGP Key.")
422+
.setPositiveButton(this.getResources().getString(R.string.dialog_ok), new DialogInterface.OnClickListener() {
423+
@Override
424+
public void onClick(DialogInterface dialogInterface, int i) {
425+
Intent intent = new Intent(activity, UserPreference.class);
426+
startActivity(intent);
427+
}
428+
}).show();
429+
return;
430+
}
431+
418432
this.currentDir = getCurrentDir();
419433
Log.i("PWDSTR", "Adding file to : " + this.currentDir.getAbsolutePath());
420434

app/src/main/java/com/zeapo/pwdstore/UserPreference.java

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040

4141
import org.apache.commons.io.FileUtils;
4242
import org.apache.commons.io.IOUtils;
43-
import org.openintents.openpgp.util.OpenPgpKeyPreference;
4443
import org.openintents.openpgp.util.OpenPgpUtils;
4544

4645
import java.io.File;
@@ -54,7 +53,6 @@ public class UserPreference extends AppCompatActivity {
5453
private final static int IMPORT_SSH_KEY = 1;
5554
private final static int IMPORT_PGP_KEY = 2;
5655
private final static int EDIT_GIT_INFO = 3;
57-
private OpenPgpKeyPreference mKey;
5856
private final static int SELECT_GIT_DIRECTORY = 4;
5957
private final static int REQUEST_EXTERNAL_STORAGE = 50;
6058
private PrefsFragment prefsFragment;
@@ -151,20 +149,6 @@ public void onClick(DialogInterface dialogInterface, int i) {
151149
}
152150
});
153151

154-
callingActivity.mKey = (OpenPgpKeyPreference) findPreference("openpgp_key");
155-
156-
if (sharedPreferences.getString("openpgp_provider_list", null) != null) {
157-
((UserPreference) getActivity()).mKey.setOpenPgpProvider(sharedPreferences.getString("openpgp_provider_list", ""));
158-
}
159-
160-
findPreference("openpgp_provider_list").setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
161-
@Override
162-
public boolean onPreferenceChange(Preference preference, Object o) {
163-
callingActivity.mKey.setOpenPgpProvider((String) o);
164-
return true;
165-
}
166-
});
167-
168152
final Preference externalRepo = findPreference("pref_select_external");
169153
externalRepo.setSummary(getPreferenceManager().getSharedPreferences().getString("git_external_repo", callingActivity.getString(R.string.no_repo_selected)));
170154
externalRepo.setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
@@ -443,14 +427,6 @@ public void onClick(DialogInterface dialogInterface, int i) {
443427
break;
444428
case EDIT_GIT_INFO: {
445429

446-
}
447-
break;
448-
case OpenPgpKeyPreference.REQUEST_CODE_KEY_PREFERENCE: {
449-
if (mKey.handleOnActivityResult(requestCode, resultCode, data)) {
450-
// handled by OpenPgpKeyPreference
451-
PreferenceManager.getDefaultSharedPreferences(this.getApplicationContext()).edit().putLong("openpgp_sign_key", mKey.getValue()).apply();
452-
return;
453-
}
454430
}
455431
break;
456432
case SELECT_GIT_DIRECTORY: {

app/src/main/res/xml/preference.xml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,6 @@
3131
<org.openintents.openpgp.util.OpenPgpAppPreference
3232
android:key="openpgp_provider_list"
3333
android:title="@string/pref_provider_title" />
34-
<org.openintents.openpgp.util.OpenPgpKeyPreference
35-
android:enabled="false"
36-
android:key="openpgp_key"
37-
android:title="Select key" />
3834
<Preference
3935
android:key="openpgp_key_id_pref"
4036
android:title="@string/pref_key_title" />

0 commit comments

Comments
 (0)