Fixed display of deletion checkbox in edit mode
This commit is contained in:
parent
404c92da9f
commit
dc8c5c3e2d
4 changed files with 39 additions and 18 deletions
|
@ -89,7 +89,8 @@ public class ChatMessageViewHolder extends RecyclerView.ViewHolder implements Vi
|
|||
|
||||
public FlexboxLayout pictures;
|
||||
|
||||
public CheckBox delete;
|
||||
public CheckBox deleteEvent;
|
||||
public CheckBox deleteMessage;
|
||||
private ClickListener mListener;
|
||||
|
||||
public ChatMessageViewHolder(Context context, View view, ClickListener listener) {
|
||||
|
@ -119,7 +120,8 @@ public class ChatMessageViewHolder extends RecyclerView.ViewHolder implements Vi
|
|||
|
||||
pictures = view.findViewById(R.id.pictures);
|
||||
|
||||
delete = view.findViewById(R.id.delete_message);
|
||||
deleteEvent = view.findViewById(R.id.delete_event);
|
||||
deleteMessage = view.findViewById(R.id.delete_message);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -79,23 +79,24 @@ public class ChatMessagesAdapter extends SelectableAdapter<ChatMessageViewHolder
|
|||
public void onBindViewHolder(@NonNull final ChatMessageViewHolder holder, int position) {
|
||||
EventLog event = mHistory.get(position);
|
||||
|
||||
holder.delete.setVisibility(View.GONE);
|
||||
holder.deleteEvent.setVisibility(View.GONE);
|
||||
holder.deleteMessage.setVisibility(View.GONE);
|
||||
holder.eventLayout.setVisibility(View.GONE);
|
||||
holder.securityEventLayout.setVisibility(View.GONE);
|
||||
holder.rightAnchor.setVisibility(View.GONE);
|
||||
holder.bubbleLayout.setVisibility(View.GONE);
|
||||
holder.sendInProgress.setVisibility(View.GONE);
|
||||
|
||||
if (isEditionEnabled()) {
|
||||
holder.delete.setOnCheckedChangeListener(null);
|
||||
holder.delete.setChecked(isSelected(position));
|
||||
holder.delete.setTag(position);
|
||||
}
|
||||
|
||||
if (event.getType() == EventLog.Type.ConferenceChatMessage) {
|
||||
ChatMessage message = event.getChatMessage();
|
||||
message.setUserData(holder);
|
||||
|
||||
if (isEditionEnabled()) {
|
||||
holder.deleteMessage.setVisibility(View.VISIBLE);
|
||||
holder.deleteMessage.setChecked(isSelected(position));
|
||||
holder.deleteMessage.setTag(position);
|
||||
}
|
||||
|
||||
if (message.isOutgoing() && message.getState() != ChatMessage.State.Displayed) {
|
||||
message.setListener(new ChatMessageListenerStub() {
|
||||
@Override
|
||||
|
@ -121,6 +122,12 @@ public class ChatMessagesAdapter extends SelectableAdapter<ChatMessageViewHolder
|
|||
holder.bindMessage(message, contact);
|
||||
changeBackgroundDependingOnPreviousAndNextEvents(message, holder, position);
|
||||
} else { // Event is not chat message
|
||||
if (isEditionEnabled()) {
|
||||
holder.deleteEvent.setVisibility(View.VISIBLE);
|
||||
holder.deleteEvent.setChecked(isSelected(position));
|
||||
holder.deleteEvent.setTag(position);
|
||||
}
|
||||
|
||||
Address address = event.getParticipantAddress();
|
||||
String displayName = null;
|
||||
if (address != null) {
|
||||
|
|
|
@ -126,7 +126,8 @@ public class ImdnFragment extends Fragment {
|
|||
Address remoteSender = mMessage.getFromAddress();
|
||||
LinphoneContact contact = ContactsManager.getInstance().findContactFromAddress(remoteSender);
|
||||
|
||||
mBubble.delete.setVisibility(View.GONE);
|
||||
mBubble.deleteMessage.setVisibility(View.GONE);
|
||||
mBubble.deleteEvent.setVisibility(View.GONE);
|
||||
mBubble.eventLayout.setVisibility(View.GONE);
|
||||
mBubble.securityEventLayout.setVisibility(View.GONE);
|
||||
mBubble.rightAnchor.setVisibility(View.GONE);
|
||||
|
|
|
@ -11,16 +11,15 @@
|
|||
android:layout_alignParentTop="true"/>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/delete_message"
|
||||
android:visibility="gone"
|
||||
android:id="@+id/delete_event"
|
||||
android:button="@drawable/checkbox"
|
||||
android:contentDescription="@string/content_description_delete"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:clickable="false"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_alignRight="@id/rightAnchor"/>
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignParentTop="true"/>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/event"
|
||||
|
@ -28,7 +27,7 @@
|
|||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@id/delete_message"
|
||||
android:layout_toLeftOf="@id/delete_event"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:gravity="center"
|
||||
|
@ -51,7 +50,7 @@
|
|||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toLeftOf="@id/delete_message"
|
||||
android:layout_toLeftOf="@id/delete_event"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:gravity="center"
|
||||
|
@ -78,6 +77,7 @@
|
|||
android:id="@+id/background"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_marginLeft="45dp"
|
||||
android:layout_marginTop="1dp"
|
||||
android:layout_marginBottom="1dp"
|
||||
|
@ -129,14 +129,25 @@
|
|||
android:layout_marginLeft="45dp"
|
||||
android:layout_toLeftOf="@id/imdn"/>
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/delete_message"
|
||||
android:button="@drawable/checkbox"
|
||||
android:contentDescription="@string/content_description_delete"
|
||||
android:layout_width="30dp"
|
||||
android:layout_height="30dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:clickable="false"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignTop="@id/background"/>
|
||||
|
||||
<ImageView
|
||||
android:id="@id/imdn"
|
||||
android:layout_width="10dp"
|
||||
android:layout_height="10dp"
|
||||
android:src="@drawable/imdn_received"
|
||||
android:layout_marginLeft="5dp"
|
||||
android:layout_marginRight="5dp"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_alignLeft="@id/delete_message"
|
||||
android:layout_alignBottom="@id/background"/>
|
||||
|
||||
<ProgressBar
|
||||
|
|
Loading…
Reference in a new issue