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

Commit

Permalink
remove useless and confusing option from the preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
zeapo committed Dec 11, 2016
1 parent 737d281 commit 5644c06
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 28 deletions.
14 changes: 14 additions & 0 deletions app/src/main/java/com/zeapo/pwdstore/PasswordStore.java
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,20 @@ public void onClick(DialogInterface dialogInterface, int i) {
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());

Expand Down
24 changes: 0 additions & 24 deletions app/src/main/java/com/zeapo/pwdstore/UserPreference.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@

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;
Expand All @@ -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;
Expand Down Expand Up @@ -151,20 +149,6 @@ public void onClick(DialogInterface dialogInterface, int i) {
}
});

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() {
Expand Down Expand Up @@ -443,14 +427,6 @@ public void onClick(DialogInterface dialogInterface, int i) {
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: {
Expand Down
4 changes: 0 additions & 4 deletions app/src/main/res/xml/preference.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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" />
Expand Down

0 comments on commit 5644c06

Please sign in to comment.