mirror of
https://github.com/oxen-io/session-android.git
synced 2025-01-02 21:27:47 +00:00
push conversation messages are now blue
// FREEBIE
This commit is contained in:
parent
ca2eecaedf
commit
3dd27ed59a
18
res/drawable/conversation_item_sent_push_shape.xml
Normal file
18
res/drawable/conversation_item_sent_push_shape.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#09000000" />
|
||||
<corners android:radius="@dimen/conversation_item_corner_radius" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:bottom="@dimen/conversation_item_drop_shadow_dist">
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/conversation_item_sent_push_background_light" />
|
||||
<corners android:radius="@dimen/conversation_item_corner_radius" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</layer-list>
|
18
res/drawable/conversation_item_sent_push_shape_dark.xml
Normal file
18
res/drawable/conversation_item_sent_push_shape_dark.xml
Normal file
@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item>
|
||||
<shape android:shape="rectangle">
|
||||
<solid android:color="#09000000" />
|
||||
<corners android:radius="@dimen/conversation_item_corner_radius" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
<item android:bottom="@dimen/conversation_item_drop_shadow_dist">
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<solid android:color="@color/conversation_item_sent_push_background_dark" />
|
||||
<corners android:radius="@dimen/conversation_item_corner_radius" />
|
||||
</shape>
|
||||
</item>
|
||||
|
||||
</layer-list>
|
16
res/drawable/conversation_item_sent_push_triangle_shape.xml
Normal file
16
res/drawable/conversation_item_sent_push_triangle_shape.xml
Normal file
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item>
|
||||
<rotate
|
||||
android:fromDegrees="45"
|
||||
android:toDegrees="45"
|
||||
android:pivotX="0%"
|
||||
android:pivotY="-30%" >
|
||||
<shape
|
||||
android:shape="rectangle" >
|
||||
<solid
|
||||
android:color="@color/conversation_item_sent_push_background_light" />
|
||||
</shape>
|
||||
</rotate>
|
||||
</item>
|
||||
</layer-list>
|
@ -0,0 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<item>
|
||||
<rotate
|
||||
android:fromDegrees="45"
|
||||
android:toDegrees="45"
|
||||
android:pivotX="0%"
|
||||
android:pivotY="-30%" >
|
||||
<shape
|
||||
android:shape="rectangle" >
|
||||
<solid
|
||||
android:color="@color/conversation_item_sent_push_background_dark" />
|
||||
</shape>
|
||||
</rotate>
|
||||
</item>
|
||||
</layer-list>
|
@ -170,7 +170,7 @@
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<View
|
||||
<View android:id="@+id/triangle_tick"
|
||||
android:background="?conversation_item_sent_triangle_background"
|
||||
android:layout_width="12dp"
|
||||
android:layout_height="15dp"
|
||||
|
@ -33,6 +33,8 @@
|
||||
<attr name="conversation_item_received_triangle_background" format="reference" />
|
||||
<attr name="conversation_item_sent_background" format="reference" />
|
||||
<attr name="conversation_item_sent_triangle_background" format="reference" />
|
||||
<attr name="conversation_item_sent_push_background" format="reference" />
|
||||
<attr name="conversation_item_sent_push_triangle_background" format="reference" />
|
||||
|
||||
<attr name="navigation_drawer_background" format="reference|color"/>
|
||||
<attr name="navigation_drawer_text_color" format="color"/>
|
||||
|
@ -15,6 +15,8 @@
|
||||
|
||||
<color name="conversation_item_sent_background_dark">#ff284e0a</color>
|
||||
<color name="conversation_item_sent_background_light">#ff64a926</color>
|
||||
<color name="conversation_item_sent_push_background_light">#ff3a7ef2</color>
|
||||
<color name="conversation_item_sent_push_background_dark">#ff213b77</color>
|
||||
<color name="conversation_item_received_background_dark">#ff284e0a</color>
|
||||
<color name="conversation_item_received_background_light">#ff284e0a</color>
|
||||
</resources>
|
@ -32,6 +32,8 @@
|
||||
<item name="conversation_item_received_triangle_background">@drawable/conversation_item_received_triangle_shape</item>
|
||||
<item name="conversation_item_sent_background">@drawable/conversation_item_sent_shape</item>
|
||||
<item name="conversation_item_sent_triangle_background">@drawable/conversation_item_sent_triangle_shape</item>
|
||||
<item name="conversation_item_sent_push_background">@drawable/conversation_item_sent_push_shape</item>
|
||||
<item name="conversation_item_sent_push_triangle_background">@drawable/conversation_item_sent_push_triangle_shape</item>
|
||||
|
||||
<item name="menu_new_conversation_icon">@drawable/ic_action_new_holo_light</item>
|
||||
<item name="menu_new_group_icon">@drawable/ic_action_add_group_holo_light</item>
|
||||
@ -79,6 +81,8 @@
|
||||
<item name="conversation_item_received_triangle_background">@drawable/conversation_item_received_triangle_shape_dark</item>
|
||||
<item name="conversation_item_sent_background">@drawable/conversation_item_sent_shape_dark</item>
|
||||
<item name="conversation_item_sent_triangle_background">@drawable/conversation_item_sent_triangle_shape_dark</item>
|
||||
<item name="conversation_item_sent_push_background">@drawable/conversation_item_sent_push_shape_dark</item>
|
||||
<item name="conversation_item_sent_push_triangle_background">@drawable/conversation_item_sent_push_triangle_shape_dark</item>
|
||||
|
||||
<item name="actionbar_icon">@drawable/actionbar_icon_holo_dark</item>
|
||||
<item name="lower_right_divet">@drawable/divet_lower_right_light</item>
|
||||
|
@ -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());
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user