Show the pgp key selected in preferences

Fix #76
This commit is contained in:
Mohamed Zenadi 2015-04-04 16:17:10 +02:00
parent fca12285c4
commit 6983ef4f82
2 changed files with 21 additions and 21 deletions

View file

@ -9,7 +9,6 @@ import android.preference.Preference;
import android.preference.PreferenceFragment;
import android.preference.PreferenceManager;
import android.support.v7.app.ActionBarActivity;
import android.util.Log;
import android.view.MenuItem;
import android.widget.Toast;
@ -35,7 +34,9 @@ public class UserPreference extends ActionBarActivity implements Preference.OnPr
super.onCreate(savedInstanceState);
// Load the preferences from an XML resource
addPreferencesFromResource(R.xml.preference);
findPreference("openpgp_key_id").setOnPreferenceClickListener((UserPreference) getActivity());
Preference keyPref = findPreference("openpgp_key_id");
keyPref.setSummary(getPreferenceManager().getSharedPreferences().getString("openpgp_key_ids", "No key selected"));
keyPref.setOnPreferenceClickListener((UserPreference) getActivity());
findPreference("ssh_key").setOnPreferenceClickListener((UserPreference) getActivity());
findPreference("git_server_info").setOnPreferenceClickListener((UserPreference) getActivity());
findPreference("git_delete_repo").setOnPreferenceClickListener((UserPreference) getActivity());

View file

@ -1,27 +1,8 @@
package com.zeapo.pwdstore.crypto;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.text.ParseException;
import java.util.ArrayList;
import org.apache.commons.io.FileUtils;
import org.eclipse.jgit.util.StringUtils;
import org.openintents.openpgp.IOpenPgpService;
import org.openintents.openpgp.OpenPgpError;
import org.openintents.openpgp.util.OpenPgpApi;
import org.openintents.openpgp.util.OpenPgpServiceConnection;
import org.openintents.openpgp.util.OpenPgpUtils;
import android.app.ActionBar;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.PendingIntent;
import android.app.ProgressDialog;
import android.content.ClipData;
import android.content.ClipboardManager;
import android.content.DialogInterface;
@ -48,6 +29,22 @@ import com.zeapo.pwdstore.R;
import com.zeapo.pwdstore.UserPreference;
import com.zeapo.pwdstore.utils.PasswordRepository;
import org.apache.commons.io.FileUtils;
import org.eclipse.jgit.util.StringUtils;
import org.openintents.openpgp.IOpenPgpService;
import org.openintents.openpgp.OpenPgpError;
import org.openintents.openpgp.util.OpenPgpApi;
import org.openintents.openpgp.util.OpenPgpServiceConnection;
import org.openintents.openpgp.util.OpenPgpUtils;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
public class PgpHandler extends ActionBarActivity implements OpenPgpServiceConnection.OnBound{
@ -378,6 +375,8 @@ public class PgpHandler extends ActionBarActivity implements OpenPgpServiceConne
// ((TextView) findViewById(R.id.crypto_key_ids)).setText(mKeys);
settings.edit().putString("openpgp_key_ids", keyIDs).apply();
}
showToast("PGP key selected");
setResult(RESULT_OK);
finish();
}