diff --git a/res/drawable/conversation_item_sent_push_shape.xml b/res/drawable/conversation_item_sent_push_shape.xml new file mode 100644 index 0000000000..62d54a7f05 --- /dev/null +++ b/res/drawable/conversation_item_sent_push_shape.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/res/drawable/conversation_item_sent_push_shape_dark.xml b/res/drawable/conversation_item_sent_push_shape_dark.xml new file mode 100644 index 0000000000..fe00bf8fda --- /dev/null +++ b/res/drawable/conversation_item_sent_push_shape_dark.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + + + + diff --git a/res/drawable/conversation_item_sent_push_triangle_shape.xml b/res/drawable/conversation_item_sent_push_triangle_shape.xml new file mode 100644 index 0000000000..0a1e2d89f4 --- /dev/null +++ b/res/drawable/conversation_item_sent_push_triangle_shape.xml @@ -0,0 +1,16 @@ + + + + + + + + + + \ No newline at end of file diff --git a/res/drawable/conversation_item_sent_push_triangle_shape_dark.xml b/res/drawable/conversation_item_sent_push_triangle_shape_dark.xml new file mode 100644 index 0000000000..26bc4058f1 --- /dev/null +++ b/res/drawable/conversation_item_sent_push_triangle_shape_dark.xml @@ -0,0 +1,16 @@ + + + + + + + + + + \ No newline at end of file diff --git a/res/layout/conversation_item_sent.xml b/res/layout/conversation_item_sent.xml index 68973591bc..876e02f92e 100644 --- a/res/layout/conversation_item_sent.xml +++ b/res/layout/conversation_item_sent.xml @@ -170,7 +170,7 @@ - + + diff --git a/res/values/colors.xml b/res/values/colors.xml index ccf8919a75..b92d49e8b2 100644 --- a/res/values/colors.xml +++ b/res/values/colors.xml @@ -15,6 +15,8 @@ #ff284e0a #ff64a926 + #ff3a7ef2 + #ff213b77 #ff284e0a #ff284e0a \ No newline at end of file diff --git a/res/values/themes.xml b/res/values/themes.xml index 20e6fa11ca..79b9cc1726 100644 --- a/res/values/themes.xml +++ b/res/values/themes.xml @@ -32,6 +32,8 @@ @drawable/conversation_item_received_triangle_shape @drawable/conversation_item_sent_shape @drawable/conversation_item_sent_triangle_shape + @drawable/conversation_item_sent_push_shape + @drawable/conversation_item_sent_push_triangle_shape @drawable/ic_action_new_holo_light @drawable/ic_action_add_group_holo_light @@ -79,6 +81,8 @@ @drawable/conversation_item_received_triangle_shape_dark @drawable/conversation_item_sent_shape_dark @drawable/conversation_item_sent_triangle_shape_dark + @drawable/conversation_item_sent_push_shape_dark + @drawable/conversation_item_sent_push_triangle_shape_dark @drawable/actionbar_icon_holo_dark @drawable/divet_lower_right_light diff --git a/src/org/thoughtcrime/securesms/ConversationItem.java b/src/org/thoughtcrime/securesms/ConversationItem.java index 62d69fbb54..c7194b0a22 100644 --- a/src/org/thoughtcrime/securesms/ConversationItem.java +++ b/src/org/thoughtcrime/securesms/ConversationItem.java @@ -21,6 +21,7 @@ import android.app.ProgressDialog; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; +import android.content.res.TypedArray; import android.graphics.Color; import android.graphics.drawable.ColorDrawable; import android.media.MediaScannerConnection; @@ -72,6 +73,7 @@ import java.io.OutputStream; */ public class ConversationItem extends LinearLayout { + private final static String TAG = ConversationItem.class.getSimpleName(); private Handler failedIconHandler; private MessageRecord messageRecord; @@ -171,19 +173,37 @@ public class ConversationItem extends LinearLayout { this.failedIconHandler = failedIconHandler; } + public static void setViewBackgroundWithoutResettingPadding(final View v, final int backgroundResId) { + final int paddingBottom = v.getPaddingBottom(); + final int paddingLeft = v.getPaddingLeft(); + final int paddingRight = v.getPaddingRight(); + final int paddingTop = v.getPaddingTop(); + v.setBackgroundResource(backgroundResId); + v.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom); + } + /// MessageRecord Attribute Parsers private void setBodyText(MessageRecord messageRecord) { - // TODO jake is going to fix this up - if (messageRecord.isPush() && messageRecord.isOutgoing()) { - bodyText.setText("PUSH " + messageRecord.getDisplayBody()); - return; - } if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) { bodyText.setText(Emoji.getInstance(context).emojify(messageRecord.getDisplayBody(), Emoji.EMOJI_LARGE), TextView.BufferType.SPANNABLE); } else { + if (messageRecord.isPush() && messageRecord.isOutgoing()) { + LinearLayout conversationParent = (LinearLayout)findViewById(R.id.conversation_item_parent); + if (conversationParent != null) { + int attributes[] = new int[]{R.attr.conversation_item_sent_push_background, + R.attr.conversation_item_sent_push_triangle_background}; + TypedArray drawables = context.obtainStyledAttributes(attributes); + + if (drawables != null) { + setViewBackgroundWithoutResettingPadding(conversationParent, drawables.getResourceId(0, -1)); + setViewBackgroundWithoutResettingPadding(findViewById(R.id.triangle_tick), drawables.getResourceId(1, -1)); + drawables.recycle(); + } + } + } bodyText.setText(messageRecord.getDisplayBody()); } }