aboutsummaryrefslogtreecommitdiffstats
path: root/OpenPGP-Keychain-API/example-app/src
diff options
context:
space:
mode:
authorDominik Schürmann <dominik@dominikschuermann.de>2014-02-15 18:44:13 +0100
committerDominik Schürmann <dominik@dominikschuermann.de>2014-02-15 18:44:13 +0100
commit884aaf7e7ac24a54f54c4e714121869346b7a623 (patch)
treeeda00c934377af20ec192ee4fb02fe8574419c64 /OpenPGP-Keychain-API/example-app/src
parenta659e97a645a7874b1712d9ad4e1a7493629ed9b (diff)
downloadopen-keychain-884aaf7e7ac24a54f54c4e714121869346b7a623.tar.gz
open-keychain-884aaf7e7ac24a54f54c4e714121869346b7a623.tar.bz2
open-keychain-884aaf7e7ac24a54f54c4e714121869346b7a623.zip
save selected provider in list preference
Diffstat (limited to 'OpenPGP-Keychain-API/example-app/src')
-rw-r--r--OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/BaseActivity.java12
-rw-r--r--OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java13
-rw-r--r--OpenPGP-Keychain-API/example-app/src/main/res/xml/base_preference.xml8
3 files changed, 9 insertions, 24 deletions
diff --git a/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/BaseActivity.java b/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/BaseActivity.java
index 7e8818b5b..d37689afc 100644
--- a/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/BaseActivity.java
+++ b/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/BaseActivity.java
@@ -16,9 +16,6 @@
package org.sufficientlysecure.keychain.demo;
-import org.sufficientlysecure.keychain.demo.R;
-
-import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.preference.Preference;
@@ -27,10 +24,7 @@ import android.preference.PreferenceActivity;
import android.widget.Toast;
public class BaseActivity extends PreferenceActivity {
- private Activity mActivity;
-
private Preference mIntentDemo;
- private Preference mContentProviderDemo;
private Preference mCryptoProvider;
/**
@@ -40,14 +34,11 @@ public class BaseActivity extends PreferenceActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
- mActivity = this;
-
// load preferences from xml
addPreferencesFromResource(R.xml.base_preference);
// find preferences
mIntentDemo = (Preference) findPreference("intent_demo");
- mContentProviderDemo = (Preference) findPreference("content_provider_demo");
mCryptoProvider = (Preference) findPreference("openpgp_provider_demo");
mIntentDemo.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@@ -63,12 +54,11 @@ public class BaseActivity extends PreferenceActivity {
mCryptoProvider.setOnPreferenceClickListener(new OnPreferenceClickListener() {
@Override
public boolean onPreferenceClick(Preference preference) {
- startActivity(new Intent(mActivity, OpenPgpProviderActivity.class));
+ startActivity(new Intent(BaseActivity.this, OpenPgpProviderActivity.class));
return false;
}
});
-
}
}
diff --git a/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java b/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java
index bf3943e1c..7b1aecae9 100644
--- a/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java
+++ b/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java
@@ -35,7 +35,6 @@ import android.widget.ListAdapter;
import android.widget.TextView;
import android.widget.Toast;
-import org.openintents.openpgp.IOpenPgpService;
import org.openintents.openpgp.OpenPgpError;
import org.openintents.openpgp.util.OpenPgpApi;
import org.openintents.openpgp.util.OpenPgpConstants;
@@ -49,8 +48,6 @@ import java.util.ArrayList;
import java.util.List;
public class OpenPgpProviderActivity extends Activity {
- Activity mActivity;
-
EditText mMessage;
EditText mCiphertext;
EditText mEncryptUserIds;
@@ -59,7 +56,7 @@ public class OpenPgpProviderActivity extends Activity {
Button mSignAndEncrypt;
Button mDecryptAndVerify;
- private OpenPgpServiceConnection mCryptoServiceConnection;
+ OpenPgpServiceConnection mCryptoServiceConnection;
public static final int REQUEST_CODE_SIGN = 9910;
public static final int REQUEST_CODE_ENCRYPT = 9911;
@@ -71,16 +68,14 @@ public class OpenPgpProviderActivity extends Activity {
super.onCreate(icicle);
setContentView(R.layout.openpgp_provider);
- mActivity = this;
-
mMessage = (EditText) findViewById(R.id.crypto_provider_demo_message);
mCiphertext = (EditText) findViewById(R.id.crypto_provider_demo_ciphertext);
mEncryptUserIds = (EditText) findViewById(R.id.crypto_provider_demo_encrypt_user_id);
-
mSign = (Button) findViewById(R.id.crypto_provider_demo_sign);
mEncrypt = (Button) findViewById(R.id.crypto_provider_demo_encrypt);
mSignAndEncrypt = (Button) findViewById(R.id.crypto_provider_demo_sign_and_encrypt);
mDecryptAndVerify = (Button) findViewById(R.id.crypto_provider_demo_decrypt_and_verify);
+
mSign.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -110,11 +105,11 @@ public class OpenPgpProviderActivity extends Activity {
}
private void handleError(final OpenPgpError error) {
- mActivity.runOnUiThread(new Runnable() {
+ runOnUiThread(new Runnable() {
@Override
public void run() {
- Toast.makeText(mActivity,
+ Toast.makeText(OpenPgpProviderActivity.this,
"onError id:" + error.getErrorId() + "\n\n" + error.getMessage(),
Toast.LENGTH_LONG).show();
Log.e(Constants.TAG, "onError getErrorId:" + error.getErrorId());
diff --git a/OpenPGP-Keychain-API/example-app/src/main/res/xml/base_preference.xml b/OpenPGP-Keychain-API/example-app/src/main/res/xml/base_preference.xml
index cb76dc10f..b38e07a36 100644
--- a/OpenPGP-Keychain-API/example-app/src/main/res/xml/base_preference.xml
+++ b/OpenPGP-Keychain-API/example-app/src/main/res/xml/base_preference.xml
@@ -1,18 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
- <PreferenceCategory android:title="Intent" >
+ <PreferenceCategory android:title="OpenKeychain Intents">
<Preference
android:key="intent_demo"
android:title="Intent Demo" />
</PreferenceCategory>
- <PreferenceCategory android:title="OpenPGP Provider" >
+ <PreferenceCategory android:title="OpenPGP Provider API">
<org.openintents.openpgp.util.OpenPgpListPreference
android:key="openpgp_provider_list"
android:title="Select OpenPGP Provider!" />
<Preference
android:key="openpgp_provider_demo"
- android:title="OpenPGP Provider" />
+ android:title="OpenPGP Provider Demo" />
</PreferenceCategory>
</PreferenceScreen> \ No newline at end of file