Commit 4779cea0 by 徐健

私聊改造項目完成

parent 31b740d3
......@@ -529,7 +529,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
//关注
@SuppressLint("CheckResult")
private void focus() {
if (ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getInfo() != null)
if (ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getInfo() != null) {
// 未关注才能进行关注
if (ActionHandlerStorage.getL(sessionId).getInfo().isFollowed == false) {
ActionHandlerStorage.getL(sessionId).getInfo().isFollowed = true;
......@@ -551,8 +551,10 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
}
}, throwable -> {
ActionHandlerStorage.getL(sessionId).getInfo().isFollowed = false;
ToastUtil.toastShort(throwable.toString());});
ToastUtil.toastShort(throwable.toString());
});
}
}
}
private void showTips() {
......@@ -560,18 +562,30 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
}
//初始化聊天顶部快捷菜单
@SuppressLint("CheckResult")
private void initMenu() {
View rela_zixun = rootView.findViewById(R.id.rela_zixun);
rela_zixun.setOnClickListener(view -> {
if (ActionHandlerStorage.getL(sessionId) != null) {
if (sessionId!= null && ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getInfo() != null) {
if (expertConsultServiceListDialog == null) {
if (getActivity() != null) {
expertConsultServiceListDialog = new ExpertConsultServiceListDialog(getActivity());
}
ServiceImpl.Companion.getInstance().serviceList(ActionHandlerStorage.getL(sessionId).getInfo().doctorId)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(res -> {
if (res.data != null && res.data.size() > 0) {
if (getActivity() != null && expertConsultServiceListDialog == null) {
expertConsultServiceListDialog = new ExpertConsultServiceListDialog(getActivity(), res.data);
expertConsultServiceListDialog.show();
}
}else {
ToastUtil.toastShort("咨询师暂未发布服务");
}
}, throwable -> {
});
}else {
expertConsultServiceListDialog.show();
}
expertConsultServiceListDialog.show();
} else {
ToastUtil.toastShort("请退出聊天重试");
}
......
......@@ -54,4 +54,9 @@ interface ServiceApi{
@FormUrlEncoded
@POST("sq-active/focus")
fun focus(@FieldMap params: Map<String, String>): Observable<BaseResponse<FocusBean>>
//服务列表
@GET("consult/expert-page/products")
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
fun serviceList(@Query("doctorId") doctorId: String): Observable<BaseAPIResponse<List<ServiceItemBean>>>
}
\ No newline at end of file
......@@ -76,4 +76,11 @@ class ServiceImpl private constructor(){
return RxUtils.mapObservable(param)
.flatMap { YDLHttpUtils.obtainApi(ServiceApi::class.java).focus(it) }
}
/**
* 服务列表
*/
fun serviceList(doctorId: String): Observable<BaseAPIResponse<List<ServiceItemBean>>> {
return YDLHttpUtils.obtainApi(ServiceApi::class.java).serviceList(doctorId)
}
}
\ No newline at end of file
package com.yidianling.uikit.custom.http.response;
import java.util.List;
public class ServiceItemBean {
/**
* cateName : 亲子教育
* cateId : 23
* products : [{"productDto":{"id":91170418024616,"desc":"咨询师基本功训练及亲子咨疗。\r\nY值1868 \r\n好评率99%\r\n本服务仅为咨询师提供督导服务,非咨询师请勿购买本服务。","shortDesc":"心理学硕士、副教授、硕士生导师、壹点灵首席心理咨询专家,从业10年。","uid":2,"name":"督导咨询","originPrice":0,"productPrice":500,"packagePrice":1500,"isPackage":1,"periodNum":0,"packageNum":1,"dayFreeTimes":0,"activityType":1,"activityStartTime":null,"activityEndTime":null,"expiryDate":0,"totalServiceTime":0,"status":3,"auditStatus":3,"checkFailedReason":"","offShelfReason":"","serviceType":1,"isDelete":2,"sortOrder":27683,"createTime":"Apr 18, 2017 10:10:22 PM","updateTime":"Nov 7, 2019 11:36:55 AM","feedbackRate":5,"saleoutAmount":32,"expireDays":0,"aimEffect":"","advantage":"","extRemark":""},"productCategoryDto":{"id":233469,"categoryId1":23,"categoryId2":65,"categoryId3":0,"categoryName1":"亲子教育","categoryName2":"厌学","categoryName3":"心理咨询服务"},"productSpecDtos":[{"id":666956,"spec1":"1","spec1Name":"服务方式","spec2":"60","spec2Name":"服务时长","price":500},{"id":666957,"spec1":"2","spec1Name":"服务方式","spec2":"60","spec2Name":"服务时长","price":500},{"id":666958,"spec1":"4","spec1Name":"服务方式","spec2":"60","spec2Name":"服务时长","price":500},{"id":666959,"spec1":"3","spec1Name":"服务方式","spec2":"60","spec2Name":"服务时长","price":500},{"id":666960,"spec1":"5","spec1Name":"服务方式","spec2":"60","spec2Name":"服务时长","price":500}],"isPushToBg":0}]
*/
private String cateName;
private int cateId;
private List<ProductsBean> products;
public String getCateName() {
return cateName;
}
public void setCateName(String cateName) {
this.cateName = cateName;
}
public int getCateId() {
return cateId;
}
public void setCateId(int cateId) {
this.cateId = cateId;
}
public List<ProductsBean> getProducts() {
return products;
}
public void setProducts(List<ProductsBean> products) {
this.products = products;
}
public static class ProductsBean {
/**
* productDto : {"id":91170418024616,"desc":"咨询师基本功训练及亲子咨疗。\r\nY值1868 \r\n好评率99%\r\n本服务仅为咨询师提供督导服务,非咨询师请勿购买本服务。","shortDesc":"心理学硕士、副教授、硕士生导师、壹点灵首席心理咨询专家,从业10年。","uid":2,"name":"督导咨询","originPrice":0,"productPrice":500,"packagePrice":1500,"isPackage":1,"periodNum":0,"packageNum":1,"dayFreeTimes":0,"activityType":1,"activityStartTime":null,"activityEndTime":null,"expiryDate":0,"totalServiceTime":0,"status":3,"auditStatus":3,"checkFailedReason":"","offShelfReason":"","serviceType":1,"isDelete":2,"sortOrder":27683,"createTime":"Apr 18, 2017 10:10:22 PM","updateTime":"Nov 7, 2019 11:36:55 AM","feedbackRate":5,"saleoutAmount":32,"expireDays":0,"aimEffect":"","advantage":"","extRemark":""}
* productCategoryDto : {"id":233469,"categoryId1":23,"categoryId2":65,"categoryId3":0,"categoryName1":"亲子教育","categoryName2":"厌学","categoryName3":"心理咨询服务"}
* productSpecDtos : [{"id":666956,"spec1":"1","spec1Name":"服务方式","spec2":"60","spec2Name":"服务时长","price":500},{"id":666957,"spec1":"2","spec1Name":"服务方式","spec2":"60","spec2Name":"服务时长","price":500},{"id":666958,"spec1":"4","spec1Name":"服务方式","spec2":"60","spec2Name":"服务时长","price":500},{"id":666959,"spec1":"3","spec1Name":"服务方式","spec2":"60","spec2Name":"服务时长","price":500},{"id":666960,"spec1":"5","spec1Name":"服务方式","spec2":"60","spec2Name":"服务时长","price":500}]
* isPushToBg : 0
*/
private ProductDtoBean productDto;
private ProductCategoryDtoBean productCategoryDto;
private int isPushToBg;
private List<ProductSpecDtosBean> productSpecDtos;
public ProductDtoBean getProductDto() {
return productDto;
}
public void setProductDto(ProductDtoBean productDto) {
this.productDto = productDto;
}
public ProductCategoryDtoBean getProductCategoryDto() {
return productCategoryDto;
}
public void setProductCategoryDto(ProductCategoryDtoBean productCategoryDto) {
this.productCategoryDto = productCategoryDto;
}
public int getIsPushToBg() {
return isPushToBg;
}
public void setIsPushToBg(int isPushToBg) {
this.isPushToBg = isPushToBg;
}
public List<ProductSpecDtosBean> getProductSpecDtos() {
return productSpecDtos;
}
public void setProductSpecDtos(List<ProductSpecDtosBean> productSpecDtos) {
this.productSpecDtos = productSpecDtos;
}
public static class ProductDtoBean {
/**
* id : 91170418024616
* desc : 咨询师基本功训练及亲子咨疗。
Y值1868
好评率99%
本服务仅为咨询师提供督导服务,非咨询师请勿购买本服务。
* shortDesc : 心理学硕士、副教授、硕士生导师、壹点灵首席心理咨询专家,从业10年。
* uid : 2
* name : 督导咨询
* originPrice : 0.0
* productPrice : 500.0
* packagePrice : 1500.0
* isPackage : 1
* periodNum : 0
* packageNum : 1
* dayFreeTimes : 0
* activityType : 1
* activityStartTime : null
* activityEndTime : null
* expiryDate : 0
* totalServiceTime : 0
* status : 3
* auditStatus : 3
* checkFailedReason :
* offShelfReason :
* serviceType : 1
* isDelete : 2
* sortOrder : 27683
* createTime : Apr 18, 2017 10:10:22 PM
* updateTime : Nov 7, 2019 11:36:55 AM
* feedbackRate : 5.0
* saleoutAmount : 32
* expireDays : 0
* aimEffect :
* advantage :
* extRemark :
*/
private long id;
private String desc;
private String shortDesc;
private int uid;
private String name;
private double originPrice;
private double productPrice;
private double packagePrice;
private int isPackage; //2是套餐
private int periodNum;
private int packageNum;
private int dayFreeTimes;
private int activityType;
private Object activityStartTime;
private Object activityEndTime;
private int expiryDate;
private int totalServiceTime;
private int status;
private int auditStatus;
private String checkFailedReason;
private String offShelfReason;
private int serviceType;
private int isDelete;
private int sortOrder;
private String createTime;
private String updateTime;
private double feedbackRate;
private int saleoutAmount;
private int expireDays;
private String aimEffect;
private String advantage;
private String extRemark;
public long getId() {
return id;
}
public void setId(long id) {
this.id = id;
}
public String getDesc() {
return desc;
}
public void setDesc(String desc) {
this.desc = desc;
}
public String getShortDesc() {
return shortDesc;
}
public void setShortDesc(String shortDesc) {
this.shortDesc = shortDesc;
}
public int getUid() {
return uid;
}
public void setUid(int uid) {
this.uid = uid;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public double getOriginPrice() {
return originPrice;
}
public void setOriginPrice(double originPrice) {
this.originPrice = originPrice;
}
public double getProductPrice() {
return productPrice;
}
public void setProductPrice(double productPrice) {
this.productPrice = productPrice;
}
public double getPackagePrice() {
return packagePrice;
}
public void setPackagePrice(double packagePrice) {
this.packagePrice = packagePrice;
}
public int getIsPackage() {
return isPackage;
}
public void setIsPackage(int isPackage) {
this.isPackage = isPackage;
}
public int getPeriodNum() {
return periodNum;
}
public void setPeriodNum(int periodNum) {
this.periodNum = periodNum;
}
public int getPackageNum() {
return packageNum;
}
public void setPackageNum(int packageNum) {
this.packageNum = packageNum;
}
public int getDayFreeTimes() {
return dayFreeTimes;
}
public void setDayFreeTimes(int dayFreeTimes) {
this.dayFreeTimes = dayFreeTimes;
}
public int getActivityType() {
return activityType;
}
public void setActivityType(int activityType) {
this.activityType = activityType;
}
public Object getActivityStartTime() {
return activityStartTime;
}
public void setActivityStartTime(Object activityStartTime) {
this.activityStartTime = activityStartTime;
}
public Object getActivityEndTime() {
return activityEndTime;
}
public void setActivityEndTime(Object activityEndTime) {
this.activityEndTime = activityEndTime;
}
public int getExpiryDate() {
return expiryDate;
}
public void setExpiryDate(int expiryDate) {
this.expiryDate = expiryDate;
}
public int getTotalServiceTime() {
return totalServiceTime;
}
public void setTotalServiceTime(int totalServiceTime) {
this.totalServiceTime = totalServiceTime;
}
public int getStatus() {
return status;
}
public void setStatus(int status) {
this.status = status;
}
public int getAuditStatus() {
return auditStatus;
}
public void setAuditStatus(int auditStatus) {
this.auditStatus = auditStatus;
}
public String getCheckFailedReason() {
return checkFailedReason;
}
public void setCheckFailedReason(String checkFailedReason) {
this.checkFailedReason = checkFailedReason;
}
public String getOffShelfReason() {
return offShelfReason;
}
public void setOffShelfReason(String offShelfReason) {
this.offShelfReason = offShelfReason;
}
public int getServiceType() {
return serviceType;
}
public void setServiceType(int serviceType) {
this.serviceType = serviceType;
}
public int getIsDelete() {
return isDelete;
}
public void setIsDelete(int isDelete) {
this.isDelete = isDelete;
}
public int getSortOrder() {
return sortOrder;
}
public void setSortOrder(int sortOrder) {
this.sortOrder = sortOrder;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
public double getFeedbackRate() {
return feedbackRate;
}
public void setFeedbackRate(double feedbackRate) {
this.feedbackRate = feedbackRate;
}
public int getSaleoutAmount() {
return saleoutAmount;
}
public void setSaleoutAmount(int saleoutAmount) {
this.saleoutAmount = saleoutAmount;
}
public int getExpireDays() {
return expireDays;
}
public void setExpireDays(int expireDays) {
this.expireDays = expireDays;
}
public String getAimEffect() {
return aimEffect;
}
public void setAimEffect(String aimEffect) {
this.aimEffect = aimEffect;
}
public String getAdvantage() {
return advantage;
}
public void setAdvantage(String advantage) {
this.advantage = advantage;
}
public String getExtRemark() {
return extRemark;
}
public void setExtRemark(String extRemark) {
this.extRemark = extRemark;
}
}
public static class ProductCategoryDtoBean {
/**
* id : 233469
* categoryId1 : 23
* categoryId2 : 65
* categoryId3 : 0
* categoryName1 : 亲子教育
* categoryName2 : 厌学
* categoryName3 : 心理咨询服务
*/
private int id;
private int categoryId1;
private int categoryId2;
private int categoryId3;
private String categoryName1;
private String categoryName2;
private String categoryName3;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getCategoryId1() {
return categoryId1;
}
public void setCategoryId1(int categoryId1) {
this.categoryId1 = categoryId1;
}
public int getCategoryId2() {
return categoryId2;
}
public void setCategoryId2(int categoryId2) {
this.categoryId2 = categoryId2;
}
public int getCategoryId3() {
return categoryId3;
}
public void setCategoryId3(int categoryId3) {
this.categoryId3 = categoryId3;
}
public String getCategoryName1() {
return categoryName1;
}
public void setCategoryName1(String categoryName1) {
this.categoryName1 = categoryName1;
}
public String getCategoryName2() {
return categoryName2;
}
public void setCategoryName2(String categoryName2) {
this.categoryName2 = categoryName2;
}
public String getCategoryName3() {
return categoryName3;
}
public void setCategoryName3(String categoryName3) {
this.categoryName3 = categoryName3;
}
}
public static class ProductSpecDtosBean {
/**
* id : 666956
* spec1 : 1
* spec1Name : 服务方式
* spec2 : 60
* spec2Name : 服务时长
* price : 500.0
*/
private int id;
private String spec1;
private String spec1Name;
private String spec2;
private String spec2Name;
private double price;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getSpec1() {
return spec1;
}
public void setSpec1(String spec1) {
this.spec1 = spec1;
}
public String getSpec1Name() {
return spec1Name;
}
public void setSpec1Name(String spec1Name) {
this.spec1Name = spec1Name;
}
public String getSpec2() {
return spec2;
}
public void setSpec2(String spec2) {
this.spec2 = spec2;
}
public String getSpec2Name() {
return spec2Name;
}
public void setSpec2Name(String spec2Name) {
this.spec2Name = spec2Name;
}
public double getPrice() {
return price;
}
public void setPrice(double price) {
this.price = price;
}
}
}
}
package com.yidianling.uikit.custom.widget.expertConsultService.callback
import com.yidianling.uikit.custom.http.response.ServiceItemBean
interface ConsultServiceViewCallback {
fun onCloseClick() {}//关闭按钮点击
fun onBackClick() {}//返回列表点击
fun onItemClick(serviceId: Int) {} //服务列表点击
fun onItemClick(serviceId: ServiceItemBean.ProductsBean) {} //服务列表点击
}
\ No newline at end of file
......@@ -5,8 +5,14 @@ import android.util.AttributeSet
import android.view.View
import android.widget.LinearLayout
import android.widget.RelativeLayout
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydlcommon.base.config.GlobalConfig
import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.bean.GlobalInfo
import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.im.R
import com.yidianling.uikit.custom.http.response.ServiceItemBean
import com.yidianling.uikit.custom.widget.expertConsultService.callback.ConsultServiceViewCallback
import kotlinx.android.synthetic.main.im_expert_consult_service_detail_view.view.*
......@@ -45,7 +51,89 @@ class ExpertConsultServiceDetailView : RelativeLayout {
/**
* 设置数据
*/
fun setData(bean: String) {
fun updateData(bean: ServiceItemBean.ProductsBean) {
consult_service_title.text = bean.productDto.name ?: ""
consult_service_desc.text = bean.productDto.desc ?: ""
//是否是套餐
if (bean.productDto.isPackage == 2) {
consult_service_is_package.text = "套餐"
consult_service_times.text = "${bean.productDto.packageNum}次"
consult_service_price_right.text = "/${bean.productSpecDtos.last().spec2}分钟" //例: 套餐展示"/60分钟"
//起售次数展示
consult_service_low_buy_time.visibility = View.VISIBLE
consult_service_low_buy_time.text = "(${bean.productDto.packageNum}次起售)"
} else {
consult_service_is_package.text = "单次"
consult_service_times.text = "1次"
consult_service_price_right.text = "/次"//例: 不是套餐展示"/次"
consult_service_low_buy_time.visibility = View.GONE
}
//可选时间类型
var timeStr = StringBuffer("")
var timeList: ArrayList<String> = ArrayList()
bean.productSpecDtos.forEach {
timeList.add(it.spec2)
}
//去重并按规则拼接
timeList.distinct().forEachIndexed { index, str ->
if (index == 0) {
timeStr.append("${str}分钟")
} else {
timeStr.append("/${str}分钟")
}
}
consult_service_once_time_type.text = timeStr.toString()
//可选服务类型
var serviceTypeStr = StringBuffer("")
var serviceTypeList: ArrayList<String> = ArrayList()
bean.productSpecDtos.forEach {
serviceTypeList.add(it.spec1)
}
//去重并按规则拼接
serviceTypeList.distinct().forEachIndexed { index, str ->
val typeStr = getServiceType(str)
if (typeStr != "未知") {
if (index == 0) {
serviceTypeStr.append("$typeStr")
} else {
serviceTypeStr.append("/$typeStr")
}
}
}
consult_service_service_type.text = serviceTypeStr.toString()
//价格,取productSpecDtos数组最后一个价格,不保留小数
consult_service_service_price.text = String.format(
"%.0f",
(bean.productSpecDtos.last().price)
)
consult_service_btn.setOnClickListener {
NewH5Activity.start(mContext, H5Params(HttpConfig.MH5_URL + "consult/#/pages/DownOrder/DownOrder?product_id=" + bean.productDto.id, null))
}
}
private fun getServiceType(index: String): String {
return when (index) {
"1" -> {
"文字"
}
"2" -> {
"电话"
}
"3" -> {
"当面"
}
"4" -> {
"视频"
}
else -> {
"未知"
}
}
}
}
\ No newline at end of file
package com.yidianling.uikit.custom.widget.expertConsultService.view
import android.annotation.SuppressLint
import android.content.Context
import android.util.AttributeSet
import android.view.View
import android.widget.LinearLayout
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydlcommon.base.config.HttpConfig
import com.yidianling.im.R
import com.yidianling.uikit.custom.http.response.ServiceItemBean
import com.yidianling.uikit.custom.widget.expertConsultService.callback.ConsultServiceViewCallback
import kotlinx.android.synthetic.main.im_expert_consult_service_item_view.view.*
......@@ -36,24 +41,53 @@ class ExpertConsultServiceItemView : LinearLayout {
orientation = HORIZONTAL
View.inflate(mContext, R.layout.im_expert_consult_service_item_view, this)
}
/**
* 设置数据
*/
@SuppressLint("SetTextI18n")
fun setData(bean: ServiceItemBean.ProductsBean) {
//是否是套餐
if (bean.productDto.isPackage == 2) {
//展示左上角套餐布局
service_item_package.visibility = View.VISIBLE
//服务名
service_item_title.text = " ${bean.productDto.name}"
//起售次数展示
service_item_low_buy_time.visibility = View.VISIBLE
service_item_low_buy_time.text = "(${bean.productDto.packageNum}次起售)"
} else {
//隐藏套餐布局
service_item_package.visibility = View.GONE
//服务名
service_item_title.text = bean.productDto.name ?: ""
//隐藏起售次数限制
service_item_low_buy_time.visibility = View.GONE
}
//价格,取productSpecDtos数组最后一个价格,不保留小数
service_item_price.text = String.format(
"%.0f",
(bean.productSpecDtos.last().price)
)
//时间,取productSpecDtos数组最后一个的时间
service_item_time.text = "/${bean.productSpecDtos.last().spec2}分钟"
//好评率,*20后 保留1位小数
service_item_feddbackrate.text = String.format(
"%.1f",
(bean.productDto.feedbackRate) * 20f
) + "%"
//销量
service_item_saleout_num.text = "销量${bean.productDto.saleoutAmount}"
setOnClickListener {
//todo xj 接接口的时候修改成服务id
mListener?.onItemClick(0)
mListener?.onItemClick(bean)
}
im_expert_service_list_btn.setOnClickListener {
//todo 去咨询
NewH5Activity.start(mContext, H5Params(HttpConfig.MH5_URL + "consult/#/pages/DownOrder/DownOrder?product_id=" + bean.productDto.id, null))
}
}
/**
* 设置数据
*/
fun setData(bean: String) {
}
}
\ No newline at end of file
......@@ -16,6 +16,7 @@ import android.widget.ScrollView
import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.common.tools.RxImageTool
import com.yidianling.im.R
import com.yidianling.uikit.custom.http.response.ServiceItemBean
import com.yidianling.uikit.custom.widget.expertConsultService.callback.ConsultServiceViewCallback
import kotlinx.android.synthetic.main.im_expert_consult_service_list_dialog_layout.*
......@@ -23,11 +24,12 @@ import kotlinx.android.synthetic.main.im_expert_consult_service_list_dialog_layo
* 专家咨询服务列表弹框
* Created by xj on 2019/8/7.
*/
class ExpertConsultServiceListDialog(val mContext: Context): Dialog(mContext, R.style.dialog_default_style) {
class ExpertConsultServiceListDialog(val mContext: Context, val mList: List<ServiceItemBean>): Dialog(mContext, R.style.dialog_default_style) {
private var mConsultServiceListView: View? = null
private var mConsultServiceDetailView: View? = null
private var mConsultServiceListView: ExpertConsultServiceView? = null
private var mConsultServiceDetailView: ExpertConsultServiceDetailView? = null
private var mViewList: ArrayList<View> = ArrayList()
private var mSelectType: String = "全部"
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
......@@ -42,39 +44,26 @@ class ExpertConsultServiceListDialog(val mContext: Context): Dialog(mContext, R.
window.attributes = params
var typeList:ArrayList<String> = ArrayList()
typeList.add("全部")
typeList.add("婚姻家庭")
typeList.add("恋爱情感")
typeList.add("性心理")
typeList.add("亲子关系")
typeList.add("人际社交")
typeList.add("精神疾病")
var serviceList:ArrayList<String> = ArrayList()
serviceList.add("全部")
serviceList.add("婚姻家庭")
serviceList.add("恋爱情感")
serviceList.add("性心理")
serviceList.add("亲子关系")
serviceList.add("人际社交")
serviceList.add("精神疾病")
typeList.add(mSelectType)//默认选中
mList.forEach { item ->
typeList.add(item.cateName)
}
mConsultServiceListView =
ExpertConsultServiceView(
mContext
)
(mConsultServiceListView as ExpertConsultServiceView).setDataAndClick(typeList, serviceList, object : ConsultServiceViewCallback {
(mConsultServiceListView as ExpertConsultServiceView).setDataAndClick(typeList, mList, object : ConsultServiceViewCallback {
override fun onCloseClick() {
dismiss()
}
override fun onItemClick(serviceId: Int) {
// todo 执行右滑动画和接口请求
dialog_bottom_scroll_view.currentItem = 1
override fun onItemClick(serviceBean: ServiceItemBean.ProductsBean) {
if (mConsultServiceDetailView != null) {
mConsultServiceDetailView?.updateData(serviceBean)
dialog_bottom_scroll_view.currentItem = 1
}
}
})
......@@ -85,7 +74,6 @@ class ExpertConsultServiceListDialog(val mContext: Context): Dialog(mContext, R.
ExpertConsultServiceDetailView(
mContext, object : ConsultServiceViewCallback {
override fun onBackClick() {
// todo 执行左滑动画
dialog_bottom_scroll_view.currentItem = 0
}
})
......
......@@ -6,6 +6,7 @@ import android.view.View
import android.widget.LinearLayout
import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.im.R
import com.yidianling.uikit.custom.http.response.ServiceItemBean
import com.yidianling.uikit.custom.widget.expertConsultService.callback.ConsultServiceViewCallback
import kotlinx.android.synthetic.main.im_expert_consult_service_view.view.*
......@@ -13,7 +14,9 @@ class ExpertConsultServiceView : LinearLayout {
private var typeSelectedIndex: Int = 0
private var mTypeList: ArrayList<String> = ArrayList()
private var mServiceList: ArrayList<String> = ArrayList()
private var mServiceList: ArrayList<ServiceItemBean> = ArrayList()
private var mListener: ConsultServiceViewCallback? = null
constructor(context: Context) : super(context) {
mContext = context
......@@ -59,13 +62,13 @@ class ExpertConsultServiceView : LinearLayout {
*/
fun setDataAndClick(
typeList: ArrayList<String>,
serviceList: ArrayList<String>,
allServiceList: List<ServiceItemBean>,
listener: ConsultServiceViewCallback?
) {
mListener = listener
consult_service_dialog_close.setOnClickListener {
listener?.onCloseClick()
mListener?.onCloseClick()
}
// 设置顶部滚动类型数据
......@@ -82,30 +85,45 @@ class ExpertConsultServiceView : LinearLayout {
)
item.setData(str, index == typeSelectedIndex)
item.setOnClickListener {
resetSelected(index)
typeSelectedIndex = index
resetSelected()
selectTypeServiceList()
}
expert_consult_service_type_list.addView(item)
}
}
}
typeSelectedIndex = 0 // 初始化为全部选中
mServiceList.clear()
mServiceList.addAll(allServiceList)
// 设置服务列表数据
if (serviceList != null && serviceList.size != 0) {
mServiceList.clear()
mServiceList.addAll(serviceList)
selectTypeServiceList()
}
mServiceList.forEachIndexed { index, str ->
val item = ExpertConsultServiceItemView(mContext!!, listener)
expert_consult_service_service_list.addView(item)
/**
* 刷新服务列表数据
*/
private fun selectTypeServiceList() {
expert_consult_service_service_list.removeAllViews()
if (mServiceList.size != 0) {
mServiceList.forEachIndexed { index, itemBean ->
//当选中String相同的时候,添加view,或者选中typeSelectedIndex==0的时候,展示全部
if (itemBean.cateName == mTypeList[typeSelectedIndex] || typeSelectedIndex == 0) {
itemBean.products.forEach {
val item = ExpertConsultServiceItemView(mContext!!, mListener)
item.setData(it)
expert_consult_service_service_list.addView(item)
}
}
}
}
}
private fun resetSelected(index: Int) {
typeSelectedIndex = index
/**
* 刷新类型列表数据
*/
private fun resetSelected() {
for (index in 0 until expert_consult_service_type_list.childCount) {
var view = expert_consult_service_type_list.getChildAt(index)
if (view is ExpertConsultServiceTypeItemView) {
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<corners android:radius="1dp"/>
<solid android:color="#FF9500"/>
</shape>
\ No newline at end of file
......@@ -25,6 +25,7 @@
android:src="@drawable/im_expert_service_list_left_back" />
<TextView
android:id="@+id/consult_service_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="调节孕期情绪烦躁,建立积极心态面对新生活"
......@@ -73,6 +74,7 @@
android:layout_marginBottom="15dp"
android:text="相互了解,初步建立咨访关系,解答你心中关于咨询本身的一切疑惑,解答你心中关于咨询本身的一切疑惑,解答你心中关于咨询本身的一切疑惑,为你的困扰解决明确咨询目标与方案。相互了解,初步建立咨访关系,解答你心中关于咨询本身的一切疑惑,为你的困扰解决明确咨询目标与方案。相互了解,初步建立咨访关系,解答你心中关于咨询"
android:textColor="#666666"
android:fontFamily="sans-serif-thin"
android:textSize="14dp"
android:textStyle="bold" />
......@@ -127,6 +129,7 @@
android:orientation="horizontal">
<TextView
android:id="@+id/consult_service_is_package"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
......@@ -135,6 +138,7 @@
android:textSize="14dp" />
<TextView
android:id="@+id/consult_service_times"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
......@@ -177,6 +181,7 @@
android:orientation="horizontal">
<TextView
android:id="@+id/consult_service_once_time_type"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
......@@ -185,6 +190,7 @@
android:textSize="14dp" />
<TextView
android:id="@+id/consult_service_service_type"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
......@@ -322,6 +328,7 @@
android:textSize="10dp" />
<TextView
android:id="@+id/consult_service_service_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="320"
......@@ -330,15 +337,24 @@
android:textStyle="bold" />
<TextView
android:id="@+id/consult_service_price_right"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="/次"
android:textColor="#666666"
android:textSize="10dp"
android:textStyle="bold" />
android:textSize="10dp" />
<TextView
android:id="@+id/consult_service_low_buy_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="(几次起售)"
android:visibility="gone"
android:textColor="#666666"
android:textSize="10dp" />
</LinearLayout>
<TextView
android:id="@+id/consult_service_btn"
android:layout_width="125dp"
android:layout_height="38dp"
android:background="@drawable/im_expert_service_detail_btn_bg"
......
......@@ -2,6 +2,7 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="horizontal">
<LinearLayout
......@@ -13,13 +14,31 @@
android:paddingTop="10dp"
android:paddingBottom="18dp">
<TextView
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="调节孕期情绪烦躁,建立积极心态面对新生活"
android:textColor="#1A1A1A"
android:textSize="16dp"
android:textStyle="bold" />
>
<TextView
android:id="@+id/service_item_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:text=" 调节孕期情绪烦躁,建立积极心态面对新生活"
android:textColor="#1A1A1A"
android:textSize="16dp"
android:textStyle="bold" />
<TextView
android:id="@+id/service_item_package"
android:layout_width="24dp"
android:layout_height="14dp"
android:gravity="center"
android:text="套餐"
android:visibility="gone"
android:layout_marginTop="3dp"
android:textColor="#ffffff"
android:textSize="10dp"
android:background="@drawable/im_service_package_bg"/>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
......@@ -42,6 +61,7 @@
android:textSize="10dp" />
<TextView
android:id="@+id/service_item_price"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="320"
......@@ -51,20 +71,31 @@
</LinearLayout>
<TextView
android:id="@+id/service_item_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="/60分钟"
android:textColor="#999999"
android:textSize="12dp" />
<TextView
android:id="@+id/service_item_low_buy_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:text="(几次起售)"
android:visibility="gone"
android:textColor="#999999"
android:textSize="12dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="好评率"
android:layout_marginLeft="10dp"
android:textColor="#999999"
android:textSize="12dp" />
<TextView
android:id="@+id/service_item_feddbackrate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="99.9%"
......@@ -94,6 +125,7 @@
android:textStyle="bold" />
<TextView
android:id="@+id/service_item_saleout_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="2dp"
......
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/textMessageLayout"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="@color/platform_color_F7F7F7"
android:gravity="center_vertical">
<!--android:paddingTop="@dimen/bottom_component_margin_vertical"-->
<!--android:paddingBottom="@dimen/bottom_component_margin_vertical"-->
<FrameLayout
android:id="@+id/switchLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp">
<ImageView
android:id="@+id/buttonAudioMessage"
android:layout_width="26dp"
android:layout_height="26dp"
android:background="@drawable/im_nim_message_input_voice_normal"
android:contentDescription="@string/im_empty" />
<ImageView
android:id="@+id/buttonTextMessage"
android:layout_width="26dp"
android:layout_height="26dp"
android:layout_gravity="center_vertical"
android:background="@drawable/im_nim_message_input_keyboard"
android:contentDescription="@string/im_empty" />
</FrameLayout>
<FrameLayout
android:id="@+id/audioTextSwitchLayout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="12dp"
android:layout_toLeftOf="@+id/emoji_button"
android:layout_toRightOf="@+id/switchLayout">
<Button
android:id="@+id/audioRecord"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:background="@drawable/im_nim_chat_audio_record_button_background"
android:gravity="center"
android:text="@string/im_record_audio"
android:textColor="@color/color_3D3D3D"
android:textSize="15sp"
android:textStyle="bold"
style="?android:attr/borderlessButtonStyle"
android:visibility="gone" />
</FrameLayout>
<LinearLayout
android:id="@+id/ll_ed"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_marginRight="12dp"
android:layout_marginBottom="10dp"
android:layout_toLeftOf="@+id/emoji_button"
android:layout_toRightOf="@+id/switchLayout"
android:background="@drawable/im_nim_chat_input_edit_background">
<EditText
android:id="@+id/editTextMessage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:autoLink="all"
android:background="#ffffff"
android:hint="放心聊天,信息保密"
android:maxHeight="72dp"
android:maxLines="4"
android:textColorHint="#999999"
android:textSize="15sp" />
</LinearLayout>
<ImageView
android:id="@+id/emoji_button"
android:layout_width="26dp"
android:layout_height="26dp"
android:layout_centerVertical="true"
android:layout_marginRight="12dp"
android:layout_toLeftOf="@+id/sendLayout"
android:background="@drawable/im_nim_message_input_emotion"
android:contentDescription="@string/im_empty"
android:scaleType="center" />
<FrameLayout
android:id="@+id/sendLayout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/im_bottom_component_margin_horizontal">
<ImageView
android:id="@+id/buttonMoreFuntionInText"
android:layout_width="26dp"
android:layout_height="26dp"
android:layout_gravity="center"
android:background="@drawable/im_nim_message_input_plus"
android:contentDescription="@string/im_empty"
android:scaleType="center" />
<TextView
android:id="@+id/buttonSendMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/im_nim_message_button_bottom_send_selector"
android:contentDescription="@string/im_empty"
android:gravity="center"
android:padding="5dp"
android:text="@string/im_send"
android:textColor="@color/im_white"
android:textSize="14sp" />
</FrameLayout>
</RelativeLayout>
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/textMessageLayout"
android:layout_width="match_parent"
android:layout_height="56dp"
android:background="@color/platform_color_F7F7F7"
android:gravity="center_vertical">
<!--android:paddingTop="@dimen/bottom_component_margin_vertical"-->
<!--android:paddingBottom="@dimen/bottom_component_margin_vertical"-->
<FrameLayout
android:id="@+id/switchLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp">
<ImageView
android:id="@+id/buttonAudioMessage"
android:layout_width="26dp"
android:layout_height="26dp"
android:background="@drawable/im_nim_message_input_voice_normal"
android:contentDescription="@string/im_empty" />
<ImageView
android:id="@+id/buttonTextMessage"
android:layout_width="26dp"
android:layout_height="26dp"
android:layout_gravity="center_vertical"
android:background="@drawable/im_nim_message_input_keyboard"
android:contentDescription="@string/im_empty" />
</FrameLayout>
<FrameLayout
android:id="@+id/audioTextSwitchLayout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginRight="12dp"
android:layout_toLeftOf="@+id/emoji_button"
android:layout_toRightOf="@+id/switchLayout">
<Button
android:id="@+id/audioRecord"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp"
android:background="@drawable/im_nim_chat_audio_record_button_background"
android:gravity="center"
android:text="@string/im_record_audio"
android:textColor="@color/color_3D3D3D"
android:textSize="15sp"
android:textStyle="bold"
style="?android:attr/borderlessButtonStyle"
android:visibility="gone" />
</FrameLayout>
<LinearLayout
android:id="@+id/ll_ed"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_marginTop="10dp"
android:layout_marginRight="12dp"
android:layout_marginBottom="10dp"
android:layout_toLeftOf="@+id/emoji_button"
android:layout_toRightOf="@+id/switchLayout"
android:background="@drawable/im_nim_chat_input_edit_background">
<EditText
android:id="@+id/editTextMessage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_weight="1"
android:autoLink="all"
android:background="#ffffff"
android:hint="隐私保密,安心咨询"
android:maxHeight="72dp"
android:maxLines="4"
android:textColorHint="#999999"
android:textSize="15sp" />
</LinearLayout>
<ImageView
android:id="@+id/emoji_button"
android:layout_width="26dp"
android:layout_height="26dp"
android:layout_centerVertical="true"
android:layout_marginRight="12dp"
android:layout_toLeftOf="@+id/sendLayout"
android:background="@drawable/im_nim_message_input_emotion"
android:contentDescription="@string/im_empty"
android:scaleType="center" />
<FrameLayout
android:id="@+id/sendLayout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="@dimen/im_bottom_component_margin_horizontal">
<ImageView
android:id="@+id/buttonMoreFuntionInText"
android:layout_width="26dp"
android:layout_height="26dp"
android:layout_gravity="center"
android:background="@drawable/im_nim_message_input_plus"
android:contentDescription="@string/im_empty"
android:scaleType="center" />
<TextView
android:id="@+id/buttonSendMessage"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/im_nim_message_button_bottom_send_selector"
android:contentDescription="@string/im_empty"
android:gravity="center"
android:padding="5dp"
android:text="@string/im_send"
android:textColor="@color/im_white"
android:textSize="14sp" />
</FrameLayout>
</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