Commit 5455aa49 by 霍志良

feat:im-灵犀2.0-您想要咨询下列哪类问题

parent 6b9fb191
package com.yidianling.im.session.extension;
import com.alibaba.fastjson.JSONObject;
public class CustomAttachLingxiWhichQuestion extends CustomAttachment {
private final String KEY_STATUS="status";
public CustomAttachLingxiWhichQuestion() {
super(CustomAttachmentType.TYPE_LINGXI_WHICH_QUESTION);
}
@Override
protected void parseData(JSONObject data) {
}
@Override
protected JSONObject packData() {
return null;
}
}
......@@ -42,4 +42,8 @@ public interface CustomAttachmentType {
int TYPE_FILTER_42=42;//客服切换过滤42
int TYPE_CONFIRM_ORDER=38;//确认订单
int TYPE_ORDER_ALREADY_DONE=39;//已完成订单
//灵犀2.0问诊数据
int TYPE_LINGXI_WHICH_QUESTION=50;//您想要咨询哪类问题
}
package com.yidianling.im.session.viewholder
data class LingxiWhichQuestionBean (
var isSelected:Boolean,
var name:String,
var id:String
)
\ No newline at end of file
package com.yidianling.im.session.viewholder;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.yidianling.common.tools.ToastUtil;
import com.yidianling.im.R;
import com.yidianling.im.session.viewholder.adapter.AdapterLingxiWhichQuestion;
import com.yidianling.nimbase.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.yidianling.uikit.business.session.viewholder.MsgViewHolderBase;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implements AdapterLingxiWhichQuestion.OnQuestionlItemClickListener {
private RecyclerView recycleviewWhichQuestion;
private AdapterLingxiWhichQuestion adapterLingxiWhichQuestion;
ArrayList<String> questionList=new ArrayList<String>();
public MsgViewHolderLingxiWhichQuestion(BaseMultiItemFetchLoadAdapter adapter) {
super(adapter);
}
@Override
protected int getContentResId() {
return R.layout.im_nim_lingxi_which_question;
}
@Override
protected void inflateContentView() {
recycleviewWhichQuestion = findViewById(R.id.which_question_rv);
}
@Override
protected void bindContentView() {
questionList.add("aaa");
questionList.add("aaa");
questionList.add("aaa");
questionList.add("aaa");
questionList.add("aaa");
questionList.add("aaa");
adapterLingxiWhichQuestion = new AdapterLingxiWhichQuestion();
adapterLingxiWhichQuestion.setTagData( questionList);
GridLayoutManager gridLayoutManager = new GridLayoutManager(context,2);
gridLayoutManager.setOrientation(LinearLayoutManager.VERTICAL);
recycleviewWhichQuestion.setLayoutManager(gridLayoutManager);
recycleviewWhichQuestion.setAdapter(adapterLingxiWhichQuestion);
}
@Override
public void onItemClick(@NotNull LingxiWhichQuestionBean string, int position) {
ToastUtil.toastShort("点击了"+position);
}
}
package com.yidianling.im.session.viewholder.adapter
import androidx.recyclerview.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.TextView
import com.ydl.ydl_image.module.GlideApp
import com.yidianling.im.R
import com.yidianling.im.session.viewholder.LingxiWhichQuestionBean
/**
* @author huozhiliang
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2021/6/21
*/
class AdapterLingxiWhichQuestion : RecyclerView.Adapter<AdapterLingxiWhichQuestion.ViewHolder>() {
private lateinit var tagList:List<String>
private var onItemClickListener: OnQuestionlItemClickListener? = null
class ViewHolder(itemView: View) :
RecyclerView.ViewHolder(itemView) {
val tv_which_question: TextView = itemView.findViewById(R.id.tv_which_question)
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
return ViewHolder(
LayoutInflater.from(parent.context).inflate(
R.layout.im_lingxi_which_question_item,
parent,
false
)
)
}
override fun getItemCount(): Int {
return tagList.size?:0
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
// holder.tv_which_question.setText("")
holder.tv_which_question.setOnClickListener {
onItemClickListener?.onItemClick(LingxiWhichQuestionBean(true,"aa","aaa"),position)
}
}
fun setTagData(data: List<String>) {
tagList = data
notifyDataSetChanged()
}
interface OnQuestionlItemClickListener {
fun onItemClick(string: LingxiWhichQuestionBean,position: Int)
}
}
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#e8f5fe" />
<corners
android:radius="@dimen/platform_dp_18"/>
</shape>
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="婚姻家庭"
android:maxWidth="110dp"
android:minWidth="110dp"
android:textColor="@color/platform_color_1DA1F2"
android:gravity="center"
android:background="@drawable/im_background_18dp_e8f5fe"
android:paddingTop="@dimen/platform_dp_8"
android:paddingBottom="@dimen/platform_dp_8"
android:id="@+id/tv_which_question"
android:layout_marginTop="@dimen/platform_dp_16"
android:layout_marginRight="@dimen/platform_dp_9"
>
</TextView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:background="@drawable/im_custom_message_round_white_6dp_bg"
android:paddingLeft="@dimen/platform_dp_12"
android:paddingRight="@dimen/platform_dp_3"
>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/which_question_title"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
tools:text="您想要咨询下类哪类问题?"
android:textSize="@dimen/im_text_size_17"
android:textColor="@color/im_color_242424"
>
</TextView>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/which_question_rv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintTop_toBottomOf="@id/which_question_title"
app:layout_constraintStart_toStartOf="@id/which_question_title"
tools:itemCount="6"
app:spanCount="2"
tools:listitem="@layout/im_lingxi_which_question_item"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
android:layout_marginBottom="@dimen/platform_dp_16"
app:layout_constraintBottom_toBottomOf="parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
\ 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