update 修正聊天页在线离线状态

update 聊天页长按删除功能
This commit is contained in:
zlzw 2024-03-21 18:02:47 +08:00
parent c3ca76df07
commit d39facbcc7
8 changed files with 67 additions and 18 deletions

View File

@ -257,6 +257,8 @@ public class IMLoginModel extends BaseModel {
private String guardType = ""; private String guardType = "";
@SerializedName("isAttention") @SerializedName("isAttention")
private int attention; private int attention;
@SerializedName("type")
private String type;
public int getAttention() { public int getAttention() {
return attention; return attention;
@ -270,6 +272,14 @@ public class IMLoginModel extends BaseModel {
return createTime; return createTime;
} }
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
public IMLoginModel setCreateTime(String createTime) { public IMLoginModel setCreateTime(String createTime) {
this.createTime = createTime; this.createTime = createTime;
return this; return this;

View File

@ -108,7 +108,7 @@ public class MessageUserInfoBean extends BaseModel{
@SerializedName("open_off") @SerializedName("open_off")
private int openOff;//接单设置 1开启 2关闭 private int openOff;//接单设置 1开启 2关闭
@SerializedName("rong_online") @SerializedName("rong_online")
private int rongOnline; private int rongOnline;//0 在线 非0 其他
public void setOpenOff(int openOff) { public void setOpenOff(int openOff) {
this.openOff = openOff; this.openOff = openOff;

View File

@ -52,14 +52,14 @@ public class MessageLongClickPopuwindow implements View.OnClickListener {
Log.e("MessageLongClick ", "currentTimeMillis:" + System.currentTimeMillis()); Log.e("MessageLongClick ", "currentTimeMillis:" + System.currentTimeMillis());
Log.e("MessageLongClick ", "秒:" + ((System.currentTimeMillis() - sentTime) / 1000)); Log.e("MessageLongClick ", "秒:" + ((System.currentTimeMillis() - sentTime) / 1000));
//超过俩分钟无法撤回 //超过俩分钟无法撤回
if (((System.currentTimeMillis() - sentTime) / 1000) > 120) { /* if (((System.currentTimeMillis() - sentTime) / 1000) > 120) {
withdrawLinear.setVisibility(View.GONE); withdrawLinear.setVisibility(View.GONE);
} }
//只可以撤回自己的消息 //只可以撤回自己的消息
IMLoginModel model = IMLoginManager.get(mContext).getUserInfo(); IMLoginModel model = IMLoginManager.get(mContext).getUserInfo();
if (!message.getSenderUserId().equals(String.valueOf(model.getId()))) { if (!message.getSenderUserId().equals(String.valueOf(model.getId()))) {
withdrawLinear.setVisibility(View.GONE); withdrawLinear.setVisibility(View.GONE);
} }*/
//非文字信息无法复制 //非文字信息无法复制
if (!message.getObjectName().equals("RC:TxtMsg")) { if (!message.getObjectName().equals("RC:TxtMsg")) {
copyLinear.setVisibility(View.GONE); copyLinear.setVisibility(View.GONE);
@ -106,7 +106,8 @@ public class MessageLongClickPopuwindow implements View.OnClickListener {
copyMethod(); copyMethod();
popupWindow.dismiss(); popupWindow.dismiss();
} else if (id == R.id.withdraw_linear) {//撤回 } else if (id == R.id.withdraw_linear) {//撤回
withdrawMethod(); // withdrawMethod();
delete();
popupWindow.dismiss(); popupWindow.dismiss();
} else if (id == R.id.quote_linear) {//引用 } else if (id == R.id.quote_linear) {//引用
List<MessageItemLongClickAction> messageItemLongClickActionList = MessageItemLongClickActionManager.getInstance().getMessageItemLongClickActions(); List<MessageItemLongClickAction> messageItemLongClickActionList = MessageItemLongClickActionManager.getInstance().getMessageItemLongClickActions();
@ -115,6 +116,20 @@ public class MessageLongClickPopuwindow implements View.OnClickListener {
} }
private void delete() {
IMCenter.getInstance().deleteMessages(message.getConversationType(), message.getTargetId(), new int[]{message.getMessageId()}, new RongIMClient.ResultCallback<Boolean>() {
@Override
public void onSuccess(Boolean aBoolean) {
}
@Override
public void onError(RongIMClient.ErrorCode e) {
}
});
}
private void copyMethod() { private void copyMethod() {
//文字消息支持复制 //文字消息支持复制
if (message.getContent() instanceof TextMessage) { if (message.getContent() instanceof TextMessage) {

View File

@ -10,24 +10,25 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:orientation="horizontal"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:padding="10dp"> android:padding="10dp">
<LinearLayout <LinearLayout
android:id="@+id/copy_linear" android:id="@+id/copy_linear"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"
android:padding="5dp"> android:padding="5dp">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableTop="@mipmap/icon_message_copy"
android:drawablePadding="5dp" android:drawablePadding="5dp"
android:text="@string/copy" android:text="@string/copy"
android:textColor="@color/white" android:textColor="@color/white"
@ -38,18 +39,17 @@
<LinearLayout <LinearLayout
android:id="@+id/withdraw_linear" android:id="@+id/withdraw_linear"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:orientation="vertical"
android:padding="5dp"> android:padding="5dp">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:drawableTop="@mipmap/icon_message_withdraw"
android:drawablePadding="5dp" android:drawablePadding="5dp"
android:text="@string/withdraw" android:text="@string/delete"
android:textColor="@color/white" android:textColor="@color/white"
android:textSize="16sp" /> android:textSize="16sp" />
@ -58,12 +58,12 @@
<LinearLayout <LinearLayout
android:id="@+id/quote_linear" android:id="@+id/quote_linear"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_weight="1"
android:visibility="gone"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:layout_weight="1"
android:gravity="center_horizontal" android:gravity="center_horizontal"
android:padding="5dp"> android:orientation="vertical"
android:padding="5dp"
android:visibility="gone">
<TextView <TextView
android:layout_width="wrap_content" android:layout_width="wrap_content"

View File

@ -270,13 +270,18 @@ public class PDLiveConversationActivity extends AbsActivity implements View.OnCl
ImgLoader.display(mContext, data.getUser().getAvatar(), ViewUtils.findViewById(card, R.id.rc_conversation_portrait, ImageView.class)); ImgLoader.display(mContext, data.getUser().getAvatar(), ViewUtils.findViewById(card, R.id.rc_conversation_portrait, ImageView.class));
ViewUtils.findViewById(card, R.id.userName, TextView.class).setText(data.getUser().getUserNicename()); ViewUtils.findViewById(card, R.id.userName, TextView.class).setText(data.getUser().getUserNicename());
ViewUtils.findViewById(card, R.id.sign, TextView.class).setText(data.getUser().getSignature()); ViewUtils.findViewById(card, R.id.sign, TextView.class).setText(data.getUser().getSignature());
if (data.getInfo().getRongOnline() == 1) { if (data.getInfo().getRongOnline() == 0) {
ViewUtils.findViewById(card, R.id.user_status, TextView.class).setText(R.string.activity_msg_chat_top_status_online); ViewUtils.findViewById(card, R.id.user_status, TextView.class).setText(R.string.activity_msg_chat_top_status_online);
ViewUtils.findViewById(card, R.id.userStatusIcon, ImageView.class).setImageResource(R.mipmap.icon_green); ViewUtils.findViewById(card, R.id.userStatusIcon, ImageView.class).setImageResource(R.mipmap.icon_green);
} else { } else {
ViewUtils.findViewById(card, R.id.user_status, TextView.class).setText(R.string.activity_msg_chat_top_status_offline); ViewUtils.findViewById(card, R.id.user_status, TextView.class).setText(R.string.activity_msg_chat_top_status_offline);
ViewUtils.findViewById(card, R.id.userStatusIcon, ImageView.class).setImageResource(R.mipmap.icon_gray); ViewUtils.findViewById(card, R.id.userStatusIcon, ImageView.class).setImageResource(R.mipmap.icon_gray);
} }
if("C".equals(data.getUser().getType())){
ViewUtils.findViewById(card,R.id.user_auth_status).setVisibility(View.VISIBLE);
}else{
ViewUtils.findViewById(card,R.id.user_auth_status).setVisibility(View.GONE);
}
showBanner(); showBanner();
showTag(); showTag();
if (data.getUser().getAttention() == 0) { if (data.getUser().getAttention() == 0) {

View File

@ -94,6 +94,16 @@
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" /> app:layout_constraintTop_toTopOf="parent" />
<pl.droidsonroids.gif.GifImageView
android:id="@+id/liveStatus"
android:layout_width="wrap_content"
android:layout_height="20dp"
android:layout_marginTop="-10dp"
android:src="@mipmap/icon_liveing_cn"
android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/rc_conversation_portrait" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
<TextView <TextView
@ -132,6 +142,14 @@
android:layout_gravity="top" android:layout_gravity="top"
android:layout_marginStart="5dp" android:layout_marginStart="5dp"
android:src="@mipmap/icon_green" /> android:src="@mipmap/icon_green" />
<ImageView
android:id="@+id/user_auth_status"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:srcCompat="@mipmap/ic_chat_auth"
tools:layout_editor_absoluteX="124dp"
tools:layout_editor_absoluteY="17dp" />
</LinearLayout> </LinearLayout>
<TextView <TextView
@ -182,7 +200,6 @@
android:textColor="#FFFFFF" android:textColor="#FFFFFF"
android:textSize="13sp" android:textSize="13sp"
app:autoSizeMaxTextSize="13sp" app:autoSizeMaxTextSize="13sp"
app:autoSizeMinTextSize="3sp" app:autoSizeMinTextSize="3sp"
app:autoSizeStepGranularity="1sp" app:autoSizeStepGranularity="1sp"
app:autoSizeTextType="uniform" app:autoSizeTextType="uniform"
@ -217,6 +234,8 @@
app:layout_constraintStart_toStartOf="@+id/avatar_list" app:layout_constraintStart_toStartOf="@+id/avatar_list"
tools:itemCount="9" tools:itemCount="9"
tools:listitem="@layout/view_msg_chat_top_tag" /> tools:listitem="@layout/view_msg_chat_top_tag" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB