Commit d3d0e5ec by 霍志良

feat:im-灵犀2.0-添加首问语卡片

parent f15e59c0
......@@ -45,6 +45,7 @@ import com.yidianling.im.session.extension.CustomAttachConsultCallStatus;
import com.yidianling.im.session.extension.CustomAttachConsultPerfectData;
import com.yidianling.im.session.extension.CustomAttachConsultSubScript;
import com.yidianling.im.session.extension.CustomAttachLingxiAnswerQuestion;
import com.yidianling.im.session.extension.CustomAttachLingxiFirstQuestion;
import com.yidianling.im.session.extension.CustomAttachLingxiWhichQuestion;
import com.yidianling.im.session.extension.CustomAttachModifyTime;
import com.yidianling.im.session.extension.CustomAttachParser;
......@@ -89,6 +90,7 @@ import com.yidianling.im.session.viewholder.MsgViewHolderDefCustom;
import com.yidianling.im.session.viewholder.MsgViewHolderEvaluate;
import com.yidianling.im.session.viewholder.MsgViewHolderJumpToDaoYi;
import com.yidianling.im.session.viewholder.MsgViewHolderLingxiAnswerQuestion;
import com.yidianling.im.session.viewholder.MsgViewHolderLingxiFirstQuestion;
import com.yidianling.im.session.viewholder.MsgViewHolderLingxiWhichQuestion;
import com.yidianling.im.session.viewholder.MsgViewHolderModifyTime;
import com.yidianling.im.session.viewholder.MsgViewHolderOrderAlreadyDone;
......@@ -471,6 +473,8 @@ public class SessionHelper {
NimUIKit.registerMsgItemViewHolder(CustomAttachmentOrderAlreadyDone.class, MsgViewHolderOrderAlreadyDone.class);//已完成订单消息类型39
NimUIKit.registerMsgItemViewHolder(CustomAttachLingxiWhichQuestion.class, MsgViewHolderLingxiWhichQuestion.class);//灵犀2.0-您想要咨询下列哪些问题
NimUIKit.registerMsgItemViewHolder(CustomAttachLingxiAnswerQuestion.class, MsgViewHolderLingxiAnswerQuestion.class);//灵犀2.0-回答问题
NimUIKit.registerMsgItemViewHolder(CustomAttachLingxiFirstQuestion.class, MsgViewHolderLingxiFirstQuestion.class);//灵犀2.0-首问语
}
......
package com.yidianling.im.session.extension;
import com.alibaba.fastjson.JSONObject;
public class CustomAttachLingxiFirstQuestion extends CustomAttachment {
private final String GREETIMAGE = "greetImage";//图片
private final String GREETVIDEO = "greetVideo";//视频
private final String GREETURL = "greetUrl";//url链接
public String greetImage;
public String greetVideo;
public String greetUrl;
public CustomAttachLingxiFirstQuestion() {
super(CustomAttachmentType.TYPE_LINGXI_FIRST_QUESTION);
}
@Override
protected void parseData(JSONObject data) {
this.greetImage = data.getString(GREETIMAGE);
this.greetVideo = data.getString(GREETVIDEO);
this.greetUrl = data.getString(GREETURL);
}
@Override
protected JSONObject packData() {
JSONObject data = new JSONObject();
data.put(GREETIMAGE, greetImage);
data.put(GREETVIDEO, greetVideo);
data.put(GREETURL, GREETURL);
return data;
}
}
......@@ -151,6 +151,9 @@ public class CustomAttachParser implements MsgAttachmentParser {
case CustomAttachmentType.TYPE_LINGXI_JUMP_CONFIDE_LIST: // 跳转倾诉列表
attachment = new CustomAttachLingXiJumpConfideList();
break;
case CustomAttachmentType.TYPE_LINGXI_FIRST_QUESTION: //首问语
attachment = new CustomAttachLingxiFirstQuestion();
break;
default:
attachment = new DefaultCustomAttachment();
break;
......
......@@ -44,6 +44,7 @@ public interface CustomAttachmentType {
int TYPE_ORDER_ALREADY_DONE=39;//已完成订单
//灵犀2.0问诊数据
int TYPE_LINGXI_FIRST_QUESTION=50;//首问语
int TYPE_LINGXI_WHICH_QUESTION=55;//试卷消息
int TYPE_LINGXI_ANSWER_QUESTION=56;//回答消息
int TYPE_LINGXI_TEST_QUESTION=60;//测评结果
......
package com.yidianling.im.session.viewholder;
import android.widget.ImageView;
import com.ydl.webview.H5Params;
import com.ydl.webview.NewH5Activity;
import com.ydl.ydl_image.module.GlideApp;
import com.yidianling.im.R;
import com.yidianling.im.session.extension.CustomAttachLingxiFirstQuestion;
import com.yidianling.nimbase.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.yidianling.uikit.business.session.activity.WatchVideoActivity;
import com.yidianling.uikit.business.session.viewholder.MsgViewHolderBase;
public class MsgViewHolderLingxiFirstQuestion extends MsgViewHolderBase {
private ImageView imageView;
private String jumpUrl;
private String jumpVideo;
private String imageUrl;
public MsgViewHolderLingxiFirstQuestion(BaseMultiItemFetchLoadAdapter adapter) {
super(adapter);
}
@Override
protected int getContentResId() {
return R.layout.im_nim_lingxi_first_question;
}
@Override
protected void inflateContentView() {
imageView=findViewById(R.id.first_question);
}
@Override
protected void bindContentView() {
jumpUrl=((CustomAttachLingxiFirstQuestion) message.getAttachment()).greetUrl;
jumpVideo=((CustomAttachLingxiFirstQuestion) message.getAttachment()).greetVideo;
imageUrl=((CustomAttachLingxiFirstQuestion) message.getAttachment()).greetImage;
GlideApp.with(context)
.load(imageUrl)
.into(imageView);
}
@Override
protected void onItemClick() {
super.onItemClick();
if (jumpUrl.length()>0&&jumpUrl!=null){
//跳转URL
NewH5Activity.start(context,new H5Params(jumpUrl,null));
}/* else if (jumpVideo!=null&&!jumpVideo.isEmpty()){
//播放视频
NewH5Activity.start(context,new H5Params(jumpVideo,null));
}*/
}
}
......@@ -122,7 +122,6 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
break;
}
}
questionList.get(0).setName("其他");
if (customAttachLingxiWhichQuestion.type!=null){
switch (customAttachLingxiWhichQuestion.type){
case "radio"://您想要咨询下列哪类的问题?(单选)
......
<?xml version="1.0" encoding="utf-8"?>
<ImageView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="260dp"
android:layout_height="260dp"
android:scaleType="fitXY"
android:id="@+id/first_question"
>
</ImageView>
\ No newline at end of file
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