diff options
author | Vincent Breitmoser <valodim@mugenguild.com> | 2015-03-10 00:57:23 +0100 |
---|---|---|
committer | Vincent Breitmoser <valodim@mugenguild.com> | 2015-03-10 00:57:23 +0100 |
commit | 4db86fdabe80cffba13b5e18e1576b5d8de39e8d (patch) | |
tree | 80ca70fdd019824c65fc3b73740b1311cecc257e /OpenKeychain | |
parent | f76f84dfb2e406dd613be04dabd9432ffd0f9c4b (diff) | |
parent | e3547b497932a1c0219c11d586858754c82d19da (diff) | |
download | open-keychain-4db86fdabe80cffba13b5e18e1576b5d8de39e8d.tar.gz open-keychain-4db86fdabe80cffba13b5e18e1576b5d8de39e8d.tar.bz2 open-keychain-4db86fdabe80cffba13b5e18e1576b5d8de39e8d.zip |
Merge remote-tracking branch 'development' into linked-identities
Diffstat (limited to 'OpenKeychain')
107 files changed, 1294 insertions, 907 deletions
diff --git a/OpenKeychain/src/main/AndroidManifest.xml b/OpenKeychain/src/main/AndroidManifest.xml index 886a8f7a5..3030cdbf2 100644 --- a/OpenKeychain/src/main/AndroidManifest.xml +++ b/OpenKeychain/src/main/AndroidManifest.xml @@ -93,7 +93,7 @@ <activity android:name=".ui.CreateKeyActivity" android:configChanges="orientation|screenSize|keyboardHidden|keyboard" - android:windowSoftInputMode="stateHidden|adjustResize" + android:windowSoftInputMode="adjustResize" android:label="@string/title_create_key" android:parentActivityName=".ui.MainActivity"> <meta-data diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java index 03fa41984..390e85ef8 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/remote/OpenPgpService.java @@ -38,8 +38,6 @@ import org.sufficientlysecure.keychain.operations.results.OperationResult.LogEnt import org.sufficientlysecure.keychain.operations.results.PgpSignEncryptResult; import org.sufficientlysecure.keychain.pgp.PgpConstants; import org.sufficientlysecure.keychain.pgp.PgpDecryptVerify; -import org.sufficientlysecure.keychain.pgp.PgpHelper; -import org.sufficientlysecure.keychain.pgp.PgpKeyOperation; import org.sufficientlysecure.keychain.pgp.PgpSignEncryptInput; import org.sufficientlysecure.keychain.pgp.PgpSignEncryptOperation; import org.sufficientlysecure.keychain.pgp.exception.PgpGeneralException; @@ -55,7 +53,6 @@ import org.sufficientlysecure.keychain.ui.PassphraseDialogActivity; import org.sufficientlysecure.keychain.ui.ViewKeyActivity; import org.sufficientlysecure.keychain.util.InputData; import org.sufficientlysecure.keychain.util.Log; -import org.sufficientlysecure.keychain.util.Preferences; import java.io.IOException; import java.io.InputStream; @@ -83,7 +80,7 @@ public class OpenPgpService extends RemoteService { * @param encryptionUserIds * @return */ - private Intent getKeyIdsFromEmails(Intent data, String[] encryptionUserIds) { + private Intent returnKeyIdsFromEmails(Intent data, String[] encryptionUserIds) { boolean noUserIdsCheck = (encryptionUserIds == null || encryptionUserIds.length == 0); boolean missingUserIdsCheck = false; boolean duplicateUserIdsCheck = false; @@ -164,7 +161,24 @@ public class OpenPgpService extends RemoteService { } } - private Intent getNfcSignIntent(Intent data, long keyId, String pin, byte[] hashToSign, int hashAlgo) { + private Intent returnPassphraseIntent(Intent data, long keyId) { + // build PendingIntent for passphrase input + Intent intent = new Intent(getBaseContext(), PassphraseDialogActivity.class); + intent.putExtra(PassphraseDialogActivity.EXTRA_SUBKEY_ID, keyId); + // pass params through to activity that it can be returned again later to repeat pgp operation + intent.putExtra(PassphraseDialogActivity.EXTRA_DATA, data); + PendingIntent pi = PendingIntent.getActivity(getBaseContext(), 0, + intent, + PendingIntent.FLAG_CANCEL_CURRENT); + + // return PendingIntent to be executed by client + Intent result = new Intent(); + result.putExtra(OpenPgpApi.RESULT_INTENT, pi); + result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED); + return result; + } + + private PendingIntent getNfcSignPendingIntent(Intent data, long keyId, String pin, byte[] hashToSign, int hashAlgo) { // build PendingIntent for Yubikey NFC operations Intent intent = new Intent(getBaseContext(), NfcActivity.class); intent.setAction(NfcActivity.ACTION_SIGN_HASH); @@ -175,18 +189,12 @@ public class OpenPgpService extends RemoteService { intent.putExtra(NfcActivity.EXTRA_NFC_HASH_TO_SIGN, hashToSign); intent.putExtra(NfcActivity.EXTRA_NFC_HASH_ALGO, hashAlgo); - PendingIntent pi = PendingIntent.getActivity(getBaseContext(), 0, + return PendingIntent.getActivity(getBaseContext(), 0, intent, PendingIntent.FLAG_CANCEL_CURRENT); - - // return PendingIntent to be executed by client - Intent result = new Intent(); - result.putExtra(OpenPgpApi.RESULT_INTENT, pi); - result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED); - return result; } - private Intent getNfcDecryptIntent(Intent data, long subKeyId, String pin, byte[] encryptedSessionKey) { + private PendingIntent getNfcDecryptPendingIntent(Intent data, long subKeyId, String pin, byte[] encryptedSessionKey) { // build PendingIntent for Yubikey NFC operations Intent intent = new Intent(getBaseContext(), NfcActivity.class); intent.setAction(NfcActivity.ACTION_DECRYPT_SESSION_KEY); @@ -196,32 +204,31 @@ public class OpenPgpService extends RemoteService { intent.putExtra(NfcActivity.EXTRA_KEY_ID, subKeyId); intent.putExtra(NfcActivity.EXTRA_NFC_ENC_SESSION_KEY, encryptedSessionKey); - PendingIntent pi = PendingIntent.getActivity(getBaseContext(), 0, + return PendingIntent.getActivity(getBaseContext(), 0, intent, PendingIntent.FLAG_CANCEL_CURRENT); - - // return PendingIntent to be executed by client - Intent result = new Intent(); - result.putExtra(OpenPgpApi.RESULT_INTENT, pi); - result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED); - return result; } - private Intent getPassphraseIntent(Intent data, long keyId) { - // build PendingIntent for passphrase input - Intent intent = new Intent(getBaseContext(), PassphraseDialogActivity.class); - intent.putExtra(PassphraseDialogActivity.EXTRA_SUBKEY_ID, keyId); - // pass params through to activity that it can be returned again later to repeat pgp operation - intent.putExtra(PassphraseDialogActivity.EXTRA_DATA, data); - PendingIntent pi = PendingIntent.getActivity(getBaseContext(), 0, + private PendingIntent getKeyserverPendingIntent(Intent data, long masterKeyId) { + // If signature is unknown we return an _additional_ PendingIntent + // to retrieve the missing key + Intent intent = new Intent(getBaseContext(), ImportKeysActivity.class); + intent.setAction(ImportKeysActivity.ACTION_IMPORT_KEY_FROM_KEYSERVER_AND_RETURN_TO_SERVICE); + intent.putExtra(ImportKeysActivity.EXTRA_KEY_ID, masterKeyId); + intent.putExtra(ImportKeysActivity.EXTRA_PENDING_INTENT_DATA, data); + + return PendingIntent.getActivity(getBaseContext(), 0, intent, PendingIntent.FLAG_CANCEL_CURRENT); + } - // return PendingIntent to be executed by client - Intent result = new Intent(); - result.putExtra(OpenPgpApi.RESULT_INTENT, pi); - result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED); - return result; + private PendingIntent getShowKeyPendingIntent(long masterKeyId) { + Intent intent = new Intent(getBaseContext(), ViewKeyActivity.class); + intent.setData(KeyRings.buildGenericKeyRingUri(masterKeyId)); + + return PendingIntent.getActivity(getBaseContext(), 0, + intent, + PendingIntent.FLAG_CANCEL_CURRENT); } private Intent signImpl(Intent data, ParcelFileDescriptor input, @@ -274,21 +281,27 @@ public class OpenPgpService extends RemoteService { if (pgpResult.isPending()) { if ((pgpResult.getResult() & PgpSignEncryptResult.RESULT_PENDING_PASSPHRASE) == PgpSignEncryptResult.RESULT_PENDING_PASSPHRASE) { - return getPassphraseIntent(data, pgpResult.getKeyIdPassphraseNeeded()); + return returnPassphraseIntent(data, pgpResult.getKeyIdPassphraseNeeded()); } else if ((pgpResult.getResult() & PgpSignEncryptResult.RESULT_PENDING_NFC) == PgpSignEncryptResult.RESULT_PENDING_NFC) { // return PendingIntent to execute NFC activity // pass through the signature creation timestamp to be used again on second execution // of PgpSignEncrypt when we have the signed hash! data.putExtra(OpenPgpApi.EXTRA_NFC_SIG_CREATION_TIMESTAMP, pgpResult.getNfcTimestamp().getTime()); - return getNfcSignIntent(data, pgpResult.getNfcKeyId(), pgpResult.getNfcPassphrase(), pgpResult.getNfcHash(), pgpResult.getNfcAlgo()); + + // return PendingIntent to be executed by client + Intent result = new Intent(); + result.putExtra(OpenPgpApi.RESULT_INTENT, + getNfcSignPendingIntent(data, pgpResult.getNfcKeyId(), pgpResult.getNfcPassphrase(), pgpResult.getNfcHash(), pgpResult.getNfcAlgo())); + result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED); + return result; } else { throw new PgpGeneralException( "Encountered unhandled type of pending action not supported by API!"); } } else if (pgpResult.success()) { Intent result = new Intent(); - if (!cleartextSign) { + if (pgpResult.getDetachedSignature() != null && !cleartextSign) { result.putExtra(OpenPgpApi.RESULT_DETACHED_SIGNATURE, pgpResult.getDetachedSignature()); } result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_SUCCESS); @@ -340,7 +353,7 @@ public class OpenPgpService extends RemoteService { // get key ids based on given user ids String[] userIds = data.getStringArrayExtra(OpenPgpApi.EXTRA_USER_IDS); // give params through to activity... - Intent result = getKeyIdsFromEmails(data, userIds); + Intent result = returnKeyIdsFromEmails(data, userIds); if (result.getIntExtra(OpenPgpApi.RESULT_CODE, 0) == OpenPgpApi.RESULT_CODE_SUCCESS) { keyIds = result.getLongArrayExtra(OpenPgpApi.RESULT_KEY_IDS); @@ -391,14 +404,19 @@ public class OpenPgpService extends RemoteService { if (pgpResult.isPending()) { if ((pgpResult.getResult() & PgpSignEncryptResult.RESULT_PENDING_PASSPHRASE) == PgpSignEncryptResult.RESULT_PENDING_PASSPHRASE) { - return getPassphraseIntent(data, pgpResult.getKeyIdPassphraseNeeded()); + return returnPassphraseIntent(data, pgpResult.getKeyIdPassphraseNeeded()); } else if ((pgpResult.getResult() & PgpSignEncryptResult.RESULT_PENDING_NFC) == PgpSignEncryptResult.RESULT_PENDING_NFC) { // return PendingIntent to execute NFC activity // pass through the signature creation timestamp to be used again on second execution // of PgpSignEncrypt when we have the signed hash! data.putExtra(OpenPgpApi.EXTRA_NFC_SIG_CREATION_TIMESTAMP, pgpResult.getNfcTimestamp().getTime()); - return getNfcSignIntent(data, pgpResult.getNfcKeyId(), pgpResult.getNfcPassphrase(), pgpResult.getNfcHash(), pgpResult.getNfcAlgo()); + // return PendingIntent to be executed by client + Intent result = new Intent(); + result.putExtra(OpenPgpApi.RESULT_INTENT, + getNfcSignPendingIntent(data, pgpResult.getNfcKeyId(), pgpResult.getNfcPassphrase(), pgpResult.getNfcHash(), pgpResult.getNfcAlgo())); + result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED); + return result; } else { throw new PgpGeneralException( "Encountered unhandled type of pending action not supported by API!"); @@ -478,15 +496,20 @@ public class OpenPgpService extends RemoteService { if (pgpResult.isPending()) { if ((pgpResult.getResult() & DecryptVerifyResult.RESULT_PENDING_ASYM_PASSPHRASE) == DecryptVerifyResult.RESULT_PENDING_ASYM_PASSPHRASE) { - return getPassphraseIntent(data, pgpResult.getKeyIdPassphraseNeeded()); + return returnPassphraseIntent(data, pgpResult.getKeyIdPassphraseNeeded()); } else if ((pgpResult.getResult() & DecryptVerifyResult.RESULT_PENDING_SYM_PASSPHRASE) == DecryptVerifyResult.RESULT_PENDING_SYM_PASSPHRASE) { throw new PgpGeneralException( "Decryption of symmetric content not supported by API!"); } else if ((pgpResult.getResult() & DecryptVerifyResult.RESULT_PENDING_NFC) == DecryptVerifyResult.RESULT_PENDING_NFC) { - return getNfcDecryptIntent( - data, pgpResult.getNfcSubKeyId(), pgpResult.getNfcPassphrase(), pgpResult.getNfcEncryptedSessionKey()); + + // return PendingIntent to be executed by client + Intent result = new Intent(); + result.putExtra(OpenPgpApi.RESULT_INTENT, + getNfcDecryptPendingIntent(data, pgpResult.getNfcSubKeyId(), pgpResult.getNfcPassphrase(), pgpResult.getNfcEncryptedSessionKey())); + result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED); + return result; } else { throw new PgpGeneralException( "Encountered unhandled type of pending action not supported by API!"); @@ -509,16 +532,10 @@ public class OpenPgpService extends RemoteService { if (signatureResult.getStatus() == OpenPgpSignatureResult.SIGNATURE_KEY_MISSING) { // If signature is unknown we return an _additional_ PendingIntent // to retrieve the missing key - Intent intent = new Intent(getBaseContext(), ImportKeysActivity.class); - intent.setAction(ImportKeysActivity.ACTION_IMPORT_KEY_FROM_KEYSERVER_AND_RETURN_TO_SERVICE); - intent.putExtra(ImportKeysActivity.EXTRA_KEY_ID, signatureResult.getKeyId()); - intent.putExtra(ImportKeysActivity.EXTRA_PENDING_INTENT_DATA, data); - - PendingIntent pi = PendingIntent.getActivity(getBaseContext(), 0, - intent, - PendingIntent.FLAG_CANCEL_CURRENT); - - result.putExtra(OpenPgpApi.RESULT_INTENT, pi); + result.putExtra(OpenPgpApi.RESULT_INTENT, getKeyserverPendingIntent(data, signatureResult.getKeyId())); + } else { + // If signature key is known, return PendingIntent to show key + result.putExtra(OpenPgpApi.RESULT_INTENT, getShowKeyPendingIntent(signatureResult.getKeyId())); } } @@ -576,33 +593,15 @@ public class OpenPgpService extends RemoteService { Intent result = new Intent(); result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_SUCCESS); - // also return PendingIntent that opens the key view activity - Intent intent = new Intent(getBaseContext(), ViewKeyActivity.class); - intent.setData(KeyRings.buildGenericKeyRingUri(masterKeyId)); - - PendingIntent pi = PendingIntent.getActivity(getBaseContext(), 0, - intent, - PendingIntent.FLAG_CANCEL_CURRENT); - - result.putExtra(OpenPgpApi.RESULT_INTENT, pi); + result.putExtra(OpenPgpApi.RESULT_INTENT, getShowKeyPendingIntent(masterKeyId)); return result; } catch (ProviderHelper.NotFoundException e) { - Intent result = new Intent(); - // If keys are not in db we return an additional PendingIntent // to retrieve the missing key - Intent intent = new Intent(getBaseContext(), ImportKeysActivity.class); - intent.setAction(ImportKeysActivity.ACTION_IMPORT_KEY_FROM_KEYSERVER_AND_RETURN_TO_SERVICE); - intent.putExtra(ImportKeysActivity.EXTRA_KEY_ID, masterKeyId); - intent.putExtra(ImportKeysActivity.EXTRA_PENDING_INTENT_DATA, data); - - PendingIntent pi = PendingIntent.getActivity(getBaseContext(), 0, - intent, - PendingIntent.FLAG_CANCEL_CURRENT); - - result.putExtra(OpenPgpApi.RESULT_INTENT, pi); + Intent result = new Intent(); + result.putExtra(OpenPgpApi.RESULT_INTENT, getKeyserverPendingIntent(data, masterKeyId)); result.putExtra(OpenPgpApi.RESULT_CODE, OpenPgpApi.RESULT_CODE_USER_INTERACTION_REQUIRED); return result; } @@ -629,7 +628,7 @@ public class OpenPgpService extends RemoteService { } else { // get key ids based on given user ids String[] userIds = data.getStringArrayExtra(OpenPgpApi.EXTRA_USER_IDS); - return getKeyIdsFromEmails(data, userIds); + return returnKeyIdsFromEmails(data, userIds); } } @@ -669,7 +668,7 @@ public class OpenPgpService extends RemoteService { return result; } - // check if caller is allowed to access openpgp keychain + // check if caller is allowed to access OpenKeychain Intent result = isAllowed(data); if (result != null) { return result; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BaseActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BaseActivity.java index e6c2542a2..41fa50705 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BaseActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/BaseActivity.java @@ -88,12 +88,20 @@ public abstract class BaseActivity extends ActionBarActivity { /** * Close button only */ - protected void setFullScreenDialogClose(View.OnClickListener cancelOnClickListener) { - setActionBarIcon(R.drawable.ic_close_white_24dp); + protected void setFullScreenDialogClose(View.OnClickListener cancelOnClickListener, boolean white) { + if (white) { + setActionBarIcon(R.drawable.ic_close_white_24dp); + } else { + setActionBarIcon(R.drawable.ic_close_black_24dp); + } getSupportActionBar().setDisplayShowTitleEnabled(true); mToolbar.setNavigationOnClickListener(cancelOnClickListener); } + protected void setFullScreenDialogClose(View.OnClickListener cancelOnClickListener) { + setFullScreenDialogClose(cancelOnClickListener, true); + } + /** * Inflate custom design with two buttons using drawables. * This does not conform to the Material Design Guidelines, but we deviate here as this is used diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyActivity.java index 60cc404b6..2da5511b8 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyActivity.java @@ -39,8 +39,8 @@ public class CreateKeyActivity extends BaseActivity { super.onCreate(savedInstanceState); // pass extras into fragment - CreateKeyInputFragment frag = - CreateKeyInputFragment.newInstance( + CreateKeyNameFragment frag = + CreateKeyNameFragment.newInstance( getIntent().getStringExtra(EXTRA_NAME), getIntent().getStringExtra(EXTRA_EMAIL) ); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyEmailFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyEmailFragment.java new file mode 100644 index 000000000..d9f391149 --- /dev/null +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyEmailFragment.java @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2014 Dominik Schürmann <dominik@dominikschuermann.de> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package org.sufficientlysecure.keychain.ui; + +import android.app.Activity; +import android.content.Context; +import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.inputmethod.InputMethodManager; +import android.widget.EditText; + +import org.sufficientlysecure.keychain.R; +import org.sufficientlysecure.keychain.ui.CreateKeyActivity.FragAction; +import org.sufficientlysecure.keychain.ui.widget.EmailEditText; + +public class CreateKeyEmailFragment extends Fragment { + + public static final String ARG_NAME = "name"; + public static final String ARG_EMAIL = "email"; + + CreateKeyActivity mCreateKeyActivity; + EmailEditText mEmailEdit; + View mBackButton; + View mNextButton; + + String mName; + + /** + * Creates new instance of this fragment + */ + public static CreateKeyEmailFragment newInstance(String name, String email) { + CreateKeyEmailFragment frag = new CreateKeyEmailFragment(); + + Bundle args = new Bundle(); + args.putString(ARG_NAME, name); + args.putString(ARG_EMAIL, email); + + frag.setArguments(args); + + return frag; + } + + /** + * Checks if text of given EditText is not empty. If it is empty an error is + * set and the EditText gets the focus. + * + * @param context + * @param editText + * @return true if EditText is not empty + */ + private static boolean isEditTextNotEmpty(Context context, EditText editText) { + boolean output = true; + if (editText.getText().toString().length() == 0) { + editText.setError(context.getString(R.string.create_key_empty)); + editText.requestFocus(); + output = false; + } else { + editText.setError(null); + } + + return output; + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + View view = inflater.inflate(R.layout.create_key_email_fragment, container, false); + + mEmailEdit = (EmailEditText) view.findViewById(R.id.create_key_email); + mBackButton = view.findViewById(R.id.create_key_back_button); + mNextButton = view.findViewById(R.id.create_key_next_button); + + // initial values + mName = getArguments().getString(ARG_NAME); + String email = getArguments().getString(ARG_EMAIL); + mEmailEdit.setText(email); + + // focus empty edit fields + if (email == null) { + mEmailEdit.requestFocus(); + } + mBackButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + mCreateKeyActivity.loadFragment(null, null, FragAction.TO_LEFT); + } + }); + mNextButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + createKeyCheck(); + } + }); + + return view; + } + + @Override + public void onAttach(Activity activity) { + super.onAttach(activity); + mCreateKeyActivity = (CreateKeyActivity) getActivity(); + } + + private void createKeyCheck() { + if (isEditTextNotEmpty(getActivity(), mEmailEdit)) { + + CreateKeyPassphraseFragment frag = + CreateKeyPassphraseFragment.newInstance( + mName, + mEmailEdit.getText().toString() + ); + + mCreateKeyActivity.loadFragment(null, frag, FragAction.TO_RIGHT); + } + } + +} diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyFinalFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyFinalFragment.java index 920488e3e..dc9f3d4ad 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyFinalFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyFinalFragment.java @@ -95,7 +95,7 @@ public class CreateKeyFinalFragment extends Fragment { mEmailEdit = (TextView) view.findViewById(R.id.email); mUploadCheckbox = (CheckBox) view.findViewById(R.id.create_key_upload); mBackButton = view.findViewById(R.id.create_key_back_button); - mCreateButton = view.findViewById(R.id.create_key_create_button); + mCreateButton = view.findViewById(R.id.create_key_next_button); mEditText = (TextView) view.findViewById(R.id.create_key_edit_text); mEditButton = view.findViewById(R.id.create_key_edit_button); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyNameFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyNameFragment.java new file mode 100644 index 000000000..50a3bd655 --- /dev/null +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyNameFragment.java @@ -0,0 +1,140 @@ +/* + * Copyright (C) 2014 Dominik Schürmann <dominik@dominikschuermann.de> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package org.sufficientlysecure.keychain.ui; + +import android.app.Activity; +import android.content.Context; +import android.os.Bundle; +import android.support.v4.app.Fragment; +import android.view.LayoutInflater; +import android.view.View; +import android.view.ViewGroup; +import android.view.inputmethod.InputMethodManager; +import android.widget.EditText; + +import org.sufficientlysecure.keychain.R; +import org.sufficientlysecure.keychain.ui.CreateKeyActivity.FragAction; +import org.sufficientlysecure.keychain.ui.widget.EmailEditText; +import org.sufficientlysecure.keychain.ui.widget.NameEditText; + +public class CreateKeyNameFragment extends Fragment { + + public static final String ARG_NAME = "name"; + public static final String ARG_EMAIL = "email"; + + CreateKeyActivity mCreateKeyActivity; + NameEditText mNameEdit; + View mNextButton; + + String mEmail; + + /** + * Creates new instance of this fragment + */ + public static CreateKeyNameFragment newInstance(String name, String email) { + CreateKeyNameFragment frag = new CreateKeyNameFragment(); + + Bundle args = new Bundle(); + args.putString(ARG_NAME, name); + args.putString(ARG_EMAIL, email); + + frag.setArguments(args); + + return frag; + } + + /** + * Checks if text of given EditText is not empty. If it is empty an error is + * set and the EditText gets the focus. + * + * @param context + * @param editText + * @return true if EditText is not empty + */ + private static boolean isEditTextNotEmpty(Context context, EditText editText) { + boolean output = true; + if (editText.getText().toString().length() == 0) { + editText.setError(context.getString(R.string.create_key_empty)); + editText.requestFocus(); + output = false; + } else { + editText.setError(null); + } + + return output; + } + + private static boolean areEditTextsEqual(Context context, EditText editText1, EditText editText2) { + boolean output = true; + if (!editText1.getText().toString().equals(editText2.getText().toString())) { + editText2.setError(context.getString(R.string.create_key_passphrases_not_equal)); + editText2.requestFocus(); + output = false; + } else { + editText2.setError(null); + } + + return output; + } + + @Override + public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { + View view = inflater.inflate(R.layout.create_key_name_fragment, container, false); + + mNameEdit = (NameEditText) view.findViewById(R.id.create_key_name); + mNextButton = view.findViewById(R.id.create_key_next_button); + + // initial values + String name = getArguments().getString(ARG_NAME); + mEmail = getArguments().getString(ARG_EMAIL); + mNameEdit.setText(name); + + // focus empty edit fields + if (name == null) { + mNameEdit.requestFocus(); + } + mNextButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + createKeyCheck(); + } + }); + + return view; + } + + @Override + public void onAttach(Activity activity) { + super.onAttach(activity); + mCreateKeyActivity = (CreateKeyActivity) getActivity(); + } + + private void createKeyCheck() { + if (isEditTextNotEmpty(getActivity(), mNameEdit)) { + + CreateKeyEmailFragment frag = + CreateKeyEmailFragment.newInstance( + mNameEdit.getText().toString(), + mEmail + ); + + mCreateKeyActivity.loadFragment(null, frag, FragAction.TO_RIGHT); + } + } + +} diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyInputFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyPassphraseFragment.java index b496d40fd..00ac00ff4 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyInputFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyPassphraseFragment.java @@ -17,43 +17,46 @@ package org.sufficientlysecure.keychain.ui; +import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.support.v4.app.Fragment; +import android.text.method.HideReturnsTransformationMethod; +import android.text.method.PasswordTransformationMethod; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.view.inputmethod.InputMethodManager; -import android.widget.ArrayAdapter; -import android.widget.AutoCompleteTextView; +import android.widget.CheckBox; +import android.widget.CompoundButton; import android.widget.EditText; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.ui.CreateKeyActivity.FragAction; -import org.sufficientlysecure.keychain.ui.widget.EmailEditText; -import org.sufficientlysecure.keychain.ui.widget.PasswordEditText; -import org.sufficientlysecure.keychain.ui.widget.passwordstrengthindicator.PasswordStrengthView; -import org.sufficientlysecure.keychain.util.ContactHelper; +import org.sufficientlysecure.keychain.ui.widget.PassphraseEditText; -public class CreateKeyInputFragment extends Fragment { - - CreateKeyActivity mCreateKeyActivity; - - PasswordStrengthView mPassphraseStrengthView; - AutoCompleteTextView mNameEdit; - EmailEditText mEmailEdit; - PasswordEditText mPassphraseEdit; - EditText mPassphraseEditAgain; - View mCreateButton; +public class CreateKeyPassphraseFragment extends Fragment { public static final String ARG_NAME = "name"; public static final String ARG_EMAIL = "email"; + // model + String mName; + String mEmail; + + // view + CreateKeyActivity mCreateKeyActivity; + PassphraseEditText mPassphraseEdit; + EditText mPassphraseEditAgain; + CheckBox mShowPassphrase; + View mBackButton; + View mNextButton; + /** * Creates new instance of this fragment */ - public static CreateKeyInputFragment newInstance(String name, String email) { - CreateKeyInputFragment frag = new CreateKeyInputFragment(); + public static CreateKeyPassphraseFragment newInstance(String name, String email) { + CreateKeyPassphraseFragment frag = new CreateKeyPassphraseFragment(); Bundle args = new Bundle(); args.putString(ARG_NAME, name); @@ -64,84 +67,102 @@ public class CreateKeyInputFragment extends Fragment { return frag; } + /** + * Checks if text of given EditText is not empty. If it is empty an error is + * set and the EditText gets the focus. + * + * @param context + * @param editText + * @return true if EditText is not empty + */ + private static boolean isEditTextNotEmpty(Context context, EditText editText) { + boolean output = true; + if (editText.getText().toString().length() == 0) { + editText.setError(context.getString(R.string.create_key_empty)); + editText.requestFocus(); + output = false; + } else { + editText.setError(null); + } + + return output; + } + + private static boolean areEditTextsEqual(Context context, EditText editText1, EditText editText2) { + boolean output = true; + if (!editText1.getText().toString().equals(editText2.getText().toString())) { + editText2.setError(context.getString(R.string.create_key_passphrases_not_equal)); + editText2.requestFocus(); + output = false; + } else { + editText2.setError(null); + } + + return output; + } + @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { - View view = inflater.inflate(R.layout.create_key_input_fragment, container, false); + View view = inflater.inflate(R.layout.create_key_passphrase_fragment, container, false); - mPassphraseStrengthView = (PasswordStrengthView) view.findViewById(R.id - .create_key_passphrase_strength); - mNameEdit = (AutoCompleteTextView) view.findViewById(R.id.create_key_name); - mEmailEdit = (EmailEditText) view.findViewById(R.id.create_key_email); - mPassphraseEdit = (PasswordEditText) view.findViewById(R.id.create_key_passphrase); + mPassphraseEdit = (PassphraseEditText) view.findViewById(R.id.create_key_passphrase); mPassphraseEditAgain = (EditText) view.findViewById(R.id.create_key_passphrase_again); - mCreateButton = view.findViewById(R.id.create_key_button); + mShowPassphrase = (CheckBox) view.findViewById(R.id.create_key_show_passphrase); + mBackButton = view.findViewById(R.id.create_key_back_button); + mNextButton = view.findViewById(R.id.create_key_next_button); // initial values - String name = getArguments().getString(ARG_NAME); - String email = getArguments().getString(ARG_EMAIL); - mNameEdit.setText(name); - mEmailEdit.setText(email); - - // focus non-empty edit fields - if (name != null && email != null) { - mPassphraseEdit.requestFocus(); - } else if (name != null) { - mEmailEdit.requestFocus(); - } - - mEmailEdit.setThreshold(1); // Start working from first character - mEmailEdit.setAdapter( - new ArrayAdapter<> - (getActivity(), android.R.layout.simple_spinner_dropdown_item, - ContactHelper.getPossibleUserEmails(getActivity()) - ) - ); - - - mNameEdit.setThreshold(1); // Start working from first character - mNameEdit.setAdapter( - new ArrayAdapter<> - (getActivity(), android.R.layout.simple_spinner_dropdown_item, - ContactHelper.getPossibleUserNames(getActivity()) - ) - ); - - // Edit text padding doesn't work via xml (http://code.google.com/p/android/issues/detail?id=77982) - // so we set the right padding programmatically. - mPassphraseEdit.setPadding(mPassphraseEdit.getPaddingLeft(), - mPassphraseEdit.getPaddingTop(), - (int) (56 * getResources().getDisplayMetrics().density), - mPassphraseEdit.getPaddingBottom()); - - mPassphraseEdit.setPasswordStrengthView(mPassphraseStrengthView); - - mCreateButton.setOnClickListener(new View.OnClickListener() { + mName = getArguments().getString(ARG_NAME); + mEmail = getArguments().getString(ARG_EMAIL); + mPassphraseEdit.requestFocus(); + mBackButton.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + back(); + } + }); + mNextButton.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { createKeyCheck(); } }); + mShowPassphrase.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { + if (isChecked) { + mPassphraseEdit.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); + mPassphraseEditAgain.setTransformationMethod(HideReturnsTransformationMethod.getInstance()); + } else { + mPassphraseEdit.setTransformationMethod(PasswordTransformationMethod.getInstance()); + mPassphraseEditAgain.setTransformationMethod(PasswordTransformationMethod.getInstance()); + } + } + }); + return view; } @Override - public void onActivityCreated(Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); - + public void onAttach(Activity activity) { + super.onAttach(activity); mCreateKeyActivity = (CreateKeyActivity) getActivity(); } + private void back() { + hideKeyboard(); + mCreateKeyActivity.loadFragment(null, null, FragAction.TO_LEFT); + } + private void createKeyCheck() { - if (isEditTextNotEmpty(getActivity(), mNameEdit) - && isEditTextNotEmpty(getActivity(), mEmailEdit) - && isEditTextNotEmpty(getActivity(), mPassphraseEdit) + if (isEditTextNotEmpty(getActivity(), mPassphraseEdit) && areEditTextsEqual(getActivity(), mPassphraseEdit, mPassphraseEditAgain)) { CreateKeyFinalFragment frag = CreateKeyFinalFragment.newInstance( - mNameEdit.getText().toString(), - mEmailEdit.getText().toString(), + mName, + mEmail, mPassphraseEdit.getText().toString() ); @@ -165,38 +186,4 @@ public class CreateKeyInputFragment extends Fragment { inputManager.hideSoftInputFromWindow(v.getWindowToken(), 0); } - /** - * Checks if text of given EditText is not empty. If it is empty an error is - * set and the EditText gets the focus. - * - * @param context - * @param editText - * @return true if EditText is not empty - */ - private static boolean isEditTextNotEmpty(Context context, EditText editText) { - boolean output = true; - if (editText.getText().toString().length() == 0) { - editText.setError(context.getString(R.string.create_key_empty)); - editText.requestFocus(); - output = false; - } else { - editText.setError(null); - } - - return output; - } - - private static boolean areEditTextsEqual(Context context, EditText editText1, EditText editText2) { - boolean output = true; - if (!editText1.getText().toString().equals(editText2.getText().toString())) { - editText2.setError(context.getString(R.string.create_key_passphrases_not_equal)); - editText2.requestFocus(); - output = false; - } else { - editText2.setError(null); - } - - return output; - } - } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFilesActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFilesActivity.java index 89dd4970b..162b10eca 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFilesActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptFilesActivity.java @@ -17,9 +17,12 @@ package org.sufficientlysecure.keychain.ui; +import android.app.Activity; import android.content.Intent; import android.net.Uri; import android.os.Bundle; +import android.os.PersistableBundle; +import android.view.View; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; @@ -40,6 +43,14 @@ public class DecryptFilesActivity extends BaseActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + setFullScreenDialogClose(new View.OnClickListener() { + @Override + public void onClick(View v) { + setResult(Activity.RESULT_CANCELED); + finish(); + } + }, false); + // Handle intent actions handleActions(savedInstanceState, getIntent()); } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptTextActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptTextActivity.java index 81a8a2ac4..1e9e7bcb1 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptTextActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/DecryptTextActivity.java @@ -18,9 +18,11 @@ package org.sufficientlysecure.keychain.ui; +import android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.text.TextUtils; +import android.view.View; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; @@ -49,6 +51,14 @@ public class DecryptTextActivity extends BaseActivity { public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + setFullScreenDialogClose(new View.OnClickListener() { + @Override + public void onClick(View v) { + setResult(Activity.RESULT_CANCELED); + finish(); + } + }, false); + // Handle intent actions handleActions(savedInstanceState, getIntent()); } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java index 0d7e6056e..ed5920cde 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptActivity.java @@ -1,10 +1,29 @@ +/* + * Copyright (C) 2014 Dominik Schürmann <dominik@dominikschuermann.de> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + package org.sufficientlysecure.keychain.ui; +import android.app.Activity; import android.app.ProgressDialog; import android.content.Intent; import android.os.Bundle; import android.os.Message; import android.os.Messenger; +import android.view.View; import org.openintents.openpgp.util.OpenPgpApi; import org.sufficientlysecure.keychain.R; @@ -26,6 +45,19 @@ public abstract class EncryptActivity extends BaseActivity { protected Date mNfcTimestamp = null; protected byte[] mNfcHash = null; + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setFullScreenDialogClose(new View.OnClickListener() { + @Override + public void onClick(View v) { + setResult(Activity.RESULT_CANCELED); + finish(); + } + }, false); + } + protected void startPassphraseDialog(long subkeyId) { Intent intent = new Intent(this, PassphraseDialogActivity.class); intent.putExtra(PassphraseDialogActivity.EXTRA_SUBKEY_ID, subkeyId); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesActivity.java index 11b596c24..d95b5cda3 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesActivity.java @@ -67,8 +67,8 @@ public class EncryptFilesActivity extends EncryptActivity implements EncryptActi private String mEncryptionUserIds[] = null; private long mSigningKeyId = Constants.key.none; private String mPassphrase = ""; - private boolean mUseArmor; - private boolean mUseCompression; + private boolean mUseArmor = false; + private boolean mUseCompression = true; private boolean mDeleteAfterEncrypt = false; private boolean mShareAfterEncrypt = false; private ArrayList<Uri> mInputUris; @@ -209,6 +209,7 @@ public class EncryptFilesActivity extends EncryptActivity implements EncryptActi } else { data.setCompressionId(CompressionAlgorithmTags.UNCOMPRESSED); } + data.setEnableAsciiArmorOutput(mUseArmor); data.setSymmetricEncryptionAlgorithm(PgpConstants.OpenKeychainSymmetricKeyAlgorithmTags.USE_PREFERRED); data.setSignatureHashAlgorithm(PgpConstants.OpenKeychainSymmetricKeyAlgorithmTags.USE_PREFERRED); @@ -314,15 +315,6 @@ public class EncryptFilesActivity extends EncryptActivity implements EncryptActi public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); - // if called with an intent action, do not init drawer navigation - if (ACTION_ENCRYPT_DATA.equals(getIntent().getAction())) { - // lock drawer -// deactivateDrawerNavigation(); - // TODO: back button to key? - } else { -// activateDrawerNavigation(savedInstanceState); - } - // Handle intent actions handleActions(getIntent()); updateModeFragment(); @@ -339,17 +331,6 @@ public class EncryptFilesActivity extends EncryptActivity implements EncryptActi return super.onCreateOptionsMenu(menu); } - private void updateModeFragment() { - getSupportFragmentManager().beginTransaction() - .replace(R.id.encrypt_pager_mode, - mCurrentMode == MODE_SYMMETRIC - ? new EncryptSymmetricFragment() - : new EncryptAsymmetricFragment() - ) - .commitAllowingStateLoss(); - getSupportFragmentManager().executePendingTransactions(); - } - @Override public boolean onOptionsItemSelected(MenuItem item) { if (item.isCheckable()) { @@ -384,6 +365,17 @@ public class EncryptFilesActivity extends EncryptActivity implements EncryptActi return true; } + private void updateModeFragment() { + getSupportFragmentManager().beginTransaction() + .replace(R.id.encrypt_pager_mode, + mCurrentMode == MODE_SYMMETRIC + ? new EncryptSymmetricFragment() + : new EncryptAsymmetricFragment() + ) + .commitAllowingStateLoss(); + getSupportFragmentManager().executePendingTransactions(); + } + /** * Handles all actions with this intent * @@ -418,9 +410,7 @@ public class EncryptFilesActivity extends EncryptActivity implements EncryptActi uris = intent.getParcelableArrayListExtra(Intent.EXTRA_STREAM); } - if (extras.containsKey(EXTRA_ASCII_ARMOR)) { - mUseArmor = extras.getBoolean(EXTRA_ASCII_ARMOR, true); - } + mUseArmor = extras.getBoolean(EXTRA_ASCII_ARMOR, false); // preselect keys given by intent mSigningKeyId = extras.getLong(EXTRA_SIGNATURE_KEY_ID); @@ -428,7 +418,6 @@ public class EncryptFilesActivity extends EncryptActivity implements EncryptActi // Save uris mInputUris = uris; - } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesFragment.java index 860bd8502..ace58b165 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptFilesFragment.java @@ -27,6 +27,7 @@ import android.os.Build; import android.os.Bundle; import android.support.v4.app.Fragment; import android.view.LayoutInflater; +import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.BaseAdapter; @@ -56,7 +57,6 @@ public class EncryptFilesFragment extends Fragment implements EncryptActivityInt // view private View mAddView; - private View mShareFile; private ListView mSelectedFiles; private SelectedFilesAdapter mAdapter = new SelectedFilesAdapter(); private final Map<Uri, Bitmap> thumbnailCache = new HashMap<>(); @@ -78,21 +78,6 @@ public class EncryptFilesFragment extends Fragment implements EncryptActivityInt public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View view = inflater.inflate(R.layout.encrypt_files_fragment, container, false); - View vEncryptFile = view.findViewById(R.id.action_encrypt_file); - vEncryptFile.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - encryptClicked(false); - } - }); - mShareFile = view.findViewById(R.id.action_encrypt_share); - mShareFile.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - encryptClicked(true); - } - }); - mAddView = inflater.inflate(R.layout.file_list_entry_add, null); mAddView.setOnClickListener(new View.OnClickListener() { @Override @@ -108,8 +93,10 @@ public class EncryptFilesFragment extends Fragment implements EncryptActivityInt } @Override - public void onActivityCreated(Bundle savedInstanceState) { - super.onActivityCreated(savedInstanceState); + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setHasOptionsMenu(true); } private void addInputUri() { @@ -192,6 +179,24 @@ public class EncryptFilesFragment extends Fragment implements EncryptActivityInt } @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case R.id.encrypt_save: { + encryptClicked(false); + break; + } + case R.id.encrypt_share: { + encryptClicked(true); + break; + } + default: { + return super.onOptionsItemSelected(item); + } + } + return true; + } + + @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { switch (requestCode) { case REQUEST_CODE_INPUT: { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java index 08ff5b962..ee15cf7b5 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextActivity.java @@ -72,7 +72,7 @@ public class EncryptTextActivity extends EncryptActivity implements EncryptActiv private ArrayList<Uri> mInputUris; private ArrayList<Uri> mOutputUris; private String mMessage = ""; - private boolean mUseCompression; + private boolean mUseCompression = true; public boolean isModeSymmetric() { return MODE_SYMMETRIC == mCurrentMode; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextFragment.java index b13cb7837..5d9994c5c 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/EncryptTextFragment.java @@ -23,6 +23,7 @@ import android.support.v4.app.Fragment; import android.text.Editable; import android.text.TextWatcher; import android.view.LayoutInflater; +import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.TextView; @@ -33,8 +34,6 @@ public class EncryptTextFragment extends Fragment { public static final String ARG_TEXT = "text"; private TextView mText; - private View mEncryptShare; - private View mEncryptClipboard; private EncryptActivityInterface mEncryptInterface; @@ -72,24 +71,16 @@ public class EncryptTextFragment extends Fragment { mEncryptInterface.setMessage(s.toString()); } }); - mEncryptClipboard = view.findViewById(R.id.action_encrypt_clipboard); - mEncryptShare = view.findViewById(R.id.action_encrypt_share); - mEncryptClipboard.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - mEncryptInterface.startEncrypt(false); - } - }); - mEncryptShare.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - mEncryptInterface.startEncrypt(true); - } - }); return view; } + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + setHasOptionsMenu(true); + } @Override public void onActivityCreated(Bundle savedInstanceState) { @@ -100,4 +91,22 @@ public class EncryptTextFragment extends Fragment { mText.setText(text); } } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + switch (item.getItemId()) { + case R.id.encrypt_copy: { + mEncryptInterface.startEncrypt(false); + break; + } + case R.id.encrypt_share: { + mEncryptInterface.startEncrypt(true); + break; + } + default: { + return super.onOptionsItemSelected(item); + } + } + return true; + } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvActivity.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvActivity.java index 9390e8a69..0654f0c9a 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvActivity.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyAdvActivity.java @@ -76,8 +76,8 @@ public class ViewKeyAdvActivity extends BaseActivity implements mExportHelper = new ExportHelper(this); mProviderHelper = new ProviderHelper(this); - mViewPager = (ViewPager) findViewById(R.id.view_key_pager); - mSlidingTabLayout = (PagerSlidingTabStrip) findViewById(R.id.view_key_sliding_tab_layout); + mViewPager = (ViewPager) findViewById(R.id.pager); + mSlidingTabLayout = (PagerSlidingTabStrip) findViewById(R.id.sliding_tab_layout); int switchToTab = TAB_MAIN; Intent intent = getIntent(); diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/AddUserIdDialogFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/AddUserIdDialogFragment.java index ee4af8cbe..5dd675fd3 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/AddUserIdDialogFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/AddUserIdDialogFragment.java @@ -33,8 +33,6 @@ import android.view.LayoutInflater; import android.view.View; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputMethodManager; -import android.widget.ArrayAdapter; -import android.widget.AutoCompleteTextView; import android.widget.Button; import android.widget.EditText; import android.widget.TextView; @@ -44,7 +42,7 @@ import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.pgp.KeyRing; import org.sufficientlysecure.keychain.ui.widget.EmailEditText; -import org.sufficientlysecure.keychain.util.ContactHelper; +import org.sufficientlysecure.keychain.ui.widget.NameEditText; import org.sufficientlysecure.keychain.util.Log; public class AddUserIdDialogFragment extends DialogFragment implements OnEditorActionListener { @@ -57,7 +55,7 @@ public class AddUserIdDialogFragment extends DialogFragment implements OnEditorA public static final String MESSAGE_DATA_USER_ID = "user_id"; private Messenger mMessenger; - private AutoCompleteTextView mName; + private NameEditText mName; private EmailEditText mEmail; private EditText mComment; @@ -81,11 +79,6 @@ public class AddUserIdDialogFragment extends DialogFragment implements OnEditorA mMessenger = getArguments().getParcelable(ARG_MESSENGER); String predefinedName = getArguments().getString(ARG_NAME); - ArrayAdapter<String> autoCompleteEmailAdapter = new ArrayAdapter<> - (getActivity(), android.R.layout.simple_spinner_dropdown_item, - ContactHelper.getPossibleUserEmails(getActivity()) - ); - CustomAlertDialogBuilder alert = new CustomAlertDialogBuilder(activity); alert.setTitle(R.string.edit_key_action_add_identity); @@ -94,16 +87,12 @@ public class AddUserIdDialogFragment extends DialogFragment implements OnEditorA View view = inflater.inflate(R.layout.add_user_id_dialog, null); alert.setView(view); - mName = (AutoCompleteTextView) view.findViewById(R.id.add_user_id_name); + mName = (NameEditText) view.findViewById(R.id.add_user_id_name); mEmail = (EmailEditText) view.findViewById(R.id.add_user_id_address); mComment = (EditText) view.findViewById(R.id.add_user_id_comment); mName.setText(predefinedName); - - mEmail.setThreshold(1); // Start working from first character - mEmail.setAdapter(autoCompleteEmailAdapter); - alert.setPositiveButton(android.R.string.ok, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { @@ -118,14 +107,6 @@ public class AddUserIdDialogFragment extends DialogFragment implements OnEditorA } }); - mName.setThreshold(1); // Start working from first character - mName.setAdapter( - new ArrayAdapter<> - (getActivity(), android.R.layout.simple_spinner_dropdown_item, - ContactHelper.getPossibleUserNames(getActivity()) - ) - ); - alert.setNegativeButton(android.R.string.cancel, new OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteFileDialogFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteFileDialogFragment.java index 07462b4ff..c4b437593 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteFileDialogFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/DeleteFileDialogFragment.java @@ -28,8 +28,10 @@ import android.support.v4.app.DialogFragment; import android.support.v4.app.FragmentActivity; import android.widget.Toast; +import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.util.FileHelper; +import org.sufficientlysecure.keychain.util.Log; import java.io.File; @@ -69,41 +71,44 @@ public class DeleteFileDialogFragment extends DialogFragment { @Override public void onClick(DialogInterface dialog, int id) { dismiss(); - String scheme = deleteUri.getScheme(); - if(scheme.equals(ContentResolver.SCHEME_FILE)) { - if(new File(deleteUri.getPath()).delete()) { - Toast.makeText(getActivity(), R.string.file_delete_successful, Toast.LENGTH_SHORT).show(); - return; - } - } - else if(scheme.equals(ContentResolver.SCHEME_CONTENT)) { - // We can not securely delete Uris, so just use usual delete on them - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + // NOTE: Use Toasts, not Snackbars. When sharing to another application snackbars + // would not show up! + + // Use DocumentsContract on Android >= 4.4 + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { + try { if (DocumentsContract.deleteDocument(getActivity().getContentResolver(), deleteUri)) { - Toast.makeText(getActivity(), R.string.file_delete_successful, Toast.LENGTH_SHORT).show(); + Toast.makeText(getActivity(), getActivity().getString(R.string.file_delete_successful, + deleteFilename), Toast.LENGTH_LONG).show(); return; } + } catch (UnsupportedOperationException e) { + Log.d(Constants.TAG, "Catched UnsupportedOperationException, can happen when delete is not supported!", e); } + } + try { if (getActivity().getContentResolver().delete(deleteUri, null, null) > 0) { - Toast.makeText(getActivity(), R.string.file_delete_successful, Toast.LENGTH_SHORT).show(); - return; - } - - // some Uri's a ContentResolver fails to delete is handled by the java.io.File's delete - // via the path of the Uri - if(new File(deleteUri.getPath()).delete()) { - Toast.makeText(getActivity(), R.string.file_delete_successful, Toast.LENGTH_SHORT).show(); + Toast.makeText(getActivity(), getActivity().getString(R.string.file_delete_successful, + deleteFilename), Toast.LENGTH_LONG).show(); return; } + } catch (UnsupportedOperationException e) { + Log.d(Constants.TAG, "Catched UnsupportedOperationException, can happen when delete is not supported!", e); } - Toast.makeText(getActivity(), getActivity().getString(R.string.error_file_delete_failed, - deleteFilename), Toast.LENGTH_SHORT).show(); + // some Uri's a ContentResolver fails to delete is handled by the java.io.File's delete + // via the path of the Uri + if (new File(deleteUri.getPath()).delete()) { + Toast.makeText(getActivity(), getActivity().getString(R.string.file_delete_successful, + deleteFilename), Toast.LENGTH_LONG).show(); + return; + } // Note: We can't delete every file... - // If possible we should find out if deletion is possible before even showing the option to do so. + Toast.makeText(getActivity(), getActivity().getString(R.string.error_file_delete_failed, + deleteFilename), Toast.LENGTH_LONG).show(); } }); alert.setNegativeButton(android.R.string.cancel, new DialogInterface.OnClickListener() { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/SetPassphraseDialogFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/SetPassphraseDialogFragment.java index 9e1f21f60..b34dc2edc 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/SetPassphraseDialogFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/dialog/SetPassphraseDialogFragment.java @@ -43,8 +43,7 @@ import android.widget.Toast; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; -import org.sufficientlysecure.keychain.ui.widget.PasswordEditText; -import org.sufficientlysecure.keychain.ui.widget.passwordstrengthindicator.PasswordStrengthView; +import org.sufficientlysecure.keychain.ui.widget.PassphraseEditText; import org.sufficientlysecure.keychain.util.Log; public class SetPassphraseDialogFragment extends DialogFragment implements OnEditorActionListener { @@ -57,10 +56,9 @@ public class SetPassphraseDialogFragment extends DialogFragment implements OnEdi public static final String MESSAGE_NEW_PASSPHRASE = "new_passphrase"; private Messenger mMessenger; - private PasswordEditText mPassphraseEditText; + private PassphraseEditText mPassphraseEditText; private EditText mPassphraseAgainEditText; private CheckBox mNoPassphraseCheckBox; - private PasswordStrengthView mPassphraseStrengthView; /** * Creates new instance of this dialog fragment @@ -100,11 +98,9 @@ public class SetPassphraseDialogFragment extends DialogFragment implements OnEdi View view = inflater.inflate(R.layout.passphrase_repeat_dialog, null); alert.setView(view); - mPassphraseEditText = (PasswordEditText) view.findViewById(R.id.passphrase_passphrase); + mPassphraseEditText = (PassphraseEditText) view.findViewById(R.id.passphrase_passphrase); mPassphraseAgainEditText = (EditText) view.findViewById(R.id.passphrase_passphrase_again); mNoPassphraseCheckBox = (CheckBox) view.findViewById(R.id.passphrase_no_passphrase); - mPassphraseStrengthView = (PasswordStrengthView) view.findViewById(R.id.passphrase_repeat_passphrase_strength); - mPassphraseEditText.setPasswordStrengthView(mPassphraseStrengthView); if (TextUtils.isEmpty(oldPassphrase)) { diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/EmailEditText.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/EmailEditText.java index 697f5a61e..1bdec7b84 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/EmailEditText.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/EmailEditText.java @@ -25,6 +25,7 @@ import android.text.InputType; import android.text.TextWatcher; import android.util.AttributeSet; import android.util.Patterns; +import android.view.inputmethod.EditorInfo; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; @@ -34,35 +35,33 @@ import org.sufficientlysecure.keychain.util.ContactHelper; import java.util.regex.Matcher; public class EmailEditText extends AutoCompleteTextView { - EmailEditText emailEditText; public EmailEditText(Context context) { super(context); - emailEditText = this; - this.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS); - this.addTextChangedListener(textWatcher); + init(); } public EmailEditText(Context context, AttributeSet attrs) { super(context, attrs); - emailEditText = this; - this.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS); - this.addTextChangedListener(textWatcher); + init(); } public EmailEditText(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); - emailEditText = this; - this.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS); - this.addTextChangedListener(textWatcher); + init(); } @TargetApi(Build.VERSION_CODES.LOLLIPOP) public EmailEditText(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr, defStyleRes); - emailEditText = this; + init(); + } + + private void init() { this.setInputType(InputType.TYPE_CLASS_TEXT | InputType.TYPE_TEXT_VARIATION_EMAIL_ADDRESS); this.addTextChangedListener(textWatcher); + removeFlag(); + initAdapter(); } TextWatcher textWatcher = new TextWatcher() { @@ -82,16 +81,32 @@ public class EmailEditText extends AutoCompleteTextView { if (email.length() > 0) { Matcher emailMatcher = Patterns.EMAIL_ADDRESS.matcher(email); if (emailMatcher.matches()) { - emailEditText.setCompoundDrawablesWithIntrinsicBounds(0, 0, + EmailEditText.this.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.uid_mail_ok, 0); } else { - emailEditText.setCompoundDrawablesWithIntrinsicBounds(0, 0, + EmailEditText.this.setCompoundDrawablesWithIntrinsicBounds(0, 0, R.drawable.uid_mail_bad, 0); } } else { // remove drawable if email is empty - emailEditText.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); + EmailEditText.this.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0); } } }; + + private void initAdapter() { + setThreshold(1); // Start working from first character + setAdapter(new ArrayAdapter<>(getContext(), android.R.layout.simple_spinner_dropdown_item, + ContactHelper.getPossibleUserEmails(getContext()))); + } + + /** + * Hack to re-enable keyboard auto correction in AutoCompleteTextView. + * From http://stackoverflow.com/a/22512858 + */ + private void removeFlag() { + int inputType = getInputType(); + inputType &= ~EditorInfo.TYPE_TEXT_FLAG_AUTO_COMPLETE; + setRawInputType(inputType); + } } diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/AutoCorrectAutoCompleteTextView.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/NameEditText.java index ed373a938..f086c5696 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/AutoCorrectAutoCompleteTextView.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/NameEditText.java @@ -17,32 +17,54 @@ package org.sufficientlysecure.keychain.ui.widget; +import android.annotation.TargetApi; import android.content.Context; +import android.os.Build; import android.util.AttributeSet; import android.view.inputmethod.EditorInfo; +import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; -/** - * Hack to re-enable keyboard auto correction in AutoCompleteTextView. - * From http://stackoverflow.com/a/22512858 - */ -public class AutoCorrectAutoCompleteTextView extends AutoCompleteTextView { +import org.sufficientlysecure.keychain.util.ContactHelper; - public AutoCorrectAutoCompleteTextView(Context context) { +public class NameEditText extends AutoCompleteTextView { + public NameEditText(Context context) { super(context); - removeFlag(); + init(); } - public AutoCorrectAutoCompleteTextView(Context context, AttributeSet attrs) { + public NameEditText(Context context, AttributeSet attrs) { super(context, attrs); - removeFlag(); + init(); + } + + public NameEditText(Context context, AttributeSet attrs, int defStyleAttr) { + super(context, attrs, defStyleAttr); + init(); } - public AutoCorrectAutoCompleteTextView(Context context, AttributeSet attrs, int defStyle) { - super(context, attrs, defStyle); + @TargetApi(Build.VERSION_CODES.LOLLIPOP) + public NameEditText(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { + super(context, attrs, defStyleAttr, defStyleRes); + init(); + } + + private void init() { removeFlag(); + initAdapter(); + } + + private void initAdapter() { + setThreshold(1); // Start working from first character + setAdapter(new ArrayAdapter<>( + getContext(), android.R.layout.simple_spinner_dropdown_item, + ContactHelper.getPossibleUserNames(getContext()))); } + /** + * Hack to re-enable keyboard auto correction in AutoCompleteTextView. + * From http://stackoverflow.com/a/22512858 + */ private void removeFlag() { int inputType = getInputType(); inputType &= ~EditorInfo.TYPE_TEXT_FLAG_AUTO_COMPLETE; diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/PassphraseEditText.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/PassphraseEditText.java new file mode 100644 index 000000000..377f701d1 --- /dev/null +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/PassphraseEditText.java @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2014 Dominik Schürmann <dominik@dominikschuermann.de> + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +package org.sufficientlysecure.keychain.ui.widget; + +import android.content.Context; +import android.graphics.Canvas; +import android.text.Editable; +import android.text.TextWatcher; +import android.util.AttributeSet; +import android.util.TypedValue; +import android.widget.EditText; + +import org.sufficientlysecure.keychain.ui.widget.passwordstrengthindicator.PasswordStrengthBarView; + +public class PassphraseEditText extends EditText { + + PasswordStrengthBarView mPasswordStrengthBarView; + int mPasswordBarWidth; + int mPasswordBarHeight; + float barGap; + + public PassphraseEditText(Context context, AttributeSet attrs) { + super(context, attrs); + init(context, attrs); + } + + private void init(Context context, AttributeSet attrs) { + mPasswordBarHeight = (int) (8 * getResources().getDisplayMetrics().density); + mPasswordBarWidth = (int) (50 * getResources().getDisplayMetrics().density); + + barGap = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 8, + getContext().getResources().getDisplayMetrics()); + + this.setPadding(getPaddingLeft(), getPaddingTop(), + getPaddingRight() + (int) barGap + mPasswordBarWidth, getPaddingBottom()); + + mPasswordStrengthBarView = new PasswordStrengthBarView(context, attrs); + mPasswordStrengthBarView.setShowGuides(false); + + this.addTextChangedListener(new TextWatcher() { + @Override + public void beforeTextChanged(CharSequence s, int start, int count, int after) { + + } + + @Override + public void onTextChanged(CharSequence s, int start, int before, int count) { + mPasswordStrengthBarView.setPassword(s.toString()); + } + + @Override + public void afterTextChanged(Editable s) { + + } + }); + } + + @Override + protected void onLayout(boolean changed, int left, int top, int right, int bottom) { + super.onLayout(changed, left, top, right, bottom); + mPasswordStrengthBarView.layout(0, 0, mPasswordBarWidth, mPasswordBarHeight); + } + + @Override + protected void onDraw(Canvas canvas) { + super.onDraw(canvas); + float translateX = getScrollX() + canvas.getWidth() - mPasswordBarWidth; + float translateY = (canvas.getHeight() - mPasswordBarHeight) / 2; + canvas.translate(translateX, translateY); + mPasswordStrengthBarView.draw(canvas); + canvas.translate(-translateX, -translateY); + } +}
\ No newline at end of file diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/PasswordEditText.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/PasswordEditText.java deleted file mode 100644 index 04c48922b..000000000 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/PasswordEditText.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * Copyright (C) 2014 Dominik Schürmann <dominik@dominikschuermann.de> - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <http://www.gnu.org/licenses/>. - */ - -package org.sufficientlysecure.keychain.ui.widget; - -import android.annotation.TargetApi; -import android.content.Context; -import android.os.Build; -import android.text.Editable; -import android.text.InputType; -import android.text.TextWatcher; -import android.util.AttributeSet; -import android.widget.EditText; - -import org.sufficientlysecure.keychain.ui.widget.passwordstrengthindicator.PasswordStrengthView; - -/** - * Developer: chipset - * Package : org.sufficientlysecure.keychain.layouts - * Project : open-keychain - * Date : 6/3/15 - */ -public class PasswordEditText extends EditText { - - PasswordEditText passwordEditText; - PasswordStrengthView passwordStrengthView; - - public PasswordEditText(Context context) { - super(context); - passwordEditText = this; - this.setInputType(InputType.TYPE_CLASS_TEXT | - InputType.TYPE_TEXT_VARIATION_PASSWORD); - this.addTextChangedListener(textWatcher); - } - - public PasswordEditText(Context context, AttributeSet attrs) { - super(context, attrs); - passwordEditText = this; - this.setInputType(InputType.TYPE_CLASS_TEXT | - InputType.TYPE_TEXT_VARIATION_PASSWORD); - this.addTextChangedListener(textWatcher); - } - - public PasswordEditText(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - passwordEditText = this; - this.setInputType(InputType.TYPE_CLASS_TEXT | - InputType.TYPE_TEXT_VARIATION_PASSWORD); - this.addTextChangedListener(textWatcher); - } - - @TargetApi(Build.VERSION_CODES.LOLLIPOP) - public PasswordEditText(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { - super(context, attrs, defStyleAttr, defStyleRes); - passwordEditText = this; - this.setInputType(InputType.TYPE_CLASS_TEXT | - InputType.TYPE_TEXT_VARIATION_PASSWORD); - this.addTextChangedListener(textWatcher); - } - - - TextWatcher textWatcher = new TextWatcher() { - @Override - public void beforeTextChanged(CharSequence s, int start, int count, int after) { - - } - - @Override - public void onTextChanged(CharSequence s, int start, int before, int count) { - - } - - @Override - public void afterTextChanged(Editable editable) { - String passphrase = editable.toString(); - passwordStrengthView.setPassword(passphrase); - } - }; - -// public PasswordStrengthView getPasswordStrengthView() { -// return passwordStrengthView; -// } - - public void setPasswordStrengthView(PasswordStrengthView mPasswordStrengthView) { - this.passwordStrengthView = mPasswordStrengthView; - } -} diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/passwordstrengthindicator/PasswordStrengthView.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/passwordstrengthindicator/PasswordStrengthView.java index d7270ff58..bc5018497 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/passwordstrengthindicator/PasswordStrengthView.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/widget/passwordstrengthindicator/PasswordStrengthView.java @@ -56,9 +56,6 @@ import org.sufficientlysecure.keychain.R; */ public class PasswordStrengthView extends View { - protected static final int COLOR_FAIL = Color.parseColor("#e74c3c"); - protected static final int COLOR_WEAK = Color.parseColor("#e67e22"); - protected static final int COLOR_STRONG = Color.parseColor("#2ecc71"); protected int mMinWidth; protected int mMinHeight; @@ -100,6 +97,11 @@ public class PasswordStrengthView extends View { public PasswordStrengthView(Context context, AttributeSet attrs) { super(context, attrs); + + int COLOR_FAIL = context.getResources().getColor(R.color.android_red_light); + int COLOR_WEAK = context.getResources().getColor(R.color.android_orange_light); + int COLOR_STRONG = context.getResources().getColor(R.color.android_green_light); + TypedArray style = context.getTheme().obtainStyledAttributes( attrs, R.styleable.PasswordStrengthView, diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ContactHelper.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ContactHelper.java index c66dc04d0..08c7c02fb 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ContactHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ContactHelper.java @@ -43,9 +43,11 @@ import java.io.InputStream; import java.util.ArrayList; import java.util.HashMap; import java.util.HashSet; +import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.regex.Matcher; public class ContactHelper { @@ -54,6 +56,17 @@ public class ContactHelper { public static List<String> getPossibleUserEmails(Context context) { Set<String> accountMails = getAccountEmails(context); accountMails.addAll(getMainProfileContactEmails(context)); + + // remove items that are not an email + Iterator<String> it = accountMails.iterator(); + while (it.hasNext()) { + String email = it.next(); + Matcher emailMatcher = Patterns.EMAIL_ADDRESS.matcher(email); + if (!emailMatcher.matches()) { + it.remove(); + } + } + // now return the Set (without duplicates) as a List return new ArrayList<>(accountMails); } @@ -62,6 +75,17 @@ public class ContactHelper { Set<String> accountMails = getAccountEmails(context); Set<String> names = getContactNamesFromEmails(context, accountMails); names.addAll(getMainProfileContactName(context)); + + // remove items that are an email + Iterator<String> it = names.iterator(); + while (it.hasNext()) { + String email = it.next(); + Matcher emailMatcher = Patterns.EMAIL_ADDRESS.matcher(email); + if (emailMatcher.matches()) { + it.remove(); + } + } + return new ArrayList<>(names); } @@ -75,9 +99,7 @@ public class ContactHelper { final Account[] accounts = AccountManager.get(context).getAccounts(); final Set<String> emailSet = new HashSet<>(); for (Account account : accounts) { - if (Patterns.EMAIL_ADDRESS.matcher(account.name).matches()) { - emailSet.add(account.name); - } + emailSet.add(account.name); } return emailSet; } @@ -256,7 +278,7 @@ public class ContactHelper { } public static Bitmap loadPhotoByMasterKeyId(ContentResolver contentResolver, long masterKeyId, - boolean highRes) { + boolean highRes) { if (masterKeyId == -1) { return null; } diff --git a/OpenKeychain/src/main/res/drawable-hdpi/ic_action_encrypt_copy_24dp.png b/OpenKeychain/src/main/res/drawable-hdpi/ic_action_encrypt_copy_24dp.png Binary files differnew file mode 100644 index 000000000..25a7ed445 --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-hdpi/ic_action_encrypt_copy_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-hdpi/ic_action_encrypt_save_24dp.png b/OpenKeychain/src/main/res/drawable-hdpi/ic_action_encrypt_save_24dp.png Binary files differnew file mode 100644 index 000000000..ef17796fb --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-hdpi/ic_action_encrypt_save_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-hdpi/ic_action_encrypt_share_24dp.png b/OpenKeychain/src/main/res/drawable-hdpi/ic_action_encrypt_share_24dp.png Binary files differnew file mode 100644 index 000000000..402d792c0 --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-hdpi/ic_action_encrypt_share_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-hdpi/ic_chevron_left_grey_24dp.png b/OpenKeychain/src/main/res/drawable-hdpi/ic_chevron_left_grey_24dp.png Binary files differnew file mode 100644 index 000000000..12e39d39d --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-hdpi/ic_chevron_left_grey_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-hdpi/ic_chevron_right_grey_24dp.png b/OpenKeychain/src/main/res/drawable-hdpi/ic_chevron_right_grey_24dp.png Binary files differnew file mode 100644 index 000000000..7eef500d4 --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-hdpi/ic_chevron_right_grey_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-hdpi/ic_close_black_24dp.png b/OpenKeychain/src/main/res/drawable-hdpi/ic_close_black_24dp.png Binary files differnew file mode 100644 index 000000000..d5a928783 --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-hdpi/ic_close_black_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-hdpi/ic_comment_text_grey600_24dp.png b/OpenKeychain/src/main/res/drawable-hdpi/ic_comment_text_grey600_24dp.png Binary files differnew file mode 100644 index 000000000..c48a3b463 --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-hdpi/ic_comment_text_grey600_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-hdpi/ic_person_grey_48dp.png b/OpenKeychain/src/main/res/drawable-hdpi/ic_person_grey_48dp.png Binary files differnew file mode 100644 index 000000000..de2a86e89 --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-hdpi/ic_person_grey_48dp.png diff --git a/OpenKeychain/src/main/res/drawable-mdpi/ic_action_encrypt_copy_24dp.png b/OpenKeychain/src/main/res/drawable-mdpi/ic_action_encrypt_copy_24dp.png Binary files differnew file mode 100644 index 000000000..9517e1fec --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-mdpi/ic_action_encrypt_copy_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-mdpi/ic_action_encrypt_save_24dp.png b/OpenKeychain/src/main/res/drawable-mdpi/ic_action_encrypt_save_24dp.png Binary files differnew file mode 100644 index 000000000..162981140 --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-mdpi/ic_action_encrypt_save_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-mdpi/ic_action_encrypt_share_24dp.png b/OpenKeychain/src/main/res/drawable-mdpi/ic_action_encrypt_share_24dp.png Binary files differnew file mode 100644 index 000000000..779ba94d3 --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-mdpi/ic_action_encrypt_share_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-mdpi/ic_chevron_left_grey_24dp.png b/OpenKeychain/src/main/res/drawable-mdpi/ic_chevron_left_grey_24dp.png Binary files differnew file mode 100644 index 000000000..56ab24da9 --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-mdpi/ic_chevron_left_grey_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-mdpi/ic_chevron_right_grey_24dp.png b/OpenKeychain/src/main/res/drawable-mdpi/ic_chevron_right_grey_24dp.png Binary files differnew file mode 100644 index 000000000..d6581fe23 --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-mdpi/ic_chevron_right_grey_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-mdpi/ic_close_black_24dp.png b/OpenKeychain/src/main/res/drawable-mdpi/ic_close_black_24dp.png Binary files differnew file mode 100644 index 000000000..4ebf8a227 --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-mdpi/ic_close_black_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-mdpi/ic_comment_text_grey600_24dp.png b/OpenKeychain/src/main/res/drawable-mdpi/ic_comment_text_grey600_24dp.png Binary files differnew file mode 100644 index 000000000..d50c008c7 --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-mdpi/ic_comment_text_grey600_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-mdpi/ic_person_grey_48dp.png b/OpenKeychain/src/main/res/drawable-mdpi/ic_person_grey_48dp.png Binary files differnew file mode 100644 index 000000000..738e3490d --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-mdpi/ic_person_grey_48dp.png diff --git a/OpenKeychain/src/main/res/drawable-xhdpi/ic_action_encrypt_copy_24dp.png b/OpenKeychain/src/main/res/drawable-xhdpi/ic_action_encrypt_copy_24dp.png Binary files differnew file mode 100644 index 000000000..9df8ff01a --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-xhdpi/ic_action_encrypt_copy_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-xhdpi/ic_action_encrypt_save_24dp.png b/OpenKeychain/src/main/res/drawable-xhdpi/ic_action_encrypt_save_24dp.png Binary files differnew file mode 100644 index 000000000..eef0635b7 --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-xhdpi/ic_action_encrypt_save_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-xhdpi/ic_action_encrypt_share_24dp.png b/OpenKeychain/src/main/res/drawable-xhdpi/ic_action_encrypt_share_24dp.png Binary files differnew file mode 100644 index 000000000..d359cd6ab --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-xhdpi/ic_action_encrypt_share_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-xhdpi/ic_chevron_left_grey_24dp.png b/OpenKeychain/src/main/res/drawable-xhdpi/ic_chevron_left_grey_24dp.png Binary files differnew file mode 100644 index 000000000..df0518a68 --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-xhdpi/ic_chevron_left_grey_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-xhdpi/ic_chevron_right_grey_24dp.png b/OpenKeychain/src/main/res/drawable-xhdpi/ic_chevron_right_grey_24dp.png Binary files differnew file mode 100644 index 000000000..7b82b8a57 --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-xhdpi/ic_chevron_right_grey_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-xhdpi/ic_close_black_24dp.png b/OpenKeychain/src/main/res/drawable-xhdpi/ic_close_black_24dp.png Binary files differnew file mode 100644 index 000000000..ed2b2525f --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-xhdpi/ic_close_black_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-xhdpi/ic_comment_text_grey600_24dp.png b/OpenKeychain/src/main/res/drawable-xhdpi/ic_comment_text_grey600_24dp.png Binary files differnew file mode 100644 index 000000000..0e14a9500 --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-xhdpi/ic_comment_text_grey600_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-xhdpi/ic_person_grey_48dp.png b/OpenKeychain/src/main/res/drawable-xhdpi/ic_person_grey_48dp.png Binary files differnew file mode 100644 index 000000000..e664e94ac --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-xhdpi/ic_person_grey_48dp.png diff --git a/OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_encrypt_copy_24dp.png b/OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_encrypt_copy_24dp.png Binary files differnew file mode 100644 index 000000000..cf184c78d --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_encrypt_copy_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_encrypt_save_24dp.png b/OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_encrypt_save_24dp.png Binary files differnew file mode 100644 index 000000000..5620e2595 --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_encrypt_save_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_encrypt_share_24dp.png b/OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_encrypt_share_24dp.png Binary files differnew file mode 100644 index 000000000..b364c7603 --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-xxhdpi/ic_action_encrypt_share_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-xxhdpi/ic_chevron_left_grey_24dp.png b/OpenKeychain/src/main/res/drawable-xxhdpi/ic_chevron_left_grey_24dp.png Binary files differnew file mode 100644 index 000000000..10643ae3f --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-xxhdpi/ic_chevron_left_grey_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-xxhdpi/ic_chevron_right_grey_24dp.png b/OpenKeychain/src/main/res/drawable-xxhdpi/ic_chevron_right_grey_24dp.png Binary files differnew file mode 100644 index 000000000..360d3c5ec --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-xxhdpi/ic_chevron_right_grey_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-xxhdpi/ic_close_black_24dp.png b/OpenKeychain/src/main/res/drawable-xxhdpi/ic_close_black_24dp.png Binary files differnew file mode 100644 index 000000000..08f59ea1e --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-xxhdpi/ic_close_black_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-xxhdpi/ic_comment_text_grey600_24dp.png b/OpenKeychain/src/main/res/drawable-xxhdpi/ic_comment_text_grey600_24dp.png Binary files differnew file mode 100644 index 000000000..de5de6042 --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-xxhdpi/ic_comment_text_grey600_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-xxhdpi/ic_person_grey_48dp.png b/OpenKeychain/src/main/res/drawable-xxhdpi/ic_person_grey_48dp.png Binary files differnew file mode 100644 index 000000000..5f00cf8a2 --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-xxhdpi/ic_person_grey_48dp.png diff --git a/OpenKeychain/src/main/res/drawable-xxxhdpi/ic_action_encrypt_copy_24dp.png b/OpenKeychain/src/main/res/drawable-xxxhdpi/ic_action_encrypt_copy_24dp.png Binary files differnew file mode 100644 index 000000000..c3078ee92 --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-xxxhdpi/ic_action_encrypt_copy_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-xxxhdpi/ic_action_encrypt_save_24dp.png b/OpenKeychain/src/main/res/drawable-xxxhdpi/ic_action_encrypt_save_24dp.png Binary files differnew file mode 100644 index 000000000..4146f9262 --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-xxxhdpi/ic_action_encrypt_save_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-xxxhdpi/ic_action_encrypt_share_24dp.png b/OpenKeychain/src/main/res/drawable-xxxhdpi/ic_action_encrypt_share_24dp.png Binary files differnew file mode 100644 index 000000000..925cb2d9e --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-xxxhdpi/ic_action_encrypt_share_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-xxxhdpi/ic_chevron_left_grey_24dp.png b/OpenKeychain/src/main/res/drawable-xxxhdpi/ic_chevron_left_grey_24dp.png Binary files differnew file mode 100644 index 000000000..a5fb05c28 --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-xxxhdpi/ic_chevron_left_grey_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-xxxhdpi/ic_chevron_right_grey_24dp.png b/OpenKeychain/src/main/res/drawable-xxxhdpi/ic_chevron_right_grey_24dp.png Binary files differnew file mode 100644 index 000000000..a71c5b3fc --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-xxxhdpi/ic_chevron_right_grey_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-xxxhdpi/ic_close_black_24dp.png b/OpenKeychain/src/main/res/drawable-xxxhdpi/ic_close_black_24dp.png Binary files differnew file mode 100644 index 000000000..c5d79caff --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-xxxhdpi/ic_close_black_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-xxxhdpi/ic_comment_text_grey600_24dp.png b/OpenKeychain/src/main/res/drawable-xxxhdpi/ic_comment_text_grey600_24dp.png Binary files differnew file mode 100644 index 000000000..9dae1a4a0 --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-xxxhdpi/ic_comment_text_grey600_24dp.png diff --git a/OpenKeychain/src/main/res/drawable-xxxhdpi/ic_person_grey_48dp.png b/OpenKeychain/src/main/res/drawable-xxxhdpi/ic_person_grey_48dp.png Binary files differnew file mode 100644 index 000000000..001fe6607 --- /dev/null +++ b/OpenKeychain/src/main/res/drawable-xxxhdpi/ic_person_grey_48dp.png diff --git a/OpenKeychain/src/main/res/layout/add_user_id_dialog.xml b/OpenKeychain/src/main/res/layout/add_user_id_dialog.xml index c1b97b02c..ffb7493f6 100644 --- a/OpenKeychain/src/main/res/layout/add_user_id_dialog.xml +++ b/OpenKeychain/src/main/res/layout/add_user_id_dialog.xml @@ -16,7 +16,7 @@ android:imeOptions="actionNext" android:textAppearance="?android:attr/textAppearanceMedium" /> - <org.sufficientlysecure.keychain.ui.widget.AutoCorrectAutoCompleteTextView + <org.sufficientlysecure.keychain.ui.widget.NameEditText android:id="@+id/add_user_id_name" android:layout_width="match_parent" android:layout_height="wrap_content" diff --git a/OpenKeychain/src/main/res/layout/api_app_settings_activity.xml b/OpenKeychain/src/main/res/layout/api_app_settings_activity.xml index 6df5c84f5..c3f6e33cb 100644 --- a/OpenKeychain/src/main/res/layout/api_app_settings_activity.xml +++ b/OpenKeychain/src/main/res/layout/api_app_settings_activity.xml @@ -78,27 +78,27 @@ android:orientation="vertical"> <TextView + android:id="@+id/api_accounts_label" style="@style/SectionHeader" android:layout_width="match_parent" android:layout_height="wrap_content" - android:text="@string/api_settings_allowed_keys" /> + android:visibility="gone" + android:text="@string/api_settings_accounts" /> <FrameLayout - android:id="@+id/api_allowed_keys_list_fragment" + android:id="@+id/api_accounts_list_fragment" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" /> <TextView - android:id="@+id/api_accounts_label" style="@style/SectionHeader" android:layout_width="match_parent" android:layout_height="wrap_content" - android:visibility="gone" - android:text="@string/api_settings_accounts" /> + android:text="@string/api_settings_allowed_keys" /> <FrameLayout - android:id="@+id/api_accounts_list_fragment" + android:id="@+id/api_allowed_keys_list_fragment" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" /> diff --git a/OpenKeychain/src/main/res/layout/api_app_settings_fragment.xml b/OpenKeychain/src/main/res/layout/api_app_settings_fragment.xml index ed3e33aab..1ea0a520d 100644 --- a/OpenKeychain/src/main/res/layout/api_app_settings_fragment.xml +++ b/OpenKeychain/src/main/res/layout/api_app_settings_fragment.xml @@ -1,7 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:custom="http://schemas.android.com/apk/res-auto" - android:background="?attr/colorPrimaryDark" android:layout_width="match_parent" android:layout_height="wrap_content" android:orientation="vertical"> @@ -29,14 +28,12 @@ android:gravity="center_vertical" android:orientation="vertical" android:text="Name (set in-code)" - android:textColor="@color/icons" android:textAppearance="?android:attr/textAppearanceMedium" /> </RelativeLayout> <org.sufficientlysecure.keychain.ui.widget.FoldableLinearLayout android:layout_width="match_parent" android:layout_height="match_parent" - android:textColor="@color/icons" custom:foldedLabel="@string/api_settings_show_info" custom:unFoldedLabel="@string/api_settings_hide_info"> @@ -44,7 +41,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/api_settings_package_name" - android:textColor="@color/icons" android:textAppearance="?android:attr/textAppearanceMedium" /> <TextView @@ -52,14 +48,12 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:text="com.example" - android:textColor="@color/icons" android:textAppearance="?android:attr/textAppearanceSmall" /> <TextView android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/api_settings_package_signature" - android:textColor="@color/icons" android:textAppearance="?android:attr/textAppearanceMedium" /> <TextView @@ -67,7 +61,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:text="Base64 encoded hash of signature" - android:textColor="@color/icons" android:textAppearance="?android:attr/textAppearanceSmall" /> </org.sufficientlysecure.keychain.ui.widget.FoldableLinearLayout> diff --git a/OpenKeychain/src/main/res/layout/create_key_email_fragment.xml b/OpenKeychain/src/main/res/layout/create_key_email_fragment.xml new file mode 100644 index 000000000..a24d1a2ee --- /dev/null +++ b/OpenKeychain/src/main/res/layout/create_key_email_fragment.xml @@ -0,0 +1,84 @@ +<?xml version="1.0" encoding="UTF-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <ScrollView + android:layout_width="match_parent" + android:layout_height="match_parent" + android:fillViewport="true" + android:layout_above="@+id/create_key_buttons"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingLeft="16dp" + android:paddingRight="16dp" + android:orientation="vertical"> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="16dp" + android:layout_marginLeft="8dp" + android:textAppearance="?android:attr/textAppearanceMedium" + android:text="@string/create_key_email_text" /> + + <org.sufficientlysecure.keychain.ui.widget.EmailEditText + android:id="@+id/create_key_email" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="16dp" + android:layout_marginBottom="8dp" + android:imeOptions="actionNext" + android:hint="@string/label_email" + android:ems="10" /> + + </LinearLayout> + </ScrollView> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:layout_alignParentBottom="true" + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" + android:background="@color/holo_gray_bright" + android:id="@+id/create_key_buttons"> + + <TextView + android:id="@+id/create_key_back_button" + android:paddingLeft="16dp" + android:paddingRight="16dp" + android:textAppearance="?android:attr/textAppearanceMedium" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/btn_back" + android:textAllCaps="true" + android:minHeight="?android:attr/listPreferredItemHeight" + android:drawableLeft="@drawable/ic_chevron_left_grey_24dp" + android:drawablePadding="8dp" + android:gravity="left|center_vertical" + android:clickable="true" + style="?android:attr/borderlessButtonStyle" /> + + <TextView + android:id="@+id/create_key_next_button" + android:paddingLeft="16dp" + android:paddingRight="16dp" + android:textAppearance="?android:attr/textAppearanceMedium" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/btn_next" + android:textAllCaps="true" + android:minHeight="?android:attr/listPreferredItemHeight" + android:drawableRight="@drawable/ic_chevron_right_grey_24dp" + android:drawablePadding="8dp" + android:gravity="right|center_vertical" + android:clickable="true" + style="?android:attr/borderlessButtonStyle" /> + </LinearLayout> +</RelativeLayout>
\ No newline at end of file diff --git a/OpenKeychain/src/main/res/layout/create_key_final_fragment.xml b/OpenKeychain/src/main/res/layout/create_key_final_fragment.xml index 84625d1fd..830f039f7 100644 --- a/OpenKeychain/src/main/res/layout/create_key_final_fragment.xml +++ b/OpenKeychain/src/main/res/layout/create_key_final_fragment.xml @@ -6,7 +6,7 @@ <ScrollView android:layout_width="match_parent" android:layout_height="match_parent" - android:layout_above="@+id/create_key_buttons_divider"> + android:layout_above="@+id/create_key_buttons"> <LinearLayout android:layout_width="match_parent" @@ -144,58 +144,42 @@ android:layout_alignParentBottom="true" android:layout_alignParentLeft="true" android:layout_alignParentStart="true" - android:layout_marginLeft="16dp" - android:layout_marginRight="16dp" + android:background="@color/holo_gray_bright" android:id="@+id/create_key_buttons"> <TextView android:id="@+id/create_key_back_button" - android:paddingLeft="8dp" - android:paddingRight="8dp" + android:paddingLeft="16dp" + android:paddingRight="16dp" android:textAppearance="?android:attr/textAppearanceMedium" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/btn_back" + android:textAllCaps="true" android:minHeight="?android:attr/listPreferredItemHeight" - android:gravity="center_vertical" + android:drawableLeft="@drawable/ic_chevron_left_grey_24dp" + android:drawablePadding="8dp" + android:gravity="left|center_vertical" android:clickable="true" - style="?android:attr/borderlessButtonStyle" - android:layout_gravity="center_vertical" /> - - <View - android:layout_width="1dp" - android:layout_height="match_parent" - android:layout_marginTop="8dp" - android:layout_marginBottom="8dp" - android:background="?android:attr/listDivider" /> + style="?android:attr/borderlessButtonStyle" /> <TextView - android:id="@+id/create_key_create_button" - android:paddingLeft="8dp" - android:paddingRight="8dp" + android:id="@+id/create_key_next_button" + android:paddingLeft="16dp" + android:paddingRight="16dp" android:textAppearance="?android:attr/textAppearanceMedium" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" android:text="@string/btn_create_key" + android:textAllCaps="true" android:minHeight="?android:attr/listPreferredItemHeight" android:drawableRight="@drawable/ic_key_plus_grey600_24dp" android:drawablePadding="8dp" - android:gravity="center_vertical" + android:gravity="right|center_vertical" android:clickable="true" - style="?android:attr/borderlessButtonStyle" - android:layout_gravity="center_vertical" /> + style="?android:attr/borderlessButtonStyle" /> </LinearLayout> - <View - android:id="@+id/create_key_buttons_divider" - android:layout_width="match_parent" - android:layout_height="1dip" - android:background="?android:attr/listDivider" - android:layout_alignTop="@+id/create_key_buttons" - android:layout_marginLeft="16dp" - android:layout_marginRight="16dp" - android:layout_alignParentLeft="true" - android:layout_alignParentStart="true" /> </RelativeLayout>
\ No newline at end of file diff --git a/OpenKeychain/src/main/res/layout/create_key_input_fragment.xml b/OpenKeychain/src/main/res/layout/create_key_input_fragment.xml deleted file mode 100644 index b320885d0..000000000 --- a/OpenKeychain/src/main/res/layout/create_key_input_fragment.xml +++ /dev/null @@ -1,161 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:custom="http://schemas.android.com/apk/res-auto" - android:layout_width="match_parent" - android:layout_height="match_parent"> - - <ScrollView - android:layout_width="match_parent" - android:layout_height="match_parent" - android:fillViewport="true" - android:layout_above="@+id/create_key_button_divider"> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingLeft="16dp" - android:paddingRight="16dp" - android:orientation="vertical"> - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginTop="16dp" - android:layout_marginLeft="8dp" - android:textAppearance="?android:attr/textAppearanceMedium" - android:text="@string/create_key_text" /> - - <TextView - style="@style/SectionHeader" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:layout_marginTop="8dp" - android:text="@string/label_user_id" /> - - <org.sufficientlysecure.keychain.ui.widget.AutoCorrectAutoCompleteTextView - android:id="@+id/create_key_name" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="8dp" - android:layout_marginBottom="8dp" - android:imeOptions="actionNext" - android:inputType="textAutoCorrect|textPersonName|textCapWords" - android:hint="@string/create_key_hint_full_name" - android:ems="10" /> - - <org.sufficientlysecure.keychain.ui.widget.EmailEditText - android:id="@+id/create_key_email" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginBottom="8dp" - android:imeOptions="actionNext" - android:hint="@string/label_email" - android:ems="10" /> - - <TextView - style="@style/SectionHeader" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/label_passphrase" /> - - <FrameLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginTop="8dp" - android:layout_marginBottom="8dp"> - - <org.sufficientlysecure.keychain.ui.widget.PasswordEditText - android:id="@+id/create_key_passphrase" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:imeOptions="actionNext" - android:hint="@string/label_passphrase" - android:ems="10" - android:layout_gravity="center_horizontal" /> - - <org.sufficientlysecure.keychain.ui.widget.passwordstrengthindicator.PasswordStrengthBarView - android:id="@+id/create_key_passphrase_strength" - android:layout_width="48dp" - android:layout_height="8dp" - android:layout_gravity="end|center_vertical" - custom:strength="medium" - custom:showGuides="false" - custom:color_fail="@color/android_red_light" - custom:color_weak="@color/android_orange_light" - custom:color_strong="@color/android_green_light" /> - - </FrameLayout> - - <EditText - android:id="@+id/create_key_passphrase_again" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_marginBottom="8dp" - android:inputType="textPassword" - android:hint="@string/label_passphrase_again" - android:ems="10" - android:layout_gravity="center_horizontal" /> - - </LinearLayout> - </ScrollView> - - <View - android:id="@+id/create_key_button_divider" - android:layout_width="match_parent" - android:layout_height="1dip" - android:layout_marginLeft="16dp" - android:layout_marginRight="16dp" - android:background="?android:attr/listDivider" - android:layout_alignTop="@+id/create_key_buttons" - android:layout_alignParentLeft="true" - android:layout_alignParentStart="true" /> - - <LinearLayout - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:orientation="horizontal" - android:layout_alignParentBottom="true" - android:layout_alignParentLeft="true" - android:layout_alignParentStart="true" - android:layout_marginLeft="16dp" - android:layout_marginRight="16dp" - android:id="@+id/create_key_buttons"> - - <TextView - android:id="@+id/create_key_back_button" - android:paddingLeft="8dp" - android:paddingRight="8dp" - android:textAppearance="?android:attr/textAppearanceMedium" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_weight="1" - android:text="" - android:minHeight="?android:attr/listPreferredItemHeight" - android:gravity="center_vertical" - android:layout_gravity="center_vertical" /> - - <View - android:layout_width="1dp" - android:layout_height="match_parent" - android:layout_marginTop="8dp" - android:layout_marginBottom="8dp" - android:background="?android:attr/listDivider" /> - - <TextView - android:id="@+id/create_key_button" - android:paddingLeft="8dp" - android:paddingRight="8dp" - android:textAppearance="?android:attr/textAppearanceMedium" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:layout_weight="1" - android:text="@string/btn_next" - android:minHeight="?android:attr/listPreferredItemHeight" - android:drawableRight="@drawable/ic_play_arrow_grey_24dp" - android:drawablePadding="8dp" - android:gravity="center_vertical" - android:clickable="true" - style="?android:attr/borderlessButtonStyle" - android:layout_gravity="center_vertical" /> - </LinearLayout> -</RelativeLayout>
\ No newline at end of file diff --git a/OpenKeychain/src/main/res/layout/create_key_name_fragment.xml b/OpenKeychain/src/main/res/layout/create_key_name_fragment.xml new file mode 100644 index 000000000..ea064b00c --- /dev/null +++ b/OpenKeychain/src/main/res/layout/create_key_name_fragment.xml @@ -0,0 +1,83 @@ +<?xml version="1.0" encoding="UTF-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <ScrollView + android:layout_width="match_parent" + android:layout_height="match_parent" + android:fillViewport="true" + android:layout_above="@+id/create_key_buttons"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingLeft="16dp" + android:paddingRight="16dp" + android:orientation="vertical"> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="16dp" + android:layout_marginLeft="8dp" + android:textAppearance="?android:attr/textAppearanceMedium" + android:text="@string/create_key_name_text" /> + + <org.sufficientlysecure.keychain.ui.widget.NameEditText + android:id="@+id/create_key_name" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="16dp" + android:layout_marginBottom="8dp" + android:imeOptions="actionNext" + android:inputType="textAutoCorrect|textPersonName|textCapWords" + android:hint="@string/create_key_hint_full_name" + android:ems="10" /> + + </LinearLayout> + </ScrollView> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:layout_alignParentBottom="true" + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" + android:background="@color/holo_gray_bright" + android:id="@+id/create_key_buttons"> + + <TextView + android:id="@+id/create_key_back_button" + android:paddingLeft="16dp" + android:paddingRight="16dp" + android:textAppearance="?android:attr/textAppearanceMedium" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="1" + android:textAllCaps="true" + android:minHeight="?android:attr/listPreferredItemHeight" + android:drawablePadding="8dp" + android:gravity="left|center_vertical" + android:clickable="false" + style="?android:attr/borderlessButtonStyle" /> + + <TextView + android:id="@+id/create_key_next_button" + android:paddingLeft="16dp" + android:paddingRight="16dp" + android:textAppearance="?android:attr/textAppearanceMedium" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/btn_next" + android:textAllCaps="true" + android:minHeight="?android:attr/listPreferredItemHeight" + android:drawableRight="@drawable/ic_chevron_right_grey_24dp" + android:drawablePadding="8dp" + android:gravity="right|center_vertical" + android:clickable="true" + style="?android:attr/borderlessButtonStyle" /> + </LinearLayout> +</RelativeLayout>
\ No newline at end of file diff --git a/OpenKeychain/src/main/res/layout/create_key_passphrase_fragment.xml b/OpenKeychain/src/main/res/layout/create_key_passphrase_fragment.xml new file mode 100644 index 000000000..48b86765a --- /dev/null +++ b/OpenKeychain/src/main/res/layout/create_key_passphrase_fragment.xml @@ -0,0 +1,103 @@ +<?xml version="1.0" encoding="UTF-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:layout_width="match_parent" + android:layout_height="match_parent"> + + <ScrollView + android:layout_width="match_parent" + android:layout_height="match_parent" + android:fillViewport="true" + android:layout_above="@+id/create_key_buttons"> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:paddingLeft="16dp" + android:paddingRight="16dp" + android:orientation="vertical"> + + <TextView + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_marginTop="16dp" + android:layout_marginLeft="8dp" + android:textAppearance="?android:attr/textAppearanceMedium" + android:text="@string/create_key_passphrase_text" /> + + <org.sufficientlysecure.keychain.ui.widget.PassphraseEditText + android:id="@+id/create_key_passphrase" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginTop="8dp" + android:layout_marginBottom="8dp" + android:imeOptions="actionNext" + android:inputType="textPassword" + android:hint="@string/label_passphrase" + android:ems="10" + android:layout_gravity="center_horizontal" /> + + <EditText + android:id="@+id/create_key_passphrase_again" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="8dp" + android:inputType="textPassword" + android:hint="@string/label_passphrase_again" + android:ems="10" + android:layout_gravity="center_horizontal" /> + + <CheckBox + android:id="@+id/create_key_show_passphrase" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_marginBottom="8dp" + android:text="@string/label_show_passphrase" /> + + </LinearLayout> + </ScrollView> + + <LinearLayout + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:orientation="horizontal" + android:layout_alignParentBottom="true" + android:layout_alignParentLeft="true" + android:layout_alignParentStart="true" + android:background="@color/holo_gray_bright" + android:id="@+id/create_key_buttons"> + + <TextView + android:id="@+id/create_key_back_button" + android:paddingLeft="16dp" + android:paddingRight="16dp" + android:textAppearance="?android:attr/textAppearanceMedium" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/btn_back" + android:textAllCaps="true" + android:minHeight="?android:attr/listPreferredItemHeight" + android:drawableLeft="@drawable/ic_chevron_left_grey_24dp" + android:drawablePadding="8dp" + android:gravity="left|center_vertical" + android:clickable="true" + style="?android:attr/borderlessButtonStyle" /> + + <TextView + android:id="@+id/create_key_next_button" + android:paddingLeft="16dp" + android:paddingRight="16dp" + android:textAppearance="?android:attr/textAppearanceMedium" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:layout_weight="1" + android:text="@string/btn_next" + android:textAllCaps="true" + android:minHeight="?android:attr/listPreferredItemHeight" + android:drawableRight="@drawable/ic_chevron_right_grey_24dp" + android:drawablePadding="8dp" + android:gravity="right|center_vertical" + android:clickable="true" + style="?android:attr/borderlessButtonStyle" /> + </LinearLayout> +</RelativeLayout>
\ No newline at end of file diff --git a/OpenKeychain/src/main/res/layout/decrypt_files_activity.xml b/OpenKeychain/src/main/res/layout/decrypt_files_activity.xml index 3cf4a9e7b..3d214dbf6 100644 --- a/OpenKeychain/src/main/res/layout/decrypt_files_activity.xml +++ b/OpenKeychain/src/main/res/layout/decrypt_files_activity.xml @@ -5,7 +5,7 @@ <include android:id="@+id/toolbar_include" - layout="@layout/toolbar_standalone" /> + layout="@layout/toolbar_standalone_white" /> <!-- fitsSystemWindows and layout_marginTop from diff --git a/OpenKeychain/src/main/res/layout/decrypt_text_activity.xml b/OpenKeychain/src/main/res/layout/decrypt_text_activity.xml index da4aa7099..a6099e25e 100644 --- a/OpenKeychain/src/main/res/layout/decrypt_text_activity.xml +++ b/OpenKeychain/src/main/res/layout/decrypt_text_activity.xml @@ -5,7 +5,7 @@ <include android:id="@+id/toolbar_include" - layout="@layout/toolbar_standalone" /> + layout="@layout/toolbar_standalone_white" /> <!-- fitsSystemWindows and layout_marginTop from diff --git a/OpenKeychain/src/main/res/layout/encrypt_decrypt_overview_fragment.xml b/OpenKeychain/src/main/res/layout/encrypt_decrypt_overview_fragment.xml index 3ef8e3551..bd640d9af 100644 --- a/OpenKeychain/src/main/res/layout/encrypt_decrypt_overview_fragment.xml +++ b/OpenKeychain/src/main/res/layout/encrypt_decrypt_overview_fragment.xml @@ -45,7 +45,7 @@ android:clickable="true" style="?android:attr/borderlessButtonStyle" android:text="@string/btn_encrypt_text" - android:drawableRight="@drawable/ic_content_copy_grey_24dp" + android:drawableRight="@drawable/ic_comment_text_grey600_24dp" android:drawablePadding="8dp" android:gravity="center_vertical" /> diff --git a/OpenKeychain/src/main/res/layout/encrypt_files_activity.xml b/OpenKeychain/src/main/res/layout/encrypt_files_activity.xml index f9efd81b4..ce8b1302c 100644 --- a/OpenKeychain/src/main/res/layout/encrypt_files_activity.xml +++ b/OpenKeychain/src/main/res/layout/encrypt_files_activity.xml @@ -5,7 +5,7 @@ <include android:id="@+id/toolbar_include" - layout="@layout/toolbar_standalone" /> + layout="@layout/toolbar_standalone_white" /> <!-- fitsSystemWindows and layout_marginTop from diff --git a/OpenKeychain/src/main/res/layout/encrypt_files_fragment.xml b/OpenKeychain/src/main/res/layout/encrypt_files_fragment.xml index 26b1d809d..029e735b3 100644 --- a/OpenKeychain/src/main/res/layout/encrypt_files_fragment.xml +++ b/OpenKeychain/src/main/res/layout/encrypt_files_fragment.xml @@ -1,72 +1,19 @@ <?xml version="1.0" encoding="utf-8"?> -<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" - android:layout_height="match_parent" - android:fillViewport="true"> - - <LinearLayout + android:layout_height="wrap_content" + android:paddingLeft="16dp" + android:paddingRight="16dp" + android:orientation="vertical"> + + <ListView + android:id="@+id/selected_files_list" + android:dividerHeight="4dip" + android:divider="@android:color/transparent" + android:focusable="true" + android:focusableInTouchMode="true" + android:layout_marginTop="8dp" android:layout_width="match_parent" - android:layout_height="wrap_content" - android:paddingLeft="16dp" - android:paddingRight="16dp" - android:orientation="vertical"> - - <ListView - android:id="@+id/selected_files_list" - android:dividerHeight="4dip" - android:divider="@android:color/transparent" - android:focusable="true" - android:focusableInTouchMode="true" - android:layout_marginTop="8dp" - android:layout_width="match_parent" - android:layout_height="0dip" - android:layout_weight="1" /> - - <View - android:layout_width="match_parent" - android:layout_height="1dip" - android:background="?android:attr/listDivider" /> - - <!-- Note: The following construct should be a widget, we use it quiet often --> - - <LinearLayout - android:id="@+id/action_encrypt_share" - android:paddingLeft="8dp" - android:layout_width="match_parent" - android:layout_height="?android:attr/listPreferredItemHeight" - android:clickable="true" - style="@style/SelectableItem" - android:orientation="horizontal"> - - <TextView - android:paddingLeft="8dp" - android:paddingRight="8dp" - android:textAppearance="?android:attr/textAppearanceMedium" - android:layout_width="0dip" - android:layout_height="match_parent" - android:text="@string/btn_encrypt_share_file" - android:layout_weight="1" - android:drawableRight="@drawable/ic_share_grey_24dp" - android:drawablePadding="8dp" - android:gravity="center_vertical" /> - - <View - android:layout_width="1dip" - android:layout_height="match_parent" - android:gravity="right" - android:layout_marginBottom="8dp" - android:layout_marginTop="8dp" - android:background="?android:attr/listDivider" /> - - <ImageButton - android:id="@+id/action_encrypt_file" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:padding="8dp" - android:src="@drawable/ic_save_grey_24dp" - android:layout_gravity="center_vertical" - style="@style/SelectableItem" /> + android:layout_height="match_parent" /> - </LinearLayout> - </LinearLayout> -</ScrollView>
\ No newline at end of file +</LinearLayout>
\ No newline at end of file diff --git a/OpenKeychain/src/main/res/layout/encrypt_text_activity.xml b/OpenKeychain/src/main/res/layout/encrypt_text_activity.xml index 67f17fa81..809e64f02 100644 --- a/OpenKeychain/src/main/res/layout/encrypt_text_activity.xml +++ b/OpenKeychain/src/main/res/layout/encrypt_text_activity.xml @@ -5,7 +5,7 @@ <include android:id="@+id/toolbar_include" - layout="@layout/toolbar_standalone" /> + layout="@layout/toolbar_standalone_white" /> <!-- fitsSystemWindows and layout_marginTop from diff --git a/OpenKeychain/src/main/res/layout/encrypt_text_fragment.xml b/OpenKeychain/src/main/res/layout/encrypt_text_fragment.xml index 6f7b636e1..3c21291cd 100644 --- a/OpenKeychain/src/main/res/layout/encrypt_text_fragment.xml +++ b/OpenKeychain/src/main/res/layout/encrypt_text_fragment.xml @@ -21,50 +21,5 @@ android:hint="@string/encrypt_content_edit_text_hint" android:layout_weight="1" /> - <View - android:layout_width="match_parent" - android:layout_height="1dip" - android:background="?android:attr/listDivider" /> - - <LinearLayout - android:id="@+id/action_encrypt_share" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:clickable="true" - style="@style/SelectableItem" - android:orientation="horizontal"> - - <TextView - android:paddingLeft="8dp" - android:paddingRight="8dp" - android:textAppearance="?android:attr/textAppearanceMedium" - android:layout_width="0dp" - android:layout_height="wrap_content" - android:minHeight="?android:attr/listPreferredItemHeight" - android:text="@string/btn_share_encrypted_signed" - android:drawableRight="@drawable/ic_share_grey_24dp" - android:drawablePadding="8dp" - android:gravity="center_vertical" - android:layout_weight="1" /> - - <View - android:layout_width="1dip" - android:layout_height="match_parent" - android:gravity="right" - android:layout_marginBottom="8dp" - android:layout_marginTop="8dp" - android:background="?android:attr/listDivider" /> - - <ImageButton - android:id="@+id/action_encrypt_clipboard" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:padding="8dp" - android:src="@drawable/ic_content_copy_grey_24dp" - android:layout_gravity="center_vertical" - style="@style/SelectableItem" /> - - </LinearLayout> - </LinearLayout> </ScrollView> diff --git a/OpenKeychain/src/main/res/layout/file_list_entry_add.xml b/OpenKeychain/src/main/res/layout/file_list_entry_add.xml index f2ee4079e..d7f4513d9 100644 --- a/OpenKeychain/src/main/res/layout/file_list_entry_add.xml +++ b/OpenKeychain/src/main/res/layout/file_list_entry_add.xml @@ -1,21 +1,21 @@ <?xml version="1.0" encoding="utf-8"?> +<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:padding="4dp" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:clickable="true" + android:minHeight="?android:attr/listPreferredItemHeight" + style="?android:attr/borderlessButtonStyle"> -<FrameLayout - xmlns:android="http://schemas.android.com/apk/res/android" - android:padding="4dp" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:clickable="true" - style="@style/SelectableItem"> <TextView - android:paddingLeft="8dp" - android:paddingRight="8dp" - android:textAppearance="?android:attr/textAppearanceMedium" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_gravity="center" - android:text="@string/btn_add_files" - android:drawableLeft="@drawable/ic_folder_grey_24dp" - android:drawablePadding="8dp" - android:gravity="center"/> + android:paddingLeft="8dp" + android:paddingRight="8dp" + android:textAppearance="?android:attr/textAppearanceMedium" + android:layout_width="wrap_content" + android:layout_height="match_parent" + android:layout_gravity="center" + android:text="@string/btn_add_files" + android:drawableLeft="@drawable/ic_folder_grey_24dp" + android:drawablePadding="8dp" + android:gravity="center" /> </FrameLayout>
\ No newline at end of file diff --git a/OpenKeychain/src/main/res/layout/help_activity.xml b/OpenKeychain/src/main/res/layout/help_activity.xml index 1722f03ea..0b309a8b1 100644 --- a/OpenKeychain/src/main/res/layout/help_activity.xml +++ b/OpenKeychain/src/main/res/layout/help_activity.xml @@ -1,33 +1,16 @@ <?xml version="1.0" encoding="utf-8"?> -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="match_parent" + android:orientation="vertical"> <include - android:id="@+id/toolbar_include" - layout="@layout/toolbar_standalone" /> + android:id="@+id/toolbar_tabs" + layout="@layout/toolbar_tabs" /> - <LinearLayout - android:layout_below="@id/toolbar_include" + <android.support.v4.view.ViewPager + android:id="@+id/pager" android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - android:elevation="4dp"> + android:layout_height="match_parent" /> - <com.astuetz.PagerSlidingTabStrip - android:id="@+id/sliding_tab_layout" - android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" - android:background="?attr/colorPrimary" - android:textColor="@color/tab_text" - app:pstsTextColorSelected="@color/tab_text_selected" - app:pstsIndicatorColor="@color/tab_indicator" /> - - <android.support.v4.view.ViewPager - android:id="@+id/pager" - android:layout_width="match_parent" - android:layout_height="match_parent" /> - - </LinearLayout> -</RelativeLayout>
\ No newline at end of file +</LinearLayout>
\ No newline at end of file diff --git a/OpenKeychain/src/main/res/layout/passphrase_repeat_dialog.xml b/OpenKeychain/src/main/res/layout/passphrase_repeat_dialog.xml index 11355bbc0..5f323716c 100644 --- a/OpenKeychain/src/main/res/layout/passphrase_repeat_dialog.xml +++ b/OpenKeychain/src/main/res/layout/passphrase_repeat_dialog.xml @@ -21,7 +21,7 @@ android:layout_marginTop="8dp" android:layout_marginBottom="8dp"> - <org.sufficientlysecure.keychain.ui.widget.PasswordEditText + <org.sufficientlysecure.keychain.ui.widget.PassphraseEditText android:id="@+id/passphrase_passphrase" android:layout_width="match_parent" android:layout_height="wrap_content" @@ -29,6 +29,7 @@ android:layout_marginBottom="8dp" android:imeOptions="actionNext" android:hint="@string/label_passphrase" + android:inputType="textPassword" android:ems="10" android:layout_gravity="center_horizontal" /> diff --git a/OpenKeychain/src/main/res/layout/toolbar_inner_layout.xml b/OpenKeychain/src/main/res/layout/toolbar_inner_layout.xml new file mode 100644 index 000000000..047225394 --- /dev/null +++ b/OpenKeychain/src/main/res/layout/toolbar_inner_layout.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<merge xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools"> + + <!-- + We always have windowTranslucentStatus=true to get under the status bar. + Thus this ImageView is the part under the status bar! + --> + <ImageView + android:id="@+id/status_bar" + android:layout_width="match_parent" + android:layout_height="@dimen/statusbar_height" + android:background="@color/transparent" /> + + <android.support.v7.widget.Toolbar + android:id="@+id/toolbar" + android:layout_below="@+id/status_bar" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" + android:background="@color/transparent" + app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" + app:popupTheme="@style/ThemeOverlay.AppCompat.Light" + tools:ignore="UnusedAttribute" /> +</merge>
\ No newline at end of file diff --git a/OpenKeychain/src/main/res/layout/toolbar_inner_layout_white.xml b/OpenKeychain/src/main/res/layout/toolbar_inner_layout_white.xml new file mode 100644 index 000000000..a626efb09 --- /dev/null +++ b/OpenKeychain/src/main/res/layout/toolbar_inner_layout_white.xml @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="utf-8"?> +<merge xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + xmlns:tools="http://schemas.android.com/tools"> + + <!-- + We always have windowTranslucentStatus=true to get under the status bar. + Thus this ImageView is the part under the status bar! + --> + <ImageView + android:id="@+id/status_bar" + android:layout_width="match_parent" + android:layout_height="@dimen/statusbar_height" + android:background="@color/transparent" /> + + <android.support.v7.widget.Toolbar + android:id="@+id/toolbar" + android:layout_below="@+id/status_bar" + android:layout_width="match_parent" + android:layout_height="wrap_content" + android:minHeight="?attr/actionBarSize" + android:background="@color/transparent" + app:theme="@style/ThemeOverlay.AppCompat.ActionBar" + app:popupTheme="@style/ThemeOverlay.AppCompat.Light" + tools:ignore="UnusedAttribute" /> +</merge>
\ No newline at end of file diff --git a/OpenKeychain/src/main/res/layout/toolbar_standalone.xml b/OpenKeychain/src/main/res/layout/toolbar_standalone.xml index 950c2f2ae..4ab94060c 100644 --- a/OpenKeychain/src/main/res/layout/toolbar_standalone.xml +++ b/OpenKeychain/src/main/res/layout/toolbar_standalone.xml @@ -1,31 +1,13 @@ <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" android:id="@+id/toolbar_include" android:elevation="4dp" + android:background="?attr/colorPrimary" android:layout_width="match_parent" android:layout_height="wrap_content"> - <!-- - We always have windowTranslucentStatus=true to get under the status bar. - Thus this ImageView is the part under the status bar! - --> - <ImageView - android:id="@+id/status_bar" - android:layout_width="match_parent" - android:layout_height="@dimen/statusbar_height" - android:background="?attr/colorPrimary" /> - - <android.support.v7.widget.Toolbar - android:id="@+id/toolbar" - android:layout_below="@+id/status_bar" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="?attr/actionBarSize" - android:background="?attr/colorPrimary" - app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" - app:popupTheme="@style/ThemeOverlay.AppCompat.Light" - tools:ignore="UnusedAttribute" /> + <include + android:id="@+id/toolbar_inner_layout" + layout="@layout/toolbar_inner_layout" /> </RelativeLayout> diff --git a/OpenKeychain/src/main/res/layout/toolbar_standalone_orange.xml b/OpenKeychain/src/main/res/layout/toolbar_standalone_orange.xml index 0336b51fd..b8c190a36 100644 --- a/OpenKeychain/src/main/res/layout/toolbar_standalone_orange.xml +++ b/OpenKeychain/src/main/res/layout/toolbar_standalone_orange.xml @@ -1,31 +1,13 @@ <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" - xmlns:tools="http://schemas.android.com/tools" android:id="@+id/toolbar_include" android:elevation="4dp" + android:background="@color/android_orange_light" android:layout_width="match_parent" android:layout_height="wrap_content"> - <!-- - We always have windowTranslucentStatus=true to get under the status bar. - Thus this ImageView is the part under the status bar! - --> - <ImageView - android:id="@+id/status_bar" - android:layout_width="match_parent" - android:layout_height="@dimen/statusbar_height" - android:background="@color/android_orange_light" /> - - <android.support.v7.widget.Toolbar - android:id="@+id/toolbar" - android:layout_below="@+id/status_bar" - android:layout_width="match_parent" - android:layout_height="wrap_content" - android:minHeight="?attr/actionBarSize" - android:background="@color/android_orange_light" - app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" - app:popupTheme="@style/ThemeOverlay.AppCompat.Light" - tools:ignore="UnusedAttribute" /> + <include + android:id="@+id/toolbar_inner_layout" + layout="@layout/toolbar_inner_layout" /> </RelativeLayout> diff --git a/OpenKeychain/src/main/res/layout/toolbar_standalone_white.xml b/OpenKeychain/src/main/res/layout/toolbar_standalone_white.xml new file mode 100644 index 000000000..d4269c2ba --- /dev/null +++ b/OpenKeychain/src/main/res/layout/toolbar_standalone_white.xml @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + android:id="@+id/toolbar_include" + android:elevation="4dp" + android:background="@color/white" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <include + android:id="@+id/toolbar_inner_layout" + layout="@layout/toolbar_inner_layout_white" /> + +</RelativeLayout> diff --git a/OpenKeychain/src/main/res/layout/toolbar_tabs.xml b/OpenKeychain/src/main/res/layout/toolbar_tabs.xml new file mode 100644 index 000000000..91efda682 --- /dev/null +++ b/OpenKeychain/src/main/res/layout/toolbar_tabs.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto" + android:id="@+id/toolbar_include" + android:elevation="4dp" + android:background="?attr/colorPrimary" + android:layout_width="match_parent" + android:layout_height="wrap_content"> + + <include + android:id="@+id/toolbar_inner_layout" + layout="@layout/toolbar_inner_layout" /> + + <com.astuetz.PagerSlidingTabStrip + android:id="@+id/sliding_tab_layout" + android:layout_below="@id/toolbar" + android:layout_width="match_parent" + android:layout_height="?attr/actionBarSize" + android:background="?attr/colorPrimary" + android:textColor="@color/tab_text" + app:pstsTextColorSelected="@color/tab_text_selected" + app:pstsIndicatorColor="@color/tab_indicator" /> + +</RelativeLayout> diff --git a/OpenKeychain/src/main/res/layout/view_key_adv_activity.xml b/OpenKeychain/src/main/res/layout/view_key_adv_activity.xml index 59888c25a..0b309a8b1 100644 --- a/OpenKeychain/src/main/res/layout/view_key_adv_activity.xml +++ b/OpenKeychain/src/main/res/layout/view_key_adv_activity.xml @@ -1,41 +1,16 @@ <?xml version="1.0" encoding="utf-8"?> -<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" - xmlns:app="http://schemas.android.com/apk/res-auto" +<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" - android:layout_height="match_parent"> + android:layout_height="match_parent" + android:orientation="vertical"> <include - android:id="@+id/toolbar_include" - layout="@layout/toolbar_standalone" /> + android:id="@+id/toolbar_tabs" + layout="@layout/toolbar_tabs" /> - <LinearLayout - android:layout_below="@id/toolbar_include" + <android.support.v4.view.ViewPager + android:id="@+id/pager" android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical"> + android:layout_height="match_parent" /> - <View - android:layout_width="match_parent" - android:layout_height="1dip" - android:background="?android:attr/listDivider" - android:visibility="gone" - android:id="@+id/view_key_status_divider" /> - - <com.astuetz.PagerSlidingTabStrip - android:id="@+id/view_key_sliding_tab_layout" - android:layout_width="match_parent" - android:layout_height="?attr/actionBarSize" - android:background="?attr/colorPrimary" - android:textColor="@color/tab_text" - app:pstsTextColorSelected="@color/tab_text_selected" - app:pstsIndicatorColor="@color/tab_indicator" /> - - <android.support.v4.view.ViewPager - android:id="@+id/view_key_pager" - android:layout_width="match_parent" - android:layout_height="0px" - android:layout_weight="1" - android:background="@android:color/white" /> - - </LinearLayout> -</RelativeLayout>
\ No newline at end of file +</LinearLayout>
\ No newline at end of file diff --git a/OpenKeychain/src/main/res/menu/encrypt_file_activity.xml b/OpenKeychain/src/main/res/menu/encrypt_file_activity.xml index 9a26d1757..f4aeb76c9 100644 --- a/OpenKeychain/src/main/res/menu/encrypt_file_activity.xml +++ b/OpenKeychain/src/main/res/menu/encrypt_file_activity.xml @@ -1,5 +1,19 @@ <?xml version="1.0" encoding="utf-8"?> -<menu xmlns:android="http://schemas.android.com/apk/res/android"> +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> + + <item + android:id="@+id/encrypt_save" + android:title="@string/btn_encrypt_save_file" + android:icon="@drawable/ic_action_encrypt_save_24dp" + app:showAsAction="always" /> + + <item + android:id="@+id/encrypt_share" + android:title="@string/btn_encrypt_share_file" + android:icon="@drawable/ic_action_encrypt_share_24dp" + app:showAsAction="always" /> + <item android:id="@+id/check_use_symmetric" android:title="@string/label_symmetric" diff --git a/OpenKeychain/src/main/res/menu/encrypt_text_activity.xml b/OpenKeychain/src/main/res/menu/encrypt_text_activity.xml index 71d254bb9..bb9f4058a 100644 --- a/OpenKeychain/src/main/res/menu/encrypt_text_activity.xml +++ b/OpenKeychain/src/main/res/menu/encrypt_text_activity.xml @@ -1,5 +1,19 @@ <?xml version="1.0" encoding="utf-8"?> -<menu xmlns:android="http://schemas.android.com/apk/res/android"> +<menu xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:app="http://schemas.android.com/apk/res-auto"> + + <item + android:id="@+id/encrypt_copy" + android:title="@string/btn_copy_encrypted_signed" + android:icon="@drawable/ic_action_encrypt_copy_24dp" + app:showAsAction="always" /> + + <item + android:id="@+id/encrypt_share" + android:title="@string/btn_share_encrypted_signed" + android:icon="@drawable/ic_action_encrypt_share_24dp" + app:showAsAction="always" /> + <item android:id="@+id/check_use_symmetric" android:title="@string/label_symmetric" diff --git a/OpenKeychain/src/main/res/values-cs/strings.xml b/OpenKeychain/src/main/res/values-cs/strings.xml index 903cc50f3..ce4f1cdcf 100644 --- a/OpenKeychain/src/main/res/values-cs/strings.xml +++ b/OpenKeychain/src/main/res/values-cs/strings.xml @@ -464,7 +464,7 @@ <string name="create_key_final_robot_text">Vytvoření klíče může chvíli trvat, mezitím si dejte třeba šálek dobré kávy...</string> <string name="create_key_rsa">(3 podklíče, RSA, 4096 bit)</string> <string name="create_key_custom">(uživatelská konfigurace klíče)</string> - <string name="create_key_text">Zadejte své celé jméno, emailovou adresu a zvolte heslo.</string> + <string name="create_key_identity_text">Zadejte své celé jméno, emailovou adresu a zvolte heslo.</string> <string name="create_key_hint_full_name">Celé jméno, např. Jan Novák</string> <string name="create_key_edit">Změnit konfiguraci klíče</string> <!--View key--> diff --git a/OpenKeychain/src/main/res/values-de/strings.xml b/OpenKeychain/src/main/res/values-de/strings.xml index 63b0c4c09..245de82ec 100644 --- a/OpenKeychain/src/main/res/values-de/strings.xml +++ b/OpenKeychain/src/main/res/values-de/strings.xml @@ -528,7 +528,7 @@ <string name="create_key_final_robot_text">Einen Schlüssel zu erzeugen braucht eine Weile, trink in der Zeit einen Kaffee...</string> <string name="create_key_rsa">(3 Unterschlüssel, RSA, 4096 Bit)</string> <string name="create_key_custom">(Benutzerdefinierte Schlüsseleinstellung)</string> - <string name="create_key_text">Vollen Namen und Emailadresse angeben und Passwort wählen.</string> + <string name="create_key_identity_text">Vollen Namen und Emailadresse angeben und Passwort wählen.</string> <string name="create_key_hint_full_name">Vollständiger Name, z.B. Max Mustermann</string> <string name="create_key_edit">Schlüsselkonfiguration ändern</string> <!--View key--> diff --git a/OpenKeychain/src/main/res/values-es/strings.xml b/OpenKeychain/src/main/res/values-es/strings.xml index 0d7444c47..d5d8440af 100644 --- a/OpenKeychain/src/main/res/values-es/strings.xml +++ b/OpenKeychain/src/main/res/values-es/strings.xml @@ -575,7 +575,7 @@ <string name="create_key_final_robot_text">Crear una clave puede llevar un tiempo, tómese una taza de café entre tanto...</string> <string name="create_key_rsa">(3 subclaves, RSA, 4096 bits)</string> <string name="create_key_custom">(configuración de clave personalizada)</string> - <string name="create_key_text">Introduzca su nombre completo, dirección de correo electrónico, y elija una frase contraseña.</string> + <string name="create_key_identity_text">Introduzca su nombre completo, dirección de correo electrónico, y elija una frase contraseña.</string> <string name="create_key_hint_full_name">Nombre completo, ej. Max Mustermann</string> <string name="create_key_edit">Cambiar configuración de clave</string> <!--View key--> diff --git a/OpenKeychain/src/main/res/values-fr/strings.xml b/OpenKeychain/src/main/res/values-fr/strings.xml index 50bd53921..8cc1cc735 100644 --- a/OpenKeychain/src/main/res/values-fr/strings.xml +++ b/OpenKeychain/src/main/res/values-fr/strings.xml @@ -573,7 +573,7 @@ <string name="create_key_final_robot_text">Créer une clef peut prendre du temps, prenez donc un café en attendant...</string> <string name="create_key_rsa">(3 sous-clefs, RSA, 4096 bits)</string> <string name="create_key_custom">(configuration personnalisée de la clef)</string> - <string name="create_key_text">Saisissez votre nom complet, votre adresse courriel et choisissez votre phrase de passe.</string> + <string name="create_key_identity_text">Saisissez votre nom complet, votre adresse courriel et choisissez votre phrase de passe.</string> <string name="create_key_hint_full_name">Nom complet, p. ex. Marc-Olivier Lagacé</string> <string name="create_key_edit">Changer la configuration de la clef</string> <!--View key--> diff --git a/OpenKeychain/src/main/res/values-it/strings.xml b/OpenKeychain/src/main/res/values-it/strings.xml index d741f7111..f55d16dfc 100644 --- a/OpenKeychain/src/main/res/values-it/strings.xml +++ b/OpenKeychain/src/main/res/values-it/strings.xml @@ -482,7 +482,7 @@ Permetti accesso?\n\nATTENZIONE: Se non sai perche\' questo schermata e\' appars <string name="create_key_final_robot_text">La creazione di una chiave richiede un po\' di tempo, prendi un caffè nel frattempo...</string> <string name="create_key_rsa">(3 sottochiavi, RSA, 4096 bit)</string> <string name="create_key_custom">(personalizza la configurazione della chiave)</string> - <string name="create_key_text">Inserisci Nome Completo, Email e scegli una Frase di Accesso.</string> + <string name="create_key_identity_text">Inserisci Nome Completo, Email e scegli una Frase di Accesso.</string> <string name="create_key_hint_full_name">Nome completo, es: Mario Rossi</string> <string name="create_key_edit">Cambia configurazione della chiave</string> <!--View key--> diff --git a/OpenKeychain/src/main/res/values-ja/strings.xml b/OpenKeychain/src/main/res/values-ja/strings.xml index c5318db36..ef817f398 100644 --- a/OpenKeychain/src/main/res/values-ja/strings.xml +++ b/OpenKeychain/src/main/res/values-ja/strings.xml @@ -532,7 +532,7 @@ <string name="create_key_final_robot_text">しばらくの間鍵を生成しています、その間はコーヒーでもどうぞ....</string> <string name="create_key_rsa">(3副鍵、RSA, 4096 bit)</string> <string name="create_key_custom">(個別の鍵設定)</string> - <string name="create_key_text">フルネーム、Eメールアドレスを入力そしてパスフレーズを選択してください。</string> + <string name="create_key_identity_text">フルネーム、Eメールアドレスを入力そしてパスフレーズを選択してください。</string> <string name="create_key_hint_full_name">フルネーム、例えば Max Mustermann</string> <string name="create_key_edit">鍵の設定変更</string> <!--View key--> diff --git a/OpenKeychain/src/main/res/values-nl/strings.xml b/OpenKeychain/src/main/res/values-nl/strings.xml index 34b8f1627..f8ee75750 100644 --- a/OpenKeychain/src/main/res/values-nl/strings.xml +++ b/OpenKeychain/src/main/res/values-nl/strings.xml @@ -575,7 +575,7 @@ <string name="create_key_final_robot_text">Een sleutel aanmaken kan even duren, maak intussen een tasje thee klaar…</string> <string name="create_key_rsa">(3 subsleutels, RSA, 4096 bit)</string> <string name="create_key_custom">(aangepaste sleutelconfiguratie)</string> - <string name="create_key_text">Voer je volledige naam en e-mailadres in, en kies een wachtwoord.</string> + <string name="create_key_identity_text">Voer je volledige naam en e-mailadres in, en kies een wachtwoord.</string> <string name="create_key_hint_full_name">Volledige naam, bv. Max Mustermann</string> <string name="create_key_edit">Sleutelconfiguratie wijzigen</string> <!--View key--> diff --git a/OpenKeychain/src/main/res/values-pl/strings.xml b/OpenKeychain/src/main/res/values-pl/strings.xml index 3dc6a2a35..46dd8c313 100644 --- a/OpenKeychain/src/main/res/values-pl/strings.xml +++ b/OpenKeychain/src/main/res/values-pl/strings.xml @@ -540,7 +540,7 @@ OSTRZEŻENIE: Jeżeli nie wiesz, czemu wyświetlił się ten komunikat, nie zezw <string name="create_key_final_robot_text">Tworzenie klucza może zająć trochę czasu... w międzyczasie idź się napij kawy.</string> <string name="create_key_rsa">(3 pod-klucze, RSA, 4096 bit)</string> <string name="create_key_custom">(niestandardowa konfiguracja kluczy)</string> - <string name="create_key_text">Wpisz swoje imię, adres email oraz wybierz hasło.</string> + <string name="create_key_identity_text">Wpisz swoje imię, adres email oraz wybierz hasło.</string> <string name="create_key_hint_full_name">Imię i nazwisko, na przykład, Jan Kowalski</string> <string name="create_key_edit">Zmień klucz konfiguracji</string> <!--View key--> diff --git a/OpenKeychain/src/main/res/values-ru/strings.xml b/OpenKeychain/src/main/res/values-ru/strings.xml index dc1c81bb4..211433d26 100644 --- a/OpenKeychain/src/main/res/values-ru/strings.xml +++ b/OpenKeychain/src/main/res/values-ru/strings.xml @@ -490,7 +490,7 @@ <string name="create_key_final_robot_text">Создание ключа займет некоторое время, можете пока выпить чашечку кофе...</string> <string name="create_key_rsa">(3 доп. ключа, RSA, 4096 bit)</string> <string name="create_key_custom">(произвольная конфигурация ключа)</string> - <string name="create_key_text">Укажите полное имя, адрес почты и придумайте надежный пароль.</string> + <string name="create_key_identity_text">Укажите полное имя, адрес почты и придумайте надежный пароль.</string> <string name="create_key_hint_full_name">Полное имя, напр. Иван Хлестаков</string> <string name="create_key_edit">Изменить конфигурацию ключа</string> <!--View key--> diff --git a/OpenKeychain/src/main/res/values-sr/strings.xml b/OpenKeychain/src/main/res/values-sr/strings.xml index 11639e2eb..73094c5a4 100644 --- a/OpenKeychain/src/main/res/values-sr/strings.xml +++ b/OpenKeychain/src/main/res/values-sr/strings.xml @@ -558,7 +558,7 @@ <string name="create_key_final_robot_text">Прављење кључа може да потраје, попијте кафу у међувремену…</string> <string name="create_key_rsa">(3 поткључа, РСА, 4096 бита)</string> <string name="create_key_custom">(прилагођена конфигурација кључа)</string> - <string name="create_key_text">Унесите пуно име, адресу е-поште и укуцајте лозинку.</string> + <string name="create_key_identity_text">Унесите пуно име, адресу е-поште и укуцајте лозинку.</string> <string name="create_key_hint_full_name">Пуно име, нпр. Петар Петровић</string> <string name="create_key_edit">Промени конфигурацију кључа</string> <!--View key--> diff --git a/OpenKeychain/src/main/res/values-sv/strings.xml b/OpenKeychain/src/main/res/values-sv/strings.xml index a24fe7ee7..d22eea22a 100644 --- a/OpenKeychain/src/main/res/values-sv/strings.xml +++ b/OpenKeychain/src/main/res/values-sv/strings.xml @@ -521,7 +521,7 @@ <string name="create_key_final_robot_text">Att skapa en nyckel kan ta ett tag, drick en kopp kaffe under tiden…</string> <string name="create_key_rsa">(3 undernycklar, RSA, 4096 bit)</string> <string name="create_key_custom">(anpassad nyckelkonfiguration)</string> - <string name="create_key_text">Ange ditt fullständiga namn, e-postadress och välj en lösenordsfras.</string> + <string name="create_key_identity_text">Ange ditt fullständiga namn, e-postadress och välj en lösenordsfras.</string> <string name="create_key_hint_full_name">Fullständigt namn, t.ex. Kalle Svensson</string> <string name="create_key_edit">Ändra nyckelkonfiguration</string> <!--View key--> diff --git a/OpenKeychain/src/main/res/values-tr/strings.xml b/OpenKeychain/src/main/res/values-tr/strings.xml index 7b6a976f5..ee5306cc7 100644 --- a/OpenKeychain/src/main/res/values-tr/strings.xml +++ b/OpenKeychain/src/main/res/values-tr/strings.xml @@ -449,7 +449,7 @@ <string name="create_key_final_robot_text">Anahtar oluşturma biraz zaman alabilir, bu sırada bir çay için...</string> <string name="create_key_rsa">(3 alt anahtar, RSA, 4096 bit)</string> <string name="create_key_custom">(özel anahtar yapılandırması)</string> - <string name="create_key_text">Tam isminizi, e-posta adresinizi girin ve bir parola seçin.</string> + <string name="create_key_identity_text">Tam isminizi, e-posta adresinizi girin ve bir parola seçin.</string> <string name="create_key_hint_full_name">Tam Ad, örneğin: Max Mustermann</string> <string name="create_key_edit">Anahtar yapılandırmasını değiştir.</string> <!--View key--> diff --git a/OpenKeychain/src/main/res/values-uk/strings.xml b/OpenKeychain/src/main/res/values-uk/strings.xml index cf586b2d5..365821f4a 100644 --- a/OpenKeychain/src/main/res/values-uk/strings.xml +++ b/OpenKeychain/src/main/res/values-uk/strings.xml @@ -449,7 +449,7 @@ <string name="create_key_empty">Це поле - обов\'язкове</string> <string name="create_key_passphrases_not_equal">Паролі фрази не збігаються</string> <string name="create_key_final_text">Ви ввели наступну сутність:</string> - <string name="create_key_text">Введіть ваше повне ім\'я, електронну адреса та оберіть парольну фразу.</string> + <string name="create_key_identity_text">Введіть ваше повне ім\'я, електронну адреса та оберіть парольну фразу.</string> <string name="create_key_hint_full_name">Повне ім\'я, наприклад Степан Бандера</string> <!--View key--> <!--Navigation Drawer--> diff --git a/OpenKeychain/src/main/res/values-zh-rTW/strings.xml b/OpenKeychain/src/main/res/values-zh-rTW/strings.xml index b6ab2c8a4..b5b57d91f 100644 --- a/OpenKeychain/src/main/res/values-zh-rTW/strings.xml +++ b/OpenKeychain/src/main/res/values-zh-rTW/strings.xml @@ -377,7 +377,7 @@ <string name="create_key_empty">必填欄位</string> <string name="create_key_passphrases_not_equal">口令不相符</string> <string name="create_key_final_robot_text">建立金鑰可能需要一點時間,來杯咖啡吧…</string> - <string name="create_key_text">輸入你的全名、電子郵件,並選擇一組口令。</string> + <string name="create_key_identity_text">輸入你的全名、電子郵件,並選擇一組口令。</string> <!--View key--> <!--Navigation Drawer--> <string name="nav_keys">金鑰</string> diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml index 4a2be2eb8..9753e4d60 100644 --- a/OpenKeychain/src/main/res/values/strings.xml +++ b/OpenKeychain/src/main/res/values/strings.xml @@ -11,8 +11,8 @@ <!-- title --> <string name="title_select_recipients">"Select Keys"</string> <string name="title_select_secret_key">"Select Your Key"</string> - <string name="title_encrypt_text">"Encrypt Text"</string> - <string name="title_encrypt_files">"Encrypt Files"</string> + <string name="title_encrypt_text">"Encrypt"</string> + <string name="title_encrypt_files">"Encrypt"</string> <string name="title_decrypt">"Decrypt"</string> <string name="title_unlock">"Unlock Key"</string> <string name="title_add_subkey">"Add subkey"</string> @@ -26,7 +26,7 @@ <string name="title_share_fingerprint_with">"Share fingerprint with…"</string> <string name="title_share_key">"Share key with…"</string> <string name="title_share_file">"Share file with…"</string> - <string name="title_share_message">"Share message with…"</string> + <string name="title_share_message">"Share text with…"</string> <string name="title_encrypt_to_file">"Encrypt To File"</string> <string name="title_decrypt_to_file">"Decrypt To File"</string> <string name="title_import_keys">"Import Keys"</string> @@ -73,9 +73,10 @@ <!-- button --> <string name="btn_decrypt_verify_file">"Decrypt, verify, and save file"</string> - <string name="btn_decrypt_verify_message">"Decrypt and verify message"</string> + <string name="btn_decrypt_verify_message">"Decrypt and verify text"</string> <string name="btn_encrypt_file">"Encrypt and save file"</string> <string name="btn_encrypt_share_file">"Encrypt and share file"</string> + <string name="btn_encrypt_save_file">"Encrypt and save file"</string> <string name="btn_save">"Save"</string> <string name="btn_do_not_save">"Cancel"</string> <string name="btn_delete">"Delete"</string> @@ -87,7 +88,8 @@ <string name="btn_no">"No"</string> <string name="btn_match">"Fingerprints match"</string> <string name="btn_lookup_key">"Lookup key"</string> - <string name="btn_share_encrypted_signed">"Encrypt and share message"</string> + <string name="btn_share_encrypted_signed">"Encrypt and share text"</string> + <string name="btn_copy_encrypted_signed">"Encrypt and copy text"</string> <string name="btn_view_cert_key">"View certification key"</string> <string name="btn_create_key">"Create key"</string> <string name="btn_add_files">"Add file(s)"</string> @@ -119,7 +121,7 @@ <string name="menu_export_log">"Export Log"</string> <!-- label --> - <string name="label_message">"Message"</string> + <string name="label_message">"Text"</string> <string name="label_file">"File"</string> <string name="label_files">"File(s)"</string> <string name="label_file_colon">"File:"</string> @@ -127,6 +129,7 @@ <string name="label_passphrase">"Passphrase"</string> <string name="label_unlock">"Unlocking…"</string> <string name="label_passphrase_again">"Repeat Passphrase"</string> + <string name="label_show_passphrase">"Show Passphrase"</string> <string name="label_algorithm">"Algorithm"</string> <string name="label_ascii_armor">"File ASCII Armor"</string> <string name="label_file_ascii_armor">"Enable ASCII Armor"</string> @@ -144,7 +147,7 @@ <string name="label_symmetric">"Encrypt with passphrase"</string> <string name="label_passphrase_cache_ttl">"Cache time"</string> <string name="label_passphrase_cache_subs">"Cache passphrases by subkey"</string> - <string name="label_message_compression">"Message compression"</string> + <string name="label_message_compression">"Text compression"</string> <string name="label_file_compression">"File compression"</string> <string name="label_keyservers">"Keyservers"</string> <string name="label_key_id">"Key ID"</string> @@ -219,7 +222,7 @@ <string name="yubikey_pin_for">"Enter PIN to access YubiKey for '%s'"</string> <string name="nfc_text">"Hold YubiKey against the back of your device."</string> <string name="file_delete_confirmation">"Are you sure you want to delete\n%s?"</string> - <string name="file_delete_successful">"Successfully deleted."</string> + <string name="file_delete_successful">"'%s' has been deleted."</string> <string name="no_file_selected">"Select a file first."</string> <string name="encrypt_sign_successful">"Successfully signed and/or encrypted."</string> <string name="encrypt_sign_clipboard_successful">"Successfully signed and/or encrypted to clipboard."</string> @@ -260,7 +263,7 @@ no punctuation, all lowercase, they will be put after "error_message", e.g. "Error: file not found" --> - <string name="error_file_delete_failed">"deleting '%s' failed"</string> + <string name="error_file_delete_failed">"Deleting '%s' failed. Please do this manually!"</string> <string name="error_file_not_found">"file not found"</string> <string name="error_no_secret_key_found">"no suitable secret key found"</string> <string name="error_external_storage_not_ready">"external storage not ready"</string> @@ -557,7 +560,7 @@ <string name="key_trust_maybe">"This key is neither revoked nor expired.\nYou haven’t confirmed it, but you may choose to trust it."</string> <string name="key_trust_revoked">"This key has been revoked by its owner. You should not trust it."</string> <string name="key_trust_expired">"This key has expired. You should not trust it."</string> - <string name="key_trust_old_keys">" It may be OK to use this to decrypt an old message dating from the time when this key was valid."</string> + <string name="key_trust_old_keys">"It may be OK to use this to decrypt an old message dating from the time when this key was valid."</string> <string name="key_trust_no_cloud_evidence">"No proof from the cloud on this key’s trustworthiness."</string> <string name="key_trust_start_cloud_search">"Start search"</string> <string name="key_trust_results_prefix">"Keybase.io offers “proofs” which assert that the owner of this key: "</string> @@ -625,8 +628,10 @@ <string name="create_key_final_robot_text">"Creating a key may take a while, have a cup of coffee in the meantime…"</string> <string name="create_key_rsa">"(3 subkeys, RSA, 4096 bit)"</string> <string name="create_key_custom">"(custom key configuration)"</string> - <string name="create_key_text">"Enter your full name, email address, and choose a passhrase."</string> - <string name="create_key_hint_full_name">"Full Name, e.g. Max Mustermann"</string> + <string name="create_key_name_text">"Choose a name associated with this key. This can be a full name, e.g., 'John Doe', or a nickname, e.g., 'Johnny'."</string> + <string name="create_key_email_text">"Choose the email address used for encrypted communication."</string> + <string name="create_key_passphrase_text">"Choose a strong passphrase. It protects your key when your device gets stolen."</string> + <string name="create_key_hint_full_name">"Full Name or Nickname"</string> <string name="create_key_edit">"Change key configuration"</string> <!-- View key --> |