Commit 5771fb70 by 霍志良

feat:消息类型-完成订单38

parent 8b48bff4
package com.yidianling.im.session.extension;
import com.alibaba.fastjson.JSONObject;
public class CustomAttachmentConfirmOrder extends CustomAttachment{
private static final String TITLE="title";//标题
private static final String STATUS="status";//状态,1代表已确认,0代表待确认
private static final String BOOKINGTIME="bookingTime";///咨询时间
private static final String SERVICETYPE="serviceType";//服务方式
private static final String ORDERID="orderId";//订单号
public String title;
public String status;
public String bookingtime;
public String servicetype;
public Long orderid;
CustomAttachmentConfirmOrder(int type) {
super(CustomAttachmentType.TYPE_CONFIRM_ORDER);
}
@Override
protected void parseData(JSONObject data) {
this.title=data.getString(TITLE);
this.status=data.getString(STATUS);
this.bookingtime=data.getString(BOOKINGTIME);
this.servicetype=data.getString(SERVICETYPE);
this.orderid=data.getLong(ORDERID);
}
@Override
protected JSONObject packData() {
JSONObject data = new JSONObject();
data.put(TITLE,title);
data.put(STATUS, status);
data.put(BOOKINGTIME, bookingtime);
data.put(SERVICETYPE, servicetype);
data.put(ORDERID, orderid);
return data;
}
}
......@@ -40,5 +40,6 @@ public interface CustomAttachmentType {
int TYPE_SWITCH_KEFU_TIPS=40;//客服切换第一次提示语
int TYPE_FILTER_41=41;//客服切换过滤41
int TYPE_FILTER_42=42;//客服切换过滤42
int TYPE_CONFIRM_ORDER=38;//确认订单
int TYPE_ORDER_ALREADY_DONE=39;//已完成订单
}
package com.yidianling.im.session.viewholder;
import android.annotation.SuppressLint;
import android.text.TextUtils;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;
import androidx.core.content.ContextCompat;
import com.netease.nimlib.sdk.msg.attachment.MsgAttachment;
import com.ydl.webview.H5Params;
import com.ydl.webview.NewH5Activity;
import com.yidianling.im.R;
import com.yidianling.im.session.extension.CustomAttachConsultSubScript;
import com.yidianling.im.session.extension.CustomAttachmentConfirmOrder;
import com.yidianling.nimbase.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.yidianling.uikit.business.session.viewholder.MsgViewHolderBase;
public class MsgViewHolderConfirmOrder extends MsgViewHolderBase {
private TextView tv_title, tv_date, tv_type;
private View lin_root;
private ImageView img_icon;
public String url;//跳转url
public int flag;//0 未确认 1已确认
public MsgViewHolderConfirmOrder(BaseMultiItemFetchLoadAdapter adapter) {
super(adapter);
}
@Override
protected int getContentResId() {
return R.layout.im_ui_message_custom_confirm_order;
}
@Override
protected void inflateContentView() {
tv_title = view.findViewById(R.id.tv_title);
tv_date = view.findViewById(R.id.tv_date);
tv_type = view.findViewById(R.id.tv_type);
lin_root = view.findViewById(R.id.lin_root);
img_icon = view.findViewById(R.id.img_icon);
if (isReceivedMessage()){
setAvatarRightInVisibity();
lin_root.setBackgroundResource(R.drawable.im_bg_radius_no_topleft_white_8);
}else {
setAvatarLeftInVisibity();
lin_root.setBackgroundResource(R.drawable.im_bg_radius_no_topright_white_8);
}
}
@SuppressLint("SetTextI18n")
@Override
protected void bindContentView() {
if (isReceivedMessage()){
setAvatarRightInVisibity();
}else {
setAvatarLeftInVisibity();
}
MsgAttachment attachment = message.getAttachment();
if (attachment instanceof CustomAttachmentConfirmOrder) {
tv_title.setText(((CustomAttachmentConfirmOrder) attachment).title);
tv_date.setText("咨询时间:"+((CustomAttachmentConfirmOrder) attachment).bookingtime);
tv_type.setText("服务方式:"+((CustomAttachmentConfirmOrder) attachment).servicetype);
}
hideItemBg();
}
@Override
protected void onItemClick() {
if (TextUtils.isEmpty(url)){
return;
}
NewH5Activity.start(context,new H5Params(url,null));
}
}
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/lin_root"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:paddingTop="8dp"
android:paddingBottom="12dp"
android:background="@drawable/im_bg_radius_no_topleft_white_8">
<ImageView
android:id="@+id/img_icon"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_marginRight="4dp"
android:layout_alignTop="@+id/tv_title"
android:layout_alignBottom="@+id/tv_title"
android:src="@mipmap/im_consult_data_sure"
android:visibility="gone"
tools:visibility="gone"/>
<TextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="14dp"
android:textColor="@color/im_color_242424"
android:layout_toRightOf="@+id/img_icon"
tools:text="我已完成本次咨询,请确认"/>
<RelativeLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:layout_below="@+id/tv_title"
android:layout_marginTop="8dp"
android:background="@drawable/im_bg_radius_f7_2">
<TextView
android:id="@+id/tv_package"
android:layout_width="24dp"
android:layout_height="14dp"
android:text="套餐"
android:layout_marginTop="3dp"
android:textSize="10dp"
android:textColor="@color/platform_color_FFFFFF"
android:gravity="center"
android:layout_marginRight="3dp"
android:visibility="gone"
android:background="@drawable/im_bg_radius_yellow_1" />
<TextView
android:id="@+id/tv_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/platform_color_999999"
android:textSize="10dp"
android:layout_marginTop="2dp"
android:layout_below="@+id/tv_package"
tools:text="咨询时间:2019-12-55 12:00:00"/>
<TextView
android:id="@+id/tv_type"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textColor="@color/platform_color_999999"
android:textSize="10dp"
android:layout_marginTop="2dp"
android:layout_below="@+id/tv_date"
tools:text="服务方式:电话"/>
</RelativeLayout>
</RelativeLayout>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment