Commit 7199799a by 霍志良

feat:专家自定义名片,m-home模块功能开发

parent 21033e83
......@@ -48,6 +48,7 @@ import com.yidianling.im.session.extension.CustomAttachRedPacket;
import com.yidianling.im.session.extension.CustomAttachSubScriptTime;
import com.yidianling.im.session.extension.CustomAttachTipMsg;
import com.yidianling.im.session.extension.CustomAttachment;
import com.yidianling.im.session.extension.CustomAttachmentBusinessCard;
import com.yidianling.im.session.extension.CustomAttachmentEvaluate;
import com.yidianling.im.session.extension.CustomAttachmentOrderStatus;
import com.yidianling.im.session.extension.CustomAttachmentPhoneCallRedPacket;
......@@ -65,6 +66,7 @@ import com.yidianling.im.session.extension.DefaultCustomAttachment;
import com.yidianling.im.session.extension.StickerAttachment;
import com.yidianling.im.session.viewholder.MsgViewHolderAVChat;
import com.yidianling.im.session.viewholder.MsgViewHolderAssistantReceivedMoney;
import com.yidianling.im.session.viewholder.MsgViewHolderBusinessCard;
import com.yidianling.im.session.viewholder.MsgViewHolderChatTip;
import com.yidianling.im.session.viewholder.MsgViewHolderConsult;
import com.yidianling.im.session.viewholder.MsgViewHolderConsultCallStatus;
......@@ -418,6 +420,7 @@ public class SessionHelper {
NimUIKit.registerMsgItemViewHolder(CustomAttachmentShareMsg.class, MsgViewHolderShareMsg.class);//分享推送
NimUIKit.registerMsgItemViewHolder(CustomAttachConsultCallStatus.class, MsgViewHolderConsultCallStatus.class);//咨询声网的拨打状态
NimUIKit.registerMsgItemViewHolder(CustomAttachAssistantReceivedMoney.class, MsgViewHolderAssistantReceivedMoney.class);
NimUIKit.registerMsgItemViewHolder(CustomAttachmentBusinessCard.class, MsgViewHolderBusinessCard.class);//专家自定义名片 ,TYPE=34
}
private static void setSessionListener() {
......
......@@ -118,6 +118,10 @@ public class CustomAttachParser implements MsgAttachmentParser {
case CustomAttachmentType.ASSISTANT_RECEIVEDMONEY:
attachment = new CustomAttachAssistantReceivedMoney();
break;
case CustomAttachmentType.TYPE_EXPERT_DETAIL_CARD:
//专家自定义名片
attachment = new CustomAttachmentBusinessCard();
break;
default:
attachment = new DefaultCustomAttachment();
break;
......
package com.yidianling.im.session.extension;
import com.alibaba.fastjson.JSONObject;
/**
* @author huozhiliang
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2020/9/7
*/
public class CustomAttachmentBusinessCard extends CustomAttachment {
private String NAME = "name";
private String SECONDTITLE = "teamCertifications";
private String EXPERTIMG = "head";
private String TAGLIST = "tag2";
private String FEEDBACKRATE = "feedbackRate";
private String COMMENTNUM = "commentNum";
private String WORKYEARS = "workYears";
private String ORDERNUM = "orderNum";
private String HELPLONG = "helpLong";
public String name; //专家名字
public String secondTitle; //专家介绍
public String expertImg; //专家头像
public String tagList; //专家标签列表
public Float feedbackRate;//评价分
public String commentNum;//评价人数
public String workYears;//持证年限
public String orderNum;//服务人数
public String helpLong;//服务时长
CustomAttachmentBusinessCard() {
super(CustomAttachmentType.TYPE_EXPERT_DETAIL_CARD);
}
@Override
protected void parseData(JSONObject data) {
name = data.getString(NAME);
secondTitle = data.getString(SECONDTITLE);
expertImg = data.getString(EXPERTIMG);
tagList = data.getString(TAGLIST);
feedbackRate = data.getFloat(FEEDBACKRATE);
commentNum = data.getString(COMMENTNUM);
workYears = data.getString(WORKYEARS);
orderNum = data.getString(ORDERNUM);
helpLong = data.getString(HELPLONG);
}
@Override
protected JSONObject packData() {
JSONObject data = new JSONObject();
data.put(NAME, name);
data.put(SECONDTITLE, secondTitle);
data.put(EXPERTIMG, expertImg);
data.put(TAGLIST, tagList);
data.put(FEEDBACKRATE, feedbackRate);
data.put(COMMENTNUM, commentNum);
data.put(WORKYEARS, workYears);
data.put(ORDERNUM, orderNum);
data.put(HELPLONG, helpLong);
return data;
}
}
......@@ -35,4 +35,5 @@ public interface CustomAttachmentType {
int TYPE_CUSTOMER_SERVICE = 31; //客服名片
int TYPE_CUSTOMER_CONSULT_CALL_STATUS = 32; //咨询的声网拨打状态的自定义消息
int ASSISTANT_RECEIVEDMONEY = 33;//发起收款
int TYPE_EXPERT_DETAIL_CARD=34;//专家名片
}
package com.yidianling.im.session.viewholder;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.ydl.ydl_image.module.GlideApp;
import com.yidianling.common.tools.ToastUtil;
import com.yidianling.im.R;
import com.yidianling.im.session.extension.CustomAttachmentBusinessCard;
import com.yidianling.im.session.viewholder.adapter.AdapterBusinessCard;
import com.yidianling.nimbase.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter;
import com.yidianling.uikit.business.session.viewholder.MsgViewHolderBase;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* @author huozhiliang
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2020/9/7
*/
public class MsgViewHolderBusinessCard extends MsgViewHolderBase {
private ImageView expertImg;
private TextView expertSecondTitle;
private TextView expertName;
private TextView scoreExpert;
private TextView commentCount;
private TextView cerfiticateYear;
private TextView serviceCount;
private TextView serviceTime;
private RecyclerView recy;
private AdapterBusinessCard businessCard;
private LinearLayout m_im_ll_feedbackRate;
public MsgViewHolderBusinessCard(BaseMultiItemFetchLoadAdapter adapter) {
super(adapter);
}
@Override
protected int getContentResId() {
return R.layout.im_ui_message_custom_business_card;
}
@Override
protected void inflateContentView() {
expertImg=findViewById(R.id.expert_Img);
expertSecondTitle=findViewById(R.id.expertSecondTitle);
expertName=findViewById(R.id.expertName);
scoreExpert=findViewById(R.id.scoreExpert);
commentCount=findViewById(R.id.commentCount);
cerfiticateYear=findViewById(R.id.cerfiticateYear);
serviceCount=findViewById(R.id.serviceCount);
serviceTime=findViewById(R.id.serviceTime);
recy=findViewById(R.id.expertTagRV);
m_im_ll_feedbackRate=findViewById(R.id.m_im_ll_feedbackRate);
}
@Override
protected void bindContentView() {
CustomAttachmentBusinessCard customBusinessCard= (CustomAttachmentBusinessCard) message.getAttachment();
businessCard=new AdapterBusinessCard();
businessCard.setTagData(new ArrayList<String>());
LinearLayoutManager linearLayoutManager=new LinearLayoutManager(context);
linearLayoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
recy.setLayoutManager(linearLayoutManager);
recy.setAdapter(businessCard);
GlideApp.with(context).load(customBusinessCard.expertImg)
.into(expertImg);
String tags=customBusinessCard.tagList;
List<String> tagsList=Arrays.asList(tags.split("\\|"));
businessCard.setTagData( tagsList);
expertName.setText(customBusinessCard.name);
expertSecondTitle.setText(customBusinessCard.secondTitle);
scoreExpert.setText(customBusinessCard.feedbackRate.toString());
commentCount.setText(customBusinessCard.commentNum+"人评价");
cerfiticateYear.setText(customBusinessCard.workYears);
serviceCount.setText(customBusinessCard.orderNum);
serviceTime.setText(customBusinessCard.helpLong);
m_im_ll_feedbackRate.removeAllViews();
for (int j=0;j<5;j++) {
View view = LayoutInflater.from(context).inflate(
R.layout.m_im_feedbackrate,
m_im_ll_feedbackRate,
false
);
ImageView startIMG= view.findViewById(R.id.feedBackRate);
if (customBusinessCard.feedbackRate >= j) {
startIMG.setBackground(context.getResources().getDrawable(R.drawable.m_im_full_star));
} else if (customBusinessCard.feedbackRate < j && customBusinessCard.feedbackRate > j - 1) {
startIMG.setBackground(context.getResources().getDrawable(R.drawable.m_im_half_star));
} else {
startIMG.setBackground(context.getResources().getDrawable(R.drawable.m_im_nothing_star));
}
m_im_ll_feedbackRate.addView(view);
}
}
@Override
protected void onItemClick() {
super.onItemClick();
ToastUtil.toastShort("点击了");
}
}
package com.yidianling.im.session.viewholder.adapter
import android.support.v7.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
/**
* @author huozhiliang
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2020/9/7
*/
class AdapterBusinessCard : RecyclerView.Adapter<AdapterBusinessCard.ViewHolder>() {
private lateinit var tagList:List<String>
class ViewHolder(itemView: View) :
RecyclerView.ViewHolder(itemView) {
val tagsTV: TextView = itemView.findViewById(R.id.tagsTV)
}
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ViewHolder {
return ViewHolder(
LayoutInflater.from(parent.context).inflate(
R.layout.im_message_item_single_text,
parent,
false
)
)
}
override fun getItemCount(): Int {
return tagList.size?:0
}
override fun onBindViewHolder(holder: ViewHolder, position: Int) {
holder.tagsTV.text = tagList[position]
}
fun setTagData(data: List<String>) {
tagList = data
notifyDataSetChanged()
}
}
\ 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="#60959595" />
<corners
android:radius="2dp"/>
</shape>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/platform_color_F7F7F7" />
<corners
android:radius="@dimen/dp_4"/>
</shape>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/white" />
<corners
android:radius="@dimen/dp_4"/>
</shape>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/white" />
<corners
android:topRightRadius="6dp"
android:bottomRightRadius="6dp"
android:bottomLeftRadius="6dp"/>
</shape>
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<gradient
android:startColor="#00ffffff"
android:endColor="#60808080"
android:angle="270" />
</shape>
\ No newline at end of file
<?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:textSize="7sp"
android:background="@drawable/im_background_2dp_gray"
android:textColor="@color/white"
android:paddingBottom="@dimen/platform_dp_2"
android:paddingTop="@dimen/platform_dp_2"
android:paddingLeft="@dimen/platform_dp_5"
android:paddingRight="@dimen/platform_dp_5"
android:layout_marginRight="@dimen/platform_dp_4"
android:id="@+id/tagsTV"
>
</TextView>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?>
<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/feedBackRate"
android:layout_width="@dimen/platform_dp_6"
android:layout_height="@dimen/platform_dp_6"
android:layout_marginRight="@dimen/platform_dp_1"
android:scaleType="fitXY"
android:background="@drawable/m_im_full_star">
</ImageView>
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<color name="im_transparent">#00000000</color>
<color name="im_white">#FFFFFF</color>
<color name="im_black">#000000</color>
<color name="im_grey">#333333</color>
<color name="im_color_blue_0888ff">#0888ff</color>
<color name="im_color_gray_d9d9d9">#d9d9d9</color>
<color name="im_color_black_333333">#333333</color>
<color name="im_color_grey_999999">#999999</color>
<color name="im_color_activity_blue_bg">#f7389fff</color>
<color name="im_split_line_grey_color_d9d9d9">#D9D9D9</color>
<color name="im_gray7">#c5c4c4</color>
<color name="im_GreyWhite">#F7F7F7</color>
<color name="im_im_list_select_hover">#dbdbdb</color>
<color name="im_color_b3b3b3">#b3b3b3</color>
<color name="im_color_grey_eaeaea">#eaeaea</color>
<color name="im_color_green_89fbff">#89fbff</color>
<color name="im_main_bg_color">#FFFFFF</color>
<color name="im_input_panel_text_color_757572">#757572</color>
<color name="im_color_split_line_d9d9d9">#d9d9d9</color>
<color name="im_color_split_line_cccccc">#cccccc</color>
<color name="im_contact_list_hover">#d9d9d9</color>
<color name="im_color_yellow_796413">#796413</color>
<color name="im_color_red_f04c62">#f04c62</color>
<color name="im_color_black_ff333333">#ff333333</color>
<!--====================RES_AVCHAT====================-->
<!--====================RES_AVCHAT====================-->
<!--====================RES_AVCHAT====================-->
<color name="im_color_f2f7fc">#F2F7FC</color>
<color name="im_color_c2364b">#C2364B</color>
<color name="im_color_f5455e">#F5455E</color>
<color name="im_video_call_peer_close_cameral_text_shadow">#484848</color>
<color name="im_video_call_peer_close_cameral_text_color">#f1f1f1</color>
<color name="im_t_av_chat_setting_bar">#3C4149</color>
<color name="im_color_gray_alpha40">#66000000</color>
<!--====================RES_UIKIT====================-->
<!--====================RES_UIKIT====================-->
<!--====================RES_UIKIT====================-->
<color name="im_color_grey_555555">#555555</color>
<color name="im_action_bar_black_title_color">#252525</color>
<color name="im_contact_search_hit">#02d3a9</color>
<color name="im_color_background">#ECF1F5</color>
<color name="im_color_00CC88">#00CC88</color>
<color name="im_color_3DBEF5">#3DBEF5</color>
<color name="im_color_8CF22318">#8CF22318</color>
<color name="im_color_CCCCCC">#CCCCCC</color>
<color name="im_color_EBEBEB">#EBEBEB</color>
<color name="im_color_242424">#242424</color>
<color name="im_color_FF5040">#FF5040</color>
<color name="im_color_BFBFBF">#BFBFBF</color>
<color name="im_divide_color">#EDEDED</color>
<color name="im_theme_title_bar_color">#FFFFFF</color>
<color name="im_color_grey_d0d0d0">#d0d0d0</color>
</resources>
<?xml version="1.0" encoding="UTF-8"?>
<resources>
<color name="im_transparent">#00000000</color>
<color name="im_white">#FFFFFF</color>
<color name="im_black">#000000</color>
<color name="im_grey">#333333</color>
<color name="im_color_blue_0888ff">#0888ff</color>
<color name="im_color_gray_d9d9d9">#d9d9d9</color>
<color name="im_color_black_333333">#333333</color>
<color name="im_color_grey_999999">#999999</color>
<color name="im_color_activity_blue_bg">#f7389fff</color>
<color name="im_split_line_grey_color_d9d9d9">#D9D9D9</color>
<color name="im_gray7">#c5c4c4</color>
<color name="im_GreyWhite">#F7F7F7</color>
<color name="im_im_list_select_hover">#dbdbdb</color>
<color name="im_color_b3b3b3">#b3b3b3</color>
<color name="im_color_grey_eaeaea">#eaeaea</color>
<color name="im_color_green_89fbff">#89fbff</color>
<color name="im_main_bg_color">#FFFFFF</color>
<color name="im_input_panel_text_color_757572">#757572</color>
<color name="im_color_split_line_d9d9d9">#d9d9d9</color>
<color name="im_color_split_line_cccccc">#cccccc</color>
<color name="im_contact_list_hover">#d9d9d9</color>
<color name="im_color_yellow_796413">#796413</color>
<color name="im_color_red_f04c62">#f04c62</color>
<color name="im_color_black_ff333333">#ff333333</color>
<!--====================RES_AVCHAT====================-->
<!--====================RES_AVCHAT====================-->
<!--====================RES_AVCHAT====================-->
<color name="im_color_f2f7fc">#F2F7FC</color>
<color name="im_color_c2364b">#C2364B</color>
<color name="im_color_f5455e">#F5455E</color>
<color name="im_video_call_peer_close_cameral_text_shadow">#484848</color>
<color name="im_video_call_peer_close_cameral_text_color">#f1f1f1</color>
<color name="im_t_av_chat_setting_bar">#3C4149</color>
<color name="im_color_gray_alpha40">#66000000</color>
<!--====================RES_UIKIT====================-->
<!--====================RES_UIKIT====================-->
<!--====================RES_UIKIT====================-->
<color name="im_color_grey_555555">#555555</color>
<color name="im_action_bar_black_title_color">#252525</color>
<color name="im_contact_search_hit">#02d3a9</color>
<color name="im_color_background">#ECF1F5</color>
<color name="im_color_00CC88">#00CC88</color>
<color name="im_color_3DBEF5">#3DBEF5</color>
<color name="im_color_8CF22318">#8CF22318</color>
<color name="im_color_CCCCCC">#CCCCCC</color>
<color name="im_color_EBEBEB">#EBEBEB</color>
<color name="im_color_242424">#242424</color>
<color name="im_color_FF5040">#FF5040</color>
<color name="im_color_BFBFBF">#BFBFBF</color>
<color name="im_divide_color">#EDEDED</color>
<color name="im_theme_title_bar_color">#FFFFFF</color>
<color name="im_color_grey_d0d0d0">#d0d0d0</color>
<color name="color_9f9f9f">#9f9f9f</color>
<color name="color_666666">#666666</color>
</resources>
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