mirror of
https://github.com/moparisthebest/open-keychain
synced 2024-11-27 11:12:15 -05:00
rename intent helper
This commit is contained in:
parent
ec2ca61b65
commit
154849b591
@ -28,7 +28,7 @@ import android.provider.MediaStore;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
import org.sufficientlysecure.keychain.api.KeychainIntents;
|
import org.sufficientlysecure.keychain.api.OpenKeychainIntents;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
|
||||||
@ -68,8 +68,8 @@ public class IntentActivity extends PreferenceActivity {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
try {
|
try {
|
||||||
Intent intent = new Intent(KeychainIntents.ENCRYPT);
|
Intent intent = new Intent(OpenKeychainIntents.ENCRYPT);
|
||||||
intent.putExtra(KeychainIntents.ENCRYPT_EXTRA_TEXT, "Hello world!");
|
intent.putExtra(OpenKeychainIntents.ENCRYPT_EXTRA_TEXT, "Hello world!");
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
} catch (ActivityNotFoundException e) {
|
} catch (ActivityNotFoundException e) {
|
||||||
Toast.makeText(IntentActivity.this, "Activity not found!", Toast.LENGTH_LONG).show();
|
Toast.makeText(IntentActivity.this, "Activity not found!", Toast.LENGTH_LONG).show();
|
||||||
@ -94,8 +94,8 @@ public class IntentActivity extends PreferenceActivity {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
try {
|
try {
|
||||||
Intent intent = new Intent(KeychainIntents.DECRYPT);
|
Intent intent = new Intent(OpenKeychainIntents.DECRYPT);
|
||||||
intent.putExtra(KeychainIntents.DECRYPT_EXTRA_TEXT, TEST_SIGNED_MESSAGE);
|
intent.putExtra(OpenKeychainIntents.DECRYPT_EXTRA_TEXT, TEST_SIGNED_MESSAGE);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
} catch (ActivityNotFoundException e) {
|
} catch (ActivityNotFoundException e) {
|
||||||
Toast.makeText(IntentActivity.this, "Activity not found!", Toast.LENGTH_LONG).show();
|
Toast.makeText(IntentActivity.this, "Activity not found!", Toast.LENGTH_LONG).show();
|
||||||
@ -109,14 +109,14 @@ public class IntentActivity extends PreferenceActivity {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
try {
|
try {
|
||||||
Intent intent = new Intent(KeychainIntents.IMPORT_KEY);
|
Intent intent = new Intent(OpenKeychainIntents.IMPORT_KEY);
|
||||||
byte[] pubkey = null;
|
byte[] pubkey = null;
|
||||||
try {
|
try {
|
||||||
pubkey = TEST_PUBKEY.getBytes("UTF-8");
|
pubkey = TEST_PUBKEY.getBytes("UTF-8");
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
intent.putExtra(KeychainIntents.IMPORT_KEY_EXTRA_KEY_BYTES, pubkey);
|
intent.putExtra(OpenKeychainIntents.IMPORT_KEY_EXTRA_KEY_BYTES, pubkey);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
} catch (ActivityNotFoundException e) {
|
} catch (ActivityNotFoundException e) {
|
||||||
Toast.makeText(IntentActivity.this, "Activity not found!", Toast.LENGTH_LONG).show();
|
Toast.makeText(IntentActivity.this, "Activity not found!", Toast.LENGTH_LONG).show();
|
||||||
@ -130,8 +130,8 @@ public class IntentActivity extends PreferenceActivity {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
try {
|
try {
|
||||||
Intent intent = new Intent(KeychainIntents.IMPORT_KEY_FROM_KEYSERVER);
|
Intent intent = new Intent(OpenKeychainIntents.IMPORT_KEY_FROM_KEYSERVER);
|
||||||
intent.putExtra(KeychainIntents.IMPORT_KEY_FROM_KEYSERVER_QUERY, "Richard Stallman");
|
intent.putExtra(OpenKeychainIntents.IMPORT_KEY_FROM_KEYSERVER_QUERY, "Richard Stallman");
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
} catch (ActivityNotFoundException e) {
|
} catch (ActivityNotFoundException e) {
|
||||||
Toast.makeText(IntentActivity.this, "Activity not found!", Toast.LENGTH_LONG).show();
|
Toast.makeText(IntentActivity.this, "Activity not found!", Toast.LENGTH_LONG).show();
|
||||||
@ -145,7 +145,7 @@ public class IntentActivity extends PreferenceActivity {
|
|||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
try {
|
try {
|
||||||
Intent intent = new Intent(KeychainIntents.IMPORT_KEY_FROM_QR_CODE);
|
Intent intent = new Intent(OpenKeychainIntents.IMPORT_KEY_FROM_QR_CODE);
|
||||||
startActivity(intent);
|
startActivity(intent);
|
||||||
} catch (ActivityNotFoundException e) {
|
} catch (ActivityNotFoundException e) {
|
||||||
Toast.makeText(IntentActivity.this, "Activity not found!", Toast.LENGTH_LONG).show();
|
Toast.makeText(IntentActivity.this, "Activity not found!", Toast.LENGTH_LONG).show();
|
||||||
@ -195,7 +195,7 @@ public class IntentActivity extends PreferenceActivity {
|
|||||||
Log.d(Constants.TAG, "filePath: " + filePath);
|
Log.d(Constants.TAG, "filePath: " + filePath);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Intent intent = new Intent(KeychainIntents.ENCRYPT);
|
Intent intent = new Intent(OpenKeychainIntents.ENCRYPT);
|
||||||
Uri dataUri = Uri.parse("file://" + filePath);
|
Uri dataUri = Uri.parse("file://" + filePath);
|
||||||
Log.d(Constants.TAG, "Uri: " + dataUri);
|
Log.d(Constants.TAG, "Uri: " + dataUri);
|
||||||
intent.setData(dataUri);
|
intent.setData(dataUri);
|
||||||
|
@ -16,21 +16,21 @@
|
|||||||
|
|
||||||
package org.sufficientlysecure.keychain.api;
|
package org.sufficientlysecure.keychain.api;
|
||||||
|
|
||||||
public class KeychainIntents {
|
public class OpenKeychainIntents {
|
||||||
|
|
||||||
public static final String ENCRYPT = "org.sufficientlysecure.keychain.action.ENCRYPT";
|
public static final String ENCRYPT = "org.sufficientlysecure.keychain.action.ENCRYPT";
|
||||||
public static final String ENCRYPT_EXTRA_TEXT = "text";
|
public static final String ENCRYPT_EXTRA_TEXT = "text"; // String
|
||||||
public static final String ENCRYPT_ASCII_ARMOR = "ascii_armor";
|
public static final String ENCRYPT_ASCII_ARMOR = "ascii_armor"; // boolean
|
||||||
|
|
||||||
public static final String DECRYPT = "org.sufficientlysecure.keychain.action.DECRYPT";
|
public static final String DECRYPT = "org.sufficientlysecure.keychain.action.DECRYPT";
|
||||||
public static final String DECRYPT_EXTRA_TEXT = "text";
|
public static final String DECRYPT_EXTRA_TEXT = "text"; // String
|
||||||
|
|
||||||
public static final String IMPORT_KEY = "org.sufficientlysecure.keychain.action.IMPORT_KEY";
|
public static final String IMPORT_KEY = "org.sufficientlysecure.keychain.action.IMPORT_KEY";
|
||||||
public static final String IMPORT_KEY_EXTRA_KEY_BYTES = "key_bytes";
|
public static final String IMPORT_KEY_EXTRA_KEY_BYTES = "key_bytes"; // byte[]
|
||||||
|
|
||||||
public static final String IMPORT_KEY_FROM_KEYSERVER = "org.sufficientlysecure.keychain.action.IMPORT_KEY_FROM_KEYSERVER";
|
public static final String IMPORT_KEY_FROM_KEYSERVER = "org.sufficientlysecure.keychain.action.IMPORT_KEY_FROM_KEYSERVER";
|
||||||
public static final String IMPORT_KEY_FROM_KEYSERVER_QUERY = "query";
|
public static final String IMPORT_KEY_FROM_KEYSERVER_QUERY = "query"; // String
|
||||||
public static final String IMPORT_KEY_FROM_KEYSERVER_FINGERPRINT = "fingerprint";
|
public static final String IMPORT_KEY_FROM_KEYSERVER_FINGERPRINT = "fingerprint"; // String
|
||||||
|
|
||||||
public static final String IMPORT_KEY_FROM_QR_CODE = "org.sufficientlysecure.keychain.action.IMPORT_KEY_FROM_QR_CODE";
|
public static final String IMPORT_KEY_FROM_QR_CODE = "org.sufficientlysecure.keychain.action.IMPORT_KEY_FROM_QR_CODE";
|
||||||
|
|
@ -304,6 +304,14 @@
|
|||||||
|
|
||||||
<data android:mimeType="*/*" />
|
<data android:mimeType="*/*" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
|
<!-- IMPORT_KEY with mimeType 'application/pgp-keys' -->
|
||||||
|
<intent-filter>
|
||||||
|
<action android:name="org.sufficientlysecure.keychain.action.IMPORT_KEY" />
|
||||||
|
|
||||||
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
|
<!-- mime type as defined in http://tools.ietf.org/html/rfc3156, section 7 -->
|
||||||
|
<data android:mimeType="application/pgp-keys" />
|
||||||
|
</intent-filter>
|
||||||
<!-- IMPORT_KEY without mimeType to allow import with extras Bundle -->
|
<!-- IMPORT_KEY without mimeType to allow import with extras Bundle -->
|
||||||
<intent-filter android:label="@string/intent_import_key">
|
<intent-filter android:label="@string/intent_import_key">
|
||||||
<action android:name="org.sufficientlysecure.keychain.action.IMPORT_KEY" />
|
<action android:name="org.sufficientlysecure.keychain.action.IMPORT_KEY" />
|
||||||
|
@ -16,21 +16,21 @@
|
|||||||
|
|
||||||
package org.sufficientlysecure.keychain.api;
|
package org.sufficientlysecure.keychain.api;
|
||||||
|
|
||||||
public class KeychainIntents {
|
public class OpenKeychainIntents {
|
||||||
|
|
||||||
public static final String ENCRYPT = "org.sufficientlysecure.keychain.action.ENCRYPT";
|
public static final String ENCRYPT = "org.sufficientlysecure.keychain.action.ENCRYPT";
|
||||||
public static final String ENCRYPT_EXTRA_TEXT = "text";
|
public static final String ENCRYPT_EXTRA_TEXT = "text"; // String
|
||||||
public static final String ENCRYPT_ASCII_ARMOR = "ascii_armor";
|
public static final String ENCRYPT_ASCII_ARMOR = "ascii_armor"; // boolean
|
||||||
|
|
||||||
public static final String DECRYPT = "org.sufficientlysecure.keychain.action.DECRYPT";
|
public static final String DECRYPT = "org.sufficientlysecure.keychain.action.DECRYPT";
|
||||||
public static final String DECRYPT_EXTRA_TEXT = "text";
|
public static final String DECRYPT_EXTRA_TEXT = "text"; // String
|
||||||
|
|
||||||
public static final String IMPORT_KEY = "org.sufficientlysecure.keychain.action.IMPORT_KEY";
|
public static final String IMPORT_KEY = "org.sufficientlysecure.keychain.action.IMPORT_KEY";
|
||||||
public static final String IMPORT_KEY_EXTRA_KEY_BYTES = "key_bytes";
|
public static final String IMPORT_KEY_EXTRA_KEY_BYTES = "key_bytes"; // byte[]
|
||||||
|
|
||||||
public static final String IMPORT_KEY_FROM_KEYSERVER = "org.sufficientlysecure.keychain.action.IMPORT_KEY_FROM_KEYSERVER";
|
public static final String IMPORT_KEY_FROM_KEYSERVER = "org.sufficientlysecure.keychain.action.IMPORT_KEY_FROM_KEYSERVER";
|
||||||
public static final String IMPORT_KEY_FROM_KEYSERVER_QUERY = "query";
|
public static final String IMPORT_KEY_FROM_KEYSERVER_QUERY = "query"; // String
|
||||||
public static final String IMPORT_KEY_FROM_KEYSERVER_FINGERPRINT = "fingerprint";
|
public static final String IMPORT_KEY_FROM_KEYSERVER_FINGERPRINT = "fingerprint"; // String
|
||||||
|
|
||||||
public static final String IMPORT_KEY_FROM_QR_CODE = "org.sufficientlysecure.keychain.action.IMPORT_KEY_FROM_QR_CODE";
|
public static final String IMPORT_KEY_FROM_QR_CODE = "org.sufficientlysecure.keychain.action.IMPORT_KEY_FROM_QR_CODE";
|
||||||
|
|
Loading…
Reference in New Issue
Block a user