mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-12 02:03:55 +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
|
<stroke
|
||||||
android:width="1dp"
|
android:width="1dp"
|
||||||
android:color="?attr/conversation_input_outline_color" />
|
android:color="@color/core_dark_70" />
|
||||||
|
|
||||||
<solid
|
<solid
|
||||||
android:color="?attr/conversation_input_background_color" />
|
android:color="@color/core_dark_85" />
|
||||||
|
|
||||||
<corners
|
<corners
|
||||||
android:radius="20dp" />
|
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">
|
android:shape="rectangle">
|
||||||
|
|
||||||
<corners android:radius="4dp" />
|
<corners android:radius="4dp" />
|
||||||
<solid android:color="?attr/conversation_item_sticky_date_background_color" />
|
<solid android:color="@color/core_dark_85" />
|
||||||
</shape>
|
</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"
|
style="@style/Signal.Text.Caption"
|
||||||
android:textColor="?attr/conversation_item_sticky_date_text_color"
|
android:textColor="?attr/conversation_item_sticky_date_text_color"
|
||||||
android:textAllCaps="true"
|
android:textAllCaps="true"
|
||||||
android:background="@drawable/sticky_date_header_background"
|
android:background="?attr/conversation_item_sticky_date_background"
|
||||||
android:elevation="9dp"
|
android:elevation="9dp"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:text="March 1, 2015" />
|
tools:text="March 1, 2015" />
|
||||||
|
@ -27,7 +27,7 @@
|
|||||||
android:id="@+id/compose_bubble"
|
android:id="@+id/compose_bubble"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/compose_background"
|
android:background="?attr/conversation_input_background"
|
||||||
android:clipChildren="false"
|
android:clipChildren="false"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginRight="@dimen/conversation_individual_right_gutter"
|
android:layout_marginRight="@dimen/conversation_individual_right_gutter"
|
||||||
android:layout_marginEnd="@dimen/conversation_individual_right_gutter"
|
android:layout_marginEnd="@dimen/conversation_individual_right_gutter"
|
||||||
|
android:paddingLeft="8dp"
|
||||||
|
android:paddingStart="8dp"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:clipChildren="false">
|
android:clipChildren="false">
|
||||||
|
|
||||||
@ -28,31 +30,28 @@
|
|||||||
android:foreground="@drawable/contact_photo_background"
|
android:foreground="@drawable/contact_photo_background"
|
||||||
android:layout_width="36dp"
|
android:layout_width="36dp"
|
||||||
android:layout_height="36dp"
|
android:layout_height="36dp"
|
||||||
android:layout_marginLeft="8dp"
|
|
||||||
android:layout_marginRight="8dp"
|
|
||||||
android:layout_marginBottom="6dp"
|
android:layout_marginBottom="6dp"
|
||||||
android:layout_alignParentLeft="true"
|
android:layout_alignParentLeft="true"
|
||||||
|
android:layout_alignParentStart="true"
|
||||||
android:layout_alignParentBottom="true"
|
android:layout_alignParentBottom="true"
|
||||||
android:cropToPadding="true"
|
android:cropToPadding="true"
|
||||||
android:contentDescription="@string/conversation_item_received__contact_photo_description" />
|
android:contentDescription="@string/conversation_item_received__contact_photo_description" />
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.components.CornerMaskingView
|
<LinearLayout
|
||||||
android:id="@+id/body_bubble"
|
android:id="@+id/body_bubble"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginRight="@dimen/message_bubble_edge_margin"
|
android:layout_marginRight="@dimen/message_bubble_edge_margin"
|
||||||
android:layout_marginEnd="@dimen/message_bubble_edge_margin"
|
android:layout_marginEnd="@dimen/message_bubble_edge_margin"
|
||||||
android:background="@color/white"
|
android:layout_marginLeft="8dp"
|
||||||
android:clipToPadding="false"
|
android:layout_marginStart="8dp"
|
||||||
android:clipChildren="false"
|
android:layout_toRightOf="@id/contact_photo"
|
||||||
tools:backgroundTint="@color/conversation_blue">
|
android:layout_toEndOf="@id/contact_photo"
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:clipChildren="false">
|
android:clipChildren="false"
|
||||||
|
android:background="@color/white"
|
||||||
|
tools:backgroundTint="@color/conversation_blue">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/group_sender_holder"
|
android:id="@+id/group_sender_holder"
|
||||||
@ -171,8 +170,6 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</org.thoughtcrime.securesms.components.CornerMaskingView>
|
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.components.AlertView
|
<org.thoughtcrime.securesms.components.AlertView
|
||||||
android:id="@+id/indicators_parent"
|
android:id="@+id/indicators_parent"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -23,27 +23,21 @@
|
|||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:clipChildren="false">
|
android:clipChildren="false">
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.components.CornerMaskingView
|
<LinearLayout
|
||||||
android:id="@+id/body_bubble"
|
android:id="@+id/body_bubble"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:orientation="vertical"
|
||||||
android:layout_toLeftOf="@+id/indicators_parent"
|
android:layout_toLeftOf="@+id/indicators_parent"
|
||||||
android:layout_toStartOf="@+id/indicators_parent"
|
android:layout_toStartOf="@+id/indicators_parent"
|
||||||
android:layout_alignWithParentIfMissing="true"
|
android:layout_alignWithParentIfMissing="true"
|
||||||
android:layout_marginLeft="@dimen/message_bubble_edge_margin"
|
android:layout_marginLeft="@dimen/message_bubble_edge_margin"
|
||||||
android:layout_marginStart="@dimen/message_bubble_edge_margin"
|
android:layout_marginStart="@dimen/message_bubble_edge_margin"
|
||||||
android:background="@color/white"
|
|
||||||
android:clipToPadding="false"
|
android:clipToPadding="false"
|
||||||
android:clipChildren="false"
|
android:clipChildren="false"
|
||||||
|
android:background="@color/white"
|
||||||
tools:backgroundTint="@color/core_light_10">
|
tools:backgroundTint="@color/core_light_10">
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:clipToPadding="false"
|
|
||||||
android:clipChildren="false">
|
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.components.QuoteView
|
<org.thoughtcrime.securesms.components.QuoteView
|
||||||
android:id="@+id/quote_view"
|
android:id="@+id/quote_view"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@ -137,8 +131,6 @@
|
|||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</org.thoughtcrime.securesms.components.CornerMaskingView>
|
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.components.AlertView
|
<org.thoughtcrime.securesms.components.AlertView
|
||||||
android:id="@+id/indicators_parent"
|
android:id="@+id/indicators_parent"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
|
@ -11,13 +11,8 @@
|
|||||||
android:layout_margin="3dp"
|
android:layout_margin="3dp"
|
||||||
tools:visibility="visible">
|
tools:visibility="visible">
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.components.CornerMaskingView
|
|
||||||
android:id="@+id/quote_root"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/quote_background"
|
android:id="@+id/quote_root"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
@ -159,6 +154,4 @@
|
|||||||
android:src="@drawable/ic_close_white_18dp"
|
android:src="@drawable/ic_close_white_18dp"
|
||||||
android:tint="@color/gray70" />
|
android:tint="@color/gray70" />
|
||||||
|
|
||||||
</org.thoughtcrime.securesms.components.CornerMaskingView>
|
|
||||||
|
|
||||||
</merge>
|
</merge>
|
@ -28,8 +28,7 @@
|
|||||||
<attr name="conversation_background" format="reference|color"/>
|
<attr name="conversation_background" format="reference|color"/>
|
||||||
<attr name="conversation_editor_background" format="reference|color"/>
|
<attr name="conversation_editor_background" format="reference|color"/>
|
||||||
<attr name="conversation_editor_text_color" format="reference|color"/>
|
<attr name="conversation_editor_text_color" format="reference|color"/>
|
||||||
<attr name="conversation_input_background_color" format="color"/>
|
<attr name="conversation_input_background" format="reference"/>
|
||||||
<attr name="conversation_input_outline_color" format="color"/>
|
|
||||||
<attr name="conversation_transport_sms_indicator" format="reference"/>
|
<attr name="conversation_transport_sms_indicator" format="reference"/>
|
||||||
<attr name="conversation_transport_push_indicator" format="reference"/>
|
<attr name="conversation_transport_push_indicator" format="reference"/>
|
||||||
<attr name="conversation_transport_popup_background" 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_last_seen_line_color" format="reference"/>
|
||||||
<attr name="conversation_item_date_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_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_sticky_date_text_color" format="color" />
|
||||||
<attr name="conversation_item_delivery_icon_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_background">@color/core_white</item>
|
||||||
<item name="conversation_editor_background">#22000000</item>
|
<item name="conversation_editor_background">#22000000</item>
|
||||||
<item name="conversation_editor_text_color">#ff111111</item>
|
<item name="conversation_editor_text_color">#ff111111</item>
|
||||||
<item name="conversation_input_background_color">@color/core_light_02</item>
|
<item name="conversation_input_background">@drawable/compose_background_light</item>
|
||||||
<item name="conversation_input_outline_color">@color/core_light_10</item>
|
|
||||||
<item name="conversation_transport_sms_indicator">@drawable/ic_send_sms_insecure</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_push_indicator">@drawable/ic_send_push</item>
|
||||||
<item name="conversation_transport_popup_background">@color/white</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_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_date_line_color">@color/core_light_45</item>
|
||||||
<item name="conversation_item_quote_text_color">@color/core_light_90</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_sticky_date_text_color">@color/core_light_60</item>
|
||||||
<item name="conversation_item_delivery_icon_color">@color/core_light_45</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_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_date_line_color">@color/core_dark_55</item>
|
||||||
<item name="conversation_item_quote_text_color">@color/core_dark_05</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_sticky_date_text_color">@color/core_dark_30</item>
|
||||||
<item name="conversation_item_delivery_icon_color">@color/core_dark_60</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_background">@color/black</item>
|
||||||
<item name="conversation_editor_background">#22ffffff</item>
|
<item name="conversation_editor_background">#22ffffff</item>
|
||||||
<item name="conversation_editor_text_color">#ffeeeeee</item>
|
<item name="conversation_editor_text_color">#ffeeeeee</item>
|
||||||
<item name="conversation_input_background_color">@color/core_dark_85</item>
|
<item name="conversation_input_background">@drawable/compose_background_dark</item>
|
||||||
<item name="conversation_input_outline_color">@color/core_dark_70</item>
|
|
||||||
<item name="conversation_transport_sms_indicator">@drawable/ic_send_sms_insecure_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_push_indicator">@drawable/ic_send_push</item>
|
||||||
<item name="conversation_transport_popup_background">@color/black</item>
|
<item name="conversation_transport_popup_background">@color/black</item>
|
||||||
|
@ -110,7 +110,7 @@ public class ConversationItem extends LinearLayout
|
|||||||
private Recipient recipient;
|
private Recipient recipient;
|
||||||
private GlideRequests glideRequests;
|
private GlideRequests glideRequests;
|
||||||
|
|
||||||
protected CornerMaskingView bodyBubble;
|
protected ViewGroup bodyBubble;
|
||||||
private QuoteView quoteView;
|
private QuoteView quoteView;
|
||||||
private TextView bodyText;
|
private TextView bodyText;
|
||||||
private ConversationItemFooter footer;
|
private ConversationItemFooter footer;
|
||||||
@ -203,7 +203,9 @@ public class ConversationItem extends LinearLayout
|
|||||||
this.recipient.addListener(this);
|
this.recipient.addListener(this);
|
||||||
this.conversationRecipient.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);
|
setInteractionState(messageRecord, pulseHighlight);
|
||||||
setBodyText(messageRecord);
|
setBodyText(messageRecord);
|
||||||
setBubbleState(messageRecord);
|
setBubbleState(messageRecord);
|
||||||
@ -213,9 +215,7 @@ public class ConversationItem extends LinearLayout
|
|||||||
setAuthor(messageRecord, previousMessageRecord, nextMessageRecord, groupThread);
|
setAuthor(messageRecord, previousMessageRecord, nextMessageRecord, groupThread);
|
||||||
setQuote(messageRecord, previousMessageRecord, nextMessageRecord, groupThread);
|
setQuote(messageRecord, previousMessageRecord, nextMessageRecord, groupThread);
|
||||||
setMessageSpacing(context, messageRecord, nextMessageRecord);
|
setMessageSpacing(context, messageRecord, nextMessageRecord);
|
||||||
setGutterSizes(messageRecord, groupThread);
|
|
||||||
setFooter(messageRecord, nextMessageRecord, locale, groupThread);
|
setFooter(messageRecord, nextMessageRecord, locale, groupThread);
|
||||||
setMessageShape(messageRecord, previousMessageRecord, nextMessageRecord, groupThread);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -414,6 +414,8 @@ public class ConversationItem extends LinearLayout
|
|||||||
sharedContactStub.get().setOnClickListener(sharedContactClickListener);
|
sharedContactStub.get().setOnClickListener(sharedContactClickListener);
|
||||||
sharedContactStub.get().setOnLongClickListener(passthroughClickListener);
|
sharedContactStub.get().setOnLongClickListener(passthroughClickListener);
|
||||||
|
|
||||||
|
setSharedContactCorners(messageRecord, previousRecord, nextRecord, isGroupThread);
|
||||||
|
|
||||||
ViewUtil.updateLayoutParams(bodyText, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
ViewUtil.updateLayoutParams(bodyText, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||||
footer.setVisibility(GONE);
|
footer.setVisibility(GONE);
|
||||||
} else if (hasAudio(messageRecord)) {
|
} else if (hasAudio(messageRecord)) {
|
||||||
@ -464,7 +466,7 @@ public class ConversationItem extends LinearLayout
|
|||||||
mediaThumbnailStub.get().setOnClickListener(passthroughClickListener);
|
mediaThumbnailStub.get().setOnClickListener(passthroughClickListener);
|
||||||
mediaThumbnailStub.get().showShade(TextUtils.isEmpty(messageRecord.getDisplayBody()));
|
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);
|
ViewUtil.updateLayoutParams(bodyText, ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||||
footer.setVisibility(VISIBLE);
|
footer.setVisibility(VISIBLE);
|
||||||
@ -537,6 +539,18 @@ public class ConversationItem extends LinearLayout
|
|||||||
mediaThumbnailStub.get().setOutlineCorners(topLeft, topRight, bottomRight, bottomLeft);
|
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) {
|
private void setContactPhoto(@NonNull Recipient recipient) {
|
||||||
if (contactPhoto == null) return;
|
if (contactPhoto == null) return;
|
||||||
|
|
||||||
@ -621,18 +635,10 @@ public class ConversationItem extends LinearLayout
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void setGutterSizes(@NonNull MessageRecord current, boolean isGroupThread) {
|
private void setGutterSizes(@NonNull MessageRecord current, boolean isGroupThread) {
|
||||||
if (isGroupThread) {
|
if (isGroupThread && current.isOutgoing()) {
|
||||||
if (current.isOutgoing()) {
|
|
||||||
ViewUtil.setLeftMargin(container, readDimen(R.dimen.conversation_group_left_gutter));
|
ViewUtil.setLeftMargin(container, readDimen(R.dimen.conversation_group_left_gutter));
|
||||||
} else {
|
} else if (current.isOutgoing()) {
|
||||||
ViewUtil.setLeftMargin(bodyBubble, readDimen(R.dimen.conversation_group_left_gutter));
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (current.isOutgoing()) {
|
|
||||||
ViewUtil.setLeftMargin(container, readDimen(R.dimen.conversation_individual_left_gutter));
|
ViewUtil.setLeftMargin(container, readDimen(R.dimen.conversation_individual_left_gutter));
|
||||||
} else {
|
|
||||||
ViewUtil.setLeftMargin(bodyBubble, 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())) {
|
if (!next.isPresent() || next.get().isUpdate() || !current.getRecipient().getAddress().equals(next.get().getRecipient().getAddress())) {
|
||||||
contactPhoto.setVisibility(VISIBLE);
|
contactPhoto.setVisibility(VISIBLE);
|
||||||
} else {
|
} else {
|
||||||
contactPhoto.setVisibility(GONE);
|
contactPhoto.setVisibility(INVISIBLE);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
groupSenderHolder.setVisibility(GONE);
|
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) {
|
private void setMessageShape(@NonNull MessageRecord current, @NonNull Optional<MessageRecord> previous, @NonNull Optional<MessageRecord> next, boolean isGroupThread) {
|
||||||
|
int background;
|
||||||
if (isSingularMessage(current, previous, next, isGroupThread)) {
|
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)) {
|
} else if (isStartOfMessageCluster(current, previous, isGroupThread)) {
|
||||||
if (current.isOutgoing()) {
|
background = current.isOutgoing() ? R.drawable.message_bubble_background_sent_start
|
||||||
bodyBubble.setRadii(readDimen(R.dimen.message_corner_radius),
|
: R.drawable.message_bubble_background_received_start;
|
||||||
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));
|
|
||||||
}
|
|
||||||
} else if (isEndOfMessageCluster(current, next, isGroupThread)) {
|
} else if (isEndOfMessageCluster(current, next, isGroupThread)) {
|
||||||
if (current.isOutgoing()) {
|
background = current.isOutgoing() ? R.drawable.message_bubble_background_sent_end
|
||||||
bodyBubble.setRadii(readDimen(R.dimen.message_corner_radius),
|
: R.drawable.message_bubble_background_received_end;
|
||||||
readDimen(R.dimen.message_corner_collapse_radius),
|
|
||||||
readDimen(R.dimen.message_corner_radius),
|
|
||||||
readDimen(R.dimen.message_corner_radius));
|
|
||||||
} else {
|
} else {
|
||||||
bodyBubble.setRadii(readDimen(R.dimen.message_corner_collapse_radius),
|
background = current.isOutgoing() ? R.drawable.message_bubble_background_sent_middle
|
||||||
readDimen(R.dimen.message_corner_radius),
|
: R.drawable.message_bubble_background_received_middle;
|
||||||
readDimen(R.dimen.message_corner_radius),
|
|
||||||
readDimen(R.dimen.message_corner_radius));
|
|
||||||
}
|
|
||||||
} 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));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bodyBubble.setBackgroundResource(background);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isStartOfMessageCluster(@NonNull MessageRecord current, @NonNull Optional<MessageRecord> previous, boolean isGroupThread) {
|
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 ImageView shade;
|
||||||
private ConversationItemFooter footer;
|
private ConversationItemFooter footer;
|
||||||
private Paint outlinePaint;
|
private Paint outlinePaint;
|
||||||
|
private CornerMask cornerMask;
|
||||||
|
|
||||||
public ConversationItemThumbnail(Context context) {
|
public ConversationItemThumbnail(Context context) {
|
||||||
super(context);
|
super(context);
|
||||||
@ -71,6 +72,7 @@ public class ConversationItemThumbnail extends FrameLayout {
|
|||||||
this.shade = findViewById(R.id.conversation_thumbnail_shade);
|
this.shade = findViewById(R.id.conversation_thumbnail_shade);
|
||||||
this.footer = findViewById(R.id.conversation_thumbnail_footer);
|
this.footer = findViewById(R.id.conversation_thumbnail_footer);
|
||||||
this.outlinePaint = ThemeUtil.isDarkTheme(getContext()) ? DARK_THEME_OUTLINE_PAINT : LIGHT_THEME_OUTLINE_PAINT;
|
this.outlinePaint = ThemeUtil.isDarkTheme(getContext()) ? DARK_THEME_OUTLINE_PAINT : LIGHT_THEME_OUTLINE_PAINT;
|
||||||
|
this.cornerMask = new CornerMask(this);
|
||||||
|
|
||||||
setTouchDelegate(thumbnail.getTouchDelegate());
|
setTouchDelegate(thumbnail.getTouchDelegate());
|
||||||
|
|
||||||
@ -87,8 +89,16 @@ public class ConversationItemThumbnail extends FrameLayout {
|
|||||||
@SuppressWarnings("SuspiciousNameCombination")
|
@SuppressWarnings("SuspiciousNameCombination")
|
||||||
@Override
|
@Override
|
||||||
protected void dispatchDraw(Canvas canvas) {
|
protected void dispatchDraw(Canvas canvas) {
|
||||||
|
if (cornerMask.isLegacy()) {
|
||||||
|
cornerMask.mask(canvas);
|
||||||
|
}
|
||||||
|
|
||||||
super.dispatchDraw(canvas);
|
super.dispatchDraw(canvas);
|
||||||
|
|
||||||
|
if (!cornerMask.isLegacy()) {
|
||||||
|
cornerMask.mask(canvas);
|
||||||
|
}
|
||||||
|
|
||||||
final float halfStrokeWidth = outlinePaint.getStrokeWidth() / 2;
|
final float halfStrokeWidth = outlinePaint.getStrokeWidth() / 2;
|
||||||
|
|
||||||
bounds.left = halfStrokeWidth;
|
bounds.left = halfStrokeWidth;
|
||||||
@ -137,6 +147,8 @@ public class ConversationItemThumbnail extends FrameLayout {
|
|||||||
radii[2] = radii[3] = topRight;
|
radii[2] = radii[3] = topRight;
|
||||||
radii[4] = radii[5] = bottomRight;
|
radii[4] = radii[5] = bottomRight;
|
||||||
radii[6] = radii[7] = bottomLeft;
|
radii[6] = radii[7] = bottomLeft;
|
||||||
|
|
||||||
|
cornerMask.setRadii(topLeft, topRight, bottomRight, bottomLeft);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ConversationItemFooter getFooter() {
|
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.Context;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
@ -40,8 +41,7 @@ public class QuoteView extends LinearLayout implements RecipientModifiedListener
|
|||||||
private static final int MESSAGE_TYPE_OUTGOING = 1;
|
private static final int MESSAGE_TYPE_OUTGOING = 1;
|
||||||
private static final int MESSAGE_TYPE_INCOMING = 2;
|
private static final int MESSAGE_TYPE_INCOMING = 2;
|
||||||
|
|
||||||
private CornerMaskingView rootView;
|
private ViewGroup rootView;
|
||||||
private View backgroundView;
|
|
||||||
private TextView authorView;
|
private TextView authorView;
|
||||||
private TextView bodyView;
|
private TextView bodyView;
|
||||||
private ImageView quoteBarView;
|
private ImageView quoteBarView;
|
||||||
@ -59,6 +59,7 @@ public class QuoteView extends LinearLayout implements RecipientModifiedListener
|
|||||||
private int messageType;
|
private int messageType;
|
||||||
private int largeCornerRadius;
|
private int largeCornerRadius;
|
||||||
private int smallCornerRadius;
|
private int smallCornerRadius;
|
||||||
|
private CornerMask cornerMask;
|
||||||
|
|
||||||
|
|
||||||
public QuoteView(Context context) {
|
public QuoteView(Context context) {
|
||||||
@ -86,7 +87,6 @@ public class QuoteView extends LinearLayout implements RecipientModifiedListener
|
|||||||
inflate(getContext(), R.layout.quote_view, this);
|
inflate(getContext(), R.layout.quote_view, this);
|
||||||
|
|
||||||
this.rootView = findViewById(R.id.quote_root);
|
this.rootView = findViewById(R.id.quote_root);
|
||||||
this.backgroundView = findViewById(R.id.quote_background);
|
|
||||||
this.authorView = findViewById(R.id.quote_author);
|
this.authorView = findViewById(R.id.quote_author);
|
||||||
this.bodyView = findViewById(R.id.quote_text);
|
this.bodyView = findViewById(R.id.quote_text);
|
||||||
this.quoteBarView = findViewById(R.id.quote_bar);
|
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.largeCornerRadius = getResources().getDimensionPixelSize(R.dimen.quote_corner_radius_large);
|
||||||
this.smallCornerRadius = getResources().getDimensionPixelSize(R.dimen.quote_corner_radius_bottom);
|
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) {
|
if (attrs != null) {
|
||||||
TypedArray typedArray = getContext().getTheme().obtainStyledAttributes(attrs, R.styleable.QuoteView, 0, 0);
|
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) {
|
if (messageType == MESSAGE_TYPE_PREVIEW) {
|
||||||
int radius = getResources().getDimensionPixelOffset(R.dimen.quote_corner_radius_preview);
|
int radius = getResources().getDimensionPixelOffset(R.dimen.quote_corner_radius_preview);
|
||||||
rootView.setTopLeftRadius(radius);
|
cornerMask.setTopLeftRadius(radius);
|
||||||
rootView.setTopRightRadius(radius);
|
cornerMask.setTopRightRadius(radius);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dismissView.setOnClickListener(view -> setVisibility(GONE));
|
dismissView.setOnClickListener(view -> setVisibility(GONE));
|
||||||
|
|
||||||
|
if (cornerMask.isLegacy()) {
|
||||||
setWillNotDraw(false);
|
setWillNotDraw(false);
|
||||||
if (Build.VERSION.SDK_INT < 18) {
|
}
|
||||||
setLayerType(View.LAYER_TYPE_SOFTWARE, null);
|
}
|
||||||
|
|
||||||
|
@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) {
|
public void setTopCornerSizes(boolean topLeftLarge, boolean topRightLarge) {
|
||||||
rootView.setTopLeftRadius(topLeftLarge ? largeCornerRadius : smallCornerRadius);
|
cornerMask.setTopLeftRadius(topLeftLarge ? largeCornerRadius : smallCornerRadius);
|
||||||
rootView.setTopRightRadius(topRightLarge ? largeCornerRadius : smallCornerRadius);
|
cornerMask.setTopRightRadius(topRightLarge ? largeCornerRadius : smallCornerRadius);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dismiss() {
|
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
|
// We use the raw color resource because Android 4.x was struggling with tints here
|
||||||
quoteBarView.setImageResource(author.getColor().toQuoteBarColorResource(getContext(), outgoing));
|
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) {
|
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.Context;
|
||||||
import android.content.res.TypedArray;
|
import android.content.res.TypedArray;
|
||||||
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
@ -46,6 +47,9 @@ public class SharedContactView extends LinearLayout implements RecipientModified
|
|||||||
private Locale locale;
|
private Locale locale;
|
||||||
private GlideRequests glideRequests;
|
private GlideRequests glideRequests;
|
||||||
private EventListener eventListener;
|
private EventListener eventListener;
|
||||||
|
private CornerMask cornerMask;
|
||||||
|
private int bigCornerRadius;
|
||||||
|
private int smallCornerRadius;
|
||||||
|
|
||||||
private final Map<String, Recipient> activeRecipients = new HashMap<>();
|
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);
|
actionButtonView = findViewById(R.id.contact_action_button);
|
||||||
footer = findViewById(R.id.contact_footer);
|
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) {
|
if (attrs != null) {
|
||||||
TypedArray typedArray = getContext().getTheme().obtainStyledAttributes(attrs, R.styleable.SharedContactView, 0, 0);
|
TypedArray typedArray = getContext().getTheme().obtainStyledAttributes(attrs, R.styleable.SharedContactView, 0, 0);
|
||||||
int titleColor = typedArray.getInt(R.styleable.SharedContactView_contact_titleColor, Color.BLACK);
|
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);
|
numberView.setTextColor(captionColor);
|
||||||
footer.setColor(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) {
|
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));
|
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) {
|
public void setEventListener(@NonNull EventListener eventListener) {
|
||||||
this.eventListener = eventListener;
|
this.eventListener = eventListener;
|
||||||
}
|
}
|
||||||
|
@ -224,6 +224,7 @@ public class ViewUtil {
|
|||||||
} else {
|
} else {
|
||||||
((ViewGroup.MarginLayoutParams) view.getLayoutParams()).rightMargin = margin;
|
((ViewGroup.MarginLayoutParams) view.getLayoutParams()).rightMargin = margin;
|
||||||
}
|
}
|
||||||
|
view.forceLayout();
|
||||||
view.requestLayout();
|
view.requestLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user