From 9843bafafdcec1721b5715440011e5f7b72ac583 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ha=C3=9F?= Date: Mon, 3 Mar 2014 09:35:05 +0100 Subject: [PATCH 001/109] Added handler for FileHasNoContent exception, some clean up --- .../keychain/ui/ImportKeysListFragment.java | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java index 1118f0264..abc594b39 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java @@ -219,27 +219,34 @@ public class ImportKeysListFragment extends ListFragment implements } else { setListShownNoAnimation(true); } + + Exception error = data.getError(); + switch (loader.getId()) { case LOADER_ID_BYTES: + error = data.getError(); + + if(error instanceof ImportKeysListLoader.FileHasNoContent) { + AppMsg.makeText(getActivity(), R.string.error_import_file_no_content, + AppMsg.STYLE_ALERT).show(); + } break; case LOADER_ID_SERVER_QUERY: - Exception error = data.getError(); - - if(error == null){ + if(error == null) { AppMsg.makeText( getActivity(), getResources().getQuantityString(R.plurals.keys_found, mAdapter.getCount(), mAdapter.getCount()), AppMsg.STYLE_INFO ).show(); - } else if(error instanceof KeyServer.InsufficientQuery){ + } else if(error instanceof KeyServer.InsufficientQuery) { AppMsg.makeText(getActivity(), R.string.error_keyserver_insufficient_query, AppMsg.STYLE_ALERT).show(); - }else if(error instanceof KeyServer.QueryException){ + } else if(error instanceof KeyServer.QueryException) { AppMsg.makeText(getActivity(), R.string.error_keyserver_query, AppMsg.STYLE_ALERT).show(); - }else if(error instanceof KeyServer.TooManyResponses){ + } else if(error instanceof KeyServer.TooManyResponses) { AppMsg.makeText(getActivity(), R.string.error_keyserver_too_many_responses, AppMsg.STYLE_ALERT).show(); } From f484122c353aa66dbc1a3a776163eaa28d70e4d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ha=C3=9F?= Date: Mon, 3 Mar 2014 09:36:10 +0100 Subject: [PATCH 002/109] Added exception for empty files --- .../ui/adapter/ImportKeysListLoader.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java index 29e418db7..bc8e4d050 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java @@ -33,7 +33,14 @@ import org.sufficientlysecure.keychain.util.PositionAwareInputStream; import android.content.Context; import android.support.v4.content.AsyncTaskLoader; +import com.devspark.appmsg.AppMsg; + public class ImportKeysListLoader extends AsyncTaskLoader>> { + + public static class FileHasNoContent extends Exception { + + } + Context mContext; InputData mInputData; @@ -92,6 +99,9 @@ public class ImportKeysListLoader extends AsyncTaskLoader 0) { + isEmpty = false; InputStream in = PGPUtil.getDecoderStream(bufferedInput); PGPObjectFactory objectFactory = new PGPObjectFactory(in); @@ -120,7 +131,12 @@ public class ImportKeysListLoader extends AsyncTaskLoader>(data, new FileHasNoContent()); } } From 6362b2de94c43eca9562af832fa0cfa77d93fbe5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ha=C3=9F?= Date: Mon, 3 Mar 2014 09:36:40 +0100 Subject: [PATCH 003/109] Added FileHasNoContent string --- OpenPGP-Keychain/src/main/res/values/strings.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenPGP-Keychain/src/main/res/values/strings.xml b/OpenPGP-Keychain/src/main/res/values/strings.xml index 91359701f..e8dc05f3b 100644 --- a/OpenPGP-Keychain/src/main/res/values/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values/strings.xml @@ -289,6 +289,7 @@ Insufficient server query Querying keyserver failed Too many responses + File has no content Please delete it from the \'My Keys\' screen! Please delete them from the \'My Keys\' screen! From ec8a3469fff2718e47f6214f5364a13d84664967 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ha=C3=9F?= Date: Mon, 3 Mar 2014 15:07:07 +0100 Subject: [PATCH 004/109] Little fixes --- .../sufficientlysecure/keychain/ui/ImportKeysListFragment.java | 1 - .../keychain/ui/adapter/ImportKeysListLoader.java | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java index abc594b39..009c26ce5 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java @@ -224,7 +224,6 @@ public class ImportKeysListFragment extends ListFragment implements switch (loader.getId()) { case LOADER_ID_BYTES: - error = data.getError(); if(error instanceof ImportKeysListLoader.FileHasNoContent) { AppMsg.makeText(getActivity(), R.string.error_import_file_no_content, diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java index bc8e4d050..19b17468b 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java @@ -131,7 +131,7 @@ public class ImportKeysListLoader extends AsyncTaskLoader Date: Mon, 3 Mar 2014 20:42:38 +0100 Subject: [PATCH 005/109] Added handling for other exceptions in the ImportListLoader. --- .../keychain/ui/ImportKeysListFragment.java | 9 +++++++ .../ui/adapter/ImportKeysListLoader.java | 25 ++++++++++++++++--- .../src/main/res/values/strings.xml | 5 ++++ 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java index 009c26ce5..06925e5fa 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java @@ -228,6 +228,15 @@ public class ImportKeysListFragment extends ListFragment implements if(error instanceof ImportKeysListLoader.FileHasNoContent) { AppMsg.makeText(getActivity(), R.string.error_import_file_no_content, AppMsg.STYLE_ALERT).show(); + } else if(error instanceof ImportKeysListLoader.NonPGPPart) { + AppMsg.makeText(getActivity(), + ((ImportKeysListLoader.NonPGPPart) error).getCount() + " " + getResources(). + getQuantityString(R.plurals.error_import_non_pgp_part, + ((ImportKeysListLoader.NonPGPPart) error).getCount()), + new AppMsg.Style(AppMsg.LENGTH_LONG, R.color.confirm)).show(); + } else { + AppMsg.makeText(getActivity(), R.string.error_generic_report_bug, + new AppMsg.Style(AppMsg.LENGTH_LONG, R.color.alert)).show(); } break; diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java index 19b17468b..98884689c 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java @@ -20,7 +20,6 @@ package org.sufficientlysecure.keychain.ui.adapter; import java.io.BufferedInputStream; import java.io.InputStream; import java.util.ArrayList; -import java.util.List; import org.spongycastle.openpgp.PGPKeyRing; import org.spongycastle.openpgp.PGPObjectFactory; @@ -33,14 +32,22 @@ import org.sufficientlysecure.keychain.util.PositionAwareInputStream; import android.content.Context; import android.support.v4.content.AsyncTaskLoader; -import com.devspark.appmsg.AppMsg; - public class ImportKeysListLoader extends AsyncTaskLoader>> { public static class FileHasNoContent extends Exception { } + public static class NonPGPPart extends Exception { + private int count; + public NonPGPPart(int count) { + this.count = count; + } + public int getCount() { + return count; + } + } + Context mContext; InputData mInputData; @@ -101,6 +108,7 @@ public class ImportKeysListLoader extends AsyncTaskLoader>(data, e); + nonPGPcounter = 0; } if(isEmpty) { Log.e(Constants.TAG, "File has no content!", new FileHasNoContent()); - entryListWrapper = new AsyncTaskResultWrapper>(data, new FileHasNoContent()); + entryListWrapper = new AsyncTaskResultWrapper> + (data, new FileHasNoContent()); + } + + if(nonPGPcounter > 0) { + entryListWrapper = new AsyncTaskResultWrapper> + (data, new NonPGPPart(nonPGPcounter)); } } diff --git a/OpenPGP-Keychain/src/main/res/values/strings.xml b/OpenPGP-Keychain/src/main/res/values/strings.xml index e8dc05f3b..14ed7c7da 100644 --- a/OpenPGP-Keychain/src/main/res/values/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values/strings.xml @@ -290,10 +290,15 @@ Querying keyserver failed Too many responses File has no content + A generic error occurred, please create a new bug report for OpenKeychain. Please delete it from the \'My Keys\' screen! Please delete them from the \'My Keys\' screen! + + part of the loaded file is a valid OpenPGP object but not a OpenPGP key + parts of the loaded file are valid OpenPGP objects but not OpenPGP keys + done. From a12b67c538a1934a35c45fbed3569056a786df67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ha=C3=9F?= Date: Tue, 4 Mar 2014 13:56:46 +0100 Subject: [PATCH 006/109] Added exception is null option to display nothing if no error occured --- .../keychain/ui/ImportKeysListFragment.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java index 06925e5fa..a6917d6f4 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysListFragment.java @@ -225,14 +225,16 @@ public class ImportKeysListFragment extends ListFragment implements switch (loader.getId()) { case LOADER_ID_BYTES: - if(error instanceof ImportKeysListLoader.FileHasNoContent) { + if(error == null){ + // No error + } else if(error instanceof ImportKeysListLoader.FileHasNoContent) { AppMsg.makeText(getActivity(), R.string.error_import_file_no_content, AppMsg.STYLE_ALERT).show(); - } else if(error instanceof ImportKeysListLoader.NonPGPPart) { + } else if(error instanceof ImportKeysListLoader.NonPgpPart) { AppMsg.makeText(getActivity(), - ((ImportKeysListLoader.NonPGPPart) error).getCount() + " " + getResources(). + ((ImportKeysListLoader.NonPgpPart) error).getCount() + " " + getResources(). getQuantityString(R.plurals.error_import_non_pgp_part, - ((ImportKeysListLoader.NonPGPPart) error).getCount()), + ((ImportKeysListLoader.NonPgpPart) error).getCount()), new AppMsg.Style(AppMsg.LENGTH_LONG, R.color.confirm)).show(); } else { AppMsg.makeText(getActivity(), R.string.error_generic_report_bug, From 106027a7cd43001a2f9e620ee13ef60d39074c41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ha=C3=9F?= Date: Tue, 4 Mar 2014 13:58:26 +0100 Subject: [PATCH 007/109] Fixed some naming --- .../keychain/ui/adapter/ImportKeysListLoader.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java index 98884689c..7ca7bc998 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java @@ -38,9 +38,9 @@ public class ImportKeysListLoader extends AsyncTaskLoader>(data, e); - nonPGPcounter = 0; + nonPgpCounter = 0; } if(isEmpty) { @@ -151,9 +151,9 @@ public class ImportKeysListLoader extends AsyncTaskLoader 0) { + if(nonPgpCounter > 0) { entryListWrapper = new AsyncTaskResultWrapper> - (data, new NonPGPPart(nonPGPcounter)); + (data, new NonPgpPart(nonPgpCounter)); } } From 0a12c41ca96977188bf08d60e49cd266c7ba147a Mon Sep 17 00:00:00 2001 From: Miroojin Bakshi Date: Tue, 4 Mar 2014 18:45:06 +0530 Subject: [PATCH 008/109] Extend DatePickerDialog and override setTitle() method. --- .../keychain/ui/widget/KeyEditor.java | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java index 6c265057e..60f505858 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java @@ -114,7 +114,7 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener { date = new GregorianCalendar(TimeZone.getTimeZone("UTC")); } - DatePickerDialog dialog = new DatePickerDialog(getContext(), + DatePickerDialog dialog = new ExpiryDatePickerDialog(getContext(), mExpiryDateSetListener, date.get(Calendar.YEAR), date.get(Calendar.MONTH), date.get(Calendar.DAY_OF_MONTH)); mDatePickerResultCount = 0; @@ -253,3 +253,14 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener { } } + +class ExpiryDatePickerDialog extends DatePickerDialog { + + public ExpiryDatePickerDialog(Context context, OnDateSetListener callBack, int year, int monthOfYear, int dayOfMonth) { + super(context, callBack, year, monthOfYear, dayOfMonth); + } + + public void setTitle(CharSequence title) { + super.setTitle("Set date"); + } +} From 50813ef188aefb78166a001f57b1f09b538a6aef Mon Sep 17 00:00:00 2001 From: Miroojin Bakshi Date: Tue, 4 Mar 2014 19:20:56 +0530 Subject: [PATCH 009/109] Hide CalendarView in tablets --- .../org/sufficientlysecure/keychain/ui/widget/KeyEditor.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java index 60f505858..b88d3bd32 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java @@ -129,6 +129,9 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener { } } }); + //setCalendarViewShown() is supported from API 11 onwards. + if (android.os.Build.VERSION.SDK_INT >= 11) + dialog.getDatePicker().setCalendarViewShown(false); dialog.show(); } }); From 89a4c38cc09425ac2e302882a63a30bdfe8a7e86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Tue, 4 Mar 2014 15:18:05 +0100 Subject: [PATCH 010/109] return SIGNATURE_SUCCESS_UNCERTIFIED from service --- OpenPGP-Keychain/src/main/AndroidManifest.xml | 3 ++- .../keychain/service/remote/OpenPgpService.java | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/OpenPGP-Keychain/src/main/AndroidManifest.xml b/OpenPGP-Keychain/src/main/AndroidManifest.xml index 749229115..cec1422d9 100644 --- a/OpenPGP-Keychain/src/main/AndroidManifest.xml +++ b/OpenPGP-Keychain/src/main/AndroidManifest.xml @@ -22,7 +22,8 @@ Remarks about the ugly android:pathPattern: - We are matching all files with a specific file ending. This is done in an ugly way because of Android limitations. - Read http://stackoverflow.com/questions/1733195/android-intent-filter-for-a-particular-file-extension and http://stackoverflow.com/questions/3400072/pathpattern-to-match-file-extension-does-not-work-if-a-period-exists-elsewhere-i/8599921 + Read http://stackoverflow.com/questions/1733195/android-intent-filter-for-a-particular-file-extension + and http://stackoverflow.com/questions/3400072/pathpattern-to-match-file-extension-does-not-work-if-a-period-exists-elsewhere-i/8599921 for more information. - Do _not_ set mimeType for gpg! Cyanogenmod's file manager will only show Keychain for gpg files if no mimeType is set! diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/OpenPgpService.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/OpenPgpService.java index 8c8e6f00a..5d2f5a815 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/OpenPgpService.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/OpenPgpService.java @@ -369,9 +369,10 @@ public class OpenPgpService extends RemoteService { boolean signatureOnly = outputBundle .getBoolean(KeychainIntentService.RESULT_CLEARTEXT_SIGNATURE_ONLY, false); + // TODO: SIGNATURE_SUCCESS_CERTIFIED is currently not implemented int signatureStatus = OpenPgpSignatureResult.SIGNATURE_ERROR; if (signatureSuccess) { - signatureStatus = OpenPgpSignatureResult.SIGNATURE_SUCCESS_CERTIFIED; + signatureStatus = OpenPgpSignatureResult.SIGNATURE_SUCCESS_UNCERTIFIED; } else if (signatureUnknown) { signatureStatus = OpenPgpSignatureResult.SIGNATURE_UNKNOWN_PUB_KEY; From 06f9134eb1c386446d56fe58fa49c35b7482ed86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Tue, 4 Mar 2014 20:53:44 +0100 Subject: [PATCH 011/109] Enforce private key for applications, verify signed-only texts without passphrase input, better internal decrypt and verify method --- .../openpgp/OpenPgpSignatureResult.java | 18 ++- .../keychain/pgp/PgpDecryptVerify.java | 137 ++++++++++++------ .../keychain/pgp/PgpDecryptVerifyResult.java | 88 +++++++++++ .../service/KeychainIntentService.java | 19 +-- .../service/remote/OpenPgpService.java | 109 +++----------- .../keychain/ui/DecryptActivity.java | 57 +++++--- 6 files changed, 266 insertions(+), 162 deletions(-) create mode 100644 OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyResult.java diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/OpenPgpSignatureResult.java b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/OpenPgpSignatureResult.java index 431d4be24..cb220cf6d 100644 --- a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/OpenPgpSignatureResult.java +++ b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/OpenPgpSignatureResult.java @@ -38,24 +38,40 @@ public class OpenPgpSignatureResult implements Parcelable { return status; } + public void setStatus(int status) { + this.status = status; + } + public boolean isSignatureOnly() { return signatureOnly; } + public void setSignatureOnly(boolean signatureOnly) { + this.signatureOnly = signatureOnly; + } + public String getUserId() { return userId; } + public void setUserId(String userId) { + this.userId = userId; + } + public long getKeyId() { return keyId; } + public void setKeyId(long keyId) { + this.keyId = keyId; + } + public OpenPgpSignatureResult() { } public OpenPgpSignatureResult(int signatureStatus, String signatureUserId, - boolean signatureOnly, long keyId) { + boolean signatureOnly, long keyId) { this.status = signatureStatus; this.signatureOnly = signatureOnly; this.userId = signatureUserId; diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java index fb97f3a5c..be80da4e3 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java @@ -18,8 +18,8 @@ package org.sufficientlysecure.keychain.pgp; import android.content.Context; -import android.os.Bundle; +import org.openintents.openpgp.OpenPgpSignatureResult; import org.spongycastle.bcpg.ArmoredInputStream; import org.spongycastle.bcpg.SignatureSubpacketTags; import org.spongycastle.openpgp.PGPCompressedData; @@ -36,6 +36,7 @@ import org.spongycastle.openpgp.PGPPublicKey; import org.spongycastle.openpgp.PGPPublicKeyEncryptedData; import org.spongycastle.openpgp.PGPPublicKeyRing; import org.spongycastle.openpgp.PGPSecretKey; +import org.spongycastle.openpgp.PGPSecretKeyRing; import org.spongycastle.openpgp.PGPSignature; import org.spongycastle.openpgp.PGPSignatureList; import org.spongycastle.openpgp.PGPSignatureSubpacketVector; @@ -53,7 +54,7 @@ import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException; import org.sufficientlysecure.keychain.provider.ProviderHelper; -import org.sufficientlysecure.keychain.service.KeychainIntentService; +import org.sufficientlysecure.keychain.service.PassphraseCacheService; import org.sufficientlysecure.keychain.util.InputData; import org.sufficientlysecure.keychain.util.Log; import org.sufficientlysecure.keychain.util.ProgressDialogUpdater; @@ -75,9 +76,10 @@ public class PgpDecryptVerify { private InputData data; private OutputStream outStream; - private ProgressDialogUpdater progress; - boolean assumeSymmetric; - String passphrase; + private ProgressDialogUpdater progressDialogUpdater; + private boolean assumeSymmetric; + private String passphrase; + private long enforcedKeyId; private PgpDecryptVerify(Builder builder) { // private Constructor can only be called from Builder @@ -85,9 +87,10 @@ public class PgpDecryptVerify { this.data = builder.data; this.outStream = builder.outStream; - this.progress = builder.progress; + this.progressDialogUpdater = builder.progressDialogUpdater; this.assumeSymmetric = builder.assumeSymmetric; this.passphrase = builder.passphrase; + this.enforcedKeyId = builder.enforcedKeyId; } public static class Builder { @@ -97,9 +100,10 @@ public class PgpDecryptVerify { private OutputStream outStream; // optional - private ProgressDialogUpdater progress = null; + private ProgressDialogUpdater progressDialogUpdater = null; private boolean assumeSymmetric = false; private String passphrase = ""; + private long enforcedKeyId = 0; public Builder(Context context, InputData data, OutputStream outStream) { this.context = context; @@ -107,8 +111,8 @@ public class PgpDecryptVerify { this.outStream = outStream; } - public Builder progress(ProgressDialogUpdater progress) { - this.progress = progress; + public Builder progressDialogUpdater(ProgressDialogUpdater progressDialogUpdater) { + this.progressDialogUpdater = progressDialogUpdater; return this; } @@ -122,20 +126,32 @@ public class PgpDecryptVerify { return this; } + /** + * Allow this key id alone for decryption. + * This means only ciphertexts encrypted for this private key can be decrypted. + * + * @param enforcedKeyId + * @return + */ + public Builder enforcedKeyId(long enforcedKeyId) { + this.enforcedKeyId = enforcedKeyId; + return this; + } + public PgpDecryptVerify build() { return new PgpDecryptVerify(this); } } public void updateProgress(int message, int current, int total) { - if (progress != null) { - progress.setProgress(message, current, total); + if (progressDialogUpdater != null) { + progressDialogUpdater.setProgress(message, current, total); } } public void updateProgress(int current, int total) { - if (progress != null) { - progress.setProgress(current, total); + if (progressDialogUpdater != null) { + progressDialogUpdater.setProgress(current, total); } } @@ -177,9 +193,8 @@ public class PgpDecryptVerify { * @throws PGPException * @throws SignatureException */ - public Bundle execute() + public PgpDecryptVerifyResult execute() throws IOException, PgpGeneralException, PGPException, SignatureException { - // automatically works with ascii armor input and binary InputStream in = PGPUtil.getDecoderStream(data.getInputStream()); if (in instanceof ArmoredInputStream) { @@ -207,9 +222,9 @@ public class PgpDecryptVerify { * @throws PGPException * @throws SignatureException */ - private Bundle decryptVerify(InputStream in) + private PgpDecryptVerifyResult decryptVerify(InputStream in) throws IOException, PgpGeneralException, PGPException, SignatureException { - Bundle returnData = new Bundle(); + PgpDecryptVerifyResult returnData = new PgpDecryptVerifyResult(); PGPObjectFactory pgpF = new PGPObjectFactory(in); PGPEncryptedDataList enc; @@ -277,9 +292,38 @@ public class PgpDecryptVerify { PGPPublicKeyEncryptedData encData = (PGPPublicKeyEncryptedData) obj; secretKey = ProviderHelper.getPGPSecretKeyByKeyId(context, encData.getKeyID()); if (secretKey != null) { + // secret key exists in database + + // allow only a specific key for decryption? + if (enforcedKeyId != 0) { + // TODO: improve this code! get master key directly! + PGPSecretKeyRing secretKeyRing = ProviderHelper.getPGPSecretKeyRingByKeyId(context, encData.getKeyID()); + long masterKeyId = PgpKeyHelper.getMasterKey(secretKeyRing).getKeyID(); + Log.d(Constants.TAG, "encData.getKeyID():" + encData.getKeyID()); + Log.d(Constants.TAG, "enforcedKeyId: " + enforcedKeyId); + Log.d(Constants.TAG, "masterKeyId: " + masterKeyId); + + if (enforcedKeyId != masterKeyId) { + throw new PgpGeneralException(context.getString(R.string.error_no_secret_key_found)); + } + } + pbe = encData; + + // passphrase handling... + if (passphrase == null) { + // try to get cached passphrase + passphrase = PassphraseCacheService.getCachedPassphrase(context, encData.getKeyID()); + } + // if passphrase was not cached, return here! + if (passphrase == null) { + returnData.setKeyPassphraseNeeded(true); + return returnData; + } break; } + + } } @@ -317,6 +361,7 @@ public class PgpDecryptVerify { PGPObjectFactory plainFact = new PGPObjectFactory(clear); Object dataChunk = plainFact.nextObject(); PGPOnePassSignature signature = null; + OpenPgpSignatureResult signatureResult = null; PGPPublicKey signatureKey = null; int signatureIndex = -1; @@ -334,7 +379,7 @@ public class PgpDecryptVerify { if (dataChunk instanceof PGPOnePassSignatureList) { updateProgress(R.string.progress_processing_signature, currentProgress, 100); - returnData.putBoolean(KeychainIntentService.RESULT_SIGNATURE, true); + signatureResult = new OpenPgpSignatureResult(); PGPOnePassSignatureList sigList = (PGPOnePassSignatureList) dataChunk; for (int i = 0; i < sigList.size(); ++i) { signature = sigList.get(i); @@ -354,12 +399,12 @@ public class PgpDecryptVerify { if (signKeyRing != null) { userId = PgpKeyHelper.getMainUserId(PgpKeyHelper.getMasterKey(signKeyRing)); } - returnData.putString(KeychainIntentService.RESULT_SIGNATURE_USER_ID, userId); + signatureResult.setUserId(userId); break; } } - returnData.putLong(KeychainIntentService.RESULT_SIGNATURE_KEY_ID, signatureKeyId); + signatureResult.setKeyId(signatureKeyId); if (signature != null) { JcaPGPContentVerifierBuilderProvider contentVerifierBuilderProvider = new JcaPGPContentVerifierBuilderProvider() @@ -367,7 +412,7 @@ public class PgpDecryptVerify { signature.init(contentVerifierBuilderProvider, signatureKey); } else { - returnData.putBoolean(KeychainIntentService.RESULT_SIGNATURE_UNKNOWN, true); + signatureResult.setStatus(OpenPgpSignatureResult.SIGNATURE_UNKNOWN_PUB_KEY); } dataChunk = plainFact.nextObject(); @@ -395,25 +440,24 @@ public class PgpDecryptVerify { } int n; - // TODO: progress calculation is broken here! Try to rework it based on commented code! -// int progress = 0; + // TODO: progressDialogUpdater calculation is broken here! Try to rework it based on commented code! +// int progressDialogUpdater = 0; long startPos = data.getStreamPosition(); while ((n = dataIn.read(buffer)) > 0) { outStream.write(buffer, 0, n); -// progress += n; +// progressDialogUpdater += n; if (signature != null) { try { signature.update(buffer, 0, n); } catch (SignatureException e) { - returnData - .putBoolean(KeychainIntentService.RESULT_SIGNATURE_SUCCESS, false); + signatureResult.setStatus(OpenPgpSignatureResult.SIGNATURE_ERROR); signature = null; } } // TODO: dead code?! - // unknown size, but try to at least have a moving, slowing down progress bar -// currentProgress = startProgress + (endProgress - startProgress) * progress -// / (progress + 100000); + // unknown size, but try to at least have a moving, slowing down progressDialogUpdater bar +// currentProgress = startProgress + (endProgress - startProgress) * progressDialogUpdater +// / (progressDialogUpdater + 100000); if (data.getSize() - startPos == 0) { currentProgress = endProgress; } else { @@ -430,17 +474,20 @@ public class PgpDecryptVerify { PGPSignature messageSignature = signatureList.get(signatureIndex); // these are not cleartext signatures! - returnData.putBoolean(KeychainIntentService.RESULT_CLEARTEXT_SIGNATURE_ONLY, false); + // TODO: what about binary signatures? + signatureResult.setSignatureOnly(false); //Now check binding signatures boolean keyBinding_isok = verifyKeyBinding(context, messageSignature, signatureKey); boolean sig_isok = signature.verify(messageSignature); - returnData.putBoolean(KeychainIntentService.RESULT_SIGNATURE_SUCCESS, keyBinding_isok & sig_isok); + // TODO: implement CERTIFIED! + if (keyBinding_isok & sig_isok) { + signatureResult.setStatus(OpenPgpSignatureResult.SIGNATURE_SUCCESS_UNCERTIFIED); + } } } - // TODO: test if this integrity really check works! if (encryptedData.isIntegrityProtected()) { updateProgress(R.string.progress_verifying_integrity, 95, 100); @@ -455,9 +502,12 @@ public class PgpDecryptVerify { } else { // no integrity check Log.e(Constants.TAG, "Encrypted data was not integrity protected!"); + // TODO: inform user? } updateProgress(R.string.progress_done, 100, 100); + + returnData.setSignatureResult(signatureResult); return returnData; } @@ -474,11 +524,12 @@ public class PgpDecryptVerify { * @throws PGPException * @throws SignatureException */ - private Bundle verifyCleartextSignature(ArmoredInputStream aIn) + private PgpDecryptVerifyResult verifyCleartextSignature(ArmoredInputStream aIn) throws IOException, PgpGeneralException, PGPException, SignatureException { - Bundle returnData = new Bundle(); + PgpDecryptVerifyResult returnData = new PgpDecryptVerifyResult(); + OpenPgpSignatureResult signatureResult = new OpenPgpSignatureResult(); // cleartext signatures are never encrypted ;) - returnData.putBoolean(KeychainIntentService.RESULT_CLEARTEXT_SIGNATURE_ONLY, true); + signatureResult.setSignatureOnly(true); ByteArrayOutputStream out = new ByteArrayOutputStream(); @@ -504,8 +555,6 @@ public class PgpDecryptVerify { byte[] clearText = out.toByteArray(); outStream.write(clearText); - returnData.putBoolean(KeychainIntentService.RESULT_SIGNATURE, true); - updateProgress(R.string.progress_processing_signature, 60, 100); PGPObjectFactory pgpFact = new PGPObjectFactory(aIn); @@ -533,15 +582,15 @@ public class PgpDecryptVerify { if (signKeyRing != null) { userId = PgpKeyHelper.getMainUserId(PgpKeyHelper.getMasterKey(signKeyRing)); } - returnData.putString(KeychainIntentService.RESULT_SIGNATURE_USER_ID, userId); + signatureResult.setUserId(userId); break; } } - returnData.putLong(KeychainIntentService.RESULT_SIGNATURE_KEY_ID, signatureKeyId); + signatureResult.setKeyId(signatureKeyId); if (signature == null) { - returnData.putBoolean(KeychainIntentService.RESULT_SIGNATURE_UNKNOWN, true); + signatureResult.setStatus(OpenPgpSignatureResult.SIGNATURE_UNKNOWN_PUB_KEY); updateProgress(R.string.progress_done, 100, 100); return returnData; } @@ -574,9 +623,15 @@ public class PgpDecryptVerify { //Now check binding signatures boolean keyBinding_isok = verifyKeyBinding(context, signature, signatureKey); - returnData.putBoolean(KeychainIntentService.RESULT_SIGNATURE_SUCCESS, sig_isok & keyBinding_isok); + if (sig_isok & keyBinding_isok) { + signatureResult.setStatus(OpenPgpSignatureResult.SIGNATURE_SUCCESS_UNCERTIFIED); + } + + // TODO: what about SIGNATURE_SUCCESS_CERTIFIED and SIGNATURE_ERROR???? updateProgress(R.string.progress_done, 100, 100); + + returnData.setSignatureResult(signatureResult); return returnData; } diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyResult.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyResult.java new file mode 100644 index 000000000..0477c4fdf --- /dev/null +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerifyResult.java @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2014 Dominik Schürmann + * + * 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 . + */ + +package org.sufficientlysecure.keychain.pgp; + +import android.os.Parcel; +import android.os.Parcelable; + +import org.openintents.openpgp.OpenPgpSignatureResult; + +public class PgpDecryptVerifyResult implements Parcelable { + boolean symmetricPassphraseNeeded; + boolean keyPassphraseNeeded; + OpenPgpSignatureResult signatureResult; + + public boolean isSymmetricPassphraseNeeded() { + return symmetricPassphraseNeeded; + } + + public void setSymmetricPassphraseNeeded(boolean symmetricPassphraseNeeded) { + this.symmetricPassphraseNeeded = symmetricPassphraseNeeded; + } + + public boolean isKeyPassphraseNeeded() { + return keyPassphraseNeeded; + } + + public void setKeyPassphraseNeeded(boolean keyPassphraseNeeded) { + this.keyPassphraseNeeded = keyPassphraseNeeded; + } + + public OpenPgpSignatureResult getSignatureResult() { + return signatureResult; + } + + public void setSignatureResult(OpenPgpSignatureResult signatureResult) { + this.signatureResult = signatureResult; + } + + public PgpDecryptVerifyResult() { + + } + + public PgpDecryptVerifyResult(PgpDecryptVerifyResult b) { + this.symmetricPassphraseNeeded = b.symmetricPassphraseNeeded; + this.keyPassphraseNeeded = b.keyPassphraseNeeded; + this.signatureResult = b.signatureResult; + } + + + public int describeContents() { + return 0; + } + + public void writeToParcel(Parcel dest, int flags) { + dest.writeByte((byte) (symmetricPassphraseNeeded ? 1 : 0)); + dest.writeByte((byte) (keyPassphraseNeeded ? 1 : 0)); + dest.writeParcelable(signatureResult, 0); + } + + public static final Creator CREATOR = new Creator() { + public PgpDecryptVerifyResult createFromParcel(final Parcel source) { + PgpDecryptVerifyResult vr = new PgpDecryptVerifyResult(); + vr.symmetricPassphraseNeeded = source.readByte() == 1; + vr.keyPassphraseNeeded = source.readByte() == 1; + vr.signatureResult = source.readParcelable(OpenPgpSignatureResult.class.getClassLoader()); + return vr; + } + + public PgpDecryptVerifyResult[] newArray(final int size) { + return new PgpDecryptVerifyResult[size]; + } + }; +} diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java index 302dbea0b..9c499ebd7 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java @@ -44,6 +44,7 @@ import org.sufficientlysecure.keychain.helper.OtherHelper; import org.sufficientlysecure.keychain.helper.Preferences; import org.sufficientlysecure.keychain.pgp.PgpConversionHelper; import org.sufficientlysecure.keychain.pgp.PgpDecryptVerify; +import org.sufficientlysecure.keychain.pgp.PgpDecryptVerifyResult; import org.sufficientlysecure.keychain.pgp.PgpHelper; import org.sufficientlysecure.keychain.pgp.PgpImportExport; import org.sufficientlysecure.keychain.pgp.PgpKeyOperation; @@ -181,13 +182,7 @@ public class KeychainIntentService extends IntentService implements ProgressDial // decrypt/verify public static final String RESULT_DECRYPTED_STRING = "decrypted_message"; public static final String RESULT_DECRYPTED_BYTES = "decrypted_data"; - public static final String RESULT_SIGNATURE = "signature"; - public static final String RESULT_SIGNATURE_KEY_ID = "signature_key_id"; - public static final String RESULT_SIGNATURE_USER_ID = "signature_user_id"; - public static final String RESULT_CLEARTEXT_SIGNATURE_ONLY = "signature_only"; - - public static final String RESULT_SIGNATURE_SUCCESS = "signature_success"; - public static final String RESULT_SIGNATURE_UNKNOWN = "signature_unknown"; + public static final String RESULT_DECRYPT_VERIFY_RESULT = "signature"; // import public static final String RESULT_IMPORT_ADDED = "added"; @@ -489,15 +484,17 @@ public class KeychainIntentService extends IntentService implements ProgressDial // verifyText and decrypt returning additional resultData values for the // verification of signatures PgpDecryptVerify.Builder builder = new PgpDecryptVerify.Builder(this, inputData, outStream); - builder.progress(this); + builder.progressDialogUpdater(this); builder.assumeSymmetric(assumeSymmetricEncryption) .passphrase(PassphraseCacheService.getCachedPassphrase(this, secretKeyId)); - resultData = builder.build().execute(); + PgpDecryptVerifyResult decryptVerifyResult = builder.build().execute(); outStream.close(); + resultData.putParcelable(RESULT_DECRYPT_VERIFY_RESULT, decryptVerifyResult); + /* Output */ switch (target) { @@ -867,10 +864,10 @@ public class KeychainIntentService extends IntentService implements ProgressDial } /** - * Set progress of ProgressDialog by sending message to handler on UI thread + * Set progressDialogUpdater of ProgressDialog by sending message to handler on UI thread */ public void setProgress(String message, int progress, int max) { - Log.d(Constants.TAG, "Send message by setProgress with progress=" + progress + ", max=" + Log.d(Constants.TAG, "Send message by setProgress with progressDialogUpdater=" + progress + ", max=" + max); Bundle data = new Bundle(); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/OpenPgpService.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/OpenPgpService.java index 5d2f5a815..8b34c4421 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/OpenPgpService.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/OpenPgpService.java @@ -21,7 +21,6 @@ import android.app.PendingIntent; import android.content.Intent; import android.database.Cursor; import android.net.Uri; -import android.os.Bundle; import android.os.IBinder; import android.os.ParcelFileDescriptor; @@ -33,9 +32,10 @@ import org.spongycastle.util.Arrays; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Id; import org.sufficientlysecure.keychain.pgp.PgpDecryptVerify; +import org.sufficientlysecure.keychain.pgp.PgpDecryptVerifyResult; import org.sufficientlysecure.keychain.pgp.PgpSignEncrypt; +import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException; import org.sufficientlysecure.keychain.provider.KeychainContract; -import org.sufficientlysecure.keychain.service.KeychainIntentService; import org.sufficientlysecure.keychain.service.PassphraseCacheService; import org.sufficientlysecure.keychain.util.InputData; import org.sufficientlysecure.keychain.util.Log; @@ -284,98 +284,29 @@ public class OpenPgpService extends RemoteService { Intent result = new Intent(); try { - // TODO: - // fix the mess: http://stackoverflow.com/questions/148130/how-do-i-peek-at-the-first-two-bytes-in-an-inputstream - // should we allow to decrypt everything under every key id or only the one set? - // TODO: instead of trying to get the passphrase before - // pause stream when passphrase is missing and then resume - - // TODO: put this code into PgpDecryptVerify class - - // TODO: This allows to decrypt messages with ALL secret keys, not only the one for the - // app, Fix this? -// String passphrase = null; -// if (!signedOnly) { -// // BEGIN Get key -// // TODO: this input stream is consumed after PgpMain.getDecryptionKeyId()... do it -// // better! -// InputStream inputStream2 = new ByteArrayInputStream(inputBytes); -// -// // TODO: duplicates functions from DecryptActivity! -// long secretKeyId; -// try { -// if (inputStream2.markSupported()) { -// // should probably set this to the max size of two -// // pgpF objects, if it even needs to be anything other -// // than 0. -// inputStream2.mark(200); -// } -// secretKeyId = PgpHelper.getDecryptionKeyId(this, inputStream2); -// if (secretKeyId == Id.key.none) { -// throw new PgpGeneralException(getString(R.string.error_no_secret_key_found)); -// } -// } catch (NoAsymmetricEncryptionException e) { -// if (inputStream2.markSupported()) { -// inputStream2.reset(); -// } -// secretKeyId = Id.key.symmetric; -// if (!PgpDecryptVerify.hasSymmetricEncryption(this, inputStream2)) { -// throw new PgpGeneralException( -// getString(R.string.error_no_known_encryption_found)); -// } -// // we do not support symmetric decryption from the API! -// throw new Exception("Symmetric decryption is not supported!"); -// } -// -// Log.d(Constants.TAG, "secretKeyId " + secretKeyId); - - // NOTE: currently this only gets the passphrase for the key set for this client - String passphrase; - if (data.hasExtra(OpenPgpApi.EXTRA_PASSPHRASE)) { - passphrase = data.getStringExtra(OpenPgpApi.EXTRA_PASSPHRASE); - } else { - passphrase = PassphraseCacheService.getCachedPassphrase(getContext(), appSettings.getKeyId()); - } - if (passphrase == null) { - // get PendingIntent for passphrase input, add it to given params and return to client - Intent passphraseBundle = getPassphraseBundleIntent(data, appSettings.getKeyId()); - return passphraseBundle; - } - + String passphrase = data.getStringExtra(OpenPgpApi.EXTRA_PASSPHRASE); long inputLength = is.available(); InputData inputData = new InputData(is, inputLength); - Bundle outputBundle; PgpDecryptVerify.Builder builder = new PgpDecryptVerify.Builder(this, inputData, os); - - builder.assumeSymmetric(false) + builder.assumeSymmetric(false) // no support for symmetric encryption + .enforcedKeyId(appSettings.getKeyId()) // allow only the private key for this app for decryption .passphrase(passphrase); - // TODO: this also decrypts with other secret keys that have no passphrase!!! - outputBundle = builder.build().execute(); + // TODO: currently does not support binary signed-only content + PgpDecryptVerifyResult decryptVerifyResult = builder.build().execute(); - //TODO: instead of using all these wrapping use OpenPgpSignatureResult directly - // in DecryptVerify class and then in DecryptActivity - boolean signature = outputBundle.getBoolean(KeychainIntentService.RESULT_SIGNATURE, false); - if (signature) { - long signatureKeyId = outputBundle - .getLong(KeychainIntentService.RESULT_SIGNATURE_KEY_ID, 0); - String signatureUserId = outputBundle - .getString(KeychainIntentService.RESULT_SIGNATURE_USER_ID); - boolean signatureSuccess = outputBundle - .getBoolean(KeychainIntentService.RESULT_SIGNATURE_SUCCESS, false); - boolean signatureUnknown = outputBundle - .getBoolean(KeychainIntentService.RESULT_SIGNATURE_UNKNOWN, false); - boolean signatureOnly = outputBundle - .getBoolean(KeychainIntentService.RESULT_CLEARTEXT_SIGNATURE_ONLY, false); - - // TODO: SIGNATURE_SUCCESS_CERTIFIED is currently not implemented - int signatureStatus = OpenPgpSignatureResult.SIGNATURE_ERROR; - if (signatureSuccess) { - signatureStatus = OpenPgpSignatureResult.SIGNATURE_SUCCESS_UNCERTIFIED; - } else if (signatureUnknown) { - signatureStatus = OpenPgpSignatureResult.SIGNATURE_UNKNOWN_PUB_KEY; + if (decryptVerifyResult.isKeyPassphraseNeeded()) { + // get PendingIntent for passphrase input, add it to given params and return to client + Intent passphraseBundle = getPassphraseBundleIntent(data, appSettings.getKeyId()); + return passphraseBundle; + } else if (decryptVerifyResult.isSymmetricPassphraseNeeded()) { + throw new PgpGeneralException("Decryption of symmetric content not supported by API!"); + } + OpenPgpSignatureResult signatureResult = decryptVerifyResult.getSignatureResult(); + if (signatureResult != null) { + if (signatureResult.getStatus() == OpenPgpSignatureResult.SIGNATURE_UNKNOWN_PUB_KEY) { // If signature is unknown we return an additional PendingIntent // to retrieve the missing key // TODO!!! @@ -390,11 +321,9 @@ public class OpenPgpService extends RemoteService { result.putExtra(OpenPgpApi.RESULT_INTENT, pi); } - - OpenPgpSignatureResult sigResult = new OpenPgpSignatureResult(signatureStatus, - signatureUserId, signatureOnly, signatureKeyId); - result.putExtra(OpenPgpApi.RESULT_SIGNATURE, sigResult); + result.putExtra(OpenPgpApi.RESULT_SIGNATURE, signatureResult); } + } finally { is.close(); os.close(); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java index 9bb675db0..a81576687 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java @@ -25,6 +25,7 @@ import java.io.FileNotFoundException; import java.io.InputStream; import java.util.regex.Matcher; +import org.openintents.openpgp.OpenPgpSignatureResult; import org.spongycastle.openpgp.PGPPublicKeyRing; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Id; @@ -32,6 +33,7 @@ import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.compatibility.ClipboardReflection; import org.sufficientlysecure.keychain.helper.ActionBarHelper; import org.sufficientlysecure.keychain.helper.FileHelper; +import org.sufficientlysecure.keychain.pgp.PgpDecryptVerifyResult; import org.sufficientlysecure.keychain.pgp.PgpHelper; import org.sufficientlysecure.keychain.pgp.PgpKeyHelper; import org.sufficientlysecure.keychain.pgp.PgpDecryptVerify; @@ -690,11 +692,15 @@ public class DecryptActivity extends DrawerActivity { } - if (returnData.getBoolean(KeychainIntentService.RESULT_SIGNATURE)) { - String userId = returnData - .getString(KeychainIntentService.RESULT_SIGNATURE_USER_ID); - mSignatureKeyId = returnData - .getLong(KeychainIntentService.RESULT_SIGNATURE_KEY_ID); + PgpDecryptVerifyResult decryptVerifyResult = + returnData.getParcelable(KeychainIntentService.RESULT_DECRYPT_VERIFY_RESULT); + + OpenPgpSignatureResult signatureResult = decryptVerifyResult.getSignatureResult(); + + if (signatureResult != null) { + + String userId = signatureResult.getUserId(); + mSignatureKeyId = signatureResult.getKeyId(); mUserIdRest.setText("id: " + PgpKeyHelper.convertKeyIdToHex(mSignatureKeyId)); if (userId == null) { @@ -707,19 +713,32 @@ public class DecryptActivity extends DrawerActivity { } mUserId.setText(userId); - if (returnData.getBoolean(KeychainIntentService.RESULT_SIGNATURE_SUCCESS)) { - mSignatureStatusImage.setImageResource(R.drawable.overlay_ok); - mLookupKey.setVisibility(View.GONE); - } else if (returnData - .getBoolean(KeychainIntentService.RESULT_SIGNATURE_UNKNOWN)) { - mSignatureStatusImage.setImageResource(R.drawable.overlay_error); - mLookupKey.setVisibility(View.VISIBLE); - AppMsg.makeText(DecryptActivity.this, - R.string.unknown_signature, - AppMsg.STYLE_ALERT).show(); - } else { - mSignatureStatusImage.setImageResource(R.drawable.overlay_error); - mLookupKey.setVisibility(View.GONE); + switch (signatureResult.getStatus()) { + case OpenPgpSignatureResult.SIGNATURE_SUCCESS_UNCERTIFIED: { + mSignatureStatusImage.setImageResource(R.drawable.overlay_ok); + mLookupKey.setVisibility(View.GONE); + break; + } + + // TODO! +// case OpenPgpSignatureResult.SIGNATURE_SUCCESS_CERTIFIED: { +// break; +// } + + case OpenPgpSignatureResult.SIGNATURE_UNKNOWN_PUB_KEY: { + mSignatureStatusImage.setImageResource(R.drawable.overlay_error); + mLookupKey.setVisibility(View.VISIBLE); + AppMsg.makeText(DecryptActivity.this, + R.string.unknown_signature, + AppMsg.STYLE_ALERT).show(); + break; + } + + default: { + mSignatureStatusImage.setImageResource(R.drawable.overlay_error); + mLookupKey.setVisibility(View.GONE); + break; + } } mSignatureLayout.setVisibility(View.VISIBLE); } @@ -733,7 +752,7 @@ public class DecryptActivity extends DrawerActivity { Messenger messenger = new Messenger(saveHandler); intent.putExtra(KeychainIntentService.EXTRA_MESSENGER, messenger); - // show progress dialog + // show progressDialogUpdater dialog saveHandler.showProgressDialog(this); // start service with intent From fe8044d18172faf21ac8085c823eb4f8e13a35ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Tue, 4 Mar 2014 20:58:53 +0100 Subject: [PATCH 012/109] 2.3.1 beta2 --- OpenPGP-Keychain/src/main/AndroidManifest.xml | 4 ++-- .../org/sufficientlysecure/keychain/ui/DecryptActivity.java | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenPGP-Keychain/src/main/AndroidManifest.xml b/OpenPGP-Keychain/src/main/AndroidManifest.xml index cec1422d9..76c4c6a2e 100644 --- a/OpenPGP-Keychain/src/main/AndroidManifest.xml +++ b/OpenPGP-Keychain/src/main/AndroidManifest.xml @@ -2,8 +2,8 @@ + android:versionCode="23102" + android:versionName="2.3.1 beta2"> - OpenKeychain: Datei entschlüsseln - OpenKeychain: Schlüssel importieren - OpenKeychain: Verschlüsseln - OpenKeychain: Entschlüsseln Keine registrierten Anwendungen vorhanden!\n\nAnwendungen von Dritten können Zugriff auf OpenKeychain erbitten. Nachdem Zugriff gewährt wurde, werden diese hier aufgelistet. Erweiterte Einstellungen anzeigen diff --git a/OpenPGP-Keychain/src/main/res/values-es/strings.xml b/OpenPGP-Keychain/src/main/res/values-es/strings.xml index 48ea6cc69..e07e049cd 100644 --- a/OpenPGP-Keychain/src/main/res/values-es/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-es/strings.xml @@ -266,6 +266,9 @@ la fecha de caducidad debe ser posterior a la fecha de creación no puedes eliminar este contacto porque eres tú mismo. no puedes eliminar los siguientes contactos porque son tú mismo:\n%s + Consulta al servidor insuficiente + La consulta al servidor de claves ha fallado + Demasiadas respuestas Por favor, bórralo desde la pantalla \'Mis claves\'! Por favor, bórralos desde la pantalla \'Mis claves\'! @@ -337,10 +340,10 @@ Ayuda Tomar la clave desde el portapapeles - OpenKeychain: Descifrar archivo - OpenKeychain: Importar clave - OpenKeychain: Cifrar - OpenKeychain: Descifrar + Descifrar archivo con OpenKeychain + Importar clave con OpenKeychain + Cifrar con OpenKeychain + Descifrar con OpenKeychain ¡No hay aplicaciones registradas!\n\nLas aplicaciones de terceros pueden pedir permiso de acceso a OpenKeychain. Después de obtener acceso, serán enumeradas aquí. Mostrar la configuración avanzada diff --git a/OpenPGP-Keychain/src/main/res/values-fr/strings.xml b/OpenPGP-Keychain/src/main/res/values-fr/strings.xml index bf66756cf..563ee636e 100644 --- a/OpenPGP-Keychain/src/main/res/values-fr/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-fr/strings.xml @@ -340,10 +340,10 @@ Aide Obtenir la clef depuis le presse-papiers - OpenKeychain : déchiffrer le ficher - OpenKeychain : importer la clef - OpenKeychain : chiffrer - OpenKeychain : déchiffrer + Déchiffrer le fichier avec OpenKeychain + Importer la clef avec OpenKeychain + Chiffrer avec OpenKeychain + Déchiffrer avec OpenKeychain Aucune application enregistrée !\n\nLes applications tierces peuvent demander l\'accès à OpenKeychain. Après avoir autorisé l\'accès, elles seront listées ici. Afficher les paramètres avancés diff --git a/OpenPGP-Keychain/src/main/res/values-it-rIT/strings.xml b/OpenPGP-Keychain/src/main/res/values-it-rIT/strings.xml index 86a094c41..041a9d0f1 100644 --- a/OpenPGP-Keychain/src/main/res/values-it-rIT/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-it-rIT/strings.xml @@ -340,10 +340,10 @@ Aiuto Ottieni chiave dagli appunti - OpenKeyChain: Decodifica File - OpenKeyChain: Importa Chiave - OpenKeychain: Codifica - OpenKeychain: Decodifica + Decodifica File con OpenKeychain + Importa Chiave con OpenKeychain + Codifica con OpenKeychain + Decodifica con OpenKeychain Nessuna app registrata!\n\nApp di terza parti possono richiedere accesso a OpenKeychain. Dopo aver concesso l\'accesso, saranno elencate qui. Mostra impostazioni avanzate diff --git a/OpenPGP-Keychain/src/main/res/values-ja/strings.xml b/OpenPGP-Keychain/src/main/res/values-ja/strings.xml index c99f8b31c..0c80d4a2c 100644 --- a/OpenPGP-Keychain/src/main/res/values-ja/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-ja/strings.xml @@ -329,10 +329,10 @@ ヘルプ クリップボードから鍵を取得 - OpenKeychain: ファイル復号化 - OpenKeychain: 鍵のインポート - OpenKeychain: 暗号化 - OpenKeychain: 復号化 + OpenKeychainでファイルを復号化 + OpenKeychainに鍵をインポート + OpenKeychainで暗号化 + OpenKeychainで復号化 登録されていないアプリケーション!\n\nサードパーティアプリケーションはOpenKeychainにアクセスを要求できます。アクセスを与えた後、それらはここにリストされます。 拡張設定を表示 diff --git a/OpenPGP-Keychain/src/main/res/values-uk/strings.xml b/OpenPGP-Keychain/src/main/res/values-uk/strings.xml index 7f1766a5c..c883ea583 100644 --- a/OpenPGP-Keychain/src/main/res/values-uk/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-uk/strings.xml @@ -351,10 +351,10 @@ Довідка Отримати ключ з буфера обміну - OpenPGP: розшифрувати файл - OpenPGP: імпортувати ключ - OpenPGP: зашифрувати - OpenPGP: розшифрувати + Розшифрувати файл з OpenKeychain + Імпортувати ключ з OpenKeychain + Зашифрувати з OpenKeychain + Розшифрувати з OpenKeychain Нема зареєстрованих програм!\n\nСтороні програми можуть вимагати доступ до OpenPGP Keychain. Після надання доступу вони будуть наведені тут. Показати додаткові налаштування From e1f525a0ac9614ed10538ce1552cf036c06fb88c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Tue, 4 Mar 2014 22:17:45 +0100 Subject: [PATCH 014/109] name KeychainIntentService properly --- .../keychain/service/KeychainIntentService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java index 9c499ebd7..cf507826e 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java @@ -201,7 +201,7 @@ public class KeychainIntentService extends IntentService implements ProgressDial private boolean mIsCanceled; public KeychainIntentService() { - super("ApgService"); + super("KeychainIntentService"); } @Override From a83c18bafbb8bb0316716a1d934363e43bec93f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Tue, 4 Mar 2014 22:20:59 +0100 Subject: [PATCH 015/109] Remove unused imports --- .../org/sufficientlysecure/keychain/util/KeyServer.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/KeyServer.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/KeyServer.java index 072affb1f..3d72c00c0 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/KeyServer.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/KeyServer.java @@ -16,14 +16,8 @@ package org.sufficientlysecure.keychain.util; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Date; import java.util.List; -import android.os.Parcel; -import android.os.Parcelable; - import org.sufficientlysecure.keychain.ui.adapter.ImportKeysListEntry; public abstract class KeyServer { From 61ee811d600f9f0d27fc4ac5ef0b6ca32a5b1ed2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Tue, 4 Mar 2014 22:42:44 +0100 Subject: [PATCH 016/109] Fix license header of key server files --- .../org/sufficientlysecure/keychain/util/HkpKeyServer.java | 4 +++- .../java/org/sufficientlysecure/keychain/util/KeyServer.java | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/HkpKeyServer.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/HkpKeyServer.java index b94c42e90..921d22f21 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/HkpKeyServer.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/HkpKeyServer.java @@ -1,6 +1,8 @@ /* + * Copyright (C) 2012-2014 Dominik Schürmann + * Copyright (C) 2011 Thialfihar * Copyright (C) 2011 Senecaso - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/KeyServer.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/KeyServer.java index 3d72c00c0..b1e6b3c71 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/KeyServer.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/KeyServer.java @@ -1,6 +1,8 @@ /* + * Copyright (C) 2012-2014 Dominik Schürmann + * Copyright (C) 2011 Thialfihar * Copyright (C) 2011 Senecaso - * + * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at From 875adae40c669620f617307d0a7f9bb4241aaac5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Tue, 4 Mar 2014 23:14:52 +0100 Subject: [PATCH 017/109] Code cleaning in PgpDecryptVerify --- .../keychain/pgp/PgpDecryptVerify.java | 88 ++++++++++--------- 1 file changed, 46 insertions(+), 42 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java index be80da4e3..345069d9d 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java @@ -440,12 +440,12 @@ public class PgpDecryptVerify { } int n; - // TODO: progressDialogUpdater calculation is broken here! Try to rework it based on commented code! -// int progressDialogUpdater = 0; + // TODO: progress calculation is broken here! Try to rework it based on commented code! +// int progress = 0; long startPos = data.getStreamPosition(); while ((n = dataIn.read(buffer)) > 0) { outStream.write(buffer, 0, n); -// progressDialogUpdater += n; +// progress += n; if (signature != null) { try { signature.update(buffer, 0, n); @@ -455,9 +455,9 @@ public class PgpDecryptVerify { } } // TODO: dead code?! - // unknown size, but try to at least have a moving, slowing down progressDialogUpdater bar -// currentProgress = startProgress + (endProgress - startProgress) * progressDialogUpdater -// / (progressDialogUpdater + 100000); + // unknown size, but try to at least have a moving, slowing down progress bar +// currentProgress = startProgress + (endProgress - startProgress) * progress +// / (progress + 100000); if (data.getSize() - startPos == 0) { currentProgress = endProgress; } else { @@ -478,11 +478,11 @@ public class PgpDecryptVerify { signatureResult.setSignatureOnly(false); //Now check binding signatures - boolean keyBinding_isok = verifyKeyBinding(context, messageSignature, signatureKey); - boolean sig_isok = signature.verify(messageSignature); + boolean validKeyBinding = verifyKeyBinding(context, messageSignature, signatureKey); + boolean validSignature = signature.verify(messageSignature); // TODO: implement CERTIFIED! - if (keyBinding_isok & sig_isok) { + if (validKeyBinding & validSignature) { signatureResult.setStatus(OpenPgpSignatureResult.SIGNATURE_SUCCESS_UNCERTIFIED); } } @@ -618,12 +618,11 @@ public class PgpDecryptVerify { } while (lookAhead != -1); } - boolean sig_isok = signature.verify(); - //Now check binding signatures - boolean keyBinding_isok = verifyKeyBinding(context, signature, signatureKey); + boolean validKeyBinding = verifyKeyBinding(context, signature, signatureKey); + boolean validSignature = signature.verify(); - if (sig_isok & keyBinding_isok) { + if (validSignature & validKeyBinding) { signatureResult.setStatus(OpenPgpSignatureResult.SIGNATURE_SUCCESS_UNCERTIFIED); } @@ -637,34 +636,34 @@ public class PgpDecryptVerify { private static boolean verifyKeyBinding(Context context, PGPSignature signature, PGPPublicKey signatureKey) { long signatureKeyId = signature.getKeyID(); - boolean keyBinding_isok = false; - String userId = null; + boolean validKeyBinding = false; + PGPPublicKeyRing signKeyRing = ProviderHelper.getPGPPublicKeyRingByKeyId(context, signatureKeyId); PGPPublicKey mKey = null; if (signKeyRing != null) { mKey = PgpKeyHelper.getMasterKey(signKeyRing); } + if (signature.getKeyID() != mKey.getKeyID()) { - keyBinding_isok = verifyKeyBinding(mKey, signatureKey); + validKeyBinding = verifyKeyBinding(mKey, signatureKey); } else { //if the key used to make the signature was the master key, no need to check binding sigs - keyBinding_isok = true; + validKeyBinding = true; } - return keyBinding_isok; + return validKeyBinding; } private static boolean verifyKeyBinding(PGPPublicKey masterPublicKey, PGPPublicKey signingPublicKey) { - boolean subkeyBinding_isok = false; - boolean tmp_subkeyBinding_isok = false; - boolean primkeyBinding_isok = false; - JcaPGPContentVerifierBuilderProvider contentVerifierBuilderProvider = new JcaPGPContentVerifierBuilderProvider() - .setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME); + boolean validSubkeyBinding = false; + boolean validTempSubkeyBinding = false; + boolean validPrimaryKeyBinding = false; + + JcaPGPContentVerifierBuilderProvider contentVerifierBuilderProvider = + new JcaPGPContentVerifierBuilderProvider() + .setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME); Iterator itr = signingPublicKey.getSignatures(); - subkeyBinding_isok = false; - tmp_subkeyBinding_isok = false; - primkeyBinding_isok = false; 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 @@ -674,32 +673,36 @@ public class PgpDecryptVerify { //check and if ok, check primary key binding. try { sig.init(contentVerifierBuilderProvider, masterPublicKey); - tmp_subkeyBinding_isok = sig.verifyCertification(masterPublicKey, signingPublicKey); + validTempSubkeyBinding = sig.verifyCertification(masterPublicKey, signingPublicKey); } catch (PGPException e) { continue; } catch (SignatureException e) { continue; } - if (tmp_subkeyBinding_isok) - subkeyBinding_isok = true; - if (tmp_subkeyBinding_isok) { - primkeyBinding_isok = verifyPrimaryBinding(sig.getUnhashedSubPackets(), masterPublicKey, signingPublicKey); - if (primkeyBinding_isok) + if (validTempSubkeyBinding) + validSubkeyBinding = true; + if (validTempSubkeyBinding) { + validPrimaryKeyBinding = verifyPrimaryKeyBinding(sig.getUnhashedSubPackets(), + masterPublicKey, signingPublicKey); + if (validPrimaryKeyBinding) break; - primkeyBinding_isok = verifyPrimaryBinding(sig.getHashedSubPackets(), masterPublicKey, signingPublicKey); - if (primkeyBinding_isok) + validPrimaryKeyBinding = verifyPrimaryKeyBinding(sig.getHashedSubPackets(), + masterPublicKey, signingPublicKey); + if (validPrimaryKeyBinding) break; } } } - return (subkeyBinding_isok & primkeyBinding_isok); + return (validSubkeyBinding & validPrimaryKeyBinding); } - private static boolean verifyPrimaryBinding(PGPSignatureSubpacketVector Pkts, PGPPublicKey masterPublicKey, PGPPublicKey signingPublicKey) { - boolean primkeyBinding_isok = false; - JcaPGPContentVerifierBuilderProvider contentVerifierBuilderProvider = new JcaPGPContentVerifierBuilderProvider() - .setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME); + private 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)) { @@ -715,8 +718,8 @@ public class PgpDecryptVerify { if (emSig.getSignatureType() == PGPSignature.PRIMARYKEY_BINDING) { try { emSig.init(contentVerifierBuilderProvider, signingPublicKey); - primkeyBinding_isok = emSig.verifyCertification(masterPublicKey, signingPublicKey); - if (primkeyBinding_isok) + validPrimaryKeyBinding = emSig.verifyCertification(masterPublicKey, signingPublicKey); + if (validPrimaryKeyBinding) break; } catch (PGPException e) { continue; @@ -726,7 +729,8 @@ public class PgpDecryptVerify { } } } - return primkeyBinding_isok; + + return validPrimaryKeyBinding; } /** From a1230bbe53d279b44038268d05d85f86ae0ff840 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Wed, 5 Mar 2014 02:06:44 +0100 Subject: [PATCH 018/109] Fix passphrase retrieval --- .../keychain/pgp/PgpDecryptVerify.java | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java index 345069d9d..c568f462a 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java @@ -310,16 +310,18 @@ public class PgpDecryptVerify { pbe = encData; - // passphrase handling... + // if no passphrase was explicitly set try to get it from the cache service if (passphrase == null) { - // try to get cached passphrase + // returns "" if key has no passphrase passphrase = PassphraseCacheService.getCachedPassphrase(context, encData.getKeyID()); + + // if passphrase was not cached, return here indicating that a passphrase is missing! + if (passphrase == null) { + returnData.setKeyPassphraseNeeded(true); + return returnData; + } } - // if passphrase was not cached, return here! - if (passphrase == null) { - returnData.setKeyPassphraseNeeded(true); - return returnData; - } + break; } @@ -644,7 +646,7 @@ public class PgpDecryptVerify { if (signKeyRing != null) { mKey = PgpKeyHelper.getMasterKey(signKeyRing); } - + if (signature.getKeyID() != mKey.getKeyID()) { validKeyBinding = verifyKeyBinding(mKey, signatureKey); } else { //if the key used to make the signature was the master key, no need to check binding sigs From 7a957840748766345f0180b2a3f8dee761161be4 Mon Sep 17 00:00:00 2001 From: Bhargav Golla Date: Tue, 4 Mar 2014 22:37:56 -0500 Subject: [PATCH 019/109] Adding a min date not to go below creation date --- .../org/sufficientlysecure/keychain/ui/widget/KeyEditor.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java index 6c265057e..b8bb547ee 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java @@ -106,7 +106,8 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener { mDeleteButton.setOnClickListener(this); setExpiryDate(null); - + String creationDate = mCreationDate.getText().toString(); + Date date = DateFormat.getDateInstance().parse(creationDate); mExpiryDateButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { GregorianCalendar date = mExpiryDate; @@ -129,6 +130,7 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener { } } }); + dialog.getDatePicker().setMinDate(date.getTime()); dialog.show(); } }); From bbda6a5b027e9688c3125014af23946d53c4bb57 Mon Sep 17 00:00:00 2001 From: Daniel Hammann Date: Wed, 5 Mar 2014 14:14:22 +0100 Subject: [PATCH 020/109] updated build.gradle-Files to current Versions of build-tools and SDK. --- OpenPGP-Keychain-API/example-app/build.gradle | 2 +- .../libraries/keychain-api-library/build.gradle | 2 +- OpenPGP-Keychain/build.gradle | 2 +- libraries/Android-AppMsg/library/build.gradle | 2 +- libraries/AndroidBootstrap/build.gradle | 4 ++-- libraries/HtmlTextView/build.gradle | 4 ++-- libraries/StickyListHeaders/library/build.gradle | 2 +- libraries/keychain-api-library/build.gradle | 2 +- libraries/zxing-android-integration/build.gradle | 2 +- libraries/zxing/build.gradle | 2 +- 10 files changed, 12 insertions(+), 12 deletions(-) diff --git a/OpenPGP-Keychain-API/example-app/build.gradle b/OpenPGP-Keychain-API/example-app/build.gradle index 1f8854431..975666b19 100644 --- a/OpenPGP-Keychain-API/example-app/build.gradle +++ b/OpenPGP-Keychain-API/example-app/build.gradle @@ -18,7 +18,7 @@ dependencies { android { compileSdkVersion 19 - buildToolsVersion "19.0.1" + buildToolsVersion "19.0.3" defaultConfig { minSdkVersion 9 diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/build.gradle b/OpenPGP-Keychain-API/libraries/keychain-api-library/build.gradle index 1d5911783..7c923e7f6 100644 --- a/OpenPGP-Keychain-API/libraries/keychain-api-library/build.gradle +++ b/OpenPGP-Keychain-API/libraries/keychain-api-library/build.gradle @@ -13,7 +13,7 @@ apply plugin: 'android-library' android { compileSdkVersion 19 - buildToolsVersion '19.0.1' + buildToolsVersion '19.0.3' // NOTE: We are using the old folder structure to also support Eclipse sourceSets { diff --git a/OpenPGP-Keychain/build.gradle b/OpenPGP-Keychain/build.gradle index 1454b80e7..5da7d6a1b 100644 --- a/OpenPGP-Keychain/build.gradle +++ b/OpenPGP-Keychain/build.gradle @@ -18,7 +18,7 @@ dependencies { android { compileSdkVersion 19 - buildToolsVersion "19.0.1" + buildToolsVersion "19.0.3" defaultConfig { minSdkVersion 9 diff --git a/libraries/Android-AppMsg/library/build.gradle b/libraries/Android-AppMsg/library/build.gradle index 934cf1cb1..f77f1a098 100644 --- a/libraries/Android-AppMsg/library/build.gradle +++ b/libraries/Android-AppMsg/library/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'android-library' android { compileSdkVersion 19 - buildToolsVersion '19.0.1' + buildToolsVersion '19.0.3' defaultConfig { minSdkVersion 4 diff --git a/libraries/AndroidBootstrap/build.gradle b/libraries/AndroidBootstrap/build.gradle index 7724c6d9c..220613132 100644 --- a/libraries/AndroidBootstrap/build.gradle +++ b/libraries/AndroidBootstrap/build.gradle @@ -2,10 +2,10 @@ apply plugin: 'android-library' android { compileSdkVersion 19 - buildToolsVersion "19.0.1" + buildToolsVersion "19.0.3" defaultConfig { minSdkVersion 7 - targetSdkVersion 17 + targetSdkVersion 19 } sourceSets { main { diff --git a/libraries/HtmlTextView/build.gradle b/libraries/HtmlTextView/build.gradle index a0b9b1bc6..d1b26d2bd 100644 --- a/libraries/HtmlTextView/build.gradle +++ b/libraries/HtmlTextView/build.gradle @@ -2,8 +2,8 @@ apply plugin: 'android-library' android { - compileSdkVersion 17 - buildToolsVersion '19.0.1' + compileSdkVersion 19 + buildToolsVersion '19.0.3' sourceSets { main { diff --git a/libraries/StickyListHeaders/library/build.gradle b/libraries/StickyListHeaders/library/build.gradle index a92c4d80e..b67172c12 100644 --- a/libraries/StickyListHeaders/library/build.gradle +++ b/libraries/StickyListHeaders/library/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'android-library' android { compileSdkVersion 19 - buildToolsVersion '19.0.1' + buildToolsVersion '19.0.3' sourceSets { main { diff --git a/libraries/keychain-api-library/build.gradle b/libraries/keychain-api-library/build.gradle index 1d5911783..7c923e7f6 100644 --- a/libraries/keychain-api-library/build.gradle +++ b/libraries/keychain-api-library/build.gradle @@ -13,7 +13,7 @@ apply plugin: 'android-library' android { compileSdkVersion 19 - buildToolsVersion '19.0.1' + buildToolsVersion '19.0.3' // NOTE: We are using the old folder structure to also support Eclipse sourceSets { diff --git a/libraries/zxing-android-integration/build.gradle b/libraries/zxing-android-integration/build.gradle index a92c4d80e..b67172c12 100644 --- a/libraries/zxing-android-integration/build.gradle +++ b/libraries/zxing-android-integration/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'android-library' android { compileSdkVersion 19 - buildToolsVersion '19.0.1' + buildToolsVersion '19.0.3' sourceSets { main { diff --git a/libraries/zxing/build.gradle b/libraries/zxing/build.gradle index a92c4d80e..b67172c12 100644 --- a/libraries/zxing/build.gradle +++ b/libraries/zxing/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'android-library' android { compileSdkVersion 19 - buildToolsVersion '19.0.1' + buildToolsVersion '19.0.3' sourceSets { main { From 76876a57c216eff92b4f0417c9ca2e09663d451e Mon Sep 17 00:00:00 2001 From: Daniel Hammann Date: Wed, 5 Mar 2014 14:30:56 +0100 Subject: [PATCH 021/109] Added build-tool and api level version information --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3a8c81b74..932c54f06 100644 --- a/README.md +++ b/README.md @@ -30,9 +30,9 @@ Development mailinglist at http://groups.google.com/d/forum/openpgp-keychain-dev 1. Have Android SDK "tools", "platform-tools", and "build-tools" directories in your PATH (http://developer.android.com/sdk/index.html) 2. Open the Android SDK Manager (shell command: ``android``). -Expand the Tools directory and select "Android SDK Build-tools" newest version. +Expand the Tools directory and select "Android SDK Build-tools (Version 19.0.3)". Expand the Extras directory and install "Android Support Repository" -Select everything for the newest SDK +Select everything for the newest SDK (API-Level 19) 3. Export ANDROID_HOME pointing to your Android SDK 4. Execute ``./gradlew build`` 5. You can install the app with ``adb install -r OpenPGP-Keychain/build/apk/OpenPGP-Keychain-debug-unaligned.apk`` From 7bfaef81b561d4a55b7e3bcc87a1e18924197182 Mon Sep 17 00:00:00 2001 From: Emantor Date: Wed, 5 Mar 2014 15:32:09 +0100 Subject: [PATCH 022/109] Update travis to build-tools-19.0.3 Updates travis to support pull request #334 --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 28827f332..946125fe0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ before_install: - export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools # Install required Android components. - - echo "y" | android update sdk -a --filter build-tools-19.0.1,android-19,platform-tools,extra-android-support,extra-android-m2repository,android-17 --no-ui --force + - echo "y" | android update sdk -a --filter build-tools-19.0.3,android-19,platform-tools,extra-android-support,extra-android-m2repository,android-17 --no-ui --force install: echo "Installation done" script: gradle assemble -S -q From aafcdbd9452a3e9454f9e9fa5c310f987ea2df24 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 5 Mar 2014 16:16:42 +0100 Subject: [PATCH 023/109] added automaticaly generated ant files --- .../libraries/keychain-api-library/build.xml | 92 +++++++++++++++++++ .../keychain-api-library/proguard-project.txt | 20 ++++ 2 files changed, 112 insertions(+) create mode 100644 OpenPGP-Keychain-API/libraries/keychain-api-library/build.xml create mode 100644 OpenPGP-Keychain-API/libraries/keychain-api-library/proguard-project.txt diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/build.xml b/OpenPGP-Keychain-API/libraries/keychain-api-library/build.xml new file mode 100644 index 000000000..48ebf198c --- /dev/null +++ b/OpenPGP-Keychain-API/libraries/keychain-api-library/build.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/proguard-project.txt b/OpenPGP-Keychain-API/libraries/keychain-api-library/proguard-project.txt new file mode 100644 index 000000000..f2fe1559a --- /dev/null +++ b/OpenPGP-Keychain-API/libraries/keychain-api-library/proguard-project.txt @@ -0,0 +1,20 @@ +# To enable ProGuard in your project, edit project.properties +# to define the proguard.config property as described in that file. +# +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in ${sdk.dir}/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} From bd934929d5dba17507897b5cc59671e96dbd4ff0 Mon Sep 17 00:00:00 2001 From: Daniel Hammann Date: Wed, 5 Mar 2014 17:44:55 +0100 Subject: [PATCH 024/109] =?UTF-8?q?Lint=20Issue:=20TypographyEllipsis:=20E?= =?UTF-8?q?llipsis=20string=20can=20be=20replaced=20with=20ellipsis=20char?= =?UTF-8?q?acter=20Replace=20"..."=20with=20ellipsis=20character=20(?= =?UTF-8?q?=E2=80=A6,=20…)=20...=20->=20=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/res/values-de/strings.xml | 56 ++++++------- .../src/main/res/values-es-rCO/strings.xml | 2 +- .../src/main/res/values-es/strings.xml | 74 +++++++++--------- .../src/main/res/values-fr/strings.xml | 76 +++++++++--------- .../src/main/res/values-it-rIT/strings.xml | 74 +++++++++--------- .../src/main/res/values-ja/strings.xml | 72 ++++++++--------- .../src/main/res/values-nl-rNL/strings.xml | 54 ++++++------- .../src/main/res/values-ru/strings.xml | 78 +++++++++---------- .../src/main/res/values-tr/strings.xml | 24 +++--- .../src/main/res/values-zh/strings.xml | 14 ++-- 10 files changed, 262 insertions(+), 262 deletions(-) diff --git a/OpenPGP-Keychain/src/main/res/values-de/strings.xml b/OpenPGP-Keychain/src/main/res/values-de/strings.xml index df76f4e52..5c8216c10 100644 --- a/OpenPGP-Keychain/src/main/res/values-de/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-de/strings.xml @@ -163,7 +163,7 @@ DSA ElGamal RSA - Öffnen... + Öffnen… Warnung Fehler Fehler: %s @@ -273,40 +273,40 @@ fertig. - speichern... - importieren... - exportieren... - erstelle Schlüssel, dies kann bis zu 3 Minuten dauern... - erstelle Schlüssel... - Hauptschlüssel wird vorbereitet... - Hauptschlüssel wird beglaubigt... - erstelle Hauptring... - füge Unterschlüssel hinzu... - Schlüssel wird gespeichert... + speichern… + importieren… + exportieren… + erstelle Schlüssel, dies kann bis zu 3 Minuten dauern… + erstelle Schlüssel… + Hauptschlüssel wird vorbereitet… + Hauptschlüssel wird beglaubigt… + erstelle Hauptring… + füge Unterschlüssel hinzu… + Schlüssel wird gespeichert… Schlüssel wird exportiert… Schlüssel werden exportiert… - extrahiere Signaturschlüssel... - extrahiere Schlüssel... - Datenstrom wird vorbereitet... - Daten werden verschlüsselt... - Daten werden entschlüsselt... - Signatur wird vorbereitet... - Signatur wird erstellt... - Signatur wird verarbeitet... - Signatur wird verifiziert... - signiere... - Daten werden gelesen... - Schlüssel wird gesucht... - Daten werden entpackt... - Integrität wird überprüft... - \'%s\' wird sicher gelöscht... - Anfrage wird gestellt... + extrahiere Signaturschlüssel… + extrahiere Schlüssel… + Datenstrom wird vorbereitet… + Daten werden verschlüsselt… + Daten werden entschlüsselt… + Signatur wird vorbereitet… + Signatur wird erstellt… + Signatur wird verarbeitet… + Signatur wird verifiziert… + signiere… + Daten werden gelesen… + Schlüssel wird gesucht… + Daten werden entpackt… + Integrität wird überprüft… + \'%s\' wird sicher gelöscht… + Anfrage wird gestellt… Öffentliche Schlüssel suchen Private Schlüssel suchen - Teile Schlüssel über... + Teile Schlüssel über… 512 1024 diff --git a/OpenPGP-Keychain/src/main/res/values-es-rCO/strings.xml b/OpenPGP-Keychain/src/main/res/values-es-rCO/strings.xml index 6efe9548d..e43cecc2c 100644 --- a/OpenPGP-Keychain/src/main/res/values-es-rCO/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-es-rCO/strings.xml @@ -12,7 +12,7 @@ Aplicaciones registradas Cambiar contraseña Establecer contraseña - Enviar correo electrónico... + Enviar correo electrónico… Cifrar a archivo Descifrar a archivo Importar claves diff --git a/OpenPGP-Keychain/src/main/res/values-es/strings.xml b/OpenPGP-Keychain/src/main/res/values-es/strings.xml index e07e049cd..edf190184 100644 --- a/OpenPGP-Keychain/src/main/res/values-es/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-es/strings.xml @@ -15,7 +15,7 @@ Prioridad del servidor de claves Cambiar la frase de contraseña Establecer frase de contraseña - Enviar email... + Enviar email… Cifrar hacia archivo Descifrar hacia archivo Importar claves @@ -61,7 +61,7 @@ Siguiente Volver Portapapeles - Compartir con... + Compartir con… Buscar clave Ajustes @@ -80,10 +80,10 @@ Actualizar desde servidor de claves Cargar al servidor de claves Compartir - Compartir la huella digital... - Compartir la clave completa... - con... - con... + Compartir la huella digital… + Compartir la clave completa… + con… + con… con código QR con código QR con NFC @@ -91,7 +91,7 @@ Clave de firma Ajustes de Beam Cancelar - Cifrar hacia... + Cifrar hacia… Firmar Mensaje @@ -163,7 +163,7 @@ DSA ElGamal RSA - Abrir... + Abrir… Advertencia Error Error: %s @@ -275,40 +275,40 @@ hecho. - guardando... - importando... - exportando... - generando la clave, esto puede tardar más de 3 minutos... - construyendo la clave... - preparando la clave maestra... - certificando la clave maestra... - construyendo el anillo maestro... - añadiendo las subclaves... - guardando claves... + guardando… + importando… + exportando… + generando la clave, esto puede tardar más de 3 minutos… + construyendo la clave… + preparando la clave maestra… + certificando la clave maestra… + construyendo el anillo maestro… + añadiendo las subclaves… + guardando claves… - exportando clave... - exportando claves... + exportando clave… + exportando claves… - extrayendo la clave de firma... - extrayendo la clave... - preparando las transmisiones... - cifrando los datos... - descifrando los datos... - preparando la firma... - generando la firma... - procesando la firma... - verificando la firma... - firmando... - leyendo los datos... - localizando la clave... - descomprimiendo los datos... - verificando la integridad... + extrayendo la clave de firma… + extrayendo la clave… + preparando las transmisiones… + cifrando los datos… + descifrando los datos… + preparando la firma… + generando la firma… + procesando la firma… + verificando la firma… + firmando… + leyendo los datos… + localizando la clave… + descomprimiendo los datos… + verificando la integridad… borrando \'%s\' de forma segura… - consultando... + consultando… Buscar claves públicas Buscar claves secretas - Compartir la clave con... + Compartir la clave con… 512 1024 @@ -374,7 +374,7 @@ 1 clave seleccionada. %d claves seleccionadas. - Aún no hay claves disponibles... + Aún no hay claves disponibles… Puedes empezar por o crear tu propia clave diff --git a/OpenPGP-Keychain/src/main/res/values-fr/strings.xml b/OpenPGP-Keychain/src/main/res/values-fr/strings.xml index 563ee636e..171ce1fa5 100644 --- a/OpenPGP-Keychain/src/main/res/values-fr/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-fr/strings.xml @@ -15,7 +15,7 @@ Préférences du serveur de clefs Changer la phrase de passe Définir la phrase de passe - Envoyer un courriel... + Envoyer un courriel… Chiffrer vers un fichier Déchiffrer vers un fichier importer des clefs @@ -61,7 +61,7 @@ Suivant Retour Presse-papiers - Partager avec... + Partager avec… Rechercher la clef Paramètres @@ -80,10 +80,10 @@ Mettre à jour depuis le serveur de clefs Téléverser vers le serveur de clefs Partager - Partager l\'empreinte... - Partager la clef entière... - avec... - avec... + Partager l\'empreinte… + Partager la clef entière… + avec… + avec… par un code QR par un code QR par la NFC @@ -91,7 +91,7 @@ Signer la clef Paramètres Beam Annuler - Chiffrer vers... + Chiffrer vers… Signer Message @@ -163,7 +163,7 @@ DSA ElGamal RSA - Ouvrir... + Ouvrir… Avertissement Erreur Erreur : %s @@ -275,40 +275,40 @@ fait. - sauvegarde... - importation... - exportation... - génération de la clef, ceci peut prendre jusqu\'à 3 minutes... - assemblage de la clef... - préparation de la clef maîtresse... - certification de la clef maîtresse... - assemblage du trousseau maître... - ajout des sous-clefs... - sauvegarde de la clef... + sauvegarde… + importation… + exportation… + génération de la clef, ceci peut prendre jusqu\'à 3 minutes… + assemblage de la clef… + préparation de la clef maîtresse… + certification de la clef maîtresse… + assemblage du trousseau maître… + ajout des sous-clefs… + sauvegarde de la clef… - exportation de la clef... - exportation des clefs... + exportation de la clef… + exportation des clefs… - extraction de la clef de signature... - extraction de la clef... - préparation des flux... - chiffrement des données... - déchiffrement des données... - préparation de la signature... - génération de la signature... - traitement de la signature... - vérification de la signature... - signature... - lecture des données... - recherche de la clef... - décompression des données... - vérification de l\'intégrité... - suppression sûre de « %s »... - interrogation... + extraction de la clef de signature… + extraction de la clef… + préparation des flux… + chiffrement des données… + déchiffrement des données… + préparation de la signature… + génération de la signature… + traitement de la signature… + vérification de la signature… + signature… + lecture des données… + recherche de la clef… + décompression des données… + vérification de l\'intégrité… + suppression sûre de « %s »… + interrogation… Rechercher des clefs publiques Rechercher des clefs secrètes - Partager la clef avec... + Partager la clef avec… 512 1024 @@ -374,7 +374,7 @@ 1 clef choisie %d clefs choisies - Aucune clef encore disponible... + Aucune clef encore disponible… Vous pouvez commencer par ou créer votre propre clef diff --git a/OpenPGP-Keychain/src/main/res/values-it-rIT/strings.xml b/OpenPGP-Keychain/src/main/res/values-it-rIT/strings.xml index 041a9d0f1..5ceb4f45b 100644 --- a/OpenPGP-Keychain/src/main/res/values-it-rIT/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-it-rIT/strings.xml @@ -15,7 +15,7 @@ Preferenze Server delle Chiavi Cambia Frase di Accesso Imposta Frase di Accesso - Invia Mail... + Invia Mail… Codifica File Decodifica File Importa Chiavi @@ -61,7 +61,7 @@ Prossimo Precedente Appunti - Condividi con... + Condividi con… Chiave di ricerca Impostazioni @@ -80,10 +80,10 @@ Aggiorna dal server delle chiavi Carica chiave nel server Condividi - Condivi impronta... - Condividi intera chiave... + Condivi impronta… + Condividi intera chiave… con.. - con... + con… con Codice QR con Codice QR con NFC @@ -91,7 +91,7 @@ Firma chiave Impostazioni Beam Annulla - Codifica su... + Codifica su… Firma Messaggio @@ -163,7 +163,7 @@ DSA ElGamal RSA - Apri... + Apri… Attenzione Errore Errore: %s @@ -275,40 +275,40 @@ fatto. - salvataggio... - importazione... - esportazione... - generazione chiave, richiede fino a 3 minuti... - fabbricazione chiave... - preparazione chiave principale... - certificazione chiave principale... - fabbricazione portachiavi principale... - aggiunta sottochiavi... - salvataggio chiavi... + salvataggio… + importazione… + esportazione… + generazione chiave, richiede fino a 3 minuti… + fabbricazione chiave… + preparazione chiave principale… + certificazione chiave principale… + fabbricazione portachiavi principale… + aggiunta sottochiavi… + salvataggio chiavi… - esportazione chiave... - esportazione chiavi... + esportazione chiave… + esportazione chiavi… - estrazione chiavi di firma... - estrazione chiave... - preparazione flussi... - codifica dati... - decodifica dati... - preparazione firma... - generazione firma... - elaborazione firma... - verifica firma... - firma... - lettura dati... - ricerca chiave... - decompressione dati... - verifica integrita\'... - eliminazione sicura di \'%s\'... - interrogazione... + estrazione chiavi di firma… + estrazione chiave… + preparazione flussi… + codifica dati… + decodifica dati… + preparazione firma… + generazione firma… + elaborazione firma… + verifica firma… + firma… + lettura dati… + ricerca chiave… + decompressione dati… + verifica integrita\'… + eliminazione sicura di \'%s\'… + interrogazione… Ricerca Chiavi Pubbliche Cerca Chiave Privata - Condividi chiave con... + Condividi chiave con… 512 1024 @@ -374,7 +374,7 @@ 1 chiave selezionata. %d chiavi selezionate. - Nessuna chiave disponibile... + Nessuna chiave disponibile… Puoi iniziare da o creazione della tua chiave diff --git a/OpenPGP-Keychain/src/main/res/values-ja/strings.xml b/OpenPGP-Keychain/src/main/res/values-ja/strings.xml index 0c80d4a2c..0ba511c1e 100644 --- a/OpenPGP-Keychain/src/main/res/values-ja/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-ja/strings.xml @@ -15,7 +15,7 @@ 鍵サーバ設定 パスフレーズの変更 パスフレーズの設定 - メールの送信... + メールの送信… 暗号化してファイルに 復号化してファイルに 鍵のインポート @@ -61,7 +61,7 @@ 戻る クリップボード - 共有... + 共有… 鍵検出 設定 @@ -80,10 +80,10 @@ 鍵サーバからの更新 鍵サーバへのアップロード 共有 - 指紋の共有... - すべての鍵の共有... - ...(指紋) - ...(鍵) + 指紋の共有… + すべての鍵の共有… + …(指紋) + …(鍵) QRコードで共有(鍵) QRコードで共有(指紋) NFCで共有 @@ -91,7 +91,7 @@ 鍵を署名 Beamの設定 キャンセル - 暗号化... + 暗号化… 署名 メッセージ @@ -161,7 +161,7 @@ DSA ElGamal RSA - 開く... + 開く… 注意 エラー エラー: %s @@ -266,39 +266,39 @@ 完了。 - 保存... - インポート... - エクスポート... - 鍵の生成、3分ほどかかります... - 鍵の構築中... - 主鍵の準備中... - 主鍵の検証中... - 主鍵輪の構築中... - 副鍵の追加中... - 鍵の保存... + 保存… + インポート… + エクスポート… + 鍵の生成、3分ほどかかります… + 鍵の構築中… + 主鍵の準備中… + 主鍵の検証中… + 主鍵輪の構築中… + 副鍵の追加中… + 鍵の保存… - 鍵のエクスポート... + 鍵のエクスポート… - 署名鍵の取り出し中... - 鍵の取り出し中... - ストリームの準備中... - データの暗号化中... - データの復号化中... - 署名の準備中... - 署名の生成中... - 署名処理中... - 署名の検証中... - 署名中... - データ読み込み中... - 鍵検索中... - データの展開中... - 完全性の検証中... + 署名鍵の取り出し中… + 鍵の取り出し中… + ストリームの準備中… + データの暗号化中… + データの復号化中… + 署名の準備中… + 署名の生成中… + 署名処理中… + 署名の検証中… + 署名中… + データ読み込み中… + 鍵検索中… + データの展開中… + 完全性の検証中… \'%s\' を完全に削除中… - 要求中... + 要求中… 公開鍵の検索 秘密鍵の検索 - 鍵の共有... + 鍵の共有… 512 1024 @@ -362,7 +362,7 @@ %d の鍵を選択。 - すでにその鍵は存在しません... + すでにその鍵は存在しません… で始める もしくは あなた所有の鍵を作る diff --git a/OpenPGP-Keychain/src/main/res/values-nl-rNL/strings.xml b/OpenPGP-Keychain/src/main/res/values-nl-rNL/strings.xml index 7d7efa616..35a0b5a03 100644 --- a/OpenPGP-Keychain/src/main/res/values-nl-rNL/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-nl-rNL/strings.xml @@ -12,7 +12,7 @@ Geregistreerde apps Wachtwoord wijzigen Wachtwoord instellen - E-mail verzenden... + E-mail verzenden… Versleutelen naar bestand Ontsleutelen naar bestand Sleutels importeren @@ -109,7 +109,7 @@ DSA ElGamal RSA - Openen... + Openen… Waarschuwing Fout Fout: %s @@ -172,34 +172,34 @@ Niets te importeren gereed. - opslaan... - importeren... - exporteren... - sleutel maken... - hoofdsleutel voorbereiden... - hoofdsleutel certificeren... - hoofdsleutelbos maken... - sub-sleutels toevoegen... - ondertekeningssleutel uitpakken... - sleutel uitpakken... - streams voorbereiden... - gegevens versleutelen... - gegevens ontsleutelen... - handtekening voorbereiden... - handtekening genereren... - handtekening verwerken... - handtekening verifiëren... - ondertekenen... - gegevens lezen... - sleutel opzoeken... - gegevens decomprimeren... - integriteit verifiëren... - \'%s\' veilig verwijderen... - opvragen... + opslaan… + importeren… + exporteren… + sleutel maken… + hoofdsleutel voorbereiden… + hoofdsleutel certificeren… + hoofdsleutelbos maken… + sub-sleutels toevoegen… + ondertekeningssleutel uitpakken… + sleutel uitpakken… + streams voorbereiden… + gegevens versleutelen… + gegevens ontsleutelen… + handtekening voorbereiden… + handtekening genereren… + handtekening verwerken… + handtekening verifiëren… + ondertekenen… + gegevens lezen… + sleutel opzoeken… + gegevens decomprimeren… + integriteit verifiëren… + \'%s\' veilig verwijderen… + opvragen… Publieke sleutels zoeken Privésleutels zoeken - Sleutel delen met... + Sleutel delen met… 512 1024 diff --git a/OpenPGP-Keychain/src/main/res/values-ru/strings.xml b/OpenPGP-Keychain/src/main/res/values-ru/strings.xml index 7d865cc23..c8aff125b 100644 --- a/OpenPGP-Keychain/src/main/res/values-ru/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-ru/strings.xml @@ -15,7 +15,7 @@ Настройки сервера ключей Изменить пароль Задать пароль - Отправить... + Отправить… Зашифровать в файл Расшифровать в файл Импорт ключей @@ -61,7 +61,7 @@ Далее Назад Буфер обмена - Поделиться... + Поделиться… Найти ключ Настройки @@ -79,9 +79,9 @@ Импорт с сервера ключей Обновить с сервера ключей Загрузить на сервер ключей - Отправить... - Отправить отпечаток... - Отправить ключ... + Отправить… + Отправить отпечаток… + Отправить ключ… Отправить Отправить QR код @@ -91,7 +91,7 @@ Подписать ключ Настройки Beam Отмена - Зашифровать.... + Зашифровать…. Подписать Сообщение @@ -115,7 +115,7 @@ Серверы ключей ID ключа Создан - Годен до... + Годен до… Применение Размер ключа Основной ID пользователя @@ -165,7 +165,7 @@ DSA ElGamal RSA - Открыть... + Открыть… Внимание Ошибка Ошибка: %s @@ -284,41 +284,41 @@ готово. - сохранение... - импорт... - экспорт... - создание ключа. это может занять до 3 минут... - создание ключа... - подготовка основного ключа... - сертификация основного ключа... - создание основной связки... - добавление доп. ключей... - сохранение ключа... + сохранение… + импорт… + экспорт… + создание ключа. это может занять до 3 минут… + создание ключа… + подготовка основного ключа… + сертификация основного ключа… + создание основной связки… + добавление доп. ключей… + сохранение ключа… - экспорт ключа... - экспорт ключей... - экспорт ключей... + экспорт ключа… + экспорт ключей… + экспорт ключей… - извлечение подписи ключа... - извлечение ключа... - подготовка к передаче... - шифрование данных... - расшифровка данных... - подготовка подписи... - формирование подписи... - обработка подписи... - проверка подписи... - подписание... - чтение данных... - поиск ключа... - распаковка данных... - проверка целостности... - безопасное удаление \'%s\'... - запрос... + извлечение подписи ключа… + извлечение ключа… + подготовка к передаче… + шифрование данных… + расшифровка данных… + подготовка подписи… + формирование подписи… + обработка подписи… + проверка подписи… + подписание… + чтение данных… + поиск ключа… + распаковка данных… + проверка целостности… + безопасное удаление \'%s\'… + запрос… Найти публичные ключи Найти секретные ключи - Отправить... + Отправить… 512 1024 @@ -386,7 +386,7 @@ %d ключей выбрано. %d ключей выбрано. - У вас пока нет ключей... + У вас пока нет ключей… Но Вы можете или создать свой ключ diff --git a/OpenPGP-Keychain/src/main/res/values-tr/strings.xml b/OpenPGP-Keychain/src/main/res/values-tr/strings.xml index 5bb5225b5..4f1becaa1 100644 --- a/OpenPGP-Keychain/src/main/res/values-tr/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-tr/strings.xml @@ -76,7 +76,7 @@ DSA ElGamal RSA - Aç... + Aç… Uyarı Hata Hata: %s @@ -96,17 +96,17 @@ bozuk veri bitti. - kaydediliyor... - alıyor... - veriyor... - anahtar oluşturuluyor... - imza hazırlanıyor... - imza oluşturuluyor... - imza işleniyor... - imza doğrulanıyor... - imzalanıyor... - veri okunuyor... - anahtar bulunuyor... + kaydediliyor… + alıyor… + veriyor… + anahtar oluşturuluyor… + imza hazırlanıyor… + imza oluşturuluyor… + imza işleniyor… + imza doğrulanıyor… + imzalanıyor… + veri okunuyor… + anahtar bulunuyor… 512 diff --git a/OpenPGP-Keychain/src/main/res/values-zh/strings.xml b/OpenPGP-Keychain/src/main/res/values-zh/strings.xml index f9422b64b..5848fb8db 100644 --- a/OpenPGP-Keychain/src/main/res/values-zh/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-zh/strings.xml @@ -24,7 +24,7 @@ 复制到剪贴板 签署密钥 取消 - 加密到... + 加密到… 签署 讯息 @@ -64,7 +64,7 @@ 4小时 8小时 永远 - 打开... + 打开… 警告 错误 @@ -106,13 +106,13 @@ 错误的密语 完成。 - 保存... - 导入中... - 导出中... + 保存… + 导入中… + 导出中… 建立密钥 正在准备主密钥 - 正在验证签名... - 正在签名... + 正在验证签名… + 正在签名… 正在读取数据 正在查找密钥 正在查询 From e482fe18fe9f61575dae191aa3fc5d3819962786 Mon Sep 17 00:00:00 2001 From: Daniel Hammann Date: Wed, 5 Mar 2014 17:44:55 +0100 Subject: [PATCH 025/109] =?UTF-8?q?Lint=20Issue:=20TypographyEllipsis:=20E?= =?UTF-8?q?llipsis=20string=20can=20be=20replaced=20with=20ellipsis=20char?= =?UTF-8?q?acter=20Replace=20"..."=20with=20ellipsis=20character=20(?= =?UTF-8?q?=E2=80=A6,=20…)=20...=20->=20=E2=80=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/res/values-de/strings.xml | 58 +++++++------- .../src/main/res/values-es-rCO/strings.xml | 2 +- .../src/main/res/values-es/strings.xml | 74 +++++++++--------- .../src/main/res/values-fr/strings.xml | 76 +++++++++--------- .../src/main/res/values-it-rIT/strings.xml | 74 +++++++++--------- .../src/main/res/values-ja/strings.xml | 72 ++++++++--------- .../src/main/res/values-nl-rNL/strings.xml | 54 ++++++------- .../src/main/res/values-ru/strings.xml | 78 +++++++++---------- .../src/main/res/values-tr/strings.xml | 24 +++--- .../src/main/res/values-zh/strings.xml | 14 ++-- 10 files changed, 263 insertions(+), 263 deletions(-) diff --git a/OpenPGP-Keychain/src/main/res/values-de/strings.xml b/OpenPGP-Keychain/src/main/res/values-de/strings.xml index df76f4e52..493a3a9bb 100644 --- a/OpenPGP-Keychain/src/main/res/values-de/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-de/strings.xml @@ -15,7 +15,7 @@ Schlüsselserver Passwort ändern Passwort setzen - E-Mail senden... + E-Mail senden… In eine Datei verschlüsseln In eine Datei entschlüsseln Schlüssel importieren @@ -163,7 +163,7 @@ DSA ElGamal RSA - Öffnen... + Öffnen… Warnung Fehler Fehler: %s @@ -273,40 +273,40 @@ fertig. - speichern... - importieren... - exportieren... - erstelle Schlüssel, dies kann bis zu 3 Minuten dauern... - erstelle Schlüssel... - Hauptschlüssel wird vorbereitet... - Hauptschlüssel wird beglaubigt... - erstelle Hauptring... - füge Unterschlüssel hinzu... - Schlüssel wird gespeichert... + speichern… + importieren… + exportieren… + erstelle Schlüssel, dies kann bis zu 3 Minuten dauern… + erstelle Schlüssel… + Hauptschlüssel wird vorbereitet… + Hauptschlüssel wird beglaubigt… + erstelle Hauptring… + füge Unterschlüssel hinzu… + Schlüssel wird gespeichert… Schlüssel wird exportiert… Schlüssel werden exportiert… - extrahiere Signaturschlüssel... - extrahiere Schlüssel... - Datenstrom wird vorbereitet... - Daten werden verschlüsselt... - Daten werden entschlüsselt... - Signatur wird vorbereitet... - Signatur wird erstellt... - Signatur wird verarbeitet... - Signatur wird verifiziert... - signiere... - Daten werden gelesen... - Schlüssel wird gesucht... - Daten werden entpackt... - Integrität wird überprüft... - \'%s\' wird sicher gelöscht... - Anfrage wird gestellt... + extrahiere Signaturschlüssel… + extrahiere Schlüssel… + Datenstrom wird vorbereitet… + Daten werden verschlüsselt… + Daten werden entschlüsselt… + Signatur wird vorbereitet… + Signatur wird erstellt… + Signatur wird verarbeitet… + Signatur wird verifiziert… + signiere… + Daten werden gelesen… + Schlüssel wird gesucht… + Daten werden entpackt… + Integrität wird überprüft… + \'%s\' wird sicher gelöscht… + Anfrage wird gestellt… Öffentliche Schlüssel suchen Private Schlüssel suchen - Teile Schlüssel über... + Teile Schlüssel über… 512 1024 diff --git a/OpenPGP-Keychain/src/main/res/values-es-rCO/strings.xml b/OpenPGP-Keychain/src/main/res/values-es-rCO/strings.xml index 6efe9548d..e43cecc2c 100644 --- a/OpenPGP-Keychain/src/main/res/values-es-rCO/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-es-rCO/strings.xml @@ -12,7 +12,7 @@ Aplicaciones registradas Cambiar contraseña Establecer contraseña - Enviar correo electrónico... + Enviar correo electrónico… Cifrar a archivo Descifrar a archivo Importar claves diff --git a/OpenPGP-Keychain/src/main/res/values-es/strings.xml b/OpenPGP-Keychain/src/main/res/values-es/strings.xml index e07e049cd..edf190184 100644 --- a/OpenPGP-Keychain/src/main/res/values-es/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-es/strings.xml @@ -15,7 +15,7 @@ Prioridad del servidor de claves Cambiar la frase de contraseña Establecer frase de contraseña - Enviar email... + Enviar email… Cifrar hacia archivo Descifrar hacia archivo Importar claves @@ -61,7 +61,7 @@ Siguiente Volver Portapapeles - Compartir con... + Compartir con… Buscar clave Ajustes @@ -80,10 +80,10 @@ Actualizar desde servidor de claves Cargar al servidor de claves Compartir - Compartir la huella digital... - Compartir la clave completa... - con... - con... + Compartir la huella digital… + Compartir la clave completa… + con… + con… con código QR con código QR con NFC @@ -91,7 +91,7 @@ Clave de firma Ajustes de Beam Cancelar - Cifrar hacia... + Cifrar hacia… Firmar Mensaje @@ -163,7 +163,7 @@ DSA ElGamal RSA - Abrir... + Abrir… Advertencia Error Error: %s @@ -275,40 +275,40 @@ hecho. - guardando... - importando... - exportando... - generando la clave, esto puede tardar más de 3 minutos... - construyendo la clave... - preparando la clave maestra... - certificando la clave maestra... - construyendo el anillo maestro... - añadiendo las subclaves... - guardando claves... + guardando… + importando… + exportando… + generando la clave, esto puede tardar más de 3 minutos… + construyendo la clave… + preparando la clave maestra… + certificando la clave maestra… + construyendo el anillo maestro… + añadiendo las subclaves… + guardando claves… - exportando clave... - exportando claves... + exportando clave… + exportando claves… - extrayendo la clave de firma... - extrayendo la clave... - preparando las transmisiones... - cifrando los datos... - descifrando los datos... - preparando la firma... - generando la firma... - procesando la firma... - verificando la firma... - firmando... - leyendo los datos... - localizando la clave... - descomprimiendo los datos... - verificando la integridad... + extrayendo la clave de firma… + extrayendo la clave… + preparando las transmisiones… + cifrando los datos… + descifrando los datos… + preparando la firma… + generando la firma… + procesando la firma… + verificando la firma… + firmando… + leyendo los datos… + localizando la clave… + descomprimiendo los datos… + verificando la integridad… borrando \'%s\' de forma segura… - consultando... + consultando… Buscar claves públicas Buscar claves secretas - Compartir la clave con... + Compartir la clave con… 512 1024 @@ -374,7 +374,7 @@ 1 clave seleccionada. %d claves seleccionadas. - Aún no hay claves disponibles... + Aún no hay claves disponibles… Puedes empezar por o crear tu propia clave diff --git a/OpenPGP-Keychain/src/main/res/values-fr/strings.xml b/OpenPGP-Keychain/src/main/res/values-fr/strings.xml index 563ee636e..171ce1fa5 100644 --- a/OpenPGP-Keychain/src/main/res/values-fr/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-fr/strings.xml @@ -15,7 +15,7 @@ Préférences du serveur de clefs Changer la phrase de passe Définir la phrase de passe - Envoyer un courriel... + Envoyer un courriel… Chiffrer vers un fichier Déchiffrer vers un fichier importer des clefs @@ -61,7 +61,7 @@ Suivant Retour Presse-papiers - Partager avec... + Partager avec… Rechercher la clef Paramètres @@ -80,10 +80,10 @@ Mettre à jour depuis le serveur de clefs Téléverser vers le serveur de clefs Partager - Partager l\'empreinte... - Partager la clef entière... - avec... - avec... + Partager l\'empreinte… + Partager la clef entière… + avec… + avec… par un code QR par un code QR par la NFC @@ -91,7 +91,7 @@ Signer la clef Paramètres Beam Annuler - Chiffrer vers... + Chiffrer vers… Signer Message @@ -163,7 +163,7 @@ DSA ElGamal RSA - Ouvrir... + Ouvrir… Avertissement Erreur Erreur : %s @@ -275,40 +275,40 @@ fait. - sauvegarde... - importation... - exportation... - génération de la clef, ceci peut prendre jusqu\'à 3 minutes... - assemblage de la clef... - préparation de la clef maîtresse... - certification de la clef maîtresse... - assemblage du trousseau maître... - ajout des sous-clefs... - sauvegarde de la clef... + sauvegarde… + importation… + exportation… + génération de la clef, ceci peut prendre jusqu\'à 3 minutes… + assemblage de la clef… + préparation de la clef maîtresse… + certification de la clef maîtresse… + assemblage du trousseau maître… + ajout des sous-clefs… + sauvegarde de la clef… - exportation de la clef... - exportation des clefs... + exportation de la clef… + exportation des clefs… - extraction de la clef de signature... - extraction de la clef... - préparation des flux... - chiffrement des données... - déchiffrement des données... - préparation de la signature... - génération de la signature... - traitement de la signature... - vérification de la signature... - signature... - lecture des données... - recherche de la clef... - décompression des données... - vérification de l\'intégrité... - suppression sûre de « %s »... - interrogation... + extraction de la clef de signature… + extraction de la clef… + préparation des flux… + chiffrement des données… + déchiffrement des données… + préparation de la signature… + génération de la signature… + traitement de la signature… + vérification de la signature… + signature… + lecture des données… + recherche de la clef… + décompression des données… + vérification de l\'intégrité… + suppression sûre de « %s »… + interrogation… Rechercher des clefs publiques Rechercher des clefs secrètes - Partager la clef avec... + Partager la clef avec… 512 1024 @@ -374,7 +374,7 @@ 1 clef choisie %d clefs choisies - Aucune clef encore disponible... + Aucune clef encore disponible… Vous pouvez commencer par ou créer votre propre clef diff --git a/OpenPGP-Keychain/src/main/res/values-it-rIT/strings.xml b/OpenPGP-Keychain/src/main/res/values-it-rIT/strings.xml index 041a9d0f1..5ceb4f45b 100644 --- a/OpenPGP-Keychain/src/main/res/values-it-rIT/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-it-rIT/strings.xml @@ -15,7 +15,7 @@ Preferenze Server delle Chiavi Cambia Frase di Accesso Imposta Frase di Accesso - Invia Mail... + Invia Mail… Codifica File Decodifica File Importa Chiavi @@ -61,7 +61,7 @@ Prossimo Precedente Appunti - Condividi con... + Condividi con… Chiave di ricerca Impostazioni @@ -80,10 +80,10 @@ Aggiorna dal server delle chiavi Carica chiave nel server Condividi - Condivi impronta... - Condividi intera chiave... + Condivi impronta… + Condividi intera chiave… con.. - con... + con… con Codice QR con Codice QR con NFC @@ -91,7 +91,7 @@ Firma chiave Impostazioni Beam Annulla - Codifica su... + Codifica su… Firma Messaggio @@ -163,7 +163,7 @@ DSA ElGamal RSA - Apri... + Apri… Attenzione Errore Errore: %s @@ -275,40 +275,40 @@ fatto. - salvataggio... - importazione... - esportazione... - generazione chiave, richiede fino a 3 minuti... - fabbricazione chiave... - preparazione chiave principale... - certificazione chiave principale... - fabbricazione portachiavi principale... - aggiunta sottochiavi... - salvataggio chiavi... + salvataggio… + importazione… + esportazione… + generazione chiave, richiede fino a 3 minuti… + fabbricazione chiave… + preparazione chiave principale… + certificazione chiave principale… + fabbricazione portachiavi principale… + aggiunta sottochiavi… + salvataggio chiavi… - esportazione chiave... - esportazione chiavi... + esportazione chiave… + esportazione chiavi… - estrazione chiavi di firma... - estrazione chiave... - preparazione flussi... - codifica dati... - decodifica dati... - preparazione firma... - generazione firma... - elaborazione firma... - verifica firma... - firma... - lettura dati... - ricerca chiave... - decompressione dati... - verifica integrita\'... - eliminazione sicura di \'%s\'... - interrogazione... + estrazione chiavi di firma… + estrazione chiave… + preparazione flussi… + codifica dati… + decodifica dati… + preparazione firma… + generazione firma… + elaborazione firma… + verifica firma… + firma… + lettura dati… + ricerca chiave… + decompressione dati… + verifica integrita\'… + eliminazione sicura di \'%s\'… + interrogazione… Ricerca Chiavi Pubbliche Cerca Chiave Privata - Condividi chiave con... + Condividi chiave con… 512 1024 @@ -374,7 +374,7 @@ 1 chiave selezionata. %d chiavi selezionate. - Nessuna chiave disponibile... + Nessuna chiave disponibile… Puoi iniziare da o creazione della tua chiave diff --git a/OpenPGP-Keychain/src/main/res/values-ja/strings.xml b/OpenPGP-Keychain/src/main/res/values-ja/strings.xml index 0c80d4a2c..0ba511c1e 100644 --- a/OpenPGP-Keychain/src/main/res/values-ja/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-ja/strings.xml @@ -15,7 +15,7 @@ 鍵サーバ設定 パスフレーズの変更 パスフレーズの設定 - メールの送信... + メールの送信… 暗号化してファイルに 復号化してファイルに 鍵のインポート @@ -61,7 +61,7 @@ 戻る クリップボード - 共有... + 共有… 鍵検出 設定 @@ -80,10 +80,10 @@ 鍵サーバからの更新 鍵サーバへのアップロード 共有 - 指紋の共有... - すべての鍵の共有... - ...(指紋) - ...(鍵) + 指紋の共有… + すべての鍵の共有… + …(指紋) + …(鍵) QRコードで共有(鍵) QRコードで共有(指紋) NFCで共有 @@ -91,7 +91,7 @@ 鍵を署名 Beamの設定 キャンセル - 暗号化... + 暗号化… 署名 メッセージ @@ -161,7 +161,7 @@ DSA ElGamal RSA - 開く... + 開く… 注意 エラー エラー: %s @@ -266,39 +266,39 @@ 完了。 - 保存... - インポート... - エクスポート... - 鍵の生成、3分ほどかかります... - 鍵の構築中... - 主鍵の準備中... - 主鍵の検証中... - 主鍵輪の構築中... - 副鍵の追加中... - 鍵の保存... + 保存… + インポート… + エクスポート… + 鍵の生成、3分ほどかかります… + 鍵の構築中… + 主鍵の準備中… + 主鍵の検証中… + 主鍵輪の構築中… + 副鍵の追加中… + 鍵の保存… - 鍵のエクスポート... + 鍵のエクスポート… - 署名鍵の取り出し中... - 鍵の取り出し中... - ストリームの準備中... - データの暗号化中... - データの復号化中... - 署名の準備中... - 署名の生成中... - 署名処理中... - 署名の検証中... - 署名中... - データ読み込み中... - 鍵検索中... - データの展開中... - 完全性の検証中... + 署名鍵の取り出し中… + 鍵の取り出し中… + ストリームの準備中… + データの暗号化中… + データの復号化中… + 署名の準備中… + 署名の生成中… + 署名処理中… + 署名の検証中… + 署名中… + データ読み込み中… + 鍵検索中… + データの展開中… + 完全性の検証中… \'%s\' を完全に削除中… - 要求中... + 要求中… 公開鍵の検索 秘密鍵の検索 - 鍵の共有... + 鍵の共有… 512 1024 @@ -362,7 +362,7 @@ %d の鍵を選択。 - すでにその鍵は存在しません... + すでにその鍵は存在しません… で始める もしくは あなた所有の鍵を作る diff --git a/OpenPGP-Keychain/src/main/res/values-nl-rNL/strings.xml b/OpenPGP-Keychain/src/main/res/values-nl-rNL/strings.xml index 7d7efa616..35a0b5a03 100644 --- a/OpenPGP-Keychain/src/main/res/values-nl-rNL/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-nl-rNL/strings.xml @@ -12,7 +12,7 @@ Geregistreerde apps Wachtwoord wijzigen Wachtwoord instellen - E-mail verzenden... + E-mail verzenden… Versleutelen naar bestand Ontsleutelen naar bestand Sleutels importeren @@ -109,7 +109,7 @@ DSA ElGamal RSA - Openen... + Openen… Waarschuwing Fout Fout: %s @@ -172,34 +172,34 @@ Niets te importeren gereed. - opslaan... - importeren... - exporteren... - sleutel maken... - hoofdsleutel voorbereiden... - hoofdsleutel certificeren... - hoofdsleutelbos maken... - sub-sleutels toevoegen... - ondertekeningssleutel uitpakken... - sleutel uitpakken... - streams voorbereiden... - gegevens versleutelen... - gegevens ontsleutelen... - handtekening voorbereiden... - handtekening genereren... - handtekening verwerken... - handtekening verifiëren... - ondertekenen... - gegevens lezen... - sleutel opzoeken... - gegevens decomprimeren... - integriteit verifiëren... - \'%s\' veilig verwijderen... - opvragen... + opslaan… + importeren… + exporteren… + sleutel maken… + hoofdsleutel voorbereiden… + hoofdsleutel certificeren… + hoofdsleutelbos maken… + sub-sleutels toevoegen… + ondertekeningssleutel uitpakken… + sleutel uitpakken… + streams voorbereiden… + gegevens versleutelen… + gegevens ontsleutelen… + handtekening voorbereiden… + handtekening genereren… + handtekening verwerken… + handtekening verifiëren… + ondertekenen… + gegevens lezen… + sleutel opzoeken… + gegevens decomprimeren… + integriteit verifiëren… + \'%s\' veilig verwijderen… + opvragen… Publieke sleutels zoeken Privésleutels zoeken - Sleutel delen met... + Sleutel delen met… 512 1024 diff --git a/OpenPGP-Keychain/src/main/res/values-ru/strings.xml b/OpenPGP-Keychain/src/main/res/values-ru/strings.xml index 7d865cc23..c8aff125b 100644 --- a/OpenPGP-Keychain/src/main/res/values-ru/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-ru/strings.xml @@ -15,7 +15,7 @@ Настройки сервера ключей Изменить пароль Задать пароль - Отправить... + Отправить… Зашифровать в файл Расшифровать в файл Импорт ключей @@ -61,7 +61,7 @@ Далее Назад Буфер обмена - Поделиться... + Поделиться… Найти ключ Настройки @@ -79,9 +79,9 @@ Импорт с сервера ключей Обновить с сервера ключей Загрузить на сервер ключей - Отправить... - Отправить отпечаток... - Отправить ключ... + Отправить… + Отправить отпечаток… + Отправить ключ… Отправить Отправить QR код @@ -91,7 +91,7 @@ Подписать ключ Настройки Beam Отмена - Зашифровать.... + Зашифровать…. Подписать Сообщение @@ -115,7 +115,7 @@ Серверы ключей ID ключа Создан - Годен до... + Годен до… Применение Размер ключа Основной ID пользователя @@ -165,7 +165,7 @@ DSA ElGamal RSA - Открыть... + Открыть… Внимание Ошибка Ошибка: %s @@ -284,41 +284,41 @@ готово. - сохранение... - импорт... - экспорт... - создание ключа. это может занять до 3 минут... - создание ключа... - подготовка основного ключа... - сертификация основного ключа... - создание основной связки... - добавление доп. ключей... - сохранение ключа... + сохранение… + импорт… + экспорт… + создание ключа. это может занять до 3 минут… + создание ключа… + подготовка основного ключа… + сертификация основного ключа… + создание основной связки… + добавление доп. ключей… + сохранение ключа… - экспорт ключа... - экспорт ключей... - экспорт ключей... + экспорт ключа… + экспорт ключей… + экспорт ключей… - извлечение подписи ключа... - извлечение ключа... - подготовка к передаче... - шифрование данных... - расшифровка данных... - подготовка подписи... - формирование подписи... - обработка подписи... - проверка подписи... - подписание... - чтение данных... - поиск ключа... - распаковка данных... - проверка целостности... - безопасное удаление \'%s\'... - запрос... + извлечение подписи ключа… + извлечение ключа… + подготовка к передаче… + шифрование данных… + расшифровка данных… + подготовка подписи… + формирование подписи… + обработка подписи… + проверка подписи… + подписание… + чтение данных… + поиск ключа… + распаковка данных… + проверка целостности… + безопасное удаление \'%s\'… + запрос… Найти публичные ключи Найти секретные ключи - Отправить... + Отправить… 512 1024 @@ -386,7 +386,7 @@ %d ключей выбрано. %d ключей выбрано. - У вас пока нет ключей... + У вас пока нет ключей… Но Вы можете или создать свой ключ diff --git a/OpenPGP-Keychain/src/main/res/values-tr/strings.xml b/OpenPGP-Keychain/src/main/res/values-tr/strings.xml index 5bb5225b5..4f1becaa1 100644 --- a/OpenPGP-Keychain/src/main/res/values-tr/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-tr/strings.xml @@ -76,7 +76,7 @@ DSA ElGamal RSA - Aç... + Aç… Uyarı Hata Hata: %s @@ -96,17 +96,17 @@ bozuk veri bitti. - kaydediliyor... - alıyor... - veriyor... - anahtar oluşturuluyor... - imza hazırlanıyor... - imza oluşturuluyor... - imza işleniyor... - imza doğrulanıyor... - imzalanıyor... - veri okunuyor... - anahtar bulunuyor... + kaydediliyor… + alıyor… + veriyor… + anahtar oluşturuluyor… + imza hazırlanıyor… + imza oluşturuluyor… + imza işleniyor… + imza doğrulanıyor… + imzalanıyor… + veri okunuyor… + anahtar bulunuyor… 512 diff --git a/OpenPGP-Keychain/src/main/res/values-zh/strings.xml b/OpenPGP-Keychain/src/main/res/values-zh/strings.xml index f9422b64b..5848fb8db 100644 --- a/OpenPGP-Keychain/src/main/res/values-zh/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-zh/strings.xml @@ -24,7 +24,7 @@ 复制到剪贴板 签署密钥 取消 - 加密到... + 加密到… 签署 讯息 @@ -64,7 +64,7 @@ 4小时 8小时 永远 - 打开... + 打开… 警告 错误 @@ -106,13 +106,13 @@ 错误的密语 完成。 - 保存... - 导入中... - 导出中... + 保存… + 导入中… + 导出中… 建立密钥 正在准备主密钥 - 正在验证签名... - 正在签名... + 正在验证签名… + 正在签名… 正在读取数据 正在查找密钥 正在查询 From 92ba91de1483e64d173b135c73012851bd372cbe Mon Sep 17 00:00:00 2001 From: Bhargav Golla Date: Wed, 5 Mar 2014 12:48:24 -0500 Subject: [PATCH 026/109] Set min date to one day after Created Date. Works on Honeycomb and above --- .../keychain/ui/widget/KeyEditor.java | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java index b8bb547ee..7344248f7 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java @@ -34,6 +34,7 @@ import android.app.DatePickerDialog; import android.app.Dialog; import android.content.Context; import android.content.DialogInterface; +import android.text.format.DateUtils; import android.util.AttributeSet; import android.view.View; import android.view.View.OnClickListener; @@ -58,6 +59,7 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener { Spinner mUsage; TextView mCreationDate; BootstrapButton mExpiryDateButton; + GregorianCalendar mCreatedDate; GregorianCalendar mExpiryDate; private int mDatePickerResultCount = 0; @@ -106,8 +108,7 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener { mDeleteButton.setOnClickListener(this); setExpiryDate(null); - String creationDate = mCreationDate.getText().toString(); - Date date = DateFormat.getDateInstance().parse(creationDate); + mExpiryDateButton.setOnClickListener(new OnClickListener() { public void onClick(View v) { GregorianCalendar date = mExpiryDate; @@ -130,7 +131,18 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener { } } }); - dialog.getDatePicker().setMinDate(date.getTime()); + if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) { + if ( dialog != null && mCreatedDate != null ) { + dialog.getDatePicker().setMinDate(mCreatedDate.getTime().getTime()+ DateUtils.DAY_IN_MILLIS); + android.util.Log.w("Date picker", "Date min set"); + } else { + //When created date isn't available + dialog.getDatePicker().setMinDate(date.getTime().getTime()+ DateUtils.DAY_IN_MILLIS); + android.util.Log.w("Date picker", "Date min set using current time"); + } + } else { + android.util.Log.w("Date picker", "API Level < 11 so not restricting date range..."); + } dialog.show(); } }); @@ -207,7 +219,7 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener { GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("UTC")); cal.setTime(PgpKeyHelper.getCreationDate(key)); - mCreationDate.setText(DateFormat.getDateInstance().format(cal.getTime())); + setCreatedDate(cal); cal = new GregorianCalendar(TimeZone.getTimeZone("UTC")); Date expiryDate = PgpKeyHelper.getExpiryDate(key); if (expiryDate == null) { @@ -237,6 +249,15 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener { mEditorListener = listener; } + private void setCreatedDate(GregorianCalendar date) { + mCreatedDate = date; + if (date == null) { + mCreationDate.setText(getContext().getString(R.string.none)); + } else { + mCreationDate.setText(DateFormat.getDateInstance().format(date.getTime())); + } + } + private void setExpiryDate(GregorianCalendar date) { mExpiryDate = date; if (date == null) { From 2000959997249bf948d61717edab5df7080278cf Mon Sep 17 00:00:00 2001 From: uberspot Date: Wed, 5 Mar 2014 20:42:11 +0200 Subject: [PATCH 027/109] Put Preferences in subscreen --- OpenPGP-Keychain/src/main/AndroidManifest.xml | 11 +- .../keychain/ui/PreferencesActivity.java | 292 ++++++++++++++---- .../{preferences.xml => adv_preferences.xml} | 17 +- .../src/main/res/xml/gen_preferences.xml | 32 ++ .../src/main/res/xml/preference_headers.xml | 25 ++ .../res/xml/preference_headers_legacy.xml | 29 ++ 6 files changed, 323 insertions(+), 83 deletions(-) rename OpenPGP-Keychain/src/main/res/xml/{preferences.xml => adv_preferences.xml} (77%) create mode 100644 OpenPGP-Keychain/src/main/res/xml/gen_preferences.xml create mode 100644 OpenPGP-Keychain/src/main/res/xml/preference_headers.xml create mode 100644 OpenPGP-Keychain/src/main/res/xml/preference_headers_legacy.xml diff --git a/OpenPGP-Keychain/src/main/AndroidManifest.xml b/OpenPGP-Keychain/src/main/AndroidManifest.xml index 76c4c6a2e..10a307bfb 100644 --- a/OpenPGP-Keychain/src/main/AndroidManifest.xml +++ b/OpenPGP-Keychain/src/main/AndroidManifest.xml @@ -277,7 +277,16 @@ + android:label="@string/title_preferences" > + + + + + + + + + target) { + super.onBuildHeaders(target); + loadHeadersFromResource(R.xml.preference_headers, target); + } + + /** This fragment shows the general preferences in android 3.0+ */ + public static class GeneralPrefsFragment extends PreferenceFragment { + + private PreferenceScreen mKeyServerPreference = null; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // Load the preferences from an XML resource + addPreferencesFromResource(R.xml.gen_preferences); + + initializePassPassPhraceCacheTtl( + (IntegerListPreference) findPreference(Constants.pref.PASS_PHRASE_CACHE_TTL)); + + mKeyServerPreference = (PreferenceScreen) findPreference(Constants.pref.KEY_SERVERS); + String servers[] = mPreferences.getKeyServers(); + mKeyServerPreference.setSummary(getResources().getQuantityString(R.plurals.n_key_servers, + servers.length, servers.length)); + mKeyServerPreference + .setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { + public boolean onPreferenceClick(Preference preference) { + Intent intent = new Intent(getActivity(), + PreferencesKeyServerActivity.class); + intent.putExtra(PreferencesKeyServerActivity.EXTRA_KEY_SERVERS, + mPreferences.getKeyServers()); + startActivityForResult(intent, Id.request.key_server_preference); + return false; + } + }); + } + + @Override + public void onActivityResult(int requestCode, int resultCode, Intent data) { + switch (requestCode) { + case Id.request.key_server_preference: { + if (resultCode == RESULT_CANCELED || data == null) { + return; + } + String servers[] = data + .getStringArrayExtra(PreferencesKeyServerActivity.EXTRA_KEY_SERVERS); + mPreferences.setKeyServers(servers); + mKeyServerPreference.setSummary(getResources().getQuantityString( + R.plurals.n_key_servers, servers.length, servers.length)); + break; + } + + default: { + super.onActivityResult(requestCode, resultCode, data); + break; + } + } + } + } + + /** This fragment shows the advanced preferences in android 3.0+ */ + public static class AdvancedPrefsFragment extends PreferenceFragment { + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + // Load the preferences from an XML resource + addPreferencesFromResource(R.xml.adv_preferences); + + initializeEncryptionAlgorithm( + (IntegerListPreference) findPreference(Constants.pref.DEFAULT_ENCRYPTION_ALGORITHM)); + + int[] valueIds = new int[] { Id.choice.compression.none, Id.choice.compression.zip, + Id.choice.compression.zlib, Id.choice.compression.bzip2, }; + String[] entries = new String[] { + getString(R.string.choice_none) + " (" + getString(R.string.compression_fast) + ")", + "ZIP (" + getString(R.string.compression_fast) + ")", + "ZLIB (" + getString(R.string.compression_fast) + ")", + "BZIP2 (" + getString(R.string.compression_very_slow) + ")", }; + String[] values = new String[valueIds.length]; + for (int i = 0; i < values.length; ++i) { + values[i] = "" + valueIds[i]; + } + + initializeHashAlgorithm( + (IntegerListPreference) findPreference(Constants.pref.DEFAULT_HASH_ALGORITHM), + valueIds, entries, values); + + initializeMessageCompression( + (IntegerListPreference) findPreference(Constants.pref.DEFAULT_MESSAGE_COMPRESSION), + valueIds, entries, values); + + initializeFileCompression( + (IntegerListPreference) findPreference(Constants.pref.DEFAULT_FILE_COMPRESSION), + entries, values); + + initializeAsciiArmour((CheckBoxPreference) findPreference(Constants.pref.DEFAULT_ASCII_ARMOUR)); + + initializeForceV3Signatures((CheckBoxPreference) findPreference(Constants.pref.FORCE_V3_SIGNATURES)); + } + } + + protected boolean isValidFragment (String fragmentName) { + return AdvancedPrefsFragment.class.getName().equals(fragmentName) + || GeneralPrefsFragment.class.getName().equals(fragmentName) + || super.isValidFragment(fragmentName); + } + + private static void initializePassPassPhraceCacheTtl(final IntegerListPreference mPassPhraseCacheTtl) { mPassPhraseCacheTtl.setValue("" + mPreferences.getPassPhraseCacheTtl()); mPassPhraseCacheTtl.setSummary(mPassPhraseCacheTtl.getEntry()); mPassPhraseCacheTtl @@ -67,8 +267,9 @@ public class PreferencesActivity extends PreferenceActivity { return false; } }); + } - mEncryptionAlgorithm = (IntegerListPreference) findPreference(Constants.pref.DEFAULT_ENCRYPTION_ALGORITHM); + private static void initializeEncryptionAlgorithm(final IntegerListPreference mEncryptionAlgorithm) { int valueIds[] = { PGPEncryptedData.AES_128, PGPEncryptedData.AES_192, PGPEncryptedData.AES_256, PGPEncryptedData.BLOWFISH, PGPEncryptedData.TWOFISH, PGPEncryptedData.CAST5, PGPEncryptedData.DES, PGPEncryptedData.TRIPLE_DES, @@ -93,8 +294,10 @@ public class PreferencesActivity extends PreferenceActivity { return false; } }); + } - mHashAlgorithm = (IntegerListPreference) findPreference(Constants.pref.DEFAULT_HASH_ALGORITHM); + private static void initializeHashAlgorithm + (final IntegerListPreference mHashAlgorithm, int[] valueIds, String[] entries, String[] values) { valueIds = new int[] { HashAlgorithmTags.MD5, HashAlgorithmTags.RIPEMD160, HashAlgorithmTags.SHA1, HashAlgorithmTags.SHA224, HashAlgorithmTags.SHA256, HashAlgorithmTags.SHA384, HashAlgorithmTags.SHA512, }; @@ -116,19 +319,10 @@ public class PreferencesActivity extends PreferenceActivity { return false; } }); + } - mMessageCompression = (IntegerListPreference) findPreference(Constants.pref.DEFAULT_MESSAGE_COMPRESSION); - valueIds = new int[] { Id.choice.compression.none, Id.choice.compression.zip, - Id.choice.compression.zlib, Id.choice.compression.bzip2, }; - entries = new String[] { - getString(R.string.choice_none) + " (" + getString(R.string.compression_fast) + ")", - "ZIP (" + getString(R.string.compression_fast) + ")", - "ZLIB (" + getString(R.string.compression_fast) + ")", - "BZIP2 (" + getString(R.string.compression_very_slow) + ")", }; - values = new String[valueIds.length]; - for (int i = 0; i < values.length; ++i) { - values[i] = "" + valueIds[i]; - } + private static void initializeMessageCompression + (final IntegerListPreference mMessageCompression, int[] valueIds, String[] entries, String[] values) { mMessageCompression.setEntries(entries); mMessageCompression.setEntryValues(values); mMessageCompression.setValue("" + mPreferences.getDefaultMessageCompression()); @@ -143,8 +337,10 @@ public class PreferencesActivity extends PreferenceActivity { return false; } }); + } - mFileCompression = (IntegerListPreference) findPreference(Constants.pref.DEFAULT_FILE_COMPRESSION); + private static void initializeFileCompression + (final IntegerListPreference mFileCompression, String[] entries, String[] values) { mFileCompression.setEntries(entries); mFileCompression.setEntryValues(values); mFileCompression.setValue("" + mPreferences.getDefaultFileCompression()); @@ -157,8 +353,9 @@ public class PreferencesActivity extends PreferenceActivity { return false; } }); + } - mAsciiArmour = (CheckBoxPreference) findPreference(Constants.pref.DEFAULT_ASCII_ARMOUR); + private static void initializeAsciiArmour(final CheckBoxPreference mAsciiArmour) { mAsciiArmour.setChecked(mPreferences.getDefaultAsciiArmour()); mAsciiArmour.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { @@ -167,8 +364,9 @@ public class PreferencesActivity extends PreferenceActivity { return false; } }); + } - mForceV3Signatures = (CheckBoxPreference) findPreference(Constants.pref.FORCE_V3_SIGNATURES); + private static void initializeForceV3Signatures(final CheckBoxPreference mForceV3Signatures) { mForceV3Signatures.setChecked(mPreferences.getForceV3Signatures()); mForceV3Signatures .setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { @@ -178,43 +376,5 @@ public class PreferencesActivity extends PreferenceActivity { return false; } }); - - mKeyServerPreference = (PreferenceScreen) findPreference(Constants.pref.KEY_SERVERS); - String servers[] = mPreferences.getKeyServers(); - mKeyServerPreference.setSummary(getResources().getQuantityString(R.plurals.n_key_servers, - servers.length, servers.length)); - mKeyServerPreference - .setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() { - public boolean onPreferenceClick(Preference preference) { - Intent intent = new Intent(PreferencesActivity.this, - PreferencesKeyServerActivity.class); - intent.putExtra(PreferencesKeyServerActivity.EXTRA_KEY_SERVERS, - mPreferences.getKeyServers()); - startActivityForResult(intent, Id.request.key_server_preference); - return false; - } - }); } - - @Override - protected void onActivityResult(int requestCode, int resultCode, Intent data) { - switch (requestCode) { - case Id.request.key_server_preference: { - if (resultCode == RESULT_CANCELED || data == null) { - return; - } - String servers[] = data - .getStringArrayExtra(PreferencesKeyServerActivity.EXTRA_KEY_SERVERS); - mPreferences.setKeyServers(servers); - mKeyServerPreference.setSummary(getResources().getQuantityString( - R.plurals.n_key_servers, servers.length, servers.length)); - break; - } - - default: { - super.onActivityResult(requestCode, resultCode, data); - break; - } - } - } -} +} \ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/res/xml/preferences.xml b/OpenPGP-Keychain/src/main/res/xml/adv_preferences.xml similarity index 77% rename from OpenPGP-Keychain/src/main/res/xml/preferences.xml rename to OpenPGP-Keychain/src/main/res/xml/adv_preferences.xml index f5b46c232..2705bd22f 100644 --- a/OpenPGP-Keychain/src/main/res/xml/preferences.xml +++ b/OpenPGP-Keychain/src/main/res/xml/adv_preferences.xml @@ -15,21 +15,7 @@ limitations under the License. --> - - - - - - - + - \ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/res/xml/gen_preferences.xml b/OpenPGP-Keychain/src/main/res/xml/gen_preferences.xml new file mode 100644 index 000000000..f83fcb0f6 --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/xml/gen_preferences.xml @@ -0,0 +1,32 @@ + + + + + + + + + + \ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/res/xml/preference_headers.xml b/OpenPGP-Keychain/src/main/res/xml/preference_headers.xml new file mode 100644 index 000000000..3506ba322 --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/xml/preference_headers.xml @@ -0,0 +1,25 @@ + + + + +
+
+ \ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/res/xml/preference_headers_legacy.xml b/OpenPGP-Keychain/src/main/res/xml/preference_headers_legacy.xml new file mode 100644 index 000000000..141bf93e5 --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/xml/preference_headers_legacy.xml @@ -0,0 +1,29 @@ + + + + + + + + + + + \ No newline at end of file From a7a8f0a78ef083965f4ca2fe07d6811032fdc65a Mon Sep 17 00:00:00 2001 From: Miroojin Bakshi Date: Thu, 6 Mar 2014 01:13:08 +0530 Subject: [PATCH 028/109] Add documentation --- .../keychain/ui/widget/KeyEditor.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java index b88d3bd32..b844a0619 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java @@ -113,7 +113,11 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener { if (date == null) { date = new GregorianCalendar(TimeZone.getTimeZone("UTC")); } - + /* + * Using custom DatePickerDialog which overrides the setTitle because + * the DatePickerDialog title is buggy (unix warparound bug). + * See: https://code.google.com/p/android/issues/detail?id=49066 + */ DatePickerDialog dialog = new ExpiryDatePickerDialog(getContext(), mExpiryDateSetListener, date.get(Calendar.YEAR), date.get(Calendar.MONTH), date.get(Calendar.DAY_OF_MONTH)); @@ -129,8 +133,9 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener { } } }); - //setCalendarViewShown() is supported from API 11 onwards. + // setCalendarViewShown() is supported from API 11 onwards. if (android.os.Build.VERSION.SDK_INT >= 11) + // Hide calendarView in tablets because of the unix warparound bug. dialog.getDatePicker().setCalendarViewShown(false); dialog.show(); } @@ -262,7 +267,7 @@ class ExpiryDatePickerDialog extends DatePickerDialog { public ExpiryDatePickerDialog(Context context, OnDateSetListener callBack, int year, int monthOfYear, int dayOfMonth) { super(context, callBack, year, monthOfYear, dayOfMonth); } - + //Set permanent title. public void setTitle(CharSequence title) { super.setTitle("Set date"); } From 42fc15e66e3efbb98fa0587569dc8b1f426c0b8a Mon Sep 17 00:00:00 2001 From: Bhargav Golla Date: Wed, 5 Mar 2014 14:46:38 -0500 Subject: [PATCH 029/109] Removed log statements as per Dominik's suggestions --- .../org/sufficientlysecure/keychain/ui/widget/KeyEditor.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java index 7344248f7..b9d8eb81c 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java @@ -134,14 +134,10 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) { if ( dialog != null && mCreatedDate != null ) { dialog.getDatePicker().setMinDate(mCreatedDate.getTime().getTime()+ DateUtils.DAY_IN_MILLIS); - android.util.Log.w("Date picker", "Date min set"); } else { //When created date isn't available dialog.getDatePicker().setMinDate(date.getTime().getTime()+ DateUtils.DAY_IN_MILLIS); - android.util.Log.w("Date picker", "Date min set using current time"); } - } else { - android.util.Log.w("Date picker", "API Level < 11 so not restricting date range..."); } dialog.show(); } From 127ab0fd817efa62b5375e9e158c68d5e50dad6c Mon Sep 17 00:00:00 2001 From: Miroojin Bakshi Date: Thu, 6 Mar 2014 01:27:35 +0530 Subject: [PATCH 030/109] Use string from strings.xml --- .../org/sufficientlysecure/keychain/ui/widget/KeyEditor.java | 2 +- OpenPGP-Keychain/src/main/res/values/strings.xml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java index b844a0619..4598b54b1 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java @@ -269,6 +269,6 @@ class ExpiryDatePickerDialog extends DatePickerDialog { } //Set permanent title. public void setTitle(CharSequence title) { - super.setTitle("Set date"); + super.setTitle(getContext().getString(R.string.expiry_date_dialog_title)); } } diff --git a/OpenPGP-Keychain/src/main/res/values/strings.xml b/OpenPGP-Keychain/src/main/res/values/strings.xml index 3ca5f5426..9689010ed 100644 --- a/OpenPGP-Keychain/src/main/res/values/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values/strings.xml @@ -130,6 +130,7 @@ Upload key to selected keyserver after certification Fingerprint Select + Set expiry date %d selected From 53f61893018403047c87e3d9618c82e9f03b0c55 Mon Sep 17 00:00:00 2001 From: Miroojin Bakshi Date: Thu, 6 Mar 2014 02:24:13 +0530 Subject: [PATCH 031/109] Implement search for KeyListPublicFragment --- .../keychain/ui/KeyListPublicFragment.java | 47 ++++++++++++++++-- .../res/drawable-mdpi/ic_action_search.png | Bin 0 -> 2349 bytes .../src/main/res/menu/key_list_public.xml | 7 ++- 3 files changed, 49 insertions(+), 5 deletions(-) create mode 100644 OpenPGP-Keychain/src/main/res/drawable-mdpi/ic_action_search.png diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java index 0afa556cb..af5d946eb 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java @@ -46,9 +46,13 @@ import android.support.v4.app.Fragment; import android.support.v4.app.LoaderManager; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; +import android.support.v4.view.MenuItemCompat; +import android.support.v7.widget.SearchView; +import android.text.TextUtils; import android.view.ActionMode; import android.view.LayoutInflater; import android.view.Menu; +import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; @@ -64,23 +68,25 @@ import com.beardedhen.androidbootstrap.BootstrapButton; * Public key list with sticky list headers. It does _not_ extend ListFragment because it uses * StickyListHeaders library which does not extend upon ListView. */ -public class KeyListPublicFragment extends Fragment implements AdapterView.OnItemClickListener, +public class KeyListPublicFragment extends Fragment implements SearchView.OnQueryTextListener, AdapterView.OnItemClickListener, LoaderManager.LoaderCallbacks { private KeyListPublicAdapter mAdapter; private StickyListHeadersListView mStickyList; - + private String mCurQuery; + private SearchView mSearchView; // empty list layout private BootstrapButton mButtonEmptyCreate; private BootstrapButton mButtonEmptyImport; + /** * Load custom layout with StickyListView from library */ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.key_list_public_fragment, container, false); - + setHasOptionsMenu(true); mButtonEmptyCreate = (BootstrapButton) view.findViewById(R.id.key_list_empty_button_create); mButtonEmptyCreate.setOnClickListener(new OnClickListener() { @@ -232,10 +238,13 @@ public class KeyListPublicFragment extends Fragment implements AdapterView.OnIte // This is called when a new Loader needs to be created. This // sample only has one Loader, so we don't care about the ID. Uri baseUri = KeyRings.buildPublicKeyRingsUri(); + String where = null; + if(mCurQuery != null) + where = KeychainContract.UserIds.USER_ID + " LIKE \"" + mCurQuery + "%\""; // Now create and return a CursorLoader that will take care of // creating a Cursor for the data being displayed. - return new CursorLoader(getActivity(), baseUri, PROJECTION, null, null, SORT_ORDER); + return new CursorLoader(getActivity(), baseUri, PROJECTION, where, null, SORT_ORDER); } @Override @@ -335,4 +344,34 @@ public class KeyListPublicFragment extends Fragment implements AdapterView.OnIte deleteKeyDialog.show(getActivity().getSupportFragmentManager(), "deleteKeyDialog"); } + + @Override + public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) { + + // Get the searchview + MenuItem searchItem = menu.findItem(R.id.menu_key_list_public_search); + mSearchView = (SearchView) MenuItemCompat.getActionView(searchItem); + + // Execute this when searching + mSearchView.setOnQueryTextListener(this); + + super.onCreateOptionsMenu(menu, inflater); + + } + + @Override + public boolean onQueryTextSubmit(String s) { + return true; + } + + @Override + public boolean onQueryTextChange(String s) { + // Called when the action bar search text has changed. Update + // the search filter, and restart the loader to do a new query + // with this filter. + String newQuery = !TextUtils.isEmpty(s) ? s : null; + mCurQuery = newQuery; + getLoaderManager().restartLoader(0, null, this); + return true; + } } diff --git a/OpenPGP-Keychain/src/main/res/drawable-mdpi/ic_action_search.png b/OpenPGP-Keychain/src/main/res/drawable-mdpi/ic_action_search.png new file mode 100644 index 0000000000000000000000000000000000000000..f6719d228a614e6090fd20281eda453d5002f424 GIT binary patch literal 2349 zcmaJ@cT`hnA5J6;L5d6!88rq(OUZ&jNFa<1kP&1GVo^eJm3)|Caw8!c1WHvsn#P(C z2t?a+6E#4wVwA6jn&KO>Z0?X^Sp(8S!9dJE^$wka(Frxtw9trGXb4iHTH|r2^Hj9J^v7=+? zdG>3(nuPXNH}P#7c=V~>H`V^LUJ93GFihTCAU7&OKPjkQ5y@kCo2A_fEh@*ou6 z1gxFJ0IK^JUkZzahyp=A5si+Ci9yBKqIiN`Xe@z1P-@uNAQcFtFqR84#7M5td`W={ z2$=#lA7t~maHS$6k|zR52t}m-q`={SmE{V*lu1!Aw3xw1V^J7oN=raG{r^KboUdph z7y$em@Bb7Q2F3CLbO0dai3ChV<93=WUGa$&0l)xxf*>Am_fi%8qIe)r7{%kmDS>uy zI)lmPD(%mBI-Tgr6@m;d6Y!*x5DEnpo6RD+k+Bpz0+~#+rQ)zy8ph4umPT=>;q5SZ zES6wLS>jT8Oc4j*f=gW1zg)^Uxyn)C@D-k^fPlRhV7Uu;9QfyyiR^F3LincM7cT4D zvABJci&g}KRyOv(8ohL+m>%W!>)0xcuY(V871J(Ij5R=ftOJ3l7I{+Lg2d0pw|X84 z_ArPO6;w2>i&|kEMr(ksw*bx0C2X8MyGPgG0&&A1)D72K(0HzqxKhJnrFqRtmA*Tf zN!B%ciVniG9cbEniyd^((o6E#`JB@s;UeDiE(C7&7s`|KbB>}WiDk>xXMPLEo~>Lw z2wkBfmP3zfh$^e9>Moiv|MM*DK5y=f_FIdw*N=xDWCX~KCAB=M{Ap)r;48Ip%U4aG zI7tq;Yll2`#CqVd^8k!#v$|Go{NbC?wuJ!9Mw9LYn`(0C|J7DoY)+IzBiwrO}<>1PyncBFQ|4 zQjf3q+7Iik+o+Qer^72zX~)hqYvNe^$)j5uLhJ z8NhNJG}59D$(K#2&bMB_W@MX%kN7E?sWZ`;X_aPOY8nH~%aPWzDmteoJ7P_}3BL7l z>Jm$0A~w2GY;a0ej*s~0-2b)(<-+`Z*X$(rsdW{3KGVd(<2c$4`+Lv!%##CeUqUZe z7%S_E(aQ3zkE;98`Qi0L@H#OZPkV777zv&*8W+E#%*X^e=p@t z;>FAvj@JXV2k9afjfgpYc6054X6^p|V?)^{2PdnZk6j;GJo`uw_<2f&cBR9}Q7zZ$ zp=n^>!(#Pc`)hVU5425{MBOc>mf|3&ZoeALGs59^rnwWmkU;6?rJ9W1|A`S{1w_KS4>#d^GHBD+#@>1^^ zuaSLpI689XNp+$;q=)94=eMODQ@&vExQqts1w0>06r?|fKO=a%-21d5kcT+L>wl_6j8z1&6N(yte(zc#P$`)_*N(|%? zJ|=E&%0O&z-v&lAszb2sIB(ssw|n)$Lv}3X=VrOychNpNzx-IU!jw?F&mH&~{Ep&}Cr}GX&9VlnxN@MBy4(Ein zjZ-Yv52D`hW#+KzEUcew+gR!LPpU*$c=GJ5;U>kM5(_D6Jnee68Dm`wiLNZWY(D75 zoeb`Csz$44o;YHrndG0Gek*dE*<=sjrgd9O6$*mj!2P0@^~uqem-i>Mu4Qsda*|ue zvMJKUQEpD_nv@a9$}K0Rx$xwU1jClX+gGmIqiI1#S9)H)NVUnrMYP(v7~X5D$(K7> zM;Y>>5CuDqHCW(!3Lj+I?5sTjlWa2^>w@a!Pxgs!(7m55ORNepi+{Zw(>}4 - + \ No newline at end of file From 7932dd8a81345f4f4cc10a4618c8f0856d9f45d1 Mon Sep 17 00:00:00 2001 From: Miroojin Bakshi Date: Thu, 6 Mar 2014 03:37:04 +0530 Subject: [PATCH 032/109] Implement search for SelectPublicKeyFragment --- .../keychain/ui/SelectPublicKeyFragment.java | 36 ++++++++++++++++--- .../res/layout/select_public_key_activity.xml | 8 +++++ 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java index 59b46dd00..e3e5c55fb 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java @@ -38,17 +38,22 @@ import android.os.Bundle; import android.support.v4.app.LoaderManager; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; +import android.text.Editable; +import android.text.TextUtils; +import android.text.TextWatcher; +import android.widget.EditText; import android.widget.ListView; -public class SelectPublicKeyFragment extends ListFragmentWorkaround implements +public class SelectPublicKeyFragment extends ListFragmentWorkaround implements TextWatcher, LoaderManager.LoaderCallbacks { public static final String ARG_PRESELECTED_KEY_IDS = "preselected_key_ids"; private Activity mActivity; private SelectKeyCursorAdapter mAdapter; private ListView mListView; - + private EditText mSearchView; private long mSelectedMasterKeyIds[]; + private String mCurQuery; /** * Creates new instance of this fragment @@ -67,7 +72,8 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - + mSearchView = (EditText)getActivity().findViewById(R.id.select_public_key_search); + mSearchView.addTextChangedListener(this); mSelectedMasterKeyIds = getArguments().getLongArray(ARG_PRESELECTED_KEY_IDS); } @@ -82,7 +88,6 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements mListView = getListView(); mListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); - // Give some text to display if there is no data. In a real // application this would come from a resource. setEmptyText(getString(R.string.list_empty)); @@ -220,10 +225,14 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements // sort by selected master keys orderBy = inMasterKeyList + " DESC, " + orderBy; } + String where = null; + if(mCurQuery != null) + where = UserIds.USER_ID + " LIKE \"" + mCurQuery + "%\""; + // Now create and return a CursorLoader that will take care of // creating a Cursor for the data being displayed. - return new CursorLoader(getActivity(), baseUri, projection, null, null, orderBy); + return new CursorLoader(getActivity(), baseUri, projection, where, null, orderBy); } @Override @@ -250,4 +259,21 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements // longer using it. mAdapter.swapCursor(null); } + + @Override + public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) { + + } + + @Override + public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) { + + } + + @Override + public void afterTextChanged(Editable editable) { + String newQuery = !TextUtils.isEmpty(editable.toString()) ? editable.toString() : null; + mCurQuery = newQuery; + getLoaderManager().restartLoader(0, null, this); + } } diff --git a/OpenPGP-Keychain/src/main/res/layout/select_public_key_activity.xml b/OpenPGP-Keychain/src/main/res/layout/select_public_key_activity.xml index a18ce46fc..5337433c6 100644 --- a/OpenPGP-Keychain/src/main/res/layout/select_public_key_activity.xml +++ b/OpenPGP-Keychain/src/main/res/layout/select_public_key_activity.xml @@ -4,8 +4,16 @@ android:layout_height="match_parent" android:layout_centerHorizontal="true" > + + From fab549c2b5cf637a4afc94c38f7745bfa733b316 Mon Sep 17 00:00:00 2001 From: Miroojin Bakshi Date: Thu, 6 Mar 2014 16:27:35 +0530 Subject: [PATCH 033/109] Use selectionArgs parameter to pass mCurquery. --- .../keychain/ui/KeyListPublicFragment.java | 10 ++++++---- .../keychain/ui/SelectPublicKeyFragment.java | 10 ++++++---- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java index af5d946eb..95267e01f 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java @@ -239,12 +239,14 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer // sample only has one Loader, so we don't care about the ID. Uri baseUri = KeyRings.buildPublicKeyRingsUri(); String where = null; - if(mCurQuery != null) - where = KeychainContract.UserIds.USER_ID + " LIKE \"" + mCurQuery + "%\""; - + String whereArgs[] = null; + if(mCurQuery != null){ + where = KeychainContract.UserIds.USER_ID + " LIKE ?"; + whereArgs = new String[]{mCurQuery+"%"}; + } // Now create and return a CursorLoader that will take care of // creating a Cursor for the data being displayed. - return new CursorLoader(getActivity(), baseUri, PROJECTION, where, null, SORT_ORDER); + return new CursorLoader(getActivity(), baseUri, PROJECTION, where, whereArgs, SORT_ORDER); } @Override diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java index e3e5c55fb..a43c84cf4 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java @@ -226,13 +226,15 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements T orderBy = inMasterKeyList + " DESC, " + orderBy; } String where = null; - if(mCurQuery != null) - where = UserIds.USER_ID + " LIKE \"" + mCurQuery + "%\""; - + String whereArgs[] = null; + if(mCurQuery != null){ + where = UserIds.USER_ID + " LIKE ?"; + whereArgs = new String[]{mCurQuery+"%"}; + } // Now create and return a CursorLoader that will take care of // creating a Cursor for the data being displayed. - return new CursorLoader(getActivity(), baseUri, projection, where, null, orderBy); + return new CursorLoader(getActivity(), baseUri, projection, where, whereArgs, orderBy); } @Override From d374f0ffbd848bf5376f59b05f909216178831cd Mon Sep 17 00:00:00 2001 From: uberspot Date: Thu, 6 Mar 2014 14:33:04 +0200 Subject: [PATCH 034/109] Add search icon for other dpi --- .../main/res/drawable-hdpi/ic_action_search.png | Bin 0 -> 702 bytes .../main/res/drawable-xhdpi/ic_action_search.png | Bin 0 -> 900 bytes .../res/drawable-xxhdpi/ic_action_search.png | Bin 0 -> 1153 bytes 3 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 OpenPGP-Keychain/src/main/res/drawable-hdpi/ic_action_search.png create mode 100644 OpenPGP-Keychain/src/main/res/drawable-xhdpi/ic_action_search.png create mode 100644 OpenPGP-Keychain/src/main/res/drawable-xxhdpi/ic_action_search.png diff --git a/OpenPGP-Keychain/src/main/res/drawable-hdpi/ic_action_search.png b/OpenPGP-Keychain/src/main/res/drawable-hdpi/ic_action_search.png new file mode 100644 index 0000000000000000000000000000000000000000..f594b4e482c7db630737b6b68c8646726480d4af GIT binary patch literal 702 zcmV;v0zv(WP)`- zYT3@c^WFKbjfR7RgM&i_cse#237;HVvt20r{a~c`dF|yDzzbtGju@$VR-^F1ro_g2$1rRf{V;Sp=H5*BpHGX zIl@TxNvBIS72F1uKc^v7`UMpEELyYM?S4VFolfV2+^tRP`!N1)lmIC40FO(iJSaXv z1!dO4ydNTQMI_qr+e30X2%Jf}PM>p|nd(OO0+cEl=4CSp1uu)27NuV! z1lWi6MFFdTIrkpaPJn`!9rdQ_$0+--4Ae7m0=|$obs)>xyH*#n8vmX^DwGF0(B(>t zdI?aa8vUo}v{ap_y4yeUudhY*07*qoM6N<$f@EtW!Tn&Xh zIyrLelkdCt-rak45RgbD5{X12k&aWLi%!Sm@c<4N&@S;5|NRDyLEA!GuU4z#-~hnD zM{t-x8#TC`gUF#R0LHr40AS!L9A?mB!!9yt&j5n;4gd^(3WuAT%L;@O*I2|8K*)Ll z0R8+9T3RuqycP1S!hH$eb5j9i4)-kk0N_sH>je&gwRD}%AcPjpp8N2^(2}MYJVkx) zVx(H~FfnF^wsqUZhRYOyocPRaCMyW^ zzm(W@iA)OsR&STmYB04l_< z`1wgVoxnNXe#8HN4b1*Cv~xMvfWDkph}#rJCkm4-^Z7+xDGQ_hZB4$v#7dEW0Cqqq zLFAa#F~ue))!0Wkg<#{wNZYqUVtUOgEF#1H6TI%xRK%(Frv|An zFRVUupNGCa;y^|5_;4nyJXdhti*CGeVgZV1UcMYnYw`;2BAIHPSCq)Bw&o9QEg^In zU@&2liy5rR-oE0^lXVDA0knkoRpAQOA)EyMD$%&^-gHauGk`)9mJx)=*U>|i=RxvH zi2ijtGg%$H1;7Wv2jdz-F4C`8~hq z*bxGPAP9mW2!bF8f*=TjAP9n-YsBeduCK3Cc^K2j@3NJ$<@CAu`1mLQz^=isJ zg&tq0gKV!7Lv0IW{*{F37I!4l}(nh^Jk^WZ#kVEj`t-^m~; zMvy}=vQxqfo387>@TJ0|1rr4gQ8WGLiKPh{+`QcxbadccK6<4-8nG#UTJ<&99* zV}g*%>syBI0SiN(e{gO5h7jhINreZ1djH%s;P!b#1Yv6kMaxhly;P<0oI6T$ zziLLEB{%@OlryuDYIe}3#kCF>0A)T&3j_4!1)0eULh}IKv_Qe6_}LjUq9h~$SB8Si zyC?*f4X=5y08*|1sIz^o001In4@d>% z6+j6S`UQ{=^uCKw0O)kd%-BiD0CYDpVK(iX1`B{5^Rccp4c8J>2+|c@Qw}#ro|tm3 z4V(dBGVgw)%iK6s>NWtF=6x0n?oT)M{25XjT8#s`9yRyr1@sVJmkhiI1%R|OOjF!? zjQzT2)CIRiT2=tiyt}R_ThOAZzO@qid8&W+2n(ika41_*5=_LfAuT*qL-Z80xpb~~D!5vfbuo)>ifqyuU5wX#a0|1mo&U53ioQ{Trm)q_5l|uzFpML&#Hc-bOv=5H3U8R7}C>j7mBF(@@J05&-ZEAqN0|5IQgPjlL4@2;mKdm_G=){N4rt{6MJw7nQJw zIw7Y5tOS65At-~t*$6uT&R1R* literal 0 HcmV?d00001 From 036fdc2b388dc45dea1b26f640d3f601e8c06aec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Thu, 6 Mar 2014 14:02:06 +0100 Subject: [PATCH 035/109] Fix verify of cleartext signatures with unknown keys --- .../sufficientlysecure/keychain/pgp/PgpDecryptVerify.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java index c568f462a..ccd6ff8df 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java @@ -335,7 +335,7 @@ public class PgpDecryptVerify { currentProgress += 5; updateProgress(R.string.progress_extracting_key, currentProgress, 100); - PGPPrivateKey privateKey = null; + PGPPrivateKey privateKey; try { PBESecretKeyDecryptor keyDecryptor = new JcePBESecretKeyDecryptorBuilder() .setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME).build( @@ -593,6 +593,8 @@ public class PgpDecryptVerify { if (signature == null) { signatureResult.setStatus(OpenPgpSignatureResult.SIGNATURE_UNKNOWN_PUB_KEY); + returnData.setSignatureResult(signatureResult); + updateProgress(R.string.progress_done, 100, 100); return returnData; } @@ -630,9 +632,9 @@ public class PgpDecryptVerify { // TODO: what about SIGNATURE_SUCCESS_CERTIFIED and SIGNATURE_ERROR???? - updateProgress(R.string.progress_done, 100, 100); - returnData.setSignatureResult(signatureResult); + + updateProgress(R.string.progress_done, 100, 100); return returnData; } From 4c49bdccccdba14113b950aafb1595ff02663dfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Thu, 6 Mar 2014 14:02:21 +0100 Subject: [PATCH 036/109] Fix documentation and variable naming in API --- .../demo/OpenPgpProviderActivity.java | 4 +- .../openintents/openpgp/util/OpenPgpApi.java | 158 ++++++++++-------- .../service/remote/OpenPgpService.java | 14 +- .../service/remote/RemoteService.java | 2 +- 4 files changed, 95 insertions(+), 83 deletions(-) diff --git a/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java b/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java index 4d143ade6..a660b1c9a 100644 --- a/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java +++ b/OpenPGP-Keychain-API/example-app/src/main/java/org/sufficientlysecure/keychain/demo/OpenPgpProviderActivity.java @@ -202,7 +202,7 @@ public class OpenPgpProviderActivity extends Activity { break; } case OpenPgpApi.RESULT_CODE_ERROR: { - OpenPgpError error = result.getParcelableExtra(OpenPgpApi.RESULT_ERRORS); + OpenPgpError error = result.getParcelableExtra(OpenPgpApi.RESULT_ERROR); handleError(error); break; } @@ -234,7 +234,7 @@ public class OpenPgpProviderActivity extends Activity { } public void signAndEncrypt(Intent data) { - data.setAction(OpenPgpApi.ACTION_SIGN_AND_ENCTYPT); + data.setAction(OpenPgpApi.ACTION_SIGN_AND_ENCRYPT); data.putExtra(OpenPgpApi.EXTRA_USER_IDS, mEncryptUserIds.getText().toString().split(",")); data.putExtra(OpenPgpApi.EXTRA_REQUEST_ASCII_ARMOR, true); diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpApi.java b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpApi.java index ed1a7540a..f0eae4a47 100644 --- a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpApi.java +++ b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpApi.java @@ -16,101 +16,110 @@ package org.openintents.openpgp.util; +import android.annotation.TargetApi; import android.content.Context; import android.content.Intent; import android.os.AsyncTask; import android.os.Build; import android.os.ParcelFileDescriptor; import android.util.Log; - import org.openintents.openpgp.IOpenPgpService; import org.openintents.openpgp.OpenPgpError; - import java.io.InputStream; import java.io.OutputStream; public class OpenPgpApi { - //TODO: fix this documentation - /** - * General extras - * -------------- - * - * Intent extras: - * int api_version (required) - * boolean ascii_armor (request ascii armor for ouput) - * - * returned Bundle: - * int result_code (0, 1, or 2 (see OpenPgpApi)) - * OpenPgpError error (if result_code == 0) - * Intent intent (if result_code == 2) - */ - - /** - * Sign only - * - * optional params: - * String passphrase (for key passphrase) - */ - - /** - * Encrypt - * - * Intent extras: - * long[] key_ids - * or - * String[] user_ids (= emails of recipients) (if more than one key has this user_id, a PendingIntent is returned) - * - * optional extras: - * String passphrase (for key passphrase) - */ - - /** - * Sign and encrypt - * - * Intent extras: - * same as in encrypt() - */ - - /** - * Decrypts and verifies given input bytes. This methods handles encrypted-only, signed-and-encrypted, - * and also signed-only input. - * - * returned Bundle: - * OpenPgpSignatureResult signature_result - */ - - /** - * Retrieves key ids based on given user ids (=emails) - * - * Intent extras: - * String[] user_ids - * - * returned Bundle: - * long[] key_ids - */ - public static final String TAG = "OpenPgp API"; public static final int API_VERSION = 2; public static final String SERVICE_INTENT = "org.openintents.openpgp.IOpenPgpService"; + /** + * Sign only + * + * optional params: + * String EXTRA_PASSPHRASE (for key passphrase) + */ public static final String ACTION_SIGN = "org.openintents.openpgp.action.SIGN"; + + /** + * General extras + * -------------- + * + * Intent extras: + * int EXTRA_API_VERSION (required) + * boolean EXTRA_REQUEST_ASCII_ARMOR (request ascii armor for ouput) + * + * returned extras: + * int RESULT_CODE (0, 1, or 2 (see OpenPgpApi)) + * OpenPgpError RESULT_ERROR (if result_code == 0) + * Intent RESULT_INTENT (if result_code == 2) + */ + + /** + * Encrypt + * + * extras: + * long[] EXTRA_KEY_IDS + * or + * String[] EXTRA_USER_IDS (= emails of recipients) (if more than one key has this user_id, a PendingIntent is returned) + * + * optional extras: + * String EXTRA_PASSPHRASE (for key passphrase) + */ public static final String ACTION_ENCRYPT = "org.openintents.openpgp.action.ENCRYPT"; - public static final String ACTION_SIGN_AND_ENCTYPT = "org.openintents.openpgp.action.SIGN_AND_ENCRYPT"; + + /** + * Sign and encrypt + * + * extras: + * long[] EXTRA_KEY_IDS + * or + * String[] EXTRA_USER_IDS (= emails of recipients) (if more than one key has this user_id, a PendingIntent is returned) + * + * optional extras: + * String EXTRA_PASSPHRASE (for key passphrase) + */ + public static final String ACTION_SIGN_AND_ENCRYPT = "org.openintents.openpgp.action.SIGN_AND_ENCRYPT"; + + /** + * Decrypts and verifies given input bytes. This methods handles encrypted-only, signed-and-encrypted, + * and also signed-only input. + * + * returned extras: + * OpenPgpSignatureResult RESULT_SIGNATURE + */ public static final String ACTION_DECRYPT_VERIFY = "org.openintents.openpgp.action.DECRYPT_VERIFY"; - public static final String ACTION_DOWNLOAD_KEYS = "org.openintents.openpgp.action.DOWNLOAD_KEYS"; + + /** + * Get key ids based on given user ids (=emails) + * + * Intent extras: + * String[] EXTRA_KEY_IDS + * + * returned extras: + * long[] EXTRA_USER_IDS + */ public static final String ACTION_GET_KEY_IDS = "org.openintents.openpgp.action.GET_KEY_IDS"; + /** + * Download keys from keyserver + * + * Intent extras: + * String[] EXTRA_KEY_IDS + */ + public static final String ACTION_DOWNLOAD_KEYS = "org.openintents.openpgp.action.DOWNLOAD_KEYS"; + /* Bundle params */ public static final String EXTRA_API_VERSION = "api_version"; - // SIGN, ENCRYPT, SIGN_ENCRYPT, DECRYPT_VERIFY + // SIGN, ENCRYPT, SIGN_AND_ENCRYPT, DECRYPT_VERIFY // request ASCII Armor for output // OpenPGP Radix-64, 33 percent overhead compared to binary, see http://tools.ietf.org/html/rfc4880#page-53) public static final String EXTRA_REQUEST_ASCII_ARMOR = "ascii_armor"; - // ENCRYPT, SIGN_ENCRYPT + // ENCRYPT, SIGN_AND_ENCRYPT public static final String EXTRA_USER_IDS = "user_ids"; public static final String EXTRA_KEY_IDS = "key_ids"; // optional parameter: @@ -118,17 +127,19 @@ public class OpenPgpApi { /* Service Bundle returns */ public static final String RESULT_CODE = "result_code"; - public static final String RESULT_SIGNATURE = "signature"; - public static final String RESULT_ERRORS = "error"; - public static final String RESULT_INTENT = "intent"; - // get actual error object from RESULT_ERRORS + // get actual error object from RESULT_ERROR public static final int RESULT_CODE_ERROR = 0; // success! public static final int RESULT_CODE_SUCCESS = 1; // executeServiceMethod intent and do it again with intent public static final int RESULT_CODE_USER_INTERACTION_REQUIRED = 2; + public static final String RESULT_ERROR = "error"; + public static final String RESULT_INTENT = "intent"; + + // DECRYPT_VERIFY + public static final String RESULT_SIGNATURE = "signature"; IOpenPgpService mService; Context mContext; @@ -166,6 +177,7 @@ public class OpenPgpApi { } + @TargetApi(Build.VERSION_CODES.HONEYCOMB) public void executeApiAsync(Intent data, InputStream is, OutputStream os, IOpenPgpCallback callback) { OpenPgpAsyncTask task = new OpenPgpAsyncTask(data, is, os, callback); @@ -188,13 +200,13 @@ public class OpenPgpApi { result = mService.execute(data, null, null); return result; } else { - // send the input and output pfds + // pipe the input and output ParcelFileDescriptor input = ParcelFileDescriptorUtil.pipeFrom(is, new ParcelFileDescriptorUtil.IThreadListener() { @Override public void onThreadFinished(Thread thread) { - Log.d(OpenPgpApi.TAG, "Copy to service finished"); + //Log.d(OpenPgpApi.TAG, "Copy to service finished"); } }); ParcelFileDescriptor output = ParcelFileDescriptorUtil.pipeTo(os, @@ -202,7 +214,7 @@ public class OpenPgpApi { @Override public void onThreadFinished(Thread thread) { - Log.d(OpenPgpApi.TAG, "Service finished writing!"); + //Log.d(OpenPgpApi.TAG, "Service finished writing!"); } }); @@ -222,7 +234,7 @@ public class OpenPgpApi { Log.e(OpenPgpApi.TAG, "Exception", e); Intent result = new Intent(); result.putExtra(RESULT_CODE, RESULT_CODE_ERROR); - result.putExtra(RESULT_ERRORS, + result.putExtra(RESULT_ERROR, new OpenPgpError(OpenPgpError.CLIENT_SIDE_ERROR, e.getMessage())); return result; } diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/OpenPgpService.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/OpenPgpService.java index 8b34c4421..e1801d9e7 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/OpenPgpService.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/OpenPgpService.java @@ -180,7 +180,7 @@ public class OpenPgpService extends RemoteService { } catch (Exception e) { Intent result = new Intent(); result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR); - result.putExtra(OpenPgpApi.RESULT_ERRORS, + result.putExtra(OpenPgpApi.RESULT_ERROR, new OpenPgpError(OpenPgpError.GENERIC_ERROR, e.getMessage())); return result; } @@ -209,7 +209,7 @@ public class OpenPgpService extends RemoteService { } else { Intent result = new Intent(); result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR); - result.putExtra(OpenPgpApi.RESULT_ERRORS, + result.putExtra(OpenPgpApi.RESULT_ERROR, new OpenPgpError(OpenPgpError.GENERIC_ERROR, "Missing parameter user_ids or key_ids!")); return result; } @@ -268,7 +268,7 @@ public class OpenPgpService extends RemoteService { } catch (Exception e) { Intent result = new Intent(); result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR); - result.putExtra(OpenPgpApi.RESULT_ERRORS, + result.putExtra(OpenPgpApi.RESULT_ERROR, new OpenPgpError(OpenPgpError.GENERIC_ERROR, e.getMessage())); return result; } @@ -334,7 +334,7 @@ public class OpenPgpService extends RemoteService { } catch (Exception e) { Intent result = new Intent(); result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR); - result.putExtra(OpenPgpApi.RESULT_ERRORS, + result.putExtra(OpenPgpApi.RESULT_ERROR, new OpenPgpError(OpenPgpError.GENERIC_ERROR, e.getMessage())); return result; } @@ -361,7 +361,7 @@ public class OpenPgpService extends RemoteService { if (data == null) { Intent result = new Intent(); OpenPgpError error = new OpenPgpError(OpenPgpError.GENERIC_ERROR, "params Bundle required!"); - result.putExtra(OpenPgpApi.RESULT_ERRORS, error); + result.putExtra(OpenPgpApi.RESULT_ERROR, error); result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR); return result; } @@ -370,7 +370,7 @@ public class OpenPgpService extends RemoteService { if (data.getIntExtra(OpenPgpApi.EXTRA_API_VERSION, -1) != OpenPgpApi.API_VERSION) { Intent result = new Intent(); OpenPgpError error = new OpenPgpError(OpenPgpError.INCOMPATIBLE_API_VERSIONS, "Incompatible API versions!"); - result.putExtra(OpenPgpApi.RESULT_ERRORS, error); + result.putExtra(OpenPgpApi.RESULT_ERROR, error); result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR); return result; } @@ -401,7 +401,7 @@ public class OpenPgpService extends RemoteService { return signImpl(data, input, output, appSettings); } else if (OpenPgpApi.ACTION_ENCRYPT.equals(action)) { return encryptAndSignImpl(data, input, output, appSettings, false); - } else if (OpenPgpApi.ACTION_SIGN_AND_ENCTYPT.equals(action)) { + } else if (OpenPgpApi.ACTION_SIGN_AND_ENCRYPT.equals(action)) { return encryptAndSignImpl(data, input, output, appSettings, true); } else if (OpenPgpApi.ACTION_DECRYPT_VERIFY.equals(action)) { return decryptAndVerifyImpl(data, input, output, appSettings); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/RemoteService.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/RemoteService.java index e7b3b2945..cb556be39 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/RemoteService.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/RemoteService.java @@ -72,7 +72,7 @@ public abstract class RemoteService extends Service { // return error Intent result = new Intent(); result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR); - result.putExtra(OpenPgpApi.RESULT_ERRORS, + result.putExtra(OpenPgpApi.RESULT_ERROR, new OpenPgpError(OpenPgpError.GENERIC_ERROR, e.getMessage())); return result; } From e8fbf976da8ea9f276fe7ad19c4d2693b1f90847 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Thu, 6 Mar 2014 14:02:51 +0100 Subject: [PATCH 037/109] 2.3.1 beta3 --- OpenPGP-Keychain/src/main/AndroidManifest.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenPGP-Keychain/src/main/AndroidManifest.xml b/OpenPGP-Keychain/src/main/AndroidManifest.xml index 10a307bfb..976b84e01 100644 --- a/OpenPGP-Keychain/src/main/AndroidManifest.xml +++ b/OpenPGP-Keychain/src/main/AndroidManifest.xml @@ -2,8 +2,8 @@ + android:versionCode="23103" + android:versionName="2.3.1 beta3"> Sign From 414623670e2bc3474d1866c3b297e4bb0c6c5943 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Thu, 6 Mar 2014 19:36:37 +0100 Subject: [PATCH 046/109] sdk 17 no longer needed --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 946125fe0..54db1a965 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ before_install: - export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools # Install required Android components. - - echo "y" | android update sdk -a --filter build-tools-19.0.3,android-19,platform-tools,extra-android-support,extra-android-m2repository,android-17 --no-ui --force + - echo "y" | android update sdk -a --filter build-tools-19.0.3,android-19,platform-tools,extra-android-support,extra-android-m2repository --no-ui --force install: echo "Installation done" script: gradle assemble -S -q From 633cca21a0a4310c62804caf64bf0d6f5d52cc78 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Thu, 6 Mar 2014 19:41:07 +0100 Subject: [PATCH 047/109] remove unused search definitions from manifest --- OpenPGP-Keychain/src/main/AndroidManifest.xml | 40 ------------------- 1 file changed, 40 deletions(-) diff --git a/OpenPGP-Keychain/src/main/AndroidManifest.xml b/OpenPGP-Keychain/src/main/AndroidManifest.xml index 976b84e01..8aa37393f 100644 --- a/OpenPGP-Keychain/src/main/AndroidManifest.xml +++ b/OpenPGP-Keychain/src/main/AndroidManifest.xml @@ -69,30 +69,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - --> - - - - From 9edd4bee700d7710fc477d8608c7c36af8ec8da0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Thu, 6 Mar 2014 19:49:54 +0100 Subject: [PATCH 048/109] fix pathes in README --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index aa8baf70e..14a9055e9 100644 --- a/README.md +++ b/README.md @@ -116,13 +116,13 @@ When changing build files or dependencies, respect the following requirements: * No dependencies from Maven (also a soft requirement for inclusion in [F-Droid](https://f-droid.org)) * Always use a fixed Android Gradle plugin version not a dynamic one, e.g. ``0.7.3`` instead of ``0.7.+`` (allows offline builds without lookups for new versions, also some minor Android plugin versions had serious issues, i.e. [0.7.2 and 0.8.1](http://tools.android.com/tech-docs/new-build-system)) * Commit the corresponding [Gradle wrapper](http://www.gradle.org/docs/current/userguide/gradle_wrapper.html) to the repository (allows easy building for new contributors without the need to install the required Gradle version using a package manager) -* In order to update the build system to a newer gradle Version you need to: +* In order to update the build system to a newer gradle version you need to: * Update every build.gradle file with the new gradle version and/or gradle plugin version * build.gradle * OpenPGP-Keychain/build.gradle * OpenPGP-Keychain-API/build.gradle - * OpenPGP-Keychain-Api/libraries/build.gradle - * OpenPGP-Keychain/example-app/build.gradle + * OpenPGP-Keychain-API/example-app/build.gradle + * OpenPGP-Keychain-API/libraries/keychain-api-library/build.gradle * run ./gradlew wrapper twice to update gradle and download the new jar file * commit the new jar and property files From 8e29b82d6daa689f07a8318bf194c8fb17133c95 Mon Sep 17 00:00:00 2001 From: Ankush Date: Thu, 6 Mar 2014 10:05:43 +0530 Subject: [PATCH 049/109] corrected commit mCurrentPassPhrase, mChangePassPhrase Minor variable naming Issue #338 --- .../keychain/Constants.java | 2 +- .../org/sufficientlysecure/keychain/Id.java | 10 +++--- .../keychain/pgp/PgpImportExport.java | 4 +-- .../keychain/pgp/PgpKeyOperation.java | 10 +++--- .../keychain/provider/ProviderHelper.java | 2 +- .../service/KeychainIntentService.java | 2 +- .../keychain/ui/EditKeyActivity.java | 34 +++++++++---------- .../keychain/ui/EncryptActivity.java | 24 ++++++------- .../keychain/ui/PreferencesActivity.java | 12 +++---- .../ui/adapter/ImportKeysListLoader.java | 2 +- .../ui/dialog/PassphraseDialogFragment.java | 8 ++--- .../dialog/SetPassphraseDialogFragment.java | 10 +++--- .../keychain/ui/widget/SectionView.java | 8 ++--- .../keychain/util/KeyServer.java | 2 +- .../src/main/res/layout/edit_key_activity.xml | 2 +- .../src/main/res/layout/encrypt_activity.xml | 8 ++--- .../src/main/res/values-de/strings.xml | 2 +- .../src/main/res/values-es-rCO/strings.xml | 2 +- .../src/main/res/values-es/strings.xml | 2 +- .../src/main/res/values-fr/strings.xml | 2 +- .../src/main/res/values-it-rIT/strings.xml | 2 +- .../src/main/res/values-ja/strings.xml | 2 +- .../src/main/res/values-nl-rNL/strings.xml | 2 +- .../src/main/res/values-ru/strings.xml | 2 +- .../src/main/res/values-uk/strings.xml | 2 +- .../src/main/res/values/arrays.xml | 4 +-- .../src/main/res/values/strings.xml | 2 +- .../src/main/res/xml/gen_preferences.xml | 6 ++-- 28 files changed, 85 insertions(+), 85 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/Constants.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/Constants.java index c1809e4e1..4428c7133 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/Constants.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/Constants.java @@ -51,7 +51,7 @@ public final class Constants { public static final String DEFAULT_ASCII_ARMOUR = "defaultAsciiArmour"; public static final String DEFAULT_MESSAGE_COMPRESSION = "defaultMessageCompression"; public static final String DEFAULT_FILE_COMPRESSION = "defaultFileCompression"; - public static final String PASS_PHRASE_CACHE_TTL = "passPhraseCacheTtl"; + public static final String PASS_PHRASE_CACHE_TTL = "passphraseCacheTtl"; public static final String LANGUAGE = "language"; public static final String FORCE_V3_SIGNATURES = "forceV3Signatures"; public static final String KEY_SERVERS = "keyServers"; diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/Id.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/Id.java index a1571e491..1d79edd43 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/Id.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/Id.java @@ -30,7 +30,7 @@ public final class Id { public static final class menu { public static final class option { - public static final int new_pass_phrase = 0x21070001; + public static final int new_passphrase = 0x21070001; public static final int create = 0x21070002; public static final int about = 0x21070003; public static final int manage_public_keys = 0x21070004; @@ -85,12 +85,12 @@ public final class Id { } public static final class dialog { - public static final int pass_phrase = 0x21070001; + public static final int passphrase = 0x21070001; public static final int encrypting = 0x21070002; public static final int decrypting = 0x21070003; - public static final int new_pass_phrase = 0x21070004; - public static final int pass_phrases_do_not_match = 0x21070005; - public static final int no_pass_phrase = 0x21070006; + public static final int new_passphrase = 0x21070004; + public static final int passphrases_do_not_match = 0x21070005; + public static final int no_passphrase = 0x21070006; public static final int saving = 0x21070007; public static final int delete_key = 0x21070008; public static final int import_keys = 0x21070009; diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java index a7a574ee7..2495a212c 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java @@ -90,8 +90,8 @@ public class PgpImportExport { aos.write(keyring.getEncoded()); aos.close(); - String armouredKey = bos.toString("UTF-8"); - server.add(armouredKey); + String armoredKey = bos.toString("UTF-8"); + server.add(armoredKey); return true; } catch (IOException e) { diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java index 7caee4048..e1ca88fb0 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java @@ -107,7 +107,7 @@ public class PgpKeyOperation { * * @param algorithmChoice * @param keySize - * @param passPhrase + * @param passphrase * @param isMasterKey * @return * @throws NoSuchAlgorithmException @@ -118,7 +118,7 @@ public class PgpKeyOperation { */ // TODO: key flags? - public PGPSecretKey createKey(int algorithmChoice, int keySize, String passPhrase, + public PGPSecretKey createKey(int algorithmChoice, int keySize, String passphrase, boolean isMasterKey) throws NoSuchAlgorithmException, PGPException, NoSuchProviderException, PgpGeneralException, InvalidAlgorithmParameterException { @@ -126,8 +126,8 @@ public class PgpKeyOperation { throw new PgpGeneralException(mContext.getString(R.string.error_key_size_minimum512bit)); } - if (passPhrase == null) { - passPhrase = ""; + if (passphrase == null) { + passphrase = ""; } int algorithm = 0; @@ -181,7 +181,7 @@ public class PgpKeyOperation { // Build key encrypter and decrypter based on passphrase PBESecretKeyEncryptor keyEncryptor = new JcePBESecretKeyEncryptorBuilder( PGPEncryptedData.CAST5, sha1Calc) - .setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(passPhrase.toCharArray()); + .setProvider(Constants.BOUNCY_CASTLE_PROVIDER_NAME).build(passphrase.toCharArray()); PGPSecretKey secKey = new PGPSecretKey(keyPair.getPrivateKey(), keyPair.getPublicKey(), sha1Calc, isMasterKey, keyEncryptor); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java index 9bee42973..8b642967f 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java @@ -628,7 +628,7 @@ public class ProviderHelper { String armoredKey = bos.toString("UTF-8"); - Log.d(Constants.TAG, "armouredKey:" + armoredKey); + Log.d(Constants.TAG, "armoredKey:" + armoredKey); output.add(armoredKey); } catch (IOException e) { diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java index cf507826e..313655766 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java @@ -748,7 +748,7 @@ public class KeychainIntentService extends IntentService implements ProgressDial */ // need to have access to the bufferedInput, so we can reuse it for the possible // PGPObject chunks after the first one, e.g. files with several consecutive ASCII - // armour blocks + // armor blocks BufferedInputStream bufferedInput = new BufferedInputStream(new ByteArrayInputStream(downloadedKey)); try { diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java index 0bed6f264..647ab2728 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java @@ -92,12 +92,12 @@ public class EditKeyActivity extends ActionBarActivity { private SectionView mUserIdsView; private SectionView mKeysView; - private String mCurrentPassPhrase = null; + private String mCurrentPassphrase = null; private String mNewPassPhrase = null; private String mSavedNewPassPhrase = null; private boolean mIsPassPhraseSet; - private BootstrapButton mChangePassPhrase; + private BootstrapButton mChangePassphrase; private CheckBox mNoPassphrase; @@ -150,7 +150,7 @@ public class EditKeyActivity extends ActionBarActivity { Bundle extras = intent.getExtras(); - mCurrentPassPhrase = ""; + mCurrentPassphrase = ""; if (extras != null) { // if userId is given, prefill the fields @@ -165,7 +165,7 @@ public class EditKeyActivity extends ActionBarActivity { if (noPassphrase) { // check "no passphrase" checkbox and remove button mNoPassphrase.setChecked(true); - mChangePassPhrase.setVisibility(View.GONE); + mChangePassphrase.setVisibility(View.GONE); } } @@ -181,7 +181,7 @@ public class EditKeyActivity extends ActionBarActivity { // fill values for this action Bundle data = new Bundle(); data.putString(KeychainIntentService.GENERATE_KEY_SYMMETRIC_PASSPHRASE, - mCurrentPassPhrase); + mCurrentPassphrase); serviceIntent.putExtra(KeychainIntentService.EXTRA_DATA, data); @@ -281,9 +281,9 @@ public class EditKeyActivity extends ActionBarActivity { @Override public void handleMessage(Message message) { if (message.what == PassphraseDialogFragment.MESSAGE_OKAY) { - String passPhrase = PassphraseCacheService.getCachedPassphrase( + String passphrase = PassphraseCacheService.getCachedPassphrase( EditKeyActivity.this, masterKeyId); - mCurrentPassPhrase = passPhrase; + mCurrentPassphrase = passphrase; finallySaveClicked(); } } @@ -373,14 +373,14 @@ public class EditKeyActivity extends ActionBarActivity { } } - mCurrentPassPhrase = ""; + mCurrentPassphrase = ""; buildLayout(); mIsPassPhraseSet = PassphraseCacheService.hasPassphrase(this, masterKeyId); if (!mIsPassPhraseSet) { // check "no passphrase" checkbox and remove button mNoPassphrase.setChecked(true); - mChangePassPhrase.setVisibility(View.GONE); + mChangePassphrase.setVisibility(View.GONE); } } @@ -410,7 +410,7 @@ public class EditKeyActivity extends ActionBarActivity { // set title based on isPassphraseSet() int title = -1; if (isPassphraseSet()) { - title = R.string.title_change_pass_phrase; + title = R.string.title_change_passphrase; } else { title = R.string.title_set_passphrase; } @@ -429,7 +429,7 @@ public class EditKeyActivity extends ActionBarActivity { setContentView(R.layout.edit_key_activity); // find views - mChangePassPhrase = (BootstrapButton) findViewById(R.id.edit_key_btn_change_pass_phrase); + mChangePassphrase = (BootstrapButton) findViewById(R.id.edit_key_btn_change_passphrase); mNoPassphrase = (CheckBox) findViewById(R.id.edit_key_no_passphrase); // Build layout based on given userIds and keys @@ -449,7 +449,7 @@ public class EditKeyActivity extends ActionBarActivity { updatePassPhraseButtonText(); - mChangePassPhrase.setOnClickListener(new OnClickListener() { + mChangePassphrase.setOnClickListener(new OnClickListener() { public void onClick(View v) { showSetPassphraseDialog(); } @@ -464,10 +464,10 @@ public class EditKeyActivity extends ActionBarActivity { // remove passphrase mSavedNewPassPhrase = mNewPassPhrase; mNewPassPhrase = ""; - mChangePassPhrase.setVisibility(View.GONE); + mChangePassphrase.setVisibility(View.GONE); } else { mNewPassPhrase = mSavedNewPassPhrase; - mChangePassPhrase.setVisibility(View.VISIBLE); + mChangePassphrase.setVisibility(View.VISIBLE); } } }); @@ -506,7 +506,7 @@ public class EditKeyActivity extends ActionBarActivity { if (passphrase == null) { showPassphraseDialog(masterKeyId, masterCanSign); } else { - mCurrentPassPhrase = passphrase; + mCurrentPassphrase = passphrase; finallySaveClicked(); } } catch (PgpGeneralException e) { @@ -525,7 +525,7 @@ public class EditKeyActivity extends ActionBarActivity { // fill values for this action Bundle data = new Bundle(); data.putString(KeychainIntentService.SAVE_KEYRING_CURRENT_PASSPHRASE, - mCurrentPassPhrase); + mCurrentPassphrase); data.putString(KeychainIntentService.SAVE_KEYRING_NEW_PASSPHRASE, mNewPassPhrase); data.putStringArrayList(KeychainIntentService.SAVE_KEYRING_USER_IDS, getUserIds(mUserIdsView)); @@ -696,7 +696,7 @@ public class EditKeyActivity extends ActionBarActivity { } private void updatePassPhraseButtonText() { - mChangePassPhrase.setText(isPassphraseSet() ? getString(R.string.btn_change_passphrase) + mChangePassphrase.setText(isPassphraseSet() ? getString(R.string.btn_change_passphrase) : getString(R.string.btn_set_passphrase)); } diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java index 9da6c1b9f..faac9b157 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java @@ -101,8 +101,8 @@ public class EncryptActivity extends DrawerActivity { private int mEncryptTarget; - private EditText mPassPhrase = null; - private EditText mPassPhraseAgain = null; + private EditText mPassphrase = null; + private EditText mPassphraseAgain = null; private CheckBox mAsciiArmor = null; private Spinner mFileCompression = null; @@ -436,14 +436,14 @@ public class EncryptActivity extends DrawerActivity { // symmetric encryption if (mMode.getCurrentView().getId() == R.id.modeSymmetric) { boolean gotPassPhrase = false; - String passPhrase = mPassPhrase.getText().toString(); - String passPhraseAgain = mPassPhraseAgain.getText().toString(); - if (!passPhrase.equals(passPhraseAgain)) { + String passphrase = mPassphrase.getText().toString(); + String passphraseAgain = mPassphraseAgain.getText().toString(); + if (!passphrase.equals(passphraseAgain)) { AppMsg.makeText(this, R.string.passphrases_do_not_match, AppMsg.STYLE_ALERT).show(); return; } - gotPassPhrase = (passPhrase.length() != 0); + gotPassPhrase = (passphrase.length() != 0); if (!gotPassPhrase) { AppMsg.makeText(this, R.string.passphrase_must_not_be_empty, AppMsg.STYLE_ALERT) .show(); @@ -550,11 +550,11 @@ public class EncryptActivity extends DrawerActivity { if (mMode.getCurrentView().getId() == R.id.modeSymmetric) { Log.d(Constants.TAG, "Symmetric encryption enabled!"); - String passPhrase = mPassPhrase.getText().toString(); - if (passPhrase.length() == 0) { - passPhrase = null; + String passphrase = mPassphrase.getText().toString(); + if (passphrase.length() == 0) { + passphrase = null; } - data.putString(KeychainIntentService.GENERATE_KEY_SYMMETRIC_PASSPHRASE, passPhrase); + data.putString(KeychainIntentService.GENERATE_KEY_SYMMETRIC_PASSPHRASE, passphrase); } else { mSecretKeyIdToPass = mSecretKeyId; encryptionKeyIds = mEncryptionKeyIds; @@ -766,8 +766,8 @@ public class EncryptActivity extends DrawerActivity { mMainUserId = (TextView) findViewById(R.id.mainUserId); mMainUserIdRest = (TextView) findViewById(R.id.mainUserIdRest); - mPassPhrase = (EditText) findViewById(R.id.passPhrase); - mPassPhraseAgain = (EditText) findViewById(R.id.passPhraseAgain); + mPassphrase = (EditText) findViewById(R.id.passphrase); + mPassphraseAgain = (EditText) findViewById(R.id.passphraseAgain); // measure the height of the source_file view and set the message view's min height to that, // so it fills mSource fully... bit of a hack. diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/PreferencesActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/PreferencesActivity.java index a508e6b33..af20b499b 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/PreferencesActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/PreferencesActivity.java @@ -255,14 +255,14 @@ public class PreferencesActivity extends PreferenceActivity { || super.isValidFragment(fragmentName); } - private static void initializePassPassPhraceCacheTtl(final IntegerListPreference mPassPhraseCacheTtl) { - mPassPhraseCacheTtl.setValue("" + mPreferences.getPassPhraseCacheTtl()); - mPassPhraseCacheTtl.setSummary(mPassPhraseCacheTtl.getEntry()); - mPassPhraseCacheTtl + private static void initializePassPassPhraceCacheTtl(final IntegerListPreference mPassphraseCacheTtl) { + mPassphraseCacheTtl.setValue("" + mPreferences.getPassPhraseCacheTtl()); + mPassphraseCacheTtl.setSummary(mPassphraseCacheTtl.getEntry()); + mPassphraseCacheTtl .setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() { public boolean onPreferenceChange(Preference preference, Object newValue) { - mPassPhraseCacheTtl.setValue(newValue.toString()); - mPassPhraseCacheTtl.setSummary(mPassPhraseCacheTtl.getEntry()); + mPassphraseCacheTtl.setValue(newValue.toString()); + mPassphraseCacheTtl.setSummary(mPassphraseCacheTtl.getEntry()); mPreferences.setPassPhraseCacheTtl(Integer.parseInt(newValue.toString())); return false; } diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java index 29e418db7..76649b27b 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java @@ -97,7 +97,7 @@ public class ImportKeysListLoader extends AsyncTaskLoader 0) { PGPSecretKey masterKey = ((KeyEditor) mEditors.getChildAt(0)).getValue(); - passPhrase = PassphraseCacheService + passphrase = PassphraseCacheService .getCachedPassphrase(mActivity, masterKey.getKeyID()); isMasterKey = false; } else { - passPhrase = ""; + passphrase = ""; isMasterKey = true; } data.putBoolean(KeychainIntentService.GENERATE_KEY_MASTER_KEY, isMasterKey); - data.putString(KeychainIntentService.GENERATE_KEY_SYMMETRIC_PASSPHRASE, passPhrase); + data.putString(KeychainIntentService.GENERATE_KEY_SYMMETRIC_PASSPHRASE, passphrase); data.putInt(KeychainIntentService.GENERATE_KEY_ALGORITHM, mNewKeyAlgorithmChoice.getId()); data.putInt(KeychainIntentService.GENERATE_KEY_KEY_SIZE, mNewKeySize); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/KeyServer.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/KeyServer.java index b1e6b3c71..7049820e8 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/KeyServer.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/KeyServer.java @@ -48,5 +48,5 @@ public abstract class KeyServer { abstract String get(long keyId) throws QueryException; - abstract void add(String armouredText) throws AddKeyException; + abstract void add(String armoredText) throws AddKeyException; } diff --git a/OpenPGP-Keychain/src/main/res/layout/edit_key_activity.xml b/OpenPGP-Keychain/src/main/res/layout/edit_key_activity.xml index 182540dc5..fc4422cf0 100644 --- a/OpenPGP-Keychain/src/main/res/layout/edit_key_activity.xml +++ b/OpenPGP-Keychain/src/main/res/layout/edit_key_activity.xml @@ -27,7 +27,7 @@ android:text="@string/label_no_passphrase" /> @@ -153,7 +153,7 @@ diff --git a/OpenPGP-Keychain/src/main/res/values-de/strings.xml b/OpenPGP-Keychain/src/main/res/values-de/strings.xml index 493a3a9bb..ea1e550e3 100644 --- a/OpenPGP-Keychain/src/main/res/values-de/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-de/strings.xml @@ -13,7 +13,7 @@ Einstellungen Registrierte Anwendungen Schlüsselserver - Passwort ändern + Passwort ändern Passwort setzen E-Mail senden… In eine Datei verschlüsseln diff --git a/OpenPGP-Keychain/src/main/res/values-es-rCO/strings.xml b/OpenPGP-Keychain/src/main/res/values-es-rCO/strings.xml index e43cecc2c..d1f0bd75b 100644 --- a/OpenPGP-Keychain/src/main/res/values-es-rCO/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-es-rCO/strings.xml @@ -10,7 +10,7 @@ Editar clave Preferencias Aplicaciones registradas - Cambiar contraseña + Cambiar contraseña Establecer contraseña Enviar correo electrónico… Cifrar a archivo diff --git a/OpenPGP-Keychain/src/main/res/values-es/strings.xml b/OpenPGP-Keychain/src/main/res/values-es/strings.xml index edf190184..de680337f 100644 --- a/OpenPGP-Keychain/src/main/res/values-es/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-es/strings.xml @@ -13,7 +13,7 @@ Preferencias Aplicaciones registradas Prioridad del servidor de claves - Cambiar la frase de contraseña + Cambiar la frase de contraseña Establecer frase de contraseña Enviar email… Cifrar hacia archivo diff --git a/OpenPGP-Keychain/src/main/res/values-fr/strings.xml b/OpenPGP-Keychain/src/main/res/values-fr/strings.xml index 171ce1fa5..aa9b59287 100644 --- a/OpenPGP-Keychain/src/main/res/values-fr/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-fr/strings.xml @@ -13,7 +13,7 @@ Préférences Applications enregistrées Préférences du serveur de clefs - Changer la phrase de passe + Changer la phrase de passe Définir la phrase de passe Envoyer un courriel… Chiffrer vers un fichier diff --git a/OpenPGP-Keychain/src/main/res/values-it-rIT/strings.xml b/OpenPGP-Keychain/src/main/res/values-it-rIT/strings.xml index 5ceb4f45b..825115bc9 100644 --- a/OpenPGP-Keychain/src/main/res/values-it-rIT/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-it-rIT/strings.xml @@ -13,7 +13,7 @@ Preferenze App Registrate Preferenze Server delle Chiavi - Cambia Frase di Accesso + Cambia Frase di Accesso Imposta Frase di Accesso Invia Mail… Codifica File diff --git a/OpenPGP-Keychain/src/main/res/values-ja/strings.xml b/OpenPGP-Keychain/src/main/res/values-ja/strings.xml index 0ba511c1e..97d5a72f4 100644 --- a/OpenPGP-Keychain/src/main/res/values-ja/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-ja/strings.xml @@ -13,7 +13,7 @@ 設定 登録済みのアプリケーション 鍵サーバ設定 - パスフレーズの変更 + パスフレーズの変更 パスフレーズの設定 メールの送信… 暗号化してファイルに diff --git a/OpenPGP-Keychain/src/main/res/values-nl-rNL/strings.xml b/OpenPGP-Keychain/src/main/res/values-nl-rNL/strings.xml index 35a0b5a03..863932a80 100644 --- a/OpenPGP-Keychain/src/main/res/values-nl-rNL/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-nl-rNL/strings.xml @@ -10,7 +10,7 @@ Sleutel bewerken Instellingen Geregistreerde apps - Wachtwoord wijzigen + Wachtwoord wijzigen Wachtwoord instellen E-mail verzenden… Versleutelen naar bestand diff --git a/OpenPGP-Keychain/src/main/res/values-ru/strings.xml b/OpenPGP-Keychain/src/main/res/values-ru/strings.xml index c8aff125b..f69cf8789 100644 --- a/OpenPGP-Keychain/src/main/res/values-ru/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-ru/strings.xml @@ -13,7 +13,7 @@ Настройки Связанные приложения Настройки сервера ключей - Изменить пароль + Изменить пароль Задать пароль Отправить… Зашифровать в файл diff --git a/OpenPGP-Keychain/src/main/res/values-uk/strings.xml b/OpenPGP-Keychain/src/main/res/values-uk/strings.xml index c883ea583..8997ef5ce 100644 --- a/OpenPGP-Keychain/src/main/res/values-uk/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-uk/strings.xml @@ -13,7 +13,7 @@ Налаштування Зареєстровані програми Налаштування сервера ключів - Змінити парольну фразу + Змінити парольну фразу Задати парольну фразу Надіслати листа… Зашифрувати до файлу diff --git a/OpenPGP-Keychain/src/main/res/values/arrays.xml b/OpenPGP-Keychain/src/main/res/values/arrays.xml index 974239110..5244de419 100644 --- a/OpenPGP-Keychain/src/main/res/values/arrays.xml +++ b/OpenPGP-Keychain/src/main/res/values/arrays.xml @@ -1,7 +1,7 @@ - + @string/choice_15secs @string/choice_1min @string/choice_3mins @@ -15,7 +15,7 @@ @string/choice_8hours @string/choice_forever - + 15 60 180 diff --git a/OpenPGP-Keychain/src/main/res/values/strings.xml b/OpenPGP-Keychain/src/main/res/values/strings.xml index 9689010ed..34dc26571 100644 --- a/OpenPGP-Keychain/src/main/res/values/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values/strings.xml @@ -14,7 +14,7 @@ Preferences Registered Applications Keyserver Preference - Change Passphrase + Change Passphrase Set Passphrase "Send Mail…" Encrypt To File diff --git a/OpenPGP-Keychain/src/main/res/xml/gen_preferences.xml b/OpenPGP-Keychain/src/main/res/xml/gen_preferences.xml index f83fcb0f6..9f1883df0 100644 --- a/OpenPGP-Keychain/src/main/res/xml/gen_preferences.xml +++ b/OpenPGP-Keychain/src/main/res/xml/gen_preferences.xml @@ -18,9 +18,9 @@ From 0cb5d86860a4707c68f1a48c720b513d9d04d99a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Thu, 6 Mar 2014 22:24:52 +0100 Subject: [PATCH 050/109] back to Gradle 1.10, Using Gradle 1.11 requires Android Studio 0.5.0 which is not released yet --- OpenPGP-Keychain-API/build.gradle | 2 +- .../gradle/wrapper/gradle-wrapper.jar | Bin 51106 -> 50557 bytes .../gradle/wrapper/gradle-wrapper.properties | 4 ++-- build.gradle | 2 +- gradle/wrapper/gradle-wrapper.jar | Bin 51106 -> 50557 bytes gradle/wrapper/gradle-wrapper.properties | 4 ++-- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/OpenPGP-Keychain-API/build.gradle b/OpenPGP-Keychain-API/build.gradle index 47a0f376a..0ce5dc8c0 100644 --- a/OpenPGP-Keychain-API/build.gradle +++ b/OpenPGP-Keychain-API/build.gradle @@ -1,3 +1,3 @@ task wrapper(type: Wrapper) { - gradleVersion = '1.11' + gradleVersion = '1.10' } diff --git a/OpenPGP-Keychain-API/gradle/wrapper/gradle-wrapper.jar b/OpenPGP-Keychain-API/gradle/wrapper/gradle-wrapper.jar index 3c7abdf12790879c06b07176de29647f77aa4129..5838598129719e795cc5633f411468bdec311016 100644 GIT binary patch delta 5305 zcmZu#2{=@38$R}3wi)|Uc8!dkB$X}6n#S0(mVHSJ$uyCzg`6xEBfAtvd}H6&&rbCz zvNfTyQz6lRX2!4Icm3ybuJd@_`+4sBdEWQD&MPaPW;>3C-Q1XlmKgvT8G)*E4|N~1 zOEQt3Dv7)wv>zTr@z8#qo~8!=1UgHAyzg*r~`LsGFHy&5<_m@#vt*$=9xGZ*DGWteW)w&;S{i8PX z_>0M#;k8c1m=kSh!pxhDVBP^4abkI;MYXVnr-g6vOP>Fw)CLu#DzxIgyrpSeQW*QI0TGCU-o#e`|#W$1J8|P;&fMhkh2h4gx|>@ywA2s1zl(=z6iZ7rM-X7fXUmyh%H(Lh8`gOqSmZ} z7GA@ns9Y-zSFfzOKB83R*>Nw&p3@xhx?IaONB-$QMLA6=->ZTQh@}D1ni$nw>Gs@L z+w5%Eu56EwjMz_D-#ZNS@zTDog*x4G49{G5_!N0Ak31N>D}oR{PSl(|?U;nPl^bin zZFvf#y*BOb&yDMuLDb%J zYrSbYpvXA~wPG1>=1xK8^m2@fxXF?D!k>qfPQHA*=+caDX`va5=-?)VBMu`ye+9N@ zhxNCgin1D!Y4K>qC$j7J9*h4KQ+VtnS0&ce0wM01_p)FRCviX1j0w@*^-p@L>H9^c zc&}*7(v6K1EM(!{E=<}og)&djaZk~N z;=CJ0Y}BwSL%kDL%5D9*lX6)G+}*7~`Y#9ciWucwa-~qQYdod4+}@a0+mSg|O@ng^ zk?kksoICRF&F4KjmJ@U330gt_yKr9A6AdTx5eMPWL(U_aff326S-*7$D{*H{Ul(My z}4sU$I1`&wCR- zeCt*=i@20yeWN!)m#Zrw5;LRx^iU2L@slO-yp!sngqnAjO~Ry$i`!RSnJJza^PrKK zcJ_{YE9QtmfnRX_NYy~9EW~pWNi1#-dG1(>e`d&2w~fC}yDM0=!cBZ&yozhBYWnss zV;3wp&w3C#dwd=TfAu@>d}Fv(^0pX5fU1JP9j1Ca<|Ew>A@Eb&T6&nnEM}E$bi;a2 z-Ol&sD8;i&7aJp^f6myo(ZgR~{+#XZVL)8KjqR{<++2IR#;W>KfyPnsx%6mJ?3+gq z@%>V^aBIRwOKI#Q{ZU^;;Xqqgr-AiX`$K)_1^bU=T<&?Ej0oe7N*`tMp53wvoUm3J z=AxgeT7Q%#ktpI!=SUkYzmm=k=4{Fm@vu_QAj?ZR{2WW<>g`R*DKGm^4sO;JDG8lWm6v{@Yn23o*jk)Ai9hdL# zbN5%BcXWV@_bTNPt82^9Mt=4|e)X%>IC&fNT!MUSQkv4}y^9_}`Cr0KUuN__kZe|zd#Smu#=u96?YH(na)#ku+Czuzhv^$_=6290#9pY>E8&+YImasS?S<=K=R7t$g>IP_w4 z^fmVDX)8hfO7Uf;9vaThX4Q)VGS!yq*VDCnRYzyXKX}b)uS-_M-QfyNbIQu^=;N&) zp^3-Ew42y`66_Z$-+Ul5Z>j$_wa+=_$r2jpk!^N0G%j3i-p6bd6YTfMXH^9~qr>7J zrpjfwk)@@Iezuu5pHg+Q(+oBmoPuX}E~k>wHy_v9fVV1d@?3{c@Mfm1MQC2$EXnc? zn%Pd9(_Ev%ajbSn5jCuv!vNCVZPY&DMR?|Kei@QI|u~5Z+ zbnDpWO13<)Tn57lU$HT?>ve8HyIvr&s`X|)$m>F=P9x+C8d5(33k7)x)iPTw+^bmb z@Fu9HRd^c0&WA61@cDJ?8PPddE$!eCF-h8*rIu4@n#f8;mO)&m-4tV*0nKj#8WU`< zr%L~`Tn;}c_78CgA)R*RfNMh+EEjLSWy}veDZraoDv7yYq`m%3Nh#Xb)kL{+gD1r2 zfPG^7gHemayfj7i(F1CzAq|bY>B^PgtPD~elq=_RT3*Bvs$|6f7FY$83z#G9>$p^V zaBqX{X`=Y)vu)bs|!}pLhm`Um28Z z87v0i8r{n$kJm3<4!6Ha7{FbSm$^vy+)W$ZwCvbzi^o#E)iY|z8EHcLxW+BHURp<1 z=03RpX+Y1!f5yfpaAYN@_V%22)z33g#bWMs^2>4^7{iW0V}m8T5YwLp`HJSa_MK64 zBK=|MI?r!LPZ@q*44g)PvbbbAaMYNljIYNjQDNP+GmvXF?Xq@TDL%2P9BcFXtTW-< zt?tKKESY0OHv#k+!76FvOwp1)cw-Se8{Uh(cCvoX+9$p6jH?+se)H} zRj#CJ6>yc!0;z;lnE~mnWts9Jq_^--hb~avS{$PqU*p$;WYxd6eTGvv-Zq&*evFyN z#x_{~+cPe@WVe`CgZ(9GQud4@tK%#q@<(=RC0WkTCSu>wgtgJWJ8P?&e-_y%b@Xyu zJMYNd%0x?_B}bMojdyKM7r#-7YHTl6*S&LbNO9$8G|**hR7_{5#`JAW*r>JN2UVM# z7h%I;)7d*eBPiFNs4AF;-7z<1#vSN2>>2eJ#oajGd9r{Tl#Z;{mGqWZ4=`~mTwzK0 zD)Kv_Nc4m2Q)S-H`{4Eju~+PykU_>|rpAEipH`7d1QpSTX-P)e1+)?k*#eX8KC_ct z6Cd>rbEyGfogTbUC=Kq^3zqfSmrzsSSf|gsmaj`96~#y6CdkN1iX`%XKQ#nJj?x2w zI>_NB0dnNgm)ZEt?}ixpAEj`WMF$PhQGy+=Z|{|Wl^t<`qXHoBROyn-_j=nCy?B+uio}i^+{8%?cy3=CD1UE z3b`gT-3g)zdi&Rkip8I`QcgHXKCglA3Ce#?k|3-?(}J|vprarFHG+K6?mhv416Vkj z3jO9EbWy?Fn2MT*=Ff?g1p03T%f5(OFrz|%LRMG7N4s!xmU0GMtYD>hcOY*LR)C6p zGDK1{ff|+Elo7K^(#Q^FoqKu1QTS0N~Iy<{(e z1@a1k$?V)9Up1>3salJh!k*Jmnfy>W$UW@H~`4(11cy$Ks7RG|B3q#DhFGsNzTSxD^BT&VlAmt3wmVl z7lZ%PODq{-XiP@|l8FDEN76DTZ)6aViwXds{~hdIIar(X;0bF1u&$1k{5F8Sb)#~|l=8`k5Kjah0BG;ydG0_4LOTfP*Kmjo{w&V6Y6#V0 z3l|0F$UcMfdV9keQ=g|Ow#=bOn zuI};v-9%};xJs0{9K=`2@$c8;_I2=5s0?_dc~|=JW)j~r2DEKHO|JUvi$;DUNG>hZ zOM`tptynToZ-nGtZMIP_QC^$?&;w1{{?{-t5&|Cr(Jfq*dGl)_@rWjqQxvs`P`v$Q zFVEw>0{j~2L4nrY7-TCcX8kF&RQSOk=@NU(1x&An)j}G@AdQH98mTg&@(zLj+qlTJ zLk}NA;6nO;Pa{LlF0as^{yVmjIJfe^se;3Md@2%b6JMdehe3Plv3-2u1>j)Y8A>st z?WEA=m!MX=A-R?3sNrvDAm$2aOHtYvmQ+k;#^E_h%%Y_EWe7i7p#^btL3@wZKJaHS qvt0s|?2sZSCH++)&5Is%i|)gPm4n_Lvg`_g0&oeM_uu8D(fAfml={NptJ)VUA$b)16>0y_&z|_D zm3-;n9g`A~*OeZ&eA>!0o$M7ex4PzAMYylE!ZA9YtWw>Je(U8>$mn!0U_7(s@SG4P`|FW zTY4%%%(Z+qKBxDjZbW#pquX#9M~-6z1=b^At|?~hJFS{r^_B6b-;?vzb3~-c|H(ck z82>~sb5q_kZnBpnj^$(&O2HK?%32EF50?JGl};C{(d}PsGl~#p8B?p%YUsP<{cMq2 zuDb5yNNBgeK?c$zs(PI1DrO!KGcD|{$SC<%4jM*ECV zw-vthQWW^Y_4&wyWv7Bb{OKVOAza}C3AJ=UZZ&1aJ7xhYyjeMiCQk0g0FjAF@ zIYy5w{P1^(GDh$Y^I`!86lG9UksPCJhfP-Bx|Rdy-WYgM%!%B-ZOM6-=ZqIM>x6*8 z0yhZn6twqmx-v8kYeOG+Y-&j?S^VIEwvqvpDwy3z3cX@u|iVIAO-(6hUf zwvavjz41G0=GS!3yrJ5z^!2YAckggdmhif4gi zy5IMh)pNcy+PVmP9niq?GG)Qmyq^7K^6;2wX!aeoNg?!Qskn*an&7xQ%Km9LCQ^0gei5mFc`JS~W7u%+Kj#zq{3 z=AP;_-}P_GVqPJEZFW+bMKYq;U|+3_KJ%&+IvBUanR{W+i*k3+sB3nh85S`Rp30 zNpEld84-D@U4Ba+-I49waFC3S-s_<1pxg+sSWXSvEpH@F;GX9#Lb5X2&wqk zmM!Qdo$=01*Lxp6lru2zexApyvH|7byXoMPr=Dbr)DdT^2%$E^yf&oX{rMK|W5;w` zFkv=m?w;fNC__74SPt9hJaa7!_$oelwZFrJG?VWsf;p#b`*}5!n$v1vU@UBURquOU z1+QxAlgLK$Ceq>w`un=5&8$*e*|y^ERxCypZ|ab`4mCYYvRKQGIZDg4erutV>kpGt zPLQXLI80z0`gvBQ_|POT{&(K z?i*7;qH4U`jNU3LYgvYJu4c)aze@Uqe16<2hq_DT zVy=$7eo#i^^a6QX2TQ-n!NIAXirIM_hVGhAlI339j1+gVE=VZv)MK^io^^YZZJZ(* zcZpJd0Di~y$y*EzfeJTWIK6$dxv1VNx~m4Wo>F73d_S@MSx0;!Q)b0iFZ#&*`?eDX zn};$xqyE~|^6{2wi-Rm(rH-eBSuDe6emeCI!xQ^v*#50RI#g4$l>2@G`B+T?>~^_KB>^-TsEVU5}*0=gz4ZV#YeNN)y6jK z4DDCC*I7r`-%p!$UwHM(I%P8{U>7)3O!XBeE&L;o~m(u zuB7v>Npv?ewrL)9iv1T{byo^L-sI2kIf@8+Im%~bidj?-O$mz zeYeIl3Yo8jgGiRTR$`*A+?YJHeZsH3z4=tZB|% ztoc|dL&NC9IVYF9=R{V`VvIccZgo6$?l2QcRiXLCqFFN7X6>L_^1YC3+b%bKsnLmc z(JMvO_paGDFO+7RJLKdd~VS|8Z#oRk(}5%viwgQcO3_!l{5 z^VgYVR5(GnMahM=}l9tEtBAP(P+>mLd0t zb?``Uye(3kv6W6cROVfvesdj1~Nc1$h(~+X&K9!ojubxY>ml-8@^=YqDQc4;Xx`t=v*HrvIWFkj7CTaeY<$5to8o)5bZWA6)~ z1qSt~vU}5)KeOFO+T5q^+4U}X!7?cGo=M>Pat zq_OL3T8g{c*dH*YneigCOvHyuulpkdn%)~T^MYkVmW*PEM8p|tWro4bMb9AezP#*1 zCDLqkFI!Nrvo3tHkF>f&g)_Ixy1LF?8vcDF{HCmeeDqhDcNr}|A~w!@yD&`%DKGoa z(&YG~j6cjlD`(I`I?$j!?sNSvnw`6(lIfiV!sV@>9(KBRW>>7aWzv?X$bE%6+`<@} z#0{RYd{KZMPd8LvY0lbVUn#^Yv>qT=I*d8_r=)VztgUnNXvKbH=ary)WLKt!KeKvp zg_ZintT^X=(^i6aow@p<8yZaS-RJ))g)=h_RU`KfS#P`a#$h1DDXF3|PKQJB>^2hG zbGh?PRNu+%O`l(@$c`!NsLG+7ypd78MH`_&e&#SPvg(-N^(Qe{=+ruNl$&zZCw7^e zvT&p z3-B`MN2wikjC5ti86uD)GuVkR<-xZFe89S+7!-9d{4B ztLlC2(UbE~@?m<(K2ymRO9|FAy{#gP%C!V@^zG@oFFuGwiCq6r5n>UtOmH1l?WcZA zQza$l+3Zwsg-It#64lkK;go6pBx8|xHT$bwZdfU+Z2>01r`@KZbbC&uPHO8p3@0l$ zmG;*swB$Yw(8Y;ST`jic||3GW-a5YrR64sN0*)P#|h2S0(V0_ClAG-~i0q9FVV1phd)xEJa{MVR}A8X#f9dC)6v zX43(CUUCWuL<`6Z766)?1uH~um>x+%-7I1vm`J34CdHfN?|%_V0Zp<%6Iswi6xeKm zR=B2T5i}pvX!4hV9W*aAr3?lrw2D_4Wz~@rI2iIt$?$>Q{K}V{4ssMx0xg#$D)gSz z9QmVphB^`(UwG!oYM`Y5Xzp>T;SuiJt9xYBxB#BcNFjhkjK=>iuh%jN%fIEdhT+Bc zI{?FL*}q>70NvM$C|rF)zynl*KS0?>2P5R*Y&tmh4Y&&SVkD#|$o_tTz(Ian&>rC- z5S&HBk;PT~cZ2`ekQsy?8RINhaBZ8|e?7U~aJljr1df6yKY0E=FlY`SuksY&Q^|Y^ z7ekWmb|MQX$qx(wAJ7pHgFXatraU;z@+YgnB5-~JJo$bTfmaMVgd7;GW&z+;?06v2 zXAmNwBL$FO3Df$&zl!`<|HK7NQ3^^3#0ZR3mWYa)8b<|$R*B<%I=@8MI)DK%f?x?E z;AMI|&_Rj{_)v8U4>peCa$f`^WdoN)ng~q8ga^x2!wDfd@rx6iz7=l19V6T=CDQ^2U0s#i#NnApJ1t3v(ng@3i;dfpTa2(ug zSc%vKEP-ovLYHtL-2CsdXZQoc6)(RP;YK+sduK0qqSD71-`e=%unbz?12v!iV~k6L zi4{Onua1`?WAB>u6#Q`oJVl5=w`_s@V1D4hnhLm6555nKK$M7l)S?0Cbrs+`_9#+xGtNh1G+t(NGoe0gVoNMMm>`h1;HnTyRE`Ch zS_nQYjocHTfa!pPVu)|{)ifMiN;?IR(87k-L-Y(G(lea_VsUH2iUiv0Pjoh3Co{s3RIiy ztAL5J1``D*qG>P0FUGMK41be#4~wI@P=rrbKbBB$07N+*m+O5{jUo|6d?_$pqWss~ zu?=T#{|YE8mBT3@ta1x}w!EB>Ga-C*xTl;J$c4KJPZ4oyRRRw&yevk#xP2D4A4)^8 LU?p@_;{N*|!W@tg diff --git a/OpenPGP-Keychain-API/gradle/wrapper/gradle-wrapper.properties b/OpenPGP-Keychain-API/gradle/wrapper/gradle-wrapper.properties index 8c3a98441..d8e0b5b29 100644 --- a/OpenPGP-Keychain-API/gradle/wrapper/gradle-wrapper.properties +++ b/OpenPGP-Keychain-API/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Thu Mar 06 18:21:41 CET 2014 +#Thu Mar 06 22:23:44 CET 2014 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.11-bin.zip +distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-bin.zip diff --git a/build.gradle b/build.gradle index 305e8d1b9..25651cd5a 100644 --- a/build.gradle +++ b/build.gradle @@ -15,5 +15,5 @@ allprojects { } task wrapper(type: Wrapper) { - gradleVersion = '1.11' + gradleVersion = '1.10' } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 3c7abdf12790879c06b07176de29647f77aa4129..5838598129719e795cc5633f411468bdec311016 100644 GIT binary patch delta 5305 zcmZu#2{=@38$R}3wi)|Uc8!dkB$X}6n#S0(mVHSJ$uyCzg`6xEBfAtvd}H6&&rbCz zvNfTyQz6lRX2!4Icm3ybuJd@_`+4sBdEWQD&MPaPW;>3C-Q1XlmKgvT8G)*E4|N~1 zOEQt3Dv7)wv>zTr@z8#qo~8!=1UgHAyzg*r~`LsGFHy&5<_m@#vt*$=9xGZ*DGWteW)w&;S{i8PX z_>0M#;k8c1m=kSh!pxhDVBP^4abkI;MYXVnr-g6vOP>Fw)CLu#DzxIgyrpSeQW*QI0TGCU-o#e`|#W$1J8|P;&fMhkh2h4gx|>@ywA2s1zl(=z6iZ7rM-X7fXUmyh%H(Lh8`gOqSmZ} z7GA@ns9Y-zSFfzOKB83R*>Nw&p3@xhx?IaONB-$QMLA6=->ZTQh@}D1ni$nw>Gs@L z+w5%Eu56EwjMz_D-#ZNS@zTDog*x4G49{G5_!N0Ak31N>D}oR{PSl(|?U;nPl^bin zZFvf#y*BOb&yDMuLDb%J zYrSbYpvXA~wPG1>=1xK8^m2@fxXF?D!k>qfPQHA*=+caDX`va5=-?)VBMu`ye+9N@ zhxNCgin1D!Y4K>qC$j7J9*h4KQ+VtnS0&ce0wM01_p)FRCviX1j0w@*^-p@L>H9^c zc&}*7(v6K1EM(!{E=<}og)&djaZk~N z;=CJ0Y}BwSL%kDL%5D9*lX6)G+}*7~`Y#9ciWucwa-~qQYdod4+}@a0+mSg|O@ng^ zk?kksoICRF&F4KjmJ@U330gt_yKr9A6AdTx5eMPWL(U_aff326S-*7$D{*H{Ul(My z}4sU$I1`&wCR- zeCt*=i@20yeWN!)m#Zrw5;LRx^iU2L@slO-yp!sngqnAjO~Ry$i`!RSnJJza^PrKK zcJ_{YE9QtmfnRX_NYy~9EW~pWNi1#-dG1(>e`d&2w~fC}yDM0=!cBZ&yozhBYWnss zV;3wp&w3C#dwd=TfAu@>d}Fv(^0pX5fU1JP9j1Ca<|Ew>A@Eb&T6&nnEM}E$bi;a2 z-Ol&sD8;i&7aJp^f6myo(ZgR~{+#XZVL)8KjqR{<++2IR#;W>KfyPnsx%6mJ?3+gq z@%>V^aBIRwOKI#Q{ZU^;;Xqqgr-AiX`$K)_1^bU=T<&?Ej0oe7N*`tMp53wvoUm3J z=AxgeT7Q%#ktpI!=SUkYzmm=k=4{Fm@vu_QAj?ZR{2WW<>g`R*DKGm^4sO;JDG8lWm6v{@Yn23o*jk)Ai9hdL# zbN5%BcXWV@_bTNPt82^9Mt=4|e)X%>IC&fNT!MUSQkv4}y^9_}`Cr0KUuN__kZe|zd#Smu#=u96?YH(na)#ku+Czuzhv^$_=6290#9pY>E8&+YImasS?S<=K=R7t$g>IP_w4 z^fmVDX)8hfO7Uf;9vaThX4Q)VGS!yq*VDCnRYzyXKX}b)uS-_M-QfyNbIQu^=;N&) zp^3-Ew42y`66_Z$-+Ul5Z>j$_wa+=_$r2jpk!^N0G%j3i-p6bd6YTfMXH^9~qr>7J zrpjfwk)@@Iezuu5pHg+Q(+oBmoPuX}E~k>wHy_v9fVV1d@?3{c@Mfm1MQC2$EXnc? zn%Pd9(_Ev%ajbSn5jCuv!vNCVZPY&DMR?|Kei@QI|u~5Z+ zbnDpWO13<)Tn57lU$HT?>ve8HyIvr&s`X|)$m>F=P9x+C8d5(33k7)x)iPTw+^bmb z@Fu9HRd^c0&WA61@cDJ?8PPddE$!eCF-h8*rIu4@n#f8;mO)&m-4tV*0nKj#8WU`< zr%L~`Tn;}c_78CgA)R*RfNMh+EEjLSWy}veDZraoDv7yYq`m%3Nh#Xb)kL{+gD1r2 zfPG^7gHemayfj7i(F1CzAq|bY>B^PgtPD~elq=_RT3*Bvs$|6f7FY$83z#G9>$p^V zaBqX{X`=Y)vu)bs|!}pLhm`Um28Z z87v0i8r{n$kJm3<4!6Ha7{FbSm$^vy+)W$ZwCvbzi^o#E)iY|z8EHcLxW+BHURp<1 z=03RpX+Y1!f5yfpaAYN@_V%22)z33g#bWMs^2>4^7{iW0V}m8T5YwLp`HJSa_MK64 zBK=|MI?r!LPZ@q*44g)PvbbbAaMYNljIYNjQDNP+GmvXF?Xq@TDL%2P9BcFXtTW-< zt?tKKESY0OHv#k+!76FvOwp1)cw-Se8{Uh(cCvoX+9$p6jH?+se)H} zRj#CJ6>yc!0;z;lnE~mnWts9Jq_^--hb~avS{$PqU*p$;WYxd6eTGvv-Zq&*evFyN z#x_{~+cPe@WVe`CgZ(9GQud4@tK%#q@<(=RC0WkTCSu>wgtgJWJ8P?&e-_y%b@Xyu zJMYNd%0x?_B}bMojdyKM7r#-7YHTl6*S&LbNO9$8G|**hR7_{5#`JAW*r>JN2UVM# z7h%I;)7d*eBPiFNs4AF;-7z<1#vSN2>>2eJ#oajGd9r{Tl#Z;{mGqWZ4=`~mTwzK0 zD)Kv_Nc4m2Q)S-H`{4Eju~+PykU_>|rpAEipH`7d1QpSTX-P)e1+)?k*#eX8KC_ct z6Cd>rbEyGfogTbUC=Kq^3zqfSmrzsSSf|gsmaj`96~#y6CdkN1iX`%XKQ#nJj?x2w zI>_NB0dnNgm)ZEt?}ixpAEj`WMF$PhQGy+=Z|{|Wl^t<`qXHoBROyn-_j=nCy?B+uio}i^+{8%?cy3=CD1UE z3b`gT-3g)zdi&Rkip8I`QcgHXKCglA3Ce#?k|3-?(}J|vprarFHG+K6?mhv416Vkj z3jO9EbWy?Fn2MT*=Ff?g1p03T%f5(OFrz|%LRMG7N4s!xmU0GMtYD>hcOY*LR)C6p zGDK1{ff|+Elo7K^(#Q^FoqKu1QTS0N~Iy<{(e z1@a1k$?V)9Up1>3salJh!k*Jmnfy>W$UW@H~`4(11cy$Ks7RG|B3q#DhFGsNzTSxD^BT&VlAmt3wmVl z7lZ%PODq{-XiP@|l8FDEN76DTZ)6aViwXds{~hdIIar(X;0bF1u&$1k{5F8Sb)#~|l=8`k5Kjah0BG;ydG0_4LOTfP*Kmjo{w&V6Y6#V0 z3l|0F$UcMfdV9keQ=g|Ow#=bOn zuI};v-9%};xJs0{9K=`2@$c8;_I2=5s0?_dc~|=JW)j~r2DEKHO|JUvi$;DUNG>hZ zOM`tptynToZ-nGtZMIP_QC^$?&;w1{{?{-t5&|Cr(Jfq*dGl)_@rWjqQxvs`P`v$Q zFVEw>0{j~2L4nrY7-TCcX8kF&RQSOk=@NU(1x&An)j}G@AdQH98mTg&@(zLj+qlTJ zLk}NA;6nO;Pa{LlF0as^{yVmjIJfe^se;3Md@2%b6JMdehe3Plv3-2u1>j)Y8A>st z?WEA=m!MX=A-R?3sNrvDAm$2aOHtYvmQ+k;#^E_h%%Y_EWe7i7p#^btL3@wZKJaHS qvt0s|?2sZSCH++)&5Is%i|)gPm4n_Lvg`_g0&oeM_uu8D(fAfml={NptJ)VUA$b)16>0y_&z|_D zm3-;n9g`A~*OeZ&eA>!0o$M7ex4PzAMYylE!ZA9YtWw>Je(U8>$mn!0U_7(s@SG4P`|FW zTY4%%%(Z+qKBxDjZbW#pquX#9M~-6z1=b^At|?~hJFS{r^_B6b-;?vzb3~-c|H(ck z82>~sb5q_kZnBpnj^$(&O2HK?%32EF50?JGl};C{(d}PsGl~#p8B?p%YUsP<{cMq2 zuDb5yNNBgeK?c$zs(PI1DrO!KGcD|{$SC<%4jM*ECV zw-vthQWW^Y_4&wyWv7Bb{OKVOAza}C3AJ=UZZ&1aJ7xhYyjeMiCQk0g0FjAF@ zIYy5w{P1^(GDh$Y^I`!86lG9UksPCJhfP-Bx|Rdy-WYgM%!%B-ZOM6-=ZqIM>x6*8 z0yhZn6twqmx-v8kYeOG+Y-&j?S^VIEwvqvpDwy3z3cX@u|iVIAO-(6hUf zwvavjz41G0=GS!3yrJ5z^!2YAckggdmhif4gi zy5IMh)pNcy+PVmP9niq?GG)Qmyq^7K^6;2wX!aeoNg?!Qskn*an&7xQ%Km9LCQ^0gei5mFc`JS~W7u%+Kj#zq{3 z=AP;_-}P_GVqPJEZFW+bMKYq;U|+3_KJ%&+IvBUanR{W+i*k3+sB3nh85S`Rp30 zNpEld84-D@U4Ba+-I49waFC3S-s_<1pxg+sSWXSvEpH@F;GX9#Lb5X2&wqk zmM!Qdo$=01*Lxp6lru2zexApyvH|7byXoMPr=Dbr)DdT^2%$E^yf&oX{rMK|W5;w` zFkv=m?w;fNC__74SPt9hJaa7!_$oelwZFrJG?VWsf;p#b`*}5!n$v1vU@UBURquOU z1+QxAlgLK$Ceq>w`un=5&8$*e*|y^ERxCypZ|ab`4mCYYvRKQGIZDg4erutV>kpGt zPLQXLI80z0`gvBQ_|POT{&(K z?i*7;qH4U`jNU3LYgvYJu4c)aze@Uqe16<2hq_DT zVy=$7eo#i^^a6QX2TQ-n!NIAXirIM_hVGhAlI339j1+gVE=VZv)MK^io^^YZZJZ(* zcZpJd0Di~y$y*EzfeJTWIK6$dxv1VNx~m4Wo>F73d_S@MSx0;!Q)b0iFZ#&*`?eDX zn};$xqyE~|^6{2wi-Rm(rH-eBSuDe6emeCI!xQ^v*#50RI#g4$l>2@G`B+T?>~^_KB>^-TsEVU5}*0=gz4ZV#YeNN)y6jK z4DDCC*I7r`-%p!$UwHM(I%P8{U>7)3O!XBeE&L;o~m(u zuB7v>Npv?ewrL)9iv1T{byo^L-sI2kIf@8+Im%~bidj?-O$mz zeYeIl3Yo8jgGiRTR$`*A+?YJHeZsH3z4=tZB|% ztoc|dL&NC9IVYF9=R{V`VvIccZgo6$?l2QcRiXLCqFFN7X6>L_^1YC3+b%bKsnLmc z(JMvO_paGDFO+7RJLKdd~VS|8Z#oRk(}5%viwgQcO3_!l{5 z^VgYVR5(GnMahM=}l9tEtBAP(P+>mLd0t zb?``Uye(3kv6W6cROVfvesdj1~Nc1$h(~+X&K9!ojubxY>ml-8@^=YqDQc4;Xx`t=v*HrvIWFkj7CTaeY<$5to8o)5bZWA6)~ z1qSt~vU}5)KeOFO+T5q^+4U}X!7?cGo=M>Pat zq_OL3T8g{c*dH*YneigCOvHyuulpkdn%)~T^MYkVmW*PEM8p|tWro4bMb9AezP#*1 zCDLqkFI!Nrvo3tHkF>f&g)_Ixy1LF?8vcDF{HCmeeDqhDcNr}|A~w!@yD&`%DKGoa z(&YG~j6cjlD`(I`I?$j!?sNSvnw`6(lIfiV!sV@>9(KBRW>>7aWzv?X$bE%6+`<@} z#0{RYd{KZMPd8LvY0lbVUn#^Yv>qT=I*d8_r=)VztgUnNXvKbH=ary)WLKt!KeKvp zg_ZintT^X=(^i6aow@p<8yZaS-RJ))g)=h_RU`KfS#P`a#$h1DDXF3|PKQJB>^2hG zbGh?PRNu+%O`l(@$c`!NsLG+7ypd78MH`_&e&#SPvg(-N^(Qe{=+ruNl$&zZCw7^e zvT&p z3-B`MN2wikjC5ti86uD)GuVkR<-xZFe89S+7!-9d{4B ztLlC2(UbE~@?m<(K2ymRO9|FAy{#gP%C!V@^zG@oFFuGwiCq6r5n>UtOmH1l?WcZA zQza$l+3Zwsg-It#64lkK;go6pBx8|xHT$bwZdfU+Z2>01r`@KZbbC&uPHO8p3@0l$ zmG;*swB$Yw(8Y;ST`jic||3GW-a5YrR64sN0*)P#|h2S0(V0_ClAG-~i0q9FVV1phd)xEJa{MVR}A8X#f9dC)6v zX43(CUUCWuL<`6Z766)?1uH~um>x+%-7I1vm`J34CdHfN?|%_V0Zp<%6Iswi6xeKm zR=B2T5i}pvX!4hV9W*aAr3?lrw2D_4Wz~@rI2iIt$?$>Q{K}V{4ssMx0xg#$D)gSz z9QmVphB^`(UwG!oYM`Y5Xzp>T;SuiJt9xYBxB#BcNFjhkjK=>iuh%jN%fIEdhT+Bc zI{?FL*}q>70NvM$C|rF)zynl*KS0?>2P5R*Y&tmh4Y&&SVkD#|$o_tTz(Ian&>rC- z5S&HBk;PT~cZ2`ekQsy?8RINhaBZ8|e?7U~aJljr1df6yKY0E=FlY`SuksY&Q^|Y^ z7ekWmb|MQX$qx(wAJ7pHgFXatraU;z@+YgnB5-~JJo$bTfmaMVgd7;GW&z+;?06v2 zXAmNwBL$FO3Df$&zl!`<|HK7NQ3^^3#0ZR3mWYa)8b<|$R*B<%I=@8MI)DK%f?x?E z;AMI|&_Rj{_)v8U4>peCa$f`^WdoN)ng~q8ga^x2!wDfd@rx6iz7=l19V6T=CDQ^2U0s#i#NnApJ1t3v(ng@3i;dfpTa2(ug zSc%vKEP-ovLYHtL-2CsdXZQoc6)(RP;YK+sduK0qqSD71-`e=%unbz?12v!iV~k6L zi4{Onua1`?WAB>u6#Q`oJVl5=w`_s@V1D4hnhLm6555nKK$M7l)S?0Cbrs+`_9#+xGtNh1G+t(NGoe0gVoNMMm>`h1;HnTyRE`Ch zS_nQYjocHTfa!pPVu)|{)ifMiN;?IR(87k-L-Y(G(lea_VsUH2iUiv0Pjoh3Co{s3RIiy ztAL5J1``D*qG>P0FUGMK41be#4~wI@P=rrbKbBB$07N+*m+O5{jUo|6d?_$pqWss~ zu?=T#{|YE8mBT3@ta1x}w!EB>Ga-C*xTl;J$c4KJPZ4oyRRRw&yevk#xP2D4A4)^8 LU?p@_;{N*|!W@tg diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 9c0d6700a..d8e0b5b29 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Thu Mar 06 18:21:40 CET 2014 +#Thu Mar 06 22:23:44 CET 2014 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.11-bin.zip +distributionUrl=http\://services.gradle.org/distributions/gradle-1.10-bin.zip From b9a9bbe429542078ace00f7bf9719de16601768a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Thu, 6 Mar 2014 22:46:04 +0100 Subject: [PATCH 051/109] remove icon from nfc dialog --- .../keychain/ui/dialog/ShareNfcDialogFragment.java | 1 - 1 file changed, 1 deletion(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ShareNfcDialogFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ShareNfcDialogFragment.java index 03e09cdcb..b850638a6 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ShareNfcDialogFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ShareNfcDialogFragment.java @@ -53,7 +53,6 @@ public class ShareNfcDialogFragment extends DialogFragment { AlertDialog.Builder alert = new AlertDialog.Builder(activity); - alert.setIcon(android.R.drawable.ic_dialog_info); alert.setTitle(R.string.share_nfc_dialog); alert.setCancelable(true); From a3f17be192fa4762f62c7d2fb0c02652cc53447b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Fri, 7 Mar 2014 10:54:36 +0100 Subject: [PATCH 052/109] Fix API docs --- .../openintents/openpgp/util/OpenPgpApi.java | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpApi.java b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpApi.java index f0eae4a47..586b091b2 100644 --- a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpApi.java +++ b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpApi.java @@ -38,7 +38,7 @@ public class OpenPgpApi { /** * Sign only * - * optional params: + * optional extras: * String EXTRA_PASSPHRASE (for key passphrase) */ public static final String ACTION_SIGN = "org.openintents.openpgp.action.SIGN"; @@ -47,7 +47,7 @@ public class OpenPgpApi { * General extras * -------------- * - * Intent extras: + * required extras: * int EXTRA_API_VERSION (required) * boolean EXTRA_REQUEST_ASCII_ARMOR (request ascii armor for ouput) * @@ -60,10 +60,10 @@ public class OpenPgpApi { /** * Encrypt * - * extras: - * long[] EXTRA_KEY_IDS - * or + * required extras: * String[] EXTRA_USER_IDS (= emails of recipients) (if more than one key has this user_id, a PendingIntent is returned) + * or + * long[] EXTRA_KEY_IDS * * optional extras: * String EXTRA_PASSPHRASE (for key passphrase) @@ -73,10 +73,10 @@ public class OpenPgpApi { /** * Sign and encrypt * - * extras: - * long[] EXTRA_KEY_IDS - * or + * required extras: * String[] EXTRA_USER_IDS (= emails of recipients) (if more than one key has this user_id, a PendingIntent is returned) + * or + * long[] EXTRA_KEY_IDS * * optional extras: * String EXTRA_PASSPHRASE (for key passphrase) @@ -84,7 +84,7 @@ public class OpenPgpApi { public static final String ACTION_SIGN_AND_ENCRYPT = "org.openintents.openpgp.action.SIGN_AND_ENCRYPT"; /** - * Decrypts and verifies given input bytes. This methods handles encrypted-only, signed-and-encrypted, + * Decrypts and verifies given input stream. This methods handles encrypted-only, signed-and-encrypted, * and also signed-only input. * * returned extras: @@ -95,19 +95,19 @@ public class OpenPgpApi { /** * Get key ids based on given user ids (=emails) * - * Intent extras: - * String[] EXTRA_KEY_IDS + * required extras: + * String[] EXTRA_USER_IDS * * returned extras: - * long[] EXTRA_USER_IDS + * long[] EXTRA_KEY_IDS */ public static final String ACTION_GET_KEY_IDS = "org.openintents.openpgp.action.GET_KEY_IDS"; /** * Download keys from keyserver * - * Intent extras: - * String[] EXTRA_KEY_IDS + * required extras: + * long[] EXTRA_KEY_IDS */ public static final String ACTION_DOWNLOAD_KEYS = "org.openintents.openpgp.action.DOWNLOAD_KEYS"; From 53ba741810ee039acbd25a1e139333201d5b043d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Fri, 7 Mar 2014 11:05:11 +0100 Subject: [PATCH 053/109] Fix API docs --- .../openintents/openpgp/util/OpenPgpApi.java | 63 +++++++++++-------- 1 file changed, 36 insertions(+), 27 deletions(-) diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpApi.java b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpApi.java index 586b091b2..9cf2a5ee9 100644 --- a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpApi.java +++ b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpApi.java @@ -34,39 +34,40 @@ public class OpenPgpApi { public static final int API_VERSION = 2; public static final String SERVICE_INTENT = "org.openintents.openpgp.IOpenPgpService"; - - /** - * Sign only - * - * optional extras: - * String EXTRA_PASSPHRASE (for key passphrase) - */ - public static final String ACTION_SIGN = "org.openintents.openpgp.action.SIGN"; - + /** * General extras * -------------- * * required extras: - * int EXTRA_API_VERSION (required) - * boolean EXTRA_REQUEST_ASCII_ARMOR (request ascii armor for ouput) + * int EXTRA_API_VERSION (always required) * * returned extras: - * int RESULT_CODE (0, 1, or 2 (see OpenPgpApi)) - * OpenPgpError RESULT_ERROR (if result_code == 0) - * Intent RESULT_INTENT (if result_code == 2) + * int RESULT_CODE (RESULT_CODE_ERROR, RESULT_CODE_SUCCESS or RESULT_CODE_USER_INTERACTION_REQUIRED) + * OpenPgpError RESULT_ERROR (if RESULT_CODE == RESULT_CODE_ERROR) + * PendingIntent RESULT_INTENT (if RESULT_CODE == RESULT_CODE_USER_INTERACTION_REQUIRED) */ + /** + * Sign only + * + * optional extras: + * boolean EXTRA_REQUEST_ASCII_ARMOR (request ascii armor for ouput) + * String EXTRA_PASSPHRASE (key passphrase) + */ + public static final String ACTION_SIGN = "org.openintents.openpgp.action.SIGN"; + /** * Encrypt * * required extras: - * String[] EXTRA_USER_IDS (= emails of recipients) (if more than one key has this user_id, a PendingIntent is returned) + * String[] EXTRA_USER_IDS (=emails of recipients, if more than one key has a user_id, a PendingIntent is returned via RESULT_INTENT) * or - * long[] EXTRA_KEY_IDS + * long[] EXTRA_KEY_IDS * * optional extras: - * String EXTRA_PASSPHRASE (for key passphrase) + * boolean EXTRA_REQUEST_ASCII_ARMOR (request ascii armor for ouput) + * String EXTRA_PASSPHRASE (key passphrase) */ public static final String ACTION_ENCRYPT = "org.openintents.openpgp.action.ENCRYPT"; @@ -74,12 +75,13 @@ public class OpenPgpApi { * Sign and encrypt * * required extras: - * String[] EXTRA_USER_IDS (= emails of recipients) (if more than one key has this user_id, a PendingIntent is returned) + * String[] EXTRA_USER_IDS (=emails of recipients, if more than one key has a user_id, a PendingIntent is returned via RESULT_INTENT) * or - * long[] EXTRA_KEY_IDS + * long[] EXTRA_KEY_IDS * * optional extras: - * String EXTRA_PASSPHRASE (for key passphrase) + * boolean EXTRA_REQUEST_ASCII_ARMOR (request ascii armor for ouput) + * String EXTRA_PASSPHRASE (key passphrase) */ public static final String ACTION_SIGN_AND_ENCRYPT = "org.openintents.openpgp.action.SIGN_AND_ENCRYPT"; @@ -87,6 +89,12 @@ public class OpenPgpApi { * Decrypts and verifies given input stream. This methods handles encrypted-only, signed-and-encrypted, * and also signed-only input. * + * If OpenPgpSignatureResult.getStatus() == OpenPgpSignatureResult.SIGNATURE_UNKNOWN_PUB_KEY + * in addition a PendingIntent is returned via RESULT_INTENT to download missing keys. + * + * optional extras: + * boolean EXTRA_REQUEST_ASCII_ARMOR (request ascii armor for ouput) + * * returned extras: * OpenPgpSignatureResult RESULT_SIGNATURE */ @@ -96,10 +104,10 @@ public class OpenPgpApi { * Get key ids based on given user ids (=emails) * * required extras: - * String[] EXTRA_USER_IDS + * String[] EXTRA_USER_IDS * * returned extras: - * long[] EXTRA_KEY_IDS + * long[] EXTRA_KEY_IDS */ public static final String ACTION_GET_KEY_IDS = "org.openintents.openpgp.action.GET_KEY_IDS"; @@ -107,11 +115,11 @@ public class OpenPgpApi { * Download keys from keyserver * * required extras: - * long[] EXTRA_KEY_IDS + * long[] EXTRA_KEY_IDS */ public static final String ACTION_DOWNLOAD_KEYS = "org.openintents.openpgp.action.DOWNLOAD_KEYS"; - /* Bundle params */ + /* Intent extras */ public static final String EXTRA_API_VERSION = "api_version"; // SIGN, ENCRYPT, SIGN_AND_ENCRYPT, DECRYPT_VERIFY @@ -122,17 +130,18 @@ public class OpenPgpApi { // ENCRYPT, SIGN_AND_ENCRYPT public static final String EXTRA_USER_IDS = "user_ids"; public static final String EXTRA_KEY_IDS = "key_ids"; - // optional parameter: + // optional extras: public static final String EXTRA_PASSPHRASE = "passphrase"; - /* Service Bundle returns */ + /* Service Intent returns */ public static final String RESULT_CODE = "result_code"; // get actual error object from RESULT_ERROR public static final int RESULT_CODE_ERROR = 0; // success! public static final int RESULT_CODE_SUCCESS = 1; - // executeServiceMethod intent and do it again with intent + // get PendingIntent from RESULT_INTENT, start PendingIntent with startIntentSenderForResult, + // and execute service method again in onActivityResult public static final int RESULT_CODE_USER_INTERACTION_REQUIRED = 2; public static final String RESULT_ERROR = "error"; From 59067f9f8b0a12f875ba928b30f8f35fc284356c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Fri, 7 Mar 2014 11:24:53 +0100 Subject: [PATCH 054/109] API: get key --- .../openintents/openpgp/util/OpenPgpApi.java | 13 +++- .../service/remote/OpenPgpService.java | 59 +++++++++++++++---- 2 files changed, 56 insertions(+), 16 deletions(-) diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpApi.java b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpApi.java index 9cf2a5ee9..f768a1685 100644 --- a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpApi.java +++ b/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpApi.java @@ -112,12 +112,16 @@ public class OpenPgpApi { public static final String ACTION_GET_KEY_IDS = "org.openintents.openpgp.action.GET_KEY_IDS"; /** - * Download keys from keyserver + * This action returns RESULT_CODE_SUCCESS if the OpenPGP Provider already has the key + * corresponding to the given key id in its database. + * + * It returns RESULT_CODE_USER_INTERACTION_REQUIRED if the Provider does not have the key. + * The PendingIntent from RESULT_INTENT can be used to retrieve those from a keyserver. * * required extras: - * long[] EXTRA_KEY_IDS + * long EXTRA_KEY_ID */ - public static final String ACTION_DOWNLOAD_KEYS = "org.openintents.openpgp.action.DOWNLOAD_KEYS"; + public static final String ACTION_GET_KEY = "org.openintents.openpgp.action.GET_KEY"; /* Intent extras */ public static final String EXTRA_API_VERSION = "api_version"; @@ -133,6 +137,9 @@ public class OpenPgpApi { // optional extras: public static final String EXTRA_PASSPHRASE = "passphrase"; + // GET_KEY + public static final String EXTRA_KEY_ID = "key_id"; + /* Service Intent returns */ public static final String RESULT_CODE = "result_code"; diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/OpenPgpService.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/OpenPgpService.java index e1801d9e7..f697faa6e 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/OpenPgpService.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/OpenPgpService.java @@ -36,6 +36,7 @@ import org.sufficientlysecure.keychain.pgp.PgpDecryptVerifyResult; import org.sufficientlysecure.keychain.pgp.PgpSignEncrypt; import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException; import org.sufficientlysecure.keychain.provider.KeychainContract; +import org.sufficientlysecure.keychain.provider.ProviderHelper; import org.sufficientlysecure.keychain.service.PassphraseCacheService; import org.sufficientlysecure.keychain.util.InputData; import org.sufficientlysecure.keychain.util.Log; @@ -103,9 +104,8 @@ public class OpenPgpService extends RemoteService { // return PendingIntent to be executed by client Intent result = new Intent(); - result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED); result.putExtra(OpenPgpApi.RESULT_INTENT, pi); - + result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED); return result; } @@ -114,8 +114,8 @@ public class OpenPgpService extends RemoteService { } Intent result = new Intent(); - result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_SUCCESS); result.putExtra(OpenPgpApi.EXTRA_KEY_IDS, keyIdsArray); + result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_SUCCESS); return result; } @@ -130,9 +130,8 @@ public class OpenPgpService extends RemoteService { // return PendingIntent to be executed by client Intent result = new Intent(); - result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED); result.putExtra(OpenPgpApi.RESULT_INTENT, pi); - + result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED); return result; } @@ -179,9 +178,9 @@ public class OpenPgpService extends RemoteService { return result; } catch (Exception e) { Intent result = new Intent(); - result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR); result.putExtra(OpenPgpApi.RESULT_ERROR, new OpenPgpError(OpenPgpError.GENERIC_ERROR, e.getMessage())); + result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR); return result; } } @@ -208,9 +207,9 @@ public class OpenPgpService extends RemoteService { } } else { Intent result = new Intent(); - result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR); result.putExtra(OpenPgpApi.RESULT_ERROR, new OpenPgpError(OpenPgpError.GENERIC_ERROR, "Missing parameter user_ids or key_ids!")); + result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR); return result; } @@ -267,9 +266,9 @@ public class OpenPgpService extends RemoteService { return result; } catch (Exception e) { Intent result = new Intent(); - result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR); result.putExtra(OpenPgpApi.RESULT_ERROR, new OpenPgpError(OpenPgpError.GENERIC_ERROR, e.getMessage())); + result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR); return result; } } @@ -307,7 +306,7 @@ public class OpenPgpService extends RemoteService { OpenPgpSignatureResult signatureResult = decryptVerifyResult.getSignatureResult(); if (signatureResult != null) { if (signatureResult.getStatus() == OpenPgpSignatureResult.SIGNATURE_UNKNOWN_PUB_KEY) { - // If signature is unknown we return an additional PendingIntent + // If signature is unknown we return an _additional_ PendingIntent // to retrieve the missing key // TODO!!! Intent intent = new Intent(getBaseContext(), RemoteServiceActivity.class); @@ -333,9 +332,44 @@ public class OpenPgpService extends RemoteService { return result; } catch (Exception e) { Intent result = new Intent(); - result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR); result.putExtra(OpenPgpApi.RESULT_ERROR, new OpenPgpError(OpenPgpError.GENERIC_ERROR, e.getMessage())); + result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR); + return result; + } + } + + private Intent getKeyImpl(Intent data) { + try { + long keyId = data.getLongExtra(OpenPgpApi.EXTRA_KEY_ID, 0); + + if (ProviderHelper.getPGPPublicKeyByKeyId(this, keyId) == null) { + Intent result = new Intent(); + + // If keys are not in db we return an additional PendingIntent + // to retrieve the missing key + // TODO!!! + Intent intent = new Intent(getBaseContext(), RemoteServiceActivity.class); + intent.setAction(RemoteServiceActivity.ACTION_ERROR_MESSAGE); + intent.putExtra(RemoteServiceActivity.EXTRA_ERROR_MESSAGE, "todo"); + intent.putExtra(RemoteServiceActivity.EXTRA_DATA, data); + + PendingIntent pi = PendingIntent.getActivity(getBaseContext(), + PRIVATE_REQUEST_CODE_GET_KEYS, intent, 0); + + result.putExtra(OpenPgpApi.RESULT_INTENT, pi); + result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED); + return result; + } else { + Intent result = new Intent(); + result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_SUCCESS); + return result; + } + } catch (Exception e) { + Intent result = new Intent(); + result.putExtra(OpenPgpApi.RESULT_ERROR, + new OpenPgpError(OpenPgpError.GENERIC_ERROR, e.getMessage())); + result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_ERROR); return result; } } @@ -405,9 +439,8 @@ public class OpenPgpService extends RemoteService { return encryptAndSignImpl(data, input, output, appSettings, true); } else if (OpenPgpApi.ACTION_DECRYPT_VERIFY.equals(action)) { return decryptAndVerifyImpl(data, input, output, appSettings); - } else if (OpenPgpApi.ACTION_DOWNLOAD_KEYS.equals(action)) { - // TODO! - return null; + } else if (OpenPgpApi.ACTION_GET_KEY.equals(action)) { + return getKeyImpl(data); } else if (OpenPgpApi.ACTION_GET_KEY_IDS.equals(action)) { return getKeyIdsImpl(data); } else { From 2e2a9bc967399b6adc353b1b34d3c7ed981e68f4 Mon Sep 17 00:00:00 2001 From: Miroojin Bakshi Date: Fri, 7 Mar 2014 21:16:58 +0530 Subject: [PATCH 055/109] Add option for sharing encrypted file. --- .../keychain/ui/EncryptActivity.java | 11 +++++++++++ .../src/main/res/layout/encrypt_activity.xml | 13 +++++++++++++ OpenPGP-Keychain/src/main/res/values/strings.xml | 2 ++ 3 files changed, 26 insertions(+) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java index faac9b157..88a29cee9 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java @@ -108,6 +108,7 @@ public class EncryptActivity extends DrawerActivity { private EditText mFilename = null; private CheckBox mDeleteAfter = null; + private CheckBox mShareAfter = null; private BootstrapButton mBrowse = null; private String mInputFilename = null; @@ -650,6 +651,15 @@ public class EncryptActivity extends DrawerActivity { .newInstance(mInputFilename); deleteFileDialog.show(getSupportFragmentManager(), "deleteDialog"); } + + if (mShareAfter.isChecked()) { + // Share encrypted file + Intent sendFileIntent = new Intent(Intent.ACTION_SEND); + sendFileIntent.setType("*/*"); + sendFileIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse(mOutputFilename)); + startActivity(Intent.createChooser(sendFileIntent, + getString(R.string.title_send_file))); + } break; default: @@ -809,6 +819,7 @@ public class EncryptActivity extends DrawerActivity { } mDeleteAfter = (CheckBox) findViewById(R.id.deleteAfterEncryption); + mShareAfter = (CheckBox) findViewById(R.id.shareAfterEncryption); mAsciiArmor = (CheckBox) findViewById(R.id.asciiArmour); mAsciiArmor.setChecked(Preferences.getPreferences(this).getDefaultAsciiArmour()); diff --git a/OpenPGP-Keychain/src/main/res/layout/encrypt_activity.xml b/OpenPGP-Keychain/src/main/res/layout/encrypt_activity.xml index 27e29eddb..419a8f2ad 100644 --- a/OpenPGP-Keychain/src/main/res/layout/encrypt_activity.xml +++ b/OpenPGP-Keychain/src/main/res/layout/encrypt_activity.xml @@ -285,6 +285,19 @@ android:text="@string/label_delete_after_encryption" /> + + + + + Change Passphrase Set Passphrase "Send Mail…" + "Send File…" Encrypt To File Decrypt To File Import Keys @@ -110,6 +111,7 @@ Recipients Delete After Encryption Delete After Decryption + Share After Encryption Encryption Algorithm Hash Algorithm Public Key From ba61e69a7dcc4e11778931eaf8f3b2c9e269d624 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Fri, 7 Mar 2014 19:50:36 +0100 Subject: [PATCH 056/109] Cleanup code, search with preceeding % --- .../keychain/ui/KeyListPublicFragment.java | 13 +++---- .../keychain/ui/SelectPublicKeyFragment.java | 35 +++++-------------- 2 files changed, 14 insertions(+), 34 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java index f2cb8a265..3418fff85 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java @@ -180,7 +180,7 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer case R.id.menu_key_list_public_multi_select_all: { //Select all int localCount = mStickyList.getCount(); - for(int k = 0; k < localCount; k++) { + for (int k = 0; k < localCount; k++) { mStickyList.setItemChecked(k, true); } break; @@ -243,9 +243,9 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer Uri baseUri = KeyRings.buildPublicKeyRingsUri(); String where = null; String whereArgs[] = null; - if(mCurQuery != null){ + if (mCurQuery != null) { where = KeychainContract.UserIds.USER_ID + " LIKE ?"; - whereArgs = new String[]{mCurQuery+"%"}; + whereArgs = new String[]{"%" + mCurQuery + "%"}; } // Now create and return a CursorLoader that will take care of // creating a Cursor for the data being displayed. @@ -291,7 +291,7 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer viewIntent.setData(KeychainContract.KeyRings.buildPublicKeyRingsUri(Long.toString(id))); startActivity(viewIntent); } - + @TargetApi(11) public void encrypt(ActionMode mode, long[] keyRingRowIds) { // get master key ids from row ids @@ -352,7 +352,6 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer @Override public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) { - // Get the searchview MenuItem searchItem = menu.findItem(R.id.menu_key_list_public_search); mSearchView = (SearchView) MenuItemCompat.getActionView(searchItem); @@ -361,7 +360,6 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer mSearchView.setOnQueryTextListener(this); super.onCreateOptionsMenu(menu, inflater); - } @Override @@ -374,8 +372,7 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer // Called when the action bar search text has changed. Update // the search filter, and restart the loader to do a new query // with this filter. - String newQuery = !TextUtils.isEmpty(s) ? s : null; - mCurQuery = newQuery; + mCurQuery = !TextUtils.isEmpty(s) ? s : null; getLoaderManager().restartLoader(0, null, this); return true; } diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java index a43c84cf4..73335c2f9 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java @@ -72,7 +72,7 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements T @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - mSearchView = (EditText)getActivity().findViewById(R.id.select_public_key_search); + mSearchView = (EditText) getActivity().findViewById(R.id.select_public_key_search); mSearchView.addTextChangedListener(this); mSelectedMasterKeyIds = getArguments().getLongArray(ARG_PRESELECTED_KEY_IDS); } @@ -106,7 +106,7 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements T /** * Selects items based on master key ids in list view - * + * * @param masterKeyIds */ private void preselectMasterKeyIds(long[] masterKeyIds) { @@ -125,7 +125,7 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements T /** * Returns all selected master key ids - * + * * @return */ public long[] getSelectedMasterKeyIds() { @@ -149,7 +149,7 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements T /** * Returns all selected user ids - * + * * @return */ public String[] getSelectedUserIds() { @@ -173,7 +173,7 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements T // These are the rows that we will retrieve. long now = new Date().getTime() / 1000; - String[] projection = new String[] { + String[] projection = new String[]{ KeyRings._ID, KeyRings.MASTER_KEY_ID, UserIds.USER_ID, @@ -190,7 +190,7 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements T + Keys.CAN_ENCRYPT + " = '1' AND valid_keys." + Keys.CREATION + " <= '" + now + "' AND " + "(valid_keys." + Keys.EXPIRY + " IS NULL OR valid_keys." + Keys.EXPIRY + " >= '" + now + "')) AS " - + SelectKeyCursorAdapter.PROJECTION_ROW_VALID, }; + + SelectKeyCursorAdapter.PROJECTION_ROW_VALID,}; String inMasterKeyList = null; if (mSelectedMasterKeyIds != null && mSelectedMasterKeyIds.length > 0) { @@ -204,22 +204,6 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements T inMasterKeyList += ")"; } - // if (searchString != null && searchString.trim().length() > 0) { - // String[] chunks = searchString.trim().split(" +"); - // qb.appendWhere("(EXISTS (SELECT tmp." + UserIds._ID + " FROM " + UserIds.TABLE_NAME - // + " AS tmp WHERE " + "tmp." + UserIds.KEY_ID + " = " + Keys.TABLE_NAME + "." - // + Keys._ID); - // for (int i = 0; i < chunks.length; ++i) { - // qb.appendWhere(" AND tmp." + UserIds.USER_ID + " LIKE "); - // qb.appendWhereEscapeString("%" + chunks[i] + "%"); - // } - // qb.appendWhere("))"); - // - // if (inIdList != null) { - // qb.appendWhere(" OR (" + inIdList + ")"); - // } - // } - String orderBy = UserIds.USER_ID + " ASC"; if (inMasterKeyList != null) { // sort by selected master keys @@ -227,9 +211,9 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements T } String where = null; String whereArgs[] = null; - if(mCurQuery != null){ + if (mCurQuery != null) { where = UserIds.USER_ID + " LIKE ?"; - whereArgs = new String[]{mCurQuery+"%"}; + whereArgs = new String[]{"%" + mCurQuery + "%"}; } // Now create and return a CursorLoader that will take care of @@ -274,8 +258,7 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements T @Override public void afterTextChanged(Editable editable) { - String newQuery = !TextUtils.isEmpty(editable.toString()) ? editable.toString() : null; - mCurQuery = newQuery; + mCurQuery = !TextUtils.isEmpty(editable.toString()) ? editable.toString() : null; getLoaderManager().restartLoader(0, null, this); } } From 357257139113940a7de5a91523b8127da1e59cb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Fri, 7 Mar 2014 20:58:33 +0100 Subject: [PATCH 057/109] Reworking main KeyListPublicFragment to get progress indicator --- .../keychain/ui/KeyListPublicFragment.java | 85 ++++++++-- .../keychain/ui/KeyListSecretFragment.java | 11 +- .../res/layout/key_list_public_fragment.xml | 149 +++++++++++------- 3 files changed, 162 insertions(+), 83 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java index 3418fff85..3ee0202ef 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java @@ -57,6 +57,7 @@ import android.view.MenuItem; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; +import android.view.animation.AnimationUtils; import android.widget.AbsListView.MultiChoiceModeListener; import android.widget.AdapterView; import android.widget.ListView; @@ -73,6 +74,12 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer private KeyListPublicAdapter mAdapter; private StickyListHeadersListView mStickyList; + + // rebuild functionality of ListFragment, http://stackoverflow.com/a/12504097 + boolean mListShown; + View mProgressContainer; + View mListContainer; + private String mCurQuery; private SearchView mSearchView; // empty list layout @@ -85,9 +92,14 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer */ @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.key_list_public_fragment, container, false); - setHasOptionsMenu(true); - mButtonEmptyCreate = (BootstrapButton) view.findViewById(R.id.key_list_empty_button_create); + View root = inflater.inflate(R.layout.key_list_public_fragment, container, false); + + mStickyList = (StickyListHeadersListView) root.findViewById(R.id.key_list_public_list); + mStickyList.setOnItemClickListener(this); + + + // empty view + mButtonEmptyCreate = (BootstrapButton) root.findViewById(R.id.key_list_empty_button_create); mButtonEmptyCreate.setOnClickListener(new OnClickListener() { @Override @@ -99,8 +111,7 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer startActivityForResult(intent, 0); } }); - - mButtonEmptyImport = (BootstrapButton) view.findViewById(R.id.key_list_empty_button_import); + mButtonEmptyImport = (BootstrapButton) root.findViewById(R.id.key_list_empty_button_import); mButtonEmptyImport.setOnClickListener(new OnClickListener() { @Override @@ -111,7 +122,12 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer } }); - return view; + // rebuild functionality of ListFragment, http://stackoverflow.com/a/12504097 + mListContainer = root.findViewById(R.id.key_list_public_list_container); + mProgressContainer = root.findViewById(R.id.key_list_public_progress_container); + mListShown = true; + + return root; } /** @@ -122,9 +138,6 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); - mStickyList = (StickyListHeadersListView) getActivity().findViewById(R.id.list); - - mStickyList.setOnItemClickListener(this); mStickyList.setAreHeadersSticky(true); mStickyList.setDrawingListUnderStickyHeader(false); mStickyList.setFastScrollEnabled(true); @@ -134,7 +147,7 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer } // this view is made visible if no data is available - mStickyList.setEmptyView(getActivity().findViewById(R.id.empty)); + mStickyList.setEmptyView(getActivity().findViewById(R.id.key_list_public_empty)); /* * ActionBarSherlock does not support MultiChoiceModeListener. Thus multi-selection is only @@ -211,9 +224,12 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer }); } + // We have a menu item to show in action bar. + setHasOptionsMenu(true); + // NOTE: Not supported by StickyListHeader, thus no indicator is shown while loading // Start out with a progress indicator. - // setListShown(false); + setListShown(false); // Create an empty adapter we will use to display the loaded data. mAdapter = new KeyListPublicAdapter(getActivity(), null, Id.type.public_key, USER_ID_INDEX); @@ -262,11 +278,11 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer // NOTE: Not supported by StickyListHeader, thus no indicator is shown while loading // The list should now be shown. - // if (isResumed()) { - // setListShown(true); - // } else { - // setListShownNoAnimation(true); - // } + if (isResumed()) { + setListShown(true); + } else { + setListShownNoAnimation(true); + } } @Override @@ -376,4 +392,41 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer getLoaderManager().restartLoader(0, null, this); return true; } + + // rebuild functionality of ListFragment, http://stackoverflow.com/a/12504097 + public void setListShown(boolean shown, boolean animate) { + if (mListShown == shown) { + return; + } + mListShown = shown; + if (shown) { + if (animate) { + mProgressContainer.startAnimation(AnimationUtils.loadAnimation( + getActivity(), android.R.anim.fade_out)); + mListContainer.startAnimation(AnimationUtils.loadAnimation( + getActivity(), android.R.anim.fade_in)); + } + mProgressContainer.setVisibility(View.GONE); + mListContainer.setVisibility(View.VISIBLE); + } else { + if (animate) { + mProgressContainer.startAnimation(AnimationUtils.loadAnimation( + getActivity(), android.R.anim.fade_in)); + mListContainer.startAnimation(AnimationUtils.loadAnimation( + getActivity(), android.R.anim.fade_out)); + } + mProgressContainer.setVisibility(View.VISIBLE); + mListContainer.setVisibility(View.INVISIBLE); + } + } + + // rebuild functionality of ListFragment, http://stackoverflow.com/a/12504097 + public void setListShown(boolean shown) { + setListShown(shown, true); + } + + // rebuild functionality of ListFragment, http://stackoverflow.com/a/12504097 + public void setListShownNoAnimation(boolean shown) { + setListShown(shown, false); + } } diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListSecretFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListSecretFragment.java index eaac6d8b1..9a5477762 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListSecretFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListSecretFragment.java @@ -17,7 +17,6 @@ package org.sufficientlysecure.keychain.ui; -import java.util.ArrayList; import java.util.Set; import org.sufficientlysecure.keychain.Id; @@ -50,12 +49,10 @@ import android.widget.AdapterView; import android.widget.ListView; import android.widget.AbsListView.MultiChoiceModeListener; import android.widget.AdapterView.OnItemClickListener; -import android.widget.Toast; public class KeyListSecretFragment extends ListFragment implements LoaderManager.LoaderCallbacks, OnItemClickListener { - private KeyListSecretActivity mKeyListSecretActivity; private KeyListSecretAdapter mAdapter; /** @@ -66,8 +63,6 @@ public class KeyListSecretFragment extends ListFragment implements public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); - mKeyListSecretActivity = (KeyListSecretActivity) getActivity(); - getListView().setOnItemClickListener(this); // Give some text to display if there is no data. In a real @@ -114,7 +109,7 @@ public class KeyListSecretFragment extends ListFragment implements case R.id.menu_key_list_public_multi_select_all: { //Select all int localCount = getListView().getCount(); - for(int k = 0; k < localCount; k++) { + for (int k = 0; k < localCount; k++) { getListView().setItemChecked(k, true); } break; @@ -153,7 +148,7 @@ public class KeyListSecretFragment extends ListFragment implements setListShown(false); // Create an empty adapter we will use to display the loaded data. - mAdapter = new KeyListSecretAdapter(mKeyListSecretActivity, null, 0); + mAdapter = new KeyListSecretAdapter(getActivity(), null, 0); setListAdapter(mAdapter); // Prepare the loader. Either re-connect with an existing one, @@ -203,7 +198,7 @@ public class KeyListSecretFragment extends ListFragment implements */ @Override public void onItemClick(AdapterView adapterView, View view, int position, long id) { - Intent editIntent = new Intent(mKeyListSecretActivity, EditKeyActivity.class); + Intent editIntent = new Intent(getActivity(), EditKeyActivity.class); editIntent.setData(KeychainContract.KeyRings.buildSecretKeyRingsUri(Long.toString(id))); editIntent.setAction(EditKeyActivity.ACTION_EDIT_KEY); startActivityForResult(editIntent, 0); diff --git a/OpenPGP-Keychain/src/main/res/layout/key_list_public_fragment.xml b/OpenPGP-Keychain/src/main/res/layout/key_list_public_fragment.xml index f3a21e1bf..db82c8771 100644 --- a/OpenPGP-Keychain/src/main/res/layout/key_list_public_fragment.xml +++ b/OpenPGP-Keychain/src/main/res/layout/key_list_public_fragment.xml @@ -3,75 +3,106 @@ xmlns:bootstrapbutton="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" - android:orientation="vertical" > - - + android:orientation="vertical"> + + android:visibility="gone" + android:gravity="center"> + + - - + android:paddingTop="4dip" + android:singleLine="true" /> - - - - - - - + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file From a1be0d302b44e76fcfdb04b2dea20cc4ea6e0e35 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Fri, 7 Mar 2014 21:32:24 +0100 Subject: [PATCH 058/109] move search view from activity to fragment by setting it as a list header, better reusability! Required for service activites --- .../keychain/ui/KeyListPublicFragment.java | 4 +-- .../keychain/ui/SelectPublicKeyFragment.java | 33 ++++++++++--------- .../res/layout/select_public_key_activity.xml | 8 ----- .../select_public_key_fragment_header.xml | 7 ++++ 4 files changed, 26 insertions(+), 26 deletions(-) create mode 100644 OpenPGP-Keychain/src/main/res/layout/select_public_key_fragment_header.xml diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java index 3ee0202ef..f14fadd77 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java @@ -227,7 +227,7 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer // We have a menu item to show in action bar. setHasOptionsMenu(true); - // NOTE: Not supported by StickyListHeader, thus no indicator is shown while loading + // NOTE: Not supported by StickyListHeader, but reimplemented here // Start out with a progress indicator. setListShown(false); @@ -276,7 +276,7 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer mStickyList.setAdapter(mAdapter); - // NOTE: Not supported by StickyListHeader, thus no indicator is shown while loading + // NOTE: Not supported by StickyListHeader, but reimplemented here // The list should now be shown. if (isResumed()) { setListShown(true); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java index 73335c2f9..5e729027d 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java @@ -30,7 +30,6 @@ import org.sufficientlysecure.keychain.provider.KeychainDatabase; import org.sufficientlysecure.keychain.provider.KeychainDatabase.Tables; import org.sufficientlysecure.keychain.ui.adapter.SelectKeyCursorAdapter; -import android.app.Activity; import android.database.Cursor; import android.database.DatabaseUtils; import android.net.Uri; @@ -41,6 +40,7 @@ import android.support.v4.content.Loader; import android.text.Editable; import android.text.TextUtils; import android.text.TextWatcher; +import android.view.View; import android.widget.EditText; import android.widget.ListView; @@ -48,9 +48,7 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements T LoaderManager.LoaderCallbacks { public static final String ARG_PRESELECTED_KEY_IDS = "preselected_key_ids"; - private Activity mActivity; private SelectKeyCursorAdapter mAdapter; - private ListView mListView; private EditText mSearchView; private long mSelectedMasterKeyIds[]; private String mCurQuery; @@ -72,8 +70,6 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements T @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - mSearchView = (EditText) getActivity().findViewById(R.id.select_public_key_search); - mSearchView.addTextChangedListener(this); mSelectedMasterKeyIds = getArguments().getLongArray(ARG_PRESELECTED_KEY_IDS); } @@ -84,15 +80,20 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements T public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); - mActivity = getActivity(); - mListView = getListView(); - - mListView.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); + getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); // Give some text to display if there is no data. In a real // application this would come from a resource. setEmptyText(getString(R.string.list_empty)); - mAdapter = new SelectKeyCursorAdapter(mActivity, null, 0, mListView, Id.type.public_key); + // add header with search field + View headerView = getLayoutInflater(savedInstanceState) + .inflate(R.layout.select_public_key_fragment_header, null); + getListView().addHeaderView(headerView); + + mSearchView = (EditText) getActivity().findViewById(R.id.select_public_key_search); + mSearchView.addTextChangedListener(this); + + mAdapter = new SelectKeyCursorAdapter(getActivity(), null, 0, getListView(), Id.type.public_key); setListAdapter(mAdapter); @@ -111,11 +112,11 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements T */ private void preselectMasterKeyIds(long[] masterKeyIds) { if (masterKeyIds != null) { - for (int i = 0; i < mListView.getCount(); ++i) { + for (int i = 0; i < getListView().getCount(); ++i) { long keyId = mAdapter.getMasterKeyId(i); for (int j = 0; j < masterKeyIds.length; ++j) { if (keyId == masterKeyIds[j]) { - mListView.setItemChecked(i, true); + getListView().setItemChecked(i, true); break; } } @@ -132,8 +133,8 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements T // mListView.getCheckedItemIds() would give the row ids of the KeyRings not the master key // ids! Vector vector = new Vector(); - for (int i = 0; i < mListView.getCount(); ++i) { - if (mListView.isItemChecked(i)) { + for (int i = 0; i < getListView().getCount(); ++i) { + if (getListView().isItemChecked(i)) { vector.add(mAdapter.getMasterKeyId(i)); } } @@ -154,8 +155,8 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements T */ public String[] getSelectedUserIds() { Vector userIds = new Vector(); - for (int i = 0; i < mListView.getCount(); ++i) { - if (mListView.isItemChecked(i)) { + for (int i = 0; i < getListView().getCount(); ++i) { + if (getListView().isItemChecked(i)) { userIds.add((String) mAdapter.getUserId(i)); } } diff --git a/OpenPGP-Keychain/src/main/res/layout/select_public_key_activity.xml b/OpenPGP-Keychain/src/main/res/layout/select_public_key_activity.xml index 5337433c6..a18ce46fc 100644 --- a/OpenPGP-Keychain/src/main/res/layout/select_public_key_activity.xml +++ b/OpenPGP-Keychain/src/main/res/layout/select_public_key_activity.xml @@ -4,16 +4,8 @@ android:layout_height="match_parent" android:layout_centerHorizontal="true" > - - diff --git a/OpenPGP-Keychain/src/main/res/layout/select_public_key_fragment_header.xml b/OpenPGP-Keychain/src/main/res/layout/select_public_key_fragment_header.xml new file mode 100644 index 000000000..e08a63726 --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/layout/select_public_key_fragment_header.xml @@ -0,0 +1,7 @@ + + From dd80ddd6f95d7f659929a49d3bff62492692c4fa Mon Sep 17 00:00:00 2001 From: Nikhil Peter Raj Date: Sat, 8 Mar 2014 02:04:50 +0530 Subject: [PATCH 059/109] Fix for #347 --- .../sufficientlysecure/keychain/ui/KeyListPublicFragment.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java index 3418fff85..edd7df7ef 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java @@ -354,6 +354,9 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) { // Get the searchview MenuItem searchItem = menu.findItem(R.id.menu_key_list_public_search); + MenuItem addContactItem = menu.findItem(R.id.menu_key_list_public_import); + + addContactItem.setVisible(false);//Hide Add Contacts Icon mSearchView = (SearchView) MenuItemCompat.getActionView(searchItem); // Execute this when searching From ca851ba21f6a5738467d04cada74d05950bf69b7 Mon Sep 17 00:00:00 2001 From: uberspot Date: Fri, 7 Mar 2014 21:48:26 +0200 Subject: [PATCH 060/109] remove unused imports and unthrown exceptions --- .../org/sufficientlysecure/keychain/helper/OtherHelper.java | 2 -- .../sufficientlysecure/keychain/pgp/PgpDecryptVerify.java | 3 +-- .../sufficientlysecure/keychain/pgp/PgpImportExport.java | 6 ------ .../keychain/provider/ProviderHelper.java | 2 -- .../keychain/service/KeychainIntentServiceHandler.java | 1 - .../org/sufficientlysecure/keychain/ui/HelpActivity.java | 5 ----- .../sufficientlysecure/keychain/ui/PreferencesActivity.java | 2 -- .../keychain/ui/adapter/ImportKeysListLoader.java | 3 +-- .../keychain/ui/adapter/KeyListPublicAdapter.java | 1 - .../keychain/ui/dialog/FileDialogFragment.java | 1 - 10 files changed, 2 insertions(+), 24 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/OtherHelper.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/OtherHelper.java index 639ab17b8..34d90a17f 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/OtherHelper.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/OtherHelper.java @@ -17,8 +17,6 @@ package org.sufficientlysecure.keychain.helper; -import java.util.Calendar; -import java.util.GregorianCalendar; import java.util.Iterator; import java.util.Set; diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java index ccd6ff8df..252be1036 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpDecryptVerify.java @@ -743,10 +743,9 @@ public class PgpDecryptVerify { * @param sig * @param line * @throws SignatureException - * @throws IOException */ private static void processLine(PGPSignature sig, byte[] line) - throws SignatureException, IOException { + throws SignatureException { int length = getLengthWithoutWhiteSpace(line); if (length > 0) { sig.update(line, 0, length); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java index 2495a212c..9d9cd4d11 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java @@ -17,11 +17,9 @@ package org.sufficientlysecure.keychain.pgp; -import java.io.BufferedInputStream; import java.io.ByteArrayOutputStream; import java.io.FileNotFoundException; import java.io.IOException; -import java.io.InputStream; import java.io.OutputStream; import java.util.ArrayList; import java.util.List; @@ -29,12 +27,10 @@ import java.util.List; import org.spongycastle.bcpg.ArmoredOutputStream; 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.PGPSecretKey; import org.spongycastle.openpgp.PGPSecretKeyRing; -import org.spongycastle.openpgp.PGPUtil; import org.spongycastle.openpgp.operator.jcajce.JcaKeyFingerprintCalculator; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Id; @@ -44,11 +40,9 @@ import org.sufficientlysecure.keychain.provider.ProviderHelper; import org.sufficientlysecure.keychain.service.KeychainIntentService; import org.sufficientlysecure.keychain.ui.adapter.ImportKeysListEntry; import org.sufficientlysecure.keychain.util.HkpKeyServer; -import org.sufficientlysecure.keychain.util.InputData; import org.sufficientlysecure.keychain.util.IterableIterator; import org.sufficientlysecure.keychain.util.KeyServer.AddKeyException; import org.sufficientlysecure.keychain.util.Log; -import org.sufficientlysecure.keychain.util.PositionAwareInputStream; import org.sufficientlysecure.keychain.util.ProgressDialogUpdater; import android.content.Context; diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java index 8b642967f..68d9f801b 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java @@ -23,8 +23,6 @@ import java.util.ArrayList; import java.util.Date; import org.spongycastle.bcpg.ArmoredOutputStream; -import org.spongycastle.bcpg.UserAttributePacket; -import org.spongycastle.bcpg.UserAttributeSubpacket; import org.spongycastle.openpgp.PGPKeyRing; import org.spongycastle.openpgp.PGPPublicKey; import org.spongycastle.openpgp.PGPPublicKeyRing; diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentServiceHandler.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentServiceHandler.java index 6eba9cc83..65c756f9a 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentServiceHandler.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentServiceHandler.java @@ -21,7 +21,6 @@ import org.sufficientlysecure.keychain.ui.dialog.ProgressDialogFragment; import org.sufficientlysecure.keychain.R; import android.app.Activity; -import android.content.DialogInterface; import android.content.DialogInterface.OnCancelListener; import android.os.Bundle; import android.os.Handler; diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpActivity.java index 9ccd7e088..cb923b052 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpActivity.java @@ -22,16 +22,11 @@ import java.util.ArrayList; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.ui.adapter.TabsAdapter; -import android.content.Context; import android.content.Intent; import android.os.Bundle; -import android.support.v4.app.Fragment; -import android.support.v4.app.FragmentStatePagerAdapter; -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.widget.TextView; public class HelpActivity extends ActionBarActivity { public static final String EXTRA_SELECTED_TAB = "selectedTab"; diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/PreferencesActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/PreferencesActivity.java index af20b499b..2e8f25890 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/PreferencesActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/PreferencesActivity.java @@ -25,7 +25,6 @@ import org.sufficientlysecure.keychain.helper.Preferences; import org.sufficientlysecure.keychain.ui.widget.IntegerListPreference; import android.annotation.SuppressLint; -import android.content.Context; import android.content.Intent; import android.os.Build; import android.os.Bundle; @@ -57,7 +56,6 @@ public class PreferencesActivity extends PreferenceActivity { // actionBar.setDisplayHomeAsUpEnabled(false); // actionBar.setHomeButtonEnabled(false); - //addPreferencesFromResource(R.xml.preferences); String action = getIntent().getAction(); if (action != null && action.equals(ACTION_PREFS_GEN)) { diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java index 76649b27b..357f5a3f1 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListLoader.java @@ -20,7 +20,6 @@ package org.sufficientlysecure.keychain.ui.adapter; import java.io.BufferedInputStream; import java.io.InputStream; import java.util.ArrayList; -import java.util.List; import org.spongycastle.openpgp.PGPKeyRing; import org.spongycastle.openpgp.PGPObjectFactory; @@ -88,7 +87,7 @@ public class ImportKeysListLoader extends AsyncTaskLoader Date: Fri, 7 Mar 2014 22:12:58 +0200 Subject: [PATCH 061/109] move hardcode strings to strings.xml --- OpenPGP-Keychain/src/main/res/layout/decrypt_activity.xml | 2 +- OpenPGP-Keychain/src/main/res/layout/edit_key_key_item.xml | 2 +- OpenPGP-Keychain/src/main/res/layout/encrypt_activity.xml | 4 ++-- .../src/main/res/layout/import_keys_list_entry.xml | 2 +- OpenPGP-Keychain/src/main/res/layout/key_list_public_item.xml | 2 +- OpenPGP-Keychain/src/main/res/layout/key_list_secret_item.xml | 2 +- OpenPGP-Keychain/src/main/res/layout/select_key_item.xml | 2 +- OpenPGP-Keychain/src/main/res/layout/view_key_keys_item.xml | 2 +- .../src/main/res/layout/view_key_userids_item.xml | 2 +- OpenPGP-Keychain/src/main/res/values/strings.xml | 3 +++ 10 files changed, 13 insertions(+), 10 deletions(-) diff --git a/OpenPGP-Keychain/src/main/res/layout/decrypt_activity.xml b/OpenPGP-Keychain/src/main/res/layout/decrypt_activity.xml index e6c81c3fc..c56ba130e 100644 --- a/OpenPGP-Keychain/src/main/res/layout/decrypt_activity.xml +++ b/OpenPGP-Keychain/src/main/res/layout/decrypt_activity.xml @@ -71,7 +71,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="left" - android:text="Main User Id" + android:text="@string/label_main_user_id" android:textAppearance="?android:attr/textAppearanceMedium" android:layout_alignTop="@+id/linearLayout" android:layout_toRightOf="@+id/relativeLayout" /> diff --git a/OpenPGP-Keychain/src/main/res/layout/edit_key_key_item.xml b/OpenPGP-Keychain/src/main/res/layout/edit_key_key_item.xml index 4bf4aa38a..45b8d6511 100644 --- a/OpenPGP-Keychain/src/main/res/layout/edit_key_key_item.xml +++ b/OpenPGP-Keychain/src/main/res/layout/edit_key_key_item.xml @@ -50,7 +50,7 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:paddingRight="5dip" - android:text="Name" /> + android:text="@string/label_name" /> diff --git a/OpenPGP-Keychain/src/main/res/layout/encrypt_activity.xml b/OpenPGP-Keychain/src/main/res/layout/encrypt_activity.xml index 419a8f2ad..e716b033a 100644 --- a/OpenPGP-Keychain/src/main/res/layout/encrypt_activity.xml +++ b/OpenPGP-Keychain/src/main/res/layout/encrypt_activity.xml @@ -82,7 +82,7 @@ android:layout_gravity="right" android:ellipsize="end" android:singleLine="true" - android:text="Sign User Id" + android:text="@string/label_sign_user_id" android:textAppearance="?android:attr/textAppearanceMedium" /> diff --git a/OpenPGP-Keychain/src/main/res/layout/import_keys_list_entry.xml b/OpenPGP-Keychain/src/main/res/layout/import_keys_list_entry.xml index 37d1c5702..3cc0bc6dc 100644 --- a/OpenPGP-Keychain/src/main/res/layout/import_keys_list_entry.xml +++ b/OpenPGP-Keychain/src/main/res/layout/import_keys_list_entry.xml @@ -48,7 +48,7 @@ android:id="@+id/mainUserId" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="Main User ID" + android:text="@string/label_main_user_id" android:textAppearance="?android:attr/textAppearanceMedium" /> diff --git a/OpenPGP-Keychain/src/main/res/layout/key_list_secret_item.xml b/OpenPGP-Keychain/src/main/res/layout/key_list_secret_item.xml index 1ed86f730..7d5492265 100644 --- a/OpenPGP-Keychain/src/main/res/layout/key_list_secret_item.xml +++ b/OpenPGP-Keychain/src/main/res/layout/key_list_secret_item.xml @@ -13,7 +13,7 @@ android:id="@+id/mainUserId" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="Main User ID" + android:text="@string/label_main_user_id" android:textAppearance="?android:attr/textAppearanceMedium" android:layout_alignParentTop="true" android:layout_alignParentLeft="true" diff --git a/OpenPGP-Keychain/src/main/res/layout/select_key_item.xml b/OpenPGP-Keychain/src/main/res/layout/select_key_item.xml index bbfe17c44..08c161ec6 100644 --- a/OpenPGP-Keychain/src/main/res/layout/select_key_item.xml +++ b/OpenPGP-Keychain/src/main/res/layout/select_key_item.xml @@ -25,7 +25,7 @@ android:id="@+id/mainUserId" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="Main User ID" + android:text="@string/label_main_user_id" android:textAppearance="?android:attr/textAppearanceMedium" /> diff --git a/OpenPGP-Keychain/src/main/res/layout/view_key_userids_item.xml b/OpenPGP-Keychain/src/main/res/layout/view_key_userids_item.xml index 508d080a6..22f0cdc5f 100644 --- a/OpenPGP-Keychain/src/main/res/layout/view_key_userids_item.xml +++ b/OpenPGP-Keychain/src/main/res/layout/view_key_userids_item.xml @@ -10,7 +10,7 @@ android:id="@+id/userId" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:text="User ID" + android:text="@string/user_id" android:textAppearance="?android:attr/textAppearanceSmall" /> \ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/res/values/strings.xml b/OpenPGP-Keychain/src/main/res/values/strings.xml index d5123b79c..99fc7c8a7 100644 --- a/OpenPGP-Keychain/src/main/res/values/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values/strings.xml @@ -130,6 +130,8 @@ Name Comment Email + Sign User Id + Sign email Upload key to selected keyserver after certification Fingerprint Select @@ -148,6 +150,7 @@ can sign expired revoked + User ID %d keyserver From 477d06c43af39090ca03a2740f7183d70e802141 Mon Sep 17 00:00:00 2001 From: uberspot Date: Fri, 7 Mar 2014 22:35:09 +0200 Subject: [PATCH 062/109] removed useless semicolons, fixed some parameters in documenation, simplified some conditionals --- .../keychain/compatibility/ClipboardReflection.java | 1 - .../sufficientlysecure/keychain/helper/ExportHelper.java | 2 +- .../keychain/pgp/PgpConversionHelper.java | 6 +++--- .../keychain/provider/KeychainProvider.java | 5 +++-- .../keychain/ui/CertifyKeyActivity.java | 4 ++-- .../sufficientlysecure/keychain/ui/DecryptActivity.java | 2 -- .../sufficientlysecure/keychain/ui/EditKeyActivity.java | 4 ++-- .../sufficientlysecure/keychain/ui/EncryptActivity.java | 2 -- .../org/sufficientlysecure/keychain/ui/HelpActivity.java | 8 ++++---- .../sufficientlysecure/keychain/ui/UploadKeyActivity.java | 2 +- .../sufficientlysecure/keychain/ui/ViewKeyActivity.java | 4 ++-- .../keychain/ui/adapter/ImportKeysListEntry.java | 4 +--- .../keychain/ui/dialog/DeleteFileDialogFragment.java | 2 +- .../keychain/ui/dialog/PassphraseDialogFragment.java | 4 ++-- .../keychain/ui/widget/SectionView.java | 2 +- 15 files changed, 23 insertions(+), 29 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/compatibility/ClipboardReflection.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/compatibility/ClipboardReflection.java index 032af4c71..3164de7d1 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/compatibility/ClipboardReflection.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/compatibility/ClipboardReflection.java @@ -59,7 +59,6 @@ public class ClipboardReflection { * Wrapper around ClipboardManager based on Android version using Reflection API * * @param context - * @param text */ public static CharSequence getClipboardText(Context context) { Object clipboard = context.getSystemService(Context.CLIPBOARD_SERVICE); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ExportHelper.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ExportHelper.java index 21676a2a7..8f2c6c83d 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ExportHelper.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ExportHelper.java @@ -160,7 +160,7 @@ public class ExportHelper { Toast.makeText(activity, toastMessage, Toast.LENGTH_SHORT).show(); } - }; + } }; // Create a new Messenger for the communication back diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpConversionHelper.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpConversionHelper.java index 20d446824..a30e0718f 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpConversionHelper.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpConversionHelper.java @@ -76,7 +76,7 @@ public class PgpConversionHelper { * * Singles keys are encoded as keyRings with one single key in it by Bouncy Castle * - * @param keysBytes + * @param keyBytes * @return */ public static PGPSecretKey BytesToPGPSecretKey(byte[] keyBytes) { @@ -125,7 +125,7 @@ public class PgpConversionHelper { /** * Convert from PGPSecretKey to byte[] * - * @param keysBytes + * @param key * @return */ public static byte[] PGPSecretKeyToBytes(PGPSecretKey key) { @@ -141,7 +141,7 @@ public class PgpConversionHelper { /** * Convert from PGPSecretKeyRing to byte[] * - * @param keysBytes + * @param keyRing * @return */ public static byte[] PGPSecretKeyRingToBytes(PGPSecretKeyRing keyRing) { diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider/KeychainProvider.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider/KeychainProvider.java index 781f36758..3b60ffc87 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider/KeychainProvider.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider/KeychainProvider.java @@ -304,7 +304,7 @@ public class KeychainProvider extends ContentProvider { /** * Returns type of the query (secret/public) * - * @param uri + * @param match * @return */ private int getKeyType(int match) { @@ -862,7 +862,8 @@ public class KeychainProvider extends ContentProvider { * Build default selection statement for KeyRings. If no extra selection is specified only build * where clause with rowId * - * @param uri + * @param defaultSelection + * @param keyType * @param selection * @return */ diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyKeyActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyKeyActivity.java index aab6b81d9..9a56d768e 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyKeyActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyKeyActivity.java @@ -249,7 +249,7 @@ public class CertifyKeyActivity extends ActionBarActivity implements finish(); } } - }; + } }; // Create a new Messenger for the communication back @@ -295,7 +295,7 @@ public class CertifyKeyActivity extends ActionBarActivity implements setResult(RESULT_OK); finish(); } - }; + } }; // Create a new Messenger for the communication back diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java index 42288ca37..c111ed33b 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java @@ -744,8 +744,6 @@ public class DecryptActivity extends DrawerActivity { } } } - - ; }; // Create a new Messenger for the communication back diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java index 647ab2728..898b0e67a 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java @@ -224,7 +224,7 @@ public class EditKeyActivity extends ActionBarActivity { buildLayout(); } - }; + } }; // Create a new Messenger for the communication back @@ -561,7 +561,7 @@ public class EditKeyActivity extends ActionBarActivity { setResult(RESULT_OK, data); finish(); } - }; + } }; // Create a new Messenger for the communication back diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java index 88a29cee9..b486fc151 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java @@ -669,8 +669,6 @@ public class EncryptActivity extends DrawerActivity { } } } - - ; }; // Create a new Messenger for the communication back diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpActivity.java index cb923b052..ac8250bef 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/HelpActivity.java @@ -59,19 +59,19 @@ public class HelpActivity extends ActionBarActivity { Bundle startBundle = new Bundle(); startBundle.putInt(HelpHtmlFragment.ARG_HTML_FILE, R.raw.help_start); mTabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.help_tab_start)), - HelpHtmlFragment.class, startBundle, (selectedTab == 0 ? true : false)); + HelpHtmlFragment.class, startBundle, (selectedTab == 0) ); Bundle nfcBundle = new Bundle(); nfcBundle.putInt(HelpHtmlFragment.ARG_HTML_FILE, R.raw.help_nfc_beam); mTabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.help_tab_nfc_beam)), - HelpHtmlFragment.class, nfcBundle, (selectedTab == 1 ? true : false)); + HelpHtmlFragment.class, nfcBundle, (selectedTab == 1) ); Bundle changelogBundle = new Bundle(); changelogBundle.putInt(HelpHtmlFragment.ARG_HTML_FILE, R.raw.help_changelog); mTabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.help_tab_changelog)), - HelpHtmlFragment.class, changelogBundle, (selectedTab == 2 ? true : false)); + HelpHtmlFragment.class, changelogBundle, (selectedTab == 2) ); mTabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.help_tab_about)), - HelpAboutFragment.class, null, (selectedTab == 3 ? true : false)); + HelpAboutFragment.class, null, (selectedTab == 3) ); } } \ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/UploadKeyActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/UploadKeyActivity.java index 550d3047d..574d837d2 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/UploadKeyActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/UploadKeyActivity.java @@ -113,7 +113,7 @@ public class UploadKeyActivity extends ActionBarActivity { Toast.LENGTH_SHORT).show(); finish(); } - }; + } }; // Create a new Messenger for the communication back diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java index 0a452bc8a..2db5fc27f 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java @@ -88,12 +88,12 @@ public class ViewKeyActivity extends ActionBarActivity { Bundle mainBundle = new Bundle(); mainBundle.putParcelable(ViewKeyMainFragment.ARG_DATA_URI, mDataUri); mTabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.key_view_tab_main)), - ViewKeyMainFragment.class, mainBundle, (selectedTab == 0 ? true : false)); + ViewKeyMainFragment.class, mainBundle, (selectedTab == 0)); Bundle certBundle = new Bundle(); certBundle.putParcelable(ViewKeyCertsFragment.ARG_DATA_URI, mDataUri); mTabsAdapter.addTab(actionBar.newTab().setText(getString(R.string.key_view_tab_certs)), - ViewKeyCertsFragment.class, certBundle, (selectedTab == 1 ? true : false)); + ViewKeyCertsFragment.class, certBundle, (selectedTab == 1)); } @Override diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListEntry.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListEntry.java index 4a7a9c93a..01b6deeaa 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListEntry.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListEntry.java @@ -152,9 +152,7 @@ public class ImportKeysListEntry implements Serializable, Parcelable { // selected is default this.selected = true; - if (pgpKeyRing instanceof PGPSecretKeyRing) { - secretKey = true; - } else { + if ( !(pgpKeyRing instanceof PGPSecretKeyRing) ) { secretKey = false; } diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteFileDialogFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteFileDialogFragment.java index cd8bc79a9..c4e305984 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteFileDialogFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteFileDialogFragment.java @@ -95,7 +95,7 @@ public class DeleteFileDialogFragment extends DialogFragment { Toast.makeText(activity, R.string.file_delete_successful, Toast.LENGTH_SHORT).show(); } - }; + } }; // Create a new Messenger for the communication back diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/PassphraseDialogFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/PassphraseDialogFragment.java index c00232fd1..afa05cc91 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/PassphraseDialogFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/PassphraseDialogFragment.java @@ -158,7 +158,7 @@ public class PassphraseDialogFragment extends DialogFragment implements OnEditor PGPSecretKey clickSecretKey = secretKey; if (clickSecretKey != null) { - while (keyOK == true) { + while (keyOK) { if (clickSecretKey != null) { // check again for loop try { PBESecretKeyDecryptor keyDecryptor = new JcePBESecretKeyDecryptorBuilder() @@ -207,7 +207,7 @@ public class PassphraseDialogFragment extends DialogFragment implements OnEditor // cache the new passphrase Log.d(Constants.TAG, "Everything okay! Caching entered passphrase"); PassphraseCacheService.addCachedPassphrase(activity, keyId, passphrase); - if (keyOK == false && clickSecretKey.getKeyID() != keyId) { + if ( !keyOK && clickSecretKey.getKeyID() != keyId) { PassphraseCacheService.addCachedPassphrase(activity, clickSecretKey.getKeyID(), passphrase); } diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java index 47d6cd311..99622106f 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java @@ -261,7 +261,7 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor .getByteArray(KeychainIntentService.RESULT_NEW_KEY)); addGeneratedKeyToView(newKey); } - }; + } }; // Create a new Messenger for the communication back From def9e5a492b04e42b8ebeb9c4189ccb655c8b1a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Fri, 7 Mar 2014 22:37:38 +0100 Subject: [PATCH 063/109] Move search view into onCreateView, fixes #365 --- .../keychain/ui/SelectPublicKeyFragment.java | 97 +++++++++++++++++-- .../select_public_key_fragment_header.xml | 7 -- 2 files changed, 91 insertions(+), 13 deletions(-) delete mode 100644 OpenPGP-Keychain/src/main/res/layout/select_public_key_fragment_header.xml diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java index 5e729027d..6e338979a 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java @@ -30,6 +30,7 @@ import org.sufficientlysecure.keychain.provider.KeychainDatabase; import org.sufficientlysecure.keychain.provider.KeychainDatabase.Tables; import org.sufficientlysecure.keychain.ui.adapter.SelectKeyCursorAdapter; +import android.content.Context; import android.database.Cursor; import android.database.DatabaseUtils; import android.net.Uri; @@ -40,9 +41,16 @@ import android.support.v4.content.Loader; import android.text.Editable; import android.text.TextUtils; import android.text.TextWatcher; +import android.view.Gravity; +import android.view.LayoutInflater; import android.view.View; +import android.view.ViewGroup; import android.widget.EditText; +import android.widget.FrameLayout; +import android.widget.LinearLayout; import android.widget.ListView; +import android.widget.ProgressBar; +import android.widget.TextView; public class SelectPublicKeyFragment extends ListFragmentWorkaround implements TextWatcher, LoaderManager.LoaderCallbacks { @@ -53,6 +61,13 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements T private long mSelectedMasterKeyIds[]; private String mCurQuery; + // copied from ListFragment + static final int INTERNAL_EMPTY_ID = 0x00ff0001; + static final int INTERNAL_PROGRESS_CONTAINER_ID = 0x00ff0002; + static final int INTERNAL_LIST_CONTAINER_ID = 0x00ff0003; + // added for search view + static final int SEARCH_ID = 0x00ff0004; + /** * Creates new instance of this fragment */ @@ -73,6 +88,81 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements T mSelectedMasterKeyIds = getArguments().getLongArray(ARG_PRESELECTED_KEY_IDS); } + /** + * Copied from ListFragment and added EditText for search on top of list. + * We do not use a custom layout here, because this breaks the progress bar functionality + * of ListFragment. + * + * @param inflater + * @param container + * @param savedInstanceState + * @return + */ + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + final Context context = getActivity(); + + FrameLayout root = new FrameLayout(context); + + // ------------------------------------------------------------------ + + LinearLayout pframe = new LinearLayout(context); + pframe.setId(INTERNAL_PROGRESS_CONTAINER_ID); + pframe.setOrientation(LinearLayout.VERTICAL); + pframe.setVisibility(View.GONE); + pframe.setGravity(Gravity.CENTER); + + ProgressBar progress = new ProgressBar(context, null, + android.R.attr.progressBarStyleLarge); + pframe.addView(progress, new FrameLayout.LayoutParams( + ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)); + + root.addView(pframe, new FrameLayout.LayoutParams( + ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); + + // ------------------------------------------------------------------ + + FrameLayout lframe = new FrameLayout(context); + lframe.setId(INTERNAL_LIST_CONTAINER_ID); + + TextView tv = new TextView(getActivity()); + tv.setId(INTERNAL_EMPTY_ID); + tv.setGravity(Gravity.CENTER); + lframe.addView(tv, new FrameLayout.LayoutParams( + ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); + + // Added for search view: linearLayout, mSearchView + LinearLayout linearLayout = new LinearLayout(context); + linearLayout.setOrientation(LinearLayout.VERTICAL); + + mSearchView = new EditText(context); + mSearchView.setId(SEARCH_ID); + mSearchView.setHint(R.string.menu_search); + mSearchView.setCompoundDrawablesWithIntrinsicBounds(getResources().getDrawable(R.drawable.ic_action_search), null, null, null); + + linearLayout.addView(mSearchView, new FrameLayout.LayoutParams( + ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); + + ListView lv = new ListView(getActivity()); + lv.setId(android.R.id.list); + lv.setDrawSelectorOnTop(false); + linearLayout.addView(lv, new FrameLayout.LayoutParams( + ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); + + lframe.addView(linearLayout, new FrameLayout.LayoutParams( + ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); + + root.addView(lframe, new FrameLayout.LayoutParams( + ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); + + // ------------------------------------------------------------------ + + root.setLayoutParams(new FrameLayout.LayoutParams( + ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.FILL_PARENT)); + + return root; + } + /** * Define Adapter and Loader on create of Activity */ @@ -81,16 +171,11 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements T super.onActivityCreated(savedInstanceState); getListView().setChoiceMode(ListView.CHOICE_MODE_MULTIPLE); + // Give some text to display if there is no data. In a real // application this would come from a resource. setEmptyText(getString(R.string.list_empty)); - // add header with search field - View headerView = getLayoutInflater(savedInstanceState) - .inflate(R.layout.select_public_key_fragment_header, null); - getListView().addHeaderView(headerView); - - mSearchView = (EditText) getActivity().findViewById(R.id.select_public_key_search); mSearchView.addTextChangedListener(this); mAdapter = new SelectKeyCursorAdapter(getActivity(), null, 0, getListView(), Id.type.public_key); diff --git a/OpenPGP-Keychain/src/main/res/layout/select_public_key_fragment_header.xml b/OpenPGP-Keychain/src/main/res/layout/select_public_key_fragment_header.xml deleted file mode 100644 index e08a63726..000000000 --- a/OpenPGP-Keychain/src/main/res/layout/select_public_key_fragment_header.xml +++ /dev/null @@ -1,7 +0,0 @@ - - From 2737aedca7e72f1f18d7b0f5418edbf52ab7fcaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Fri, 7 Mar 2014 22:48:20 +0100 Subject: [PATCH 064/109] Revert "Fix for #347" This reverts commit dd80ddd6f95d7f659929a49d3bff62492692c4fa. --- .../sufficientlysecure/keychain/ui/KeyListPublicFragment.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java index 1938883a1..f14fadd77 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java @@ -370,9 +370,6 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer public void onCreateOptionsMenu(final Menu menu, final MenuInflater inflater) { // Get the searchview MenuItem searchItem = menu.findItem(R.id.menu_key_list_public_search); - MenuItem addContactItem = menu.findItem(R.id.menu_key_list_public_import); - - addContactItem.setVisible(false);//Hide Add Contacts Icon mSearchView = (SearchView) MenuItemCompat.getActionView(searchItem); // Execute this when searching From 3fbda4245cf34d2f8e150e6a26ad4048cdb6b204 Mon Sep 17 00:00:00 2001 From: grait Date: Sat, 8 Mar 2014 03:24:16 +0530 Subject: [PATCH 065/109] progress is shown when creating the default key based on number of keys created so far --- .../keychain/service/KeychainIntentService.java | 7 +++++++ .../sufficientlysecure/keychain/ui/EditKeyActivity.java | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java index 313655766..be9d126b3 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java @@ -596,13 +596,20 @@ public class KeychainIntentService extends IntentService implements ProgressDial String passphrase = data.getString(GENERATE_KEY_SYMMETRIC_PASSPHRASE); /* Operation */ + int keysTotal = 2; + int keysCreated =0; + this.setProgress(keysCreated, keysTotal); PgpKeyOperation keyOperations = new PgpKeyOperation(this, this); PGPSecretKey masterKey = keyOperations.createKey(Id.choice.algorithm.rsa, 4096, passphrase, true); + keysCreated++; + setProgress(keysCreated, keysTotal); PGPSecretKey subKey = keyOperations.createKey(Id.choice.algorithm.rsa, 4096, passphrase, false); + keysCreated++; + setProgress(keysCreated, keysTotal ); // TODO: default to one master for cert, one sub for encrypt and one sub // for sign diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java index 898b0e67a..2507a77b1 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java @@ -187,7 +187,7 @@ public class EditKeyActivity extends ActionBarActivity { // Message is received after generating is done in ApgService KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler( - this, R.string.progress_generating, ProgressDialog.STYLE_SPINNER, true, + this, R.string.progress_generating, ProgressDialog.STYLE_HORIZONTAL, true, new DialogInterface.OnCancelListener() { @Override From 0e33fd23924471caef81f12d0828e17da32582d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Fri, 7 Mar 2014 23:05:03 +0100 Subject: [PATCH 066/109] Split api libs into OpenKeychain specific and OpenPGP Provider lib --- OpenPGP-Keychain-API/example-app/build.gradle | 3 +- .../.gitignore | 0 .../AndroidManifest.xml | 0 .../LICENSE | 0 .../build.gradle | 0 .../build.xml | 0 .../proguard-project.txt | 0 .../project.properties | 0 .../keychain/api/OpenKeychainIntents.java | 0 .../libraries/openpgp-api-library/.gitignore | 29 +++ .../openpgp-api-library/AndroidManifest.xml | 13 ++ .../libraries/openpgp-api-library/LICENSE | 202 ++++++++++++++++++ .../openpgp-api-library}/build.gradle | 2 +- .../libraries/openpgp-api-library/build.xml | 92 ++++++++ .../openpgp-api-library/proguard-project.txt | 20 ++ .../openpgp-api-library/project.properties | 15 ++ .../ic_action_cancel_launchersize.png | Bin .../ic_action_cancel_launchersize_light.png | Bin .../ic_action_cancel_launchersize.png | Bin .../ic_action_cancel_launchersize_light.png | Bin .../ic_action_cancel_launchersize.png | Bin .../ic_action_cancel_launchersize_light.png | Bin .../ic_action_cancel_launchersize.png | Bin .../ic_action_cancel_launchersize_light.png | Bin .../res/values/strings.xml | 0 .../openintents/openpgp/IOpenPgpService.aidl | 0 .../org/openintents/openpgp/OpenPgpError.java | 0 .../openpgp/OpenPgpSignatureResult.java | 0 .../openintents/openpgp/util/OpenPgpApi.java | 0 .../openpgp/util/OpenPgpListPreference.java | 2 +- .../util/OpenPgpServiceConnection.java | 0 .../openpgp/util/OpenPgpUtils.java | 0 .../util/ParcelFileDescriptorUtil.java | 0 OpenPGP-Keychain-API/settings.gradle | 3 +- OpenPGP-Keychain/build.gradle | 3 +- settings.gradle | 3 +- 36 files changed, 381 insertions(+), 6 deletions(-) rename OpenPGP-Keychain-API/libraries/{keychain-api-library => openkeychain-api-library}/.gitignore (100%) rename OpenPGP-Keychain-API/libraries/{keychain-api-library => openkeychain-api-library}/AndroidManifest.xml (100%) rename OpenPGP-Keychain-API/libraries/{keychain-api-library => openkeychain-api-library}/LICENSE (100%) rename OpenPGP-Keychain-API/libraries/{keychain-api-library => openkeychain-api-library}/build.gradle (100%) rename OpenPGP-Keychain-API/libraries/{keychain-api-library => openkeychain-api-library}/build.xml (100%) rename OpenPGP-Keychain-API/libraries/{keychain-api-library => openkeychain-api-library}/proguard-project.txt (100%) rename OpenPGP-Keychain-API/libraries/{keychain-api-library => openkeychain-api-library}/project.properties (100%) rename OpenPGP-Keychain-API/libraries/{keychain-api-library => openkeychain-api-library}/src/org/sufficientlysecure/keychain/api/OpenKeychainIntents.java (100%) create mode 100644 OpenPGP-Keychain-API/libraries/openpgp-api-library/.gitignore create mode 100644 OpenPGP-Keychain-API/libraries/openpgp-api-library/AndroidManifest.xml create mode 100644 OpenPGP-Keychain-API/libraries/openpgp-api-library/LICENSE rename {libraries/keychain-api-library => OpenPGP-Keychain-API/libraries/openpgp-api-library}/build.gradle (93%) create mode 100644 OpenPGP-Keychain-API/libraries/openpgp-api-library/build.xml create mode 100644 OpenPGP-Keychain-API/libraries/openpgp-api-library/proguard-project.txt create mode 100644 OpenPGP-Keychain-API/libraries/openpgp-api-library/project.properties rename OpenPGP-Keychain-API/libraries/{keychain-api-library => openpgp-api-library}/res/drawable-hdpi/ic_action_cancel_launchersize.png (100%) rename OpenPGP-Keychain-API/libraries/{keychain-api-library => openpgp-api-library}/res/drawable-hdpi/ic_action_cancel_launchersize_light.png (100%) rename OpenPGP-Keychain-API/libraries/{keychain-api-library => openpgp-api-library}/res/drawable-mdpi/ic_action_cancel_launchersize.png (100%) rename OpenPGP-Keychain-API/libraries/{keychain-api-library => openpgp-api-library}/res/drawable-mdpi/ic_action_cancel_launchersize_light.png (100%) rename OpenPGP-Keychain-API/libraries/{keychain-api-library => openpgp-api-library}/res/drawable-xhdpi/ic_action_cancel_launchersize.png (100%) rename OpenPGP-Keychain-API/libraries/{keychain-api-library => openpgp-api-library}/res/drawable-xhdpi/ic_action_cancel_launchersize_light.png (100%) rename OpenPGP-Keychain-API/libraries/{keychain-api-library => openpgp-api-library}/res/drawable-xxhdpi/ic_action_cancel_launchersize.png (100%) rename OpenPGP-Keychain-API/libraries/{keychain-api-library => openpgp-api-library}/res/drawable-xxhdpi/ic_action_cancel_launchersize_light.png (100%) rename OpenPGP-Keychain-API/libraries/{keychain-api-library => openpgp-api-library}/res/values/strings.xml (100%) rename OpenPGP-Keychain-API/libraries/{keychain-api-library => openpgp-api-library}/src/org/openintents/openpgp/IOpenPgpService.aidl (100%) rename OpenPGP-Keychain-API/libraries/{keychain-api-library => openpgp-api-library}/src/org/openintents/openpgp/OpenPgpError.java (100%) rename OpenPGP-Keychain-API/libraries/{keychain-api-library => openpgp-api-library}/src/org/openintents/openpgp/OpenPgpSignatureResult.java (100%) rename OpenPGP-Keychain-API/libraries/{keychain-api-library => openpgp-api-library}/src/org/openintents/openpgp/util/OpenPgpApi.java (100%) rename OpenPGP-Keychain-API/libraries/{keychain-api-library => openpgp-api-library}/src/org/openintents/openpgp/util/OpenPgpListPreference.java (99%) rename OpenPGP-Keychain-API/libraries/{keychain-api-library => openpgp-api-library}/src/org/openintents/openpgp/util/OpenPgpServiceConnection.java (100%) rename OpenPGP-Keychain-API/libraries/{keychain-api-library => openpgp-api-library}/src/org/openintents/openpgp/util/OpenPgpUtils.java (100%) rename OpenPGP-Keychain-API/libraries/{keychain-api-library => openpgp-api-library}/src/org/openintents/openpgp/util/ParcelFileDescriptorUtil.java (100%) diff --git a/OpenPGP-Keychain-API/example-app/build.gradle b/OpenPGP-Keychain-API/example-app/build.gradle index 5147dc7bc..e7a25e689 100644 --- a/OpenPGP-Keychain-API/example-app/build.gradle +++ b/OpenPGP-Keychain-API/example-app/build.gradle @@ -13,7 +13,8 @@ apply plugin: 'android' dependencies { compile 'com.android.support:support-v4:19.0.1' - compile project(':libraries:keychain-api-library') + compile project(':libraries:openpgp-api-library') + compile project(':libraries:openkeychain-api-library') } android { diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/.gitignore b/OpenPGP-Keychain-API/libraries/openkeychain-api-library/.gitignore similarity index 100% rename from OpenPGP-Keychain-API/libraries/keychain-api-library/.gitignore rename to OpenPGP-Keychain-API/libraries/openkeychain-api-library/.gitignore diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/AndroidManifest.xml b/OpenPGP-Keychain-API/libraries/openkeychain-api-library/AndroidManifest.xml similarity index 100% rename from OpenPGP-Keychain-API/libraries/keychain-api-library/AndroidManifest.xml rename to OpenPGP-Keychain-API/libraries/openkeychain-api-library/AndroidManifest.xml diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/LICENSE b/OpenPGP-Keychain-API/libraries/openkeychain-api-library/LICENSE similarity index 100% rename from OpenPGP-Keychain-API/libraries/keychain-api-library/LICENSE rename to OpenPGP-Keychain-API/libraries/openkeychain-api-library/LICENSE diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/build.gradle b/OpenPGP-Keychain-API/libraries/openkeychain-api-library/build.gradle similarity index 100% rename from OpenPGP-Keychain-API/libraries/keychain-api-library/build.gradle rename to OpenPGP-Keychain-API/libraries/openkeychain-api-library/build.gradle diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/build.xml b/OpenPGP-Keychain-API/libraries/openkeychain-api-library/build.xml similarity index 100% rename from OpenPGP-Keychain-API/libraries/keychain-api-library/build.xml rename to OpenPGP-Keychain-API/libraries/openkeychain-api-library/build.xml diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/proguard-project.txt b/OpenPGP-Keychain-API/libraries/openkeychain-api-library/proguard-project.txt similarity index 100% rename from OpenPGP-Keychain-API/libraries/keychain-api-library/proguard-project.txt rename to OpenPGP-Keychain-API/libraries/openkeychain-api-library/proguard-project.txt diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/project.properties b/OpenPGP-Keychain-API/libraries/openkeychain-api-library/project.properties similarity index 100% rename from OpenPGP-Keychain-API/libraries/keychain-api-library/project.properties rename to OpenPGP-Keychain-API/libraries/openkeychain-api-library/project.properties diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/sufficientlysecure/keychain/api/OpenKeychainIntents.java b/OpenPGP-Keychain-API/libraries/openkeychain-api-library/src/org/sufficientlysecure/keychain/api/OpenKeychainIntents.java similarity index 100% rename from OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/sufficientlysecure/keychain/api/OpenKeychainIntents.java rename to OpenPGP-Keychain-API/libraries/openkeychain-api-library/src/org/sufficientlysecure/keychain/api/OpenKeychainIntents.java diff --git a/OpenPGP-Keychain-API/libraries/openpgp-api-library/.gitignore b/OpenPGP-Keychain-API/libraries/openpgp-api-library/.gitignore new file mode 100644 index 000000000..aa8bb5760 --- /dev/null +++ b/OpenPGP-Keychain-API/libraries/openpgp-api-library/.gitignore @@ -0,0 +1,29 @@ +#Android specific +bin +gen +obj +lint.xml +local.properties +release.properties +ant.properties +*.class +*.apk + +#Gradle +.gradle +build +gradle.properties + +#Maven +target +pom.xml.* + +#Eclipse +.project +.classpath +.settings +.metadata + +#IntelliJ IDEA +.idea +*.iml diff --git a/OpenPGP-Keychain-API/libraries/openpgp-api-library/AndroidManifest.xml b/OpenPGP-Keychain-API/libraries/openpgp-api-library/AndroidManifest.xml new file mode 100644 index 000000000..98cb89faa --- /dev/null +++ b/OpenPGP-Keychain-API/libraries/openpgp-api-library/AndroidManifest.xml @@ -0,0 +1,13 @@ + + + + + + + + \ No newline at end of file diff --git a/OpenPGP-Keychain-API/libraries/openpgp-api-library/LICENSE b/OpenPGP-Keychain-API/libraries/openpgp-api-library/LICENSE new file mode 100644 index 000000000..d64569567 --- /dev/null +++ b/OpenPGP-Keychain-API/libraries/openpgp-api-library/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/libraries/keychain-api-library/build.gradle b/OpenPGP-Keychain-API/libraries/openpgp-api-library/build.gradle similarity index 93% rename from libraries/keychain-api-library/build.gradle rename to OpenPGP-Keychain-API/libraries/openpgp-api-library/build.gradle index 7c923e7f6..98c9a3bd6 100644 --- a/libraries/keychain-api-library/build.gradle +++ b/OpenPGP-Keychain-API/libraries/openpgp-api-library/build.gradle @@ -5,7 +5,7 @@ buildscript { } dependencies { - classpath 'com.android.tools.build:gradle:0.8.3' + classpath 'com.android.tools.build:gradle:0.9.0' } } diff --git a/OpenPGP-Keychain-API/libraries/openpgp-api-library/build.xml b/OpenPGP-Keychain-API/libraries/openpgp-api-library/build.xml new file mode 100644 index 000000000..48ebf198c --- /dev/null +++ b/OpenPGP-Keychain-API/libraries/openpgp-api-library/build.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenPGP-Keychain-API/libraries/openpgp-api-library/proguard-project.txt b/OpenPGP-Keychain-API/libraries/openpgp-api-library/proguard-project.txt new file mode 100644 index 000000000..f2fe1559a --- /dev/null +++ b/OpenPGP-Keychain-API/libraries/openpgp-api-library/proguard-project.txt @@ -0,0 +1,20 @@ +# To enable ProGuard in your project, edit project.properties +# to define the proguard.config property as described in that file. +# +# Add project specific ProGuard rules here. +# By default, the flags in this file are appended to flags specified +# in ${sdk.dir}/tools/proguard/proguard-android.txt +# You can edit the include path and order by changing the ProGuard +# include property in project.properties. +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# Add any project specific keep options here: + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} diff --git a/OpenPGP-Keychain-API/libraries/openpgp-api-library/project.properties b/OpenPGP-Keychain-API/libraries/openpgp-api-library/project.properties new file mode 100644 index 000000000..91d2b0246 --- /dev/null +++ b/OpenPGP-Keychain-API/libraries/openpgp-api-library/project.properties @@ -0,0 +1,15 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt + +# Project target. +target=android-19 +android.library=true diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/res/drawable-hdpi/ic_action_cancel_launchersize.png b/OpenPGP-Keychain-API/libraries/openpgp-api-library/res/drawable-hdpi/ic_action_cancel_launchersize.png similarity index 100% rename from OpenPGP-Keychain-API/libraries/keychain-api-library/res/drawable-hdpi/ic_action_cancel_launchersize.png rename to OpenPGP-Keychain-API/libraries/openpgp-api-library/res/drawable-hdpi/ic_action_cancel_launchersize.png diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/res/drawable-hdpi/ic_action_cancel_launchersize_light.png b/OpenPGP-Keychain-API/libraries/openpgp-api-library/res/drawable-hdpi/ic_action_cancel_launchersize_light.png similarity index 100% rename from OpenPGP-Keychain-API/libraries/keychain-api-library/res/drawable-hdpi/ic_action_cancel_launchersize_light.png rename to OpenPGP-Keychain-API/libraries/openpgp-api-library/res/drawable-hdpi/ic_action_cancel_launchersize_light.png diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/res/drawable-mdpi/ic_action_cancel_launchersize.png b/OpenPGP-Keychain-API/libraries/openpgp-api-library/res/drawable-mdpi/ic_action_cancel_launchersize.png similarity index 100% rename from OpenPGP-Keychain-API/libraries/keychain-api-library/res/drawable-mdpi/ic_action_cancel_launchersize.png rename to OpenPGP-Keychain-API/libraries/openpgp-api-library/res/drawable-mdpi/ic_action_cancel_launchersize.png diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/res/drawable-mdpi/ic_action_cancel_launchersize_light.png b/OpenPGP-Keychain-API/libraries/openpgp-api-library/res/drawable-mdpi/ic_action_cancel_launchersize_light.png similarity index 100% rename from OpenPGP-Keychain-API/libraries/keychain-api-library/res/drawable-mdpi/ic_action_cancel_launchersize_light.png rename to OpenPGP-Keychain-API/libraries/openpgp-api-library/res/drawable-mdpi/ic_action_cancel_launchersize_light.png diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/res/drawable-xhdpi/ic_action_cancel_launchersize.png b/OpenPGP-Keychain-API/libraries/openpgp-api-library/res/drawable-xhdpi/ic_action_cancel_launchersize.png similarity index 100% rename from OpenPGP-Keychain-API/libraries/keychain-api-library/res/drawable-xhdpi/ic_action_cancel_launchersize.png rename to OpenPGP-Keychain-API/libraries/openpgp-api-library/res/drawable-xhdpi/ic_action_cancel_launchersize.png diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/res/drawable-xhdpi/ic_action_cancel_launchersize_light.png b/OpenPGP-Keychain-API/libraries/openpgp-api-library/res/drawable-xhdpi/ic_action_cancel_launchersize_light.png similarity index 100% rename from OpenPGP-Keychain-API/libraries/keychain-api-library/res/drawable-xhdpi/ic_action_cancel_launchersize_light.png rename to OpenPGP-Keychain-API/libraries/openpgp-api-library/res/drawable-xhdpi/ic_action_cancel_launchersize_light.png diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/res/drawable-xxhdpi/ic_action_cancel_launchersize.png b/OpenPGP-Keychain-API/libraries/openpgp-api-library/res/drawable-xxhdpi/ic_action_cancel_launchersize.png similarity index 100% rename from OpenPGP-Keychain-API/libraries/keychain-api-library/res/drawable-xxhdpi/ic_action_cancel_launchersize.png rename to OpenPGP-Keychain-API/libraries/openpgp-api-library/res/drawable-xxhdpi/ic_action_cancel_launchersize.png diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/res/drawable-xxhdpi/ic_action_cancel_launchersize_light.png b/OpenPGP-Keychain-API/libraries/openpgp-api-library/res/drawable-xxhdpi/ic_action_cancel_launchersize_light.png similarity index 100% rename from OpenPGP-Keychain-API/libraries/keychain-api-library/res/drawable-xxhdpi/ic_action_cancel_launchersize_light.png rename to OpenPGP-Keychain-API/libraries/openpgp-api-library/res/drawable-xxhdpi/ic_action_cancel_launchersize_light.png diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/res/values/strings.xml b/OpenPGP-Keychain-API/libraries/openpgp-api-library/res/values/strings.xml similarity index 100% rename from OpenPGP-Keychain-API/libraries/keychain-api-library/res/values/strings.xml rename to OpenPGP-Keychain-API/libraries/openpgp-api-library/res/values/strings.xml diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/IOpenPgpService.aidl b/OpenPGP-Keychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/IOpenPgpService.aidl similarity index 100% rename from OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/IOpenPgpService.aidl rename to OpenPGP-Keychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/IOpenPgpService.aidl diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/OpenPgpError.java b/OpenPGP-Keychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/OpenPgpError.java similarity index 100% rename from OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/OpenPgpError.java rename to OpenPGP-Keychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/OpenPgpError.java diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/OpenPgpSignatureResult.java b/OpenPGP-Keychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/OpenPgpSignatureResult.java similarity index 100% rename from OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/OpenPgpSignatureResult.java rename to OpenPGP-Keychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/OpenPgpSignatureResult.java diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpApi.java b/OpenPGP-Keychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/util/OpenPgpApi.java similarity index 100% rename from OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpApi.java rename to OpenPGP-Keychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/util/OpenPgpApi.java diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpListPreference.java b/OpenPGP-Keychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/util/OpenPgpListPreference.java similarity index 99% rename from OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpListPreference.java rename to OpenPGP-Keychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/util/OpenPgpListPreference.java index ecc2b8ec1..cf5864620 100644 --- a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpListPreference.java +++ b/OpenPGP-Keychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/util/OpenPgpListPreference.java @@ -31,7 +31,7 @@ import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.ListAdapter; import android.widget.TextView; -import org.sufficientlysecure.keychain.api.R; +import org.openintents.openpgp.R; import java.util.ArrayList; import java.util.List; diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpServiceConnection.java b/OpenPGP-Keychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/util/OpenPgpServiceConnection.java similarity index 100% rename from OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpServiceConnection.java rename to OpenPGP-Keychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/util/OpenPgpServiceConnection.java diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpUtils.java b/OpenPGP-Keychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/util/OpenPgpUtils.java similarity index 100% rename from OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/OpenPgpUtils.java rename to OpenPGP-Keychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/util/OpenPgpUtils.java diff --git a/OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/ParcelFileDescriptorUtil.java b/OpenPGP-Keychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/util/ParcelFileDescriptorUtil.java similarity index 100% rename from OpenPGP-Keychain-API/libraries/keychain-api-library/src/org/openintents/openpgp/util/ParcelFileDescriptorUtil.java rename to OpenPGP-Keychain-API/libraries/openpgp-api-library/src/org/openintents/openpgp/util/ParcelFileDescriptorUtil.java diff --git a/OpenPGP-Keychain-API/settings.gradle b/OpenPGP-Keychain-API/settings.gradle index 4df1d7b4f..a819a021b 100644 --- a/OpenPGP-Keychain-API/settings.gradle +++ b/OpenPGP-Keychain-API/settings.gradle @@ -1,2 +1,3 @@ include ':example-app' -include ':libraries:keychain-api-library' \ No newline at end of file +include ':libraries:openpgp-api-library' +include ':libraries:openkeychain-api-library' \ No newline at end of file diff --git a/OpenPGP-Keychain/build.gradle b/OpenPGP-Keychain/build.gradle index 284f0430c..6338774eb 100644 --- a/OpenPGP-Keychain/build.gradle +++ b/OpenPGP-Keychain/build.gradle @@ -3,7 +3,8 @@ apply plugin: 'android' dependencies { compile 'com.android.support:support-v4:19.0.1' compile 'com.android.support:appcompat-v7:19.0.1' - compile project(':OpenPGP-Keychain-API:libraries:keychain-api-library') + compile project(':OpenPGP-Keychain-API:libraries:openpgp-api-library') + compile project(':OpenPGP-Keychain-API:libraries:openkeychain-api-library') compile project(':libraries:HtmlTextView') compile project(':libraries:StickyListHeaders:library') compile project(':libraries:AndroidBootstrap') diff --git a/settings.gradle b/settings.gradle index 1ebb30ec0..f6ba5c517 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,5 +1,6 @@ include ':OpenPGP-Keychain' -include ':OpenPGP-Keychain-API:libraries:keychain-api-library' +include ':OpenPGP-Keychain-API:libraries:openpgp-api-library' +include ':OpenPGP-Keychain-API:libraries:openkeychain-api-library' include ':libraries:HtmlTextView' include ':libraries:StickyListHeaders:library' include ':libraries:AndroidBootstrap' From db05b3043ac1f1b5b350557fa851786b06ca223e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Sat, 8 Mar 2014 00:17:24 +0100 Subject: [PATCH 067/109] beta4 --- OpenPGP-Keychain/src/main/AndroidManifest.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenPGP-Keychain/src/main/AndroidManifest.xml b/OpenPGP-Keychain/src/main/AndroidManifest.xml index 8aa37393f..10f112f23 100644 --- a/OpenPGP-Keychain/src/main/AndroidManifest.xml +++ b/OpenPGP-Keychain/src/main/AndroidManifest.xml @@ -2,8 +2,8 @@ + android:versionCode="23104" + android:versionName="2.3.1 beta4"> Settings From 8d85aa5876949aec45a908760411790f3601c632 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Sun, 9 Mar 2014 23:51:18 +0100 Subject: [PATCH 076/109] remove unneeded replace for newline on fingerprint --- .../sufficientlysecure/keychain/ui/ViewKeyMainFragment.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java index f8db19c16..65fe08484 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java @@ -261,8 +261,7 @@ public class ViewKeyMainFragment extends Fragment implements // FALLBACK for old database entries fingerprintBlob = ProviderHelper.getFingerprint(getActivity(), mDataUri); } - String fingerprint = PgpKeyHelper.convertFingerprintToHex(fingerprintBlob, true) - .replace(" ", "\n"); + String fingerprint = PgpKeyHelper.convertFingerprintToHex(fingerprintBlob, true); mFingerprint.setText(colorizeFingerprint(fingerprint)); } From 7d2c3f860e4ce291a4607bee43d4a36ff0093989 Mon Sep 17 00:00:00 2001 From: Sreeram Boyapati Date: Mon, 10 Mar 2014 08:31:53 +0530 Subject: [PATCH 077/109] Fix to passphrase dialog and Issue #207 --- .../ui/SelectSecretKeyLayoutFragment.java | 50 ++++++++++++++++--- .../res/layout/passphrase_repeat_dialog.xml | 8 ++- .../select_secret_key_layout_fragment.xml | 23 +++++++-- 3 files changed, 68 insertions(+), 13 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectSecretKeyLayoutFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectSecretKeyLayoutFragment.java index 6bcb84f46..95a254bf2 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectSecretKeyLayoutFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectSecretKeyLayoutFragment.java @@ -24,10 +24,13 @@ import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.pgp.PgpKeyHelper; import org.sufficientlysecure.keychain.provider.ProviderHelper; +import android.Manifest; import android.app.Activity; +import android.app.ActivityOptions; import android.content.Intent; import android.os.Bundle; import android.support.v4.app.Fragment; +import android.util.Log; import android.view.LayoutInflater; import android.view.View; import android.view.View.OnClickListener; @@ -40,6 +43,7 @@ public class SelectSecretKeyLayoutFragment extends Fragment { private TextView mKeyUserId; private TextView mKeyUserIdRest; + private TextView mKeyMasterKeyIdHex; private BootstrapButton mSelectKeyButton; private Boolean mFilterCertify; @@ -61,26 +65,58 @@ public class SelectSecretKeyLayoutFragment extends Fragment { public void selectKey(long secretKeyId) { if (secretKeyId == Id.key.none) { - mKeyUserId.setText(R.string.api_settings_no_key); + mKeyMasterKeyIdHex.setText(R.string.api_settings_no_key); mKeyUserIdRest.setText(""); + mKeyUserId.setVisibility(View.GONE); + mKeyUserIdRest.setVisibility(View.GONE); + } else { String uid = getResources().getString(R.string.user_id_no_name); String uidExtra = ""; + String masterkeyIdHex = ""; + PGPSecretKeyRing keyRing = ProviderHelper.getPGPSecretKeyRingByMasterKeyId( getActivity(), secretKeyId); if (keyRing != null) { PGPSecretKey key = PgpKeyHelper.getMasterKey(keyRing); + masterkeyIdHex = PgpKeyHelper.convertKeyIdToHex(secretKeyId); + if (key != null) { String userId = PgpKeyHelper.getMainUserIdSafe(getActivity(), key); - String chunks[] = userId.split(" <", 2); + /*String chunks[] = mUserId.split(" <", 2); uid = chunks[0]; if (chunks.length > 1) { uidExtra = "<" + chunks[1]; - } + }*/ + String[] userIdSplit = PgpKeyHelper.splitUserId(userId); + String userName, userEmail; + + if (userIdSplit[0] != null) { userName = userIdSplit[0]; } + else { userName = "No Name"; } + + if (userIdSplit[1] != null) { userEmail = userIdSplit[1]; } + else { userEmail = "No Email"; } + + mKeyMasterKeyIdHex.setText(masterkeyIdHex); + mKeyUserId.setText(userName); + mKeyUserIdRest.setText(userEmail); + mKeyUserId.setVisibility(View.VISIBLE); + mKeyUserIdRest.setVisibility(View.VISIBLE); } + else{ + mKeyMasterKeyIdHex.setText("No key found for KeyRing"); + mKeyUserId.setVisibility(View.GONE); + mKeyUserIdRest.setVisibility(View.GONE); + + } + } - mKeyUserId.setText(uid); - mKeyUserIdRest.setText(uidExtra); + else{ + mKeyMasterKeyIdHex.setText("No KeyRings found for MasterId: "+secretKeyId); + mKeyUserId.setVisibility(View.GONE); + mKeyUserIdRest.setVisibility(View.GONE); + } + } } @@ -98,6 +134,7 @@ public class SelectSecretKeyLayoutFragment extends Fragment { mKeyUserId = (TextView) view.findViewById(R.id.select_secret_key_user_id); mKeyUserIdRest = (TextView) view.findViewById(R.id.select_secret_key_user_id_rest); + mKeyMasterKeyIdHex = (TextView) view.findViewById(R.id.select_secret_key_master_key_hex); mSelectKeyButton = (BootstrapButton) view .findViewById(R.id.select_secret_key_select_key_button); mFilterCertify = false; @@ -117,6 +154,8 @@ public class SelectSecretKeyLayoutFragment extends Fragment { startActivityForResult(intent, REQUEST_CODE_SELECT_KEY); } + //Select Secret Key Activity delivers the intent which was sent by it using interface to Select + // Secret Key Fragment.Intent contains Master Key Id, User Email, User Name, Master Key Id Hex. @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode & 0xFFFF) { @@ -125,7 +164,6 @@ public class SelectSecretKeyLayoutFragment extends Fragment { if (resultCode == Activity.RESULT_OK) { Bundle bundle = data.getExtras(); secretKeyId = bundle.getLong(SelectSecretKeyActivity.RESULT_EXTRA_MASTER_KEY_ID); - selectKey(secretKeyId); // remove displayed errors diff --git a/OpenPGP-Keychain/src/main/res/layout/passphrase_repeat_dialog.xml b/OpenPGP-Keychain/src/main/res/layout/passphrase_repeat_dialog.xml index 2bdd231ee..ae523762c 100644 --- a/OpenPGP-Keychain/src/main/res/layout/passphrase_repeat_dialog.xml +++ b/OpenPGP-Keychain/src/main/res/layout/passphrase_repeat_dialog.xml @@ -6,7 +6,9 @@ android:paddingRight="16dp" android:stretchColumns="1" > - + - + + android:orientation="vertical" > + + android:visibility="gone" + android:text="" + android:textAppearance="?android:attr/textAppearanceSmall" /> + + + \ No newline at end of file From b47f291d1272954a27c5d1313480dd4cc4dbfe05 Mon Sep 17 00:00:00 2001 From: Sreeram Boyapati Date: Mon, 10 Mar 2014 11:49:18 +0530 Subject: [PATCH 078/109] ViewHolder Pattern Implemented --- .../ui/adapter/ImportKeysAdapter.java | 65 +++++++++++-------- 1 file changed, 39 insertions(+), 26 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysAdapter.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysAdapter.java index 52186b662..4f7623bce 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysAdapter.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysAdapter.java @@ -42,7 +42,15 @@ public class ImportKeysAdapter extends ArrayAdapter { protected Activity mActivity; protected List data; + static class ViewHolder{ + private TextView mainUserId; + private TextView mainUserIdRest; + private TextView keyId; + private TextView fingerprint; + private TextView algorithm; + private TextView status; + } public ImportKeysAdapter(Activity activity) { super(activity, -1); mActivity = activity; @@ -86,16 +94,21 @@ public class ImportKeysAdapter extends ArrayAdapter { public View getView(int position, View convertView, ViewGroup parent) { ImportKeysListEntry entry = data.get(position); - - View view = mInflater.inflate(R.layout.import_keys_list_entry, null); - - TextView mainUserId = (TextView) view.findViewById(R.id.mainUserId); - TextView mainUserIdRest = (TextView) view.findViewById(R.id.mainUserIdRest); - TextView keyId = (TextView) view.findViewById(R.id.keyId); - TextView fingerprint = (TextView) view.findViewById(R.id.fingerprint); - TextView algorithm = (TextView) view.findViewById(R.id.algorithm); - TextView status = (TextView) view.findViewById(R.id.status); - + ViewHolder holder; + if(convertView == null) { + holder = new ViewHolder(); + convertView = mInflater.inflate(R.layout.import_keys_list_entry, null); + holder.mainUserId = (TextView) convertView.findViewById(R.id.mainUserId); + holder.mainUserIdRest = (TextView) convertView.findViewById(R.id.mainUserIdRest); + holder.keyId = (TextView) convertView.findViewById(R.id.keyId); + holder.fingerprint = (TextView) convertView.findViewById(R.id.fingerprint); + holder.algorithm = (TextView) convertView.findViewById(R.id.algorithm); + holder.status = (TextView) convertView.findViewById(R.id.status); + convertView.setTag(holder); + } + else{ + holder = (ViewHolder)convertView.getTag(); + } // main user id String userId = entry.userIds.get(0); String[] userIdSplit = PgpKeyHelper.splitUserId(userId); @@ -105,39 +118,39 @@ public class ImportKeysAdapter extends ArrayAdapter { // show red user id if it is a secret key if (entry.secretKey) { userIdSplit[0] = mActivity.getString(R.string.secret_key) + " " + userIdSplit[0]; - mainUserId.setTextColor(Color.RED); + holder.mainUserId.setTextColor(Color.RED); } - mainUserId.setText(userIdSplit[0]); + holder.mainUserId.setText(userIdSplit[0]); } else { - mainUserId.setText(R.string.user_id_no_name); + holder.mainUserId.setText(R.string.user_id_no_name); } // email if (userIdSplit[1] != null) { - mainUserIdRest.setText(userIdSplit[1]); - mainUserIdRest.setVisibility(View.VISIBLE); + holder.mainUserIdRest.setText(userIdSplit[1]); + holder.mainUserIdRest.setVisibility(View.VISIBLE); } else { - mainUserIdRest.setVisibility(View.GONE); + holder.mainUserIdRest.setVisibility(View.GONE); } - keyId.setText(entry.hexKeyId); + holder.keyId.setText(entry.hexKeyId); if (entry.fingerPrint != null) { - fingerprint.setText(mActivity.getString(R.string.fingerprint) + " " + entry.fingerPrint); - fingerprint.setVisibility(View.VISIBLE); + holder.fingerprint.setText(mActivity.getString(R.string.fingerprint) + " " + entry.fingerPrint); + holder.fingerprint.setVisibility(View.VISIBLE); } else { - fingerprint.setVisibility(View.GONE); + holder.fingerprint.setVisibility(View.GONE); } - algorithm.setText("" + entry.bitStrength + "/" + entry.algorithm); + holder.algorithm.setText("" + entry.bitStrength + "/" + entry.algorithm); if (entry.revoked) { - status.setText(R.string.revoked); + holder.status.setText(R.string.revoked); } else { - status.setVisibility(View.GONE); + holder.status.setVisibility(View.GONE); } - LinearLayout ll = (LinearLayout) view.findViewById(R.id.list); + LinearLayout ll = (LinearLayout) convertView.findViewById(R.id.list); if (entry.userIds.size() == 1) { ll.setVisibility(View.GONE); } else { @@ -162,10 +175,10 @@ public class ImportKeysAdapter extends ArrayAdapter { } } - CheckBox cBox = (CheckBox) view.findViewById(R.id.selected); + CheckBox cBox = (CheckBox) convertView.findViewById(R.id.selected); cBox.setChecked(entry.isSelected()); - return view; + return convertView; } } From b927c0f26ace30651b3cb9df9d71741745563aaf Mon Sep 17 00:00:00 2001 From: Miroojin Bakshi Date: Mon, 10 Mar 2014 15:25:09 +0530 Subject: [PATCH 079/109] Highlight search query in SelectPublicKeyFragment and KeyListPublicFragment --- .../keychain/ui/KeyListPublicFragment.java | 2 +- .../keychain/ui/SelectPublicKeyFragment.java | 1 + .../ui/adapter/KeyListPublicAdapter.java | 35 +++++++++++++++++- .../ui/adapter/SelectKeyCursorAdapter.java | 37 ++++++++++++++++++- 4 files changed, 72 insertions(+), 3 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java index 40a016f55..59dd31a21 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java @@ -272,8 +272,8 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer public void onLoadFinished(Loader loader, Cursor data) { // Swap the new cursor in. (The framework will take care of closing the // old cursor once we return.) + mAdapter.setSearchQuery(mCurQuery); mAdapter.swapCursor(data); - mStickyList.setAdapter(mAdapter); // NOTE: Not supported by StickyListHeader, but reimplemented here diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java index 6e338979a..c1c9aa705 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java @@ -311,6 +311,7 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements T public void onLoadFinished(Loader loader, Cursor data) { // Swap the new cursor in. (The framework will take care of closing the // old cursor once we return.) + mAdapter.setSearchQuery(mCurQuery); mAdapter.swapCursor(data); // The list should now be shown. diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java index 086d2c178..dcc368e7b 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java @@ -19,6 +19,8 @@ package org.sufficientlysecure.keychain.ui.adapter; import java.util.HashMap; import java.util.Set; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; @@ -33,6 +35,9 @@ import android.content.Context; import android.database.Cursor; import android.graphics.Color; import android.support.v4.widget.CursorAdapter; +import android.text.Html; +import android.text.Spannable; +import android.text.style.ForegroundColorSpan; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -46,13 +51,14 @@ public class KeyListPublicAdapter extends CursorAdapter implements StickyListHea private int mSectionColumnIndex; private int mIndexUserId; private int mIndexIsRevoked; + private String mCurQuery; @SuppressLint("UseSparseArrays") private HashMap mSelection = new HashMap(); public KeyListPublicAdapter(Context context, Cursor c, int flags, int sectionColumnIndex) { super(context, c, flags); - + mCurQuery = null; mInflater = LayoutInflater.from(context); mSectionColumnIndex = sectionColumnIndex; initIndex(c); @@ -78,6 +84,10 @@ public class KeyListPublicAdapter extends CursorAdapter implements StickyListHea } } + public void setSearchQuery(String searchQuery){ + mCurQuery = searchQuery; + } + /** * Bind cursor data to the item list view *

@@ -110,6 +120,10 @@ public class KeyListPublicAdapter extends CursorAdapter implements StickyListHea } else { revoked.setVisibility(View.GONE); } + if(mCurQuery != null){ + mainUserId.setText(highlightSearchKey(userIdSplit[0])); + mainUserIdRest.setText(highlightSearchKey(userIdSplit[1])); + } } @Override @@ -228,5 +242,24 @@ public class KeyListPublicAdapter extends CursorAdapter implements StickyListHea } return v; } + private Spannable highlightSearchKey(String text) { + Spannable highlight; + Pattern pattern; + Matcher matcher; + String orig_str; + + orig_str = Html.fromHtml(text).toString(); + highlight = (Spannable) Html.fromHtml(text); + pattern = Pattern.compile("(?i)" + mCurQuery); + matcher = pattern.matcher(orig_str); + if (matcher.find()) { + highlight.setSpan( + new ForegroundColorSpan(0xFF33B5E5), + matcher.start(), + matcher.end(), + Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + } + return highlight; + } } diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java index d44dd5890..03010f7a2 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java @@ -26,6 +26,9 @@ import org.sufficientlysecure.keychain.provider.KeychainContract.UserIds; import android.content.Context; import android.database.Cursor; import android.support.v4.widget.CursorAdapter; +import android.text.Html; +import android.text.Spannable; +import android.text.style.ForegroundColorSpan; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -33,6 +36,9 @@ import android.widget.CheckBox; import android.widget.ListView; import android.widget.TextView; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + public class SelectKeyCursorAdapter extends CursorAdapter { protected int mKeyType; @@ -47,6 +53,7 @@ public class SelectKeyCursorAdapter extends CursorAdapter { public final static String PROJECTION_ROW_AVAILABLE = "available"; public final static String PROJECTION_ROW_VALID = "valid"; + private String mCurQuery; public SelectKeyCursorAdapter(Context context, Cursor c, int flags, ListView listView, int keyType) { @@ -55,7 +62,7 @@ public class SelectKeyCursorAdapter extends CursorAdapter { mInflater = LayoutInflater.from(context); mListView = listView; mKeyType = keyType; - + mCurQuery = null; initIndex(c); } @@ -158,6 +165,11 @@ public class SelectKeyCursorAdapter extends CursorAdapter { mainUserIdRest.setEnabled(valid); keyId.setEnabled(valid); status.setEnabled(valid); + + if(mCurQuery != null){ + mainUserId.setText(highlightSearchKey(userIdSplit[0])); + mainUserIdRest.setText(highlightSearchKey(userIdSplit[1])); + } } @Override @@ -165,4 +177,27 @@ public class SelectKeyCursorAdapter extends CursorAdapter { return mInflater.inflate(R.layout.select_key_item, null); } + public void setSearchQuery(String searchQuery){ + mCurQuery = searchQuery; + } + + private Spannable highlightSearchKey(String text) { + Spannable highlight; + Pattern pattern; + Matcher matcher; + String orig_str; + + orig_str = Html.fromHtml(text).toString(); + highlight = (Spannable) Html.fromHtml(text); + pattern = Pattern.compile("(?i)" + mCurQuery); + matcher = pattern.matcher(orig_str); + if (matcher.find()) { + highlight.setSpan( + new ForegroundColorSpan(0xFF33B5E5), + matcher.start(), + matcher.end(), + Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + } + return highlight; + } } From 2b4b09d13c1592adc617bda39cc44f632481fc2b Mon Sep 17 00:00:00 2001 From: Tharindu Wijewardane Date: Mon, 10 Mar 2014 17:10:16 +0530 Subject: [PATCH 080/109] Issue #378 ( private keys are no longer red ): Fixed --- .../keychain/ui/adapter/ImportKeysListEntry.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListEntry.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListEntry.java index f764b879c..ac1f582f1 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListEntry.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListEntry.java @@ -155,6 +155,9 @@ public class ImportKeysListEntry implements Serializable, Parcelable { if ( !(pgpKeyRing instanceof PGPSecretKeyRing) ) { secretKey = false; } + else{ + secretKey = true; + } userIds = new ArrayList(); for (String userId : new IterableIterator(pgpKeyRing.getPublicKey().getUserIDs())) { From 98da2d0c48eec809009e4c129ef13dd4a6f93cc3 Mon Sep 17 00:00:00 2001 From: Miroojin Bakshi Date: Mon, 10 Mar 2014 21:10:04 +0530 Subject: [PATCH 081/109] Create custom HighlightQueryCursorAdapter --- .../adapter/HighlightQueryCursorAdapter.java | 61 +++++++++++++++++++ .../ui/adapter/KeyListPublicAdapter.java | 38 ++---------- .../ui/adapter/SelectKeyCursorAdapter.java | 39 ++---------- 3 files changed, 70 insertions(+), 68 deletions(-) create mode 100644 OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/HighlightQueryCursorAdapter.java diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/HighlightQueryCursorAdapter.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/HighlightQueryCursorAdapter.java new file mode 100644 index 000000000..1c41cbf03 --- /dev/null +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/HighlightQueryCursorAdapter.java @@ -0,0 +1,61 @@ +package org.sufficientlysecure.keychain.ui.adapter; + +import android.annotation.SuppressLint; +import android.content.Context; +import android.database.Cursor; +import android.text.Spannable; +import android.text.style.ForegroundColorSpan; +import android.view.View; +import android.view.ViewGroup; +import android.support.v4.widget.CursorAdapter; + +import java.util.regex.Matcher; +import java.util.regex.Pattern; + + +public class HighlightQueryCursorAdapter extends CursorAdapter { + + private String mCurQuery; + + public HighlightQueryCursorAdapter(Context context, Cursor c, int flags) { + super(context, c, flags); + mCurQuery = null; + } + + @Override + public View newView(Context context, Cursor cursor, ViewGroup parent) { + return null; + } + + + @Override + public void bindView(View view, Context context, Cursor cursor) { + + } + + public void setSearchQuery(String searchQuery){ + mCurQuery = searchQuery; + } + + public String getSearchQuery(){ + return mCurQuery; + } + + protected Spannable highlightSearchKey(String text) { + Spannable highlight; + Pattern pattern; + Matcher matcher; + + highlight = Spannable.Factory.getInstance().newSpannable(text);; + pattern = Pattern.compile("(?i)" + mCurQuery); + matcher = pattern.matcher(text); + if (matcher.find()) { + highlight.setSpan( + new ForegroundColorSpan(0xFF33B5E5), + matcher.start(), + matcher.end(), + Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + } + return highlight; + } +} diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java index dcc368e7b..888284ec0 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java @@ -19,8 +19,7 @@ package org.sufficientlysecure.keychain.ui.adapter; import java.util.HashMap; import java.util.Set; -import java.util.regex.Matcher; -import java.util.regex.Pattern; + import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; @@ -34,10 +33,6 @@ import android.annotation.SuppressLint; import android.content.Context; import android.database.Cursor; import android.graphics.Color; -import android.support.v4.widget.CursorAdapter; -import android.text.Html; -import android.text.Spannable; -import android.text.style.ForegroundColorSpan; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -46,19 +41,17 @@ import android.widget.TextView; /** * Implements StickyListHeadersAdapter from library */ -public class KeyListPublicAdapter extends CursorAdapter implements StickyListHeadersAdapter { +public class KeyListPublicAdapter extends HighlightQueryCursorAdapter implements StickyListHeadersAdapter { private LayoutInflater mInflater; private int mSectionColumnIndex; private int mIndexUserId; private int mIndexIsRevoked; - private String mCurQuery; @SuppressLint("UseSparseArrays") private HashMap mSelection = new HashMap(); public KeyListPublicAdapter(Context context, Cursor c, int flags, int sectionColumnIndex) { super(context, c, flags); - mCurQuery = null; mInflater = LayoutInflater.from(context); mSectionColumnIndex = sectionColumnIndex; initIndex(c); @@ -84,10 +77,6 @@ public class KeyListPublicAdapter extends CursorAdapter implements StickyListHea } } - public void setSearchQuery(String searchQuery){ - mCurQuery = searchQuery; - } - /** * Bind cursor data to the item list view *

@@ -120,7 +109,9 @@ public class KeyListPublicAdapter extends CursorAdapter implements StickyListHea } else { revoked.setVisibility(View.GONE); } - if(mCurQuery != null){ + String query = getSearchQuery(); + + if(query != null){ mainUserId.setText(highlightSearchKey(userIdSplit[0])); mainUserIdRest.setText(highlightSearchKey(userIdSplit[1])); } @@ -242,24 +233,5 @@ public class KeyListPublicAdapter extends CursorAdapter implements StickyListHea } return v; } - private Spannable highlightSearchKey(String text) { - Spannable highlight; - Pattern pattern; - Matcher matcher; - String orig_str; - - orig_str = Html.fromHtml(text).toString(); - highlight = (Spannable) Html.fromHtml(text); - pattern = Pattern.compile("(?i)" + mCurQuery); - matcher = pattern.matcher(orig_str); - if (matcher.find()) { - highlight.setSpan( - new ForegroundColorSpan(0xFF33B5E5), - matcher.start(), - matcher.end(), - Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); - } - return highlight; - } } diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java index 03010f7a2..a7ef0785b 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java @@ -25,10 +25,6 @@ import org.sufficientlysecure.keychain.provider.KeychainContract.UserIds; import android.content.Context; import android.database.Cursor; -import android.support.v4.widget.CursorAdapter; -import android.text.Html; -import android.text.Spannable; -import android.text.style.ForegroundColorSpan; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -36,10 +32,9 @@ import android.widget.CheckBox; import android.widget.ListView; import android.widget.TextView; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -public class SelectKeyCursorAdapter extends CursorAdapter { + +public class SelectKeyCursorAdapter extends HighlightQueryCursorAdapter { protected int mKeyType; @@ -53,7 +48,6 @@ public class SelectKeyCursorAdapter extends CursorAdapter { public final static String PROJECTION_ROW_AVAILABLE = "available"; public final static String PROJECTION_ROW_VALID = "valid"; - private String mCurQuery; public SelectKeyCursorAdapter(Context context, Cursor c, int flags, ListView listView, int keyType) { @@ -62,7 +56,6 @@ public class SelectKeyCursorAdapter extends CursorAdapter { mInflater = LayoutInflater.from(context); mListView = listView; mKeyType = keyType; - mCurQuery = null; initIndex(c); } @@ -165,8 +158,8 @@ public class SelectKeyCursorAdapter extends CursorAdapter { mainUserIdRest.setEnabled(valid); keyId.setEnabled(valid); status.setEnabled(valid); - - if(mCurQuery != null){ + String query = getSearchQuery(); + if(query != null){ mainUserId.setText(highlightSearchKey(userIdSplit[0])); mainUserIdRest.setText(highlightSearchKey(userIdSplit[1])); } @@ -176,28 +169,4 @@ public class SelectKeyCursorAdapter extends CursorAdapter { public View newView(Context context, Cursor cursor, ViewGroup parent) { return mInflater.inflate(R.layout.select_key_item, null); } - - public void setSearchQuery(String searchQuery){ - mCurQuery = searchQuery; - } - - private Spannable highlightSearchKey(String text) { - Spannable highlight; - Pattern pattern; - Matcher matcher; - String orig_str; - - orig_str = Html.fromHtml(text).toString(); - highlight = (Spannable) Html.fromHtml(text); - pattern = Pattern.compile("(?i)" + mCurQuery); - matcher = pattern.matcher(orig_str); - if (matcher.find()) { - highlight.setSpan( - new ForegroundColorSpan(0xFF33B5E5), - matcher.start(), - matcher.end(), - Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); - } - return highlight; - } } From 6a8fa619082ab6022f9d58c9b2dd95f88672bc1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Mon, 10 Mar 2014 16:58:58 +0100 Subject: [PATCH 082/109] remove double definition of progress_generating --- OpenPGP-Keychain/src/main/res/values/strings.xml | 1 - 1 file changed, 1 deletion(-) diff --git a/OpenPGP-Keychain/src/main/res/values/strings.xml b/OpenPGP-Keychain/src/main/res/values/strings.xml index 505e41b78..3267115a2 100644 --- a/OpenPGP-Keychain/src/main/res/values/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values/strings.xml @@ -315,7 +315,6 @@ saving… importing… exporting… - generating key, this can take up to 3 minutes… building key… preparing master key… certifying master key… From 2166d6668079035fa2fbf7e16863fadccbe294c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Mon, 10 Mar 2014 17:06:11 +0100 Subject: [PATCH 083/109] Cleanup ImportKeysListEntry --- .../keychain/ui/adapter/ImportKeysListEntry.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListEntry.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListEntry.java index ac1f582f1..a52e9b447 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListEntry.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/ImportKeysListEntry.java @@ -125,7 +125,10 @@ public class ImportKeysListEntry implements Serializable, Parcelable { * Constructor for later querying from keyserver */ public ImportKeysListEntry() { + // keys from keyserver are always public keys secretKey = false; + // do not select by default + selected = false; userIds = new ArrayList(); } @@ -152,11 +155,10 @@ public class ImportKeysListEntry implements Serializable, Parcelable { // selected is default this.selected = true; - if ( !(pgpKeyRing instanceof PGPSecretKeyRing) ) { - secretKey = false; - } - else{ + if (pgpKeyRing instanceof PGPSecretKeyRing) { secretKey = true; + } else { + secretKey = false; } userIds = new ArrayList(); From caa0740919f2acae636dfdd6bdcd971a3bf6473c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Mon, 10 Mar 2014 17:22:19 +0100 Subject: [PATCH 084/109] Improve hightlight query code: make cursor abstract, tidy up code --- .../adapter/HighlightQueryCursorAdapter.java | 71 ++++++++++--------- .../ui/adapter/KeyListPublicAdapter.java | 17 ++--- .../ui/adapter/KeyListSecretAdapter.java | 7 +- .../ui/adapter/SelectKeyCursorAdapter.java | 9 +-- 4 files changed, 50 insertions(+), 54 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/HighlightQueryCursorAdapter.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/HighlightQueryCursorAdapter.java index 1c41cbf03..fd7a2dc30 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/HighlightQueryCursorAdapter.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/HighlightQueryCursorAdapter.java @@ -1,19 +1,34 @@ +/* + * Copyright (C) 2014 Dominik Schürmann + * + * 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 . + */ + package org.sufficientlysecure.keychain.ui.adapter; -import android.annotation.SuppressLint; import android.content.Context; import android.database.Cursor; +import android.support.v4.widget.CursorAdapter; import android.text.Spannable; import android.text.style.ForegroundColorSpan; -import android.view.View; -import android.view.ViewGroup; -import android.support.v4.widget.CursorAdapter; + +import org.sufficientlysecure.keychain.R; import java.util.regex.Matcher; import java.util.regex.Pattern; - -public class HighlightQueryCursorAdapter extends CursorAdapter { +public abstract class HighlightQueryCursorAdapter extends CursorAdapter { private String mCurQuery; @@ -22,40 +37,30 @@ public class HighlightQueryCursorAdapter extends CursorAdapter { mCurQuery = null; } - @Override - public View newView(Context context, Cursor cursor, ViewGroup parent) { - return null; - } - - - @Override - public void bindView(View view, Context context, Cursor cursor) { - - } - - public void setSearchQuery(String searchQuery){ + public void setSearchQuery(String searchQuery) { mCurQuery = searchQuery; } - public String getSearchQuery(){ + public String getSearchQuery() { return mCurQuery; } - protected Spannable highlightSearchKey(String text) { - Spannable highlight; - Pattern pattern; - Matcher matcher; + protected Spannable highlightSearchQuery(String text) { + Spannable highlight = Spannable.Factory.getInstance().newSpannable(text); - highlight = Spannable.Factory.getInstance().newSpannable(text);; - pattern = Pattern.compile("(?i)" + mCurQuery); - matcher = pattern.matcher(text); - if (matcher.find()) { - highlight.setSpan( - new ForegroundColorSpan(0xFF33B5E5), - matcher.start(), - matcher.end(), - Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + if (mCurQuery != null) { + Pattern pattern = Pattern.compile("(?i)" + mCurQuery); + Matcher matcher = pattern.matcher(text); + if (matcher.find()) { + highlight.setSpan( + new ForegroundColorSpan(mContext.getResources().getColor(R.color.emphasis)), + matcher.start(), + matcher.end(), + Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + } + return highlight; + } else { + return highlight; } - return highlight; } } diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java index 888284ec0..0cd2606a1 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java @@ -92,12 +92,12 @@ public class KeyListPublicAdapter extends HighlightQueryCursorAdapter implements String userId = cursor.getString(mIndexUserId); String[] userIdSplit = PgpKeyHelper.splitUserId(userId); if (userIdSplit[0] != null) { - mainUserId.setText(userIdSplit[0]); + mainUserId.setText(highlightSearchQuery(userIdSplit[0])); } else { mainUserId.setText(R.string.user_id_no_name); } if (userIdSplit[1] != null) { - mainUserIdRest.setText(userIdSplit[1]); + mainUserIdRest.setText(highlightSearchQuery(userIdSplit[1])); mainUserIdRest.setVisibility(View.VISIBLE); } else { mainUserIdRest.setVisibility(View.GONE); @@ -109,12 +109,6 @@ public class KeyListPublicAdapter extends HighlightQueryCursorAdapter implements } else { revoked.setVisibility(View.GONE); } - String query = getSearchQuery(); - - if(query != null){ - mainUserId.setText(highlightSearchKey(userIdSplit[0])); - mainUserIdRest.setText(highlightSearchKey(userIdSplit[1])); - } } @Override @@ -225,11 +219,12 @@ public class KeyListPublicAdapter extends HighlightQueryCursorAdapter implements /** * Change color for multi-selection */ - // default color - v.setBackgroundColor(Color.TRANSPARENT); if (mSelection.get(position) != null && mSelection.get(position).booleanValue()) { - // this is a selected position, change color! + // color for selected items v.setBackgroundColor(parent.getResources().getColor(R.color.emphasis)); + } else { + // default color + v.setBackgroundColor(Color.TRANSPARENT); } return v; } diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListSecretAdapter.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListSecretAdapter.java index 11d1e8c17..a86508597 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListSecretAdapter.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListSecretAdapter.java @@ -126,11 +126,12 @@ public class KeyListSecretAdapter extends CursorAdapter { /** * Change color for multi-selection */ - // default color - v.setBackgroundColor(Color.TRANSPARENT); if (mSelection.get(position) != null) { - // this is a selected position, change color! + // color for selected items v.setBackgroundColor(parent.getResources().getColor(R.color.emphasis)); + } else { + // default color + v.setBackgroundColor(Color.TRANSPARENT); } return v; } diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java index a7ef0785b..6d67a0e65 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/SelectKeyCursorAdapter.java @@ -104,12 +104,12 @@ public class SelectKeyCursorAdapter extends HighlightQueryCursorAdapter { String[] userIdSplit = PgpKeyHelper.splitUserId(userId); if (userIdSplit[0] != null) { - mainUserId.setText(userIdSplit[0]); + mainUserId.setText(highlightSearchQuery(userIdSplit[0])); } else { mainUserId.setText(R.string.user_id_no_name); } if (userIdSplit[1] != null) { - mainUserIdRest.setText(userIdSplit[1]); + mainUserIdRest.setText(highlightSearchQuery(userIdSplit[1])); } else { mainUserIdRest.setText(""); } @@ -158,11 +158,6 @@ public class SelectKeyCursorAdapter extends HighlightQueryCursorAdapter { mainUserIdRest.setEnabled(valid); keyId.setEnabled(valid); status.setEnabled(valid); - String query = getSearchQuery(); - if(query != null){ - mainUserId.setText(highlightSearchKey(userIdSplit[0])); - mainUserIdRest.setText(highlightSearchKey(userIdSplit[1])); - } } @Override From e00436b4096466af37b3e32c3f3277c3604d85ee Mon Sep 17 00:00:00 2001 From: Bhargav Golla Date: Fri, 7 Mar 2014 18:21:16 -0500 Subject: [PATCH 085/109] Lint changes Deleting lint-report gen files Adding lint output files to gitignore --- .gitignore | 4 ++++ OpenPGP-Keychain/build.gradle | 2 ++ .../keychain/ui/widget/KeyEditor.java | 2 ++ .../res/layout/actionbar_include_cancel_button.xml | 4 ++-- .../res/layout/actionbar_include_done_button.xml | 4 ++-- .../src/main/res/layout/decrypt_activity.xml | 13 +++---------- .../src/main/res/layout/drawer_list.xml | 1 - .../src/main/res/layout/edit_key_user_id_item.xml | 3 ++- .../src/main/res/layout/key_server_editor.xml | 2 +- .../src/main/res/layout/key_server_preference.xml | 2 +- .../src/main/res/menu/key_list_secret.xml | 2 +- OpenPGP-Keychain/src/main/res/menu/key_view.xml | 2 +- OpenPGP-Keychain/src/main/res/values-de/strings.xml | 2 +- OpenPGP-Keychain/src/main/res/values/strings.xml | 4 ++-- 14 files changed, 24 insertions(+), 23 deletions(-) diff --git a/.gitignore b/.gitignore index c4f2c8ad0..176725b3f 100644 --- a/.gitignore +++ b/.gitignore @@ -31,3 +31,7 @@ pom.xml.* #OS Specific [Tt]humbs.db + +#Lint output +OpenPGP-Keychain/lint-report.html +OpenPGP-Keychain/lint-report_files/* diff --git a/OpenPGP-Keychain/build.gradle b/OpenPGP-Keychain/build.gradle index 6338774eb..04ee46715 100644 --- a/OpenPGP-Keychain/build.gradle +++ b/OpenPGP-Keychain/build.gradle @@ -57,5 +57,7 @@ android { // Do not abort build if lint finds errors lintOptions { abortOnError false + htmlReport true + htmlOutput file("lint-report.html") } } diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java index 75a885bdd..f1516faaa 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java @@ -30,6 +30,7 @@ import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.pgp.PgpKeyHelper; import org.sufficientlysecure.keychain.util.Choice; +import android.annotation.TargetApi; import android.app.DatePickerDialog; import android.app.Dialog; import android.content.Context; @@ -110,6 +111,7 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener { setExpiryDate(null); mExpiryDateButton.setOnClickListener(new OnClickListener() { + @TargetApi(11) public void onClick(View v) { GregorianCalendar date = mExpiryDate; if (date == null) { diff --git a/OpenPGP-Keychain/src/main/res/layout/actionbar_include_cancel_button.xml b/OpenPGP-Keychain/src/main/res/layout/actionbar_include_cancel_button.xml index 5fd36286b..04f41d38c 100644 --- a/OpenPGP-Keychain/src/main/res/layout/actionbar_include_cancel_button.xml +++ b/OpenPGP-Keychain/src/main/res/layout/actionbar_include_cancel_button.xml @@ -14,7 +14,7 @@ limitations under the License. --> - - \ No newline at end of file + \ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/res/layout/actionbar_include_done_button.xml b/OpenPGP-Keychain/src/main/res/layout/actionbar_include_done_button.xml index e51f63c80..c39f6978e 100644 --- a/OpenPGP-Keychain/src/main/res/layout/actionbar_include_done_button.xml +++ b/OpenPGP-Keychain/src/main/res/layout/actionbar_include_done_button.xml @@ -14,7 +14,7 @@ limitations under the License. --> - - \ No newline at end of file + \ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/res/layout/decrypt_activity.xml b/OpenPGP-Keychain/src/main/res/layout/decrypt_activity.xml index c56ba130e..22e8192f2 100644 --- a/OpenPGP-Keychain/src/main/res/layout/decrypt_activity.xml +++ b/OpenPGP-Keychain/src/main/res/layout/decrypt_activity.xml @@ -5,16 +5,11 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - - - + android:fillViewport="true" + android:orientation="vertical"> - diff --git a/OpenPGP-Keychain/src/main/res/layout/drawer_list.xml b/OpenPGP-Keychain/src/main/res/layout/drawer_list.xml index 18210afc5..6454b3333 100644 --- a/OpenPGP-Keychain/src/main/res/layout/drawer_list.xml +++ b/OpenPGP-Keychain/src/main/res/layout/drawer_list.xml @@ -12,7 +12,6 @@ android:layout_width="240dp" android:layout_height="match_parent" android:layout_gravity="start" - android:background="#fff" android:choiceMode="singleChoice" android:divider="@color/bg_gray" android:dividerHeight="1dp" /> diff --git a/OpenPGP-Keychain/src/main/res/layout/edit_key_user_id_item.xml b/OpenPGP-Keychain/src/main/res/layout/edit_key_user_id_item.xml index 663949d8e..437e5ebaf 100644 --- a/OpenPGP-Keychain/src/main/res/layout/edit_key_user_id_item.xml +++ b/OpenPGP-Keychain/src/main/res/layout/edit_key_user_id_item.xml @@ -71,7 +71,8 @@ android:id="@+id/comment" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_weight="1" /> + android:layout_weight="1" + android:inputType="text"/> diff --git a/OpenPGP-Keychain/src/main/res/layout/key_server_editor.xml b/OpenPGP-Keychain/src/main/res/layout/key_server_editor.xml index 058a43eaf..950978a0e 100644 --- a/OpenPGP-Keychain/src/main/res/layout/key_server_editor.xml +++ b/OpenPGP-Keychain/src/main/res/layout/key_server_editor.xml @@ -13,7 +13,7 @@ diff --git a/OpenPGP-Keychain/src/main/res/layout/key_server_preference.xml b/OpenPGP-Keychain/src/main/res/layout/key_server_preference.xml index 4a09e4240..eddbe3cbf 100644 --- a/OpenPGP-Keychain/src/main/res/layout/key_server_preference.xml +++ b/OpenPGP-Keychain/src/main/res/layout/key_server_preference.xml @@ -14,7 +14,7 @@ android:orientation="horizontal" >

Für diese Benutzer-IDs wurden keine öffentlichen Schlüssel gefunden: Für diese Benutzer-IDs existieren mehrere öffentliche Schlüssel: Bitte die Liste der Empfänger überprüfen! - Signaturüberprüfung fehlgeschlagen! Haben Sie diese App von einer anderen Quelle installiert? Wenn Sie eine Attacke ausschliessen können, sollten Sie die Registrierung der App in OpenKeychain widerrufen und die App erneut registrieren. + Signaturüberprüfung fehlgeschlagen! Haben Sie diese App von einer anderen Quelle installiert? Wenn Sie eine Attacke ausschließen können, sollten Sie die Registrierung der App in OpenKeychain widerrufen und die App erneut registrieren. Über QR Code teilen Mit \'Weiter\' durch alle QR-Codes gehen und diese nacheinander scannen. diff --git a/OpenPGP-Keychain/src/main/res/values/strings.xml b/OpenPGP-Keychain/src/main/res/values/strings.xml index 99fc7c8a7..ec4a45b3e 100644 --- a/OpenPGP-Keychain/src/main/res/values/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values/strings.xml @@ -302,8 +302,8 @@ - done. - cancel + Done. + Cancel saving… importing… exporting… From 83c346fec447a6748848938e994e19997d29092c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Mon, 10 Mar 2014 17:49:30 +0100 Subject: [PATCH 086/109] Make code more tidy for multiselect --- .../keychain/ui/KeyListPublicFragment.java | 18 +++++------------- .../keychain/ui/KeyListSecretFragment.java | 16 ++++------------ .../ui/adapter/KeyListPublicAdapter.java | 9 --------- .../ui/adapter/KeyListSecretAdapter.java | 11 +---------- 4 files changed, 10 insertions(+), 44 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java index 59dd31a21..c2b21027c 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java @@ -171,15 +171,8 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer @Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { - Set positions = mAdapter.getCurrentCheckedPosition(); - - // get IDs for checked positions as long array - long[] ids = new long[positions.size()]; - int i = 0; - for (int pos : positions) { - ids[i] = mAdapter.getItemId(pos); - i++; - } + // get row ids for checked positions as long array + long[] ids = mStickyList.getCheckedItemIds(); switch (item.getItemId()) { case R.id.menu_key_list_public_multi_encrypt: { @@ -192,9 +185,8 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer } case R.id.menu_key_list_public_multi_select_all: { //Select all - int localCount = mStickyList.getCount(); - for (int k = 0; k < localCount; k++) { - mStickyList.setItemChecked(k, true); + for (int i = 0; i < mStickyList.getCount(); i++) { + mStickyList.setItemChecked(i, true); } break; } @@ -215,7 +207,7 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer } else { mAdapter.removeSelection(position); } - int count = mAdapter.getCurrentCheckedPosition().size(); + int count = mStickyList.getCheckedItemCount(); String keysSelected = getResources().getQuantityString( R.plurals.key_list_selected_keys, count, count); mode.setTitle(keysSelected); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListSecretFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListSecretFragment.java index 9a5477762..76212afc3 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListSecretFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListSecretFragment.java @@ -91,15 +91,8 @@ public class KeyListSecretFragment extends ListFragment implements @Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { - Set positions = mAdapter.getCurrentCheckedPosition(); - - // get IDs for checked positions as long array - long[] ids = new long[positions.size()]; - int i = 0; - for (int pos : positions) { - ids[i] = mAdapter.getItemId(pos); - i++; - } + // get row ids for checked positions as long array + long[] ids = getListView().getCheckedItemIds(); switch (item.getItemId()) { case R.id.menu_key_list_public_multi_delete: { @@ -108,9 +101,8 @@ public class KeyListSecretFragment extends ListFragment implements } case R.id.menu_key_list_public_multi_select_all: { //Select all - int localCount = getListView().getCount(); - for (int k = 0; k < localCount; k++) { - getListView().setItemChecked(k, true); + for (int i = 0; i < getListView().getCount(); i++) { + getListView().setItemChecked(i, true); } break; } diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java index 0cd2606a1..b8f60633e 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java @@ -192,15 +192,6 @@ public class KeyListPublicAdapter extends HighlightQueryCursorAdapter implements notifyDataSetChanged(); } - public boolean isPositionChecked(int position) { - Boolean result = mSelection.get(position); - return result == null ? false : result; - } - - public Set getCurrentCheckedPosition() { - return mSelection.keySet(); - } - public void removeSelection(int position) { mSelection.remove(position); notifyDataSetChanged(); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListSecretAdapter.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListSecretAdapter.java index a86508597..ca3a26066 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListSecretAdapter.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListSecretAdapter.java @@ -98,16 +98,7 @@ public class KeyListSecretAdapter extends CursorAdapter { mSelection.put(position, value); notifyDataSetChanged(); } - - public boolean isPositionChecked(int position) { - Boolean result = mSelection.get(position); - return result == null ? false : result; - } - - public Set getCurrentCheckedPosition() { - return mSelection.keySet(); - } - + public void removeSelection(int position) { mSelection.remove(position); notifyDataSetChanged(); From a41ee31b6c5cfbef067efb0843593a2459861b9c Mon Sep 17 00:00:00 2001 From: Sreeram Boyapati Date: Mon, 10 Mar 2014 22:37:23 +0530 Subject: [PATCH 087/109] Added string reference for Issue #207 --- .../keychain/ui/SelectSecretKeyLayoutFragment.java | 8 ++++---- OpenPGP-Keychain/src/main/res/values/strings.xml | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectSecretKeyLayoutFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectSecretKeyLayoutFragment.java index 95a254bf2..ca5d8b262 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectSecretKeyLayoutFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectSecretKeyLayoutFragment.java @@ -92,10 +92,10 @@ public class SelectSecretKeyLayoutFragment extends Fragment { String userName, userEmail; if (userIdSplit[0] != null) { userName = userIdSplit[0]; } - else { userName = "No Name"; } + else { userName = getActivity().getResources().getString(R.string.user_id_no_name); } if (userIdSplit[1] != null) { userEmail = userIdSplit[1]; } - else { userEmail = "No Email"; } + else { userEmail = getActivity().getResources().getString(R.string.error_user_id_no_email); } mKeyMasterKeyIdHex.setText(masterkeyIdHex); mKeyUserId.setText(userName); @@ -104,7 +104,7 @@ public class SelectSecretKeyLayoutFragment extends Fragment { mKeyUserIdRest.setVisibility(View.VISIBLE); } else{ - mKeyMasterKeyIdHex.setText("No key found for KeyRing"); + mKeyMasterKeyIdHex.setText(getActivity().getResources().getString(R.string.no_key)); mKeyUserId.setVisibility(View.GONE); mKeyUserIdRest.setVisibility(View.GONE); @@ -112,7 +112,7 @@ public class SelectSecretKeyLayoutFragment extends Fragment { } else{ - mKeyMasterKeyIdHex.setText("No KeyRings found for MasterId: "+secretKeyId); + mKeyMasterKeyIdHex.setText(getActivity().getResources().getString(R.string.no_keys_added_or_updated)+" for master id: "+secretKeyId); mKeyUserId.setVisibility(View.GONE); mKeyUserIdRest.setVisibility(View.GONE); } diff --git a/OpenPGP-Keychain/src/main/res/values/strings.xml b/OpenPGP-Keychain/src/main/res/values/strings.xml index 99fc7c8a7..754d4cece 100644 --- a/OpenPGP-Keychain/src/main/res/values/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values/strings.xml @@ -145,6 +145,7 @@ <no name> <none> <no key> + <No Email> can encrypt can sign @@ -271,6 +272,7 @@ the master key cannot be an ElGamal key unknown algorithm choice you need to specify a name + no email found you need to specify an email address need at least one user id main user id must not be empty From d91e2673d7b291e1798e1acee506749eae3cdd01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Mon, 10 Mar 2014 18:23:47 +0100 Subject: [PATCH 088/109] Revert "Lint changes" This reverts commit e00436b4096466af37b3e32c3f3277c3604d85ee. --- .gitignore | 4 ---- OpenPGP-Keychain/build.gradle | 2 -- .../keychain/ui/widget/KeyEditor.java | 2 -- .../res/layout/actionbar_include_cancel_button.xml | 4 ++-- .../res/layout/actionbar_include_done_button.xml | 4 ++-- .../src/main/res/layout/decrypt_activity.xml | 13 ++++++++++--- .../src/main/res/layout/drawer_list.xml | 1 + .../src/main/res/layout/edit_key_user_id_item.xml | 3 +-- .../src/main/res/layout/key_server_editor.xml | 2 +- .../src/main/res/layout/key_server_preference.xml | 2 +- .../src/main/res/menu/key_list_secret.xml | 2 +- OpenPGP-Keychain/src/main/res/menu/key_view.xml | 2 +- OpenPGP-Keychain/src/main/res/values-de/strings.xml | 2 +- OpenPGP-Keychain/src/main/res/values/strings.xml | 4 ++-- 14 files changed, 23 insertions(+), 24 deletions(-) diff --git a/.gitignore b/.gitignore index 176725b3f..c4f2c8ad0 100644 --- a/.gitignore +++ b/.gitignore @@ -31,7 +31,3 @@ pom.xml.* #OS Specific [Tt]humbs.db - -#Lint output -OpenPGP-Keychain/lint-report.html -OpenPGP-Keychain/lint-report_files/* diff --git a/OpenPGP-Keychain/build.gradle b/OpenPGP-Keychain/build.gradle index 04ee46715..6338774eb 100644 --- a/OpenPGP-Keychain/build.gradle +++ b/OpenPGP-Keychain/build.gradle @@ -57,7 +57,5 @@ android { // Do not abort build if lint finds errors lintOptions { abortOnError false - htmlReport true - htmlOutput file("lint-report.html") } } diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java index 9f25fac42..65461cb4f 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/KeyEditor.java @@ -30,7 +30,6 @@ import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.pgp.PgpKeyHelper; import org.sufficientlysecure.keychain.util.Choice; -import android.annotation.TargetApi; import android.app.DatePickerDialog; import android.app.Dialog; import android.content.Context; @@ -111,7 +110,6 @@ public class KeyEditor extends LinearLayout implements Editor, OnClickListener { setExpiryDate(null); mExpiryDateButton.setOnClickListener(new OnClickListener() { - @TargetApi(11) public void onClick(View v) { GregorianCalendar date = mExpiryDate; if (date == null) { diff --git a/OpenPGP-Keychain/src/main/res/layout/actionbar_include_cancel_button.xml b/OpenPGP-Keychain/src/main/res/layout/actionbar_include_cancel_button.xml index 04f41d38c..5fd36286b 100644 --- a/OpenPGP-Keychain/src/main/res/layout/actionbar_include_cancel_button.xml +++ b/OpenPGP-Keychain/src/main/res/layout/actionbar_include_cancel_button.xml @@ -14,7 +14,7 @@ limitations under the License. --> - - \ No newline at end of file + \ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/res/layout/actionbar_include_done_button.xml b/OpenPGP-Keychain/src/main/res/layout/actionbar_include_done_button.xml index c39f6978e..e51f63c80 100644 --- a/OpenPGP-Keychain/src/main/res/layout/actionbar_include_done_button.xml +++ b/OpenPGP-Keychain/src/main/res/layout/actionbar_include_done_button.xml @@ -14,7 +14,7 @@ limitations under the License. --> - - \ No newline at end of file + \ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/res/layout/decrypt_activity.xml b/OpenPGP-Keychain/src/main/res/layout/decrypt_activity.xml index 22e8192f2..c56ba130e 100644 --- a/OpenPGP-Keychain/src/main/res/layout/decrypt_activity.xml +++ b/OpenPGP-Keychain/src/main/res/layout/decrypt_activity.xml @@ -5,11 +5,16 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - + + + android:fillViewport="true"> + diff --git a/OpenPGP-Keychain/src/main/res/layout/drawer_list.xml b/OpenPGP-Keychain/src/main/res/layout/drawer_list.xml index 6454b3333..18210afc5 100644 --- a/OpenPGP-Keychain/src/main/res/layout/drawer_list.xml +++ b/OpenPGP-Keychain/src/main/res/layout/drawer_list.xml @@ -12,6 +12,7 @@ android:layout_width="240dp" android:layout_height="match_parent" android:layout_gravity="start" + android:background="#fff" android:choiceMode="singleChoice" android:divider="@color/bg_gray" android:dividerHeight="1dp" /> diff --git a/OpenPGP-Keychain/src/main/res/layout/edit_key_user_id_item.xml b/OpenPGP-Keychain/src/main/res/layout/edit_key_user_id_item.xml index 437e5ebaf..663949d8e 100644 --- a/OpenPGP-Keychain/src/main/res/layout/edit_key_user_id_item.xml +++ b/OpenPGP-Keychain/src/main/res/layout/edit_key_user_id_item.xml @@ -71,8 +71,7 @@ android:id="@+id/comment" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_weight="1" - android:inputType="text"/> + android:layout_weight="1" /> diff --git a/OpenPGP-Keychain/src/main/res/layout/key_server_editor.xml b/OpenPGP-Keychain/src/main/res/layout/key_server_editor.xml index 950978a0e..058a43eaf 100644 --- a/OpenPGP-Keychain/src/main/res/layout/key_server_editor.xml +++ b/OpenPGP-Keychain/src/main/res/layout/key_server_editor.xml @@ -13,7 +13,7 @@ diff --git a/OpenPGP-Keychain/src/main/res/layout/key_server_preference.xml b/OpenPGP-Keychain/src/main/res/layout/key_server_preference.xml index eddbe3cbf..4a09e4240 100644 --- a/OpenPGP-Keychain/src/main/res/layout/key_server_preference.xml +++ b/OpenPGP-Keychain/src/main/res/layout/key_server_preference.xml @@ -14,7 +14,7 @@ android:orientation="horizontal" > Für diese Benutzer-IDs wurden keine öffentlichen Schlüssel gefunden: Für diese Benutzer-IDs existieren mehrere öffentliche Schlüssel: Bitte die Liste der Empfänger überprüfen! - Signaturüberprüfung fehlgeschlagen! Haben Sie diese App von einer anderen Quelle installiert? Wenn Sie eine Attacke ausschließen können, sollten Sie die Registrierung der App in OpenKeychain widerrufen und die App erneut registrieren. + Signaturüberprüfung fehlgeschlagen! Haben Sie diese App von einer anderen Quelle installiert? Wenn Sie eine Attacke ausschliessen können, sollten Sie die Registrierung der App in OpenKeychain widerrufen und die App erneut registrieren. Über QR Code teilen Mit \'Weiter\' durch alle QR-Codes gehen und diese nacheinander scannen. diff --git a/OpenPGP-Keychain/src/main/res/values/strings.xml b/OpenPGP-Keychain/src/main/res/values/strings.xml index 7f53fd0e4..3267115a2 100644 --- a/OpenPGP-Keychain/src/main/res/values/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values/strings.xml @@ -310,8 +310,8 @@ - Done. - Cancel + done. + cancel saving… importing… exporting… From da83c8ff60324002547854c3dd361a365df1fbfd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Mon, 10 Mar 2014 18:26:52 +0100 Subject: [PATCH 089/109] @color/white instead of hex --- OpenPGP-Keychain/src/main/res/layout/drawer_list.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenPGP-Keychain/src/main/res/layout/drawer_list.xml b/OpenPGP-Keychain/src/main/res/layout/drawer_list.xml index 18210afc5..81ceba20c 100644 --- a/OpenPGP-Keychain/src/main/res/layout/drawer_list.xml +++ b/OpenPGP-Keychain/src/main/res/layout/drawer_list.xml @@ -12,7 +12,7 @@ android:layout_width="240dp" android:layout_height="match_parent" android:layout_gravity="start" - android:background="#fff" + android:background="@color/white" android:choiceMode="singleChoice" android:divider="@color/bg_gray" android:dividerHeight="1dp" /> From 6fab8a126a6f5e71ec921d4d45f279fb16a8b7da Mon Sep 17 00:00:00 2001 From: Daniel Hammann Date: Mon, 10 Mar 2014 20:58:15 +0100 Subject: [PATCH 090/109] Reset cursor query when closing search view #386 Without focus the search result get erased. --- .../keychain/ui/KeyListPublicFragment.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java index c2b21027c..92c6262b6 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java @@ -367,6 +367,16 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer // Execute this when searching mSearchView.setOnQueryTextListener(this); + //Erase search result without focus + mSearchView.setOnQueryTextFocusChangeListener(new View.OnFocusChangeListener() { + @Override + public void onFocusChange(View v, boolean hasFocus) { + if (!hasFocus) { + mCurQuery = null; + getLoaderManager().restartLoader(0, null, KeyListPublicFragment.this); + } + } + }); super.onCreateOptionsMenu(menu, inflater); } From be41a0a3e13dde2f3f21d4c49e23285966799507 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Mon, 10 Mar 2014 22:19:43 +0100 Subject: [PATCH 091/109] Fix progress_generating and reformat --- .../service/KeychainIntentService.java | 10 +- .../service/KeychainIntentServiceHandler.java | 21 +++- .../keychain/ui/EditKeyActivity.java | 3 +- .../ui/dialog/DeleteFileDialogFragment.java | 7 +- .../ui/dialog/ProgressDialogFragment.java | 12 +- .../keychain/ui/widget/SectionView.java | 103 ++++++++++-------- 6 files changed, 94 insertions(+), 62 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java index 67ce7a395..12ad694c9 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java @@ -597,9 +597,11 @@ public class KeychainIntentService extends IntentService implements ProgressDial /* Operation */ int keysTotal = 2; - int keysCreated =0; - setProgress(getApplicationContext().getResources().getQuantityString(R.plurals.progress_generating,keysTotal), - keysCreated, keysTotal); + int keysCreated = 0; + setProgress( + getResources().getQuantityString(R.plurals.progress_generating, keysTotal), + keysCreated, + keysTotal); PgpKeyOperation keyOperations = new PgpKeyOperation(this, this); PGPSecretKey masterKey = keyOperations.createKey(Id.choice.algorithm.rsa, @@ -610,7 +612,7 @@ public class KeychainIntentService extends IntentService implements ProgressDial PGPSecretKey subKey = keyOperations.createKey(Id.choice.algorithm.rsa, 4096, passphrase, false); keysCreated++; - setProgress(keysCreated, keysTotal ); + setProgress(keysCreated, keysTotal); // TODO: default to one master for cert, one sub for encrypt and one sub // for sign diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentServiceHandler.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentServiceHandler.java index 65c756f9a..c3de39235 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentServiceHandler.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentServiceHandler.java @@ -55,6 +55,10 @@ public class KeychainIntentServiceHandler extends Handler { this.mProgressDialogFragment = progressDialogFragment; } + public KeychainIntentServiceHandler(Activity activity, String progressDialogMessage, int progressDialogStyle) { + this(activity, progressDialogMessage, progressDialogStyle, false, null); + } + public KeychainIntentServiceHandler(Activity activity, int progressDialogMessageId, int progressDialogStyle) { this(activity, progressDialogMessageId, progressDialogStyle, false, null); } @@ -62,9 +66,22 @@ public class KeychainIntentServiceHandler extends Handler { public KeychainIntentServiceHandler(Activity activity, int progressDialogMessageId, int progressDialogStyle, boolean cancelable, OnCancelListener onCancelListener) { + this(activity, + activity.getString(progressDialogMessageId), + progressDialogStyle, + cancelable, + onCancelListener); + } + + public KeychainIntentServiceHandler(Activity activity, String progressDialogMessage, + int progressDialogStyle, boolean cancelable, + OnCancelListener onCancelListener) { this.mActivity = activity; - this.mProgressDialogFragment = ProgressDialogFragment.newInstance(progressDialogMessageId, - progressDialogStyle, cancelable, onCancelListener); + this.mProgressDialogFragment = ProgressDialogFragment.newInstance( + progressDialogMessage, + progressDialogStyle, + cancelable, + onCancelListener); } public void showProgressDialog(FragmentActivity activity) { diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java index 2507a77b1..ddeb8846f 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java @@ -187,7 +187,8 @@ public class EditKeyActivity extends ActionBarActivity { // Message is received after generating is done in ApgService KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler( - this, R.string.progress_generating, ProgressDialog.STYLE_HORIZONTAL, true, + this, getResources().getQuantityString(R.plurals.progress_generating, 1), + ProgressDialog.STYLE_HORIZONTAL, true, new DialogInterface.OnCancelListener() { @Override diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteFileDialogFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteFileDialogFragment.java index c4e305984..162bf32fd 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteFileDialogFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteFileDialogFragment.java @@ -67,7 +67,7 @@ public class DeleteFileDialogFragment extends DialogFragment { alert.setMessage(this.getString(R.string.file_delete_confirmation, deleteFile)); alert.setPositiveButton(android.R.string.ok, new DialogInterface.OnClickListener() { - + @Override public void onClick(DialogInterface dialog, int id) { dismiss(); @@ -83,7 +83,10 @@ public class DeleteFileDialogFragment extends DialogFragment { intent.putExtra(KeychainIntentService.EXTRA_DATA, data); ProgressDialogFragment deletingDialog = ProgressDialogFragment.newInstance( - R.string.progress_deleting_securely, ProgressDialog.STYLE_HORIZONTAL, false, null); + getString(R.string.progress_deleting_securely), + ProgressDialog.STYLE_HORIZONTAL, + false, + null); // Message is received after deleting is done in ApgService KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(activity, deletingDialog) { diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ProgressDialogFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ProgressDialogFragment.java index 6c62d14e0..90947e42b 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ProgressDialogFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ProgressDialogFragment.java @@ -30,7 +30,7 @@ import android.view.KeyEvent; import org.sufficientlysecure.keychain.R; public class ProgressDialogFragment extends DialogFragment { - private static final String ARG_MESSAGE_ID = "message_id"; + private static final String ARG_MESSAGE = "message_id"; private static final String ARG_STYLE = "style"; private static final String ARG_CANCELABLE = "cancelable"; @@ -39,16 +39,16 @@ public class ProgressDialogFragment extends DialogFragment { /** * Creates new instance of this fragment * - * @param messageId + * @param message * @param style * @param cancelable * @return */ - public static ProgressDialogFragment newInstance(int messageId, int style, boolean cancelable, + public static ProgressDialogFragment newInstance(String message, int style, boolean cancelable, OnCancelListener onCancelListener) { ProgressDialogFragment frag = new ProgressDialogFragment(); Bundle args = new Bundle(); - args.putInt(ARG_MESSAGE_ID, messageId); + args.putString(ARG_MESSAGE, message); args.putInt(ARG_STYLE, style); args.putBoolean(ARG_CANCELABLE, cancelable); @@ -117,11 +117,11 @@ public class ProgressDialogFragment extends DialogFragment { dialog.setCancelable(false); dialog.setCanceledOnTouchOutside(false); - int messageId = getArguments().getInt(ARG_MESSAGE_ID); + String message = getArguments().getString(ARG_MESSAGE); int style = getArguments().getInt(ARG_STYLE); boolean cancelable = getArguments().getBoolean(ARG_CANCELABLE); - dialog.setMessage(getString(messageId)); + dialog.setMessage(message); dialog.setProgressStyle(style); if (cancelable) { diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java index 99622106f..0acfe13bc 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/SectionView.java @@ -80,19 +80,19 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor public void setType(int type) { mType = type; switch (type) { - case Id.type.user_id: { - mTitle.setText(R.string.section_user_ids); - break; - } + case Id.type.user_id: { + mTitle.setText(R.string.section_user_ids); + break; + } - case Id.type.key: { - mTitle.setText(R.string.section_keys); - break; - } + case Id.type.key: { + mTitle.setText(R.string.section_keys); + break; + } - default: { - break; - } + default: { + break; + } } } @@ -103,7 +103,9 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor } } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ @Override protected void onFinishInflate() { mInflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE); @@ -121,7 +123,9 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor super.onFinishInflate(); } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ public void onDeleted(Editor editor) { this.updateEditorsVisible(); } @@ -131,38 +135,40 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor mEditors.setVisibility(hasChildren ? View.VISIBLE : View.GONE); } - /** {@inheritDoc} */ + /** + * {@inheritDoc} + */ public void onClick(View v) { if (canEdit) { switch (mType) { - case Id.type.user_id: { - UserIdEditor view = (UserIdEditor) mInflater.inflate( - R.layout.edit_key_user_id_item, mEditors, false); - view.setEditorListener(this); - if (mEditors.getChildCount() == 0) { - view.setIsMainUserId(true); - } - mEditors.addView(view); - break; - } - - case Id.type.key: { - CreateKeyDialogFragment mCreateKeyDialogFragment = CreateKeyDialogFragment.newInstance(mEditors.getChildCount()); - mCreateKeyDialogFragment.setOnAlgorithmSelectedListener(new CreateKeyDialogFragment.OnAlgorithmSelectedListener() { - @Override - public void onAlgorithmSelected(Choice algorithmChoice, int keySize) { - mNewKeyAlgorithmChoice = algorithmChoice; - mNewKeySize = keySize; - createKey(); + case Id.type.user_id: { + UserIdEditor view = (UserIdEditor) mInflater.inflate( + R.layout.edit_key_user_id_item, mEditors, false); + view.setEditorListener(this); + if (mEditors.getChildCount() == 0) { + view.setIsMainUserId(true); } - }); - mCreateKeyDialogFragment.show(mActivity.getSupportFragmentManager(), "createKeyDialog"); - break; - } + mEditors.addView(view); + break; + } - default: { - break; - } + case Id.type.key: { + CreateKeyDialogFragment mCreateKeyDialogFragment = CreateKeyDialogFragment.newInstance(mEditors.getChildCount()); + mCreateKeyDialogFragment.setOnAlgorithmSelectedListener(new CreateKeyDialogFragment.OnAlgorithmSelectedListener() { + @Override + public void onAlgorithmSelected(Choice algorithmChoice, int keySize) { + mNewKeyAlgorithmChoice = algorithmChoice; + mNewKeySize = keySize; + createKey(); + } + }); + mCreateKeyDialogFragment.show(mActivity.getSupportFragmentManager(), "createKeyDialog"); + break; + } + + default: { + break; + } } this.updateEditorsVisible(); } @@ -238,13 +244,16 @@ public class SectionView extends LinearLayout implements OnClickListener, Editor intent.putExtra(KeychainIntentService.EXTRA_DATA, data); // show progress dialog - mGeneratingDialog = ProgressDialogFragment.newInstance(R.string.progress_generating, - ProgressDialog.STYLE_SPINNER, true, new DialogInterface.OnCancelListener() { - @Override - public void onCancel(DialogInterface dialog) { - mActivity.stopService(intent); - } - }); + mGeneratingDialog = ProgressDialogFragment.newInstance( + getResources().getQuantityString(R.plurals.progress_generating, 1), + ProgressDialog.STYLE_SPINNER, + true, + new DialogInterface.OnCancelListener() { + @Override + public void onCancel(DialogInterface dialog) { + mActivity.stopService(intent); + } + }); // Message is received after generating is done in ApgService KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(mActivity, From bac68c4c730ba033df411215f4982b0dd2d24b1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Mon, 10 Mar 2014 22:22:37 +0100 Subject: [PATCH 092/109] Fix progress_generating and reformat --- .../keychain/service/KeychainIntentService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java index 12ad694c9..902c66fe9 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java @@ -599,7 +599,7 @@ public class KeychainIntentService extends IntentService implements ProgressDial int keysTotal = 2; int keysCreated = 0; setProgress( - getResources().getQuantityString(R.plurals.progress_generating, keysTotal), + getApplicationContext().getResources().getQuantityString(R.plurals.progress_generating, keysTotal), keysCreated, keysTotal); PgpKeyOperation keyOperations = new PgpKeyOperation(this, this); From 59091e417ffbd8eb6d66d1ef4fe6ce2505d6577d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Mon, 10 Mar 2014 22:37:13 +0100 Subject: [PATCH 093/109] getString before init of KeychainIntentHandler --- .../keychain/helper/ExportHelper.java | 2 +- .../service/KeychainIntentServiceHandler.java | 82 ++++++++----------- .../keychain/ui/CertifyKeyActivity.java | 4 +- .../keychain/ui/DecryptActivity.java | 2 +- .../keychain/ui/EditKeyActivity.java | 2 +- .../keychain/ui/EncryptActivity.java | 2 +- .../keychain/ui/ImportKeysActivity.java | 4 +- .../keychain/ui/UploadKeyActivity.java | 2 +- .../ui/dialog/ProgressDialogFragment.java | 13 ++- 9 files changed, 50 insertions(+), 63 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ExportHelper.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ExportHelper.java index 8f2c6c83d..6aa28fec8 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ExportHelper.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ExportHelper.java @@ -139,7 +139,7 @@ public class ExportHelper { // Message is received after exporting is done in ApgService KeychainIntentServiceHandler exportHandler = new KeychainIntentServiceHandler(activity, - R.string.progress_exporting, ProgressDialog.STYLE_HORIZONTAL) { + activity.getString(R.string.progress_exporting), ProgressDialog.STYLE_HORIZONTAL) { public void handleMessage(Message message) { // handle messages by standard ApgHandler first super.handleMessage(message); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentServiceHandler.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentServiceHandler.java index c3de39235..ebc002ceb 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentServiceHandler.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentServiceHandler.java @@ -50,29 +50,17 @@ public class KeychainIntentServiceHandler extends Handler { this.mActivity = activity; } - public KeychainIntentServiceHandler(Activity activity, ProgressDialogFragment progressDialogFragment) { + public KeychainIntentServiceHandler(Activity activity, + ProgressDialogFragment progressDialogFragment) { this.mActivity = activity; this.mProgressDialogFragment = progressDialogFragment; } - public KeychainIntentServiceHandler(Activity activity, String progressDialogMessage, int progressDialogStyle) { + public KeychainIntentServiceHandler(Activity activity, String progressDialogMessage, + int progressDialogStyle) { this(activity, progressDialogMessage, progressDialogStyle, false, null); } - public KeychainIntentServiceHandler(Activity activity, int progressDialogMessageId, int progressDialogStyle) { - this(activity, progressDialogMessageId, progressDialogStyle, false, null); - } - - public KeychainIntentServiceHandler(Activity activity, int progressDialogMessageId, - int progressDialogStyle, boolean cancelable, - OnCancelListener onCancelListener) { - this(activity, - activity.getString(progressDialogMessageId), - progressDialogStyle, - cancelable, - onCancelListener); - } - public KeychainIntentServiceHandler(Activity activity, String progressDialogMessage, int progressDialogStyle, boolean cancelable, OnCancelListener onCancelListener) { @@ -100,43 +88,43 @@ public class KeychainIntentServiceHandler extends Handler { Bundle data = message.getData(); switch (message.arg1) { - case MESSAGE_OKAY: - mProgressDialogFragment.dismissAllowingStateLoss(); + case MESSAGE_OKAY: + mProgressDialogFragment.dismissAllowingStateLoss(); - break; + break; - case MESSAGE_EXCEPTION: - mProgressDialogFragment.dismissAllowingStateLoss(); + case MESSAGE_EXCEPTION: + mProgressDialogFragment.dismissAllowingStateLoss(); - // show error from service - if (data.containsKey(DATA_ERROR)) { - Toast.makeText(mActivity, - mActivity.getString(R.string.error_message, data.getString(DATA_ERROR)), - Toast.LENGTH_SHORT).show(); - } - - break; - - case MESSAGE_UPDATE_PROGRESS: - if (data.containsKey(DATA_PROGRESS) && data.containsKey(DATA_PROGRESS_MAX)) { - - // update progress from service - if (data.containsKey(DATA_MESSAGE)) { - mProgressDialogFragment.setProgress(data.getString(DATA_MESSAGE), - data.getInt(DATA_PROGRESS), data.getInt(DATA_PROGRESS_MAX)); - } else if (data.containsKey(DATA_MESSAGE_ID)) { - mProgressDialogFragment.setProgress(data.getInt(DATA_MESSAGE_ID), - data.getInt(DATA_PROGRESS), data.getInt(DATA_PROGRESS_MAX)); - } else { - mProgressDialogFragment.setProgress(data.getInt(DATA_PROGRESS), - data.getInt(DATA_PROGRESS_MAX)); + // show error from service + if (data.containsKey(DATA_ERROR)) { + Toast.makeText(mActivity, + mActivity.getString(R.string.error_message, data.getString(DATA_ERROR)), + Toast.LENGTH_SHORT).show(); } - } - break; + break; - default: - break; + case MESSAGE_UPDATE_PROGRESS: + if (data.containsKey(DATA_PROGRESS) && data.containsKey(DATA_PROGRESS_MAX)) { + + // update progress from service + if (data.containsKey(DATA_MESSAGE)) { + mProgressDialogFragment.setProgress(data.getString(DATA_MESSAGE), + data.getInt(DATA_PROGRESS), data.getInt(DATA_PROGRESS_MAX)); + } else if (data.containsKey(DATA_MESSAGE_ID)) { + mProgressDialogFragment.setProgress(data.getInt(DATA_MESSAGE_ID), + data.getInt(DATA_PROGRESS), data.getInt(DATA_PROGRESS_MAX)); + } else { + mProgressDialogFragment.setProgress(data.getInt(DATA_PROGRESS), + data.getInt(DATA_PROGRESS_MAX)); + } + } + + break; + + default: + break; } } } diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyKeyActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyKeyActivity.java index 9a56d768e..029dda1a0 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyKeyActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/CertifyKeyActivity.java @@ -230,7 +230,7 @@ public class CertifyKeyActivity extends ActionBarActivity implements // Message is received after signing is done in ApgService KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(this, - R.string.progress_signing, ProgressDialog.STYLE_SPINNER) { + getString(R.string.progress_signing), ProgressDialog.STYLE_SPINNER) { public void handleMessage(Message message) { // handle messages by standard ApgHandler first super.handleMessage(message); @@ -283,7 +283,7 @@ public class CertifyKeyActivity extends ActionBarActivity implements // Message is received after uploading is done in ApgService KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(this, - R.string.progress_exporting, ProgressDialog.STYLE_HORIZONTAL) { + getString(R.string.progress_exporting), ProgressDialog.STYLE_HORIZONTAL) { public void handleMessage(Message message) { // handle messages by standard ApgHandler first super.handleMessage(message); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java index c111ed33b..76acf15b0 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java @@ -646,7 +646,7 @@ public class DecryptActivity extends DrawerActivity { // Message is received after encrypting is done in ApgService KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(this, - R.string.progress_decrypting, ProgressDialog.STYLE_HORIZONTAL) { + getString(R.string.progress_decrypting), ProgressDialog.STYLE_HORIZONTAL) { public void handleMessage(Message message) { // handle messages by standard ApgHandler first super.handleMessage(message); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java index ddeb8846f..334fe5d3a 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java @@ -544,7 +544,7 @@ public class EditKeyActivity extends ActionBarActivity { // Message is received after saving is done in ApgService KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(this, - R.string.progress_saving, ProgressDialog.STYLE_HORIZONTAL) { + getString(R.string.progress_saving), ProgressDialog.STYLE_HORIZONTAL) { public void handleMessage(Message message) { // handle messages by standard ApgHandler first super.handleMessage(message); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java index 665035d0c..8f8952763 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java @@ -617,7 +617,7 @@ public class EncryptActivity extends DrawerActivity { // Message is received after encrypting is done in ApgService KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(this, - R.string.progress_encrypting, ProgressDialog.STYLE_HORIZONTAL) { + getString(R.string.progress_encrypting), ProgressDialog.STYLE_HORIZONTAL) { public void handleMessage(Message message) { // handle messages by standard ApgHandler first super.handleMessage(message); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java index 7e31d795e..6fd67ca65 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java @@ -362,9 +362,9 @@ public class ImportKeysActivity extends DrawerActivity implements ActionBar.OnNa // Message is received after importing is done in ApgService KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(this, - R.string.progress_importing, ProgressDialog.STYLE_HORIZONTAL) { + getString(R.string.progress_importing), ProgressDialog.STYLE_HORIZONTAL) { public void handleMessage(Message message) { - // handle messages by standard ApgHandler first + // handle messages by standard KeychainIntentServiceHandler first super.handleMessage(message); if (message.arg1 == KeychainIntentServiceHandler.MESSAGE_OKAY) { diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/UploadKeyActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/UploadKeyActivity.java index 574d837d2..6f0aaa0f0 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/UploadKeyActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/UploadKeyActivity.java @@ -102,7 +102,7 @@ public class UploadKeyActivity extends ActionBarActivity { // Message is received after uploading is done in ApgService KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(this, - R.string.progress_exporting, ProgressDialog.STYLE_HORIZONTAL) { + getString(R.string.progress_exporting), ProgressDialog.STYLE_HORIZONTAL) { public void handleMessage(Message message) { // handle messages by standard ApgHandler first super.handleMessage(message); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ProgressDialogFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ProgressDialogFragment.java index 90947e42b..b7a1882ef 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ProgressDialogFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/ProgressDialogFragment.java @@ -30,7 +30,7 @@ import android.view.KeyEvent; import org.sufficientlysecure.keychain.R; public class ProgressDialogFragment extends DialogFragment { - private static final String ARG_MESSAGE = "message_id"; + private static final String ARG_MESSAGE = "message"; private static final String ARG_STYLE = "style"; private static final String ARG_CANCELABLE = "cancelable"; @@ -128,11 +128,11 @@ public class ProgressDialogFragment extends DialogFragment { dialog.setButton(DialogInterface.BUTTON_NEGATIVE, activity.getString(R.string.progress_cancel), new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, int which) { - dialog.cancel(); - } - }); + @Override + public void onClick(DialogInterface dialog, int which) { + dialog.cancel(); + } + }); } // Disable the back button @@ -140,7 +140,6 @@ public class ProgressDialogFragment extends DialogFragment { @Override public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event) { - if (keyCode == KeyEvent.KEYCODE_BACK) { return true; } From d339029ab9b73459737c5d6409bf35c4715d0eac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Mon, 10 Mar 2014 22:40:59 +0100 Subject: [PATCH 094/109] Pull from transifex --- .../src/main/res/raw-el/help_about.html | 45 ++++++++ .../src/main/res/raw-el/help_changelog.html | 108 ++++++++++++++++++ .../src/main/res/raw-el/help_nfc_beam.html | 12 ++ .../src/main/res/raw-el/help_start.html | 19 +++ .../src/main/res/raw-el/nfc_beam_share.html | 11 ++ .../src/main/res/raw-fa-rIR/help_about.html | 45 ++++++++ .../main/res/raw-fa-rIR/help_changelog.html | 108 ++++++++++++++++++ .../main/res/raw-fa-rIR/help_nfc_beam.html | 12 ++ .../src/main/res/raw-fa-rIR/help_start.html | 19 +++ .../main/res/raw-fa-rIR/nfc_beam_share.html | 11 ++ .../src/main/res/values-de/strings.xml | 60 +++++----- .../src/main/res/values-el/strings.xml | 53 +++++++++ .../src/main/res/values-es-rCO/strings.xml | 3 +- .../src/main/res/values-es/strings.xml | 79 +++++++------ .../src/main/res/values-fa-rIR/strings.xml | 26 +++++ .../src/main/res/values-fr/strings.xml | 92 ++++++++------- .../src/main/res/values-it-rIT/strings.xml | 90 +++++++++------ .../src/main/res/values-ja/strings.xml | 85 ++++++++------ .../src/main/res/values-nl-rNL/strings.xml | 55 +++++---- .../src/main/res/values-ru/strings.xml | 81 ++++++------- .../src/main/res/values-tr/strings.xml | 24 ++-- .../src/main/res/values-uk/strings.xml | 15 +++ .../src/main/res/values-zh/strings.xml | 44 +++++-- 23 files changed, 828 insertions(+), 269 deletions(-) create mode 100644 OpenPGP-Keychain/src/main/res/raw-el/help_about.html create mode 100644 OpenPGP-Keychain/src/main/res/raw-el/help_changelog.html create mode 100644 OpenPGP-Keychain/src/main/res/raw-el/help_nfc_beam.html create mode 100644 OpenPGP-Keychain/src/main/res/raw-el/help_start.html create mode 100644 OpenPGP-Keychain/src/main/res/raw-el/nfc_beam_share.html create mode 100644 OpenPGP-Keychain/src/main/res/raw-fa-rIR/help_about.html create mode 100644 OpenPGP-Keychain/src/main/res/raw-fa-rIR/help_changelog.html create mode 100644 OpenPGP-Keychain/src/main/res/raw-fa-rIR/help_nfc_beam.html create mode 100644 OpenPGP-Keychain/src/main/res/raw-fa-rIR/help_start.html create mode 100644 OpenPGP-Keychain/src/main/res/raw-fa-rIR/nfc_beam_share.html create mode 100644 OpenPGP-Keychain/src/main/res/values-el/strings.xml create mode 100644 OpenPGP-Keychain/src/main/res/values-fa-rIR/strings.xml diff --git a/OpenPGP-Keychain/src/main/res/raw-el/help_about.html b/OpenPGP-Keychain/src/main/res/raw-el/help_about.html new file mode 100644 index 000000000..863aeee58 --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/raw-el/help_about.html @@ -0,0 +1,45 @@ + + + +

http://www.openkeychain.org

+

OpenKeychain is an OpenPGP implementation for Android.

+

License: GPLv3+

+ +

Developers OpenKeychain

+
    +
  • Dominik Schürmann (Lead developer)
  • +
  • Ash Hughes (crypto patches)
  • +
  • Brian C. Barnes
  • +
  • Bahtiar 'kalkin' Gadimov (UI)
  • + +
+

Developers APG 1.x

+
    +
  • 'Thialfihar' (Lead developer)
  • +
  • 'Senecaso' (QRCode, sign key, upload key)
  • +
  • Oliver Runge
  • +
  • Markus Doits
  • +
+

Libraries

+ + + diff --git a/OpenPGP-Keychain/src/main/res/raw-el/help_changelog.html b/OpenPGP-Keychain/src/main/res/raw-el/help_changelog.html new file mode 100644 index 000000000..abf660ba8 --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/raw-el/help_changelog.html @@ -0,0 +1,108 @@ + + + +

2.3

+
    +
  • remove unnecessary export of public keys when exporting secret key (thanks to Ash Hughes)
  • +
  • fix setting expiry dates on keys (thanks to Ash Hughes)
  • +
  • more internal fixes when editing keys (thanks to Ash Hughes)
  • +
  • querying keyservers directly from the import screen
  • +
  • fix layout and dialog style on Android 2.2-3.0
  • +
  • fix crash on keys with empty user ids
  • +
  • fix crash and empty lists when coming back from signing screen
  • +
  • Bouncy Castle (cryptography library) updated from 1.47 to 1.50 and build from source
  • +
  • fix upload of key from signing screen
  • +
+

2.2

+
    +
  • new design with navigation drawer
  • +
  • new public key list design
  • +
  • new public key view
  • +
  • bug fixes for importing of keys
  • +
  • key cross-certification (thanks to Ash Hughes)
  • +
  • handle UTF-8 passwords properly (thanks to Ash Hughes)
  • +
  • first version with new languages (thanks to the contributors on Transifex)
  • +
  • sharing of keys via QR Codes fixed and improved
  • +
  • package signature verification for API
  • +
+

2.1.1

+
    +
  • API Updates, preparation for K-9 Mail integration
  • +
+

2.1

+
    +
  • lots of bug fixes
  • +
  • new API for developers
  • +
  • PRNG bug fix by Google
  • +
+

2.0

+
    +
  • complete redesign
  • +
  • share public keys via qr codes, nfc beam
  • +
  • sign keys
  • +
  • upload keys to server
  • +
  • fixes import issues
  • +
  • new AIDL API
  • +
+

1.0.8

+
    +
  • basic keyserver support
  • +
  • app2sd
  • +
  • more choices for pass phrase cache: 1, 2, 4, 8, hours
  • +
  • translations: Norwegian (thanks, Sander Danielsen), Chinese (thanks, Zhang Fredrick)
  • +
  • bugfixes
  • +
  • optimizations
  • +
+

1.0.7

+
    +
  • fixed problem with signature verification of texts with trailing newline
  • +
  • more options for pass phrase cache time to live (20, 40, 60 mins)
  • +
+

1.0.6

+
    +
  • account adding crash on Froyo fixed
  • +
  • secure file deletion
  • +
  • option to delete key file after import
  • +
  • stream encryption/decryption (gallery, etc.)
  • +
  • new options (language, force v3 signatures)
  • +
  • interface changes
  • +
  • bugfixes
  • +
+

1.0.5

+
    +
  • German and Italian translation
  • +
  • much smaller package, due to reduced BC sources
  • +
  • new preferences GUI
  • +
  • layout adjustment for localization
  • +
  • signature bugfix
  • +
+

1.0.4

+
    +
  • fixed another crash caused by some SDK bug with query builder
  • +
+

1.0.3

+
    +
  • fixed crashes during encryption/signing and possibly key export
  • +
+

1.0.2

+
    +
  • filterable key lists
  • +
  • smarter pre-selection of encryption keys
  • +
  • new Intent handling for VIEW and SEND, allows files to be encrypted/decrypted out of file managers
  • +
  • fixes and additional features (key preselection) for K-9 Mail, new beta build available
  • +
+

1.0.1

+
    +
  • GMail account listing was broken in 1.0.0, fixed again
  • +
+

1.0.0

+
    +
  • K-9 Mail integration, APG supporting beta build of K-9 Mail
  • +
  • support of more file managers (including ASTRO)
  • +
  • Slovenian translation
  • +
  • new database, much faster, less memory usage
  • +
  • defined Intents and content provider for other apps
  • +
  • bugfixes
  • +
+ + diff --git a/OpenPGP-Keychain/src/main/res/raw-el/help_nfc_beam.html b/OpenPGP-Keychain/src/main/res/raw-el/help_nfc_beam.html new file mode 100644 index 000000000..88492731c --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/raw-el/help_nfc_beam.html @@ -0,0 +1,12 @@ + + + +

How to receive keys

+
    +
  1. Go to your partners contacts and open the contact you want to share.
  2. +
  3. Hold the two devices back to back (they have to be almost touching) and you’ll feel a vibration.
  4. +
  5. After it vibrates you’ll see the content on your partners device turn into a card-like object with Star Trek warp speed-looking animation in the background.
  6. +
  7. Tap the card and the content will then load on the your device.
  8. +
+ + diff --git a/OpenPGP-Keychain/src/main/res/raw-el/help_start.html b/OpenPGP-Keychain/src/main/res/raw-el/help_start.html new file mode 100644 index 000000000..3a6443a2f --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/raw-el/help_start.html @@ -0,0 +1,19 @@ + + + +

Getting started

+

First you need a personal key pair. Create one via the option menus in "My Keys" or import existing key pairs via "Import Keys". Afterwards, you can download your friends' keys or exchange them via QR Codes or NFC.

+ +

It is recommended that you install OI File Manager for enhanced file selection and Barcode Scanner to scan generated QR Codes. Clicking on the links will open Google Play Store or F-Droid for installation.

+ +

I found a bug in OpenKeychain!

+

Please report the bug using the issue tracker of OpenKeychain.

+ +

Contribute

+

If you want to help us developing OpenKeychain by contributing code follow our small guide on Github.

+ +

Translations

+

Help translating OpenKeychain! Everybody can participate at OpenKeychain on Transifex.

+ + + diff --git a/OpenPGP-Keychain/src/main/res/raw-el/nfc_beam_share.html b/OpenPGP-Keychain/src/main/res/raw-el/nfc_beam_share.html new file mode 100644 index 000000000..083e055c7 --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/raw-el/nfc_beam_share.html @@ -0,0 +1,11 @@ + + + +
    +
  1. Make sure that NFC is turned on in Settings > More > NFC and make sure that Android Beam is also on in the same section.
  2. +
  3. Hold the two devices back to back (they have to be almost touching) and you'll feel a vibration.
  4. +
  5. After it vibrates you'll see the content on your device turn into a card-like object with Star Trek warp speed-looking animation in the background.
  6. +
  7. Tap the card and the content will then load on the other person’s device.
  8. +
+ + diff --git a/OpenPGP-Keychain/src/main/res/raw-fa-rIR/help_about.html b/OpenPGP-Keychain/src/main/res/raw-fa-rIR/help_about.html new file mode 100644 index 000000000..863aeee58 --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/raw-fa-rIR/help_about.html @@ -0,0 +1,45 @@ + + + +

http://www.openkeychain.org

+

OpenKeychain is an OpenPGP implementation for Android.

+

License: GPLv3+

+ +

Developers OpenKeychain

+
    +
  • Dominik Schürmann (Lead developer)
  • +
  • Ash Hughes (crypto patches)
  • +
  • Brian C. Barnes
  • +
  • Bahtiar 'kalkin' Gadimov (UI)
  • + +
+

Developers APG 1.x

+
    +
  • 'Thialfihar' (Lead developer)
  • +
  • 'Senecaso' (QRCode, sign key, upload key)
  • +
  • Oliver Runge
  • +
  • Markus Doits
  • +
+

Libraries

+ + + diff --git a/OpenPGP-Keychain/src/main/res/raw-fa-rIR/help_changelog.html b/OpenPGP-Keychain/src/main/res/raw-fa-rIR/help_changelog.html new file mode 100644 index 000000000..abf660ba8 --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/raw-fa-rIR/help_changelog.html @@ -0,0 +1,108 @@ + + + +

2.3

+
    +
  • remove unnecessary export of public keys when exporting secret key (thanks to Ash Hughes)
  • +
  • fix setting expiry dates on keys (thanks to Ash Hughes)
  • +
  • more internal fixes when editing keys (thanks to Ash Hughes)
  • +
  • querying keyservers directly from the import screen
  • +
  • fix layout and dialog style on Android 2.2-3.0
  • +
  • fix crash on keys with empty user ids
  • +
  • fix crash and empty lists when coming back from signing screen
  • +
  • Bouncy Castle (cryptography library) updated from 1.47 to 1.50 and build from source
  • +
  • fix upload of key from signing screen
  • +
+

2.2

+
    +
  • new design with navigation drawer
  • +
  • new public key list design
  • +
  • new public key view
  • +
  • bug fixes for importing of keys
  • +
  • key cross-certification (thanks to Ash Hughes)
  • +
  • handle UTF-8 passwords properly (thanks to Ash Hughes)
  • +
  • first version with new languages (thanks to the contributors on Transifex)
  • +
  • sharing of keys via QR Codes fixed and improved
  • +
  • package signature verification for API
  • +
+

2.1.1

+
    +
  • API Updates, preparation for K-9 Mail integration
  • +
+

2.1

+
    +
  • lots of bug fixes
  • +
  • new API for developers
  • +
  • PRNG bug fix by Google
  • +
+

2.0

+
    +
  • complete redesign
  • +
  • share public keys via qr codes, nfc beam
  • +
  • sign keys
  • +
  • upload keys to server
  • +
  • fixes import issues
  • +
  • new AIDL API
  • +
+

1.0.8

+
    +
  • basic keyserver support
  • +
  • app2sd
  • +
  • more choices for pass phrase cache: 1, 2, 4, 8, hours
  • +
  • translations: Norwegian (thanks, Sander Danielsen), Chinese (thanks, Zhang Fredrick)
  • +
  • bugfixes
  • +
  • optimizations
  • +
+

1.0.7

+
    +
  • fixed problem with signature verification of texts with trailing newline
  • +
  • more options for pass phrase cache time to live (20, 40, 60 mins)
  • +
+

1.0.6

+
    +
  • account adding crash on Froyo fixed
  • +
  • secure file deletion
  • +
  • option to delete key file after import
  • +
  • stream encryption/decryption (gallery, etc.)
  • +
  • new options (language, force v3 signatures)
  • +
  • interface changes
  • +
  • bugfixes
  • +
+

1.0.5

+
    +
  • German and Italian translation
  • +
  • much smaller package, due to reduced BC sources
  • +
  • new preferences GUI
  • +
  • layout adjustment for localization
  • +
  • signature bugfix
  • +
+

1.0.4

+
    +
  • fixed another crash caused by some SDK bug with query builder
  • +
+

1.0.3

+
    +
  • fixed crashes during encryption/signing and possibly key export
  • +
+

1.0.2

+
    +
  • filterable key lists
  • +
  • smarter pre-selection of encryption keys
  • +
  • new Intent handling for VIEW and SEND, allows files to be encrypted/decrypted out of file managers
  • +
  • fixes and additional features (key preselection) for K-9 Mail, new beta build available
  • +
+

1.0.1

+
    +
  • GMail account listing was broken in 1.0.0, fixed again
  • +
+

1.0.0

+
    +
  • K-9 Mail integration, APG supporting beta build of K-9 Mail
  • +
  • support of more file managers (including ASTRO)
  • +
  • Slovenian translation
  • +
  • new database, much faster, less memory usage
  • +
  • defined Intents and content provider for other apps
  • +
  • bugfixes
  • +
+ + diff --git a/OpenPGP-Keychain/src/main/res/raw-fa-rIR/help_nfc_beam.html b/OpenPGP-Keychain/src/main/res/raw-fa-rIR/help_nfc_beam.html new file mode 100644 index 000000000..88492731c --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/raw-fa-rIR/help_nfc_beam.html @@ -0,0 +1,12 @@ + + + +

How to receive keys

+
    +
  1. Go to your partners contacts and open the contact you want to share.
  2. +
  3. Hold the two devices back to back (they have to be almost touching) and you’ll feel a vibration.
  4. +
  5. After it vibrates you’ll see the content on your partners device turn into a card-like object with Star Trek warp speed-looking animation in the background.
  6. +
  7. Tap the card and the content will then load on the your device.
  8. +
+ + diff --git a/OpenPGP-Keychain/src/main/res/raw-fa-rIR/help_start.html b/OpenPGP-Keychain/src/main/res/raw-fa-rIR/help_start.html new file mode 100644 index 000000000..f8c255232 --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/raw-fa-rIR/help_start.html @@ -0,0 +1,19 @@ + + + +

شروع کار

+

اول شما نیاز به یک جفت کلید شخصی دارید. از طریق منوها در "کلیدهای من" بسازید و یا از طریق"واردات کلیدهای" جفت کلیدهای موجود را وارد کنید. پس از آن، شما می توانید کلید های دوستان خود را دانلود کنید و یا آنها را از طریق کدهای QR یا NFC رد و بدل کنید.

+ +

It is recommended that you install OI File Manager for enhanced file selection and Barcode Scanner to scan generated QR Codes. Clicking on the links will open Google Play Store or F-Droid for installation.

+ +

I found a bug in OpenKeychain!

+

Please report the bug using the issue tracker of OpenKeychain.

+ +

هم بخشی کردن

+

If you want to help us developing OpenKeychain by contributing code follow our small guide on Github.

+ +

ترجمه ها

+

Help translating OpenKeychain! Everybody can participate at OpenKeychain on Transifex.

+ + + diff --git a/OpenPGP-Keychain/src/main/res/raw-fa-rIR/nfc_beam_share.html b/OpenPGP-Keychain/src/main/res/raw-fa-rIR/nfc_beam_share.html new file mode 100644 index 000000000..083e055c7 --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/raw-fa-rIR/nfc_beam_share.html @@ -0,0 +1,11 @@ + + + +
    +
  1. Make sure that NFC is turned on in Settings > More > NFC and make sure that Android Beam is also on in the same section.
  2. +
  3. Hold the two devices back to back (they have to be almost touching) and you'll feel a vibration.
  4. +
  5. After it vibrates you'll see the content on your device turn into a card-like object with Star Trek warp speed-looking animation in the background.
  6. +
  7. Tap the card and the content will then load on the other person’s device.
  8. +
+ + diff --git a/OpenPGP-Keychain/src/main/res/values-de/strings.xml b/OpenPGP-Keychain/src/main/res/values-de/strings.xml index ea1e550e3..dcb21dea3 100644 --- a/OpenPGP-Keychain/src/main/res/values-de/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-de/strings.xml @@ -13,9 +13,8 @@ Einstellungen Registrierte Anwendungen Schlüsselserver - Passwort ändern Passwort setzen - E-Mail senden… + E-Mail senden... In eine Datei verschlüsseln In eine Datei entschlüsseln Schlüssel importieren @@ -163,7 +162,7 @@ DSA ElGamal RSA - Öffnen… + Öffnen... Warnung Fehler Fehler: %s @@ -273,40 +272,41 @@ fertig. - speichern… - importieren… - exportieren… - erstelle Schlüssel, dies kann bis zu 3 Minuten dauern… - erstelle Schlüssel… - Hauptschlüssel wird vorbereitet… - Hauptschlüssel wird beglaubigt… - erstelle Hauptring… - füge Unterschlüssel hinzu… - Schlüssel wird gespeichert… + Abbrechen + speichern... + importieren... + exportieren... + erstelle Schlüssel, dies kann bis zu 3 Minuten dauern... + erstelle Schlüssel... + Hauptschlüssel wird vorbereitet... + Hauptschlüssel wird beglaubigt... + erstelle Hauptring... + füge Unterschlüssel hinzu... + Schlüssel wird gespeichert... Schlüssel wird exportiert… Schlüssel werden exportiert… - extrahiere Signaturschlüssel… - extrahiere Schlüssel… - Datenstrom wird vorbereitet… - Daten werden verschlüsselt… - Daten werden entschlüsselt… - Signatur wird vorbereitet… - Signatur wird erstellt… - Signatur wird verarbeitet… - Signatur wird verifiziert… - signiere… - Daten werden gelesen… - Schlüssel wird gesucht… - Daten werden entpackt… - Integrität wird überprüft… - \'%s\' wird sicher gelöscht… - Anfrage wird gestellt… + extrahiere Signaturschlüssel... + extrahiere Schlüssel... + Datenstrom wird vorbereitet... + Daten werden verschlüsselt... + Daten werden entschlüsselt... + Signatur wird vorbereitet... + Signatur wird erstellt... + Signatur wird verarbeitet... + Signatur wird verifiziert... + signiere... + Daten werden gelesen... + Schlüssel wird gesucht... + Daten werden entpackt... + Integrität wird überprüft... + \'%s\' wird sicher gelöscht... + Anfrage wird gestellt... Öffentliche Schlüssel suchen Private Schlüssel suchen - Teile Schlüssel über… + Teile Schlüssel über... 512 1024 diff --git a/OpenPGP-Keychain/src/main/res/values-el/strings.xml b/OpenPGP-Keychain/src/main/res/values-el/strings.xml new file mode 100644 index 000000000..84b39c221 --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/values-el/strings.xml @@ -0,0 +1,53 @@ + + + + Επιλογή Δημόσιου Κλειδιού + Επιλογή Ιδιωτικού Κλειδιού + Κωδικός + Δημιουργία Κλειδιού + Επεξεργασία Κλειδιού + Επιλογές + + + Υπόγραψε + Αποθήκευση + Ακύρωση + Διαγραφή + Κανένα + ΟΚ + Αλλαγή κωδικού + Επέλεξε Κωδικό + + Διαγραφής κλειδιού + Δημιουργίας κλειδιού + + Υπόγραψε + Μήνυμα + Αρχείο + Κωδικός + Ξανά + Αλγόριθμος + Αλγόριθμος κρυπτογράφησης + Δημόσιο κλειδί + Κωδικός + Μέγεθος κλειδιού + Ηλεκτρονικό ταχυδρομίο + + + + + + + + + + + + + + + + + diff --git a/OpenPGP-Keychain/src/main/res/values-es-rCO/strings.xml b/OpenPGP-Keychain/src/main/res/values-es-rCO/strings.xml index d1f0bd75b..41dc629aa 100644 --- a/OpenPGP-Keychain/src/main/res/values-es-rCO/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-es-rCO/strings.xml @@ -10,9 +10,8 @@ Editar clave Preferencias Aplicaciones registradas - Cambiar contraseña Establecer contraseña - Enviar correo electrónico… + Enviar correo electrónico... Cifrar a archivo Descifrar a archivo Importar claves diff --git a/OpenPGP-Keychain/src/main/res/values-es/strings.xml b/OpenPGP-Keychain/src/main/res/values-es/strings.xml index de680337f..c643a3cd8 100644 --- a/OpenPGP-Keychain/src/main/res/values-es/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-es/strings.xml @@ -13,9 +13,9 @@ Preferencias Aplicaciones registradas Prioridad del servidor de claves - Cambiar la frase de contraseña + Cambiar frase de contraseña Establecer frase de contraseña - Enviar email… + Enviar email... Cifrar hacia archivo Descifrar hacia archivo Importar claves @@ -61,7 +61,7 @@ Siguiente Volver Portapapeles - Compartir con… + Compartir con... Buscar clave Ajustes @@ -80,10 +80,10 @@ Actualizar desde servidor de claves Cargar al servidor de claves Compartir - Compartir la huella digital… - Compartir la clave completa… - con… - con… + Compartir la huella digital... + Compartir la clave completa... + con... + con... con código QR con código QR con NFC @@ -91,7 +91,8 @@ Clave de firma Ajustes de Beam Cancelar - Cifrar hacia… + Cifrar hacia... + Seleccionar todo Firmar Mensaje @@ -125,6 +126,7 @@ Cargar clave al servidor de claves seleccionado después de la certificación Huella digital Seleccionar + Establer la fecha de vencimiento %d seleccionado %d seleccionados @@ -163,7 +165,7 @@ DSA ElGamal RSA - Abrir… + Abrir... Advertencia Error Error: %s @@ -275,40 +277,41 @@ hecho. - guardando… - importando… - exportando… - generando la clave, esto puede tardar más de 3 minutos… - construyendo la clave… - preparando la clave maestra… - certificando la clave maestra… - construyendo el anillo maestro… - añadiendo las subclaves… - guardando claves… + cancelar + guardando... + importando... + exportando... + generando la clave, esto puede tardar más de 3 minutos... + construyendo la clave... + preparando la clave maestra... + certificando la clave maestra... + construyendo el anillo maestro... + añadiendo las subclaves... + guardando claves... - exportando clave… - exportando claves… + exportando clave... + exportando claves... - extrayendo la clave de firma… - extrayendo la clave… - preparando las transmisiones… - cifrando los datos… - descifrando los datos… - preparando la firma… - generando la firma… - procesando la firma… - verificando la firma… - firmando… - leyendo los datos… - localizando la clave… - descomprimiendo los datos… - verificando la integridad… + extrayendo la clave de firma... + extrayendo la clave... + preparando las transmisiones... + cifrando los datos... + descifrando los datos... + preparando la firma... + generando la firma... + procesando la firma... + verificando la firma... + firmando... + leyendo los datos... + localizando la clave... + descomprimiendo los datos... + verificando la integridad... borrando \'%s\' de forma segura… - consultando… + consultando... Buscar claves públicas Buscar claves secretas - Compartir la clave con… + Compartir la clave con... 512 1024 @@ -374,7 +377,7 @@ 1 clave seleccionada. %d claves seleccionadas. - Aún no hay claves disponibles… + Aún no hay claves disponibles... Puedes empezar por o crear tu propia clave diff --git a/OpenPGP-Keychain/src/main/res/values-fa-rIR/strings.xml b/OpenPGP-Keychain/src/main/res/values-fa-rIR/strings.xml new file mode 100644 index 000000000..6bb115049 --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/values-fa-rIR/strings.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenPGP-Keychain/src/main/res/values-fr/strings.xml b/OpenPGP-Keychain/src/main/res/values-fr/strings.xml index aa9b59287..d99bbcd7c 100644 --- a/OpenPGP-Keychain/src/main/res/values-fr/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-fr/strings.xml @@ -13,9 +13,10 @@ Préférences Applications enregistrées Préférences du serveur de clefs - Changer la phrase de passe + Modifier la phrase de passe Définir la phrase de passe - Envoyer un courriel… + Envoyer un courriel... + Envoyer un fichier... Chiffrer vers un fichier Déchiffrer vers un fichier importer des clefs @@ -61,7 +62,7 @@ Suivant Retour Presse-papiers - Partager avec… + Partager avec... Rechercher la clef Paramètres @@ -80,10 +81,10 @@ Mettre à jour depuis le serveur de clefs Téléverser vers le serveur de clefs Partager - Partager l\'empreinte… - Partager la clef entière… - avec… - avec… + Partager l\'empreinte... + Partager la clef entière... + avec... + avec... par un code QR par un code QR par la NFC @@ -91,7 +92,8 @@ Signer la clef Paramètres Beam Annuler - Chiffrer vers… + Chiffrer vers... + Tout sélectionner Signer Message @@ -104,6 +106,7 @@ Destinataires Supprimer après le chiffrement Supprimer après le chiffrement + Partager après chiffrement Algorithme de chiffrement Algorithme de hachage Clef publique @@ -122,9 +125,12 @@ Nom Commentaire Courriel + Signer l\'ID utilisateur + Signer le courriel Téléverser la clef vers le serveur de clefs choisi après certification Empreinte Choisir + Définir une date d\'expiration %d choisie %d choisies @@ -137,6 +143,7 @@ peut signer expiré révoquée + ID utilisateur %d serveur de clefs %d serveurs de clefs @@ -163,7 +170,7 @@ DSA ElGamal RSA - Ouvrir… + Ouvrir... Avertissement Erreur Erreur : %s @@ -269,46 +276,53 @@ Requête serveur insuffisante Échec lors de l\'interrogation du serveur de clefs Trop de réponses + Le fichier n\'a pas de contenu + Une erreur générique est survenue, veuillez créer un nouveau rapport de bogue pour OpenKeychain. Veuillez le supprimer depuis l\'écran « Mes Clefs »! Veuillez les supprimer depuis l\'écran « Mes Clefs »! + + une partie du fichier chargé est un objet OpenPGP valide mais pas une clef OpenPGP + certaines parties du fichier chargé sont des objets OpenPGP valides mais pas des clefs OpenPGP + fait. - sauvegarde… - importation… - exportation… - génération de la clef, ceci peut prendre jusqu\'à 3 minutes… - assemblage de la clef… - préparation de la clef maîtresse… - certification de la clef maîtresse… - assemblage du trousseau maître… - ajout des sous-clefs… - sauvegarde de la clef… + annuler + sauvegarde... + importation... + exportation... + génération de la clef, ceci peut prendre jusqu\'à 3 minutes... + assemblage de la clef... + préparation de la clef maîtresse... + certification de la clef maîtresse... + assemblage du trousseau maître... + ajout des sous-clefs... + sauvegarde de la clef... - exportation de la clef… - exportation des clefs… + exportation de la clef... + exportation des clefs... - extraction de la clef de signature… - extraction de la clef… - préparation des flux… - chiffrement des données… - déchiffrement des données… - préparation de la signature… - génération de la signature… - traitement de la signature… - vérification de la signature… - signature… - lecture des données… - recherche de la clef… - décompression des données… - vérification de l\'intégrité… - suppression sûre de « %s »… - interrogation… + extraction de la clef de signature... + extraction de la clef... + préparation des flux... + chiffrement des données... + déchiffrement des données... + préparation de la signature... + génération de la signature... + traitement de la signature... + vérification de la signature... + signature... + lecture des données... + recherche de la clef... + décompression des données... + vérification de l\'intégrité... + suppression sûre de « %s »... + interrogation... Rechercher des clefs publiques Rechercher des clefs secrètes - Partager la clef avec… + Partager la clef avec... 512 1024 @@ -374,7 +388,7 @@ 1 clef choisie %d clefs choisies - Aucune clef encore disponible… + Aucune clef encore disponible... Vous pouvez commencer par ou créer votre propre clef diff --git a/OpenPGP-Keychain/src/main/res/values-it-rIT/strings.xml b/OpenPGP-Keychain/src/main/res/values-it-rIT/strings.xml index 825115bc9..f9e7074da 100644 --- a/OpenPGP-Keychain/src/main/res/values-it-rIT/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-it-rIT/strings.xml @@ -13,9 +13,10 @@ Preferenze App Registrate Preferenze Server delle Chiavi - Cambia Frase di Accesso + Cambia Frase Di Accesso Imposta Frase di Accesso - Invia Mail… + Invia Mail... + Invia file... Codifica File Decodifica File Importa Chiavi @@ -61,7 +62,7 @@ Prossimo Precedente Appunti - Condividi con… + Condividi con... Chiave di ricerca Impostazioni @@ -80,10 +81,10 @@ Aggiorna dal server delle chiavi Carica chiave nel server Condividi - Condivi impronta… - Condividi intera chiave… + Condivi impronta... + Condividi intera chiave... con.. - con… + con... con Codice QR con Codice QR con NFC @@ -91,7 +92,8 @@ Firma chiave Impostazioni Beam Annulla - Codifica su… + Codifica su... + Seleziona tutto Firma Messaggio @@ -104,6 +106,7 @@ Destinatari Cancella Dopo Codifica Cancella Dopo Decodifica + Condividi Dopo la Codifica Algoritmo di Codifica Algoritmo di Hash Chiave Pubblica @@ -122,9 +125,12 @@ Nome Commento Email + Firma ID Utente + Firma email Carica chiave nel server delle chiavi selezionati dopo la certificazione Impronta Seleziona + Impostare la data di scadenza %d selezionato %d selezionati @@ -137,6 +143,7 @@ puo\' firmare scaduto revocato + ID Utente %d server delle chiavi %d server delle chiavi @@ -163,7 +170,7 @@ DSA ElGamal RSA - Apri… + Apri... Attenzione Errore Errore: %s @@ -269,46 +276,53 @@ Query di server insufficiente Interrogazione del server delle chiavi fallita Troppi responsi + Il File non ha contenuti + Si è verificato un errore generico, si prega di creare una nuova segnalazione di errore per OpenKeychain. Per favore cancellala dalla schermata \'Mie Chavi\' Per favore cancellatele dalla schermata \'Mie Chavi\' + + parte del file caricato e\' un oggetto OpenPGP valido, ma non una chave OpenPGP + parti del file caricato sono oggetti OpenPGP validi, ma non chavi OpenPGP + fatto. - salvataggio… - importazione… - esportazione… - generazione chiave, richiede fino a 3 minuti… - fabbricazione chiave… - preparazione chiave principale… - certificazione chiave principale… - fabbricazione portachiavi principale… - aggiunta sottochiavi… - salvataggio chiavi… + cancella + salvataggio... + importazione... + esportazione... + generazione chiave, richiede fino a 3 minuti... + fabbricazione chiave... + preparazione chiave principale... + certificazione chiave principale... + fabbricazione portachiavi principale... + aggiunta sottochiavi... + salvataggio chiavi... - esportazione chiave… - esportazione chiavi… + esportazione chiave... + esportazione chiavi... - estrazione chiavi di firma… - estrazione chiave… - preparazione flussi… - codifica dati… - decodifica dati… - preparazione firma… - generazione firma… - elaborazione firma… - verifica firma… - firma… - lettura dati… - ricerca chiave… - decompressione dati… - verifica integrita\'… - eliminazione sicura di \'%s\'… - interrogazione… + estrazione chiavi di firma... + estrazione chiave... + preparazione flussi... + codifica dati... + decodifica dati... + preparazione firma... + generazione firma... + elaborazione firma... + verifica firma... + firma... + lettura dati... + ricerca chiave... + decompressione dati... + verifica integrita\'... + eliminazione sicura di \'%s\'... + interrogazione... Ricerca Chiavi Pubbliche Cerca Chiave Privata - Condividi chiave con… + Condividi chiave con... 512 1024 @@ -374,7 +388,7 @@ 1 chiave selezionata. %d chiavi selezionate. - Nessuna chiave disponibile… + Nessuna chiave disponibile... Puoi iniziare da o creazione della tua chiave diff --git a/OpenPGP-Keychain/src/main/res/values-ja/strings.xml b/OpenPGP-Keychain/src/main/res/values-ja/strings.xml index 97d5a72f4..e5ee5ecc0 100644 --- a/OpenPGP-Keychain/src/main/res/values-ja/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-ja/strings.xml @@ -15,7 +15,8 @@ 鍵サーバ設定 パスフレーズの変更 パスフレーズの設定 - メールの送信… + メールの送信... + ファイルの送信... 暗号化してファイルに 復号化してファイルに 鍵のインポート @@ -61,7 +62,7 @@ 戻る クリップボード - 共有… + 共有... 鍵検出 設定 @@ -80,10 +81,10 @@ 鍵サーバからの更新 鍵サーバへのアップロード 共有 - 指紋の共有… - すべての鍵の共有… - …(指紋) - …(鍵) + 指紋の共有... + すべての鍵の共有... + ...(指紋) + ...(鍵) QRコードで共有(鍵) QRコードで共有(指紋) NFCで共有 @@ -91,7 +92,8 @@ 鍵を署名 Beamの設定 キャンセル - 暗号化… + 暗号化... + すべて選択 署名 メッセージ @@ -104,6 +106,7 @@ 受信者 暗号化後に削除 復号化後に削除 + 暗号化して共有 暗号化アルゴリズム ハッシュアルゴリズム 公開鍵 @@ -122,9 +125,12 @@ 名前 コメント Eメールアドレス + 署名ユーザーID + メールを署名 証明後選択した鍵サーバに鍵をアップロード 指紋 選択 + 期限日時を設定 %d を選択 @@ -136,6 +142,7 @@ 署名可能 期限切れ 破棄 + ユーザーID %d の鍵サーバ @@ -161,7 +168,7 @@ DSA ElGamal RSA - 開く… + 開く... 注意 エラー エラー: %s @@ -261,44 +268,50 @@ サーバへのクエリーが不足しています 鍵サーバへのクエリーが失敗 レスポンスが多すぎます + ファイルに内容がありません + 一般エラーが発生しました、この新しいバグの情報をOpenKeychainプロジェクトに送ってください \'自分の鍵\'画面から削除してください! + + 読み込んだファイルのOpenPGPオブジェクト部分は正しいですが、OpenPGPの鍵ではありません + 完了。 - 保存… - インポート… - エクスポート… - 鍵の生成、3分ほどかかります… - 鍵の構築中… - 主鍵の準備中… - 主鍵の検証中… - 主鍵輪の構築中… - 副鍵の追加中… - 鍵の保存… + キャンセル + 保存... + インポート... + エクスポート... + 鍵の生成、3分ほどかかります... + 鍵の構築中... + 主鍵の準備中... + 主鍵の検証中... + 主鍵輪の構築中... + 副鍵の追加中... + 鍵の保存... - 鍵のエクスポート… + 鍵のエクスポート... - 署名鍵の取り出し中… - 鍵の取り出し中… - ストリームの準備中… - データの暗号化中… - データの復号化中… - 署名の準備中… - 署名の生成中… - 署名処理中… - 署名の検証中… - 署名中… - データ読み込み中… - 鍵検索中… - データの展開中… - 完全性の検証中… + 署名鍵の取り出し中... + 鍵の取り出し中... + ストリームの準備中... + データの暗号化中... + データの復号化中... + 署名の準備中... + 署名の生成中... + 署名処理中... + 署名の検証中... + 署名中... + データ読み込み中... + 鍵検索中... + データの展開中... + 完全性の検証中... \'%s\' を完全に削除中… - 要求中… + 要求中... 公開鍵の検索 秘密鍵の検索 - 鍵の共有… + 鍵の共有... 512 1024 @@ -362,7 +375,7 @@ %d の鍵を選択。 - すでにその鍵は存在しません… + すでにその鍵は存在しません... で始める もしくは あなた所有の鍵を作る diff --git a/OpenPGP-Keychain/src/main/res/values-nl-rNL/strings.xml b/OpenPGP-Keychain/src/main/res/values-nl-rNL/strings.xml index 863932a80..de6ba554d 100644 --- a/OpenPGP-Keychain/src/main/res/values-nl-rNL/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-nl-rNL/strings.xml @@ -10,9 +10,8 @@ Sleutel bewerken Instellingen Geregistreerde apps - Wachtwoord wijzigen Wachtwoord instellen - E-mail verzenden… + E-mail verzenden... Versleutelen naar bestand Ontsleutelen naar bestand Sleutels importeren @@ -109,7 +108,7 @@ DSA ElGamal RSA - Openen… + Openen... Waarschuwing Fout Fout: %s @@ -172,34 +171,34 @@ Niets te importeren gereed. - opslaan… - importeren… - exporteren… - sleutel maken… - hoofdsleutel voorbereiden… - hoofdsleutel certificeren… - hoofdsleutelbos maken… - sub-sleutels toevoegen… - ondertekeningssleutel uitpakken… - sleutel uitpakken… - streams voorbereiden… - gegevens versleutelen… - gegevens ontsleutelen… - handtekening voorbereiden… - handtekening genereren… - handtekening verwerken… - handtekening verifiëren… - ondertekenen… - gegevens lezen… - sleutel opzoeken… - gegevens decomprimeren… - integriteit verifiëren… - \'%s\' veilig verwijderen… - opvragen… + opslaan... + importeren... + exporteren... + sleutel maken... + hoofdsleutel voorbereiden... + hoofdsleutel certificeren... + hoofdsleutelbos maken... + sub-sleutels toevoegen... + ondertekeningssleutel uitpakken... + sleutel uitpakken... + streams voorbereiden... + gegevens versleutelen... + gegevens ontsleutelen... + handtekening voorbereiden... + handtekening genereren... + handtekening verwerken... + handtekening verifiëren... + ondertekenen... + gegevens lezen... + sleutel opzoeken... + gegevens decomprimeren... + integriteit verifiëren... + \'%s\' veilig verwijderen... + opvragen... Publieke sleutels zoeken Privésleutels zoeken - Sleutel delen met… + Sleutel delen met... 512 1024 diff --git a/OpenPGP-Keychain/src/main/res/values-ru/strings.xml b/OpenPGP-Keychain/src/main/res/values-ru/strings.xml index f69cf8789..22f676ccb 100644 --- a/OpenPGP-Keychain/src/main/res/values-ru/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-ru/strings.xml @@ -15,7 +15,7 @@ Настройки сервера ключей Изменить пароль Задать пароль - Отправить… + Отправить... Зашифровать в файл Расшифровать в файл Импорт ключей @@ -61,7 +61,7 @@ Далее Назад Буфер обмена - Поделиться… + Поделиться... Найти ключ Настройки @@ -79,9 +79,9 @@ Импорт с сервера ключей Обновить с сервера ключей Загрузить на сервер ключей - Отправить… - Отправить отпечаток… - Отправить ключ… + Отправить... + Отправить отпечаток... + Отправить ключ... Отправить Отправить QR код @@ -91,7 +91,8 @@ Подписать ключ Настройки Beam Отмена - Зашифровать…. + Зашифровать.... + Выбрать все Подписать Сообщение @@ -115,7 +116,7 @@ Серверы ключей ID ключа Создан - Годен до… + Годен до... Применение Размер ключа Основной ID пользователя @@ -125,6 +126,7 @@ После сертификации загрузить ключ на сервер Отпечаток Выбрать + Срок годности %d выбран %d выбрано @@ -165,7 +167,7 @@ DSA ElGamal RSA - Открыть… + Открыть... Внимание Ошибка Ошибка: %s @@ -284,41 +286,42 @@ готово. - сохранение… - импорт… - экспорт… - создание ключа. это может занять до 3 минут… - создание ключа… - подготовка основного ключа… - сертификация основного ключа… - создание основной связки… - добавление доп. ключей… - сохранение ключа… + отмена + сохранение... + импорт... + экспорт... + создание ключа. это может занять до 3 минут... + создание ключа... + подготовка основного ключа... + сертификация основного ключа... + создание основной связки... + добавление доп. ключей... + сохранение ключа... - экспорт ключа… - экспорт ключей… - экспорт ключей… + экспорт ключа... + экспорт ключей... + экспорт ключей... - извлечение подписи ключа… - извлечение ключа… - подготовка к передаче… - шифрование данных… - расшифровка данных… - подготовка подписи… - формирование подписи… - обработка подписи… - проверка подписи… - подписание… - чтение данных… - поиск ключа… - распаковка данных… - проверка целостности… - безопасное удаление \'%s\'… - запрос… + извлечение подписи ключа... + извлечение ключа... + подготовка к передаче... + шифрование данных... + расшифровка данных... + подготовка подписи... + формирование подписи... + обработка подписи... + проверка подписи... + подписание... + чтение данных... + поиск ключа... + распаковка данных... + проверка целостности... + безопасное удаление \'%s\'... + запрос... Найти публичные ключи Найти секретные ключи - Отправить… + Отправить... 512 1024 @@ -386,7 +389,7 @@ %d ключей выбрано. %d ключей выбрано. - У вас пока нет ключей… + У вас пока нет ключей... Но Вы можете или создать свой ключ diff --git a/OpenPGP-Keychain/src/main/res/values-tr/strings.xml b/OpenPGP-Keychain/src/main/res/values-tr/strings.xml index 4f1becaa1..5bb5225b5 100644 --- a/OpenPGP-Keychain/src/main/res/values-tr/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-tr/strings.xml @@ -76,7 +76,7 @@ DSA ElGamal RSA - Aç… + Aç... Uyarı Hata Hata: %s @@ -96,17 +96,17 @@ bozuk veri bitti. - kaydediliyor… - alıyor… - veriyor… - anahtar oluşturuluyor… - imza hazırlanıyor… - imza oluşturuluyor… - imza işleniyor… - imza doğrulanıyor… - imzalanıyor… - veri okunuyor… - anahtar bulunuyor… + kaydediliyor... + alıyor... + veriyor... + anahtar oluşturuluyor... + imza hazırlanıyor... + imza oluşturuluyor... + imza işleniyor... + imza doğrulanıyor... + imzalanıyor... + veri okunuyor... + anahtar bulunuyor... 512 diff --git a/OpenPGP-Keychain/src/main/res/values-uk/strings.xml b/OpenPGP-Keychain/src/main/res/values-uk/strings.xml index 8997ef5ce..7ccb661d3 100644 --- a/OpenPGP-Keychain/src/main/res/values-uk/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-uk/strings.xml @@ -16,6 +16,7 @@ Змінити парольну фразу Задати парольну фразу Надіслати листа… + Надіслати файл… Зашифрувати до файлу Розшифрувати до файлу Імпортувати ключі @@ -92,6 +93,7 @@ Налаштування променя Скасувати Зашифрувати… + Вибрати усе Підпис Повідомлення @@ -104,6 +106,7 @@ Отримувачі Вилучити після шифрування Вилучити після розшифрування + Поширити після шифрування Алгоритм шифрування Хеш алгоритм Публічний ключ @@ -122,9 +125,12 @@ Назва Коментар Ел. пошта + Ід підпису користувача + Підписати листа Завантажити ключ до вибраного сервера ключів після сертифікації Відбиток Вибрати + Задати термін дії %d вибраний %d вибрані @@ -138,6 +144,7 @@ можна підписати закінчився скасовано + ІД користувача %d сервер ключів %d сервери ключів @@ -277,13 +284,21 @@ Запит обмеженого сервера Збій сервера ключа запиту Забагато відповідей + Файл не має вмісту + Трапилася загальна помилка, будь ласка, створіть новий звіт про помилку для OpenKeychain. Будь ласка, вилучіть його з екрану „Мої ключі“! Будь ласка, вилучіть їх з екрану „Мої ключі“! Будь ласка, вилучіть їх з екрану „Мої ключі“! + + частина завантаженого файлу є вірним об\'єктом OpenPGP, але не ключем OpenPGP + частини завантаженого файлу є вірним об\'єктом OpenPGP, але не ключем OpenPGP + частин завантаженого файлу є вірним об\'єктом OpenPGP, але не ключем OpenPGP + готово. + cкасувати збереження… імпортується… експортується… diff --git a/OpenPGP-Keychain/src/main/res/values-zh/strings.xml b/OpenPGP-Keychain/src/main/res/values-zh/strings.xml index 5848fb8db..80413d589 100644 --- a/OpenPGP-Keychain/src/main/res/values-zh/strings.xml +++ b/OpenPGP-Keychain/src/main/res/values-zh/strings.xml @@ -1,17 +1,47 @@ + 选择公钥 + 选择私钥 加密 解密 + 密码短语 + 创建密钥 + 编辑密钥 + 参数 + 已注册应用 密钥服务器偏好 + 设置密码短语 + 发送邮件 + 加密至文件 + 解密至文件 + 导入密钥 + 导出密钥 + 导出密钥 + 无法找到密钥 查询密钥服务器 上传到密钥服务器 + 未知签名密钥 + 帮助 + 用户ID + 密钥 + 常规 + 缺省 + 高级 主密钥 密钥服务器 解密并验证 + 签名 + 解密 解密并验证 + 选择收件人 + 加密文件 + 保存 + 取消 + 删除 + 剪贴板 帮助 @@ -24,7 +54,7 @@ 复制到剪贴板 签署密钥 取消 - 加密到… + 加密到... 签署 讯息 @@ -64,7 +94,7 @@ 4小时 8小时 永远 - 打开… + 打开... 警告 错误 @@ -106,13 +136,13 @@ 错误的密语 完成。 - 保存… - 导入中… - 导出中… + 保存... + 导入中... + 导出中... 建立密钥 正在准备主密钥 - 正在验证签名… - 正在签名… + 正在验证签名... + 正在签名... 正在读取数据 正在查找密钥 正在查询 From 8fa62161df84ab7c7bcba55eb6991c6b5e26ac45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Mon, 10 Mar 2014 22:46:30 +0100 Subject: [PATCH 095/109] More fixes for KeychainIntentServiceHandler --- .../keychain/ui/ImportKeysActivity.java | 84 ++++++++++--------- 1 file changed, 43 insertions(+), 41 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java index 6fd67ca65..f04a0e227 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ImportKeysActivity.java @@ -360,51 +360,53 @@ public class ImportKeysActivity extends DrawerActivity implements ActionBar.OnNa // } - // Message is received after importing is done in ApgService - KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler(this, - getString(R.string.progress_importing), ProgressDialog.STYLE_HORIZONTAL) { - 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(); - - int added = returnData.getInt(KeychainIntentService.RESULT_IMPORT_ADDED); - int updated = returnData - .getInt(KeychainIntentService.RESULT_IMPORT_UPDATED); - int bad = returnData.getInt(KeychainIntentService.RESULT_IMPORT_BAD); - String toastMessage; - if (added > 0 && updated > 0) { - String addedStr = getResources().getQuantityString( - R.plurals.keys_added_and_updated_1, added, added); - String updatedStr = getResources().getQuantityString( - R.plurals.keys_added_and_updated_2, updated, updated); - toastMessage = addedStr + updatedStr; - } else if (added > 0) { - toastMessage = getResources().getQuantityString(R.plurals.keys_added, - added, added); - } else if (updated > 0) { - toastMessage = getResources().getQuantityString(R.plurals.keys_updated, - updated, updated); - } else { - toastMessage = getString(R.string.no_keys_added_or_updated); - } - AppMsg.makeText(ImportKeysActivity.this, toastMessage, AppMsg.STYLE_INFO) - .show(); - if (bad > 0) { - BadImportKeyDialogFragment badImportKeyDialogFragment = BadImportKeyDialogFragment.newInstance(bad); - badImportKeyDialogFragment.show(getSupportFragmentManager(), "badKeyDialog"); - } - } - } - }; - /** * Import keys with mImportData */ public void importKeys() { + // Message is received after importing is done in ApgService + KeychainIntentServiceHandler saveHandler = new KeychainIntentServiceHandler( + this, + getString(R.string.progress_importing), + ProgressDialog.STYLE_HORIZONTAL) { + 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(); + + int added = returnData.getInt(KeychainIntentService.RESULT_IMPORT_ADDED); + int updated = returnData + .getInt(KeychainIntentService.RESULT_IMPORT_UPDATED); + int bad = returnData.getInt(KeychainIntentService.RESULT_IMPORT_BAD); + String toastMessage; + if (added > 0 && updated > 0) { + String addedStr = getResources().getQuantityString( + R.plurals.keys_added_and_updated_1, added, added); + String updatedStr = getResources().getQuantityString( + R.plurals.keys_added_and_updated_2, updated, updated); + toastMessage = addedStr + updatedStr; + } else if (added > 0) { + toastMessage = getResources().getQuantityString(R.plurals.keys_added, + added, added); + } else if (updated > 0) { + toastMessage = getResources().getQuantityString(R.plurals.keys_updated, + updated, updated); + } else { + toastMessage = getString(R.string.no_keys_added_or_updated); + } + AppMsg.makeText(ImportKeysActivity.this, toastMessage, AppMsg.STYLE_INFO) + .show(); + if (bad > 0) { + BadImportKeyDialogFragment badImportKeyDialogFragment = BadImportKeyDialogFragment.newInstance(bad); + badImportKeyDialogFragment.show(getSupportFragmentManager(), "badKeyDialog"); + } + } + } + }; + if (mListFragment.getKeyBytes() != null || mListFragment.getDataUri() != null) { Log.d(Constants.TAG, "importKeys started"); From 3cad8b6248d136f21ef4bc4697feada299c8a58e Mon Sep 17 00:00:00 2001 From: uberspot Date: Tue, 11 Mar 2014 00:42:03 +0200 Subject: [PATCH 096/109] Appropriate save Icon in EditKeyActivity --- .../keychain/helper/ActionBarHelper.java | 60 ++++++++++++++++++ .../keychain/ui/EditKeyActivity.java | 2 +- .../main/res/drawable-hdpi/ic_action_save.png | Bin 0 -> 398 bytes .../main/res/drawable-mdpi/ic_action_save.png | Bin 0 -> 359 bytes .../res/drawable-xhdpi/ic_action_save.png | Bin 0 -> 451 bytes .../res/drawable-xxhdpi/ic_action_save.png | Bin 0 -> 500 bytes .../res/layout/actionbar_custom_view_save.xml | 27 ++++++++ .../actionbar_custom_view_save_cancel.xml | 29 +++++++++ .../layout/actionbar_include_save_button.xml | 36 +++++++++++ 9 files changed, 153 insertions(+), 1 deletion(-) create mode 100644 OpenPGP-Keychain/src/main/res/drawable-hdpi/ic_action_save.png create mode 100644 OpenPGP-Keychain/src/main/res/drawable-mdpi/ic_action_save.png create mode 100644 OpenPGP-Keychain/src/main/res/drawable-xhdpi/ic_action_save.png create mode 100644 OpenPGP-Keychain/src/main/res/drawable-xxhdpi/ic_action_save.png create mode 100644 OpenPGP-Keychain/src/main/res/layout/actionbar_custom_view_save.xml create mode 100644 OpenPGP-Keychain/src/main/res/layout/actionbar_custom_view_save_cancel.xml create mode 100644 OpenPGP-Keychain/src/main/res/layout/actionbar_include_save_button.xml diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ActionBarHelper.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ActionBarHelper.java index b55075e6c..6aa8e7d74 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ActionBarHelper.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ActionBarHelper.java @@ -113,4 +113,64 @@ public class ActionBarHelper { actionBar.setCustomView(customActionBarView); } + /** + * Sets custom view on ActionBar for Save activities + * + * @param actionBar + * @param saveText + * @param saveOnClickListener + */ + public static void setSaveView(ActionBar actionBar, int saveText, + OnClickListener saveOnClickListener) { + // Inflate a "Save" custom action bar view to serve as the "Up" affordance. + final LayoutInflater inflater = (LayoutInflater) actionBar.getThemedContext() + .getSystemService(Activity.LAYOUT_INFLATER_SERVICE); + final View customActionBarView = inflater + .inflate(R.layout.actionbar_custom_view_save, null); + + ((TextView) customActionBarView.findViewById(R.id.actionbar_save_text)).setText(saveText); + customActionBarView.findViewById(R.id.actionbar_save).setOnClickListener( + saveOnClickListener); + + // Show the custom action bar view and hide the normal Home icon and title. + actionBar.setDisplayShowTitleEnabled(false); + actionBar.setDisplayShowHomeEnabled(false); + actionBar.setDisplayShowCustomEnabled(true); + actionBar.setCustomView(customActionBarView); + } + + /** + * Sets custom view on ActionBar for Save/Cancel activities + * + * @param actionBar + * @param saveText + * @param saveOnClickListener + * @param cancelText + * @param cancelOnClickListener + */ + public static void setSaveCancelView(ActionBar actionBar, int saveText, + OnClickListener saveOnClickListener, int cancelText, + OnClickListener cancelOnClickListener) { + + // Inflate a "Done"/"Cancel" custom action bar view + final LayoutInflater inflater = (LayoutInflater) actionBar.getThemedContext() + .getSystemService(Activity.LAYOUT_INFLATER_SERVICE); + final View customActionBarView = inflater.inflate( + R.layout.actionbar_custom_view_save_cancel, null); + + ((TextView) customActionBarView.findViewById(R.id.actionbar_save_text)).setText(saveText); + customActionBarView.findViewById(R.id.actionbar_save).setOnClickListener( + saveOnClickListener); + ((TextView) customActionBarView.findViewById(R.id.actionbar_cancel_text)) + .setText(cancelText); + customActionBarView.findViewById(R.id.actionbar_cancel).setOnClickListener( + cancelOnClickListener); + + // Show the custom action bar view and hide the normal Home icon and title. + actionBar.setDisplayShowTitleEnabled(false); + actionBar.setDisplayShowHomeEnabled(false); + actionBar.setDisplayShowCustomEnabled(true); + actionBar.setCustomView(customActionBarView, new ActionBar.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); + } } diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java index 334fe5d3a..628f642d8 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java @@ -250,7 +250,7 @@ public class EditKeyActivity extends ActionBarActivity { */ private void handleActionEditKey(Intent intent) { // Inflate a "Done"/"Cancel" custom action bar - ActionBarHelper.setDoneView(getSupportActionBar(), R.string.btn_save, + ActionBarHelper.setSaveView(getSupportActionBar(), R.string.btn_save, new View.OnClickListener() { @Override public void onClick(View v) { diff --git a/OpenPGP-Keychain/src/main/res/drawable-hdpi/ic_action_save.png b/OpenPGP-Keychain/src/main/res/drawable-hdpi/ic_action_save.png new file mode 100644 index 0000000000000000000000000000000000000000..c4b7783ccc4eca742de2b7eca8a3e931abbcb8bb GIT binary patch literal 398 zcmV;90df9`P)pqPHqBJ2KMjBH=%-8&Z|T47fu zz)>;xq){v8;w2EFV=g^F2wwr%5TT>VWj2JX0J9-n1{feRp8*1&UC3G;c+;p7(fs&4`SW_AC4ZqJ8piQ*8TrsS9co#y2gdI1Gcizri}}-&_87%Q!S;D sHq-l-atfezV6klgK@bG3rH=pu0H2{ob7jo@O#lD@07*qoM6N<$f-EMaDF6Tf literal 0 HcmV?d00001 diff --git a/OpenPGP-Keychain/src/main/res/drawable-mdpi/ic_action_save.png b/OpenPGP-Keychain/src/main/res/drawable-mdpi/ic_action_save.png new file mode 100644 index 0000000000000000000000000000000000000000..61304a68c71248d1919e3a7f5eff3c834bf61c6b GIT binary patch literal 359 zcmV-t0hs=YP)F4>9WY`OG&VMt1yY<) z?%T6x&%PzrKqS52f%+a3QqO`zyatKA1&BAJS;7URWYF}$92y41YEX3xfMUnVaR4Cz zvb-2g48x&7kN|W913pJE(IJ{aj<6g^2jF!C6CD$L!azHKs)_JB5Z^)*dqXP+2m|9! z4U70@EMkb&tV zwj@*orU73v%~zv}1Bfw*+9A+FYPCva8)6iU0t^5UU;w40M4ufCPG|rC002ovPDHLk FV1jPxec1p2 literal 0 HcmV?d00001 diff --git a/OpenPGP-Keychain/src/main/res/drawable-xhdpi/ic_action_save.png b/OpenPGP-Keychain/src/main/res/drawable-xhdpi/ic_action_save.png new file mode 100644 index 0000000000000000000000000000000000000000..29c5f4d3b4222300a3982a6fabf0bbed8484155a GIT binary patch literal 451 zcmV;!0X+VRP)9%LkkCR z#~GY9SD=TMk~Zmcg|u)D9{^ftX+xW_WK$p~7?=tBc~7!dGAn!h_A}l!&H(@b03^y& z*NSia?tyO?>-%N_^?DSsl`K@vN-W7EhErB#l4I619M{#y;Ct^M{BwQmP zQ)tbR6yr)^nfDNIe;vH0Meie z>j%YOcp;#}9-ax3eF}yE0uX=zZ`K0!hmW~oyzknd;phR%*E<@o_Ksc)knXvwx+#+& z0uYdF8m#u?-wfmZs^=MRvq0b3ZejHq0-mSA>K$Mjk^r&*0uaC?sFD9a=>Z7{I0W=u t2a6%Fbie#r+C%mZ00000{^m!30RTljO2DMue~kbD002ovPDHLkV1f+awb=jw literal 0 HcmV?d00001 diff --git a/OpenPGP-Keychain/src/main/res/drawable-xxhdpi/ic_action_save.png b/OpenPGP-Keychain/src/main/res/drawable-xxhdpi/ic_action_save.png new file mode 100644 index 0000000000000000000000000000000000000000..744350049a886da8655ef443ea272a03ed31249e GIT binary patch literal 500 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD1|%QND7OGok|nMYCBgY=CFO}lsSJ)O`AMk? zp1FzXsX?iUDV2pMQ*9U+7^iu~$GtHLn+>uQ1fCtZdO<(qcG=yB z8_o+Hx-MZQbGur&ynKI6P2bx;CvMJrdf=SRvAgRIFFapp-TP#b_d)wV7ne`hcxW4* zEXI8PzV8Mt8&}TRT1E=VH$50{ezW+xHQm!wXqL>(4QrmP+S7Y`*YV2h%*GEN35oG` zO;cv#@>W=|fdxDD&yk5y)R}>irGbGdphK%}0;i(P<98a&4h=$A`g7-OvhP`Pezhgn zjUCsfDlj=PFe)TWJAC0w-LsvWZY;Sj^?tdM!d{i?Rhqx-U(4}%O{iwzP+(vYU|{k& z@=7YXT=iVwHzNm5CdPM+H?#7p^tOoCNrKF1U=T=a$O&k}uBtL)x1YZAk16`-XBjEwnC7CLM@{~b!%bYmdKI;Vst03?yYO#lD@ literal 0 HcmV?d00001 diff --git a/OpenPGP-Keychain/src/main/res/layout/actionbar_custom_view_save.xml b/OpenPGP-Keychain/src/main/res/layout/actionbar_custom_view_save.xml new file mode 100644 index 000000000..f0dcf177c --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/layout/actionbar_custom_view_save.xml @@ -0,0 +1,27 @@ + + + + + + + \ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/res/layout/actionbar_custom_view_save_cancel.xml b/OpenPGP-Keychain/src/main/res/layout/actionbar_custom_view_save_cancel.xml new file mode 100644 index 000000000..ba08a7714 --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/layout/actionbar_custom_view_save_cancel.xml @@ -0,0 +1,29 @@ + + + + + + + + + \ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/res/layout/actionbar_include_save_button.xml b/OpenPGP-Keychain/src/main/res/layout/actionbar_include_save_button.xml new file mode 100644 index 000000000..86c59dcc5 --- /dev/null +++ b/OpenPGP-Keychain/src/main/res/layout/actionbar_include_save_button.xml @@ -0,0 +1,36 @@ + + + + + + + \ No newline at end of file From 506782b6890c2aa41adf0042d64c0f24e28975f1 Mon Sep 17 00:00:00 2001 From: Daniel Hammann Date: Tue, 11 Mar 2014 00:07:53 +0100 Subject: [PATCH 097/109] OnFocusChangeListener replaced with OnActionExpandListener For same behaviour like contacts app #386 #387 --- .../keychain/ui/KeyListPublicFragment.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java index 92c6262b6..707001de9 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java @@ -368,13 +368,17 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer mSearchView.setOnQueryTextListener(this); //Erase search result without focus - mSearchView.setOnQueryTextFocusChangeListener(new View.OnFocusChangeListener() { + MenuItemCompat.setOnActionExpandListener(searchItem, new MenuItemCompat.OnActionExpandListener() { @Override - public void onFocusChange(View v, boolean hasFocus) { - if (!hasFocus) { - mCurQuery = null; - getLoaderManager().restartLoader(0, null, KeyListPublicFragment.this); - } + public boolean onMenuItemActionExpand(MenuItem item) { + return true; + } + + @Override + public boolean onMenuItemActionCollapse(MenuItem item) { + mCurQuery = null; + getLoaderManager().restartLoader(0, null, KeyListPublicFragment.this); + return true; } }); From dc865427e3d2ce539c9c989ab7b08d77f77de287 Mon Sep 17 00:00:00 2001 From: Sreeram Boyapati Date: Tue, 11 Mar 2014 04:50:15 +0530 Subject: [PATCH 098/109] linear layout edited to display test horizontally --- .../main/res/layout/select_secret_key_layout_fragment.xml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/OpenPGP-Keychain/src/main/res/layout/select_secret_key_layout_fragment.xml b/OpenPGP-Keychain/src/main/res/layout/select_secret_key_layout_fragment.xml index 9b92a373a..2b60555b7 100644 --- a/OpenPGP-Keychain/src/main/res/layout/select_secret_key_layout_fragment.xml +++ b/OpenPGP-Keychain/src/main/res/layout/select_secret_key_layout_fragment.xml @@ -3,7 +3,7 @@ xmlns:bootstrapbutton="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" - android:orientation="vertical" > + android:orientation="horizontal" > @@ -57,6 +59,7 @@ android:layout_gravity="left" android:ellipsize="end" android:singleLine="true" + android:layout_marginRight="5dip" android:text="" android:visibility="gone" android:textAppearance="?android:attr/textAppearanceSmall" /> From 50ed5db001ccff0efe9c1e0b121f4292b7be1e7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Tue, 11 Mar 2014 00:28:28 +0100 Subject: [PATCH 099/109] cleanup --- .../keychain/ui/KeyListPublicFragment.java | 2 +- .../ui/SelectSecretKeyLayoutFragment.java | 74 +++++++++---------- 2 files changed, 35 insertions(+), 41 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java index 707001de9..c62695417 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java @@ -367,7 +367,7 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer // Execute this when searching mSearchView.setOnQueryTextListener(this); - //Erase search result without focus + // Erase search result without focus MenuItemCompat.setOnActionExpandListener(searchItem, new MenuItemCompat.OnActionExpandListener() { @Override public boolean onMenuItemActionExpand(MenuItem item) { diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectSecretKeyLayoutFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectSecretKeyLayoutFragment.java index ca5d8b262..c9129285e 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectSecretKeyLayoutFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectSecretKeyLayoutFragment.java @@ -71,50 +71,44 @@ public class SelectSecretKeyLayoutFragment extends Fragment { mKeyUserIdRest.setVisibility(View.GONE); } else { - String uid = getResources().getString(R.string.user_id_no_name); - String uidExtra = ""; - String masterkeyIdHex = ""; - PGPSecretKeyRing keyRing = ProviderHelper.getPGPSecretKeyRingByMasterKeyId( getActivity(), secretKeyId); if (keyRing != null) { PGPSecretKey key = PgpKeyHelper.getMasterKey(keyRing); - masterkeyIdHex = PgpKeyHelper.convertKeyIdToHex(secretKeyId); + String masterkeyIdHex = PgpKeyHelper.convertKeyIdToHex(secretKeyId); if (key != null) { String userId = PgpKeyHelper.getMainUserIdSafe(getActivity(), key); - /*String chunks[] = mUserId.split(" <", 2); - uid = chunks[0]; - if (chunks.length > 1) { - uidExtra = "<" + chunks[1]; - }*/ + String[] userIdSplit = PgpKeyHelper.splitUserId(userId); - String userName, userEmail; + String userName, userEmail; - if (userIdSplit[0] != null) { userName = userIdSplit[0]; } - else { userName = getActivity().getResources().getString(R.string.user_id_no_name); } + if (userIdSplit[0] != null) { + userName = userIdSplit[0]; + } else { + userName = getActivity().getResources().getString(R.string.user_id_no_name); + } - if (userIdSplit[1] != null) { userEmail = userIdSplit[1]; } - else { userEmail = getActivity().getResources().getString(R.string.error_user_id_no_email); } + if (userIdSplit[1] != null) { + userEmail = userIdSplit[1]; + } else { + userEmail = getActivity().getResources().getString(R.string.error_user_id_no_email); + } mKeyMasterKeyIdHex.setText(masterkeyIdHex); mKeyUserId.setText(userName); mKeyUserIdRest.setText(userEmail); mKeyUserId.setVisibility(View.VISIBLE); mKeyUserIdRest.setVisibility(View.VISIBLE); - } - else{ + } else { mKeyMasterKeyIdHex.setText(getActivity().getResources().getString(R.string.no_key)); mKeyUserId.setVisibility(View.GONE); mKeyUserIdRest.setVisibility(View.GONE); - } - - } - else{ - mKeyMasterKeyIdHex.setText(getActivity().getResources().getString(R.string.no_keys_added_or_updated)+" for master id: "+secretKeyId); - mKeyUserId.setVisibility(View.GONE); - mKeyUserIdRest.setVisibility(View.GONE); + } else { + mKeyMasterKeyIdHex.setText(getActivity().getResources().getString(R.string.no_keys_added_or_updated) + " for master id: " + secretKeyId); + mKeyUserId.setVisibility(View.GONE); + mKeyUserIdRest.setVisibility(View.GONE); } } @@ -154,31 +148,31 @@ public class SelectSecretKeyLayoutFragment extends Fragment { startActivityForResult(intent, REQUEST_CODE_SELECT_KEY); } - //Select Secret Key Activity delivers the intent which was sent by it using interface to Select + // Select Secret Key Activity delivers the intent which was sent by it using interface to Select // Secret Key Fragment.Intent contains Master Key Id, User Email, User Name, Master Key Id Hex. @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode & 0xFFFF) { - case REQUEST_CODE_SELECT_KEY: { - long secretKeyId; - if (resultCode == Activity.RESULT_OK) { - Bundle bundle = data.getExtras(); - secretKeyId = bundle.getLong(SelectSecretKeyActivity.RESULT_EXTRA_MASTER_KEY_ID); - selectKey(secretKeyId); + case REQUEST_CODE_SELECT_KEY: { + long secretKeyId; + if (resultCode == Activity.RESULT_OK) { + Bundle bundle = data.getExtras(); + secretKeyId = bundle.getLong(SelectSecretKeyActivity.RESULT_EXTRA_MASTER_KEY_ID); + selectKey(secretKeyId); - // remove displayed errors - mKeyUserId.setError(null); + // remove displayed errors + mKeyUserId.setError(null); - // give value back to callback - mCallback.onKeySelected(secretKeyId); + // give value back to callback + mCallback.onKeySelected(secretKeyId); + } + break; } - break; - } - default: - super.onActivityResult(requestCode, resultCode, data); + default: + super.onActivityResult(requestCode, resultCode, data); - break; + break; } } } From c9b117b7068d471c5ea74b4e21d44684a31e4df6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Tue, 11 Mar 2014 00:31:13 +0100 Subject: [PATCH 100/109] more tight layout --- .../select_secret_key_layout_fragment.xml | 22 +++++++++---------- 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/OpenPGP-Keychain/src/main/res/layout/select_secret_key_layout_fragment.xml b/OpenPGP-Keychain/src/main/res/layout/select_secret_key_layout_fragment.xml index 2b60555b7..1141091a3 100644 --- a/OpenPGP-Keychain/src/main/res/layout/select_secret_key_layout_fragment.xml +++ b/OpenPGP-Keychain/src/main/res/layout/select_secret_key_layout_fragment.xml @@ -3,7 +3,7 @@ xmlns:bootstrapbutton="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="wrap_content" - android:orientation="horizontal" > + android:orientation="horizontal"> + android:paddingLeft="4dp"> - - + From d93731701255e082b02bf80c5c029db8838b15b0 Mon Sep 17 00:00:00 2001 From: uberspot Date: Tue, 11 Mar 2014 01:50:17 +0200 Subject: [PATCH 101/109] Remove duplicate code from ActionBarHelper. You can now set the drawables via the method calls --- .../keychain/helper/ActionBarHelper.java | 107 +++++------------- .../service/remote/AppSettingsActivity.java | 2 +- .../service/remote/RemoteServiceActivity.java | 10 +- .../keychain/ui/EditKeyActivity.java | 10 +- .../ui/PreferencesKeyServerActivity.java | 4 +- .../keychain/ui/SelectPublicKeyActivity.java | 4 +- .../res/layout/actionbar_custom_view_save.xml | 27 ----- .../actionbar_custom_view_save_cancel.xml | 29 ----- .../layout/actionbar_include_save_button.xml | 36 ------ 9 files changed, 42 insertions(+), 187 deletions(-) delete mode 100644 OpenPGP-Keychain/src/main/res/layout/actionbar_custom_view_save.xml delete mode 100644 OpenPGP-Keychain/src/main/res/layout/actionbar_custom_view_save_cancel.xml delete mode 100644 OpenPGP-Keychain/src/main/res/layout/actionbar_include_save_button.xml diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ActionBarHelper.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ActionBarHelper.java index 6aa8e7d74..2276e0f8a 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ActionBarHelper.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ActionBarHelper.java @@ -22,6 +22,7 @@ import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.util.Log; import android.app.Activity; +import android.graphics.drawable.Drawable; import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBarActivity; import android.view.LayoutInflater; @@ -56,28 +57,33 @@ public class ActionBarHelper { * Sets custom view on ActionBar for Done/Cancel activities * * @param actionBar - * @param doneText - * @param doneOnClickListener - * @param cancelText - * @param cancelOnClickListener + * @param firstText + * @param firstDrawableId + * @param firstOnClickListener + * @param secondText + * @param secondDrawableId + * @param secondOnClickListener */ - public static void setDoneCancelView(ActionBar actionBar, int doneText, - OnClickListener doneOnClickListener, int cancelText, - OnClickListener cancelOnClickListener) { + public static void setTwoButtonView(ActionBar actionBar, int firstText, int firstDrawableId, + OnClickListener firstOnClickListener, int secondText, int secondDrawableId, + OnClickListener secondOnClickListener) { - // Inflate a "Done"/"Cancel" custom action bar view + // Inflate the custom action bar view final LayoutInflater inflater = (LayoutInflater) actionBar.getThemedContext() .getSystemService(Activity.LAYOUT_INFLATER_SERVICE); final View customActionBarView = inflater.inflate( R.layout.actionbar_custom_view_done_cancel, null); - ((TextView) customActionBarView.findViewById(R.id.actionbar_done_text)).setText(doneText); + TextView firstTextView = ((TextView) customActionBarView.findViewById(R.id.actionbar_done_text)); + firstTextView.setText(firstText); + firstTextView.setCompoundDrawablesWithIntrinsicBounds(firstDrawableId, 0, 0, 0); customActionBarView.findViewById(R.id.actionbar_done).setOnClickListener( - doneOnClickListener); - ((TextView) customActionBarView.findViewById(R.id.actionbar_cancel_text)) - .setText(cancelText); + firstOnClickListener); + TextView secondTextView = ((TextView) customActionBarView.findViewById(R.id.actionbar_cancel_text)); + secondTextView.setText(secondText); + secondTextView.setCompoundDrawablesWithIntrinsicBounds(secondDrawableId, 0, 0, 0); customActionBarView.findViewById(R.id.actionbar_cancel).setOnClickListener( - cancelOnClickListener); + secondOnClickListener); // Show the custom action bar view and hide the normal Home icon and title. actionBar.setDisplayShowTitleEnabled(false); @@ -91,20 +97,22 @@ public class ActionBarHelper { * Sets custom view on ActionBar for Done activities * * @param actionBar - * @param doneText - * @param doneOnClickListener + * @param firstText + * @param firstOnClickListener */ - public static void setDoneView(ActionBar actionBar, int doneText, - OnClickListener doneOnClickListener) { + public static void setOneButtonView(ActionBar actionBar, int firstText, int firstDrawableId, + OnClickListener firstOnClickListener) { // Inflate a "Done" custom action bar view to serve as the "Up" affordance. final LayoutInflater inflater = (LayoutInflater) actionBar.getThemedContext() .getSystemService(Activity.LAYOUT_INFLATER_SERVICE); final View customActionBarView = inflater .inflate(R.layout.actionbar_custom_view_done, null); - ((TextView) customActionBarView.findViewById(R.id.actionbar_done_text)).setText(doneText); + TextView firstTextView = ((TextView) customActionBarView.findViewById(R.id.actionbar_done_text)); + firstTextView.setText(firstText); + firstTextView.setCompoundDrawablesWithIntrinsicBounds(firstDrawableId, 0, 0, 0); customActionBarView.findViewById(R.id.actionbar_done).setOnClickListener( - doneOnClickListener); + firstOnClickListener); // Show the custom action bar view and hide the normal Home icon and title. actionBar.setDisplayShowTitleEnabled(false); @@ -112,65 +120,4 @@ public class ActionBarHelper { actionBar.setDisplayShowCustomEnabled(true); actionBar.setCustomView(customActionBarView); } - - /** - * Sets custom view on ActionBar for Save activities - * - * @param actionBar - * @param saveText - * @param saveOnClickListener - */ - public static void setSaveView(ActionBar actionBar, int saveText, - OnClickListener saveOnClickListener) { - // Inflate a "Save" custom action bar view to serve as the "Up" affordance. - final LayoutInflater inflater = (LayoutInflater) actionBar.getThemedContext() - .getSystemService(Activity.LAYOUT_INFLATER_SERVICE); - final View customActionBarView = inflater - .inflate(R.layout.actionbar_custom_view_save, null); - - ((TextView) customActionBarView.findViewById(R.id.actionbar_save_text)).setText(saveText); - customActionBarView.findViewById(R.id.actionbar_save).setOnClickListener( - saveOnClickListener); - - // Show the custom action bar view and hide the normal Home icon and title. - actionBar.setDisplayShowTitleEnabled(false); - actionBar.setDisplayShowHomeEnabled(false); - actionBar.setDisplayShowCustomEnabled(true); - actionBar.setCustomView(customActionBarView); - } - - /** - * Sets custom view on ActionBar for Save/Cancel activities - * - * @param actionBar - * @param saveText - * @param saveOnClickListener - * @param cancelText - * @param cancelOnClickListener - */ - public static void setSaveCancelView(ActionBar actionBar, int saveText, - OnClickListener saveOnClickListener, int cancelText, - OnClickListener cancelOnClickListener) { - - // Inflate a "Done"/"Cancel" custom action bar view - final LayoutInflater inflater = (LayoutInflater) actionBar.getThemedContext() - .getSystemService(Activity.LAYOUT_INFLATER_SERVICE); - final View customActionBarView = inflater.inflate( - R.layout.actionbar_custom_view_save_cancel, null); - - ((TextView) customActionBarView.findViewById(R.id.actionbar_save_text)).setText(saveText); - customActionBarView.findViewById(R.id.actionbar_save).setOnClickListener( - saveOnClickListener); - ((TextView) customActionBarView.findViewById(R.id.actionbar_cancel_text)) - .setText(cancelText); - customActionBarView.findViewById(R.id.actionbar_cancel).setOnClickListener( - cancelOnClickListener); - - // Show the custom action bar view and hide the normal Home icon and title. - actionBar.setDisplayShowTitleEnabled(false); - actionBar.setDisplayShowHomeEnabled(false); - actionBar.setDisplayShowCustomEnabled(true); - actionBar.setCustomView(customActionBarView, new ActionBar.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT)); - } } diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/AppSettingsActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/AppSettingsActivity.java index a7afc9698..178b2fc67 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/AppSettingsActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/AppSettingsActivity.java @@ -41,7 +41,7 @@ public class AppSettingsActivity extends ActionBarActivity { super.onCreate(savedInstanceState); // Inflate a "Done" custom action bar - ActionBarHelper.setDoneView(getSupportActionBar(), R.string.api_settings_save, + ActionBarHelper.setOneButtonView(getSupportActionBar(), R.string.api_settings_save, R.drawable.ic_action_done, new View.OnClickListener() { @Override public void onClick(View v) { diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/RemoteServiceActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/RemoteServiceActivity.java index 11b3ee217..8fb562884 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/RemoteServiceActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/remote/RemoteServiceActivity.java @@ -88,7 +88,7 @@ public class RemoteServiceActivity extends ActionBarActivity { final byte[] packageSignature = extras.getByteArray(EXTRA_PACKAGE_SIGNATURE); // Inflate a "Done"/"Cancel" custom action bar view - ActionBarHelper.setDoneCancelView(getSupportActionBar(), R.string.api_register_allow, + ActionBarHelper.setTwoButtonView(getSupportActionBar(), R.string.api_register_allow, R.drawable.ic_action_done, new View.OnClickListener() { @Override public void onClick(View v) { @@ -108,7 +108,7 @@ public class RemoteServiceActivity extends ActionBarActivity { RemoteServiceActivity.this.finish(); } } - }, R.string.api_register_disallow, new View.OnClickListener() { + }, R.string.api_register_disallow, R.drawable.ic_action_cancel, new View.OnClickListener() { @Override public void onClick(View v) { // Disallow @@ -161,7 +161,7 @@ public class RemoteServiceActivity extends ActionBarActivity { } // Inflate a "Done"/"Cancel" custom action bar view - ActionBarHelper.setDoneCancelView(getSupportActionBar(), R.string.btn_okay, + ActionBarHelper.setTwoButtonView(getSupportActionBar(), R.string.btn_okay, R.drawable.ic_action_done, new View.OnClickListener() { @Override public void onClick(View v) { @@ -173,7 +173,7 @@ public class RemoteServiceActivity extends ActionBarActivity { RemoteServiceActivity.this.setResult(RESULT_OK, resultData); RemoteServiceActivity.this.finish(); } - }, R.string.btn_do_not_save, new View.OnClickListener() { + }, R.string.btn_do_not_save, R.drawable.ic_action_cancel, new View.OnClickListener() { @Override public void onClick(View v) { // cancel @@ -214,7 +214,7 @@ public class RemoteServiceActivity extends ActionBarActivity { String text = "" + errorMessage + ""; // Inflate a "Done" custom action bar view - ActionBarHelper.setDoneView(getSupportActionBar(), R.string.btn_okay, + ActionBarHelper.setOneButtonView(getSupportActionBar(), R.string.btn_okay, R.drawable.ic_action_done, new View.OnClickListener() { @Override diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java index 628f642d8..19f991640 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java @@ -134,14 +134,14 @@ public class EditKeyActivity extends ActionBarActivity { * @param intent */ private void handleActionCreateKey(Intent intent) { - // Inflate a "Done"/"Cancel" custom action bar - ActionBarHelper.setDoneCancelView(getSupportActionBar(), R.string.btn_save, + // Inflate a "Save"/"Cancel" custom action bar + ActionBarHelper.setTwoButtonView(getSupportActionBar(), R.string.btn_save, R.drawable.ic_action_save, new View.OnClickListener() { @Override public void onClick(View v) { saveClicked(); } - }, R.string.btn_do_not_save, new View.OnClickListener() { + }, R.string.btn_do_not_save, R.drawable.ic_action_cancel, new View.OnClickListener() { @Override public void onClick(View v) { cancelClicked(); @@ -249,8 +249,8 @@ public class EditKeyActivity extends ActionBarActivity { * @param intent */ private void handleActionEditKey(Intent intent) { - // Inflate a "Done"/"Cancel" custom action bar - ActionBarHelper.setSaveView(getSupportActionBar(), R.string.btn_save, + // Inflate a "Save"/"Cancel" custom action bar + ActionBarHelper.setOneButtonView(getSupportActionBar(), R.string.btn_save, R.drawable.ic_action_save, new View.OnClickListener() { @Override public void onClick(View v) { diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/PreferencesKeyServerActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/PreferencesKeyServerActivity.java index b5ac739ae..492e9f200 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/PreferencesKeyServerActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/PreferencesKeyServerActivity.java @@ -50,14 +50,14 @@ public class PreferencesKeyServerActivity extends ActionBarActivity implements O super.onCreate(savedInstanceState); // Inflate a "Done"/"Cancel" custom action bar view - ActionBarHelper.setDoneCancelView(getSupportActionBar(), R.string.btn_okay, + ActionBarHelper.setTwoButtonView(getSupportActionBar(), R.string.btn_okay, R.drawable.ic_action_done, new View.OnClickListener() { @Override public void onClick(View v) { // ok okClicked(); } - }, R.string.btn_do_not_save, new View.OnClickListener() { + }, R.string.btn_do_not_save, R.drawable.ic_action_cancel, new View.OnClickListener() { @Override public void onClick(View v) { // cancel diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyActivity.java index 86ae0073f..3c63628f7 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyActivity.java @@ -46,14 +46,14 @@ public class SelectPublicKeyActivity extends ActionBarActivity { super.onCreate(savedInstanceState); // Inflate a "Done"/"Cancel" custom action bar view - ActionBarHelper.setDoneCancelView(getSupportActionBar(), R.string.btn_okay, + ActionBarHelper.setTwoButtonView(getSupportActionBar(), R.string.btn_okay, R.drawable.ic_action_done, new View.OnClickListener() { @Override public void onClick(View v) { // ok okClicked(); } - }, R.string.btn_do_not_save, new View.OnClickListener() { + }, R.string.btn_do_not_save, R.drawable.ic_action_cancel, new View.OnClickListener() { @Override public void onClick(View v) { // cancel diff --git a/OpenPGP-Keychain/src/main/res/layout/actionbar_custom_view_save.xml b/OpenPGP-Keychain/src/main/res/layout/actionbar_custom_view_save.xml deleted file mode 100644 index f0dcf177c..000000000 --- a/OpenPGP-Keychain/src/main/res/layout/actionbar_custom_view_save.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/res/layout/actionbar_custom_view_save_cancel.xml b/OpenPGP-Keychain/src/main/res/layout/actionbar_custom_view_save_cancel.xml deleted file mode 100644 index ba08a7714..000000000 --- a/OpenPGP-Keychain/src/main/res/layout/actionbar_custom_view_save_cancel.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/OpenPGP-Keychain/src/main/res/layout/actionbar_include_save_button.xml b/OpenPGP-Keychain/src/main/res/layout/actionbar_include_save_button.xml deleted file mode 100644 index 86c59dcc5..000000000 --- a/OpenPGP-Keychain/src/main/res/layout/actionbar_include_save_button.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - \ No newline at end of file From 361c45a481c75b3c62f7d9f46c9a6d2a7c4f97f0 Mon Sep 17 00:00:00 2001 From: uberspot Date: Tue, 11 Mar 2014 03:22:05 +0200 Subject: [PATCH 102/109] Make export work with rowIds instead of MasterKeyIds --- .../keychain/helper/ExportHelper.java | 15 ++--- .../keychain/pgp/PgpImportExport.java | 58 +++++++++---------- .../keychain/provider/ProviderHelper.java | 40 +++++++++++++ .../service/KeychainIntentService.java | 24 +++++--- .../keychain/ui/EditKeyActivity.java | 3 +- .../keychain/ui/ViewKeyActivity.java | 3 +- 6 files changed, 91 insertions(+), 52 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ExportHelper.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ExportHelper.java index 6aa28fec8..90e1f8cba 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ExportHelper.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ExportHelper.java @@ -63,7 +63,7 @@ public class ExportHelper { /** * Show dialog where to export keys */ - public void showExportKeysDialog(final Uri dataUri, final int keyType, + public void showExportKeysDialog(final long[] rowIds, final int keyType, final String exportFilename) { mExportFilename = exportFilename; @@ -75,7 +75,7 @@ public class ExportHelper { Bundle data = message.getData(); mExportFilename = data.getString(FileDialogFragment.MESSAGE_DATA_FILENAME); - exportKeys(dataUri, keyType); + exportKeys(rowIds, keyType); } } }; @@ -86,7 +86,7 @@ public class ExportHelper { DialogFragmentWorkaround.INTERFACE.runnableRunDelayed(new Runnable() { public void run() { String title = null; - if (dataUri == null) { + if (rowIds == null) { // export all keys title = activity.getString(R.string.title_export_keys); } else { @@ -112,7 +112,7 @@ public class ExportHelper { /** * Export keys */ - public void exportKeys(Uri dataUri, int keyType) { + public void exportKeys(long[] rowIds, int keyType) { Log.d(Constants.TAG, "exportKeys started"); // Send all information needed to service to export key in other thread @@ -126,13 +126,10 @@ public class ExportHelper { data.putString(KeychainIntentService.EXPORT_FILENAME, mExportFilename); data.putInt(KeychainIntentService.EXPORT_KEY_TYPE, keyType); - if (dataUri == null) { + if (rowIds == null) { data.putBoolean(KeychainIntentService.EXPORT_ALL, true); } else { - // TODO: put data uri into service??? - long keyRingMasterKeyId = ProviderHelper.getMasterKeyId(activity, dataUri); - - data.putLong(KeychainIntentService.EXPORT_KEY_RING_MASTER_KEY_ID, keyRingMasterKeyId); + data.putLongArray(KeychainIntentService.EXPORT_KEY_RING_ROW_ID, rowIds); } intent.putExtra(KeychainIntentService.EXTRA_DATA, data); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java index 7c635a00b..0a17a2be4 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java @@ -155,59 +155,53 @@ public class PgpImportExport { return returnData; } - public Bundle exportKeyRings(ArrayList keyRingMasterKeyIds, int keyType, + public Bundle exportKeyRings(ArrayList keyRingRowIds, int keyType, OutputStream outStream) throws PgpGeneralException, FileNotFoundException, PGPException, IOException { Bundle returnData = new Bundle(); + int rowIdsSize = keyRingRowIds.size(); + updateProgress( mContext.getResources().getQuantityString(R.plurals.progress_exporting_key, - keyRingMasterKeyIds.size()), 0, 100); + rowIdsSize), 0, 100); if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { throw new PgpGeneralException( mContext.getString(R.string.error_external_storage_not_ready)); } + // For each row id + for (int i = 0; i < rowIdsSize; ++i) { + // Create an output stream + ArmoredOutputStream arOutStream = new ArmoredOutputStream(outStream); + arOutStream.setHeader("Version", PgpHelper.getFullVersion(mContext)); - if (keyType == Id.type.secret_key) { - ArmoredOutputStream outSec = new ArmoredOutputStream(outStream); - outSec.setHeader("Version", PgpHelper.getFullVersion(mContext)); - - for (int i = 0; i < keyRingMasterKeyIds.size(); ++i) { - updateProgress(i * 100 / keyRingMasterKeyIds.size() / 2, 100); - - PGPSecretKeyRing secretKeyRing = ProviderHelper.getPGPSecretKeyRingByMasterKeyId( - mContext, keyRingMasterKeyIds.get(i)); + // If the keyType is secret get the PGPSecretKeyRing + // based on the row id and encode it to the output + if (keyType == Id.type.secret_key) { + updateProgress(i * 100 / rowIdsSize / 2, 100); + PGPSecretKeyRing secretKeyRing = + ProviderHelper.getPGPSecretKeyRingByRowId(mContext, keyRingRowIds.get(i)); if (secretKeyRing != null) { - secretKeyRing.encode(outSec); + secretKeyRing.encode(arOutStream); } - } - outSec.close(); - } else { - // export public keyrings... - ArmoredOutputStream outPub = new ArmoredOutputStream(outStream); - outPub.setHeader("Version", PgpHelper.getFullVersion(mContext)); - - for (int i = 0; i < keyRingMasterKeyIds.size(); ++i) { - // double the needed time if exporting both public and secret parts - if (keyType == Id.type.secret_key) { - updateProgress(i * 100 / keyRingMasterKeyIds.size() / 2, 100); - } else { - updateProgress(i * 100 / keyRingMasterKeyIds.size(), 100); - } - - PGPPublicKeyRing publicKeyRing = ProviderHelper.getPGPPublicKeyRingByMasterKeyId( - mContext, keyRingMasterKeyIds.get(i)); + // Else if it's a public key get the PGPPublicKeyRing + // and encode that to the output + } else { + updateProgress(i * 100 / rowIdsSize, 100); + PGPPublicKeyRing publicKeyRing = + ProviderHelper.getPGPPublicKeyRingByRowId(mContext, keyRingRowIds.get(i)); if (publicKeyRing != null) { - publicKeyRing.encode(outPub); + publicKeyRing.encode(arOutStream); } } - outPub.close(); + + arOutStream.close(); } - returnData.putInt(KeychainIntentService.RESULT_EXPORT, keyRingMasterKeyIds.size()); + returnData.putInt(KeychainIntentService.RESULT_EXPORT, rowIdsSize); updateProgress(R.string.progress_done, 100, 100); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java index ac0692213..dd538fbf4 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/provider/ProviderHelper.java @@ -404,6 +404,30 @@ public class ProviderHelper { return masterKeyIds; } + /** + * Private helper method + */ + private static ArrayList getKeyRingsRowIds(Context context, Uri queryUri) { + Cursor cursor = context.getContentResolver().query(queryUri, + new String[]{KeyRings._ID}, null, null, null); + + ArrayList rowIds = new ArrayList(); + if (cursor != null) { + int IdCol = cursor.getColumnIndex(KeyRings._ID); + if (cursor.moveToFirst()) { + do { + rowIds.add(cursor.getLong(IdCol)); + } while (cursor.moveToNext()); + } + } + + if (cursor != null) { + cursor.close(); + } + + return rowIds; + } + /** * Retrieves ids of all SecretKeyRings */ @@ -420,6 +444,22 @@ public class ProviderHelper { return getKeyRingsMasterKeyIds(context, queryUri); } + /** + * Retrieves ids of all SecretKeyRings + */ + public static ArrayList getSecretKeyRingsRowIds(Context context) { + Uri queryUri = KeyRings.buildSecretKeyRingsUri(); + return getKeyRingsRowIds(context, queryUri); + } + + /** + * Retrieves ids of all PublicKeyRings + */ + public static ArrayList getPublicKeyRingsRowIds(Context context) { + Uri queryUri = KeyRings.buildPublicKeyRingsUri(); + return getKeyRingsRowIds(context, queryUri); + } + public static void deletePublicKeyRing(Context context, long rowId) { ContentResolver cr = context.getContentResolver(); cr.delete(KeyRings.buildPublicKeyRingsUri(Long.toString(rowId)), null, null); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java index 902c66fe9..93238349d 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/KeychainIntentService.java @@ -50,6 +50,7 @@ import org.sufficientlysecure.keychain.pgp.PgpImportExport; import org.sufficientlysecure.keychain.pgp.PgpKeyOperation; import org.sufficientlysecure.keychain.pgp.PgpSignEncrypt; import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException; +import org.sufficientlysecure.keychain.provider.KeychainContract; import org.sufficientlysecure.keychain.provider.KeychainContract.DataStream; import org.sufficientlysecure.keychain.provider.ProviderHelper; import org.sufficientlysecure.keychain.ui.adapter.ImportKeysListEntry; @@ -153,6 +154,7 @@ public class KeychainIntentService extends IntentService implements ProgressDial public static final String EXPORT_KEY_TYPE = "export_key_type"; public static final String EXPORT_ALL = "export_all"; public static final String EXPORT_KEY_RING_MASTER_KEY_ID = "export_key_ring_id"; + public static final String EXPORT_KEY_RING_ROW_ID = "export_key_rind_row_id"; // upload key public static final String UPLOAD_KEY_SERVER = "upload_key_server"; @@ -675,10 +677,12 @@ public class KeychainIntentService extends IntentService implements ProgressDial String outputFile = data.getString(EXPORT_FILENAME); + long[] rowIds = new long[0]; + + // If not exporting all keys get the rowIds of the keys to export from the intent boolean exportAll = data.getBoolean(EXPORT_ALL); - long keyRingMasterKeyId = -1; if (!exportAll) { - keyRingMasterKeyId = data.getLong(EXPORT_KEY_RING_MASTER_KEY_ID); + rowIds = data.getLongArray(EXPORT_KEY_RING_ROW_ID); } /* Operation */ @@ -691,24 +695,26 @@ public class KeychainIntentService extends IntentService implements ProgressDial // OutputStream FileOutputStream outStream = new FileOutputStream(outputFile); - ArrayList keyRingMasterKeyIds = new ArrayList(); + ArrayList keyRingRowIds = new ArrayList(); if (exportAll) { - // get all key ring row ids based on export type + // get all key ring row ids based on export type if (keyType == Id.type.public_key) { - keyRingMasterKeyIds = ProviderHelper.getPublicKeyRingsMasterKeyIds(this); + keyRingRowIds = ProviderHelper.getPublicKeyRingsRowIds(this); } else { - keyRingMasterKeyIds = ProviderHelper.getSecretKeyRingsMasterKeyIds(this); + keyRingRowIds = ProviderHelper.getSecretKeyRingsRowIds(this); } } else { - keyRingMasterKeyIds.add(keyRingMasterKeyId); + for(long rowId : rowIds) { + keyRingRowIds.add(rowId); + } } - Bundle resultData = new Bundle(); + Bundle resultData; PgpImportExport pgpImportExport = new PgpImportExport(this, this); resultData = pgpImportExport - .exportKeyRings(keyRingMasterKeyIds, keyType, outStream); + .exportKeyRings(keyRingRowIds, keyType, outStream); sendMessageToHandler(KeychainIntentServiceHandler.MESSAGE_OKAY, resultData); } catch (Exception e) { diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java index 19f991640..6e16afef1 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java @@ -329,7 +329,8 @@ public class EditKeyActivity extends ActionBarActivity { cancelClicked(); return true; case R.id.menu_key_edit_export_file: - mExportHelper.showExportKeysDialog(mDataUri, Id.type.secret_key, Constants.path.APP_DIR + long[] ids = new long[]{Long.valueOf(mDataUri.getLastPathSegment())}; + mExportHelper.showExportKeysDialog(ids, Id.type.secret_key, Constants.path.APP_DIR + "/secexport.asc"); return true; case R.id.menu_key_edit_delete: { diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java index 390de9ab9..3641f4d96 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java @@ -118,7 +118,8 @@ public class ViewKeyActivity extends ActionBarActivity { uploadToKeyserver(mDataUri); return true; case R.id.menu_key_view_export_file: - mExportHelper.showExportKeysDialog(mDataUri, Id.type.public_key, Constants.path.APP_DIR + long[] ids = new long[]{Long.valueOf(mDataUri.getLastPathSegment())}; + mExportHelper.showExportKeysDialog(ids, Id.type.public_key, Constants.path.APP_DIR + "/pubexport.asc"); return true; case R.id.menu_key_view_share_default_fingerprint: From 43a20ad1da62a32eb48ecedcd6dc33df5396dfeb Mon Sep 17 00:00:00 2001 From: uberspot Date: Tue, 11 Mar 2014 03:53:00 +0200 Subject: [PATCH 103/109] Add export... button and functionality in multi-select --- .../org/sufficientlysecure/keychain/Constants.java | 2 ++ .../keychain/helper/ExportHelper.java | 1 - .../keychain/ui/EditKeyActivity.java | 3 +-- .../keychain/ui/KeyListPublicActivity.java | 3 +-- .../keychain/ui/KeyListPublicFragment.java | 9 ++++++++- .../keychain/ui/KeyListSecretActivity.java | 3 +-- .../keychain/ui/KeyListSecretFragment.java | 11 +++++++++-- .../keychain/ui/ViewKeyActivity.java | 3 +-- .../src/main/res/menu/key_list_public_multi.xml | 4 ++++ .../src/main/res/menu/key_list_secret_multi.xml | 4 ++++ 10 files changed, 31 insertions(+), 12 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/Constants.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/Constants.java index 4428c7133..34a3de8d5 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/Constants.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/Constants.java @@ -43,6 +43,8 @@ public final class Constants { public static final class path { public static final String APP_DIR = Environment.getExternalStorageDirectory() + "/OpenPGP-Keychain"; + public static final String APP_DIR_FILE_SEC = APP_DIR + "/secexport.asc"; + public static final String APP_DIR_FILE_PUB = APP_DIR + "/pubexport.asc"; } public static final class pref { diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ExportHelper.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ExportHelper.java index 90e1f8cba..19dfccbde 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ExportHelper.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ExportHelper.java @@ -20,7 +20,6 @@ import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Id; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.compatibility.DialogFragmentWorkaround; -import org.sufficientlysecure.keychain.provider.ProviderHelper; import org.sufficientlysecure.keychain.service.KeychainIntentService; import org.sufficientlysecure.keychain.service.KeychainIntentServiceHandler; import org.sufficientlysecure.keychain.ui.dialog.DeleteKeyDialogFragment; diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java index 6e16afef1..72dc97ccd 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/EditKeyActivity.java @@ -330,8 +330,7 @@ public class EditKeyActivity extends ActionBarActivity { return true; case R.id.menu_key_edit_export_file: long[] ids = new long[]{Long.valueOf(mDataUri.getLastPathSegment())}; - mExportHelper.showExportKeysDialog(ids, Id.type.secret_key, Constants.path.APP_DIR - + "/secexport.asc"); + mExportHelper.showExportKeysDialog(ids, Id.type.secret_key, Constants.path.APP_DIR_FILE_SEC); return true; case R.id.menu_key_edit_delete: { // Message is received after key is deleted diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicActivity.java index 4521786f7..9bd9ee225 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicActivity.java @@ -59,8 +59,7 @@ public class KeyListPublicActivity extends DrawerActivity { return true; case R.id.menu_key_list_public_export: - mExportHelper.showExportKeysDialog(null, Id.type.public_key, Constants.path.APP_DIR - + "/pubexport.asc"); + mExportHelper.showExportKeysDialog(null, Id.type.public_key, Constants.path.APP_DIR_FILE_PUB); return true; default: diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java index c62695417..2fb280ccd 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java @@ -18,10 +18,11 @@ package org.sufficientlysecure.keychain.ui; import java.util.ArrayList; -import java.util.Set; +import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Id; import org.sufficientlysecure.keychain.R; +import org.sufficientlysecure.keychain.helper.ExportHelper; import org.sufficientlysecure.keychain.provider.KeychainContract; import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings; import org.sufficientlysecure.keychain.provider.KeychainContract.UserIds; @@ -47,6 +48,7 @@ import android.support.v4.app.LoaderManager; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; import android.support.v4.view.MenuItemCompat; +import android.support.v7.app.ActionBarActivity; import android.support.v7.widget.SearchView; import android.text.TextUtils; import android.view.ActionMode; @@ -179,6 +181,11 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer encrypt(mode, ids); break; } + case R.id.menu_key_list_public_multi_export: { + ExportHelper mExportHelper = new ExportHelper((ActionBarActivity) getActivity()); + mExportHelper.showExportKeysDialog(ids, Id.type.public_key, Constants.path.APP_DIR_FILE_PUB); + break; + } case R.id.menu_key_list_public_multi_delete: { showDeleteKeyDialog(mode, ids); break; diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListSecretActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListSecretActivity.java index e58ebe819..cd3c8b4fd 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListSecretActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListSecretActivity.java @@ -62,8 +62,7 @@ public class KeyListSecretActivity extends DrawerActivity { return true; case R.id.menu_key_list_secret_export: - mExportHelper.showExportKeysDialog(null, Id.type.secret_key, Constants.path.APP_DIR - + "/secexport.asc"); + mExportHelper.showExportKeysDialog(null, Id.type.secret_key, Constants.path.APP_DIR_FILE_SEC); return true; case R.id.menu_key_list_secret_import: diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListSecretFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListSecretFragment.java index 76212afc3..e84b2f4c8 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListSecretFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListSecretFragment.java @@ -17,10 +17,10 @@ package org.sufficientlysecure.keychain.ui; -import java.util.Set; - +import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.Id; import org.sufficientlysecure.keychain.R; +import org.sufficientlysecure.keychain.helper.ExportHelper; import org.sufficientlysecure.keychain.provider.KeychainContract; import org.sufficientlysecure.keychain.provider.KeychainContract.KeyRings; import org.sufficientlysecure.keychain.provider.KeychainContract.UserIds; @@ -41,6 +41,7 @@ import android.support.v4.app.ListFragment; import android.support.v4.app.LoaderManager; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; +import android.support.v7.app.ActionBarActivity; import android.view.ActionMode; import android.view.Menu; import android.view.MenuItem; @@ -106,6 +107,12 @@ public class KeyListSecretFragment extends ListFragment implements } break; } + case R.id.menu_key_list_public_multi_export: { + ExportHelper mExportHelper = new ExportHelper((ActionBarActivity) getActivity()); + mExportHelper.showExportKeysDialog(ids, Id.type.secret_key, Constants.path.APP_DIR_FILE_SEC); + break; + } + } return true; } diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java index 3641f4d96..4cc5e1b62 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyActivity.java @@ -119,8 +119,7 @@ public class ViewKeyActivity extends ActionBarActivity { return true; case R.id.menu_key_view_export_file: long[] ids = new long[]{Long.valueOf(mDataUri.getLastPathSegment())}; - mExportHelper.showExportKeysDialog(ids, Id.type.public_key, Constants.path.APP_DIR - + "/pubexport.asc"); + mExportHelper.showExportKeysDialog(ids, Id.type.public_key, Constants.path.APP_DIR_FILE_PUB); return true; case R.id.menu_key_view_share_default_fingerprint: shareKey(mDataUri, true); diff --git a/OpenPGP-Keychain/src/main/res/menu/key_list_public_multi.xml b/OpenPGP-Keychain/src/main/res/menu/key_list_public_multi.xml index d30ee5e8f..9df17615e 100644 --- a/OpenPGP-Keychain/src/main/res/menu/key_list_public_multi.xml +++ b/OpenPGP-Keychain/src/main/res/menu/key_list_public_multi.xml @@ -5,6 +5,10 @@ android:id="@+id/menu_key_list_public_multi_select_all" android:icon="@drawable/ic_action_select_all" android:title="@string/menu_select_all" /> + + Date: Tue, 11 Mar 2014 04:13:58 +0200 Subject: [PATCH 104/109] minor clean up in colorize method --- .../sufficientlysecure/keychain/ui/ViewKeyMainFragment.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java index 65fe08484..adb06a068 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyMainFragment.java @@ -280,13 +280,14 @@ public class ViewKeyMainFragment extends Fragment implements // for each 4 characters of the fingerprint + 1 space for (int i = 0; i < fingerprint.length(); i += 5) { - String fourChars = fingerprint.substring(i, Math.min(i + 4, fingerprint.length())); + int minFingLength = Math.min(i + 4, fingerprint.length()); + String fourChars = fingerprint.substring(i, minFingLength); // Create a foreground color by converting the 4 fingerprint chars to an int hashcode // and then converting that int to hex to use as a color fcs = new ForegroundColorSpan( Color.parseColor(String.format("#%06X", (0xFFFFFF & fourChars.hashCode())))); - sb.setSpan(fcs, i, Math.min(i+4, fingerprint.length()), Spannable.SPAN_INCLUSIVE_INCLUSIVE); + sb.setSpan(fcs, i, minFingLength, Spannable.SPAN_INCLUSIVE_INCLUSIVE); } return sb; From e2ec5a38823270a64709cd730dedf93d68219a7b Mon Sep 17 00:00:00 2001 From: Tharindu Wijewardane Date: Tue, 11 Mar 2014 11:04:31 +0530 Subject: [PATCH 105/109] Issue #393 ( PublicKeyListFragment: Query not really resetted ) : Fixed --- .../sufficientlysecure/keychain/ui/KeyListPublicFragment.java | 1 + 1 file changed, 1 insertion(+) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java index c62695417..514b0e00e 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/KeyListPublicFragment.java @@ -377,6 +377,7 @@ public class KeyListPublicFragment extends Fragment implements SearchView.OnQuer @Override public boolean onMenuItemActionCollapse(MenuItem item) { mCurQuery = null; + mSearchView.setQuery("", true); getLoaderManager().restartLoader(0, null, KeyListPublicFragment.this); return true; } From 317595dc7293dcef132373163298bd08e66e47b4 Mon Sep 17 00:00:00 2001 From: uberspot Date: Tue, 11 Mar 2014 23:40:12 +0200 Subject: [PATCH 106/109] Added initial xml and readme info for checkstyle --- README.md | 8 + tools/checkstyle | 1 + tools/checkstyle.xml | 356 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 365 insertions(+) create mode 100755 tools/checkstyle create mode 100644 tools/checkstyle.xml diff --git a/README.md b/README.md index 14a9055e9..4b997c59f 100644 --- a/README.md +++ b/README.md @@ -155,6 +155,14 @@ See http://source.android.com/source/code-style.html See http://www.androidpolice.com/2009/11/04/auto-formatting-android-xml-files-with-eclipse/ +### Automated syntax check with CheckStyle +* Paste the tools/checkstyle.xml file to ~/.AndroidStudioPreview/config/codestyles/ (in Linux/Unix) + or ~/Library/Preferences/AndroidStudioPreview/codestyles (in Mac OSX) +* Go to Settings (or Preferences in Mac OS X) > Code Style > Java, select OpenPgpChecker, + as well as Code Style > XML and select OpenPgpChecker again. +* Start code inspection and see the results by selecting Analyze > Inspect Code from Android-Studio + or you can directly run checkstyle via cli with .tools/checkstyle. Make sure it's executable first. + ## Licenses OpenPGP Kechain is licensed under GPLv3+. Some parts (older parts and some libraries are Apache License v2, MIT X11 License) diff --git a/tools/checkstyle b/tools/checkstyle new file mode 100755 index 000000000..27aabced2 --- /dev/null +++ b/tools/checkstyle @@ -0,0 +1 @@ +checkstyle -c tools/checkstyle.xml -r OpenPGP-Keychain/src/main/java 2>&1 | egrep -v 'log4j' diff --git a/tools/checkstyle.xml b/tools/checkstyle.xml new file mode 100644 index 000000000..95ef07a90 --- /dev/null +++ b/tools/checkstyle.xml @@ -0,0 +1,356 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From d586ad288d2a6db803c12c8ae4a600630004f7bc Mon Sep 17 00:00:00 2001 From: uberspot Date: Tue, 11 Mar 2014 23:42:45 +0200 Subject: [PATCH 107/109] fix plenty of lint warnings, make some for loops into foreach, remove unused imports and throw exceptions --- .../keychain/helper/ActionBarHelper.java | 1 - .../sufficientlysecure/keychain/helper/Preferences.java | 8 ++++---- .../org/sufficientlysecure/keychain/pgp/PgpHelper.java | 3 +-- .../sufficientlysecure/keychain/pgp/PgpImportExport.java | 8 +++++--- .../sufficientlysecure/keychain/pgp/PgpKeyOperation.java | 2 +- .../keychain/service/PassphraseCacheService.java | 5 +++-- .../sufficientlysecure/keychain/ui/DecryptActivity.java | 4 ++++ .../keychain/ui/PreferencesKeyServerActivity.java | 4 ++-- .../keychain/ui/SelectPublicKeyFragment.java | 4 ++-- .../keychain/ui/adapter/KeyListPublicAdapter.java | 2 -- .../keychain/ui/adapter/KeyListSecretAdapter.java | 1 - .../keychain/ui/dialog/CreateKeyDialogFragment.java | 3 ++- .../src/main/res/layout/api_app_error_message.xml | 1 - .../main/res/layout/api_app_select_pub_keys_activity.xml | 1 - .../src/main/res/layout/key_server_export.xml | 1 - 15 files changed, 24 insertions(+), 24 deletions(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ActionBarHelper.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ActionBarHelper.java index 2276e0f8a..24e8ff4c7 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ActionBarHelper.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ActionBarHelper.java @@ -22,7 +22,6 @@ import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.util.Log; import android.app.Activity; -import android.graphics.drawable.Drawable; import android.support.v7.app.ActionBar; import android.support.v7.app.ActionBarActivity; import android.view.LayoutInflater; diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/Preferences.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/Preferences.java index 493f25707..f18a290b3 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/Preferences.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/Preferences.java @@ -144,8 +144,8 @@ public class Preferences { Constants.defaults.KEY_SERVERS); Vector servers = new Vector(); String chunks[] = rawData.split(","); - for (int i = 0; i < chunks.length; ++i) { - String tmp = chunks[i].trim(); + for (String c : chunks) { + String tmp = c.trim(); if (tmp.length() > 0) { servers.add(tmp); } @@ -156,8 +156,8 @@ public class Preferences { public void setKeyServers(String[] value) { SharedPreferences.Editor editor = mSharedPreferences.edit(); String rawData = ""; - for (int i = 0; i < value.length; ++i) { - String tmp = value[i].trim(); + for (String v : value) { + String tmp = v.trim(); if (tmp.length() == 0) { continue; } diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpHelper.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpHelper.java index 7ac904d89..1db4f98b1 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpHelper.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpHelper.java @@ -193,11 +193,10 @@ public class PgpHelper { * @param context * @param progress * @param file - * @throws FileNotFoundException * @throws IOException */ public static void deleteFileSecurely(Context context, ProgressDialogUpdater progress, File file) - throws FileNotFoundException, IOException { + throws IOException { long length = file.length(); SecureRandom random = new SecureRandom(); RandomAccessFile raf = new RandomAccessFile(file, "rws"); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java index 0a17a2be4..138e54f71 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpImportExport.java @@ -79,8 +79,9 @@ public class PgpImportExport { public boolean uploadKeyRingToServer(HkpKeyServer server, PGPPublicKeyRing keyring) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); - ArmoredOutputStream aos = new ArmoredOutputStream(bos); + ArmoredOutputStream aos = null; try { + aos = new ArmoredOutputStream(bos); aos.write(keyring.getEncoded()); aos.close(); @@ -95,7 +96,8 @@ public class PgpImportExport { return false; } finally { try { - bos.close(); + if (aos != null) aos.close(); + if (bos != null) bos.close(); } catch (IOException e) { } } @@ -156,7 +158,7 @@ public class PgpImportExport { } public Bundle exportKeyRings(ArrayList keyRingRowIds, int keyType, - OutputStream outStream) throws PgpGeneralException, FileNotFoundException, + OutputStream outStream) throws PgpGeneralException, PGPException, IOException { Bundle returnData = new Bundle(); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java index e1ca88fb0..5ebb53f20 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/pgp/PgpKeyOperation.java @@ -190,7 +190,7 @@ public class PgpKeyOperation { } public void changeSecretKeyPassphrase(PGPSecretKeyRing keyRing, String oldPassPhrase, - String newPassPhrase) throws IOException, PGPException, PGPException, + String newPassPhrase) throws IOException, PGPException, NoSuchProviderException { updateProgress(R.string.progress_building_key, 0, 100); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/PassphraseCacheService.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/PassphraseCacheService.java index abd2320e3..ce34d451d 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/PassphraseCacheService.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/service/PassphraseCacheService.java @@ -21,6 +21,7 @@ import java.util.Date; import java.util.HashMap; import java.util.Iterator; +import android.util.LongSparseArray; import org.spongycastle.openpgp.PGPException; import org.spongycastle.openpgp.PGPPrivateKey; import org.spongycastle.openpgp.PGPSecretKey; @@ -77,7 +78,7 @@ public class PassphraseCacheService extends Service { private BroadcastReceiver mIntentReceiver; - private HashMap mPassphraseCache = new HashMap(); + private LongSparseArray mPassphraseCache = new LongSparseArray(); Context mContext; @@ -347,7 +348,7 @@ public class PassphraseCacheService extends Service { Log.d(TAG, "Timeout of keyId " + keyId + ", removed from memory!"); // stop whole service if no cached passphrases remaining - if (mPassphraseCache.isEmpty()) { + if (mPassphraseCache.size() == 0) { Log.d(TAG, "No passphrases remaining in memory, stopping service!"); stopSelf(); } diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java index 76acf15b0..38d763ce4 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptActivity.java @@ -530,6 +530,10 @@ public class DecryptActivity extends DrawerActivity { Log.e(Constants.TAG, "File not found!", e); AppMsg.makeText(this, getString(R.string.error_file_not_found, e.getMessage()), AppMsg.STYLE_ALERT).show(); + } finally { + try { + if (inStream != null) inStream.close(); + } catch (Exception e){ } } } else { inStream = new ByteArrayInputStream(mMessage.getText().toString().getBytes()); diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/PreferencesKeyServerActivity.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/PreferencesKeyServerActivity.java index 492e9f200..50fec1ffc 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/PreferencesKeyServerActivity.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/PreferencesKeyServerActivity.java @@ -81,11 +81,11 @@ public class PreferencesKeyServerActivity extends ActionBarActivity implements O Intent intent = getIntent(); String servers[] = intent.getStringArrayExtra(EXTRA_KEY_SERVERS); if (servers != null) { - for (int i = 0; i < servers.length; ++i) { + for (String serv : servers) { KeyServerEditor view = (KeyServerEditor) mInflater.inflate( R.layout.key_server_editor, mEditors, false); view.setEditorListener(this); - view.setValue(servers[i]); + view.setValue(serv); mEditors.addView(view); } } diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java index c1c9aa705..d320af451 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/SelectPublicKeyFragment.java @@ -199,8 +199,8 @@ public class SelectPublicKeyFragment extends ListFragmentWorkaround implements T if (masterKeyIds != null) { for (int i = 0; i < getListView().getCount(); ++i) { long keyId = mAdapter.getMasterKeyId(i); - for (int j = 0; j < masterKeyIds.length; ++j) { - if (keyId == masterKeyIds[j]) { + for (long masterKeyId : masterKeyIds) { + if (keyId == masterKeyId) { getListView().setItemChecked(i, true); break; } diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java index b8f60633e..d7bb62d01 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListPublicAdapter.java @@ -18,8 +18,6 @@ package org.sufficientlysecure.keychain.ui.adapter; import java.util.HashMap; -import java.util.Set; - import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListSecretAdapter.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListSecretAdapter.java index ca3a26066..0bffcaa19 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListSecretAdapter.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/adapter/KeyListSecretAdapter.java @@ -18,7 +18,6 @@ package org.sufficientlysecure.keychain.ui.adapter; import java.util.HashMap; -import java.util.Set; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.pgp.PgpKeyHelper; diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/CreateKeyDialogFragment.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/CreateKeyDialogFragment.java index 98b677511..a47601c9b 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/CreateKeyDialogFragment.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/CreateKeyDialogFragment.java @@ -32,6 +32,7 @@ import org.sufficientlysecure.keychain.Id; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.util.Choice; +import java.util.ArrayList; import java.util.Vector; public class CreateKeyDialogFragment extends DialogFragment { @@ -78,7 +79,7 @@ public class CreateKeyDialogFragment extends DialogFragment { boolean wouldBeMasterKey = (childCount == 0); final Spinner algorithm = (Spinner) view.findViewById(R.id.create_key_algorithm); - Vector choices = new Vector(); + ArrayList choices = new ArrayList(); choices.add(new Choice(Id.choice.algorithm.dsa, getResources().getString( R.string.dsa))); if (!wouldBeMasterKey) { diff --git a/OpenPGP-Keychain/src/main/res/layout/api_app_error_message.xml b/OpenPGP-Keychain/src/main/res/layout/api_app_error_message.xml index 5927dbf43..48aa89d4f 100644 --- a/OpenPGP-Keychain/src/main/res/layout/api_app_error_message.xml +++ b/OpenPGP-Keychain/src/main/res/layout/api_app_error_message.xml @@ -1,6 +1,5 @@ diff --git a/OpenPGP-Keychain/src/main/res/layout/api_app_select_pub_keys_activity.xml b/OpenPGP-Keychain/src/main/res/layout/api_app_select_pub_keys_activity.xml index 877b4e74e..a10592607 100644 --- a/OpenPGP-Keychain/src/main/res/layout/api_app_select_pub_keys_activity.xml +++ b/OpenPGP-Keychain/src/main/res/layout/api_app_select_pub_keys_activity.xml @@ -1,6 +1,5 @@ diff --git a/OpenPGP-Keychain/src/main/res/layout/key_server_export.xml b/OpenPGP-Keychain/src/main/res/layout/key_server_export.xml index c162a6e28..6031bf7c7 100644 --- a/OpenPGP-Keychain/src/main/res/layout/key_server_export.xml +++ b/OpenPGP-Keychain/src/main/res/layout/key_server_export.xml @@ -1,7 +1,6 @@ From b955c3de0173cc2014f9b56553ef984d196deb1b Mon Sep 17 00:00:00 2001 From: uberspot Date: Wed, 12 Mar 2014 02:04:04 +0200 Subject: [PATCH 108/109] Add Email suggestions in Create Key activity --- OpenPGP-Keychain/src/main/AndroidManifest.xml | 1 + .../keychain/helper/ContactHelper.java | 41 +++++++++++++++++++ .../keychain/ui/widget/UserIdEditor.java | 17 +++++--- .../main/res/layout/edit_key_user_id_item.xml | 2 +- 4 files changed, 55 insertions(+), 6 deletions(-) create mode 100644 OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/helper/ContactHelper.java diff --git a/OpenPGP-Keychain/src/main/AndroidManifest.xml b/OpenPGP-Keychain/src/main/AndroidManifest.xml index 10f112f23..4fabf7432 100644 --- a/OpenPGP-Keychain/src/main/AndroidManifest.xml +++ b/OpenPGP-Keychain/src/main/AndroidManifest.xml @@ -50,6 +50,7 @@ + + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.sufficientlysecure.keychain.helper; + +import android.accounts.Account; +import android.accounts.AccountManager; +import android.content.Context; +import android.util.Patterns; + +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; + +public class ContactHelper { + + public static final List getMailAccounts(Context context) { + final Account[] accounts = AccountManager.get(context).getAccounts(); + final Set emailSet = new HashSet(); + for (Account account : accounts) { + if (Patterns.EMAIL_ADDRESS.matcher(account.name).matches()) { + emailSet.add(account.name); + } + } + return new ArrayList(emailSet); + } +} diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/UserIdEditor.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/UserIdEditor.java index 5428b626e..71cd89ae8 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/UserIdEditor.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/UserIdEditor.java @@ -19,6 +19,7 @@ package org.sufficientlysecure.keychain.ui.widget; import java.util.regex.Matcher; import java.util.regex.Pattern; +import android.widget.*; import org.sufficientlysecure.keychain.R; import android.content.Context; @@ -26,11 +27,9 @@ import android.util.AttributeSet; import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; -import android.widget.EditText; -import android.widget.LinearLayout; -import android.widget.RadioButton; import com.beardedhen.androidbootstrap.BootstrapButton; +import org.sufficientlysecure.keychain.helper.ContactHelper; public class UserIdEditor extends LinearLayout implements Editor, OnClickListener { private EditorListener mEditorListener = null; @@ -38,7 +37,7 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene private BootstrapButton mDeleteButton; private RadioButton mIsMainUserId; private EditText mName; - private EditText mEmail; + private AutoCompleteTextView mEmail; private EditText mComment; // see http://www.regular-expressions.info/email.html @@ -102,9 +101,17 @@ public class UserIdEditor extends LinearLayout implements Editor, OnClickListene mIsMainUserId.setOnClickListener(this); mName = (EditText) findViewById(R.id.name); - mEmail = (EditText) findViewById(R.id.email); + mEmail = (AutoCompleteTextView) findViewById(R.id.email); mComment = (EditText) findViewById(R.id.comment); + + mEmail.setThreshold(1); // Start working from first character + mEmail.setAdapter( + new ArrayAdapter + (this.getContext(), android.R.layout.simple_dropdown_item_1line, + ContactHelper.getMailAccounts(getContext()) + )); + super.onFinishInflate(); } diff --git a/OpenPGP-Keychain/src/main/res/layout/edit_key_user_id_item.xml b/OpenPGP-Keychain/src/main/res/layout/edit_key_user_id_item.xml index 663949d8e..3030d6bae 100644 --- a/OpenPGP-Keychain/src/main/res/layout/edit_key_user_id_item.xml +++ b/OpenPGP-Keychain/src/main/res/layout/edit_key_user_id_item.xml @@ -49,7 +49,7 @@ android:paddingRight="5dip" android:text="@string/label_email" /> - Date: Wed, 12 Mar 2014 20:14:56 +0530 Subject: [PATCH 109/109] Fix error in importing/updating keys from keyserver by removing extra 0x --- .../java/org/sufficientlysecure/keychain/util/HkpKeyServer.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/HkpKeyServer.java b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/HkpKeyServer.java index 0681847f4..32266839c 100644 --- a/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/HkpKeyServer.java +++ b/OpenPGP-Keychain/src/main/java/org/sufficientlysecure/keychain/util/HkpKeyServer.java @@ -226,7 +226,7 @@ public class HkpKeyServer extends KeyServer { HttpClient client = new DefaultHttpClient(); try { HttpGet get = new HttpGet("http://" + mHost + ":" + mPort - + "/pks/lookup?op=get&search=0x" + PgpKeyHelper.convertKeyIdToHex(keyId)); + + "/pks/lookup?op=get&search=" + PgpKeyHelper.convertKeyIdToHex(keyId)); HttpResponse response = client.execute(get); if (response.getStatusLine().getStatusCode() != HttpStatus.SC_OK) {