Skip to content

Commit

Permalink
refactor and improve contact selection
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
mcginty committed Apr 1, 2014
1 parent c414334 commit ca6d8a8
Show file tree
Hide file tree
Showing 42 changed files with 1,168 additions and 871 deletions.
12 changes: 6 additions & 6 deletions AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
android:windowSoftInputMode="stateUnchanged"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>

<activity android:name=".MmsPreferencesActivity"
<activity android:name=".MmsPreferencesActivity"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>

<activity android:name=".ConversationListActivity"
Expand Down Expand Up @@ -135,15 +135,15 @@
android:windowSoftInputMode="stateHidden"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>

<activity android:name=".SingleContactSelectionActivity"
android:label="@string/AndroidManifest__select_contact"
<activity android:name=".NewConversationActivity"
android:label="@string/AndroidManifest__select_contacts"
android:windowSoftInputMode="stateHidden"
android:configChanges="touchscreen|keyboard|keyboardHidden|orientation|screenLayout|screenSize"/>

<activity android:name=".PushContactSelectionActivity"
android:label="@string/AndroidManifest__select_contacts"
android:windowSoftInputMode="stateHidden"
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"/>

<activity android:name=".AutoInitiateActivity"
android:theme="@style/TextSecure.Light.Dialog"
Expand Down
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ dependencies {
compile 'com.actionbarsherlock:actionbarsherlock:4.4.0@aar'
compile 'com.android.support:support-v4:19.0.1'
compile 'com.google.android.gcm:gcm-client:1.0.2'
compile 'se.emilsjolander:stickylistheaders:2.2.0'

compile project(':library')
}
Expand Down
17 changes: 17 additions & 0 deletions res/anim/fade_scale_in.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>

<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/decelerate_interpolator">
<scale
android:duration="150"
android:fromXScale="0.85"
android:fromYScale="0.85"
android:toXScale="1.0"
android:toYScale="1.0"
android:pivotX="50%"
android:pivotY="50%" />
<alpha
android:duration="150"
android:fromAlpha="0.6"
android:toAlpha="1.0" />
</set>
17 changes: 17 additions & 0 deletions res/anim/fade_scale_out.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>

<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/decelerate_interpolator">
<scale
android:duration="150"
android:fromXScale="1.0"
android:fromYScale="1.0"
android:toXScale="0.85"
android:toYScale="0.85"
android:pivotX="50%"
android:pivotY="50%" />
<alpha
android:duration="150"
android:fromAlpha="1.0"
android:toAlpha="0.6" />
</set>
9 changes: 9 additions & 0 deletions res/anim/slide_from_right.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>

<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/decelerate_interpolator">
<translate
android:duration="150"
android:fromXDelta="100%"
android:toXDelta="0%" />
</set>
9 changes: 9 additions & 0 deletions res/anim/slide_to_right.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>

<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/decelerate_interpolator">
<translate
android:duration="150"
android:fromXDelta="0%"
android:toXDelta="100%" />
</set>
16 changes: 16 additions & 0 deletions res/drawable/textlines.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle">
<solid android:color="#33000000" />
</shape>
</item>

<item android:bottom="1dp">
<shape
android:shape="rectangle">
<solid android:color="@color/white" />
</shape>
</item>

</layer-list>
16 changes: 16 additions & 0 deletions res/drawable/textlines_dark.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
<shape android:shape="rectangle">
<solid android:color="#33ffffff" />
</shape>
</item>

<item android:bottom="1dp">
<shape
android:shape="rectangle">
<solid android:color="@color/black" />
</shape>
</item>

</layer-list>
2 changes: 1 addition & 1 deletion res/layout/conversation_list_fragment.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<ListView android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:drawSelectorOnTop="false"
android:scrollbarStyle="insideOverlay"
android:fadingEdgeLength="16dip"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,16 @@
android:orientation="vertical"
xmlns:android="http://schemas.android.com/apk/res/android">

<org.thoughtcrime.securesms.components.SingleRecipientPanel android:id="@+id/recipients"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />

<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:id="@+id/contact_selection_list_fragment"
android:name="org.thoughtcrime.securesms.SingleContactSelectionListFragment">
android:name="org.thoughtcrime.securesms.PushContactSelectionListFragment">
</fragment>

</LinearLayout>
2 changes: 1 addition & 1 deletion res/layout/push_contact_selection_activity.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<fragment
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:id="@+id/contact_selection_list_fragment"
android:name="org.thoughtcrime.securesms.PushContactSelectionListFragment">
</fragment>
Expand Down
11 changes: 5 additions & 6 deletions res/layout/push_contact_selection_list_activity.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">

<ListView android:id="@android:id/list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:fastScrollEnabled="true" />
<se.emilsjolander.stickylistheaders.StickyListHeadersListView android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent" />

<TextView android:id="@android:id/empty"
android:layout_width="match_parent"
Expand Down
25 changes: 25 additions & 0 deletions res/layout/push_contact_selection_list_header.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?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="32sp"
android:paddingLeft="10dp"
android:paddingRight="25dp">

<TextView android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
android:ellipsize="marquee"
android:layout_centerVertical="true"
android:layout_alignParentLeft="true"
android:textSize="15sp"
android:textColor="?conversation_sent_text_secondary_color"
android:textStyle="bold" />

<View android:layout_width="match_parent"
android:layout_height="3dp"
android:layout_alignParentBottom="true"
android:layout_marginTop="2dp"
android:background="?conversation_received_text_secondary_color" />
</RelativeLayout>
45 changes: 14 additions & 31 deletions res/layout/push_contact_selection_list_item.xml
Original file line number Diff line number Diff line change
@@ -1,65 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_width="match_parent"
android:layout_height="?android:attr/listPreferredItemHeight"
android:paddingRight="25dip">

<View android:id="@+id/push_support_label"
android:layout_height="fill_parent"
android:layout_width="3dip"
android:layout_alignParentLeft="true"
android:background="#ff64a926"
android:visibility="visible"
/>

<TextView android:id="@+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
<ImageView android:id="@+id/contact_photo_image"
android:layout_width="@dimen/contact_selection_photo_size"
android:layout_height="@dimen/contact_selection_photo_size"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:layout_marginBottom="8dip"
android:layout_marginTop="-8dip"
android:layout_marginLeft="14dip"
android:singleLine="true"
android:ellipsize="marquee"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textStyle="bold"
android:visibility = "gone"
/>
android:layout_centerVertical="true"
android:layout_marginLeft="10dp"
android:cropToPadding="true"
android:scaleType="centerCrop"
android:contentDescription="@string/SingleContactSelectionActivity_contact_photo" />

<TextView android:id="@+id/number"
android:visibility = "visible"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="8dip"
android:layout_marginTop="-8dip"
android:layout_marginLeft="14dip"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"
android:singleLine="true"
android:ellipsize="marquee"
android:layout_toRightOf="@id/contact_photo_image"
android:textAppearance="?android:attr/textAppearanceSmall"
android:fontFamily="sans-serif-light"
/>
android:fontFamily="sans-serif-light" />

<TextView android:id="@+id/name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/number"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="1dip"
android:layout_marginLeft="14dip"
android:checkMark="?android:attr/listChoiceIndicatorMultiple"
android:singleLine="true"
android:ellipsize="marquee"
android:layout_toRightOf="@id/contact_photo_image"
android:gravity="center_vertical|left"
android:textAppearance="?android:attr/textAppearanceMedium"
/>
android:textAppearance="?android:attr/textAppearanceMedium" />

<CheckBox
android:id="@+id/check_box"
<CheckBox android:id="@+id/check_box"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
Expand Down
26 changes: 0 additions & 26 deletions res/layout/single_contact_selection_list_activity.xml

This file was deleted.

61 changes: 0 additions & 61 deletions res/layout/single_contact_selection_list_item.xml

This file was deleted.

4 changes: 4 additions & 0 deletions res/layout/single_recipient_panel.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"/>

</RelativeLayout>
Loading

0 comments on commit ca6d8a8

Please sign in to comment.