From bc43797c32542aa48a34f44d486645d24fca06ba Mon Sep 17 00:00:00 2001 From: Adithya Abraham Philip Date: Mon, 9 Mar 2015 00:37:14 +0530 Subject: [PATCH 1/6] added card --- .../keychain/ui/ViewKeyFragment.java | 18 +++++++++ .../src/main/res/layout/view_key_fragment.xml | 38 ++++++++++++++++--- OpenKeychain/src/main/res/values/strings.xml | 1 + 3 files changed, 52 insertions(+), 5 deletions(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyFragment.java index 628970b27..389b39c82 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyFragment.java @@ -18,6 +18,7 @@ package org.sufficientlysecure.keychain.ui; +import android.content.DialogInterface; import android.database.Cursor; import android.net.Uri; import android.os.Bundle; @@ -44,6 +45,7 @@ public class ViewKeyFragment extends LoaderFragment implements public static final String ARG_DATA_URI = "uri"; private ListView mUserIds; + private ListView mLinkedSystemContact; boolean mIsSecret = false; @@ -81,6 +83,15 @@ public class ViewKeyFragment extends LoaderFragment implements } }); + mLinkedSystemContact = (ListView) view.findViewById(R.id.view_key_linked_system_contact); + + mLinkedSystemContact.setOnItemClickListener(new AdapterView.OnItemClickListener() { + @Override + public void onItemClick(AdapterView parent, View view, int position, long id) { + showSystemContact(position); + } + }); + return root; } @@ -100,6 +111,10 @@ public class ViewKeyFragment extends LoaderFragment implements } } + private void showSystemContact(final int position) { + + } + @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); @@ -148,6 +163,7 @@ public class ViewKeyFragment extends LoaderFragment implements getLoaderManager().initLoader(LOADER_ID_UNIFIED, null, this); } + @Override public Loader onCreateLoader(int id, Bundle args) { setContentShown(false); @@ -164,6 +180,7 @@ public class ViewKeyFragment extends LoaderFragment implements } } + @Override public void onLoadFinished(Loader loader, Cursor data) { /* TODO better error handling? May cause problems when a key is deleted, * because the notification triggers faster than the activity closes. @@ -202,6 +219,7 @@ public class ViewKeyFragment extends LoaderFragment implements * This is called when the last Cursor provided to onLoadFinished() above is about to be closed. * We need to make sure we are no longer using it. */ + @Override public void onLoaderReset(Loader loader) { switch (loader.getId()) { case LOADER_ID_USER_IDS: { diff --git a/OpenKeychain/src/main/res/layout/view_key_fragment.xml b/OpenKeychain/src/main/res/layout/view_key_fragment.xml index bba412f99..7f3ef0f1e 100644 --- a/OpenKeychain/src/main/res/layout/view_key_fragment.xml +++ b/OpenKeychain/src/main/res/layout/view_key_fragment.xml @@ -1,7 +1,7 @@ + xmlns:card_view="http://schemas.android.com/apk/res-auto" + android:layout_width="match_parent" + android:layout_height="match_parent"> + android:text="@string/section_user_ids"/> + android:layout_marginBottom="4dp"/> + + + + + + + + + diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml index 2c83ac070..61c406d48 100644 --- a/OpenKeychain/src/main/res/values/strings.xml +++ b/OpenKeychain/src/main/res/values/strings.xml @@ -47,6 +47,7 @@ "Identities" + "Linked System Contact" "Should you trust this key?" Proof verification "Proofs from the cloud" From f8a6f814dd4f4e015707085c297b91abf237ed14 Mon Sep 17 00:00:00 2001 From: Adithya Abraham Philip Date: Tue, 10 Mar 2015 01:05:40 +0530 Subject: [PATCH 2/6] added contact linking --- .../keychain/ui/ViewKeyFragment.java | 61 ++++++++++++++++--- .../keychain/util/ContactHelper.java | 28 +++++++++ .../src/main/res/layout/view_key_fragment.xml | 23 ++++++- OpenKeychain/src/main/res/values/strings.xml | 2 + 4 files changed, 102 insertions(+), 12 deletions(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyFragment.java index 389b39c82..f4cbe88a9 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyFragment.java @@ -18,25 +18,31 @@ package org.sufficientlysecure.keychain.ui; +import android.content.ContentResolver; +import android.content.Context; import android.content.DialogInterface; +import android.content.Intent; import android.database.Cursor; +import android.graphics.Bitmap; import android.net.Uri; import android.os.Bundle; +import android.provider.ContactsContract; import android.support.v4.app.LoaderManager; import android.support.v4.content.CursorLoader; import android.support.v4.content.Loader; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.AdapterView; -import android.widget.ListView; +import android.widget.*; import org.sufficientlysecure.keychain.Constants; import org.sufficientlysecure.keychain.R; import org.sufficientlysecure.keychain.compatibility.DialogFragmentWorkaround; +import org.sufficientlysecure.keychain.pgp.KeyRing; import org.sufficientlysecure.keychain.provider.KeychainContract; import org.sufficientlysecure.keychain.ui.adapter.UserIdsAdapter; import org.sufficientlysecure.keychain.ui.dialog.UserIdInfoDialogFragment; +import org.sufficientlysecure.keychain.util.ContactHelper; import org.sufficientlysecure.keychain.util.Log; public class ViewKeyFragment extends LoaderFragment implements @@ -45,12 +51,18 @@ public class ViewKeyFragment extends LoaderFragment implements public static final String ARG_DATA_URI = "uri"; private ListView mUserIds; - private ListView mLinkedSystemContact; + //private ListView mLinkedSystemContact; boolean mIsSecret = false; + private String mName; + + LinearLayout mSystemContactLayout; + ImageView mSystemContactPicture; + TextView mSystemContactName; private static final int LOADER_ID_UNIFIED = 0; private static final int LOADER_ID_USER_IDS = 1; + private static final int LOADER_ID_SYSTEM_CONTACT = 2; private UserIdsAdapter mUserIdsAdapter; @@ -83,15 +95,17 @@ public class ViewKeyFragment extends LoaderFragment implements } }); - mLinkedSystemContact = (ListView) view.findViewById(R.id.view_key_linked_system_contact); + mSystemContactLayout = (LinearLayout) view.findViewById(R.id.system_contact_layout); + mSystemContactName = (TextView) view.findViewById(R.id.system_contact_name); + mSystemContactPicture = (ImageView) view.findViewById(R.id.system_contact_picture); + // mLinkedSystemContact = (ListView) view.findViewById(R.id.view_key_linked_system_contact); - mLinkedSystemContact.setOnItemClickListener(new AdapterView.OnItemClickListener() { + /* mLinkedSystemContact.setOnItemClickListener(new AdapterView.OnItemClickListener() { @Override public void onItemClick(AdapterView parent, View view, int position, long id) { showSystemContact(position); } - }); - + });*/ return root; } @@ -111,8 +125,32 @@ public class ViewKeyFragment extends LoaderFragment implements } } - private void showSystemContact(final int position) { + private void loadLinkedSystemContact(String name, final long masterKeyId) { + final Context context = mSystemContactName.getContext(); + final ContentResolver resolver = context.getContentResolver(); + final long contactId = ContactHelper.findContactId(resolver, masterKeyId); + + if (contactId != -1) {//contact exists for given master key + mSystemContactName.setText(name); + + Bitmap picture = ContactHelper.loadPhotoByMasterKeyId(resolver, masterKeyId, true); + if (picture != null) mSystemContactPicture.setImageBitmap(picture); + + mSystemContactLayout.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + launchContactActivity(contactId, context); + } + }); + } + } + + private void launchContactActivity(final long contactId, Context context) { + Intent intent = new Intent(Intent.ACTION_VIEW); + Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_URI, String.valueOf(contactId)); + intent.setData(uri); + context.startActivity(intent); } @Override @@ -196,7 +234,12 @@ public class ViewKeyFragment extends LoaderFragment implements if (data.moveToFirst()) { mIsSecret = data.getInt(INDEX_HAS_ANY_SECRET) != 0; - + if (mName == null) {//to ensure we load the linked system contact only once + String[] mainUserId = KeyRing.splitUserId(data.getString(INDEX_USER_ID)); + mName = mainUserId[0]; + long masterKeyId = data.getLong(INDEX_MASTER_KEY_ID); + loadLinkedSystemContact(mName, masterKeyId); + } // load user ids after we know if it's a secret key mUserIdsAdapter = new UserIdsAdapter(getActivity(), null, 0, !mIsSecret, null); mUserIds.setAdapter(mUserIdsAdapter); 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 08c7c02fb..f1ed36a8d 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ContactHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ContactHelper.java @@ -267,6 +267,34 @@ public class ContactHelper { return null; } + /** + * returns the CONTACT_ID of the raw contact to which a masterKeyId is associated, if the + * raw contact has not been marked for deletion + * @param resolver + * @param masterKeyId + * @return CONTACT_ID (id of aggregated contact) linked to masterKeyId + */ + public static long findContactId(ContentResolver resolver, long masterKeyId) { + long contactId = -1; + Cursor raw = resolver.query(ContactsContract.RawContacts.CONTENT_URI, + new String[]{ + ContactsContract.RawContacts.CONTACT_ID + }, + ContactsContract.RawContacts.ACCOUNT_TYPE + "=? AND " + + ContactsContract.RawContacts.SOURCE_ID + "=? AND " + + ContactsContract.RawContacts.DELETED + "=?", + new String[]{//"0" for "not deleted" + Constants.ACCOUNT_TYPE, Long.toString(masterKeyId), "0" + }, null); + if (raw != null) { + if (raw.moveToNext()) { + contactId = raw.getLong(0); + } + raw.close(); + } + return contactId; + } + public static Bitmap getCachedPhotoByMasterKeyId(ContentResolver contentResolver, long masterKeyId) { if (masterKeyId == -1) { return null; diff --git a/OpenKeychain/src/main/res/layout/view_key_fragment.xml b/OpenKeychain/src/main/res/layout/view_key_fragment.xml index 7f3ef0f1e..d8584bca6 100644 --- a/OpenKeychain/src/main/res/layout/view_key_fragment.xml +++ b/OpenKeychain/src/main/res/layout/view_key_fragment.xml @@ -62,11 +62,28 @@ android:layout_height="wrap_content" android:text="@string/section_linked_system_contact"/> - + android:orientation="horizontal"> + + + + + diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml index 61c406d48..784f2825c 100644 --- a/OpenKeychain/src/main/res/values/strings.xml +++ b/OpenKeychain/src/main/res/values/strings.xml @@ -639,6 +639,8 @@ "Confirmed Key" "Unconfirmed: Scan QR Code to confirm key!" + "<none>" + "Keys" "Encrypt/Decrypt" From 012b7e4830e9a52b896c17c98af68db5ade2e333 Mon Sep 17 00:00:00 2001 From: Adithya Abraham Philip Date: Tue, 10 Mar 2015 01:27:33 +0530 Subject: [PATCH 3/6] cleaned up code, added comments optimised imports --- .../keychain/ui/ViewKeyFragment.java | 24 ++++++++++++------- .../keychain/util/ContactHelper.java | 1 + 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyFragment.java index f4cbe88a9..bb3df2541 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/ViewKeyFragment.java @@ -20,7 +20,6 @@ package org.sufficientlysecure.keychain.ui; import android.content.ContentResolver; import android.content.Context; -import android.content.DialogInterface; import android.content.Intent; import android.database.Cursor; import android.graphics.Bitmap; @@ -62,7 +61,6 @@ public class ViewKeyFragment extends LoaderFragment implements private static final int LOADER_ID_UNIFIED = 0; private static final int LOADER_ID_USER_IDS = 1; - private static final int LOADER_ID_SYSTEM_CONTACT = 2; private UserIdsAdapter mUserIdsAdapter; @@ -98,14 +96,7 @@ public class ViewKeyFragment extends LoaderFragment implements mSystemContactLayout = (LinearLayout) view.findViewById(R.id.system_contact_layout); mSystemContactName = (TextView) view.findViewById(R.id.system_contact_name); mSystemContactPicture = (ImageView) view.findViewById(R.id.system_contact_picture); - // mLinkedSystemContact = (ListView) view.findViewById(R.id.view_key_linked_system_contact); - /* mLinkedSystemContact.setOnItemClickListener(new AdapterView.OnItemClickListener() { - @Override - public void onItemClick(AdapterView parent, View view, int position, long id) { - showSystemContact(position); - } - });*/ return root; } @@ -125,6 +116,13 @@ public class ViewKeyFragment extends LoaderFragment implements } } + /** + * Checks if a system contact exists for given masterKeyId, and if it does, sets name, picture + * and onClickListener for the linked system contact's layout + * + * @param name + * @param masterKeyId + */ private void loadLinkedSystemContact(String name, final long masterKeyId) { final Context context = mSystemContactName.getContext(); final ContentResolver resolver = context.getContentResolver(); @@ -146,6 +144,14 @@ public class ViewKeyFragment extends LoaderFragment implements } } + /** + * launches the default android Contacts app to view a contact with the passed + * contactId (CONTACT_ID column from ContactsContract.RawContact table which is _ID column in + * ContactsContract.Contact table) + * + * @param contactId _ID for row in ContactsContract.Contacts table + * @param context + */ private void launchContactActivity(final long contactId, Context context) { Intent intent = new Intent(Intent.ACTION_VIEW); Uri uri = Uri.withAppendedPath(ContactsContract.Contacts.CONTENT_URI, String.valueOf(contactId)); 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 f1ed36a8d..a7b5c2983 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ContactHelper.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/util/ContactHelper.java @@ -270,6 +270,7 @@ public class ContactHelper { /** * returns the CONTACT_ID of the raw contact to which a masterKeyId is associated, if the * raw contact has not been marked for deletion + * * @param resolver * @param masterKeyId * @return CONTACT_ID (id of aggregated contact) linked to masterKeyId From 7d2e2e3eec85193f41554605483506b1233e7f07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Sch=C3=BCrmann?= Date: Mon, 9 Mar 2015 22:00:44 +0100 Subject: [PATCH 4/6] Make create key wizard step-by-step --- Graphics/get-material-icons.sh | 3 + OpenKeychain/src/main/AndroidManifest.xml | 2 +- .../keychain/ui/CreateKeyActivity.java | 4 +- .../keychain/ui/CreateKeyEmailFragment.java | 134 +++++++++++++++++ .../keychain/ui/CreateKeyFinalFragment.java | 2 +- .../keychain/ui/CreateKeyNameFragment.java | 140 ++++++++++++++++++ ....java => CreateKeyPassphraseFragment.java} | 67 +++++---- .../ic_chevron_left_grey_24dp.png | Bin 0 -> 276 bytes .../ic_chevron_right_grey_24dp.png | Bin 0 -> 271 bytes .../res/drawable-hdpi/ic_person_grey_48dp.png | Bin 0 -> 576 bytes .../ic_chevron_left_grey_24dp.png | Bin 0 -> 240 bytes .../ic_chevron_right_grey_24dp.png | Bin 0 -> 225 bytes .../res/drawable-mdpi/ic_person_grey_48dp.png | Bin 0 -> 431 bytes .../ic_chevron_left_grey_24dp.png | Bin 0 -> 314 bytes .../ic_chevron_right_grey_24dp.png | Bin 0 -> 305 bytes .../drawable-xhdpi/ic_person_grey_48dp.png | Bin 0 -> 751 bytes .../ic_chevron_left_grey_24dp.png | Bin 0 -> 382 bytes .../ic_chevron_right_grey_24dp.png | Bin 0 -> 388 bytes .../drawable-xxhdpi/ic_person_grey_48dp.png | Bin 0 -> 1121 bytes .../ic_chevron_left_grey_24dp.png | Bin 0 -> 481 bytes .../ic_chevron_right_grey_24dp.png | Bin 0 -> 472 bytes .../drawable-xxxhdpi/ic_person_grey_48dp.png | Bin 0 -> 1488 bytes .../res/layout/create_key_email_fragment.xml | 84 +++++++++++ .../res/layout/create_key_final_fragment.xml | 46 ++---- .../res/layout/create_key_name_fragment.xml | 83 +++++++++++ ...xml => create_key_passphrase_fragment.xml} | 87 +++-------- .../src/main/res/values-cs/strings.xml | 2 +- .../src/main/res/values-de/strings.xml | 2 +- .../src/main/res/values-es/strings.xml | 2 +- .../src/main/res/values-fr/strings.xml | 2 +- .../src/main/res/values-it/strings.xml | 2 +- .../src/main/res/values-ja/strings.xml | 2 +- .../src/main/res/values-nl/strings.xml | 2 +- .../src/main/res/values-pl/strings.xml | 2 +- .../src/main/res/values-ru/strings.xml | 2 +- .../src/main/res/values-sr/strings.xml | 2 +- .../src/main/res/values-sv/strings.xml | 2 +- .../src/main/res/values-tr/strings.xml | 2 +- .../src/main/res/values-uk/strings.xml | 2 +- .../src/main/res/values-zh-rTW/strings.xml | 2 +- OpenKeychain/src/main/res/values/strings.xml | 6 +- 41 files changed, 535 insertions(+), 151 deletions(-) create mode 100644 OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyEmailFragment.java create mode 100644 OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyNameFragment.java rename OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/{CreateKeyInputFragment.java => CreateKeyPassphraseFragment.java} (72%) create mode 100644 OpenKeychain/src/main/res/drawable-hdpi/ic_chevron_left_grey_24dp.png create mode 100644 OpenKeychain/src/main/res/drawable-hdpi/ic_chevron_right_grey_24dp.png create mode 100644 OpenKeychain/src/main/res/drawable-hdpi/ic_person_grey_48dp.png create mode 100644 OpenKeychain/src/main/res/drawable-mdpi/ic_chevron_left_grey_24dp.png create mode 100644 OpenKeychain/src/main/res/drawable-mdpi/ic_chevron_right_grey_24dp.png create mode 100644 OpenKeychain/src/main/res/drawable-mdpi/ic_person_grey_48dp.png create mode 100644 OpenKeychain/src/main/res/drawable-xhdpi/ic_chevron_left_grey_24dp.png create mode 100644 OpenKeychain/src/main/res/drawable-xhdpi/ic_chevron_right_grey_24dp.png create mode 100644 OpenKeychain/src/main/res/drawable-xhdpi/ic_person_grey_48dp.png create mode 100644 OpenKeychain/src/main/res/drawable-xxhdpi/ic_chevron_left_grey_24dp.png create mode 100644 OpenKeychain/src/main/res/drawable-xxhdpi/ic_chevron_right_grey_24dp.png create mode 100644 OpenKeychain/src/main/res/drawable-xxhdpi/ic_person_grey_48dp.png create mode 100644 OpenKeychain/src/main/res/drawable-xxxhdpi/ic_chevron_left_grey_24dp.png create mode 100644 OpenKeychain/src/main/res/drawable-xxxhdpi/ic_chevron_right_grey_24dp.png create mode 100644 OpenKeychain/src/main/res/drawable-xxxhdpi/ic_person_grey_48dp.png create mode 100644 OpenKeychain/src/main/res/layout/create_key_email_fragment.xml create mode 100644 OpenKeychain/src/main/res/layout/create_key_name_fragment.xml rename OpenKeychain/src/main/res/layout/{create_key_input_fragment.xml => create_key_passphrase_fragment.xml} (50%) diff --git a/Graphics/get-material-icons.sh b/Graphics/get-material-icons.sh index 3bfec249f..248dcd532 100755 --- a/Graphics/get-material-icons.sh +++ b/Graphics/get-material-icons.sh @@ -37,6 +37,9 @@ python copy OpenKeychain social grey person 24 python copy OpenKeychain social grey person_add 24 python copy OpenKeychain social grey share 24 python copy OpenKeychain communication grey vpn_key 24 +python copy OpenKeychain navigation grey chevron_left 24 +python copy OpenKeychain navigation grey chevron_right 24 +python copy OpenKeychain social grey person 48 # navigation drawer sections python copy OpenKeychain communication black vpn_key 24 diff --git a/OpenKeychain/src/main/AndroidManifest.xml b/OpenKeychain/src/main/AndroidManifest.xml index a1a6ed02e..fbe89bc28 100644 --- a/OpenKeychain/src/main/AndroidManifest.xml +++ b/OpenKeychain/src/main/AndroidManifest.xml @@ -93,7 +93,7 @@ + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package org.sufficientlysecure.keychain.ui; + +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 + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package org.sufficientlysecure.keychain.ui; + +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 similarity index 72% rename from OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyInputFragment.java rename to OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyPassphraseFragment.java index 05408e21e..be77d5042 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyInputFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyPassphraseFragment.java @@ -17,6 +17,7 @@ package org.sufficientlysecure.keychain.ui; +import android.app.Activity; import android.content.Context; import android.os.Bundle; import android.support.v4.app.Fragment; @@ -28,26 +29,29 @@ 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; import org.sufficientlysecure.keychain.ui.widget.PassphraseEditText; -public class CreateKeyInputFragment extends Fragment { +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; - NameEditText mNameEdit; - EmailEditText mEmailEdit; PassphraseEditText mPassphraseEdit; EditText mPassphraseEditAgain; - View mCreateButton; + 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); @@ -94,27 +98,24 @@ public class CreateKeyInputFragment extends Fragment { @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); - mNameEdit = (NameEditText) view.findViewById(R.id.create_key_name); mPassphraseEdit = (PassphraseEditText) view.findViewById(R.id.create_key_passphrase); - mEmailEdit = (EmailEditText) view.findViewById(R.id.create_key_email); mPassphraseEditAgain = (EditText) view.findViewById(R.id.create_key_passphrase_again); - mCreateButton = view.findViewById(R.id.create_key_button); + 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(); - } - 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(); @@ -125,22 +126,24 @@ public class CreateKeyInputFragment extends Fragment { } @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() ); 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 new file mode 100644 index 0000000000000000000000000000000000000000..12e39d39dc2b19f585ad1f1e3cd4615afa4490b4 GIT binary patch literal 276 zcmeAS@N?(olHy`uVBq!ia0vp^Dj>|k0wldT1B8K;Lb6AYF9SoB8UsT^3j@P1pisjL z28L1t28LG&3=CE?7#PG0=Ijcz0ZK3>dAqwX{BQ3+vmeOgEbxddW?TY)5S5wg1$~jG*zUI-~ zQ$kY~_$yZL^Eh#d;jQh`W|k0wldT1B8K;Lb6AYF9SoB8UsT^3j@P1pisjL z28L1t28LG&3=CE?7#PG0=Ijcz0ZK3>dAqwX{BQ3+vmeOgEbxddW?Tu)5S5wAx004R> z004l5008;`004mK004C`008P>0026e000+ooVrmw00002VoOIv0RM-N%)bBt010qN zS#tmY3ljhU3ljkVnw%H_00Fp3L_t(&-tE`TO2R=D#$hq)3TjtbZX)`k?xU6&nimkQ zqJD{8KyB(WL^Nuhx(>r-P}?x6MFdgSLQzgDDf-a=s52%V-Wzz}%$a$|hwpF2ryvC> zNI?oxkXulYJ#ySrrOF*S;!N}oG|4e_%;9{(qKOXHo9VySCgqyc4z^f;N5m5-H3!ll)=hY9tuz-8U#ej0`0zR48%AZaXbef36BrP(OhD%(Bh_ z#}p`1rbdl2MGB0WSiX5AGdXuIEywx3mkE4RL=yV$RYFH1`V*rg)!xG z@~nCrq8H8z*BxORxnj9<&DpaO2a`eo O0000O=~G=WkL6 z;pyTSVsScICsl#hpfAgTl{dg=NgG>RRhvD}FP`fiml*=(PHt$kkXAUgSRzdLIeW*a zjJD7tl~POo=wJ8}dZbOr#o6Sr*P~|9^O=~G=WkJm z>FMGaVsScICsl#hpf9VT!L98-5ATue3#k_85Aa;M;;@HTkjJ|q`{28FkG7*bwmkS$ zB63*iO;ka9kjY`EoTwGc7~6|tqzbf-uVd^l(sGSq7U@q@*ksDUV9Tc@==tE!OrRwU Mp00i_>zopr09`OciU0rr literal 0 HcmV?d00001 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 new file mode 100644 index 0000000000000000000000000000000000000000..738e3490d01ea88aed5ad31814d74c96ec7e67b7 GIT binary patch literal 431 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA0wn)(8}a}tg=CK)Uj~LMH3o);76yi2K%s^g z3=E|}g|8AA7_4S6Fo+k-*%fF5lweBoc6VX;-`;;_Kaj^+;1OBOz`!jG!i)^F=14Fw zFsggHIEF+VetXr{i`h})*hk-|&jfCHaYcUTYubC`h3&uT24$W%bc>h|8kGsL2--SK zI;$EZlDhrGJ~5>XyR@|OV@g&we?KShyT{2|!j476?s*;=&qZgbN_&Kp_ z$_3F2&+=COGfoyh#3He7t$523R)PFA;#z+rUo?g=axhmXtYcaB&0!@=mo9^ms=-Ef zA=L|;*_E`8n%Wk8ykHi8W#8=SGDdOH^{4w*CyGzf%MEe8zhvLJ9eol8OBWQBqceOlU;MtNN!qHNGV@At$ihe~_AfGdMy85}Sb4q9e E0FO6u=l}o! literal 0 HcmV?d00001 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 new file mode 100644 index 0000000000000000000000000000000000000000..7b82b8a5774229761b0bbc24c5fdbb9f6214d8dc GIT binary patch literal 305 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA0wn)(8}a}tg=CK)Uj~LMH3o);76yi2K%s^g z3=E|}g|8AA7_4S6Fo+k-*%fF5lweBoc6VX;-`;;_Kaj^+;1OBOz`!jG!i)^F=12eq zS9-cQhD02Gd(DyWkO7a&#rw80E4ExuYGhH$Rb6+b$SNWv>Fvx%bBh})y=2tit$VU= zT>}%B#)J9;N7|>cpRs8;si<^d?$ho4(-^<(vE1$Qrh`x5qS9@bKeJ}FTw)hnXgbSr z#atcXU%`q(=b}{v`3e$Gvn;8Qm54Cz);XSi;J`7>^%vLturSzU^)c{3Uq2)JqvQj< v;qRt%_NG5uzF#<{PuJ8+EWm+r=WA{)byr2Jx6gk99nIkB>gTe~DWM4fNak$P literal 0 HcmV?d00001 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 new file mode 100644 index 0000000000000000000000000000000000000000..e664e94ac1d1f253280475bd1e2d293060ec5d41 GIT binary patch literal 751 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD0wg^q?%xcg6p}rHd>I(3)EF2VS{N990fib~ zFff!FFfhDIU|_JC!N4G1FlSew4N!t9$=lt9;eUJonf*W>XMsm#F#`j)FbFd;%$g$s zRFUrK;uunK>+Q|+S;B!L$3G_I%9(I&Ns$wf%wfmL+WAP5B@0zVg~QNl7GU zv9f5*ggoXzFK#ovzneE+E>pa*!q{tl_k`9NCdS3-Mek2Mv~j4DxA^XNZYL|(&vi`< zED8*a91aXj0u3PMZU)t9A2SMFJWeR;+N_%LiE&2iq&oOaqD(f?G}8@839`x&FFRp;aS$BTIDpV<`iPT@S&t{KO#5SE}Gd=Z;G5O9CKkJV^chaV^ zo}0mV=CjE&0pk_lA|D^qV0?VV=Ld<)U+n~%5O*(xp0lW#+2*FLjHg@Z%7m;h$+mrM2c`m fjtBLue;6fJE#zR>_~a@u9Wr>j`njxgN@xNAUm`iW literal 0 HcmV?d00001 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 new file mode 100644 index 0000000000000000000000000000000000000000..10643ae3fafe3484f2282ba442b232a23b8298f3 GIT binary patch literal 382 zcmeAS@N?(olHy`uVBq!ia0vp^9w5xY0wn)GsXhaw6p}rHd>I(3)EF2VS{N990fib~ zFff!FFfhDIU|_JC!N4G1FlSew4N!t9$=lt9;eUJonf*W>XMsm#F#`j)FbFd;%$g$s z6#VAt;uw-~@9mA#yoVfkST1;acCbxaWZ@*Vz-JP7hy!y0gJ##ElX9oUW=;L}Z;O5P zHp>OqGFXH>6dEDKulfrg=DIpCS1~M}dW5akV#DMe3tE%a3>~xi3J%Mix4AIw^23SS zomBX^T^<)WxbQK%JpJLA(kJfn{D%Xh48KN8GCOPGngs@ZydozyHaJ< zf2qan^DXvCGnO_xJrcXlDf@1x<3ztl<{5rLF5It`j+*>5j?&iDVw>q%=y=hitLKt& z+04KyZ>vX9FRh=oc>gOu5V| literal 0 HcmV?d00001 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 new file mode 100644 index 0000000000000000000000000000000000000000..360d3c5ec81099b57d5d547d788d201394b6293d GIT binary patch literal 388 zcmeAS@N?(olHy`uVBq!ia0vp^9w5xY0wn)GsXhaw6p}rHd>I(3)EF2VS{N990fib~ zFff!FFfhDIU|_JC!N4G1FlSew4N!t9$=lt9;eUJonf*W>XMsm#F#`j)FbFd;%$g$s z6#V1q;uw-~@9mA#yoU?~S{{0`1~77dInmqB+^Q<7;Pr@s>EOkG;gJhBKKZ@8_wCJ` z?cwXLN~TP3WP=c2>=%5x<>|24Z<5=r5bj+sezZ+}>KHD&FDrB!>)Mjb@1B32nyS6! zqKNA%Tj#_jzoNxlvMSr1JaY9*8CIHF6$DjJJE)=*6DTzKn?h%ny@Akmen*u}j?NxA z$2lfsTv(GUCvYH<-}JykhrMb|&W#3q%uJRnE3U6m^xtu4PME;COlH=CD2HaXdBOZr zCaceXmKHg-l6h@u|D!8mD_+dWyz#-;%dqd~giAbY<}C?P-n$?b?(mcVqYKOruBICX Tn74fZh697AtDnm{r-UW|>lu)# literal 0 HcmV?d00001 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 new file mode 100644 index 0000000000000000000000000000000000000000..5f00cf8a213a7c2e8f2d6955b05c16a90b80dd60 GIT binary patch literal 1121 zcmeAS@N?(olHy`uVBq!ia0vp^6F``Q1xWh(YZ(J6g=CK)Uj~LMH3o);76yi2K%s^g z3=E|P3=FRl7#OT(FffQ0%-I!a1C(G&@^*J&_}|`tWO>_%)r1c48n{Iv*t)J zFfiZrba4!+xb^mqcScO8%<+$za=}OSdVF)-H+!xryZKIZm!@lA*Cg?iPJuy>SWK5b z%~r@>YH}ijy(HZ0Y*}J~R zP_da$xc17dEnSe-Hsh$sNuK!yJIorRPJUXU;ip)+?@{Y5CNCqWeJXRDW>{6QJ#8$)lYQ=}Qm7m1+zE!^P zk?YvJ|7mll*D`ytt%>f5Pbio#Rhw~pVaGhuK-IsGKeGNnJui{k`xju$$oxm>h@#TXF z7aGs~F5PtNK+Fmo<14?f?J4N_dZFT4#^;THpX%&h_~FfmW$SrE{w`#weNfCDSKpd{ zQSbfldq*m#v5WTD=3jM^{@~51eT(Pq){E+M7c_RK`pI6mln+hpXAWp$asRpKi0Li1 z#TU=addxaS!BM!`XJdHE{^#bG0(Cqeb8VR~w(F$9IVSC#jYqk-dnPaJe)g(%!$d$5_`HM?VwY z?OW7S*cdGHN%)1q+#27$xdQKO&VS~$4a{A5^IwBi+*6~SO0$y=&R+gZ@~H^#I;N|i zt-^O^Z)H56u;aMty$#1xo^Mn?QE=Sq?Ec?NH_s_yT+tY}Olj%Q^ktRPQ)(LLCC-Qr zJ*@e}>~Lb(t_^Y}6BcqDn|izu0&OO$&VbY%$Ed2*R2(vF{TlL&Jz2cku;$s<&>#U9@8^rVr zy|8^=!SvrUX2ZF8`{%HnV%PlT*s#v>r0|FIFuU`cbF8?x9Pa+sck_)8&n3ZI(3)EF2VS{N990fib~ zFff!FFfhDIU|_JC!N4G1FlSew4N!t9$=lt9;eUJonf*W>XMsm#F#`j)FbFd;%$g&? zz`z*k>EaktaqI0ZM?WS-iWm_sJ=o3uk`vGpa!`o^!|4{~ho77Pn}|vu=2r&G7h-^0YrS ztOsVDXP@!;CPTHIc)*17EIpt3BQ!r(HY}sGPgV*QM24T4mH<<%`0_={6 zHGNCJ;t;U^#1odk8j5NbZI+q`js3Ve*YWoDJh&ay#c|GeZ_5MQFhPMk?9nAn|1&1~ ztgyJVR4A+OdS}ZjZa%4n@47l&R_u9FeW+UeK*xus+Ue^rbZj`d?zFRw(uGgi|K1or t+I(3)EF2VS{N990fib~ zFff!FFfhDIU|_JC!N4G1FlSew4N!t9$=lt9;eUJonf*W>XMsm#F#`j)FbFd;%$g&? zz`z*b>EaktaqI1^gSk$I0xTC6GT1$B`NFJP;N8I)tJ3>nr5?KgM{BT&@$9L`CcXcx z^1J%_{chQ+epd!Y76Auz;yYWD9%|$w>$#A zGMhE6TWBaaMRsQEf?Q2rmQsHm^%t|N3=bA+E2>tk3vFS!zIQ^;112AfQnnM1su>Rb z;A=41Cufj&Y}b27wf^<25|6YQr~R;M(A>wB(7m3~$KvtQ{NViF^XxMoZ)Vg!bMHrt zgJX@_0u?*{0Fn8u8r|oaaz4Zg&)?p{W~cSY*!-jN!n^(N+?`G@XDfHQeOyl5>Gg9n kR^-$RZQ$o2+0`N?DESJ96VG(UY&4+8tt1z{&Zr&hdg| zzsMH{l&^;Ry~$HnY3mJ4SI<6!BSaK;<;2IF)eGX=)W+QRuVUoZyPu!bCzQ6AIL@P`m~x{IroEDg6gyvbu5xbMMBmh2|6=dau5$70|-OL zl7TCLypQfwM_JUIr6=hs*g9 zO9QsaK7et`+{#IV(`wqO5AoQ9Kqsx#rtOwW2h=)3oLnXaiPoO8Re)~3ev=>_60=D# zORh5iNqgn85d}-T8c5Jdn|MeD=H<)H>M0)JldXueS%KTko`T){9y&ZWOU)9n>_q4U z(9~g>niW77lLlHWWrU+cl{7! zXj78RB#ztQhv-4>DKf>%2#CkLDr*?YU}|1hFm<@1jEvT02SP0$wpO_UH!5o=KX?a% z1fK%9`2G6$v1}{kAcRKOF32{x0(+7CCx8D3iU=tfBq-p6YO-{y^|ozAx}G<#t;Ejs zsKr_Iij{oyk@wMgTWL9k%t44EJ{Bd|Xy;w`Si3YL-yW*5fjNZX3fqse*%pH^COr3h zNmg`Szb5&-;HUhJ!(mevOAYy3KYMss}^E-k|~kRf>&RG$}jQM0lVKRb6z=_5gB zXx4V6X85i7bpxs_cUS4XQ2Km#SE>EG0Vi1lIwN=VXRD2lrReeMM<{=ueX6;GB&zSX zf~gxiZ#7acRSVXl9#9$DxL9uv*^rql9R9emKb&@a9p2K|Jx8Tm7u*@3dfUVM_$4j6 zsZEU9=O&2ChZ2Kgv7L6JwKkvWv_+6s&XBQ?L0qw_{hHF^sj{a4FzDi+e0F=Hoy z#ho#dY7&c-D>e~|oMHEdN3vYjIc-ksX&y}8%+XgHQ`)wu)L_~uP#Skb;^e}qM6Sy^ zWPgZAzLthmIHNYL$f>&#xgqP&(MPHXkn%;kOdti$e?mO=|Fh^{nBpdGfXi9w3pPD^ Q22#)h>H$yZdM8@?Ke7^WlmGw# literal 0 HcmV?d00001 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 @@ + + + + + + + + + + + + + + + + + + + + + \ 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 @@ + android:layout_above="@+id/create_key_buttons"> - - + style="?android:attr/borderlessButtonStyle" /> + style="?android:attr/borderlessButtonStyle" /> - \ 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 @@ + + + + + + + + + + + + + + + + + + + + + \ 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_passphrase_fragment.xml similarity index 50% rename from OpenKeychain/src/main/res/layout/create_key_input_fragment.xml rename to OpenKeychain/src/main/res/layout/create_key_passphrase_fragment.xml index 2178fcb1f..4b09c6cac 100644 --- a/OpenKeychain/src/main/res/layout/create_key_input_fragment.xml +++ b/OpenKeychain/src/main/res/layout/create_key_passphrase_fragment.xml @@ -1,6 +1,5 @@ @@ -8,7 +7,7 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:fillViewport="true" - android:layout_above="@+id/create_key_button_divider"> + android:layout_above="@+id/create_key_buttons"> - - - - - - - - + android:text="@string/create_key_passphrase_text" /> - - - - + android:drawableLeft="@drawable/ic_chevron_left_grey_24dp" + android:drawablePadding="8dp" + android:gravity="left|center_vertical" + android:clickable="true" + style="?android:attr/borderlessButtonStyle" /> + style="?android:attr/borderlessButtonStyle" /> \ No newline at end of file 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 @@ Vytvoření klíče může chvíli trvat, mezitím si dejte třeba šálek dobré kávy... (3 podklíče, RSA, 4096 bit) (uživatelská konfigurace klíče) - Zadejte své celé jméno, emailovou adresu a zvolte heslo. + Zadejte své celé jméno, emailovou adresu a zvolte heslo. Celé jméno, např. Jan Novák Změnit konfiguraci klíče 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 @@ Einen Schlüssel zu erzeugen braucht eine Weile, trink in der Zeit einen Kaffee... (3 Unterschlüssel, RSA, 4096 Bit) (Benutzerdefinierte Schlüsseleinstellung) - Vollen Namen und Emailadresse angeben und Passwort wählen. + Vollen Namen und Emailadresse angeben und Passwort wählen. Vollständiger Name, z.B. Max Mustermann Schlüsselkonfiguration ändern 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 @@ Crear una clave puede llevar un tiempo, tómese una taza de café entre tanto... (3 subclaves, RSA, 4096 bits) (configuración de clave personalizada) - Introduzca su nombre completo, dirección de correo electrónico, y elija una frase contraseña. + Introduzca su nombre completo, dirección de correo electrónico, y elija una frase contraseña. Nombre completo, ej. Max Mustermann Cambiar configuración de clave 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 @@ Créer une clef peut prendre du temps, prenez donc un café en attendant... (3 sous-clefs, RSA, 4096 bits) (configuration personnalisée de la clef) - Saisissez votre nom complet, votre adresse courriel et choisissez votre phrase de passe. + Saisissez votre nom complet, votre adresse courriel et choisissez votre phrase de passe. Nom complet, p. ex. Marc-Olivier Lagacé Changer la configuration de la clef 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 La creazione di una chiave richiede un po\' di tempo, prendi un caffè nel frattempo... (3 sottochiavi, RSA, 4096 bit) (personalizza la configurazione della chiave) - Inserisci Nome Completo, Email e scegli una Frase di Accesso. + Inserisci Nome Completo, Email e scegli una Frase di Accesso. Nome completo, es: Mario Rossi Cambia configurazione della chiave 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 @@ しばらくの間鍵を生成しています、その間はコーヒーでもどうぞ.... (3副鍵、RSA, 4096 bit) (個別の鍵設定) - フルネーム、Eメールアドレスを入力そしてパスフレーズを選択してください。 + フルネーム、Eメールアドレスを入力そしてパスフレーズを選択してください。 フルネーム、例えば Max Mustermann 鍵の設定変更 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 @@ Een sleutel aanmaken kan even duren, maak intussen een tasje thee klaar… (3 subsleutels, RSA, 4096 bit) (aangepaste sleutelconfiguratie) - Voer je volledige naam en e-mailadres in, en kies een wachtwoord. + Voer je volledige naam en e-mailadres in, en kies een wachtwoord. Volledige naam, bv. Max Mustermann Sleutelconfiguratie wijzigen 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 Tworzenie klucza może zająć trochę czasu... w międzyczasie idź się napij kawy. (3 pod-klucze, RSA, 4096 bit) (niestandardowa konfiguracja kluczy) - Wpisz swoje imię, adres email oraz wybierz hasło. + Wpisz swoje imię, adres email oraz wybierz hasło. Imię i nazwisko, na przykład, Jan Kowalski Zmień klucz konfiguracji 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 @@ Создание ключа займет некоторое время, можете пока выпить чашечку кофе... (3 доп. ключа, RSA, 4096 bit) (произвольная конфигурация ключа) - Укажите полное имя, адрес почты и придумайте надежный пароль. + Укажите полное имя, адрес почты и придумайте надежный пароль. Полное имя, напр. Иван Хлестаков Изменить конфигурацию ключа 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 @@ Прављење кључа може да потраје, попијте кафу у међувремену… (3 поткључа, РСА, 4096 бита) (прилагођена конфигурација кључа) - Унесите пуно име, адресу е-поште и укуцајте лозинку. + Унесите пуно име, адресу е-поште и укуцајте лозинку. Пуно име, нпр. Петар Петровић Промени конфигурацију кључа 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 @@ Att skapa en nyckel kan ta ett tag, drick en kopp kaffe under tiden… (3 undernycklar, RSA, 4096 bit) (anpassad nyckelkonfiguration) - Ange ditt fullständiga namn, e-postadress och välj en lösenordsfras. + Ange ditt fullständiga namn, e-postadress och välj en lösenordsfras. Fullständigt namn, t.ex. Kalle Svensson Ändra nyckelkonfiguration 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 @@ Anahtar oluşturma biraz zaman alabilir, bu sırada bir çay için... (3 alt anahtar, RSA, 4096 bit) (özel anahtar yapılandırması) - Tam isminizi, e-posta adresinizi girin ve bir parola seçin. + Tam isminizi, e-posta adresinizi girin ve bir parola seçin. Tam Ad, örneğin: Max Mustermann Anahtar yapılandırmasını değiştir. 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 @@ Це поле - обов\'язкове Паролі фрази не збігаються Ви ввели наступну сутність: - Введіть ваше повне ім\'я, електронну адреса та оберіть парольну фразу. + Введіть ваше повне ім\'я, електронну адреса та оберіть парольну фразу. Повне ім\'я, наприклад Степан Бандера 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 @@ 必填欄位 口令不相符 建立金鑰可能需要一點時間,來杯咖啡吧… - 輸入你的全名、電子郵件,並選擇一組口令。 + 輸入你的全名、電子郵件,並選擇一組口令。 金鑰 diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml index 784f2825c..8c4db3bac 100644 --- a/OpenKeychain/src/main/res/values/strings.xml +++ b/OpenKeychain/src/main/res/values/strings.xml @@ -627,8 +627,10 @@ "Creating a key may take a while, have a cup of coffee in the meantime…" "(3 subkeys, RSA, 4096 bit)" "(custom key configuration)" - "Enter your full name, email address, and choose a passhrase." - "Full Name, e.g. Max Mustermann" + "Choose a name associated with this key. This can be a full name, e.g., 'John Doe', or a nickname, e.g., 'Johnny'." + "Choose the email address used for encrypted communication." + "Choose a strong passphrase. It protects your key when your device gets stolen." + "Full Name or Nickname" "Change key configuration" From 5f0a468d9a3645c8c209d00d74b13709de154f5b Mon Sep 17 00:00:00 2001 From: Adithya Abraham Philip Date: Tue, 10 Mar 2015 02:48:04 +0530 Subject: [PATCH 5/6] changed default drawable for linked system contact --- OpenKeychain/src/main/res/layout/view_key_fragment.xml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/OpenKeychain/src/main/res/layout/view_key_fragment.xml b/OpenKeychain/src/main/res/layout/view_key_fragment.xml index d8584bca6..59939d8fa 100644 --- a/OpenKeychain/src/main/res/layout/view_key_fragment.xml +++ b/OpenKeychain/src/main/res/layout/view_key_fragment.xml @@ -71,10 +71,10 @@ + android:src="@drawable/ic_person_grey_48dp"/> Date: Mon, 9 Mar 2015 22:09:48 +0100 Subject: [PATCH 6/6] Show passphrase checkbox in create key --- .../ui/CreateKeyPassphraseFragment.java | 19 +++++++++++++++++++ .../layout/create_key_passphrase_fragment.xml | 7 +++++++ OpenKeychain/src/main/res/values/strings.xml | 1 + 3 files changed, 27 insertions(+) diff --git a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyPassphraseFragment.java b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyPassphraseFragment.java index be77d5042..00ac00ff4 100644 --- a/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyPassphraseFragment.java +++ b/OpenKeychain/src/main/java/org/sufficientlysecure/keychain/ui/CreateKeyPassphraseFragment.java @@ -21,10 +21,14 @@ 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.CheckBox; +import android.widget.CompoundButton; import android.widget.EditText; import org.sufficientlysecure.keychain.R; @@ -44,6 +48,7 @@ public class CreateKeyPassphraseFragment extends Fragment { CreateKeyActivity mCreateKeyActivity; PassphraseEditText mPassphraseEdit; EditText mPassphraseEditAgain; + CheckBox mShowPassphrase; View mBackButton; View mNextButton; @@ -102,6 +107,7 @@ public class CreateKeyPassphraseFragment extends Fragment { mPassphraseEdit = (PassphraseEditText) view.findViewById(R.id.create_key_passphrase); mPassphraseEditAgain = (EditText) view.findViewById(R.id.create_key_passphrase_again); + 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); @@ -121,6 +127,19 @@ public class CreateKeyPassphraseFragment extends Fragment { 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; } diff --git a/OpenKeychain/src/main/res/layout/create_key_passphrase_fragment.xml b/OpenKeychain/src/main/res/layout/create_key_passphrase_fragment.xml index 4b09c6cac..48b86765a 100644 --- a/OpenKeychain/src/main/res/layout/create_key_passphrase_fragment.xml +++ b/OpenKeychain/src/main/res/layout/create_key_passphrase_fragment.xml @@ -46,6 +46,13 @@ android:ems="10" android:layout_gravity="center_horizontal" /> + + diff --git a/OpenKeychain/src/main/res/values/strings.xml b/OpenKeychain/src/main/res/values/strings.xml index 8c4db3bac..e9869b0de 100644 --- a/OpenKeychain/src/main/res/values/strings.xml +++ b/OpenKeychain/src/main/res/values/strings.xml @@ -129,6 +129,7 @@ "Passphrase" "Unlocking…" "Repeat Passphrase" + "Show Passphrase" "Algorithm" "File ASCII Armor" "Enable ASCII Armor"