From ca6d8a8a0d9841b93575978f4db06ecf2e410628 Mon Sep 17 00:00:00 2001 From: Jake McGinty Date: Mon, 17 Mar 2014 23:25:09 -0700 Subject: [PATCH] refactor and improve contact selection * unify single and multi contact selection activities * follow android listview design recommendations more closely * add contact photos to selection * change indicator for push to be more obvious * cache circle-cropped bitmaps * dedupe numbers when contact has multiple of same phone number // FREEBIE --- AndroidManifest.xml | 12 +- build.gradle | 1 + res/anim/fade_scale_in.xml | 17 + res/anim/fade_scale_out.xml | 17 + res/anim/slide_from_right.xml | 9 + res/anim/slide_to_right.xml | 9 + res/drawable/textlines.xml | 16 + res/drawable/textlines_dark.xml | 16 + res/layout/conversation_list_fragment.xml | 2 +- ...vity.xml => new_conversation_activity.xml} | 8 +- .../push_contact_selection_activity.xml | 2 +- .../push_contact_selection_list_activity.xml | 11 +- .../push_contact_selection_list_header.xml | 25 ++ .../push_contact_selection_list_item.xml | 45 +-- ...single_contact_selection_list_activity.xml | 26 -- .../single_contact_selection_list_item.xml | 61 --- res/layout/single_recipient_panel.xml | 4 + res/values/attrs.xml | 5 +- res/values/dimens.xml | 3 +- res/values/ids.xml | 5 + res/values/strings.xml | 13 +- res/values/styles.xml | 16 + res/values/themes.xml | 18 +- .../ApplicationPreferencesActivity.java | 34 +- .../securesms/ConversationActivity.java | 2 + .../securesms/ConversationListActivity.java | 4 +- .../securesms/LogSubmitActivity.java | 19 +- ...vity.java => NewConversationActivity.java} | 158 ++++---- .../PushContactSelectionActivity.java | 67 +++- .../PushContactSelectionListFragment.java | 348 +++++------------- .../SingleContactSelectionListFragment.java | 269 -------------- .../securesms/contacts/ContactAccessor.java | 23 +- .../contacts/ContactPhotoFactory.java | 10 +- .../contacts/ContactSelectionListAdapter.java | 254 +++++++++++++ .../contacts/ContactsCursorLoader.java | 49 +++ .../securesms/contacts/ContactsDatabase.java | 211 +++++++++++ .../securesms/recipients/Recipient.java | 17 +- .../recipients/RecipientProvider.java | 13 +- .../securesms/util/BitmapWorkerRunnable.java | 116 ++++++ .../securesms/util/DirectoryHelper.java | 37 ++ .../util/ProgressDialogAsyncTask.java | 34 ++ .../securesms/util/TaggedFutureTask.java | 43 +++ 42 files changed, 1173 insertions(+), 876 deletions(-) create mode 100644 res/anim/fade_scale_in.xml create mode 100644 res/anim/fade_scale_out.xml create mode 100644 res/anim/slide_from_right.xml create mode 100644 res/anim/slide_to_right.xml create mode 100644 res/drawable/textlines.xml create mode 100644 res/drawable/textlines_dark.xml rename res/layout/{single_contact_selection_activity.xml => new_conversation_activity.xml} (62%) create mode 100644 res/layout/push_contact_selection_list_header.xml delete mode 100644 res/layout/single_contact_selection_list_activity.xml delete mode 100644 res/layout/single_contact_selection_list_item.xml create mode 100644 res/values/ids.xml rename src/org/thoughtcrime/securesms/{SingleContactSelectionActivity.java => NewConversationActivity.java} (60%) delete mode 100644 src/org/thoughtcrime/securesms/SingleContactSelectionListFragment.java create mode 100644 src/org/thoughtcrime/securesms/contacts/ContactSelectionListAdapter.java create mode 100644 src/org/thoughtcrime/securesms/contacts/ContactsCursorLoader.java create mode 100644 src/org/thoughtcrime/securesms/contacts/ContactsDatabase.java create mode 100644 src/org/thoughtcrime/securesms/util/BitmapWorkerRunnable.java create mode 100644 src/org/thoughtcrime/securesms/util/ProgressDialogAsyncTask.java create mode 100644 src/org/thoughtcrime/securesms/util/TaggedFutureTask.java diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 5e15d318c5..653670eacb 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -90,7 +90,7 @@ android:windowSoftInputMode="stateUnchanged" android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/> - - + android:label="@string/AndroidManifest__select_contacts" + android:windowSoftInputMode="stateHidden" + android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/> + + + + + \ No newline at end of file diff --git a/res/anim/fade_scale_out.xml b/res/anim/fade_scale_out.xml new file mode 100644 index 0000000000..2ee729071b --- /dev/null +++ b/res/anim/fade_scale_out.xml @@ -0,0 +1,17 @@ + + + + + + \ No newline at end of file diff --git a/res/anim/slide_from_right.xml b/res/anim/slide_from_right.xml new file mode 100644 index 0000000000..7dbec61f34 --- /dev/null +++ b/res/anim/slide_from_right.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/res/anim/slide_to_right.xml b/res/anim/slide_to_right.xml new file mode 100644 index 0000000000..c655fcd12c --- /dev/null +++ b/res/anim/slide_to_right.xml @@ -0,0 +1,9 @@ + + + + + \ No newline at end of file diff --git a/res/drawable/textlines.xml b/res/drawable/textlines.xml new file mode 100644 index 0000000000..648fbb55e1 --- /dev/null +++ b/res/drawable/textlines.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/res/drawable/textlines_dark.xml b/res/drawable/textlines_dark.xml new file mode 100644 index 0000000000..ec0b664031 --- /dev/null +++ b/res/drawable/textlines_dark.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/res/layout/conversation_list_fragment.xml b/res/layout/conversation_list_fragment.xml index 63d228e17f..c358f1f9a1 100644 --- a/res/layout/conversation_list_fragment.xml +++ b/res/layout/conversation_list_fragment.xml @@ -7,7 +7,7 @@ + + + android:name="org.thoughtcrime.securesms.PushContactSelectionListFragment"> \ No newline at end of file diff --git a/res/layout/push_contact_selection_activity.xml b/res/layout/push_contact_selection_activity.xml index 9836f8c47c..e3bf93e1f4 100644 --- a/res/layout/push_contact_selection_activity.xml +++ b/res/layout/push_contact_selection_activity.xml @@ -8,7 +8,7 @@ diff --git a/res/layout/push_contact_selection_list_activity.xml b/res/layout/push_contact_selection_list_activity.xml index ceb2e2d4a0..83f7c01d5d 100644 --- a/res/layout/push_contact_selection_list_activity.xml +++ b/res/layout/push_contact_selection_list_activity.xml @@ -1,13 +1,12 @@ - + + + + + + + + diff --git a/res/layout/push_contact_selection_list_item.xml b/res/layout/push_contact_selection_list_item.xml index 769927bd03..2e3d081bf4 100644 --- a/res/layout/push_contact_selection_list_item.xml +++ b/res/layout/push_contact_selection_list_item.xml @@ -1,65 +1,48 @@ - - - + android:layout_centerVertical="true" + android:layout_marginLeft="10dp" + android:cropToPadding="true" + android:scaleType="centerCrop" + android:contentDescription="@string/SingleContactSelectionActivity_contact_photo" /> + android:fontFamily="sans-serif-light" /> + android:textAppearance="?android:attr/textAppearanceMedium" /> - - - - - - - - - diff --git a/res/layout/single_contact_selection_list_item.xml b/res/layout/single_contact_selection_list_item.xml deleted file mode 100644 index 5afc8cf434..0000000000 --- a/res/layout/single_contact_selection_list_item.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - diff --git a/res/layout/single_recipient_panel.xml b/res/layout/single_recipient_panel.xml index c9334e30a7..aa939874df 100644 --- a/res/layout/single_recipient_panel.xml +++ b/res/layout/single_recipient_panel.xml @@ -13,7 +13,11 @@ android:singleLine="true" android:hint="@string/recipients_panel__to" android:paddingRight="45dip" + android:paddingLeft="15dp" + android:paddingTop="12dp" + android:paddingBottom="12dp" android:textColor="?conversation_editor_text_color" + android:background="?conversation_editor_background" android:layout_width="fill_parent"/> \ No newline at end of file diff --git a/res/values/attrs.xml b/res/values/attrs.xml index 3acaa308ad..f751fe3ea9 100644 --- a/res/values/attrs.xml +++ b/res/values/attrs.xml @@ -21,7 +21,7 @@ - + @@ -45,8 +45,7 @@ - - + diff --git a/res/values/dimens.xml b/res/values/dimens.xml index 411282e6bb..8d0cb4c2ff 100644 --- a/res/values/dimens.xml +++ b/res/values/dimens.xml @@ -3,4 +3,5 @@ 40dip 3dp 2dp - \ No newline at end of file + 50dp + diff --git a/res/values/ids.xml b/res/values/ids.xml new file mode 100644 index 0000000000..422241e3cb --- /dev/null +++ b/res/values/ids.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/res/values/strings.xml b/res/values/strings.xml index 04099249cf..ee8a579d45 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -413,13 +413,14 @@ No contacts. - Finding contacts… + Loading contacts… Type a name to filter… - You are not registered with the push service... + You are not registered with the push service… Updating directory - Updating push directory... + Updating push directory… + Contact Photo Select for @@ -468,6 +469,8 @@ Copied to clipboard Loading logcat… Thanks for your help! + Submitting + Posting logs to pastebin… Would you like to import your existing text messages into TextSecure\'s encrypted database? @@ -602,7 +605,7 @@ Generating keys... - To + Enter a name or number Add member @@ -748,6 +751,8 @@ Select All Unselect All + TEXTSECURE USERS + ALL CONTACTS Finished diff --git a/res/values/styles.xml b/res/values/styles.xml index a1732cd08d..83185c98c0 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -23,6 +23,22 @@ #ff111111 + + + + + +