Commit 38678631 by fengquan

feat: 咨询师详情页改版

parent aa9ca9ae
......@@ -23,6 +23,7 @@ interface IImService : IProvider {
// 直接打开聊天页面,不走分配导医
fun startChatBySessionId(context: Activity, toUid: String)
// 打开信息前置收集页
fun startP2PSession(context: Activity, location: Int, ffrom2: String?)
......@@ -183,4 +184,8 @@ interface IImService : IProvider {
fun initIm(app: Application, activity: Class<out Activity>, imInitBean: IMInitConfigBean)
fun isWifiOr3G(activity: Activity): Boolean
fun showConsultServiceDialog(activity: Activity, toUid: String, doctorId: String)
fun dismissConsultServiceDialog();
}
\ No newline at end of file
......@@ -23,6 +23,7 @@ import com.yidianling.muse.activity.ChooseMusicActivity;
//import static com.ydl.ydlcommon.router.IYDLRouterConstant.ROUTER_MUSE_PLAY;
import de.greenrobot.event.EventBus;
import com.yidianling.im.event.CloseBottomWebviewEvent;
import java.util.ArrayList;
......@@ -523,13 +524,18 @@ public class WVClickAbstractListener implements WebViewClientClickListener {
.setData(mThumbViewInfoList)
.setCurrentIndex(params.getPreview_index())
.setFullscreen(true)
.setToUid(info.getToUid() +"")
.setToUid(info.getToUid() + "")
.setDoctorId(info.getDoctorId())
.setType(GPreviewBuilder.IndicatorType.Dot)
.start();
}
@Override
public void showDocBooking(H5JsBean.H5JsCmd.Params params) {
ModularServiceManager.INSTANCE.provide(IImService.class).showConsultServiceDialog(mContext, params.getToUid() + "", params.getDoctorId() + "");
}
@Override
public void switchSound(int mediaId, long meditationId, int meditationType, int businessType,
String buried, String mediaUrl, String mediaCoverUrl,
String title, String desc, int status) {
......@@ -541,9 +547,11 @@ public class WVClickAbstractListener implements WebViewClientClickListener {
businessType, buried, mediaUrl, mediaCoverUrl, title, desc, status);
}
}
@Override
public void chatCloseBottomWebView() {
EventBus.getDefault().post(new CloseBottomWebviewEvent(true));
ModularServiceManager.INSTANCE.provide(IImService.class).dismissConsultServiceDialog();
}
......@@ -556,8 +564,8 @@ public class WVClickAbstractListener implements WebViewClientClickListener {
@Override
public void setWebViewBG(String rgb, String alpha) {
if (mContext instanceof NewH5Activity){
((NewH5Activity)mContext).setBG(rgb, alpha);
if (mContext instanceof NewH5Activity) {
((NewH5Activity) mContext).setBG(rgb, alpha);
}
}
}
......@@ -465,6 +465,11 @@ class WebJavascriptHandler(private val webView: WebView?, private val wvEnventPr
wvEnventPro?.resourceToPreview(jsData.cmd?.params)
}
"doctor_booking" -> {
wvEnventPro?.showDocBooking(jsData.cmd?.params)
}
}
}
}
......@@ -205,4 +205,6 @@ public interface WebViewClientClickListener {
void switchPushStatus(H5JsBean.H5JsCmd.Params params);
void resourceToPreview(H5JsBean.H5JsCmd.Params params);
void showDocBooking(H5JsBean.H5JsCmd.Params params);
}
......@@ -382,6 +382,14 @@ class BasePhotoFragment : Fragment() {
fun actionCancel()
}
fun stopVideo() {
if (videoView != null && videoView!!.isPlaying) {
ivPlay!!.visibility = VISIBLE
stopTiming()
videoView!!.pause()
}
}
companion object {
/**
* 预览图片 类型
......
......@@ -12,16 +12,14 @@ import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentStatePagerAdapter
import androidx.viewpager.widget.ViewPager
import com.alibaba.android.arouter.launcher.ARouter
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.utils.StatusBarUtils
import com.yidianling.consultant.R
import com.yidianling.consultant.preview.GPreviewBuilder.IndicatorType
import com.yidianling.consultant.preview.SmoothImageView.onTransformListener
import com.yidianling.im.api.service.IImService
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.Consumer
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.consultant_image_preview_photo.*
import kotlinx.android.synthetic.main.fragment_image_photo_layout.*
import java.util.*
/**
......@@ -93,11 +91,26 @@ class GPreviewActivity : AppCompatActivity() {
if (!toUid.isNullOrBlank()) {
ARouter.getInstance().navigation(IImService::class.java)
?.startChatBySessionId(context = this, toUid = toUid!!)
Timer().schedule(object : TimerTask() {
override fun run() {
runOnUiThread {
if (fragments != null && currentIndex < fragments!!.size) {
fragments!![currentIndex].stopVideo()
}
}
}
}, 2000)
}
}
bookingBtn.setOnClickListener {
ModularServiceManager.provide(IImService::class.java)
.showConsultServiceDialog(activity = this, toUid = toUid!!, doctorId = doctorId!!)
}
......@@ -116,12 +129,34 @@ class GPreviewActivity : AppCompatActivity() {
}
override fun onPageSelected(position: Int) {
currentIndex = position;
selectPosition?.setText((position + 1).toString() + "")
}
override fun onPageScrollStateChanged(state: Int) {}
})
if (toUid != null) {
val unReadByUid =
ARouter.getInstance().navigation(IImService::class.java).getUnReadByUid(toUid!!)
when {
unReadByUid <= 0 -> {
un_read_num_ll.visibility = View.GONE
}
unReadByUid > 99 -> {
un_read_num_ll.visibility = View.VISIBLE
un_read_num.text = "99"
}
else -> {
un_read_num_ll.visibility = View.VISIBLE
un_read_num.text = unReadByUid.toString()
}
}
}
// viewPager.setOffscreenPageLimit(3);
}
......@@ -136,6 +171,8 @@ class GPreviewActivity : AppCompatActivity() {
val isScale = intent.getBooleanExtra("isScale", false)
SmoothImageView.setIsScale(isScale)
initFragment(imgUrls, currentIndex, BasePhotoFragment::class.java)
}
private fun initFragment(
......
......@@ -25,8 +25,8 @@
android:layout_alignParentBottom="true"
android:layout_marginLeft="@dimen/platform_dp_20"
android:background="@drawable/consultant_bg_btn_chat"
android:text="立即私聊"
android:gravity="center"
android:text="立即私聊"
android:textColor="@color/white"
android:textSize="17sp"
android:textStyle="bold" />
......@@ -39,26 +39,28 @@
android:layout_alignParentBottom="true"
android:layout_marginRight="@dimen/platform_dp_20"
android:background="@drawable/consultant_bg_btn_book"
android:text="立即预约"
android:gravity="center"
android:text="立即预约"
android:textColor="@color/white"
android:textSize="17sp"
android:textStyle="bold" />
<RelativeLayout
android:id="@+id/un_read_num_ll"
android:layout_width="@dimen/platform_dp_17"
android:layout_height="@dimen/platform_dp_17"
android:layout_alignTop="@+id/chatBtn"
android:layout_alignRight="@+id/chatBtn"
android:layout_marginTop="-10dp"
android:layout_marginRight="@dimen/platform_dp_10"
android:visibility="gone"
android:background="@drawable/consultant_bg_chat_unread_num">
<TextView
android:id="@+id/un_read_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:text="3"
android:textColor="@color/white"
android:textSize="@dimen/sp_12" />
......
......@@ -43,6 +43,7 @@ import com.yidianling.im.ui.page.NewMultiMessageFragment
import com.yidianling.nimbase.common.media.picker.PickImageHelper
import com.yidianling.uikit.api.NimUIKit
import com.yidianling.uikit.business.session.helper.MessageListPanelHelper
import com.yidianling.uikit.custom.widget.expertConsultService.view.ExpertConsultServiceListDialog2
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
......@@ -53,6 +54,8 @@ import io.reactivex.schedulers.Schedulers
@Route(path = "/im/ImService")
class IMServiceImpl : IImService {
private var expertConsultServiceListDialog2: ExpertConsultServiceListDialog2 ?= null
override fun isHasUnread(): Boolean {
return MsgReceiveHelper.isHasUnread
}
......@@ -411,4 +414,21 @@ class IMServiceImpl : IImService {
override fun isWifiOr3G(activity: Activity): Boolean {
return NetworkUtil.isWifiOr3G(activity)
}
override fun showConsultServiceDialog(activity: Activity, toUid: String, doctorId: String) {
// 获取专家是否在繁忙状态
if (activity != null) {
expertConsultServiceListDialog2 =
ExpertConsultServiceListDialog2(
activity, null, false, toUid,
doctorId
)
expertConsultServiceListDialog2?.show()
}
}
override fun dismissConsultServiceDialog() {
expertConsultServiceListDialog2?.changeItem()
}
}
\ No newline at end of file
......@@ -55,6 +55,21 @@ class ExpertConsultServiceItemView : LinearLayout {
View.inflate(mContext, R.layout.im_expert_consult_service_item_view, this)
}
fun updateBusyStatus(isBusy: Boolean) {
mIsBusy = isBusy
if (mIsBusy) {
im_expert_service_list_btn.visibility = View.GONE
tv_add.visibility = View.VISIBLE
tv_add.setOnClickListener {
mListener?.addTime()
}
} else {
im_expert_service_list_btn.visibility = View.VISIBLE
tv_add.visibility = View.GONE
}
}
/**
* 设置数据
*/
......@@ -149,7 +164,7 @@ class ExpertConsultServiceItemView : LinearLayout {
null
)
)
}else{
} else {
//新增需求,如果没有绑定手机号,跳转到绑定手机号页面
bindPhoneDialog()
}
......
......@@ -16,20 +16,30 @@ import com.netease.nimlib.sdk.RequestCallback
import com.netease.nimlib.sdk.msg.MessageBuilder
import com.netease.nimlib.sdk.msg.MsgService
import com.netease.nimlib.sdk.msg.constant.SessionTypeEnum
import com.ydl.ydlcommon.data.http.BaseAPIResponse
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.common.tools.RxImageTool
import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.R
import com.yidianling.im.bean.BusyBean
import com.yidianling.im.session.extension.CustomAttachSubScriptTime
import com.yidianling.uikit.business.session.helper.MessageListPanelHelper
import com.yidianling.uikit.custom.bridge.ActionHandlerStorage
import com.yidianling.uikit.custom.http.ServiceImpl
import com.yidianling.uikit.custom.http.ServiceImpl.Companion.instance
import com.yidianling.uikit.custom.http.response.ServiceItemBean
import com.yidianling.uikit.custom.widget.expertConsultService.callback.ConsultServiceViewCallback
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.functions.Consumer
import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.im_expert_consult_service_list_dialog_layout.dialog_bottom_scroll_view
import kotlinx.android.synthetic.main.im_expert_consult_service_list_fragment_layout.*
class ExpertConsultServiceListDialog2(val mContext: Context, val mList: List<ServiceItemBean>, val mIsBusy: Boolean,
val toUid:String, val doctorID:String) : BottomSheetDialogFragment() {
class ExpertConsultServiceListDialog2(
val mContext: Context, val mList: List<ServiceItemBean>?, val mIsBusy: Boolean,
val toUid: String, val doctorID: String
) : BottomSheetDialogFragment() {
private var mConsultServiceListView: ExpertConsultServiceView? = null
private var mWebviewView: ExpertConsultWebview? = null
......@@ -37,10 +47,9 @@ class ExpertConsultServiceListDialog2(val mContext: Context, val mList: List<Ser
private var mSelectType: String = "全部"
var bottomSheet: FrameLayout? = null
private var behavior: BottomSheetBehavior<*>? = null
fun changeItem(){
fun changeItem() {
dialog_bottom_scroll_view.currentItem = 0
}
......@@ -55,81 +64,120 @@ class ExpertConsultServiceListDialog2(val mContext: Context, val mList: List<Ser
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.im_expert_consult_service_list_fragment_layout, container, false)
return inflater.inflate(
R.layout.im_expert_consult_service_list_fragment_layout,
container,
false
)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
var typeList:ArrayList<String> = ArrayList()
var typeList: ArrayList<String> = ArrayList()
typeList.add(mSelectType)//默认选中
mList.forEach { item ->
typeList.add(item.cateName)
}
mConsultServiceListView = ExpertConsultServiceView(mContext,mIsBusy)
(mConsultServiceListView as ExpertConsultServiceView).setDataAndClick(typeList, mList, object :
ConsultServiceViewCallback {
override fun onCloseClick() {
dismiss()
}
override fun onItemClick(serviceBean: ServiceItemBean.ProductsBean) {
// if (mConsultServiceDetailView != null) {
// mConsultServiceDetailView?.updateData(serviceBean)
// dialog_bottom_scroll_view.currentItem = 1
// }
mWebviewView?.setData(serviceBean)
dialog_bottom_scroll_view.currentItem = 1
if (mList != null) {
mList.forEach { item ->
typeList.add(item.cateName)
}
onViewCreate(typeList, mList)
} else {
ServiceImpl.instance.serviceList(doctorID)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(Consumer<BaseAPIResponse<List<ServiceItemBean>>> { res: BaseAPIResponse<List<ServiceItemBean>> ->
if (res.data != null && res.data.size > 0) {
var serviceItemBeanList = res.data
serviceItemBeanList.forEach { item ->
typeList.add(item.cateName)
}
override fun addTime() { // 提醒添加时间回调
dismiss()
// 埋点
ActionCountUtils.baiDuCountSign3("ydl_user_product_page","remind_add_click",toUid,
ActionHandlerStorage.getL(toUid).info.name,"")
// 发送提醒消息
val customTime = CustomAttachSubScriptTime("请尽快添加可预约时间")
val message = MessageBuilder.createCustomMessage(toUid, SessionTypeEnum.P2P, "请尽快添加可预约时间", customTime)
NIMClient.getService(MsgService::class.java).sendMessage(message, false).setCallback(object :
RequestCallback<Void> {
override fun onSuccess(param: Void?) {
MessageListPanelHelper.getInstance().notifyAddMessage(message)
onViewCreate(typeList, serviceItemBeanList)
// 获取专家是否在繁忙状态
instance.queryDoctorIsBusy(doctorID)
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
{ res: BaseAPIResponse<BusyBean> ->
var isBusy = res.data.success
mConsultServiceListView?.setBusyStatus(isBusy)
}
) { throwable: Throwable? -> }
} else {
ToastUtil.toastShort("咨询师暂未发布服务")
}
}, Consumer { throwable: Throwable? -> })
}
override fun onException(exception: Throwable?) {
}
}
override fun onFailed(code: Int) {
private fun onViewCreate(typeList: ArrayList<String>, mList: List<ServiceItemBean>) {
mConsultServiceListView = ExpertConsultServiceView(mContext, mIsBusy)
(mConsultServiceListView as ExpertConsultServiceView).setDataAndClick(
typeList,
mList,
object :
ConsultServiceViewCallback {
override fun onCloseClick() {
dismiss()
}
}
})
}
})
override fun onItemClick(serviceBean: ServiceItemBean.ProductsBean) {
mWebviewView?.setData(serviceBean)
dialog_bottom_scroll_view.currentItem = 1
}
override fun addTime() { // 提醒添加时间回调
dismiss()
// 埋点
ActionCountUtils.baiDuCountSign3(
"ydl_user_product_page", "remind_add_click", toUid,
ActionHandlerStorage.getL(toUid).info.name, ""
)
// 发送提醒消息
val customTime = CustomAttachSubScriptTime("请尽快添加可预约时间")
val message = MessageBuilder.createCustomMessage(
toUid,
SessionTypeEnum.P2P,
"请尽快添加可预约时间",
customTime
)
NIMClient.getService(MsgService::class.java).sendMessage(message, false)
.setCallback(object :
RequestCallback<Void> {
override fun onSuccess(param: Void?) {
MessageListPanelHelper.getInstance().notifyAddMessage(message)
}
override fun onException(exception: Throwable?) {
}
override fun onFailed(code: Int) {
}
})
}
})
consult_service_dialog_close.setOnTouchListener { v, event ->
when(event.action){
MotionEvent.ACTION_DOWN ->{
when (event.action) {
MotionEvent.ACTION_DOWN -> {
behavior?.isHideable = true
}
}
true
}
mViewList.add(mConsultServiceListView as View)
// mConsultServiceDetailView = ExpertConsultServiceDetailView(mContext, object : ConsultServiceViewCallback {
// override fun onBackClick() {
// dialog_bottom_scroll_view.currentItem = 0
// }
// },mIsBusy,toUid)
// mViewList.add(mConsultServiceDetailView as View)
mWebviewView= ExpertConsultWebview(mContext,doctorID =doctorID )
mWebviewView = ExpertConsultWebview(mContext, doctorID = doctorID)
mViewList.add(mWebviewView as View)
dialog_bottom_scroll_view.adapter = ConsultServicePagerAdapter()
......@@ -137,8 +185,6 @@ class ExpertConsultServiceListDialog2(val mContext: Context, val mList: List<Ser
}
override fun setCancelable(cancelable: Boolean) {
val dialog = dialog
val touchOutsideView =
......@@ -181,7 +227,7 @@ class ExpertConsultServiceListDialog2(val mContext: Context, val mList: List<Ser
setMaxHeight(RxDeviceTool.getScreenHeight(mContext) - RxImageTool.dp2px(100f))
//true是跳过peekHeight,直接滑下去,false是可以滑动到顶部还可以保持peekHeight在滑下去
// behavior?.skipCollapsed=true
behavior?.addBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() {
override fun onStateChanged(bottomSheet: View, newState: Int) {
when (newState) {
......@@ -231,7 +277,7 @@ class ExpertConsultServiceListDialog2(val mContext: Context, val mList: List<Ser
}
fun show() {
if (mContext is FragmentActivity){
if (mContext is FragmentActivity) {
show(mContext.supportFragmentManager, "consult_bottom_showdialog")
}
......
......@@ -4,7 +4,6 @@ import android.content.Context
import android.util.AttributeSet
import android.view.View
import android.widget.LinearLayout
import com.yidianling.avchatkit.common.log.LogUtil
import com.yidianling.common.tools.RxDeviceTool
import com.yidianling.im.R
import com.yidianling.uikit.custom.http.response.ServiceItemBean
......@@ -53,7 +52,6 @@ class ExpertConsultServiceView : LinearLayout {
private fun initView() {
val mWidth: Int = RxDeviceTool.getScreenWidth(mContext)
val mHeight: Int = LayoutParams.MATCH_PARENT
......@@ -68,6 +66,15 @@ class ExpertConsultServiceView : LinearLayout {
View.inflate(mContext, R.layout.im_expert_consult_service_view, this)
}
fun setBusyStatus(isBusy: Boolean){
this.mIsBusy = isBusy
for(i in 0 until expert_consult_service_service_list.childCount){
val view = expert_consult_service_service_list.getChildAt(i)
if (view is ExpertConsultServiceItemView) {
view.updateBusyStatus(mIsBusy)
}
}
}
/**
* typeList 类型列表
* serviceList 服务列表
......
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