mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
create separate videochat-item, based on update item
This commit is contained in:
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<org.thoughtcrime.securesms.ConversationVideochatItem
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/conversation_item_background"
|
||||
android:focusable="true"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="13dp"
|
||||
android:paddingBottom="13dp"
|
||||
android:paddingLeft="28dp"
|
||||
android:paddingRight="28dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/conversation_update_body"
|
||||
style="@style/Delta.Text.UpdateHeader"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:autoLink="none"
|
||||
android:linksClickable="false"
|
||||
android:gravity="center"
|
||||
android:textColor="?attr/conversation_item_update_text_color"
|
||||
android:background="@drawable/conversation_item_update_background"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingTop="3dp"
|
||||
android:paddingRight="10dp"
|
||||
android:paddingBottom="3dp"
|
||||
tools:text="Paddy invited to a video chat" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</org.thoughtcrime.securesms.ConversationVideochatItem>
|
||||
@@ -213,6 +213,8 @@
|
||||
<string name="file_saved_to">File saved to \"%1$s\".</string>
|
||||
|
||||
<string name="videochat">Video chat</string>
|
||||
<string name="videochat_contact_invited_hint">%1$s invited to a video chat.</string>
|
||||
<string name="videochat_you_invited_hint">You invited to a video chat.</string>
|
||||
|
||||
<!-- get confirmations -->
|
||||
<string name="ask_leave_group">Are you sure you want to leave this group?</string>
|
||||
|
||||
@@ -76,6 +76,7 @@ public class ConversationAdapter <V extends View & BindableConversationItem>
|
||||
private static final int MESSAGE_TYPE_THUMBNAIL_INCOMING = 6;
|
||||
private static final int MESSAGE_TYPE_DOCUMENT_OUTGOING = 7;
|
||||
private static final int MESSAGE_TYPE_DOCUMENT_INCOMING = 8;
|
||||
private static final int MESSAGE_TYPE_VIDEOCHAT_INVITE = 9;
|
||||
|
||||
private final Set<DcMsg> batchSelected = Collections.synchronizedSet(new HashSet<DcMsg>());
|
||||
|
||||
@@ -266,6 +267,7 @@ public class ConversationAdapter <V extends View & BindableConversationItem>
|
||||
case MESSAGE_TYPE_DOCUMENT_INCOMING:
|
||||
case MESSAGE_TYPE_INCOMING: return R.layout.conversation_item_received;
|
||||
case MESSAGE_TYPE_INFO: return R.layout.conversation_item_update;
|
||||
case MESSAGE_TYPE_VIDEOCHAT_INVITE:return R.layout.conversation_item_videochat;
|
||||
default: throw new IllegalArgumentException("unsupported item view type given to ConversationAdapter");
|
||||
}
|
||||
}
|
||||
@@ -286,6 +288,9 @@ public class ConversationAdapter <V extends View & BindableConversationItem>
|
||||
else if (type==DcMsg.DC_MSG_IMAGE || type==DcMsg.DC_MSG_GIF || type==DcMsg.DC_MSG_VIDEO) {
|
||||
return dcMsg.isOutgoing()? MESSAGE_TYPE_THUMBNAIL_OUTGOING : MESSAGE_TYPE_THUMBNAIL_INCOMING;
|
||||
}
|
||||
else if (type == DcMsg.DC_MSG_VIDEOCHAT_INVITATION) {
|
||||
return MESSAGE_TYPE_VIDEOCHAT_INVITE;
|
||||
}
|
||||
else {
|
||||
return dcMsg.isOutgoing()? MESSAGE_TYPE_OUTGOING : MESSAGE_TYPE_INCOMING;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
package org.thoughtcrime.securesms;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.b44t.messenger.DcChat;
|
||||
import com.b44t.messenger.DcContact;
|
||||
import com.b44t.messenger.DcContext;
|
||||
import com.b44t.messenger.DcMsg;
|
||||
|
||||
import org.thoughtcrime.securesms.connect.DcHelper;
|
||||
import org.thoughtcrime.securesms.mms.GlideRequests;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
|
||||
public class ConversationVideochatItem extends LinearLayout
|
||||
implements BindableConversationItem
|
||||
{
|
||||
private TextView body;
|
||||
private DcMsg dcMsg;
|
||||
|
||||
public ConversationVideochatItem(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public ConversationVideochatItem(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFinishInflate() {
|
||||
super.onFinishInflate();
|
||||
this.body = findViewById(R.id.conversation_update_body);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bind(@NonNull DcMsg dcMsg,
|
||||
@NonNull DcChat dcChat,
|
||||
@NonNull GlideRequests glideRequests,
|
||||
@NonNull Locale locale,
|
||||
@NonNull Set<DcMsg> batchSelected,
|
||||
@NonNull Recipient conversationRecipient,
|
||||
boolean pulseUpdate)
|
||||
{
|
||||
this.dcMsg = dcMsg;
|
||||
DcContext dcContext = DcHelper.getContext(getContext());
|
||||
DcContact dcContact = dcContext.getContact(dcMsg.getFromId());
|
||||
body.setText(dcMsg.isOutgoing()?
|
||||
getContext().getString(R.string.videochat_you_invited_hint) :
|
||||
getContext().getString(R.string.videochat_contact_invited_hint, dcContact.getFirstName()));
|
||||
setSelected(batchSelected.contains(dcMsg));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setEventListener(@Nullable EventListener listener) {
|
||||
// No events to report yet
|
||||
}
|
||||
|
||||
@Override
|
||||
public DcMsg getMessageRecord() {
|
||||
return dcMsg;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unbind() {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user