Add send private message input bubble (fix input bubble shape)
This commit is contained in:
parent
704cc4a537
commit
6bd9c3104f
3 changed files with 49 additions and 1 deletions
src/main
java/eu/siacs/conversations/ui
res/drawable
|
@ -3949,7 +3949,7 @@ public class ConversationFragment extends XmppFragment
|
|||
}
|
||||
|
||||
public void updateSendButton() {
|
||||
messageListAdapter.setBubbleBackgroundColor(binding.messageInputBox, 0, isPrivateMessage(), true);
|
||||
messageListAdapter.setInputBubbleBackgroundColor(binding.messageInputBox, 0, isPrivateMessage(), true);
|
||||
boolean hasAttachments = mediaPreviewAdapter != null && mediaPreviewAdapter.hasAttachments();
|
||||
boolean useSendButtonToIndicateStatus = activity != null && PreferenceManager.getDefaultSharedPreferences(activity).getBoolean("send_button_status", getResources().getBoolean(R.bool.send_button_status));
|
||||
final Conversation c = this.conversation;
|
||||
|
|
|
@ -1980,6 +1980,39 @@ public class MessageAdapter extends ArrayAdapter<Message> {
|
|||
}
|
||||
}
|
||||
|
||||
public void setInputBubbleBackgroundColor(final View viewHolder, final int type,
|
||||
final boolean isPrivateMessage, final boolean isInValidSession) {
|
||||
if (type == RECEIVED) {
|
||||
if (isInValidSession) {
|
||||
if (isPrivateMessage) {
|
||||
viewHolder.setBackgroundResource(R.drawable.message_bubble_received_light_private);
|
||||
activity.setBubbleColor(viewHolder, StyledAttributes.getColor(activity, R.attr.color_bubble_light), StyledAttributes.getColor(activity, R.attr.colorAccent));
|
||||
} else {
|
||||
viewHolder.setBackgroundResource(R.drawable.message_bubble_received_light);
|
||||
activity.setBubbleColor(viewHolder, StyledAttributes.getColor(activity, R.attr.color_bubble_light), -1);
|
||||
}
|
||||
} else {
|
||||
if (isPrivateMessage) {
|
||||
viewHolder.setBackgroundResource(R.drawable.message_bubble_received_warning_private);
|
||||
activity.setBubbleColor(viewHolder, StyledAttributes.getColor(activity, R.attr.color_bubble_warning), StyledAttributes.getColor(activity, R.attr.colorAccent));
|
||||
} else {
|
||||
viewHolder.setBackgroundResource(R.drawable.message_bubble_received_warning);
|
||||
activity.setBubbleColor(viewHolder, StyledAttributes.getColor(activity, R.attr.color_bubble_warning), -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (type == SENT) {
|
||||
if (isPrivateMessage) {
|
||||
viewHolder.setBackgroundResource(R.drawable.input_bubble_sent_private);
|
||||
activity.setBubbleColor(viewHolder, StyledAttributes.getColor(activity, R.attr.color_bubble_dark), StyledAttributes.getColor(activity, R.attr.colorAccent));
|
||||
} else {
|
||||
viewHolder.setBackgroundResource(R.drawable.input_bubble_light);
|
||||
activity.setBubbleColor(viewHolder, StyledAttributes.getColor(activity, R.attr.color_bubble_dark), -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class ThumbnailTask extends AsyncTask<DownloadableFile, Void, Drawable[]> {
|
||||
@Override
|
||||
protected Drawable[] doInBackground(DownloadableFile... params) {
|
||||
|
|
15
src/main/res/drawable/input_bubble_sent_private.xml
Normal file
15
src/main/res/drawable/input_bubble_sent_private.xml
Normal file
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
|
||||
<stroke android:width="2dp" android:color="@color/accent"/>
|
||||
<corners
|
||||
android:topLeftRadius="30dp"
|
||||
android:topRightRadius="30dp"
|
||||
android:bottomRightRadius="30dp"
|
||||
android:bottomLeftRadius="30dp" />
|
||||
<padding
|
||||
android:bottom="4dp"
|
||||
android:left="6dp"
|
||||
android:right="6dp"
|
||||
android:top="4dp" />
|
||||
<solid android:color="@color/darkblue" />
|
||||
</shape>
|
Loading…
Add table
Reference in a new issue