Added ability to share contacts.

The "contact" option in the attachments tray now brings you through an
optimized contact sharing flow, allowing you to select specific fields
to share. The contact is then presented as a special message type,
allowing you to interact with the card to add the contact to your system
contacts, invite them to signal, initiate a signal message, etc.
This commit is contained in:
Greyson Parrelli
2018-04-26 17:03:54 -07:00
parent 17dbdbd0a9
commit 54dbffaf30
90 changed files with 3628 additions and 195 deletions

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.v7.widget.RecyclerView
android:id="@+id/contact_share_edit_list"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<android.support.design.widget.FloatingActionButton
android:id="@+id/contact_share_edit_send"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end|bottom"
android:src="@drawable/ic_send_push_white_24dp"
android:layout_margin="@dimen/floating_action_button_margin"/>
</FrameLayout>

View File

@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/fragment_container"
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>

View File

@@ -0,0 +1,159 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/root"
android:layout_width="match_parent"
android:layout_height="match_parent">
<android.support.design.widget.AppBarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.design.widget.CollapsingToolbarLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/shared_contact_details_header_background">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="?attr/actionBarSize"
android:orientation="vertical"
android:gravity="center">
<ImageView
android:id="@+id/contact_details_avatar"
android:layout_width="125dp"
android:layout_height="125dp"
android:padding="8dp"
android:transitionName="avatar"
app:layout_collapseMode="parallax"
app:layout_collapseParallaxMultiplier="0.7"/>
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
android:id="@+id/contact_details_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:transitionName="name"
android:gravity="center"
android:textSize="20sp"
tools:text="Peter Parker"/>
<TextView
android:id="@+id/contact_details_number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:transitionName="number"
android:layout_marginBottom="14dp"
android:gravity="center"
tools:text="(610) 555-5555"/>
<Button
android:id="@+id/contact_details_add_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_gravity="center"
style="@style/Button.Primary"
android:text="@string/SharedContactDetailsActivity_add_to_contacts" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/contact_details_invite_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="10dp"
android:layout_gravity="center"
style="@style/Button.Borderless"
android:text="@string/SharedContactDetailsActivity_invite_to_signal"
android:visibility="gone"
tools:visibility="gone"/>
<LinearLayout
android:id="@+id/contact_details_engage_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="horizontal"
style="?attr/buttonBarStyle"
android:visibility="gone"
tools:visibility="visible">
<LinearLayout
android:id="@+id/contact_details_message_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center"
android:padding="10dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="6dp"
android:tint="@color/signal_primary"
android:src="@drawable/message_24dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Signal Message"
android:textColor="@color/signal_primary"/>
</LinearLayout>
<LinearLayout
android:id="@+id/contact_details_call_button"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical"
android:gravity="center"
android:padding="10dp">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="6dp"
android:tint="@color/signal_primary"
android:src="@drawable/phone_24dp"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Signal Call"
android:textColor="@color/signal_primary"/>
</LinearLayout>
</LinearLayout>
</FrameLayout>
</LinearLayout>
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:theme="@style/TextSecure.LightActionBar.DarkText"
android:background="@color/transparent"
app:layout_collapseMode="pin" />
</android.support.design.widget.CollapsingToolbarLayout>
</android.support.design.widget.AppBarLayout>
<android.support.v7.widget.RecyclerView
android:id="@+id/contact_details_fields"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_behavior="@string/appbar_scrolling_view_behavior"/>
</android.support.design.widget.CoordinatorLayout>

View File

@@ -84,6 +84,13 @@
app:message_type="incoming"
tools:visibility="visible"/>
<ViewStub
android:id="@+id/shared_contact_view_stub"
android:layout="@layout/conversation_item_shared_contact"
android:layout_width="@dimen/media_bubble_max_width"
android:layout_height="wrap_content"
android:visibility="gone"/>
<ViewStub
android:id="@+id/image_view_stub"
android:layout="@layout/conversation_item_received_thumbnail"

View File

@@ -47,6 +47,13 @@
app:message_type="outgoing"
tools:visibility="visible"/>
<ViewStub
android:id="@+id/shared_contact_view_stub"
android:layout="@layout/conversation_item_shared_contact"
android:layout_width="@dimen/media_bubble_max_width"
android:layout_height="wrap_content"
android:visibility="gone"/>
<ViewStub
android:id="@+id/image_view_stub"
android:layout_width="@dimen/media_bubble_default_dimens"

View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<org.thoughtcrime.securesms.components.SharedContactView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/shared_contact_view"
android:layout_width="@dimen/media_bubble_default_dimens"
android:layout_height="wrap_content" />

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical">
<org.thoughtcrime.securesms.components.AvatarImageView
android:id="@+id/editable_contact_avatar"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_margin="12dp"/>
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
android:id="@+id/editable_contact_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:textSize="20sp"
android:maxLines="2"
android:ellipsize="end"
tools:text="Peter Parker"/>
</LinearLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="1dp"
android:src="@color/grey_400"/>
<android.support.v7.widget.RecyclerView
android:id="@+id/editable_contact_fields"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>

View File

@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="5dp"
android:paddingBottom="5dp"
android:gravity="center_vertical">
<ImageView
android:id="@+id/contact_field_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_margin="16dp"
android:tint="@color/grey_600"
tools:src="@drawable/ic_call_white_24dp" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
android:id="@+id/contact_field_value"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:ellipsize="end"
tools:text="(610) 867-5309" />
<TextView
android:id="@+id/contact_field_label"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:ellipsize="end"
tools:text="Mobile"/>
</LinearLayout>
<CheckBox
android:id="@+id/contact_field_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="16dp"/>
</LinearLayout>

View File

@@ -0,0 +1,84 @@
<?xml version="1.0" encoding="utf-8"?>
<merge
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:background="@drawable/shared_contact_view_background">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:padding="6dp"
android:gravity="center_vertical">
<ImageView
android:id="@+id/contact_avatar"
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"/>
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:orientation="vertical">
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
android:id="@+id/contact_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="4dp"
android:maxLines="1"
android:ellipsize="end"
android:fontFamily="sans-serif-medium"
android:textColor="@color/signal_primary"
android:textSize="16sp"
tools:text="Peter Parker"/>
<TextView
android:id="@+id/contact_number"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="1"
android:ellipsize="end"
android:textColor="@color/grey_600"
tools:text="(610) 555-5555"/>
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/contact_action_button_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/grey_400_transparent"/>
<TextView
android:id="@+id/contact_action_button"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:padding="10dp"
android:background="?attr/selectableItemBackground"
android:fontFamily="sans-serif-medium"
android:textColor="@color/signal_primary"
tools:text="Add to Contacts"/>
</LinearLayout>
</LinearLayout>
</merge>