Commit bbccea6b authored by Grigory Fedorov's avatar Grigory Fedorov

9 patch PNG used to draw chat messages background.

parent b05bc240
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
package com.xabber.android.ui.adapter; package com.xabber.android.ui.adapter;
import android.app.Activity; import android.app.Activity;
import android.graphics.drawable.ColorDrawable;
import android.text.Spannable; import android.text.Spannable;
import android.text.SpannableStringBuilder; import android.text.SpannableStringBuilder;
import android.text.method.LinkMovementMethod; import android.text.method.LinkMovementMethod;
...@@ -80,7 +79,6 @@ public class ChatMessageAdapter extends BaseAdapter implements UpdatableAdapter ...@@ -80,7 +79,6 @@ public class ChatMessageAdapter extends BaseAdapter implements UpdatableAdapter
* Text with extra information. * Text with extra information.
*/ */
private String hint; private String hint;
private final int[] backgroundColors;
public ChatMessageAdapter(Activity activity) { public ChatMessageAdapter(Activity activity) {
this.activity = activity; this.activity = activity;
...@@ -96,8 +94,6 @@ public class ChatMessageAdapter extends BaseAdapter implements UpdatableAdapter ...@@ -96,8 +94,6 @@ public class ChatMessageAdapter extends BaseAdapter implements UpdatableAdapter
} else { } else {
divider = " "; divider = " ";
} }
backgroundColors = activity.getResources().getIntArray(R.array.accout_chat_background);
} }
@Override @Override
...@@ -183,11 +179,7 @@ public class ChatMessageAdapter extends BaseAdapter implements UpdatableAdapter ...@@ -183,11 +179,7 @@ public class ChatMessageAdapter extends BaseAdapter implements UpdatableAdapter
TextView textView = (TextView) view.findViewById(R.id.text); TextView textView = (TextView) view.findViewById(R.id.text);
textView.setTextAppearance(activity, appearanceStyle); textView.setTextAppearance(activity, appearanceStyle);
if (incoming) { textView.getBackground().setAlpha(127);
ColorDrawable colorDrawable = new ColorDrawable(backgroundColors[AccountManager.getInstance().getColorLevel(account)]);
colorDrawable.setAlpha(64);
textView.setBackgroundDrawable(colorDrawable);
}
Spannable text = messageItem.getSpannable(); Spannable text = messageItem.getSpannable();
String time = StringUtils.getSmartTimeText(messageItem.getTimestamp()); String time = StringUtils.getSmartTimeText(messageItem.getTimestamp());
......
...@@ -38,7 +38,13 @@ ...@@ -38,7 +38,13 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_toRightOf="@id/avatar" android:layout_toRightOf="@id/avatar"
android:layout_toEndOf="@id/avatar" android:layout_toEndOf="@id/avatar"
android:padding="4dp"
android:paddingLeft="16dp"
android:paddingTop="6dp"
android:paddingBottom="6dp"
android:paddingRight="6dp"
android:paddingEnd="6dp"
android:layout_marginRight="48dp" android:layout_marginRight="48dp"
android:layout_marginEnd="48dp" android:layout_marginEnd="48dp"
...@@ -46,10 +52,14 @@ ...@@ -46,10 +52,14 @@
android:layout_marginBottom="4dp" android:layout_marginBottom="4dp"
android:layout_marginStart="4dp" android:layout_marginStart="40dp"
android:layout_marginLeft="4dp" android:layout_marginLeft="4dp"
android:textColor="@android:color/primary_text_light"
android:text="Some text\n line \nrgregrere" android:text="Some text\n line \nrgregrere"
android:background="@drawable/msg_in"
/> />
</RelativeLayout> </RelativeLayout>
...@@ -24,19 +24,25 @@ ...@@ -24,19 +24,25 @@
android:id="@+id/text" android:id="@+id/text"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:padding="4dp"
android:paddingLeft="6dp"
android:paddingTop="6dp"
android:paddingBottom="6dp"
android:paddingRight="16dp"
android:paddingEnd="16dp"
android:layout_marginLeft="48dp" android:layout_marginLeft="48dp"
android:layout_marginStart="48dp" android:layout_marginStart="48dp"
android:layout_marginTop="4dp" android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:layout_marginEnd="4dp" android:layout_marginEnd="4dp"
android:layout_marginRight="4dp" android:layout_marginRight="4dp"
android:textColor="@android:color/primary_text_light"
android:text="Some text\n line \nrgregrere" android:text="Some text\n line \nrgregrere"
android:background="@color/grey_600" android:background="@drawable/msg_out"
android:gravity="end" android:gravity="end"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment