mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 00:37:47 +00:00
Fix various redesign issues with Android 4.x.
In particular, there were many issues with drawing corners. Unfortunately, there's no pretty way to get masking working on every Android version, so we have to switch back to using custom backgrounds and then using multiple masking methods depending on Android version. Also, I had to remove attr references in drawables. They crash on 4.x.
This commit is contained in:
parent
d3e194aefe
commit
8f551c8b32
@ -5,10 +5,10 @@
|
||||
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="?attr/conversation_input_outline_color" />
|
||||
android:color="@color/core_dark_70" />
|
||||
|
||||
<solid
|
||||
android:color="?attr/conversation_input_background_color" />
|
||||
android:color="@color/core_dark_85" />
|
||||
|
||||
<corners
|
||||
android:radius="20dp" />
|
16
res/drawable/compose_background_light.xml
Normal file
16
res/drawable/compose_background_light.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<stroke
|
||||
android:width="1dp"
|
||||
android:color="@color/core_light_10" />
|
||||
|
||||
<solid
|
||||
android:color="@color/core_light_02" />
|
||||
|
||||
<corners
|
||||
android:radius="20dp" />
|
||||
|
||||
</shape>
|
13
res/drawable/message_bubble_background_received_alone.xml
Normal file
13
res/drawable/message_bubble_background_received_alone.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:top="2px"
|
||||
android:bottom="2px">
|
||||
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="@dimen/message_corner_radius"/>
|
||||
<solid android:color="@color/white" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
17
res/drawable/message_bubble_background_received_end.xml
Normal file
17
res/drawable/message_bubble_background_received_end.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:top="2px"
|
||||
android:bottom="2px">
|
||||
|
||||
<shape android:shape="rectangle">
|
||||
<corners
|
||||
android:topLeftRadius="@dimen/message_corner_collapse_radius"
|
||||
android:topRightRadius="@dimen/message_corner_radius"
|
||||
android:bottomRightRadius="@dimen/message_corner_radius"
|
||||
android:bottomLeftRadius="@dimen/message_corner_radius" />
|
||||
<solid android:color="@color/white" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
17
res/drawable/message_bubble_background_received_middle.xml
Normal file
17
res/drawable/message_bubble_background_received_middle.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:top="2px"
|
||||
android:bottom="2px">
|
||||
|
||||
<shape android:shape="rectangle">
|
||||
<corners
|
||||
android:topLeftRadius="@dimen/message_corner_collapse_radius"
|
||||
android:topRightRadius="@dimen/message_corner_radius"
|
||||
android:bottomRightRadius="@dimen/message_corner_radius"
|
||||
android:bottomLeftRadius="@dimen/message_corner_collapse_radius" />
|
||||
<solid android:color="@color/white" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
17
res/drawable/message_bubble_background_received_start.xml
Normal file
17
res/drawable/message_bubble_background_received_start.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:top="2px"
|
||||
android:bottom="2px">
|
||||
|
||||
<shape android:shape="rectangle">
|
||||
<corners
|
||||
android:topLeftRadius="@dimen/message_corner_radius"
|
||||
android:topRightRadius="@dimen/message_corner_radius"
|
||||
android:bottomRightRadius="@dimen/message_corner_radius"
|
||||
android:bottomLeftRadius="@dimen/message_corner_collapse_radius" />
|
||||
<solid android:color="@color/white" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
13
res/drawable/message_bubble_background_sent_alone.xml
Normal file
13
res/drawable/message_bubble_background_sent_alone.xml
Normal file
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:top="2px"
|
||||
android:bottom="2px">
|
||||
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="@dimen/message_corner_radius"/>
|
||||
<solid android:color="@color/white" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
17
res/drawable/message_bubble_background_sent_end.xml
Normal file
17
res/drawable/message_bubble_background_sent_end.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:top="2px"
|
||||
android:bottom="2px">
|
||||
|
||||
<shape android:shape="rectangle">
|
||||
<corners
|
||||
android:topLeftRadius="@dimen/message_corner_radius"
|
||||
android:topRightRadius="@dimen/message_corner_collapse_radius"
|
||||
android:bottomRightRadius="@dimen/message_corner_radius"
|
||||
android:bottomLeftRadius="@dimen/message_corner_radius" />
|
||||
<solid android:color="@color/white" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
17
res/drawable/message_bubble_background_sent_middle.xml
Normal file
17
res/drawable/message_bubble_background_sent_middle.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:top="2px"
|
||||
android:bottom="2px">
|
||||
|
||||
<shape android:shape="rectangle">
|
||||
<corners
|
||||
android:topLeftRadius="@dimen/message_corner_radius"
|
||||
android:topRightRadius="@dimen/message_corner_collapse_radius"
|
||||
android:bottomRightRadius="@dimen/message_corner_collapse_radius"
|
||||
android:bottomLeftRadius="@dimen/message_corner_radius" />
|
||||
<solid android:color="@color/white" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
17
res/drawable/message_bubble_background_sent_start.xml
Normal file
17
res/drawable/message_bubble_background_sent_start.xml
Normal file
@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:top="2px"
|
||||
android:bottom="2px">
|
||||
|
||||
<shape android:shape="rectangle">
|
||||
<corners
|
||||
android:topLeftRadius="@dimen/message_corner_radius"
|
||||
android:topRightRadius="@dimen/message_corner_radius"
|
||||
android:bottomRightRadius="@dimen/message_corner_collapse_radius"
|
||||
android:bottomLeftRadius="@dimen/message_corner_radius" />
|
||||
<solid android:color="@color/white" />
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
@ -4,5 +4,5 @@
|
||||
android:shape="rectangle">
|
||||
|
||||
<corners android:radius="4dp" />
|
||||
<solid android:color="?attr/conversation_item_sticky_date_background_color" />
|
||||
<solid android:color="@color/core_dark_85" />
|
||||
</shape>
|
8
res/drawable/sticky_date_header_background_light.xml
Normal file
8
res/drawable/sticky_date_header_background_light.xml
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
|
||||
<corners android:radius="4dp" />
|
||||
<solid android:color="@color/core_light_02" />
|
||||
</shape>
|
@ -28,7 +28,7 @@
|
||||
style="@style/Signal.Text.Caption"
|
||||
android:textColor="?attr/conversation_item_sticky_date_text_color"
|
||||
android:textAllCaps="true"
|
||||
android:background="@drawable/sticky_date_header_background"
|
||||
android:background="?attr/conversation_item_sticky_date_background"
|
||||
android:elevation="9dp"
|
||||
android:visibility="gone"
|
||||
tools:text="March 1, 2015" />
|
||||
|
@ -27,7 +27,7 @@
|
||||
android:id="@+id/compose_bubble"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/compose_background"
|
||||
android:background="?attr/conversation_input_background"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:orientation="vertical">
|
||||
|
@ -20,6 +20,8 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/conversation_individual_right_gutter"
|
||||
android:layout_marginEnd="@dimen/conversation_individual_right_gutter"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingStart="8dp"
|
||||
android:clipToPadding="false"
|
||||
android:clipChildren="false">
|
||||
|
||||
@ -28,31 +30,28 @@
|
||||
android:foreground="@drawable/contact_photo_background"
|
||||
android:layout_width="36dp"
|
||||
android:layout_height="36dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginBottom="6dp"
|
||||
android:layout_alignParentLeft="true"
|
||||
android:layout_alignParentStart="true"
|
||||
android:layout_alignParentBottom="true"
|
||||
android:cropToPadding="true"
|
||||
android:contentDescription="@string/conversation_item_received__contact_photo_description" />
|
||||
|
||||
<org.thoughtcrime.securesms.components.CornerMaskingView
|
||||
<LinearLayout
|
||||
android:id="@+id/body_bubble"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/message_bubble_edge_margin"
|
||||
android:layout_marginEnd="@dimen/message_bubble_edge_margin"
|
||||
android:background="@color/white"
|
||||
android:clipToPadding="false"
|
||||
android:clipChildren="false"
|
||||
tools:backgroundTint="@color/conversation_blue">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_toRightOf="@id/contact_photo"
|
||||
android:layout_toEndOf="@id/contact_photo"
|
||||
android:orientation="vertical"
|
||||
android:clipToPadding="false"
|
||||
android:clipChildren="false">
|
||||
android:clipChildren="false"
|
||||
android:background="@color/white"
|
||||
tools:backgroundTint="@color/conversation_blue">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/group_sender_holder"
|
||||
@ -169,9 +168,7 @@
|
||||
android:clipToPadding="false"
|
||||
app:footer_color="?conversation_item_received_text_secondary_color"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</org.thoughtcrime.securesms.components.CornerMaskingView>
|
||||
</LinearLayout>
|
||||
|
||||
<org.thoughtcrime.securesms.components.AlertView
|
||||
android:id="@+id/indicators_parent"
|
||||
|
@ -23,121 +23,113 @@
|
||||
android:clipToPadding="false"
|
||||
android:clipChildren="false">
|
||||
|
||||
<org.thoughtcrime.securesms.components.CornerMaskingView
|
||||
<LinearLayout
|
||||
android:id="@+id/body_bubble"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_toLeftOf="@+id/indicators_parent"
|
||||
android:layout_toStartOf="@+id/indicators_parent"
|
||||
android:layout_alignWithParentIfMissing="true"
|
||||
android:layout_marginLeft="@dimen/message_bubble_edge_margin"
|
||||
android:layout_marginStart="@dimen/message_bubble_edge_margin"
|
||||
android:background="@color/white"
|
||||
android:clipToPadding="false"
|
||||
android:clipChildren="false"
|
||||
android:background="@color/white"
|
||||
tools:backgroundTint="@color/core_light_10">
|
||||
|
||||
<LinearLayout
|
||||
<org.thoughtcrime.securesms.components.QuoteView
|
||||
android:id="@+id/quote_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:layout_marginTop="@dimen/message_bubble_top_padding"
|
||||
android:layout_marginLeft="6dp"
|
||||
android:layout_marginRight="6dp"
|
||||
android:visibility="gone"
|
||||
app:message_type="outgoing"
|
||||
app:quote_colorPrimary="?attr/conversation_item_quote_text_color"
|
||||
app:quote_colorSecondary="?attr/conversation_item_quote_text_color"
|
||||
tools:visibility="visible"/>
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/shared_contact_view_stub"
|
||||
android:layout="@layout/conversation_item_sent_shared_contact"
|
||||
android:layout_width="@dimen/media_bubble_default_dimens"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/message_bubble_top_padding"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/image_view_stub"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout="@layout/conversation_item_sent_thumbnail" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/audio_view_stub"
|
||||
android:layout="@layout/conversation_item_sent_audio"
|
||||
android:layout_width="210dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/message_bubble_top_padding"
|
||||
android:layout_marginBottom="@dimen/message_bubble_collapsed_footer_padding"
|
||||
android:layout_marginLeft="@dimen/message_bubble_horizontal_padding"
|
||||
android:layout_marginRight="@dimen/message_bubble_horizontal_padding" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/document_view_stub"
|
||||
android:layout="@layout/conversation_item_sent_document"
|
||||
android:layout_width="210dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/message_bubble_top_padding"
|
||||
android:layout_marginBottom="@dimen/message_bubble_collapsed_footer_padding"
|
||||
android:layout_marginLeft="@dimen/message_bubble_horizontal_padding"
|
||||
android:layout_marginRight="@dimen/message_bubble_horizontal_padding" />
|
||||
|
||||
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||
android:id="@+id/conversation_item_body"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/message_bubble_top_padding"
|
||||
android:layout_marginLeft="@dimen/message_bubble_horizontal_padding"
|
||||
android:layout_marginRight="@dimen/message_bubble_horizontal_padding"
|
||||
android:layout_marginBottom="@dimen/message_bubble_collapsed_footer_padding"
|
||||
style="@style/Signal.Text.Body"
|
||||
android:textColor="?conversation_item_sent_text_primary_color"
|
||||
android:textColorLink="?conversation_item_sent_text_primary_color"
|
||||
app:scaleEmojis="true"
|
||||
tools:text="Mango pickle lorem ipsum"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/group_sender_holder"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/group_message_sender"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/group_message_sender_profile"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone" />
|
||||
|
||||
<org.thoughtcrime.securesms.components.ConversationItemFooter
|
||||
android:id="@+id/conversation_item_footer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="-4dp"
|
||||
android:layout_marginLeft="@dimen/message_bubble_horizontal_padding"
|
||||
android:layout_marginRight="@dimen/message_bubble_horizontal_padding"
|
||||
android:layout_marginBottom="@dimen/message_bubble_bottom_padding"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
android:clipChildren="false">
|
||||
app:footer_color="?conversation_item_sent_text_secondary_color"/>
|
||||
|
||||
<org.thoughtcrime.securesms.components.QuoteView
|
||||
android:id="@+id/quote_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/message_bubble_top_padding"
|
||||
android:layout_marginLeft="6dp"
|
||||
android:layout_marginRight="6dp"
|
||||
android:visibility="gone"
|
||||
app:message_type="outgoing"
|
||||
app:quote_colorPrimary="?attr/conversation_item_quote_text_color"
|
||||
app:quote_colorSecondary="?attr/conversation_item_quote_text_color"
|
||||
tools:visibility="visible"/>
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/shared_contact_view_stub"
|
||||
android:layout="@layout/conversation_item_sent_shared_contact"
|
||||
android:layout_width="@dimen/media_bubble_default_dimens"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/message_bubble_top_padding"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/image_view_stub"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout="@layout/conversation_item_sent_thumbnail" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/audio_view_stub"
|
||||
android:layout="@layout/conversation_item_sent_audio"
|
||||
android:layout_width="210dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/message_bubble_top_padding"
|
||||
android:layout_marginBottom="@dimen/message_bubble_collapsed_footer_padding"
|
||||
android:layout_marginLeft="@dimen/message_bubble_horizontal_padding"
|
||||
android:layout_marginRight="@dimen/message_bubble_horizontal_padding" />
|
||||
|
||||
<ViewStub
|
||||
android:id="@+id/document_view_stub"
|
||||
android:layout="@layout/conversation_item_sent_document"
|
||||
android:layout_width="210dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/message_bubble_top_padding"
|
||||
android:layout_marginBottom="@dimen/message_bubble_collapsed_footer_padding"
|
||||
android:layout_marginLeft="@dimen/message_bubble_horizontal_padding"
|
||||
android:layout_marginRight="@dimen/message_bubble_horizontal_padding" />
|
||||
|
||||
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||
android:id="@+id/conversation_item_body"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/message_bubble_top_padding"
|
||||
android:layout_marginLeft="@dimen/message_bubble_horizontal_padding"
|
||||
android:layout_marginRight="@dimen/message_bubble_horizontal_padding"
|
||||
android:layout_marginBottom="@dimen/message_bubble_collapsed_footer_padding"
|
||||
style="@style/Signal.Text.Body"
|
||||
android:textColor="?conversation_item_sent_text_primary_color"
|
||||
android:textColorLink="?conversation_item_sent_text_primary_color"
|
||||
app:scaleEmojis="true"
|
||||
tools:text="Mango pickle lorem ipsum"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/group_sender_holder"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/group_message_sender"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/group_message_sender_profile"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:visibility="gone" />
|
||||
|
||||
<org.thoughtcrime.securesms.components.ConversationItemFooter
|
||||
android:id="@+id/conversation_item_footer"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="-4dp"
|
||||
android:layout_marginLeft="@dimen/message_bubble_horizontal_padding"
|
||||
android:layout_marginRight="@dimen/message_bubble_horizontal_padding"
|
||||
android:layout_marginBottom="@dimen/message_bubble_bottom_padding"
|
||||
android:clipChildren="false"
|
||||
android:clipToPadding="false"
|
||||
app:footer_color="?conversation_item_sent_text_secondary_color"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</org.thoughtcrime.securesms.components.CornerMaskingView>
|
||||
</LinearLayout>
|
||||
|
||||
<org.thoughtcrime.securesms.components.AlertView
|
||||
android:id="@+id/indicators_parent"
|
||||
|
@ -11,154 +11,147 @@
|
||||
android:layout_margin="3dp"
|
||||
tools:visibility="visible">
|
||||
|
||||
<org.thoughtcrime.securesms.components.CornerMaskingView
|
||||
<LinearLayout
|
||||
android:id="@+id/quote_root"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/quote_bar"
|
||||
android:layout_width="@dimen/quote_corner_radius_bottom"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@color/white"
|
||||
tools:tint="@color/purple_400" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/quote_background"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="1">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/quote_bar"
|
||||
android:layout_width="@dimen/quote_corner_radius_bottom"
|
||||
android:layout_height="match_parent"
|
||||
android:src="@color/white"
|
||||
tools:tint="@color/purple_400" />
|
||||
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||
android:id="@+id/quote_author"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/Signal.Text.Caption"
|
||||
android:textColor="@color/core_black"
|
||||
android:textStyle="bold"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
tools:text="Peter Parker" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:id="@+id/quote_attachment_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginEnd="8dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginBottom="8dp"
|
||||
android:orientation="vertical"
|
||||
android:layout_weight="1">
|
||||
android:layout_marginBottom="2dp"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||
android:id="@+id/quote_author"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/Signal.Text.Caption"
|
||||
android:textColor="@color/core_black"
|
||||
android:textStyle="bold"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
tools:text="Peter Parker" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/quote_attachment_container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="2dp"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_vertical"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="27dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginRight="4dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:paddingLeft="-4dp"
|
||||
android:paddingStart="-4dp"
|
||||
android:src="?attr/attachment_document_icon_small" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/quote_attachment_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/Signal.Text.Body"
|
||||
android:textColor="@color/core_light_90"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
tools:text="The-Amazing-Spider-Man.cba" />
|
||||
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:layout_width="27dp"
|
||||
android:layout_height="35dp"
|
||||
android:layout_marginRight="4dp"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:paddingLeft="-4dp"
|
||||
android:paddingStart="-4dp"
|
||||
android:src="?attr/attachment_document_icon_small" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/media_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="8dp"
|
||||
style="@style/Signal.Text.Caption"
|
||||
android:textColor="@color/core_light_90"
|
||||
android:paddingTop="4dp"
|
||||
android:textStyle="italic"
|
||||
android:visibility="gone"
|
||||
tools:text="Photo"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||
android:id="@+id/quote_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:id="@+id/quote_attachment_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/Signal.Text.Body"
|
||||
android:textColor="@color/core_light_90"
|
||||
android:maxLines="1"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
tools:text="With great power comes great responsibility."
|
||||
tools:visibility="visible" />
|
||||
|
||||
tools:text="The-Amazing-Spider-Man.cba" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<FrameLayout
|
||||
<TextView
|
||||
android:id="@+id/media_type"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/quote_thumbnail"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
android:visibility="gone"
|
||||
tools:visibility="gone" />
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="8dp"
|
||||
style="@style/Signal.Text.Caption"
|
||||
android:textColor="@color/core_light_90"
|
||||
android:paddingTop="4dp"
|
||||
android:textStyle="italic"
|
||||
android:visibility="gone"
|
||||
tools:text="Photo"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/quote_video_overlay"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:background="@drawable/circle_white"
|
||||
android:layout_gravity="center"
|
||||
android:longClickable="false"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
<org.thoughtcrime.securesms.components.emoji.EmojiTextView
|
||||
android:id="@+id/quote_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
style="@style/Signal.Text.Body"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="2"
|
||||
tools:text="With great power comes great responsibility."
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageView
|
||||
android:layout_width="13dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_marginLeft="11dp"
|
||||
android:layout_marginStart="11dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:tint="@color/core_blue"
|
||||
android:scaleType="fitXY"
|
||||
app:srcCompat="@drawable/triangle_right" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/quote_dismiss"
|
||||
<FrameLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_marginRight="4dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_gravity="top|end"
|
||||
android:background="@drawable/dismiss_background"
|
||||
android:src="@drawable/ic_close_white_18dp"
|
||||
android:tint="@color/gray70" />
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</org.thoughtcrime.securesms.components.CornerMaskingView>
|
||||
<ImageView
|
||||
android:id="@+id/quote_thumbnail"
|
||||
android:layout_width="60dp"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
android:visibility="gone"
|
||||
tools:visibility="gone" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/quote_video_overlay"
|
||||
android:layout_width="32dp"
|
||||
android:layout_height="32dp"
|
||||
android:background="@drawable/circle_white"
|
||||
android:layout_gravity="center"
|
||||
android:longClickable="false"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible">
|
||||
|
||||
<ImageView
|
||||
android:layout_width="13dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_marginLeft="11dp"
|
||||
android:layout_marginStart="11dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:tint="@color/core_blue"
|
||||
android:scaleType="fitXY"
|
||||
app:srcCompat="@drawable/triangle_right" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/quote_dismiss"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="4dp"
|
||||
android:layout_marginRight="4dp"
|
||||
android:layout_marginTop="4dp"
|
||||
android:layout_gravity="top|end"
|
||||
android:background="@drawable/dismiss_background"
|
||||
android:src="@drawable/ic_close_white_18dp"
|
||||
android:tint="@color/gray70" />
|
||||
|
||||
</merge>
|
@ -28,8 +28,7 @@
|
||||
<attr name="conversation_background" format="reference|color"/>
|
||||
<attr name="conversation_editor_background" format="reference|color"/>
|
||||
<attr name="conversation_editor_text_color" format="reference|color"/>
|
||||
<attr name="conversation_input_background_color" format="color"/>
|
||||
<attr name="conversation_input_outline_color" format="color"/>
|
||||
<attr name="conversation_input_background" format="reference"/>
|
||||
<attr name="conversation_transport_sms_indicator" format="reference"/>
|
||||
<attr name="conversation_transport_push_indicator" format="reference"/>
|
||||
<attr name="conversation_transport_popup_background" format="reference"/>
|
||||
@ -77,7 +76,7 @@
|
||||
<attr name="conversation_item_last_seen_line_color" format="reference"/>
|
||||
<attr name="conversation_item_date_line_color" format="reference"/>
|
||||
<attr name="conversation_item_quote_text_color" format="reference"/>
|
||||
<attr name="conversation_item_sticky_date_background_color" format="color" />
|
||||
<attr name="conversation_item_sticky_date_background" format="reference" />
|
||||
<attr name="conversation_item_sticky_date_text_color" format="color" />
|
||||
<attr name="conversation_item_delivery_icon_color" format="color" />
|
||||
|
||||
|
@ -146,8 +146,7 @@
|
||||
<item name="conversation_background">@color/core_white</item>
|
||||
<item name="conversation_editor_background">#22000000</item>
|
||||
<item name="conversation_editor_text_color">#ff111111</item>
|
||||
<item name="conversation_input_background_color">@color/core_light_02</item>
|
||||
<item name="conversation_input_outline_color">@color/core_light_10</item>
|
||||
<item name="conversation_input_background">@drawable/compose_background_light</item>
|
||||
<item name="conversation_transport_sms_indicator">@drawable/ic_send_sms_insecure</item>
|
||||
<item name="conversation_transport_push_indicator">@drawable/ic_send_push</item>
|
||||
<item name="conversation_transport_popup_background">@color/white</item>
|
||||
@ -195,7 +194,7 @@
|
||||
<item name="conversation_item_last_seen_line_color">@color/core_light_60</item>
|
||||
<item name="conversation_item_date_line_color">@color/core_light_45</item>
|
||||
<item name="conversation_item_quote_text_color">@color/core_light_90</item>
|
||||
<item name="conversation_item_sticky_date_background_color">@color/core_light_02</item>
|
||||
<item name="conversation_item_sticky_date_background">@drawable/sticky_date_header_background_light</item>
|
||||
<item name="conversation_item_sticky_date_text_color">@color/core_light_60</item>
|
||||
<item name="conversation_item_delivery_icon_color">@color/core_light_45</item>
|
||||
|
||||
@ -295,7 +294,7 @@
|
||||
<item name="conversation_item_last_seen_line_color">@color/core_dark_30</item>
|
||||
<item name="conversation_item_date_line_color">@color/core_dark_55</item>
|
||||
<item name="conversation_item_quote_text_color">@color/core_dark_05</item>
|
||||
<item name="conversation_item_sticky_date_background_color">@color/core_dark_85</item>
|
||||
<item name="conversation_item_sticky_date_background">@drawable/sticky_date_header_background_dark</item>
|
||||
<item name="conversation_item_sticky_date_text_color">@color/core_dark_30</item>
|
||||
<item name="conversation_item_delivery_icon_color">@color/core_dark_60</item>
|
||||
|
||||
@ -319,8 +318,7 @@
|
||||
<item name="conversation_background">@color/black</item>
|
||||
<item name="conversation_editor_background">#22ffffff</item>
|
||||
<item name="conversation_editor_text_color">#ffeeeeee</item>
|
||||
<item name="conversation_input_background_color">@color/core_dark_85</item>
|
||||
<item name="conversation_input_outline_color">@color/core_dark_70</item>
|
||||
<item name="conversation_input_background">@drawable/compose_background_dark</item>
|
||||
<item name="conversation_transport_sms_indicator">@drawable/ic_send_sms_insecure_dark</item>
|
||||
<item name="conversation_transport_push_indicator">@drawable/ic_send_push</item>
|
||||
<item name="conversation_transport_popup_background">@color/black</item>
|
||||
|
@ -110,16 +110,16 @@ public class ConversationItem extends LinearLayout
|
||||
private Recipient recipient;
|
||||
private GlideRequests glideRequests;
|
||||
|
||||
protected CornerMaskingView bodyBubble;
|
||||
private QuoteView quoteView;
|
||||
private TextView bodyText;
|
||||
private ConversationItemFooter footer;
|
||||
private TextView groupSender;
|
||||
private TextView groupSenderProfileName;
|
||||
private View groupSenderHolder;
|
||||
private AvatarImageView contactPhoto;
|
||||
private AlertView alertView;
|
||||
private ViewGroup container;
|
||||
protected ViewGroup bodyBubble;
|
||||
private QuoteView quoteView;
|
||||
private TextView bodyText;
|
||||
private ConversationItemFooter footer;
|
||||
private TextView groupSender;
|
||||
private TextView groupSenderProfileName;
|
||||
private View groupSenderHolder;
|
||||
private AvatarImageView contactPhoto;
|
||||
private AlertView alertView;
|
||||
private ViewGroup container;
|
||||
|
||||
private @NonNull Set<MessageRecord> batchSelected = new HashSet<>();
|
||||
private @NonNull Recipient conversationRecipient;
|
||||
@ -203,7 +203,9 @@ public class ConversationItem extends LinearLayout
|
||||
this.recipient.addListener(this);
|
||||
this.conversationRecipient.addListener(this);
|
||||
|
||||
setMediaAttributes(messageRecord, nextMessageRecord, previousMessageRecord, conversationRecipient, groupThread);
|
||||
setGutterSizes(messageRecord, groupThread);
|
||||
setMessageShape(messageRecord, previousMessageRecord, nextMessageRecord, groupThread);
|
||||
setMediaAttributes(messageRecord, previousMessageRecord, nextMessageRecord, conversationRecipient, groupThread);
|
||||
setInteractionState(messageRecord, pulseHighlight);
|
||||
setBodyText(messageRecord);
|
||||
setBubbleState(messageRecord);
|
||||
@ -213,9 +215,7 @@ public class ConversationItem extends LinearLayout
|
||||
setAuthor(messageRecord, previousMessageRecord, nextMessageRecord, groupThread);
|
||||
setQuote(messageRecord, previousMessageRecord, nextMessageRecord, groupThread);
|
||||
setMessageSpacing(context, messageRecord, nextMessageRecord);
|
||||
setGutterSizes(messageRecord, groupThread);
|
||||
setFooter(messageRecord, nextMessageRecord, locale, groupThread);
|
||||
setMessageShape(messageRecord, previousMessageRecord, nextMessageRecord, groupThread);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -414,6 +414,8 @@ public class ConversationItem extends LinearLayout
|
||||
sharedContactStub.get().setOnClickListener(sharedContactClickListener);
|
||||
sharedContactStub.get().setOnLongClickListener(passthroughClickListener);
|
||||
|
||||
setSharedContactCorners(messageRecord, previousRecord, nextRecord, isGroupThread);
|
||||
|
||||
ViewUtil.updateLayoutParams(bodyText, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
footer.setVisibility(GONE);
|
||||
} else if (hasAudio(messageRecord)) {
|
||||
@ -464,7 +466,7 @@ public class ConversationItem extends LinearLayout
|
||||
mediaThumbnailStub.get().setOnClickListener(passthroughClickListener);
|
||||
mediaThumbnailStub.get().showShade(TextUtils.isEmpty(messageRecord.getDisplayBody()));
|
||||
|
||||
setThumbnailOutlineCorners(messageRecord, nextRecord, previousRecord, isGroupThread);
|
||||
setThumbnailOutlineCorners(messageRecord, previousRecord, nextRecord, isGroupThread);
|
||||
|
||||
ViewUtil.updateLayoutParams(bodyText, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
footer.setVisibility(VISIBLE);
|
||||
@ -537,6 +539,18 @@ public class ConversationItem extends LinearLayout
|
||||
mediaThumbnailStub.get().setOutlineCorners(topLeft, topRight, bottomRight, bottomLeft);
|
||||
}
|
||||
|
||||
private void setSharedContactCorners(@NonNull MessageRecord current, @NonNull Optional<MessageRecord> previous, @NonNull Optional<MessageRecord> next, boolean isGroupThread) {
|
||||
if (isSingularMessage(current, previous, next, isGroupThread) || isEndOfMessageCluster(current, next, isGroupThread)) {
|
||||
sharedContactStub.get().setSingularStyle();
|
||||
} else {
|
||||
if (current.isOutgoing()) {
|
||||
sharedContactStub.get().setClusteredOutgoingStyle();
|
||||
} else {
|
||||
sharedContactStub.get().setClusteredIncomingStyle();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void setContactPhoto(@NonNull Recipient recipient) {
|
||||
if (contactPhoto == null) return;
|
||||
|
||||
@ -621,18 +635,10 @@ public class ConversationItem extends LinearLayout
|
||||
}
|
||||
|
||||
private void setGutterSizes(@NonNull MessageRecord current, boolean isGroupThread) {
|
||||
if (isGroupThread) {
|
||||
if (current.isOutgoing()) {
|
||||
ViewUtil.setLeftMargin(container, readDimen(R.dimen.conversation_group_left_gutter));
|
||||
} else {
|
||||
ViewUtil.setLeftMargin(bodyBubble, readDimen(R.dimen.conversation_group_left_gutter));
|
||||
}
|
||||
} else {
|
||||
if (current.isOutgoing()) {
|
||||
ViewUtil.setLeftMargin(container, readDimen(R.dimen.conversation_individual_left_gutter));
|
||||
} else {
|
||||
ViewUtil.setLeftMargin(bodyBubble, readDimen(R.dimen.conversation_individual_left_gutter));
|
||||
}
|
||||
if (isGroupThread && current.isOutgoing()) {
|
||||
ViewUtil.setLeftMargin(container, readDimen(R.dimen.conversation_group_left_gutter));
|
||||
} else if (current.isOutgoing()) {
|
||||
ViewUtil.setLeftMargin(container, readDimen(R.dimen.conversation_individual_left_gutter));
|
||||
}
|
||||
}
|
||||
|
||||
@ -698,7 +704,7 @@ public class ConversationItem extends LinearLayout
|
||||
if (!next.isPresent() || next.get().isUpdate() || !current.getRecipient().getAddress().equals(next.get().getRecipient().getAddress())) {
|
||||
contactPhoto.setVisibility(VISIBLE);
|
||||
} else {
|
||||
contactPhoto.setVisibility(GONE);
|
||||
contactPhoto.setVisibility(INVISIBLE);
|
||||
}
|
||||
} else {
|
||||
groupSenderHolder.setVisibility(GONE);
|
||||
@ -710,45 +716,22 @@ public class ConversationItem extends LinearLayout
|
||||
}
|
||||
|
||||
private void setMessageShape(@NonNull MessageRecord current, @NonNull Optional<MessageRecord> previous, @NonNull Optional<MessageRecord> next, boolean isGroupThread) {
|
||||
int background;
|
||||
if (isSingularMessage(current, previous, next, isGroupThread)) {
|
||||
bodyBubble.setRadius(readDimen(R.dimen.message_corner_radius));
|
||||
background = current.isOutgoing() ? R.drawable.message_bubble_background_sent_alone
|
||||
: R.drawable.message_bubble_background_received_alone;
|
||||
} else if (isStartOfMessageCluster(current, previous, isGroupThread)) {
|
||||
if (current.isOutgoing()) {
|
||||
bodyBubble.setRadii(readDimen(R.dimen.message_corner_radius),
|
||||
readDimen(R.dimen.message_corner_radius),
|
||||
readDimen(R.dimen.message_corner_collapse_radius),
|
||||
readDimen(R.dimen.message_corner_radius));
|
||||
} else {
|
||||
bodyBubble.setRadii(readDimen(R.dimen.message_corner_radius),
|
||||
readDimen(R.dimen.message_corner_radius),
|
||||
readDimen(R.dimen.message_corner_radius),
|
||||
readDimen(R.dimen.message_corner_collapse_radius));
|
||||
}
|
||||
background = current.isOutgoing() ? R.drawable.message_bubble_background_sent_start
|
||||
: R.drawable.message_bubble_background_received_start;
|
||||
} else if (isEndOfMessageCluster(current, next, isGroupThread)) {
|
||||
if (current.isOutgoing()) {
|
||||
bodyBubble.setRadii(readDimen(R.dimen.message_corner_radius),
|
||||
readDimen(R.dimen.message_corner_collapse_radius),
|
||||
readDimen(R.dimen.message_corner_radius),
|
||||
readDimen(R.dimen.message_corner_radius));
|
||||
} else {
|
||||
bodyBubble.setRadii(readDimen(R.dimen.message_corner_collapse_radius),
|
||||
readDimen(R.dimen.message_corner_radius),
|
||||
readDimen(R.dimen.message_corner_radius),
|
||||
readDimen(R.dimen.message_corner_radius));
|
||||
}
|
||||
background = current.isOutgoing() ? R.drawable.message_bubble_background_sent_end
|
||||
: R.drawable.message_bubble_background_received_end;
|
||||
} else {
|
||||
if (current.isOutgoing()) {
|
||||
bodyBubble.setRadii(readDimen(R.dimen.message_corner_radius),
|
||||
readDimen(R.dimen.message_corner_collapse_radius),
|
||||
readDimen(R.dimen.message_corner_collapse_radius),
|
||||
readDimen(R.dimen.message_corner_radius));
|
||||
} else {
|
||||
bodyBubble.setRadii(readDimen(R.dimen.message_corner_collapse_radius),
|
||||
readDimen(R.dimen.message_corner_radius),
|
||||
readDimen(R.dimen.message_corner_radius),
|
||||
readDimen(R.dimen.message_corner_collapse_radius));
|
||||
}
|
||||
background = current.isOutgoing() ? R.drawable.message_bubble_background_sent_middle
|
||||
: R.drawable.message_bubble_background_received_middle;
|
||||
}
|
||||
|
||||
bodyBubble.setBackgroundResource(background);
|
||||
}
|
||||
|
||||
private boolean isStartOfMessageCluster(@NonNull MessageRecord current, @NonNull Optional<MessageRecord> previous, boolean isGroupThread) {
|
||||
|
@ -48,6 +48,7 @@ public class ConversationItemThumbnail extends FrameLayout {
|
||||
private ImageView shade;
|
||||
private ConversationItemFooter footer;
|
||||
private Paint outlinePaint;
|
||||
private CornerMask cornerMask;
|
||||
|
||||
public ConversationItemThumbnail(Context context) {
|
||||
super(context);
|
||||
@ -71,6 +72,7 @@ public class ConversationItemThumbnail extends FrameLayout {
|
||||
this.shade = findViewById(R.id.conversation_thumbnail_shade);
|
||||
this.footer = findViewById(R.id.conversation_thumbnail_footer);
|
||||
this.outlinePaint = ThemeUtil.isDarkTheme(getContext()) ? DARK_THEME_OUTLINE_PAINT : LIGHT_THEME_OUTLINE_PAINT;
|
||||
this.cornerMask = new CornerMask(this);
|
||||
|
||||
setTouchDelegate(thumbnail.getTouchDelegate());
|
||||
|
||||
@ -87,8 +89,16 @@ public class ConversationItemThumbnail extends FrameLayout {
|
||||
@SuppressWarnings("SuspiciousNameCombination")
|
||||
@Override
|
||||
protected void dispatchDraw(Canvas canvas) {
|
||||
if (cornerMask.isLegacy()) {
|
||||
cornerMask.mask(canvas);
|
||||
}
|
||||
|
||||
super.dispatchDraw(canvas);
|
||||
|
||||
if (!cornerMask.isLegacy()) {
|
||||
cornerMask.mask(canvas);
|
||||
}
|
||||
|
||||
final float halfStrokeWidth = outlinePaint.getStrokeWidth() / 2;
|
||||
|
||||
bounds.left = halfStrokeWidth;
|
||||
@ -137,6 +147,8 @@ public class ConversationItemThumbnail extends FrameLayout {
|
||||
radii[2] = radii[3] = topRight;
|
||||
radii[4] = radii[5] = bottomRight;
|
||||
radii[6] = radii[7] = bottomLeft;
|
||||
|
||||
cornerMask.setRadii(topLeft, topRight, bottomRight, bottomLeft);
|
||||
}
|
||||
|
||||
public ConversationItemFooter getFooter() {
|
||||
|
88
src/org/thoughtcrime/securesms/components/CornerMask.java
Normal file
88
src/org/thoughtcrime/securesms/components/CornerMask.java
Normal file
@ -0,0 +1,88 @@
|
||||
package org.thoughtcrime.securesms.components;
|
||||
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.Path;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.PorterDuffXfermode;
|
||||
import android.graphics.RectF;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.view.View;
|
||||
|
||||
public class CornerMask {
|
||||
|
||||
private final float[] radii = new float[8];
|
||||
private final Paint clearPaint = new Paint();
|
||||
private final Path outline = new Path();
|
||||
private final Path corners = new Path();
|
||||
private final RectF bounds = new RectF();
|
||||
|
||||
public CornerMask(@NonNull View view) {
|
||||
if (isLegacy()) {
|
||||
view.setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
||||
} else {
|
||||
view.setLayerType(View.LAYER_TYPE_HARDWARE, null);
|
||||
}
|
||||
|
||||
clearPaint.setColor(Color.BLACK);
|
||||
clearPaint.setStyle(Paint.Style.FILL);
|
||||
clearPaint.setAntiAlias(true);
|
||||
clearPaint.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.CLEAR));
|
||||
}
|
||||
|
||||
public void mask(Canvas canvas) {
|
||||
bounds.left = 0;
|
||||
bounds.top = 0;
|
||||
bounds.right = canvas.getWidth();
|
||||
bounds.bottom = canvas.getHeight();
|
||||
|
||||
corners.reset();
|
||||
corners.addRoundRect(bounds, radii, Path.Direction.CW);
|
||||
|
||||
// Note: There's a bug in the P beta where most PorterDuff modes aren't working. But CLEAR does.
|
||||
// So we find and inverse path and use Mode.CLEAR for versions that support Path.op().
|
||||
// See issue https://issuetracker.google.com/issues/111394085.
|
||||
if (!isLegacy()) {
|
||||
outline.reset();
|
||||
outline.addRect(bounds, Path.Direction.CW);
|
||||
outline.op(corners, Path.Op.DIFFERENCE);
|
||||
canvas.drawPath(outline, clearPaint);
|
||||
} else {
|
||||
corners.addRoundRect(bounds, radii, Path.Direction.CW);
|
||||
canvas.clipPath(corners);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isLegacy() {
|
||||
return Build.VERSION.SDK_INT < 19;
|
||||
}
|
||||
|
||||
public void setRadius(int radius) {
|
||||
setRadii(radius, radius, radius, radius);
|
||||
}
|
||||
|
||||
public void setRadii(int topLeft, int topRight, int bottomRight, int bottomLeft) {
|
||||
radii[0] = radii[1] = topLeft;
|
||||
radii[2] = radii[3] = topRight;
|
||||
radii[4] = radii[5] = bottomRight;
|
||||
radii[6] = radii[7] = bottomLeft;
|
||||
}
|
||||
|
||||
public void setTopLeftRadius(int radius) {
|
||||
radii[0] = radii[1] = radius;
|
||||
}
|
||||
|
||||
public void setTopRightRadius(int radius) {
|
||||
radii[2] = radii[3] = radius;
|
||||
}
|
||||
|
||||
public void setBottomRightRadius(int radius) {
|
||||
radii[4] = radii[5] = radius;
|
||||
}
|
||||
|
||||
public void setBottomLeftRadius(int radius) {
|
||||
radii[6] = radii[7] = radius;
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.os.Build;
|
||||
import android.support.annotation.NonNull;
|
||||
@ -40,25 +41,25 @@ public class QuoteView extends LinearLayout implements RecipientModifiedListener
|
||||
private static final int MESSAGE_TYPE_OUTGOING = 1;
|
||||
private static final int MESSAGE_TYPE_INCOMING = 2;
|
||||
|
||||
private CornerMaskingView rootView;
|
||||
private View backgroundView;
|
||||
private TextView authorView;
|
||||
private TextView bodyView;
|
||||
private ImageView quoteBarView;
|
||||
private ImageView thumbnailView;
|
||||
private View attachmentVideoOverlayView;
|
||||
private ViewGroup attachmentContainerView;
|
||||
private TextView attachmentNameView;
|
||||
private ImageView dismissView;
|
||||
private ViewGroup rootView;
|
||||
private TextView authorView;
|
||||
private TextView bodyView;
|
||||
private ImageView quoteBarView;
|
||||
private ImageView thumbnailView;
|
||||
private View attachmentVideoOverlayView;
|
||||
private ViewGroup attachmentContainerView;
|
||||
private TextView attachmentNameView;
|
||||
private ImageView dismissView;
|
||||
|
||||
private long id;
|
||||
private Recipient author;
|
||||
private String body;
|
||||
private TextView mediaDescriptionText;
|
||||
private SlideDeck attachments;
|
||||
private int messageType;
|
||||
private int largeCornerRadius;
|
||||
private int smallCornerRadius;
|
||||
private long id;
|
||||
private Recipient author;
|
||||
private String body;
|
||||
private TextView mediaDescriptionText;
|
||||
private SlideDeck attachments;
|
||||
private int messageType;
|
||||
private int largeCornerRadius;
|
||||
private int smallCornerRadius;
|
||||
private CornerMask cornerMask;
|
||||
|
||||
|
||||
public QuoteView(Context context) {
|
||||
@ -86,7 +87,6 @@ public class QuoteView extends LinearLayout implements RecipientModifiedListener
|
||||
inflate(getContext(), R.layout.quote_view, this);
|
||||
|
||||
this.rootView = findViewById(R.id.quote_root);
|
||||
this.backgroundView = findViewById(R.id.quote_background);
|
||||
this.authorView = findViewById(R.id.quote_author);
|
||||
this.bodyView = findViewById(R.id.quote_text);
|
||||
this.quoteBarView = findViewById(R.id.quote_bar);
|
||||
@ -99,7 +99,8 @@ public class QuoteView extends LinearLayout implements RecipientModifiedListener
|
||||
this.largeCornerRadius = getResources().getDimensionPixelSize(R.dimen.quote_corner_radius_large);
|
||||
this.smallCornerRadius = getResources().getDimensionPixelSize(R.dimen.quote_corner_radius_bottom);
|
||||
|
||||
rootView.setRadii(largeCornerRadius, largeCornerRadius, smallCornerRadius, smallCornerRadius);
|
||||
cornerMask = new CornerMask(this);
|
||||
cornerMask.setRadii(largeCornerRadius, largeCornerRadius, smallCornerRadius, smallCornerRadius);
|
||||
|
||||
if (attrs != null) {
|
||||
TypedArray typedArray = getContext().getTheme().obtainStyledAttributes(attrs, R.styleable.QuoteView, 0, 0);
|
||||
@ -117,16 +118,31 @@ public class QuoteView extends LinearLayout implements RecipientModifiedListener
|
||||
|
||||
if (messageType == MESSAGE_TYPE_PREVIEW) {
|
||||
int radius = getResources().getDimensionPixelOffset(R.dimen.quote_corner_radius_preview);
|
||||
rootView.setTopLeftRadius(radius);
|
||||
rootView.setTopRightRadius(radius);
|
||||
cornerMask.setTopLeftRadius(radius);
|
||||
cornerMask.setTopRightRadius(radius);
|
||||
}
|
||||
}
|
||||
|
||||
dismissView.setOnClickListener(view -> setVisibility(GONE));
|
||||
|
||||
setWillNotDraw(false);
|
||||
if (Build.VERSION.SDK_INT < 18) {
|
||||
setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
||||
if (cornerMask.isLegacy()) {
|
||||
setWillNotDraw(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
if (cornerMask.isLegacy()) {
|
||||
cornerMask.mask(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dispatchDraw(Canvas canvas) {
|
||||
super.dispatchDraw(canvas);
|
||||
if (!cornerMask.isLegacy()) {
|
||||
cornerMask.mask(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
@ -145,8 +161,8 @@ public class QuoteView extends LinearLayout implements RecipientModifiedListener
|
||||
}
|
||||
|
||||
public void setTopCornerSizes(boolean topLeftLarge, boolean topRightLarge) {
|
||||
rootView.setTopLeftRadius(topLeftLarge ? largeCornerRadius : smallCornerRadius);
|
||||
rootView.setTopRightRadius(topRightLarge ? largeCornerRadius : smallCornerRadius);
|
||||
cornerMask.setTopLeftRadius(topLeftLarge ? largeCornerRadius : smallCornerRadius);
|
||||
cornerMask.setTopRightRadius(topRightLarge ? largeCornerRadius : smallCornerRadius);
|
||||
}
|
||||
|
||||
public void dismiss() {
|
||||
@ -177,7 +193,7 @@ public class QuoteView extends LinearLayout implements RecipientModifiedListener
|
||||
|
||||
// We use the raw color resource because Android 4.x was struggling with tints here
|
||||
quoteBarView.setImageResource(author.getColor().toQuoteBarColorResource(getContext(), outgoing));
|
||||
backgroundView.setBackgroundColor(author.getColor().toQuoteBackgroundColor(getContext(), outgoing));
|
||||
rootView.setBackgroundColor(author.getColor().toQuoteBackgroundColor(getContext(), outgoing));
|
||||
}
|
||||
|
||||
private void setQuoteText(@Nullable String body, @NonNull SlideDeck attachments) {
|
||||
|
@ -2,6 +2,7 @@ package org.thoughtcrime.securesms.components;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.res.TypedArray;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
@ -46,6 +47,9 @@ public class SharedContactView extends LinearLayout implements RecipientModified
|
||||
private Locale locale;
|
||||
private GlideRequests glideRequests;
|
||||
private EventListener eventListener;
|
||||
private CornerMask cornerMask;
|
||||
private int bigCornerRadius;
|
||||
private int smallCornerRadius;
|
||||
|
||||
private final Map<String, Recipient> activeRecipients = new HashMap<>();
|
||||
|
||||
@ -79,6 +83,10 @@ public class SharedContactView extends LinearLayout implements RecipientModified
|
||||
actionButtonView = findViewById(R.id.contact_action_button);
|
||||
footer = findViewById(R.id.contact_footer);
|
||||
|
||||
cornerMask = new CornerMask(this);
|
||||
bigCornerRadius = getResources().getDimensionPixelOffset(R.dimen.message_corner_radius);
|
||||
smallCornerRadius = getResources().getDimensionPixelOffset(R.dimen.message_corner_collapse_radius);
|
||||
|
||||
if (attrs != null) {
|
||||
TypedArray typedArray = getContext().getTheme().obtainStyledAttributes(attrs, R.styleable.SharedContactView, 0, 0);
|
||||
int titleColor = typedArray.getInt(R.styleable.SharedContactView_contact_titleColor, Color.BLACK);
|
||||
@ -89,6 +97,26 @@ public class SharedContactView extends LinearLayout implements RecipientModified
|
||||
numberView.setTextColor(captionColor);
|
||||
footer.setColor(captionColor);
|
||||
}
|
||||
|
||||
if (cornerMask.isLegacy()) {
|
||||
setWillNotDraw(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
super.onDraw(canvas);
|
||||
if (cornerMask.isLegacy()) {
|
||||
cornerMask.mask(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void dispatchDraw(Canvas canvas) {
|
||||
super.dispatchDraw(canvas);
|
||||
if (!cornerMask.isLegacy()) {
|
||||
cornerMask.mask(canvas);
|
||||
}
|
||||
}
|
||||
|
||||
public void setContact(@NonNull Contact contact, @NonNull GlideRequests glideRequests, @NonNull Locale locale) {
|
||||
@ -104,6 +132,21 @@ public class SharedContactView extends LinearLayout implements RecipientModified
|
||||
presentActionButtons(ContactUtil.getRecipients(getContext(), contact));
|
||||
}
|
||||
|
||||
public void setSingularStyle() {
|
||||
cornerMask.setBottomLeftRadius(bigCornerRadius);
|
||||
cornerMask.setBottomRightRadius(bigCornerRadius);
|
||||
}
|
||||
|
||||
public void setClusteredIncomingStyle() {
|
||||
cornerMask.setBottomLeftRadius(smallCornerRadius);
|
||||
cornerMask.setBottomRightRadius(bigCornerRadius);
|
||||
}
|
||||
|
||||
public void setClusteredOutgoingStyle() {
|
||||
cornerMask.setBottomLeftRadius(bigCornerRadius);
|
||||
cornerMask.setBottomRightRadius(smallCornerRadius);
|
||||
}
|
||||
|
||||
public void setEventListener(@NonNull EventListener eventListener) {
|
||||
this.eventListener = eventListener;
|
||||
}
|
||||
|
@ -224,6 +224,7 @@ public class ViewUtil {
|
||||
} else {
|
||||
((ViewGroup.MarginLayoutParams) view.getLayoutParams()).rightMargin = margin;
|
||||
}
|
||||
view.forceLayout();
|
||||
view.requestLayout();
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user