diff options
author | mar-v-in <github@rvin.mooo.com> | 2014-06-19 13:57:35 +0200 |
---|---|---|
committer | mar-v-in <github@rvin.mooo.com> | 2014-06-19 13:57:35 +0200 |
commit | 58706425d62e40c0ecc9164a8fee089ca471e1fe (patch) | |
tree | d250292332dce208760847f150c4e627607d8028 /OpenKeychain/src | |
parent | d9c937bbe762736d9f0c45d5ba0083555c8da2e1 (diff) | |
parent | 48c96184dcf2837f9be2e5bdb116bedd86098eb3 (diff) | |
download | open-keychain-58706425d62e40c0ecc9164a8fee089ca471e1fe.tar.gz open-keychain-58706425d62e40c0ecc9164a8fee089ca471e1fe.tar.bz2 open-keychain-58706425d62e40c0ecc9164a8fee089ca471e1fe.zip |
Merge branch 'master' of https://github.com/open-keychain/open-keychain into improve-file
Diffstat (limited to 'OpenKeychain/src')
37 files changed, 206 insertions, 428 deletions
diff --git a/OpenKeychain/src/main/AndroidManifest.xml b/OpenKeychain/src/main/AndroidManifest.xml index b3a4d5960..48677431c 100644 --- a/OpenKeychain/src/main/AndroidManifest.xml +++ b/OpenKeychain/src/main/AndroidManifest.xml @@ -65,7 +65,7 @@ android:name=".KeychainApplication" android:allowBackup="false" android:hardwareAccelerated="true" - android:icon="@drawable/icon" + android:icon="@drawable/ic_launcher" android:theme="@style/KeychainTheme" android:label="@string/app_name"> <activity diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/KeybaseKeyserver.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/KeybaseKeyserver.java index 43557279f..2f14d77a8 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/KeybaseKeyserver.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/keyimport/KeybaseKeyserver.java @@ -53,15 +53,16 @@ public class KeybaseKeyserver extends Keyserver { // only list them if they have a key if (JWalk.optObject(match, "components", "key_fingerprint") != null) { - String keybaseId = JWalk.getString(match, "components", "username", "val"); - String fingerprint = JWalk.getString(match, "components", "key_fingerprint", "val"); - fingerprint = fingerprint.replace(" ", "").toUpperCase(); - - if (keybaseId.equals(query) || fingerprint.startsWith(query.toUpperCase())) { - results.add(makeEntry(match)); - } else { - results.add(makeEntry(match)); - } + // TODO: needed anymore? +// String keybaseId = JWalk.getString(match, "components", "username", "val"); +// String fingerprint = JWalk.getString(match, "components", "key_fingerprint", "val"); +// fingerprint = fingerprint.replace(" ", "").toUpperCase(); +// if (keybaseId.equals(query) || fingerprint.startsWith(query.toUpperCase())) { +// results.add(makeEntry(match)); +// } else { +// results.add(makeEntry(match)); +// } + results.add(makeEntry(match)); } } } catch (Exception e) { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/OpenPgpSignatureResultBuilder.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/OpenPgpSignatureResultBuilder.java index 5e49497c0..75f8bdb66 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/OpenPgpSignatureResultBuilder.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/OpenPgpSignatureResultBuilder.java @@ -35,7 +35,6 @@ public class OpenPgpSignatureResultBuilder { private boolean mSignatureAvailable = false; private boolean mKnownKey = false; private boolean mValidSignature = false; - private boolean mValidKeyBinding = false; private boolean mIsSignatureKeyCertified = false; public void signatureOnly(boolean signatureOnly) { @@ -58,10 +57,6 @@ public class OpenPgpSignatureResultBuilder { this.mValidSignature = validSignature; } - public void validKeyBinding(boolean validKeyBinding) { - this.mValidKeyBinding = validKeyBinding; - } - public void signatureKeyCertified(boolean isSignatureKeyCertified) { this.mIsSignatureKeyCertified = isSignatureKeyCertified; } @@ -77,7 +72,7 @@ public class OpenPgpSignatureResultBuilder { // valid sig! if (mKnownKey) { - if (mValidKeyBinding && mValidSignature) { + if (mValidSignature) { result.setKeyId(mKeyId); result.setUserId(mUserId); @@ -89,8 +84,7 @@ public class OpenPgpSignatureResultBuilder { result.setStatus(OpenPgpSignatureResult.SIGNATURE_SUCCESS_UNCERTIFIED); } } else { - Log.d(Constants.TAG, "Error!\nvalidKeyBinding: " + mValidKeyBinding - + "\nvalidSignature: " + mValidSignature); + Log.d(Constants.TAG, "Error! Invalid signature."); result.setStatus(OpenPgpSignatureResult.SIGNATURE_ERROR); } } else { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java index c009d1b5c..a5ccfbd3b 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java @@ -122,9 +122,6 @@ public class PgpDecryptVerify { /** * Allow these key ids alone for decryption. * This means only ciphertexts encrypted for one of these private key can be decrypted. - * - * @param allowedKeyIds - * @return */ public Builder setAllowedKeyIds(Set<Long> allowedKeyIds) { this.mAllowedKeyIds = allowedKeyIds; @@ -496,10 +493,7 @@ public class PgpDecryptVerify { // Verify signature and check binding signatures boolean validSignature = signature.verify(messageSignature); - boolean validKeyBinding = signingRing.verifySubkeyBinding(signingKey); - signatureResultBuilder.validSignature(validSignature); - signatureResultBuilder.validKeyBinding(validKeyBinding); } } @@ -643,10 +637,8 @@ public class PgpDecryptVerify { // Verify signature and check binding signatures boolean validSignature = signature.verify(); - boolean validKeyBinding = signingRing.verifySubkeyBinding(signingKey); signatureResultBuilder.validSignature(validSignature); - signatureResultBuilder.validKeyBinding(validKeyBinding); } result.setSignatureResult(signatureResultBuilder.build()); @@ -657,10 +649,6 @@ public class PgpDecryptVerify { /** * Mostly taken from ClearSignedFileProcessor in Bouncy Castle - * - * @param sig - * @param line - * @throws SignatureException */ private static void processLine(PGPSignature sig, byte[] line) throws SignatureException { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpHelper.java index d24f65aa6..969ff1de8 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpHelper.java @@ -60,7 +60,7 @@ public class PgpHelper { } public static String getFullVersion(Context context) { - return "OpenPGP Keychain v" + getVersion(context); + return "OpenKeychain v" + getVersion(context); } // public static final class content { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java index 9b070175c..7544f7b86 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java @@ -226,7 +226,7 @@ public class PgpImportExport { try { WrappedPublicKeyRing ring = mProviderHelper.getWrappedPublicKeyRing( - KeychainContract.KeyRings.buildGenericKeyRingUri(pubKeyMasterId) + KeychainContract.KeyRings.buildUnifiedKeyRingUri(pubKeyMasterId) ); ring.encode(arOutStream); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java index e1ce62bdf..371202217 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/UncachedKeyRing.java @@ -547,6 +547,7 @@ public class UncachedKeyRing { // if we already have a cert, and this one is not newer: skip it if (selfCert != null && selfCert.getCreationTime().before(cert.getCreationTime())) { + log.add(LogLevel.DEBUG, LogType.MSG_KC_SUB_DUP, indent); redundantCerts += 1; continue; } @@ -574,8 +575,9 @@ public class UncachedKeyRing { continue; } - // if there is no binding (yet), or the revocation is newer than the binding: keep it + // if there is a certification that is newer than this revocation, don't bother if (selfCert != null && selfCert.getCreationTime().after(cert.getCreationTime())) { + log.add(LogLevel.DEBUG, LogType.MSG_KC_SUB_REVOKE_DUP, indent); redundantCerts += 1; continue; } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/WrappedPublicKeyRing.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/WrappedPublicKeyRing.java index 0bb84aee7..b2abf15a4 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/WrappedPublicKeyRing.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/pgp/WrappedPublicKeyRing.java @@ -1,24 +1,16 @@ package org.sufficientlysecure.keychain.pgp; import org.spongycastle.bcpg.ArmoredOutputStream; -import org.spongycastle.bcpg.SignatureSubpacketTags; -import org.spongycastle.openpgp.PGPException; import org.spongycastle.openpgp.PGPKeyRing; import org.spongycastle.openpgp.PGPObjectFactory; import org.spongycastle.openpgp.PGPPublicKey; import org.spongycastle.openpgp.PGPPublicKeyRing; -import org.spongycastle.openpgp.PGPSignature; -import org.spongycastle.openpgp.PGPSignatureList; -import org.spongycastle.openpgp.PGPSignatureSubpacketVector; -import org.spongycastle.openpgp.operator.jcajce.JcaPGPContentVerifierBuilderProvider; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException; import org.sufficientlysecure.keychain.util.IterableIterator; import org.sufficientlysecure.keychain.util.Log; import java.io.IOException; -import java.security.SignatureException; -import java.util.Arrays; import java.util.Iterator; public class WrappedPublicKeyRing extends WrappedKeyRing { @@ -70,106 +62,11 @@ public class WrappedPublicKeyRing extends WrappedKeyRing { } return cKey; } - // TODO handle with proper exception throw new PgpGeneralException("no encryption key available"); } - public boolean verifySubkeyBinding(WrappedPublicKey cachedSubkey) { - boolean validSubkeyBinding = false; - boolean validTempSubkeyBinding = false; - boolean validPrimaryKeyBinding = false; - - PGPPublicKey masterKey = getRing().getPublicKey(); - PGPPublicKey subKey = cachedSubkey.getPublicKey(); - - // Is this the master key? Match automatically, then. - if(Arrays.equals(masterKey.getFingerprint(), subKey.getFingerprint())) { - return true; - } - - JcaPGPContentVerifierBuilderProvider contentVerifierBuilderProvider = - new JcaPGPContentVerifierBuilderProvider() - .setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME); - - Iterator<PGPSignature> itr = subKey.getSignatures(); - - while (itr.hasNext()) { //what does gpg do if the subkey binding is wrong? - //gpg has an invalid subkey binding error on key import I think, but doesn't shout - //about keys without subkey signing. Can't get it to import a slightly broken one - //either, so we will err on bad subkey binding here. - PGPSignature sig = itr.next(); - if (sig.getKeyID() == masterKey.getKeyID() && - sig.getSignatureType() == PGPSignature.SUBKEY_BINDING) { - //check and if ok, check primary key binding. - try { - sig.init(contentVerifierBuilderProvider, masterKey); - validTempSubkeyBinding = sig.verifyCertification(masterKey, subKey); - } catch (PGPException e) { - continue; - } catch (SignatureException e) { - continue; - } - - if (validTempSubkeyBinding) { - validSubkeyBinding = true; - } - if (validTempSubkeyBinding) { - validPrimaryKeyBinding = verifyPrimaryKeyBinding(sig.getUnhashedSubPackets(), - masterKey, subKey); - if (validPrimaryKeyBinding) { - break; - } - validPrimaryKeyBinding = verifyPrimaryKeyBinding(sig.getHashedSubPackets(), - masterKey, subKey); - if (validPrimaryKeyBinding) { - break; - } - } - } - } - return validSubkeyBinding && validPrimaryKeyBinding; - - } - - static boolean verifyPrimaryKeyBinding(PGPSignatureSubpacketVector pkts, - PGPPublicKey masterPublicKey, - PGPPublicKey signingPublicKey) { - boolean validPrimaryKeyBinding = false; - JcaPGPContentVerifierBuilderProvider contentVerifierBuilderProvider = - new JcaPGPContentVerifierBuilderProvider() - .setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME); - PGPSignatureList eSigList; - - if (pkts.hasSubpacket(SignatureSubpacketTags.EMBEDDED_SIGNATURE)) { - try { - eSigList = pkts.getEmbeddedSignatures(); - } catch (IOException e) { - return false; - } catch (PGPException e) { - return false; - } - for (int j = 0; j < eSigList.size(); ++j) { - PGPSignature emSig = eSigList.get(j); - if (emSig.getSignatureType() == PGPSignature.PRIMARYKEY_BINDING) { - try { - emSig.init(contentVerifierBuilderProvider, signingPublicKey); - validPrimaryKeyBinding = emSig.verifyCertification(masterPublicKey, signingPublicKey); - if (validPrimaryKeyBinding) { - break; - } - } catch (PGPException e) { - continue; - } catch (SignatureException e) { - continue; - } - } - } - } - - return validPrimaryKeyBinding; - } - public IterableIterator<WrappedPublicKey> publicKeyIterator() { + @SuppressWarnings("unchecked") final Iterator<PGPPublicKey> it = getRing().getPublicKeys(); return new IterableIterator<WrappedPublicKey>(new Iterator<WrappedPublicKey>() { @Override diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/OperationResultParcel.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/OperationResultParcel.java index 6e49baf92..f88df5301 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/OperationResultParcel.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/service/OperationResultParcel.java @@ -201,6 +201,7 @@ public class OperationResultParcel implements Parcelable { MSG_KC_SUB_BAD_KEYID(R.string.msg_kc_sub_bad_keyid), MSG_KC_SUB_BAD_TIME(R.string.msg_kc_sub_bad_time), MSG_KC_SUB_BAD_TYPE(R.string.msg_kc_sub_bad_type), + MSG_KC_SUB_DUP (R.string.msg_kc_sub_dup), MSG_KC_SUB_PRIMARY_BAD(R.string.msg_kc_sub_primary_bad), MSG_KC_SUB_PRIMARY_BAD_ERR(R.string.msg_kc_sub_primary_bad_err), MSG_KC_SUB_PRIMARY_NONE(R.string.msg_kc_sub_primary_none), 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 54186e380..e829df7a0 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java @@ -18,9 +18,7 @@ package org.sufficientlysecure.keychain.ui; import android.annotation.TargetApi; -import android.app.Activity; import android.app.ProgressDialog; -import android.content.Context; import android.content.Intent; import android.net.Uri; import android.nfc.NdefMessage; @@ -31,16 +29,12 @@ import android.os.Message; import android.os.Messenger; import android.os.Parcelable; import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentTransaction; import android.support.v4.view.ViewPager; -import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBarActivity; -import android.util.DisplayMetrics; -import android.util.TypedValue; +import android.view.MotionEvent; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; -import android.widget.ArrayAdapter; import com.github.johnpersano.supertoasts.SuperCardToast; import com.github.johnpersano.supertoasts.SuperToast; @@ -51,7 +45,6 @@ import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.helper.OtherHelper; import org.sufficientlysecure.keychain.keyimport.ImportKeysListEntry; -import org.sufficientlysecure.keychain.keyimport.KeybaseKeyserver; import org.sufficientlysecure.keychain.keyimport.ParcelableKeyRing; import org.sufficientlysecure.keychain.pgp.PgpKeyHelper; import org.sufficientlysecure.keychain.service.KeychainIntentService; @@ -130,60 +123,13 @@ public class ImportKeysActivity extends ActionBarActivity { mNavigationStrings = getResources().getStringArray(R.array.import_action_list); - if (ACTION_IMPORT_KEY_FROM_KEYSERVER_AND_RETURN.equals(getIntent().getAction())) { - setTitle(R.string.nav_import); - } else { - initTabs(); - } + // TODO: add actionbar button for this action? +// if (ACTION_IMPORT_KEY_FROM_KEYSERVER_AND_RETURN.equals(getIntent().getAction())) { +// } handleActions(savedInstanceState, getIntent()); } - private void initTabs() { - mTabsAdapter = new PagerTabStripAdapter(this); - mViewPager.setAdapter(mTabsAdapter); - mSlidingTabLayout.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { - @Override - public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { - // resize view pager back to 64 if keyserver settings have been collapsed - if (getViewPagerHeight() > VIEW_PAGER_HEIGHT) { - resizeViewPager(VIEW_PAGER_HEIGHT); - } - } - - @Override - public void onPageSelected(int position) { - } - - @Override - public void onPageScrollStateChanged(int state) { - } - }); - - Bundle serverBundle = new Bundle(); -// serverBundle.putParcelable(ViewKeyMainFragment.ARG_DATA_URI, dataUri); - mTabsAdapter.addTab(ImportKeysServerFragment.class, - serverBundle, getString(R.string.import_tab_keyserver)); - - Bundle qrCodeBundle = new Bundle(); -// importBundle.putParcelable(ViewKeyMainFragment.ARG_DATA_URI, dataUri); - mTabsAdapter.addTab(ImportKeysQrCodeFragment.class, - qrCodeBundle, getString(R.string.import_tab_qr_code)); - - Bundle fileBundle = new Bundle(); -// importBundle.putParcelable(ViewKeyMainFragment.ARG_DATA_URI, dataUri); - mTabsAdapter.addTab(ImportKeysFileFragment.class, - fileBundle, getString(R.string.import_tab_direct)); - - Bundle keybaseBundle = new Bundle(); -// keybaseBundle.putParcelable(ViewKeyMainFragment.ARG_DATA_URI, dataUri); - mTabsAdapter.addTab(ImportKeysKeybaseFragment.class, - keybaseBundle, getString(R.string.import_tab_keybase)); - - // update layout after operations - mSlidingTabLayout.setViewPager(mViewPager); - } - protected void handleActions(Bundle savedInstanceState, Intent intent) { String action = intent.getAction(); Bundle extras = intent.getExtras(); @@ -200,6 +146,8 @@ public class ImportKeysActivity extends ActionBarActivity { action = ACTION_IMPORT_KEY; } + Bundle serverBundle = null; + boolean serverOnly = false; if (scheme != null && scheme.toLowerCase(Locale.ENGLISH).equals(Constants.FINGERPRINT_SCHEME)) { /* Scanning a fingerprint directly with Barcode Scanner */ loadFromFingerprintUri(savedInstanceState, dataUri); @@ -240,10 +188,8 @@ public class ImportKeysActivity extends ActionBarActivity { if (query != null && query.length() > 0) { // display keyserver fragment with query - Bundle args = new Bundle(); - args.putString(ImportKeysServerFragment.ARG_QUERY, query); -// loadNavFragment(NAV_SERVER, args); - //TODO: load afterwards! + serverBundle = new Bundle(); + serverBundle.putString(ImportKeysServerFragment.ARG_QUERY, query); mSwitchToTab = NAV_SERVER; // action: search immediately @@ -259,7 +205,19 @@ public class ImportKeysActivity extends ActionBarActivity { */ String fingerprint = intent.getStringExtra(EXTRA_FINGERPRINT); - loadFromFingerprint(savedInstanceState, fingerprint); + if (isFingerprintValid(fingerprint)) { + String query = "0x" + fingerprint; + + // display keyserver fragment with query + serverBundle = new Bundle(); + serverBundle.putString(ImportKeysServerFragment.ARG_QUERY, query); + serverBundle.putBoolean(ImportKeysServerFragment.ARG_DISABLE_QUERY_EDIT, true); + serverOnly = true; + mSwitchToTab = NAV_SERVER; + + // action: search immediately + startListFragment(savedInstanceState, null, null, query); + } } else { Log.e(Constants.TAG, "IMPORT_KEY_FROM_KEYSERVER action needs to contain the 'query', 'key_id', or " + @@ -298,6 +256,44 @@ public class ImportKeysActivity extends ActionBarActivity { startListFragment(savedInstanceState, null, null, null); } + initTabs(serverBundle, serverOnly); + } + + private void initTabs(Bundle serverBundle, boolean serverOnly) { + mTabsAdapter = new PagerTabStripAdapter(this); + mViewPager.setAdapter(mTabsAdapter); + mSlidingTabLayout.setOnPageChangeListener(new ViewPager.OnPageChangeListener() { + @Override + public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { + // resize view pager back to 64 if keyserver settings have been collapsed + if (getViewPagerHeight() > VIEW_PAGER_HEIGHT) { + resizeViewPager(VIEW_PAGER_HEIGHT); + } + } + + @Override + public void onPageSelected(int position) { + } + + @Override + public void onPageScrollStateChanged(int state) { + } + }); + + mTabsAdapter.addTab(ImportKeysServerFragment.class, + serverBundle, getString(R.string.import_tab_keyserver)); + if (!serverOnly) { + mTabsAdapter.addTab(ImportKeysQrCodeFragment.class, + null, getString(R.string.import_tab_qr_code)); + mTabsAdapter.addTab(ImportKeysFileFragment.class, + null, getString(R.string.import_tab_direct)); + mTabsAdapter.addTab(ImportKeysKeybaseFragment.class, + null, getString(R.string.import_tab_keybase)); + } + + // update layout after operations + mSlidingTabLayout.setViewPager(mViewPager); + mViewPager.setCurrentItem(mSwitchToTab); } @@ -338,35 +334,52 @@ public class ImportKeysActivity extends ActionBarActivity { Log.d(Constants.TAG, "fingerprint: " + fingerprint); - loadFromFingerprint(savedInstanceState, fingerprint); + // TODO: reload fragment when coming from qr code! +// loadFromFingerprint(savedInstanceState, fingerprint); + + +// String query = "0x" + fingerprint; +// +// // display keyserver fragment with query +// Bundle serverBundle = new Bundle(); +// serverBundle.putString(ImportKeysServerFragment.ARG_QUERY, query); +// serverBundle.putBoolean(ImportKeysServerFragment.ARG_DISABLE_QUERY_EDIT, true); +// +// return serverBundle; } - public void loadFromFingerprint(Bundle savedInstanceState, String fingerprint) { + private boolean isFingerprintValid(String fingerprint) { if (fingerprint == null || fingerprint.length() < 40) { SuperCardToast toast = SuperCardToast.create(this, getString(R.string.import_qr_code_too_short_fingerprint), SuperToast.Duration.LONG); toast.setBackground(SuperToast.Background.RED); toast.show(); - return; + return false; + } else { + return true; } + } - String query = "0x" + fingerprint; - - // display keyserver fragment with query - Bundle args = new Bundle(); - args.putString(ImportKeysServerFragment.ARG_QUERY, query); - args.putBoolean(ImportKeysServerFragment.ARG_DISABLE_QUERY_EDIT, true); -// loadNavFragment(NAV_SERVER, args); + /** + * Scroll ViewPager left and right + * + * @param event + * @return + */ + @Override + public boolean onTouchEvent(MotionEvent event) { + boolean result = super.onTouchEvent(event); - //TODO + if (!result) { + mViewPager.onTouchEvent(event); + } - // action: search directly - startListFragment(savedInstanceState, null, null, query); + return result; } - public void loadCallback(byte[] importData, Uri dataUri, String serverQuery, String keyServer, String keybaseQuery) { - mListFragment.loadNew(importData, dataUri, serverQuery, keyServer, keybaseQuery); + public void loadCallback(ImportKeysListFragment.LoaderState loaderState) { + mListFragment.loadNew(loaderState); } /** @@ -477,7 +490,8 @@ public class ImportKeysActivity extends ActionBarActivity { } }; - if (mListFragment.getKeyBytes() != null || mListFragment.getDataUri() != null) { + ImportKeysListFragment.LoaderState ls = mListFragment.getLoaderState(); + if (ls instanceof ImportKeysListFragment.BytesLoaderState) { Log.d(Constants.TAG, "importKeys started"); // Send all information needed to service to import key in other thread @@ -503,7 +517,9 @@ public class ImportKeysActivity extends ActionBarActivity { // start service with intent startService(intent); - } else if (mListFragment.getServerQuery() != null) { + } else if (ls instanceof ImportKeysListFragment.KeyserverLoaderState) { + ImportKeysListFragment.KeyserverLoaderState sls = (ImportKeysListFragment.KeyserverLoaderState) ls; + // Send all information needed to service to query keys in other thread Intent intent = new Intent(this, KeychainIntentService.class); @@ -512,7 +528,7 @@ public class ImportKeysActivity extends ActionBarActivity { // fill values for this action Bundle data = new Bundle(); - data.putString(KeychainIntentService.DOWNLOAD_KEY_SERVER, mListFragment.getKeyServer()); + data.putString(KeychainIntentService.DOWNLOAD_KEY_SERVER, sls.keyserver); // get selected key entries ArrayList<ImportKeysListEntry> selectedEntries = mListFragment.getSelectedEntries(); @@ -529,7 +545,7 @@ public class ImportKeysActivity extends ActionBarActivity { // start service with intent startService(intent); - } else if (mListFragment.getKeybaseQuery() != null) { + } else if (ls instanceof ImportKeysListFragment.KeybaseLoaderState) { // Send all information needed to service to query keys in other thread Intent intent = new Intent(this, KeychainIntentService.class); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysFileFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysFileFragment.java index 060e9bab2..60e5324c5 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysFileFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysFileFragment.java @@ -85,7 +85,7 @@ public class ImportKeysFileFragment extends Fragment { return; } } - mImportActivity.loadCallback(sendText.getBytes(), null, null, null, null); + mImportActivity.loadCallback(new ImportKeysListFragment.BytesLoaderState(sendText.getBytes(), null)); } }); @@ -107,7 +107,7 @@ public class ImportKeysFileFragment extends Fragment { if (resultCode == Activity.RESULT_OK && data != null) { // load data - mImportActivity.loadCallback(null, data.getData(), null, null, null); + mImportActivity.loadCallback(new ImportKeysListFragment.BytesLoaderState(null, data.getData())); } break; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysKeybaseFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysKeybaseFragment.java index 9264829ea..3a82bdc32 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysKeybaseFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysKeybaseFragment.java @@ -117,6 +117,6 @@ public class ImportKeysKeybaseFragment extends Fragment { } private void search(String query) { - mImportActivity.loadCallback(null, null, null, null, query); + mImportActivity.loadCallback(new ImportKeysListFragment.KeybaseLoaderState(query)); } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java index 7d8dc4a6c..cba6dd78f 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java @@ -27,8 +27,6 @@ import android.support.v4.util.LongSparseArray; import android.view.View; import android.widget.ListView; -import com.devspark.appmsg.AppMsg; - import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.helper.Preferences; @@ -60,11 +58,7 @@ public class ImportKeysListFragment extends ListFragment implements private Activity mActivity; private ImportKeysAdapter mAdapter; - private byte[] mKeyBytes; - private Uri mDataUri; - private String mServerQuery; - private String mKeyServer; - private String mKeybaseQuery; + private LoaderState mLoaderState; private static final int LOADER_ID_BYTES = 0; private static final int LOADER_ID_SERVER_QUERY = 1; @@ -72,24 +66,8 @@ public class ImportKeysListFragment extends ListFragment implements private LongSparseArray<ParcelableKeyRing> mCachedKeyData; - public byte[] getKeyBytes() { - return mKeyBytes; - } - - public Uri getDataUri() { - return mDataUri; - } - - public String getServerQuery() { - return mServerQuery; - } - - public String getKeybaseQuery() { - return mKeybaseQuery; - } - - public String getKeyServer() { - return mKeyServer; + public LoaderState getLoaderState() { + return mLoaderState; } public List<ImportKeysListEntry> getData() { @@ -124,6 +102,37 @@ public class ImportKeysListFragment extends ListFragment implements return frag; } + static public class LoaderState { + } + + static public class BytesLoaderState extends LoaderState { + byte[] keyBytes; + Uri dataUri; + + BytesLoaderState(byte[] keyBytes, Uri dataUri) { + this.keyBytes = keyBytes; + this.dataUri = dataUri; + } + } + + static public class KeyserverLoaderState extends LoaderState { + String serverQuery; + String keyserver; + + KeyserverLoaderState(String serverQuery, String keyserver) { + this.serverQuery = serverQuery; + this.keyserver = keyserver; + } + } + + static public class KeybaseLoaderState extends LoaderState { + String keybaseQuery; + + KeybaseLoaderState(String keybaseQuery) { + this.keybaseQuery = keybaseQuery; + } + } + /** * Define Adapter and Loader on create of Activity */ @@ -140,43 +149,20 @@ public class ImportKeysListFragment extends ListFragment implements mAdapter = new ImportKeysAdapter(mActivity); setListAdapter(mAdapter); - mDataUri = getArguments().getParcelable(ARG_DATA_URI); - mKeyBytes = getArguments().getByteArray(ARG_BYTES); - mServerQuery = getArguments().getString(ARG_SERVER_QUERY); - - // TODO: this is used when scanning QR Code. Currently it simply uses keyserver nr 0 - mKeyServer = Preferences.getPreferences(getActivity()) - .getKeyServers()[0]; - - if (mDataUri != null || mKeyBytes != null) { - // Start out with a progress indicator. - setListShown(false); - - // Prepare the loader. Either re-connect with an existing one, - // or start a new one. - // give arguments to onCreateLoader() - getLoaderManager().initLoader(LOADER_ID_BYTES, null, this); - } - - if (mServerQuery != null && mKeyServer != null) { - // Start out with a progress indicator. - setListShown(false); - - // Prepare the loader. Either re-connect with an existing one, - // or start a new one. - // give arguments to onCreateLoader() - getLoaderManager().initLoader(LOADER_ID_SERVER_QUERY, null, this); + if (getArguments().containsKey(ARG_DATA_URI) || getArguments().containsKey(ARG_BYTES)) { + Uri dataUri = getArguments().getParcelable(ARG_DATA_URI); + byte[] bytes = getArguments().getByteArray(ARG_BYTES); + mLoaderState = new BytesLoaderState(bytes, dataUri); + } else if (getArguments().containsKey(ARG_SERVER_QUERY)) { + String query = getArguments().getString(ARG_SERVER_QUERY); + // TODO: this is used when scanning QR Code or updating a key. + // Currently it simply uses keyserver nr 0 + String keyserver = Preferences.getPreferences(getActivity()) + .getKeyServers()[0]; + mLoaderState = new KeyserverLoaderState(query, keyserver); } - if (mKeybaseQuery != null) { - // Start out with a progress indicator. - setListShown(false); - - // Prepare the loader. Either re-connect with an existing one, - // or start a new one. - // give arguments to onCreateLoader() - getLoaderManager().initLoader(LOADER_ID_KEYBASE, null, this); - } + restartLoaders(); } @Override @@ -192,31 +178,33 @@ public class ImportKeysListFragment extends ListFragment implements mAdapter.notifyDataSetChanged(); } - public void loadNew(byte[] keyBytes, Uri dataUri, String serverQuery, String keyServer, String keybaseQuery) { - mKeyBytes = keyBytes; - mDataUri = dataUri; - mServerQuery = serverQuery; - mKeyServer = keyServer; - mKeybaseQuery = keybaseQuery; + public void loadNew(LoaderState loaderState) { + mLoaderState = loaderState; + + restartLoaders(); + } - if (mKeyBytes != null || mDataUri != null) { + private void restartLoaders() { + if (mLoaderState instanceof BytesLoaderState) { // Start out with a progress indicator. setListShown(false); getLoaderManager().restartLoader(LOADER_ID_BYTES, null, this); - } - - if (mServerQuery != null && mKeyServer != null) { + getLoaderManager().destroyLoader(LOADER_ID_SERVER_QUERY); + getLoaderManager().destroyLoader(LOADER_ID_KEYBASE); + } else if (mLoaderState instanceof KeyserverLoaderState) { // Start out with a progress indicator. setListShown(false); + getLoaderManager().destroyLoader(LOADER_ID_BYTES); getLoaderManager().restartLoader(LOADER_ID_SERVER_QUERY, null, this); - } - - if (mKeybaseQuery != null) { + getLoaderManager().destroyLoader(LOADER_ID_KEYBASE); + } else if (mLoaderState instanceof KeybaseLoaderState) { // Start out with a progress indicator. setListShown(false); + getLoaderManager().destroyLoader(LOADER_ID_BYTES); + getLoaderManager().destroyLoader(LOADER_ID_SERVER_QUERY); getLoaderManager().restartLoader(LOADER_ID_KEYBASE, null, this); } } @@ -226,14 +214,17 @@ public class ImportKeysListFragment extends ListFragment implements onCreateLoader(int id, Bundle args) { switch (id) { case LOADER_ID_BYTES: { - InputData inputData = getInputData(mKeyBytes, mDataUri); + BytesLoaderState ls = (BytesLoaderState) mLoaderState; + InputData inputData = getInputData(ls.keyBytes, ls.dataUri); return new ImportKeysListLoader(mActivity, inputData); } case LOADER_ID_SERVER_QUERY: { - return new ImportKeysListServerLoader(getActivity(), mServerQuery, mKeyServer); + KeyserverLoaderState ls = (KeyserverLoaderState) mLoaderState; + return new ImportKeysListServerLoader(getActivity(), ls.serverQuery, ls.keyserver); } case LOADER_ID_KEYBASE: { - return new ImportKeysListKeybaseLoader(getActivity(), mKeybaseQuery); + KeybaseLoaderState ls = (KeybaseLoaderState) mLoaderState; + return new ImportKeysListKeybaseLoader(getActivity(), ls.keybaseQuery); } default: @@ -280,7 +271,8 @@ public class ImportKeysListFragment extends ListFragment implements ((ImportKeysListLoader.NonPgpPart) error).getCount() + " " + getResources(). getQuantityString(R.plurals.error_import_non_pgp_part, ((ImportKeysListLoader.NonPgpPart) error).getCount()), - Notify.Style.OK); + Notify.Style.OK + ); } else { Notify.showNotify(getActivity(), R.string.error_generic_report_bug, Notify.Style.ERROR); } @@ -289,7 +281,6 @@ public class ImportKeysListFragment extends ListFragment implements case LOADER_ID_SERVER_QUERY: case LOADER_ID_KEYBASE: - // TODO: possibly fine-tune message building for these two cases if (error == null) { // No error } else if (error instanceof Keyserver.QueryTooShortException) { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysQrCodeFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysQrCodeFragment.java index 0cbb51c77..5766fc189 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysQrCodeFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysQrCodeFragment.java @@ -25,8 +25,6 @@ import android.support.v4.app.Fragment; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.ProgressBar; -import android.widget.TextView; import com.google.zxing.integration.android.IntentResult; @@ -36,18 +34,13 @@ import org.sufficientlysecure.keychain.util.IntentIntegratorSupportV4; import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.Notify; -import java.util.ArrayList; import java.util.Locale; public class ImportKeysQrCodeFragment extends Fragment { private ImportKeysActivity mImportActivity; - private View mNfcButton; + private View mNfcButton; private View mQrCodeButton; - private TextView mQrCodeText; - private ProgressBar mQrCodeProgress; - - private String[] mQrCodeContent; /** * Creates new instance of this fragment @@ -81,8 +74,6 @@ public class ImportKeysQrCodeFragment extends Fragment { }); mQrCodeButton = view.findViewById(R.id.import_qrcode_button); - mQrCodeText = (TextView) view.findViewById(R.id.import_qrcode_text); - mQrCodeProgress = (ProgressBar) view.findViewById(R.id.import_qrcode_progress); mQrCodeButton.setOnClickListener(new View.OnClickListener() { @@ -120,16 +111,9 @@ public class ImportKeysQrCodeFragment extends Fragment { return; } - // look if it is the whole key - String[] parts = scannedContent.split(","); - if (parts.length == 3) { - importParts(parts); - return; - } - // is this a full key encoded as qr code? if (scannedContent.startsWith("-----BEGIN PGP")) { - mImportActivity.loadCallback(scannedContent.getBytes(), null, null, null, null); + mImportActivity.loadCallback(new ImportKeysListFragment.BytesLoaderState(scannedContent.getBytes(), null)); return; } @@ -147,68 +131,8 @@ public class ImportKeysQrCodeFragment extends Fragment { } } - public void importFingerprint(Uri dataUri) { mImportActivity.loadFromFingerprintUri(null, dataUri); } - private void importParts(String[] parts) { - int counter = Integer.valueOf(parts[0]); - int size = Integer.valueOf(parts[1]); - String content = parts[2]; - - Log.d(Constants.TAG, "" + counter); - Log.d(Constants.TAG, "" + size); - Log.d(Constants.TAG, "" + content); - - // first qr code -> setup - if (counter == 0) { - mQrCodeContent = new String[size]; - mQrCodeProgress.setMax(size); - mQrCodeProgress.setVisibility(View.VISIBLE); - mQrCodeText.setVisibility(View.VISIBLE); - } - - if (mQrCodeContent == null || counter > mQrCodeContent.length) { - Notify.showNotify(getActivity(), R.string.import_qr_code_start_with_one, Notify.Style.ERROR); - return; - } - - // save scanned content - mQrCodeContent[counter] = content; - - // get missing numbers - ArrayList<Integer> missing = new ArrayList<Integer>(); - for (int i = 0; i < mQrCodeContent.length; i++) { - if (mQrCodeContent[i] == null) { - missing.add(i); - } - } - - // update progress and text - int alreadyScanned = mQrCodeContent.length - missing.size(); - mQrCodeProgress.setProgress(alreadyScanned); - - String missingString = ""; - for (int m : missing) { - if (!missingString.equals("")) { - missingString += ", "; - } - missingString += String.valueOf(m + 1); - } - - String missingText = getResources().getQuantityString(R.plurals.import_qr_code_missing, - missing.size(), missingString); - mQrCodeText.setText(missingText); - - // finished! - if (missing.size() == 0) { - mQrCodeText.setText(R.string.import_qr_code_finished); - String result = ""; - for (String in : mQrCodeContent) { - result += in; - } - mImportActivity.loadCallback(result.getBytes(), null, null, null, null); - } - } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysServerFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysServerFragment.java index eabc8348c..c7467d789 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysServerFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysServerFragment.java @@ -170,8 +170,8 @@ public class ImportKeysServerFragment extends Fragment { mImportActivity = (ImportKeysActivity) activity; } - private void search(String query, String keyServer) { - mImportActivity.loadCallback(null, null, query, keyServer, null); + private void search(String query, String keyserver) { + mImportActivity.loadCallback(new ImportKeysListFragment.KeyserverLoaderState(query, keyserver)); } } diff --git a/OpenKeychain/src/main/res/drawable-hdpi/ic_action_nfc.png b/OpenKeychain/src/main/res/drawable-hdpi/ic_action_nfc.png Binary files differnew file mode 100644 index 000000000..635633709 --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-hdpi/ic_action_nfc.png diff --git a/OpenKeychain/src/main/res/drawable-hdpi/ic_action_qr_code.png b/OpenKeychain/src/main/res/drawable-hdpi/ic_action_qr_code.png Binary files differindex e15a055db..1c65e5af8 100644 --- a/OpenKeychain/src/main/res/drawable-hdpi/ic_action_qr_code.png +++ b/OpenKeychain/src/main/res/drawable-hdpi/ic_action_qr_code.png diff --git a/OpenKeychain/src/main/res/drawable-hdpi/icon.png b/OpenKeychain/src/main/res/drawable-hdpi/ic_launcher.png Binary files differindex f5487599b..f5487599b 100644 --- a/OpenKeychain/src/main/res/drawable-hdpi/icon.png +++ b/OpenKeychain/src/main/res/drawable-hdpi/ic_launcher.png diff --git a/OpenKeychain/src/main/res/drawable-ldpi/icon.png b/OpenKeychain/src/main/res/drawable-ldpi/ic_launcher.png Binary files differindex 7cd482bff..7cd482bff 100644 --- a/OpenKeychain/src/main/res/drawable-ldpi/icon.png +++ b/OpenKeychain/src/main/res/drawable-ldpi/ic_launcher.png diff --git a/OpenKeychain/src/main/res/drawable-mdpi/ic_action_nfc.png b/OpenKeychain/src/main/res/drawable-mdpi/ic_action_nfc.png Binary files differnew file mode 100644 index 000000000..da5e267d0 --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-mdpi/ic_action_nfc.png diff --git a/OpenKeychain/src/main/res/drawable-mdpi/ic_action_qr_code.png b/OpenKeychain/src/main/res/drawable-mdpi/ic_action_qr_code.png Binary files differindex 1c65e5af8..570212461 100644 --- a/OpenKeychain/src/main/res/drawable-mdpi/ic_action_qr_code.png +++ b/OpenKeychain/src/main/res/drawable-mdpi/ic_action_qr_code.png diff --git a/OpenKeychain/src/main/res/drawable-mdpi/icon.png b/OpenKeychain/src/main/res/drawable-mdpi/ic_launcher.png Binary files differindex 34f1420ac..34f1420ac 100644 --- a/OpenKeychain/src/main/res/drawable-mdpi/icon.png +++ b/OpenKeychain/src/main/res/drawable-mdpi/ic_launcher.png diff --git a/OpenKeychain/src/main/res/drawable-xhdpi/ic_action_nfc.png b/OpenKeychain/src/main/res/drawable-xhdpi/ic_action_nfc.png Binary files differnew file mode 100644 index 000000000..ff569927c --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-xhdpi/ic_action_nfc.png diff --git a/OpenKeychain/src/main/res/drawable-xhdpi/ic_action_qr_code.png b/OpenKeychain/src/main/res/drawable-xhdpi/ic_action_qr_code.png Binary files differindex c56b128e4..ce8965396 100644 --- a/OpenKeychain/src/main/res/drawable-xhdpi/ic_action_qr_code.png +++ b/OpenKeychain/src/main/res/drawable-xhdpi/ic_action_qr_code.png diff --git a/OpenKeychain/src/main/res/drawable-xhdpi/icon.png b/OpenKeychain/src/main/res/drawable-xhdpi/ic_launcher.png Binary files differindex 32584f3ff..32584f3ff 100644 --- a/OpenKeychain/src/main/res/drawable-xhdpi/icon.png +++ b/OpenKeychain/src/main/res/drawable-xhdpi/ic_launcher.png diff --git a/OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_nfc.png b/OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_nfc.png Binary files differnew file mode 100644 index 000000000..1f96ce37b --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_nfc.png diff --git a/OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_qr_code.png b/OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_qr_code.png Binary files differindex c718aee0b..c56b128e4 100644 --- a/OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_qr_code.png +++ b/OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_qr_code.png diff --git a/OpenKeychain/src/main/res/drawable-xxhdpi/icon.png b/OpenKeychain/src/main/res/drawable-xxhdpi/ic_launcher.png Binary files differindex b2922309f..b2922309f 100644 --- a/OpenKeychain/src/main/res/drawable-xxhdpi/icon.png +++ b/OpenKeychain/src/main/res/drawable-xxhdpi/ic_launcher.png diff --git a/OpenKeychain/src/main/res/drawable-xxxhdpi/icon.png b/OpenKeychain/src/main/res/drawable-xxxhdpi/ic_launcher.png Binary files differindex 93ea6b0f5..93ea6b0f5 100644 --- a/OpenKeychain/src/main/res/drawable-xxxhdpi/icon.png +++ b/OpenKeychain/src/main/res/drawable-xxxhdpi/ic_launcher.png diff --git a/OpenKeychain/src/main/res/layout/api_app_settings_fragment.xml b/OpenKeychain/src/main/res/layout/api_app_settings_fragment.xml index 96271d418..ceea1d8a6 100644 --- a/OpenKeychain/src/main/res/layout/api_app_settings_fragment.xml +++ b/OpenKeychain/src/main/res/layout/api_app_settings_fragment.xml @@ -22,7 +22,7 @@ android:layout_alignParentBottom="true" android:layout_alignParentTop="true" android:layout_marginRight="6dp" - android:src="@drawable/icon" /> + android:src="@drawable/ic_launcher" /> <TextView android:id="@+id/api_app_settings_app_name" diff --git a/OpenKeychain/src/main/res/layout/api_apps_adapter_list_item.xml b/OpenKeychain/src/main/res/layout/api_apps_adapter_list_item.xml index e70a79589..543f7d675 100644 --- a/OpenKeychain/src/main/res/layout/api_apps_adapter_list_item.xml +++ b/OpenKeychain/src/main/res/layout/api_apps_adapter_list_item.xml @@ -11,7 +11,7 @@ android:layout_height="48dp" android:layout_marginLeft="8dp" android:layout_centerVertical="true" - android:src="@drawable/icon" /> + android:src="@drawable/ic_launcher" /> <TextView android:id="@+id/api_apps_adapter_item_name" diff --git a/OpenKeychain/src/main/res/layout/help_about_fragment.xml b/OpenKeychain/src/main/res/layout/help_about_fragment.xml index 71788e720..6afab2e12 100644 --- a/OpenKeychain/src/main/res/layout/help_about_fragment.xml +++ b/OpenKeychain/src/main/res/layout/help_about_fragment.xml @@ -28,7 +28,7 @@ android:layout_height="wrap_content" android:layout_gravity="top" android:layout_marginRight="10dp" - android:src="@drawable/icon" /> + android:src="@drawable/ic_launcher" /> </LinearLayout> <LinearLayout diff --git a/OpenKeychain/src/main/res/layout/import_keys_keybase_fragment.xml b/OpenKeychain/src/main/res/layout/import_keys_keybase_fragment.xml index bf00b77e7..062289688 100644 --- a/OpenKeychain/src/main/res/layout/import_keys_keybase_fragment.xml +++ b/OpenKeychain/src/main/res/layout/import_keys_keybase_fragment.xml @@ -18,22 +18,13 @@ android:lines="1" android:maxLines="1" android:minLines="1" - android:layout_marginRight="8dp" android:layout_gravity="center_vertical" /> - <View - android:layout_width="1dip" - android:layout_height="match_parent" - android:gravity="right" - android:layout_marginBottom="8dp" - android:layout_marginTop="8dp" - android:background="?android:attr/listDivider" /> - <ImageButton android:id="@+id/import_keybase_search" android:layout_width="wrap_content" android:layout_height="match_parent" - android:padding="16dp" + android:padding="8dp" android:src="@drawable/ic_action_search" android:layout_gravity="center_vertical" style="@style/SelectableItem" /> diff --git a/OpenKeychain/src/main/res/layout/import_keys_qr_code_fragment.xml b/OpenKeychain/src/main/res/layout/import_keys_qr_code_fragment.xml index 09a31b4a8..1cc414dab 100644 --- a/OpenKeychain/src/main/res/layout/import_keys_qr_code_fragment.xml +++ b/OpenKeychain/src/main/res/layout/import_keys_qr_code_fragment.xml @@ -33,34 +33,15 @@ android:layout_marginTop="8dp" android:background="?android:attr/listDivider" /> - <Button + <ImageButton android:id="@+id/import_nfc_button" android:layout_width="wrap_content" android:layout_height="match_parent" android:padding="8dp" - android:text="NFC?" + android:src="@drawable/ic_action_nfc" android:layout_gravity="center_vertical" style="@style/SelectableItem" /> </LinearLayout> - <TextView - android:id="@+id/import_qrcode_text" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:paddingLeft="16dp" - android:paddingRight="16dp" - android:paddingTop="8dp" - android:visibility="gone" /> - - <ProgressBar - android:id="@+id/import_qrcode_progress" - style="?android:attr/progressBarStyleHorizontal" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingLeft="16dp" - android:paddingRight="16dp" - android:progress="0" - android:visibility="gone" /> - </LinearLayout>
\ No newline at end of file diff --git a/OpenKeychain/src/main/res/layout/import_keys_server_fragment.xml b/OpenKeychain/src/main/res/layout/import_keys_server_fragment.xml index 7562eaa9b..47c354c53 100644 --- a/OpenKeychain/src/main/res/layout/import_keys_server_fragment.xml +++ b/OpenKeychain/src/main/res/layout/import_keys_server_fragment.xml @@ -23,22 +23,13 @@ android:lines="1" android:maxLines="1" android:minLines="1" - android:layout_marginRight="8dp" android:layout_gravity="center_vertical" /> - <View - android:layout_width="1dip" - android:layout_height="match_parent" - android:gravity="right" - android:layout_marginBottom="8dp" - android:layout_marginTop="8dp" - android:background="?android:attr/listDivider" /> - <ImageButton android:id="@+id/import_server_search" android:layout_width="wrap_content" android:layout_height="match_parent" - android:padding="16dp" + android:padding="8dp" android:src="@drawable/ic_action_search" android:layout_gravity="center_vertical" style="@style/SelectableItem" /> diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml index 3221cd9cd..e24ac6925 100644 --- a/OpenKeychain/src/main/res/values/strings.xml +++ b/OpenKeychain/src/main/res/values/strings.xml @@ -578,13 +578,14 @@ <string name="msg_kc_sub_bad_keyid">Subkey binding issuer id mismatch</string> <string name="msg_kc_sub_bad_time">Removing subkey binding certificate with future timestamp</string> <string name="msg_kc_sub_bad_type">Unknown subkey certificate type: %s</string> + <string name="msg_kc_sub_dup">Removing redundant subkey binding certificate</string> <string name="msg_kc_sub_primary_bad">Removing subkey binding certificate due to invalid primary binding certificate</string> <string name="msg_kc_sub_primary_bad_err">Removing subkey binding certificate due to bad primary binding certificate</string> <string name="msg_kc_sub_primary_none">Removing subkey binding certificate due to missing primary binding certificate</string> <string name="msg_kc_sub_no_cert">No valid certificate found for %s, removing from ring</string> - <string name="msg_kc_sub_revoke_bad_err">Removing bad subkey revocation key</string> - <string name="msg_kc_sub_revoke_bad">Removing bad subkey revocation key</string> - <string name="msg_kc_sub_revoke_dup">Removing redundant keyring revocation key</string> + <string name="msg_kc_sub_revoke_bad_err">Removing bad subkey revocation certificate</string> + <string name="msg_kc_sub_revoke_bad">Removing bad subkey revocation certificate</string> + <string name="msg_kc_sub_revoke_dup">Removing redundant subkey revocation certificate</string> <string name="msg_kc_success">Keyring canonicalization successful, no changes</string> <string name="msg_kc_success_bad">Keyring canonicalization successful, removed %s erroneous certificates</string> <string name="msg_kc_success_bad_and_red">Keyring canonicalization successful, removed %1$s erroneous and %2$s redundant certificates</string> diff --git a/OpenKeychain/src/main/res/xml/account_desc.xml b/OpenKeychain/src/main/res/xml/account_desc.xml index 94ffdf40b..a6989e9ef 100644 --- a/OpenKeychain/src/main/res/xml/account_desc.xml +++ b/OpenKeychain/src/main/res/xml/account_desc.xml @@ -2,5 +2,5 @@ <account-authenticator xmlns:android="http://schemas.android.com/apk/res/android" android:accountType="org.sufficientlysecure.keychain" - android:icon="@drawable/icon" + android:icon="@drawable/ic_launcher" android:label="@string/app_name"/> |