diff options
Diffstat (limited to 'OpenKeychain/src')
17 files changed, 493 insertions, 250 deletions
diff --git a/OpenKeychain/src/main/AndroidManifest.xml b/OpenKeychain/src/main/AndroidManifest.xml index f1bfbd9b0..bc6912f38 100644 --- a/OpenKeychain/src/main/AndroidManifest.xml +++ b/OpenKeychain/src/main/AndroidManifest.xml @@ -108,7 +108,7 @@ android:configChanges="orientation|screenSize|keyboardHidden|keyboard" android:label="@string/title_edit_key" /> <activity - android:name=".ui.QrCodeActivity" + android:name=".ui.QrCodeViewActivity" android:configChanges="orientation|screenSize|keyboardHidden|keyboard" android:label="@string/share_qr_code_dialog_title" /> <activity @@ -441,10 +441,10 @@ android:value=".ui.KeyListActivity" /> </activity> <activity - android:name=".ui.ImportKeysActivity" + android:name=".ui.QrCodeScanActivity" android:configChanges="orientation|screenSize|keyboardHidden|keyboard" - android:label="@string/title_import_keys" - android:launchMode="singleTop" + android:label="@string/app_name" + android:theme="@android:style/Theme.NoDisplay" android:windowSoftInputMode="stateHidden"> <!-- VIEW with fingerprint scheme: @@ -462,6 +462,21 @@ <data android:scheme="OpenPGP4Fpr" /> <data android:scheme="OpenPGP4fpr" /> </intent-filter> + <!-- IMPORT_KEY without mimeType to allow import with extras Bundle --> + <intent-filter android:label="@string/intent_import_key"> + <action android:name="org.sufficientlysecure.keychain.action.IMPORT_KEY_FROM_QR_CODE" /> + + <category android:name="android.intent.category.DEFAULT" /> + </intent-filter> + </activity> + + <activity + android:name=".ui.ImportKeysActivity" + android:configChanges="orientation|screenSize|keyboardHidden|keyboard" + android:label="@string/title_import_keys" + android:launchMode="singleTop" + android:windowSoftInputMode="stateHidden"> + <!-- VIEW with mimeType: Allows to import keys (attached to emails) from email apps --> <intent-filter android:label="@string/intent_import_key"> <action android:name="android.intent.action.VIEW" /> @@ -625,7 +640,6 @@ <!-- IMPORT_KEY without mimeType to allow import with extras Bundle --> <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_FROM_QR_CODE" /> <action android:name="org.sufficientlysecure.keychain.action.IMPORT_KEY_FROM_KEYSERVER" /> <category android:name="android.intent.category.DEFAULT" /> diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java index ec9509768..cacceb5d0 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/KeychainApplication.java @@ -23,6 +23,7 @@ import android.app.Application; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; +import android.content.res.Resources; import android.graphics.PorterDuff; import android.graphics.drawable.Drawable; import android.os.Build; @@ -139,16 +140,20 @@ public class KeychainApplication extends Application { } static void brandGlowEffect(Context context, int brandColor) { - // terrible hack to brand the edge overscroll glow effect - // https://gist.github.com/menny/7878762#file-brandgloweffect_full-java - - //glow - int glowDrawableId = context.getResources().getIdentifier("overscroll_glow", "drawable", "android"); - Drawable androidGlow = context.getResources().getDrawable(glowDrawableId); - androidGlow.setColorFilter(brandColor, PorterDuff.Mode.SRC_IN); - //edge - int edgeDrawableId = context.getResources().getIdentifier("overscroll_edge", "drawable", "android"); - Drawable androidEdge = context.getResources().getDrawable(edgeDrawableId); - androidEdge.setColorFilter(brandColor, PorterDuff.Mode.SRC_IN); + try { + // terrible hack to brand the edge overscroll glow effect + // https://gist.github.com/menny/7878762#file-brandgloweffect_full-java + + //glow + int glowDrawableId = context.getResources().getIdentifier("overscroll_glow", "drawable", "android"); + Drawable androidGlow = context.getResources().getDrawable(glowDrawableId); + androidGlow.setColorFilter(brandColor, PorterDuff.Mode.SRC_IN); + //edge + int edgeDrawableId = context.getResources().getIdentifier("overscroll_edge", "drawable", "android"); + Drawable androidEdge = context.getResources().getDrawable(edgeDrawableId); + androidEdge.setColorFilter(brandColor, PorterDuff.Mode.SRC_IN); + } catch (Resources.NotFoundException e) { + // no hack on Android 5 + } } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/ParcelableKeyRing.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/ParcelableKeyRing.java index 55e6be9b9..6f6c816ea 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/ParcelableKeyRing.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/ParcelableKeyRing.java @@ -21,33 +21,55 @@ package org.sufficientlysecure.keychain.keyimport; import android.os.Parcel; import android.os.Parcelable; -/** This is a trivial wrapper around keyring bytes which implements Parcelable. It exists - * for the sole purpose of keeping spongycastle and android imports in separate packages. +/** This class is a parcelable representation of either a keyring as raw data, + * or a (unique) reference to one as a fingerprint, keyid, or keybase name. */ public class ParcelableKeyRing implements Parcelable { - final byte[] mBytes; - final String mExpectedFingerprint; + public final byte[] mBytes; + + // dual role! + public final String mExpectedFingerprint; + public final String mKeyIdHex; + public final String mKeybaseName; public ParcelableKeyRing(byte[] bytes) { mBytes = bytes; mExpectedFingerprint = null; + mKeyIdHex = null; + mKeybaseName = null; } - public ParcelableKeyRing(byte[] bytes, String expectedFingerprint) { + public ParcelableKeyRing(String expectedFingerprint, byte[] bytes) { mBytes = bytes; mExpectedFingerprint = expectedFingerprint; + mKeyIdHex = null; + mKeybaseName = null; + } + public ParcelableKeyRing(String expectedFingerprint, String keyIdHex, String keybaseName) { + mBytes = null; + mExpectedFingerprint = expectedFingerprint; + mKeyIdHex = keyIdHex; + mKeybaseName = keybaseName; + } + + private ParcelableKeyRing(Parcel source) { + mBytes = source.createByteArray(); + + mExpectedFingerprint = source.readString(); + mKeyIdHex = source.readString(); + mKeybaseName = source.readString(); } public void writeToParcel(Parcel dest, int flags) { dest.writeByteArray(mBytes); dest.writeString(mExpectedFingerprint); + dest.writeString(mKeyIdHex); + dest.writeString(mKeybaseName); } public static final Creator<ParcelableKeyRing> CREATOR = new Creator<ParcelableKeyRing>() { public ParcelableKeyRing createFromParcel(final Parcel source) { - byte[] bytes = source.createByteArray(); - String expectedFingerprint = source.readString(); - return new ParcelableKeyRing(bytes, expectedFingerprint); + return new ParcelableKeyRing(source); } public ParcelableKeyRing[] newArray(final int size) { @@ -59,11 +81,4 @@ public class ParcelableKeyRing implements Parcelable { return 0; } - public byte[] getBytes() { - return mBytes; - } - - public String getExpectedFingerprint() { - return mExpectedFingerprint; - } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportExportOperation.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportExportOperation.java index 15d461006..63417057f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportExportOperation.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/ImportExportOperation.java @@ -26,6 +26,8 @@ import org.spongycastle.bcpg.ArmoredOutputStream; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.keyimport.HkpKeyserver; +import org.sufficientlysecure.keychain.keyimport.KeybaseKeyserver; +import org.sufficientlysecure.keychain.keyimport.Keyserver; import org.sufficientlysecure.keychain.keyimport.Keyserver.AddKeyException; import org.sufficientlysecure.keychain.keyimport.ParcelableKeyRing; import org.sufficientlysecure.keychain.operations.results.ExportResult; @@ -109,7 +111,7 @@ public class ImportExportOperation extends BaseOperation { } } - public ImportKeyResult importKeyRings(Iterator<ParcelableKeyRing> entries, int num) { + public ImportKeyResult importKeyRings(Iterator<ParcelableKeyRing> entries, int num, String keyServerUri) { updateProgress(R.string.progress_importing, 0, 100); OperationLog log = new OperationLog(); @@ -129,6 +131,9 @@ public class ImportExportOperation extends BaseOperation { int position = 0; double progSteps = 100.0 / num; + KeybaseKeyserver keybaseServer = null; + HkpKeyserver keyServer = null; + // iterate over all entries while (entries.hasNext()) { ParcelableKeyRing entry = entries.next(); @@ -140,13 +145,77 @@ public class ImportExportOperation extends BaseOperation { } try { - UncachedKeyRing key = UncachedKeyRing.decodeFromData(entry.getBytes()); - String expectedFp = entry.getExpectedFingerprint(); - if(expectedFp != null) { - if(!KeyFormattingUtils.convertFingerprintToHex(key.getFingerprint()).equals(expectedFp)) { + UncachedKeyRing key = null; + + // If there is already byte data, use that + if (entry.mBytes != null) { + key = UncachedKeyRing.decodeFromData(entry.mBytes); + } + // Otherwise, we need to fetch the data from a server first + else { + + // If we have a keybase name, try to fetch from there + if (entry.mKeybaseName != null) { + // Make sure we have this cached + if (keybaseServer == null) { + keybaseServer = new KeybaseKeyserver(); + } + + try { + byte[] data = keyServer.get(entry.mKeybaseName).getBytes(); + key = UncachedKeyRing.decodeFromData(data); + } catch (Keyserver.QueryFailedException e) { + // download failed, too bad. just proceed + } + + } + + // If we have a keyServerUri and a fingerprint or at least a keyId, + // download from HKP + if (keyServerUri != null + && (entry.mKeyIdHex != null || entry.mExpectedFingerprint != null)) { + // Make sure we have the keyserver instance cached + if (keyServer == null) { + keyServer = new HkpKeyserver(keyServerUri); + } + + try { + byte[] data; + // Download by fingerprint, or keyId - whichever is available + if (entry.mExpectedFingerprint != null) { + data = keyServer.get("0x" + entry.mExpectedFingerprint).getBytes(); + } else { + data = keyServer.get(entry.mKeyIdHex).getBytes(); + } + // If there already is a key (of keybase origin), merge the two + if (key != null) { + UncachedKeyRing merged = UncachedKeyRing.decodeFromData(data); + // TODO log pollution? + merged = key.merge(merged, log, 2); + // If the merge didn't fail, use the new merged key + if (merged != null) { + key = merged; + } + } else { + key = UncachedKeyRing.decodeFromData(data); + } + } catch (Keyserver.QueryFailedException e) { + break; + } + } + } + + if (key == null) { + badKeys += 1; + continue; + } + + // If we have an expected fingerprint, make sure it matches + if (entry.mExpectedFingerprint != null) { + if(!KeyFormattingUtils.convertFingerprintToHex(key.getFingerprint()).equals(entry.mExpectedFingerprint)) { Log.d(Constants.TAG, "fingerprint: " + KeyFormattingUtils.convertFingerprintToHex(key.getFingerprint())); - Log.d(Constants.TAG, "expected fingerprint: " + expectedFp); + Log.d(Constants.TAG, "expected fingerprint: " + entry.mExpectedFingerprint); Log.e(Constants.TAG, "Actual key fingerprint is not the same as expected!"); badKeys += 1; continue; @@ -155,6 +224,12 @@ public class ImportExportOperation extends BaseOperation { } } + // Another check if we have been cancelled + if (checkCancelled()) { + cancelled = true; + break; + } + SaveKeyringResult result; mProviderHelper.clearLog(); if (key.isSecret()) { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java index 3a7328d5a..9d04dec38 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/operations/results/OperationResult.java @@ -602,6 +602,8 @@ public abstract class OperationResult implements Parcelable { MSG_ACC_SAVED (LogLevel.INFO, R.string.api_settings_save_msg), + MSG_WRONG_QR_CODE (LogLevel.INFO, R.string.import_qr_code_wrong), + MSG_NO_VALID_ENC (LogLevel.ERROR, R.string.error_invalid_data), // get key diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java index baf4fe1ae..15e546f5a 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java @@ -949,8 +949,8 @@ public class ProviderHelper { if (cursor.isAfterLast()) { return false; } - ring = new ParcelableKeyRing(cursor.getBlob(0), - KeyFormattingUtils.convertFingerprintToHex(cursor.getBlob(1))); + ring = new ParcelableKeyRing(KeyFormattingUtils.convertFingerprintToHex(cursor.getBlob(1)), cursor.getBlob(0) + ); cursor.moveToNext(); return true; } @@ -1009,8 +1009,8 @@ public class ProviderHelper { if (cursor.isAfterLast()) { return false; } - ring = new ParcelableKeyRing(cursor.getBlob(0), - KeyFormattingUtils.convertFingerprintToHex(cursor.getBlob(1))); + ring = new ParcelableKeyRing(KeyFormattingUtils.convertFingerprintToHex(cursor.getBlob(1)), cursor.getBlob(0) + ); cursor.moveToNext(); return true; } @@ -1097,7 +1097,7 @@ public class ProviderHelper { ImportKeyResult result = new ImportExportOperation(mContext, this, new ProgressFixedScaler(progress, 10, 25, 100, R.string.progress_con_reimport)) - .importKeyRings(itSecrets, numSecrets); + .importKeyRings(itSecrets, numSecrets, null); log.add(result, indent); } else { log.add(LogType.MSG_CON_REIMPORT_SECRET_SKIP, indent); @@ -1124,7 +1124,7 @@ public class ProviderHelper { ImportKeyResult result = new ImportExportOperation(mContext, this, new ProgressFixedScaler(progress, 25, 99, 100, R.string.progress_con_reimport)) - .importKeyRings(itPublics, numPublics); + .importKeyRings(itPublics, numPublics, null); log.add(result, indent); } else { log.add(LogType.MSG_CON_REIMPORT_PUBLIC_SKIP, indent); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java index e4a5276d5..51a0acf7a 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java @@ -38,8 +38,6 @@ import org.sufficientlysecure.keychain.util.FileHelper; import org.sufficientlysecure.keychain.util.ParcelableFileCache.IteratorWithSize; import org.sufficientlysecure.keychain.util.Preferences; import org.sufficientlysecure.keychain.keyimport.HkpKeyserver; -import org.sufficientlysecure.keychain.keyimport.ImportKeysListEntry; -import org.sufficientlysecure.keychain.keyimport.KeybaseKeyserver; import org.sufficientlysecure.keychain.keyimport.Keyserver; import org.sufficientlysecure.keychain.keyimport.ParcelableKeyRing; import org.sufficientlysecure.keychain.pgp.CanonicalizedPublicKeyRing; @@ -99,15 +97,10 @@ public class KeychainIntentService extends IntentService implements Progressable public static final String ACTION_EDIT_KEYRING = Constants.INTENT_PREFIX + "EDIT_KEYRING"; - public static final String ACTION_DELETE_FILE_SECURELY = Constants.INTENT_PREFIX - + "DELETE_FILE_SECURELY"; - public static final String ACTION_IMPORT_KEYRING = Constants.INTENT_PREFIX + "IMPORT_KEYRING"; public static final String ACTION_EXPORT_KEYRING = Constants.INTENT_PREFIX + "EXPORT_KEYRING"; public static final String ACTION_UPLOAD_KEYRING = Constants.INTENT_PREFIX + "UPLOAD_KEYRING"; - public static final String ACTION_DOWNLOAD_AND_IMPORT_KEYS = Constants.INTENT_PREFIX + "QUERY_KEYRING"; - public static final String ACTION_IMPORT_KEYBASE_KEYS = Constants.INTENT_PREFIX + "DOWNLOAD_KEYBASE"; public static final String ACTION_CERTIFY_KEYRING = Constants.INTENT_PREFIX + "SIGN_KEYRING"; @@ -153,16 +146,13 @@ public class KeychainIntentService extends IntentService implements Progressable public static final String EDIT_KEYRING_PARCEL = "save_parcel"; public static final String EDIT_KEYRING_PASSPHRASE = "passphrase"; - // delete file securely - public static final String DELETE_FILE = "deleteFile"; - // delete keyring(s) public static final String DELETE_KEY_LIST = "delete_list"; public static final String DELETE_IS_SECRET = "delete_is_secret"; // import key public static final String IMPORT_KEY_LIST = "import_key_list"; - public static final String IMPORT_KEY_FILE = "import_key_file"; + public static final String IMPORT_KEY_SERVER = "import_key_server"; // export key public static final String EXPORT_OUTPUT_STREAM = "export_output_stream"; @@ -175,10 +165,6 @@ public class KeychainIntentService extends IntentService implements Progressable // upload key public static final String UPLOAD_KEY_SERVER = "upload_key_server"; - // query key - public static final String DOWNLOAD_KEY_SERVER = "query_key_server"; - public static final String DOWNLOAD_KEY_LIST = "query_key_id"; - // certify key public static final String CERTIFY_PARCEL = "certify_parcel"; @@ -358,65 +344,6 @@ public class KeychainIntentService extends IntentService implements Progressable // Result sendMessageToHandler(KeychainIntentServiceHandler.MESSAGE_OKAY, result); - } else if (ACTION_DOWNLOAD_AND_IMPORT_KEYS.equals(action) || ACTION_IMPORT_KEYBASE_KEYS.equals(action)) { - - ArrayList<ImportKeysListEntry> entries = data.getParcelableArrayList(DOWNLOAD_KEY_LIST); - - // this downloads the keys and places them into the ImportKeysListEntry entries - String keyServer = data.getString(DOWNLOAD_KEY_SERVER); - - ArrayList<ParcelableKeyRing> keyRings = new ArrayList<ParcelableKeyRing>(entries.size()); - for (ImportKeysListEntry entry : entries) { - try { - Keyserver server; - ArrayList<String> origins = entry.getOrigins(); - if (origins == null) { - origins = new ArrayList<String>(); - } - if (origins.isEmpty()) { - origins.add(keyServer); - } - for (String origin : origins) { - if (KeybaseKeyserver.ORIGIN.equals(origin)) { - server = new KeybaseKeyserver(); - } else { - server = new HkpKeyserver(origin); - } - Log.d(Constants.TAG, "IMPORTING " + entry.getKeyIdHex() + " FROM: " + server); - - // if available use complete fingerprint for get request - byte[] downloadedKeyBytes; - if (KeybaseKeyserver.ORIGIN.equals(origin)) { - downloadedKeyBytes = server.get(entry.getExtraData()).getBytes(); - } else if (entry.getFingerprintHex() != null) { - downloadedKeyBytes = server.get("0x" + entry.getFingerprintHex()).getBytes(); - } else { - downloadedKeyBytes = server.get(entry.getKeyIdHex()).getBytes(); - } - - // save key bytes in entry object for doing the - // actual import afterwards - keyRings.add(new ParcelableKeyRing(downloadedKeyBytes, entry.getFingerprintHex())); - } - } catch (Keyserver.QueryFailedException e) { - sendErrorToHandler(e); - } - } - - Intent importIntent = new Intent(this, KeychainIntentService.class); - importIntent.setAction(ACTION_IMPORT_KEYRING); - - Bundle importData = new Bundle(); - // This is not going through binder, nothing to fear of - importData.putParcelableArrayList(IMPORT_KEY_LIST, keyRings); - importIntent.putExtra(EXTRA_DATA, importData); - importIntent.putExtra(EXTRA_MESSENGER, mMessenger); - - // now import it with this service - onHandleIntent(importIntent); - - // result is handled in ACTION_IMPORT_KEYRING - } else if (ACTION_EDIT_KEYRING.equals(action)) { try { @@ -519,6 +446,8 @@ public class KeychainIntentService extends IntentService implements Progressable try { + // Input + String keyServer = data.getString(IMPORT_KEY_SERVER); Iterator<ParcelableKeyRing> entries; int numEntries; if (data.containsKey(IMPORT_KEY_LIST)) { @@ -535,20 +464,22 @@ public class KeychainIntentService extends IntentService implements Progressable numEntries = it.getSize(); } + // Operation ImportExportOperation importExportOperation = new ImportExportOperation( this, providerHelper, this, mActionCanceled); - ImportKeyResult result = importExportOperation.importKeyRings(entries, numEntries); + ImportKeyResult result = importExportOperation.importKeyRings(entries, numEntries, keyServer); - // we do this even on failure or cancellation! + // Special: consolidate on secret key import (cannot be cancelled!) if (result.mSecret > 0) { // cannot cancel from here on out! sendMessageToHandler(KeychainIntentServiceHandler.MESSAGE_PREVENT_CANCEL); providerHelper.consolidateDatabaseStep1(this); } - // make sure new data is synced into contacts + // Special: make sure new data is synced into contacts ContactSyncAdapterService.requestSync(); + // Result sendMessageToHandler(KeychainIntentServiceHandler.MESSAGE_OKAY, result); } catch (Exception e) { sendErrorToHandler(e); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java index 6ef73cd36..1b470dd16 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java @@ -501,16 +501,25 @@ public class ImportKeysActivity extends ActionBarActivity { // Send all information needed to service to query keys in other thread Intent intent = new Intent(this, KeychainIntentService.class); - intent.setAction(KeychainIntentService.ACTION_DOWNLOAD_AND_IMPORT_KEYS); + intent.setAction(KeychainIntentService.ACTION_IMPORT_KEYRING); // fill values for this action Bundle data = new Bundle(); - data.putString(KeychainIntentService.DOWNLOAD_KEY_SERVER, sls.mCloudPrefs.keyserver); + data.putString(KeychainIntentService.IMPORT_KEY_SERVER, sls.mCloudPrefs.keyserver); // get selected key entries - ArrayList<ImportKeysListEntry> selectedEntries = mListFragment.getSelectedEntries(); - data.putParcelableArrayList(KeychainIntentService.DOWNLOAD_KEY_LIST, selectedEntries); + ArrayList<ParcelableKeyRing> keys = new ArrayList<ParcelableKeyRing>(); + { + // change the format into ParcelableKeyRing + ArrayList<ImportKeysListEntry> entries = mListFragment.getSelectedEntries(); + for (ImportKeysListEntry entry : entries) { + keys.add(new ParcelableKeyRing( + entry.getFingerprintHex(), entry.getKeyIdHex(), entry.getExtraData()) + ); + } + } + data.putParcelableArrayList(KeychainIntentService.IMPORT_KEY_LIST, keys); intent.putExtra(KeychainIntentService.EXTRA_DATA, data); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListActivity.java index a0423ccd0..c05393f6d 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListActivity.java @@ -20,35 +20,26 @@ package org.sufficientlysecure.keychain.ui; import android.app.ProgressDialog; import android.content.Intent; -import android.net.Uri; import android.os.Bundle; import android.os.Message; import android.os.Messenger; import android.view.Menu; import android.view.MenuItem; -import com.google.zxing.integration.android.IntentIntegrator; -import com.google.zxing.integration.android.IntentResult; - import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; -import org.sufficientlysecure.keychain.keyimport.ImportKeysListEntry; +import org.sufficientlysecure.keychain.operations.results.ConsolidateResult; +import org.sufficientlysecure.keychain.operations.results.OperationResult; import org.sufficientlysecure.keychain.provider.KeychainContract; import org.sufficientlysecure.keychain.provider.KeychainDatabase; import org.sufficientlysecure.keychain.service.KeychainIntentService; import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler; -import org.sufficientlysecure.keychain.operations.results.ConsolidateResult; -import org.sufficientlysecure.keychain.operations.results.ImportKeyResult; -import org.sufficientlysecure.keychain.operations.results.OperationResult; import org.sufficientlysecure.keychain.ui.util.Notify; import org.sufficientlysecure.keychain.util.ExportHelper; -import org.sufficientlysecure.keychain.util.IntentIntegratorSupportV4; import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.Preferences; import java.io.IOException; -import java.util.ArrayList; -import java.util.Locale; public class KeyListActivity extends DrawerActivity { @@ -97,8 +88,9 @@ public class KeyListActivity extends DrawerActivity { public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.menu_key_list_add: - // scan using xzing's Barcode Scanner - new IntentIntegrator(this).initiateScan(); + Intent scanQrCode = new Intent(this, QrCodeScanActivity.class); + scanQrCode.setAction(QrCodeScanActivity.ACTION_SCAN_WITH_RESULT); + startActivityForResult(scanQrCode, 0); return true; case R.id.menu_key_list_search_cloud: @@ -219,35 +211,6 @@ public class KeyListActivity extends DrawerActivity { @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { - if (requestCode == IntentIntegratorSupportV4.REQUEST_CODE) { - IntentResult scanResult = IntentIntegratorSupportV4.parseActivityResult(requestCode, - resultCode, data); - if (scanResult != null && scanResult.getFormatName() != null) { - String scannedContent = scanResult.getContents(); - - Log.d(Constants.TAG, "scannedContent: " + scannedContent); - - // look if it's fingerprint only - if (scannedContent.toLowerCase(Locale.ENGLISH).startsWith(Constants.FINGERPRINT_SCHEME)) { - String fingerprint = - Uri.parse(scanResult.getContents()).toString().split(":")[1].toLowerCase(Locale.ENGLISH); - importKeys(fingerprint); - return; - } - - // is this a full key encoded as qr code? - if (scannedContent.startsWith("-----BEGIN PGP")) { - // TODO - // mImportActivity.loadCallback(new ImportKeysListFragment.BytesLoaderState(scannedContent.getBytes(), null)); - return; - } - - // fail... - Notify.showNotify(this, R.string.import_qr_code_wrong, Notify.Style.ERROR); - } - - return; - } // if a result has been returned, display a notify if (data != null && data.hasExtra(OperationResult.EXTRA_RESULT)) { OperationResult result = data.getParcelableExtra(OperationResult.EXTRA_RESULT); @@ -257,76 +220,4 @@ public class KeyListActivity extends DrawerActivity { } } - public void importKeys(String fingerprint) { - // Message is received after importing is done in KeychainIntentService - KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler( - this, - getString(R.string.progress_importing), - ProgressDialog.STYLE_HORIZONTAL, - true) { - public void handleMessage(Message message) { - // handle messages by standard KeychainIntentServiceHandler first - super.handleMessage(message); - - if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) { - // get returned data bundle - Bundle returnData = message.getData(); - if (returnData == null) { - return; - } - final ImportKeyResult result = - returnData.getParcelable(OperationResult.EXTRA_RESULT); - if (result == null) { - Log.e(Constants.TAG, "result == null"); - return; - } - - if ( ! result.success()) { - result.createNotify(KeyListActivity.this).show(); - return; - } - - Intent certifyIntent = new Intent(KeyListActivity.this, MultiCertifyKeyActivity.class); - certifyIntent.putExtra(MultiCertifyKeyActivity.EXTRA_RESULT, result); - certifyIntent.putExtra(MultiCertifyKeyActivity.EXTRA_KEY_IDS, result.getImportedMasterKeyIds()); - startActivityForResult(certifyIntent, REQUEST_CODE_RESULT_TO_LIST); - } - } - }; - - // search config - Preferences prefs = Preferences.getPreferences(this); - Preferences.CloudSearchPrefs cloudPrefs = new Preferences.CloudSearchPrefs(true, true, prefs.getPreferredKeyserver()); - - // Send all information needed to service to query keys in other thread - Intent intent = new Intent(this, KeychainIntentService.class); - - intent.setAction(KeychainIntentService.ACTION_DOWNLOAD_AND_IMPORT_KEYS); - - // fill values for this action - Bundle data = new Bundle(); - - data.putString(KeychainIntentService.DOWNLOAD_KEY_SERVER, cloudPrefs.keyserver); - - final ImportKeysListEntry keyEntry = new ImportKeysListEntry(); - keyEntry.setFingerprintHex(fingerprint); - keyEntry.addOrigin(cloudPrefs.keyserver); - ArrayList<ImportKeysListEntry> selectedEntries = new ArrayList<ImportKeysListEntry>(); - selectedEntries.add(keyEntry); - - data.putParcelableArrayList(KeychainIntentService.DOWNLOAD_KEY_LIST, selectedEntries); - - intent.putExtra(KeychainIntentService.EXTRA_DATA, data); - - // Create a new Messenger for the communication back - Messenger messenger = new Messenger(saveHandler); - intent.putExtra(KeychainIntentService.EXTRA_MESSENGER, messenger); - - // show progress dialog - saveHandler.showProgressDialog(this); - - // start service with intent - startService(intent); - } - } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java index 1138c9e9c..0b28a2594 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListFragment.java @@ -162,7 +162,7 @@ public class KeyListFragment extends LoaderFragment } } }; - new KeyUpdateHelper().updateAllKeys(getActivity(), finishedHandler); + // new KeyUpdateHelper().updateAllKeys(getActivity(), finishedHandler); updateActionbarForSwipe(false); } }); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/QrCodeScanActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/QrCodeScanActivity.java new file mode 100644 index 000000000..ba1d03636 --- /dev/null +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/QrCodeScanActivity.java @@ -0,0 +1,221 @@ +/* + * Copyright (C) 2014 Dominik Schürmann <dominik@dominikschuermann.de> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package org.sufficientlysecure.keychain.ui; + +import android.app.ProgressDialog; +import android.content.Intent; +import android.net.Uri; +import android.os.Bundle; +import android.os.Message; +import android.os.Messenger; +import android.support.v4.app.FragmentActivity; +import android.widget.Toast; + +import com.google.zxing.integration.android.IntentIntegrator; +import com.google.zxing.integration.android.IntentResult; + +import org.sufficientlysecure.keychain.Constants; +import org.sufficientlysecure.keychain.R; +import org.sufficientlysecure.keychain.api.OpenKeychainIntents; +import org.sufficientlysecure.keychain.keyimport.ImportKeysListEntry; +import org.sufficientlysecure.keychain.keyimport.ParcelableKeyRing; +import org.sufficientlysecure.keychain.operations.results.ImportKeyResult; +import org.sufficientlysecure.keychain.operations.results.OperationResult; +import org.sufficientlysecure.keychain.operations.results.SingletonResult; +import org.sufficientlysecure.keychain.service.KeychainIntentService; +import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler; +import org.sufficientlysecure.keychain.util.IntentIntegratorSupportV4; +import org.sufficientlysecure.keychain.util.Log; +import org.sufficientlysecure.keychain.util.Preferences; + +import java.util.ArrayList; +import java.util.Locale; + +/** + * Proxy activity (just a transparent content view) to scan QR Codes using the Barcode Scanner app + */ +public class QrCodeScanActivity extends FragmentActivity { + + public static final String ACTION_QR_CODE_API = OpenKeychainIntents.IMPORT_KEY_FROM_QR_CODE; + public static final String ACTION_SCAN_WITH_RESULT = Constants.INTENT_PREFIX + "SCAN_QR_CODE_WITH_RESULT"; + + boolean returnResult; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // this activity itself has no content view (see manifest) + + handleActions(getIntent()); + } + + protected void handleActions(Intent intent) { + String action = intent.getAction(); + Uri dataUri = intent.getData(); + String scheme = intent.getScheme(); + + if (scheme != null && scheme.toLowerCase(Locale.ENGLISH).equals(Constants.FINGERPRINT_SCHEME)) { + // Scanning a fingerprint directly with Barcode Scanner, thus we already have scanned + + returnResult = false; + startCertify(dataUri); + } else if (ACTION_SCAN_WITH_RESULT.equals(action)) { + // scan using xzing's Barcode Scanner and return result parcel in OpenKeychain + + returnResult = true; + new IntentIntegrator(this).initiateScan(); + } else if (ACTION_QR_CODE_API.equals(action)) { + // scan using xzing's Barcode Scanner from outside OpenKeychain + + returnResult = false; + new IntentIntegrator(this).initiateScan(); + } else { + Log.e(Constants.TAG, "No valid scheme or action given!"); + finish(); + } + } + + @Override + protected void onActivityResult(int requestCode, int resultCode, Intent data) { + if (requestCode == IntentIntegratorSupportV4.REQUEST_CODE) { + IntentResult scanResult = IntentIntegratorSupportV4.parseActivityResult(requestCode, + resultCode, data); + if (scanResult != null && scanResult.getFormatName() != null) { + String scannedContent = scanResult.getContents(); + Log.d(Constants.TAG, "scannedContent: " + scannedContent); + + startCertify(Uri.parse(scanResult.getContents())); + } else { + Log.e(Constants.TAG, "scanResult or formatName null! Should not happen!"); + finish(); + } + + return; + } + // if a result has been returned, return it down to other activity + if (data != null && data.hasExtra(OperationResult.EXTRA_RESULT)) { + returnResult(data); + } else { + super.onActivityResult(requestCode, resultCode, data); + } + } + + public void returnResult(Intent data) { + if (returnResult) { + setResult(RESULT_OK, data); + finish(); + } else { + // display last log message but as Toast for calls from outside OpenKeychain + OperationResult result = data.getParcelableExtra(OperationResult.EXTRA_RESULT); + String str = getString(result.getLog().getLast().mType.getMsgId()); + Toast.makeText(this, str, Toast.LENGTH_LONG).show(); + finish(); + } + } + + public void startCertify(Uri dataUri) { + // example: openpgp4fpr:73EE2314F65FA92EC2390D3A718C070100012282 + if (dataUri.getScheme().equals(Constants.FINGERPRINT_SCHEME)) { + String fingerprint = dataUri.getEncodedSchemeSpecificPart().toLowerCase(Locale.ENGLISH); + importKeys(fingerprint); + } else { + SingletonResult result = new SingletonResult( + SingletonResult.RESULT_ERROR, OperationResult.LogType.MSG_WRONG_QR_CODE); + Intent intent = new Intent(); + intent.putExtra(SingletonResult.EXTRA_RESULT, result); + returnResult(intent); + } + } + + public void importKeys(String fingerprint) { + // Message is received after importing is done in KeychainIntentService + KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler( + this, + getString(R.string.progress_importing), + ProgressDialog.STYLE_HORIZONTAL, + true) { + public void handleMessage(Message message) { + // handle messages by standard KeychainIntentServiceHandler first + super.handleMessage(message); + + if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) { + // get returned data bundle + Bundle returnData = message.getData(); + if (returnData == null) { + finish(); + return; + } + final ImportKeyResult result = + returnData.getParcelable(OperationResult.EXTRA_RESULT); + if (result == null) { + Log.e(Constants.TAG, "result == null"); + finish(); + return; + } + + if ( ! result.success()) { + // only return if no success... + Intent data = new Intent(); + data.putExtras(returnData); + returnResult(data); + return; + } + + Intent certifyIntent = new Intent(QrCodeScanActivity.this, MultiCertifyKeyActivity.class); + certifyIntent.putExtra(MultiCertifyKeyActivity.EXTRA_RESULT, result); + certifyIntent.putExtra(MultiCertifyKeyActivity.EXTRA_KEY_IDS, result.getImportedMasterKeyIds()); + startActivityForResult(certifyIntent, 0); + } + } + }; + + // search config + Preferences prefs = Preferences.getPreferences(this); + Preferences.CloudSearchPrefs cloudPrefs = new Preferences.CloudSearchPrefs(true, true, prefs.getPreferredKeyserver()); + + // Send all information needed to service to query keys in other thread + Intent intent = new Intent(this, KeychainIntentService.class); + + intent.setAction(KeychainIntentService.ACTION_IMPORT_KEYRING); + + // fill values for this action + Bundle data = new Bundle(); + + data.putString(KeychainIntentService.IMPORT_KEY_SERVER, cloudPrefs.keyserver); + + ParcelableKeyRing keyEntry = new ParcelableKeyRing(fingerprint, null, null); + ArrayList<ParcelableKeyRing> selectedEntries = new ArrayList<ParcelableKeyRing>(); + selectedEntries.add(keyEntry); + + data.putParcelableArrayList(KeychainIntentService.IMPORT_KEY_LIST, selectedEntries); + + intent.putExtra(KeychainIntentService.EXTRA_DATA, data); + + // Create a new Messenger for the communication back + Messenger messenger = new Messenger(saveHandler); + intent.putExtra(KeychainIntentService.EXTRA_MESSENGER, messenger); + + // show progress dialog + saveHandler.showProgressDialog(this); + + // start service with intent + startService(intent); + } + +} diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/QrCodeActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/QrCodeViewActivity.java index cc66a33a3..cf0c3eb88 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/QrCodeActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/QrCodeViewActivity.java @@ -36,7 +36,7 @@ import org.sufficientlysecure.keychain.ui.util.Notify; import org.sufficientlysecure.keychain.ui.util.Notify.Style; import org.sufficientlysecure.keychain.ui.util.QrCodeUtils; -public class QrCodeActivity extends ActionBarActivity { +public class QrCodeViewActivity extends ActionBarActivity { private ImageView mFingerprintQrCode; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SafeSlingerActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SafeSlingerActivity.java new file mode 100644 index 000000000..b8e3dd590 --- /dev/null +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/SafeSlingerActivity.java @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2014 Dominik Schürmann <dominik@dominikschuermann.de> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package org.sufficientlysecure.keychain.ui; + +import android.os.Bundle; +import android.support.v7.app.ActionBarActivity; +import android.widget.NumberPicker; + +import org.sufficientlysecure.keychain.R; + + +public class SafeSlingerActivity extends ActionBarActivity { + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setContentView(R.layout.safe_slinger_activity); + + NumberPicker numberPicker = (NumberPicker) findViewById(R.id.safe_slinger_number_picker); + + numberPicker.setDisplayedValues(new String[]{"2","3","4","5","6","7","8","9","10"}); + numberPicker.setValue(0); +// numberPicker.setMaxValue(8); +// numberPicker.setMinValue(0); + } + +} diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyShareFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyShareFragment.java index e7f1be3f2..a913057f0 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyShareFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyShareFragment.java @@ -291,7 +291,7 @@ public class ViewKeyShareFragment extends LoaderFragment implements private void showQrCodeDialog() { - Intent qrCodeIntent = new Intent(getActivity(), QrCodeActivity.class); + Intent qrCodeIntent = new Intent(getActivity(), QrCodeViewActivity.class); qrCodeIntent.setData(mDataUri); startActivity(qrCodeIntent); } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/EmailKeyHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/EmailKeyHelper.java index 33541718e..49d4d8bf8 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/EmailKeyHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/EmailKeyHelper.java @@ -25,6 +25,7 @@ import android.os.Messenger; import org.sufficientlysecure.keychain.keyimport.HkpKeyserver; import org.sufficientlysecure.keychain.keyimport.ImportKeysListEntry; import org.sufficientlysecure.keychain.keyimport.Keyserver; +import org.sufficientlysecure.keychain.keyimport.ParcelableKeyRing; import org.sufficientlysecure.keychain.service.KeychainIntentService; import java.util.ArrayList; @@ -40,14 +41,21 @@ public class EmailKeyHelper { } public static void importAll(Context context, Messenger messenger, List<String> mails) { - Set<ImportKeysListEntry> keys = new HashSet<ImportKeysListEntry>(); + // Collect all candidates as ImportKeysListEntry (set for deduplication) + Set<ImportKeysListEntry> entries = new HashSet<ImportKeysListEntry>(); for (String mail : mails) { - keys.addAll(getEmailKeys(context, mail)); + entries.addAll(getEmailKeys(context, mail)); + } + + // Put them in a list and import + ArrayList<ParcelableKeyRing> keys = new ArrayList<ParcelableKeyRing>(entries.size()); + for (ImportKeysListEntry entry : entries) { + keys.add(new ParcelableKeyRing(entry.getFingerprintHex(), entry.getKeyIdHex(), null)); } - importKeys(context, messenger, new ArrayList<ImportKeysListEntry>(keys)); + importKeys(context, messenger, keys); } - public static List<ImportKeysListEntry> getEmailKeys(Context context, String mail) { + public static Set<ImportKeysListEntry> getEmailKeys(Context context, String mail) { Set<ImportKeysListEntry> keys = new HashSet<ImportKeysListEntry>(); // Try _hkp._tcp SRV record first @@ -67,15 +75,14 @@ public class EmailKeyHelper { keys.addAll(getEmailKeys(mail, hkp)); } } - return new ArrayList<ImportKeysListEntry>(keys); + return keys; } - private static void importKeys(Context context, Messenger messenger, List<ImportKeysListEntry> keys) { + private static void importKeys(Context context, Messenger messenger, ArrayList<ParcelableKeyRing> keys) { Intent importIntent = new Intent(context, KeychainIntentService.class); - importIntent.setAction(KeychainIntentService.ACTION_DOWNLOAD_AND_IMPORT_KEYS); + importIntent.setAction(KeychainIntentService.ACTION_IMPORT_KEYRING); Bundle importData = new Bundle(); - importData.putParcelableArrayList(KeychainIntentService.DOWNLOAD_KEY_LIST, - new ArrayList<ImportKeysListEntry>(keys)); + importData.putParcelableArrayList(KeychainIntentService.IMPORT_KEY_LIST, keys); importIntent.putExtra(KeychainIntentService.EXTRA_DATA, importData); importIntent.putExtra(KeychainIntentService.EXTRA_MESSENGER, messenger); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/KeyUpdateHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/KeyUpdateHelper.java index afa2e75fa..76ec9f75f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/KeyUpdateHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/KeyUpdateHelper.java @@ -34,6 +34,8 @@ import java.util.List; public class KeyUpdateHelper { + /* + public void updateAllKeys(Context context, KeychainIntentServiceHandler finishedHandler) { UpdateTask updateTask = new UpdateTask(context, finishedHandler); updateTask.execute(); @@ -79,4 +81,6 @@ public class KeyUpdateHelper { return null; } } + */ + } diff --git a/OpenKeychain/src/main/res/layout/safe_slinger_activity.xml b/OpenKeychain/src/main/res/layout/safe_slinger_activity.xml new file mode 100644 index 000000000..46d9237ea --- /dev/null +++ b/OpenKeychain/src/main/res/layout/safe_slinger_activity.xml @@ -0,0 +1,26 @@ +<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="vertical" + android:paddingLeft="16dp" + android:paddingRight="16dp"> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginBottom="4dp" + android:layout_marginTop="14dp" + android:text="bla" /> + + <NumberPicker + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:id="@+id/safe_slinger_number_picker" /> + + </LinearLayout> + +</ScrollView> |