diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-05-03 22:06:18 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-05-03 22:06:18 +0200 |
commit | 75f7ec90466e6cbfc4220bd59b78a6230dc8fef7 (patch) | |
tree | 2908d844114d0df2916934265a41feaaf2273462 | |
parent | ab3e365fec77fa49294bde344c0be4fa212ea4f6 (diff) |
fixed regression of not highlighting current conversation in overview
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java | 9 | ||||
-rw-r--r-- | src/main/res/layout/conversation_list_row.xml | 1 |
2 files changed, 8 insertions, 2 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java index 804e71eaf..c35e13328 100644 --- a/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java +++ b/src/main/java/de/pixart/messenger/ui/adapter/ConversationAdapter.java @@ -16,6 +16,7 @@ import android.util.Pair; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; +import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.TextView; @@ -28,6 +29,7 @@ import de.pixart.messenger.entities.Conversation; import de.pixart.messenger.entities.Message; import de.pixart.messenger.entities.MucOptions; import de.pixart.messenger.entities.Transferable; +import de.pixart.messenger.ui.ConversationFragment; import de.pixart.messenger.ui.XmppActivity; import de.pixart.messenger.ui.util.Color; import de.pixart.messenger.ui.widget.UnreadCountCustomView; @@ -78,8 +80,7 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationAdapte public ConversationViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { LayoutInflater inflater = (LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE); View view = inflater.inflate(R.layout.conversation_list_row, parent, false); - ConversationViewHolder conversationViewHolder = ConversationViewHolder.get(view); - return conversationViewHolder; + return ConversationViewHolder.get(view); } @Override @@ -99,6 +100,8 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationAdapte viewHolder.name.setText(conversation.getJid().asBareJid().toString()); } + viewHolder.frame.setBackgroundColor(Color.get(activity, conversation == ConversationFragment.getConversation(activity) ? R.attr.color_background_secondary : R.attr.color_background_primary)); + Message message = conversation.getLatestMessage(); final int failedCount = conversation.failedCount(); final int unreadCount = conversation.unreadCount(); @@ -357,6 +360,7 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationAdapte private ImageView receivedStatus; private ImageView readStatus; private ImageView avatar; + private FrameLayout frame; private ConversationViewHolder(View view) { super(view); @@ -366,6 +370,7 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationAdapte ConversationViewHolder conversationViewHolder = (ConversationViewHolder) layout.getTag(); if (conversationViewHolder == null) { conversationViewHolder = new ConversationViewHolder(layout); + conversationViewHolder.frame = layout.findViewById(R.id.frame); conversationViewHolder.name = layout.findViewById(R.id.conversation_name); conversationViewHolder.lastMessage = layout.findViewById(R.id.conversation_lastmsg); conversationViewHolder.lastMessageIcon = layout.findViewById(R.id.conversation_lastmsg_img); diff --git a/src/main/res/layout/conversation_list_row.xml b/src/main/res/layout/conversation_list_row.xml index 3ce42ad58..6acc6a56f 100644 --- a/src/main/res/layout/conversation_list_row.xml +++ b/src/main/res/layout/conversation_list_row.xml @@ -5,6 +5,7 @@ android:descendantFocusability="blocksDescendants"> <FrameLayout + android:id="@+id/frame" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="?attr/color_background_primary"> |