mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
make deaddrop-background compatible to selection-background
This commit is contained in:
@@ -48,6 +48,7 @@ class ConversationListAdapter extends RecyclerView.Adapter {
|
||||
private static final int MESSAGE_TYPE_SWITCH_ARCHIVE = 1;
|
||||
private static final int MESSAGE_TYPE_THREAD = 2;
|
||||
private static final int MESSAGE_TYPE_INBOX_ZERO = 3;
|
||||
private static final int MESSAGE_TYPE_DEADDROP = 4; // DEADDROP is modified on construction so it cannot be reused as THREAD
|
||||
|
||||
private final @NonNull ApplicationDcContext dcContext;
|
||||
private @NonNull DcChatlist dcChatlist;
|
||||
@@ -138,7 +139,10 @@ class ConversationListAdapter extends RecyclerView.Adapter {
|
||||
public int getItemViewType(int i) {
|
||||
int chatId = dcChatlist.getChatId(i);
|
||||
|
||||
if (chatId == DcChat.DC_CHAT_ID_ARCHIVED_LINK) {
|
||||
if (chatId==DcChat.DC_CHAT_ID_DEADDROP) {
|
||||
return MESSAGE_TYPE_DEADDROP;
|
||||
}
|
||||
else if (chatId == DcChat.DC_CHAT_ID_ARCHIVED_LINK) {
|
||||
return MESSAGE_TYPE_SWITCH_ARCHIVE;
|
||||
} else if(chatId == DcChat.DC_CHAT_ID_ALLDONE_HINT) {
|
||||
return MESSAGE_TYPE_INBOX_ZERO;
|
||||
|
||||
@@ -32,6 +32,7 @@ import android.text.Spanned;
|
||||
import android.text.TextUtils;
|
||||
import android.text.style.StyleSpan;
|
||||
import android.util.AttributeSet;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
@@ -305,21 +306,20 @@ public class ConversationListItem extends RelativeLayout
|
||||
|
||||
private void setRippleColor(Recipient recipient) {
|
||||
if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
|
||||
// TODO: a different backgroupd for the deaddrop would be nice, however the following code collades with the selected state and should be fixex
|
||||
|
||||
// if(threadId==DcChat.DC_CHAT_ID_DEADDROP) {
|
||||
// TypedArray ta = getContext().obtainStyledAttributes(new int[] { R.attr.conversation_list_deaddrop_bg_color});
|
||||
// setBackgroundColor(ta.getColor(0, 0xffffffff));
|
||||
// ta.recycle();
|
||||
// }
|
||||
// else {
|
||||
// TypedArray ta = getContext().obtainStyledAttributes(new int[] { R.attr.conversation_list_item_background});
|
||||
// setBackground(ta.getDrawable(0));
|
||||
// ta.recycle();
|
||||
|
||||
((RippleDrawable)(getBackground()).mutate())
|
||||
.setColor(ColorStateList.valueOf(recipient.getColor().toConversationColor(getContext())));
|
||||
// }
|
||||
if(threadId==DcChat.DC_CHAT_ID_DEADDROP) {
|
||||
TypedArray ta = getContext().obtainStyledAttributes(new int[] { R.attr.conversation_list_deaddrop_bg_color});
|
||||
setBackgroundColor(ta.getColor(0, 0xffffffff));
|
||||
ta.recycle();
|
||||
}
|
||||
else {
|
||||
try {
|
||||
((RippleDrawable) (getBackground()).mutate())
|
||||
.setColor(ColorStateList.valueOf(recipient.getColor().toConversationColor(getContext())));
|
||||
}
|
||||
catch (Exception e) {
|
||||
Log.i(TAG, "Item was converted to Deaddrop-Item with a colored background, this is not undoable");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user