Commit dc73f7fd by fengquan

feat: 倾诉师介绍层离线按钮需求

parent 077b56ca
...@@ -8,6 +8,7 @@ import android.graphics.drawable.ColorDrawable ...@@ -8,6 +8,7 @@ import android.graphics.drawable.ColorDrawable
import android.net.Uri import android.net.Uri
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.text.TextUtils
import android.view.Gravity import android.view.Gravity
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
...@@ -40,6 +41,7 @@ import com.ydl.ydlcommon.utils.TimeUtil ...@@ -40,6 +41,7 @@ import com.ydl.ydlcommon.utils.TimeUtil
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.view.dialog.CommonDialog import com.ydl.ydlcommon.view.dialog.CommonDialog
import com.ydl.ydlnet.YDLHttpUtils import com.ydl.ydlnet.YDLHttpUtils
import com.yidianling.common.tools.LogUtil
import com.yidianling.common.tools.RxImageTool import com.yidianling.common.tools.RxImageTool
import com.yidianling.common.tools.ToastUtil import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.api.service.IImService import com.yidianling.im.api.service.IImService
...@@ -49,6 +51,8 @@ import com.yidianling.user.api.service.IUserService ...@@ -49,6 +51,8 @@ import com.yidianling.user.api.service.IUserService
import de.greenrobot.event.EventBus import de.greenrobot.event.EventBus
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers import io.reactivex.schedulers.Schedulers
import java.io.UnsupportedEncodingException
import java.net.URLDecoder
import java.util.* import java.util.*
import kotlin.math.roundToInt import kotlin.math.roundToInt
...@@ -59,6 +63,7 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -59,6 +63,7 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
private const val KEY_SHOULD_SHOW = "should_show" private const val KEY_SHOULD_SHOW = "should_show"
private const val KEY_LISTEN_FREE = "listen_free" private const val KEY_LISTEN_FREE = "listen_free"
private const val KEY_UID = "uid" private const val KEY_UID = "uid"
private const val EXPERT_URL = "expert_url"
} }
private var firstVisitWXH5PayUrl = true private var firstVisitWXH5PayUrl = true
...@@ -79,6 +84,7 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -79,6 +84,7 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
lateinit var layout_change_text: View lateinit var layout_change_text: View
lateinit var layoutBottom: View lateinit var layoutBottom: View
lateinit var itemView: View lateinit var itemView: View
var lineStatus:Int = 0
var bottomSheet :FrameLayout?=null var bottomSheet :FrameLayout?=null
var mJtoJHandle:IJavascriptHandler?=null var mJtoJHandle:IJavascriptHandler?=null
...@@ -86,6 +92,7 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -86,6 +92,7 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
var isLogin : Boolean = false var isLogin : Boolean = false
lateinit var jumpUrl: String lateinit var jumpUrl: String
lateinit var doctorId: String lateinit var doctorId: String
lateinit var expertUrl:String
var shouldShow: Boolean? = false var shouldShow: Boolean? = false
var uid: String? = null var uid: String? = null
var listen_free : Boolean = false var listen_free : Boolean = false
...@@ -95,7 +102,8 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -95,7 +102,8 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
doctorId: String, doctorId: String,
shouldShow: Boolean = false, shouldShow: Boolean = false,
uid: String? = null, uid: String? = null,
listenFree: Boolean = false listenFree: Boolean = false,
expertUrl:String = ""
) { ) {
arguments = Bundle().apply { arguments = Bundle().apply {
putString(KEY_JUMP_URL, jumpUrl) putString(KEY_JUMP_URL, jumpUrl)
...@@ -103,6 +111,7 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -103,6 +111,7 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
putBoolean(KEY_SHOULD_SHOW, shouldShow) putBoolean(KEY_SHOULD_SHOW, shouldShow)
putBoolean(KEY_LISTEN_FREE,listenFree) putBoolean(KEY_LISTEN_FREE,listenFree)
uid?.let { putString(KEY_UID, it) } uid?.let { putString(KEY_UID, it) }
putString(EXPERT_URL,expertUrl)
} }
show(activity.supportFragmentManager, "confide_bottom_showdialog") show(activity.supportFragmentManager, "confide_bottom_showdialog")
} }
...@@ -128,6 +137,7 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -128,6 +137,7 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
ActionCountUtils.record("ydl_experts_detail_popupwindows_page", "ydl_experts_detail_popupwindows_page_visit") ActionCountUtils.record("ydl_experts_detail_popupwindows_page", "ydl_experts_detail_popupwindows_page_visit")
jumpUrl = arguments?.getString(KEY_JUMP_URL) ?: "" jumpUrl = arguments?.getString(KEY_JUMP_URL) ?: ""
doctorId = arguments?.getString(KEY_DOCTOR_ID) ?: "" doctorId = arguments?.getString(KEY_DOCTOR_ID) ?: ""
expertUrl = arguments?.getString(EXPERT_URL) ?:""
shouldShow = arguments?.getBoolean(KEY_SHOULD_SHOW) ?: false shouldShow = arguments?.getBoolean(KEY_SHOULD_SHOW) ?: false
uid = arguments?.getString(KEY_UID) uid = arguments?.getString(KEY_UID)
listen_free = arguments?.getBoolean(KEY_LISTEN_FREE) ?: false listen_free = arguments?.getBoolean(KEY_LISTEN_FREE) ?: false
...@@ -216,7 +226,44 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -216,7 +226,44 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
.show() .show()
return@setOnClickListener return@setOnClickListener
} }
callJsFun(wv_content, "listenCallClick()")
when(lineStatus){
1,4 ->{
callJsFun(wv_content, "listenCallClick()")
}
3,6 ->{
if (!uid.isNullOrBlank()) {
activity?.let { it1 ->
ARouter.getInstance().navigation(IImService::class.java)
?.startChatBySessionId(it1, uid!!)
}
}
}
5->{
if (!TextUtils.isEmpty(expertUrl)){
val linkUri = Uri.parse(expertUrl)
if (linkUri != null) {
val host = linkUri.host
if (!TextUtils.isEmpty(host) && host == "h5") {
//如果是h5,跳转至NewH5Activity
try {
var params = URLDecoder.decode(linkUri.getQueryParameter("params"),"UTF-8")
ARouter.getInstance().build("/new_h5/h5").withSerializable("routerParam", params).navigation()
}catch (e : NullPointerException){
LogUtil.e("params参数为空")
}catch (e : UnsupportedEncodingException){
LogUtil.e("解码错误")
}catch (e : UnsupportedOperationException){
LogUtil.e("这不是一个uri格式的地址")
}
}
}
}
}
}
} }
layoutChange.setOnClickListener { layoutChange.setOnClickListener {
layout_change_text.visibility = View.GONE layout_change_text.visibility = View.GONE
...@@ -335,6 +382,8 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -335,6 +382,8 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
layout_change_text.visibility = View.VISIBLE layout_change_text.visibility = View.VISIBLE
this.doctorId = doctorId this.doctorId = doctorId
onLoadDialStatus(doctorId) onLoadDialStatus(doctorId)
val confideHomeActivity = activity as ConfideHomeActivity
expertUrl = confideHomeActivity.searchLinkUrlByUid(uid)
callJsFun(wv_content, "setUnRead(${getUnReadByUid(uid = uid)})") callJsFun(wv_content, "setUnRead(${getUnReadByUid(uid = uid)})")
} }
...@@ -520,7 +569,7 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -520,7 +569,7 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
.subscribe({ resp -> .subscribe({ resp ->
if (resp.code == "200") { if (resp.code == "200") {
layoutCall.visibility = View.VISIBLE layoutCall.visibility = View.VISIBLE
val lineStatus = resp.data?.confideLine ?: 2 lineStatus = resp.data?.confideLine ?: 2
if (isLogin && listen_free){ if (isLogin && listen_free){
free.visibility = View.VISIBLE free.visibility = View.VISIBLE
...@@ -584,6 +633,20 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -584,6 +633,20 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
} }
} }
5 -> {
tvCall.text = "已离线,可预约"
tvTime.visibility = View.GONE
ivCall.visibility = View.GONE
layoutCall.background =
context?.getDrawable(R.drawable.confide_offline_book_bg)
}
6 -> {
tvCall.text = "已离线,可留言"
tvTime.visibility = View.GONE
ivCall.visibility = View.GONE
layoutCall.background =
context?.getDrawable(R.drawable.confide_offline_book_bg)
}
} }
} else { } else {
if (!resp.msg.isNullOrEmpty()) { if (!resp.msg.isNullOrEmpty()) {
......
...@@ -665,4 +665,15 @@ class ConfideHomeActivity : ...@@ -665,4 +665,15 @@ class ConfideHomeActivity :
} }
super.onBackPressed() super.onBackPressed()
} }
public fun searchLinkUrlByUid(uid : String):String{
cacheList?.forEach {confideHomeDataBean ->
confideHomeDataBean.body?.forEach { confideHomeBodyBean ->
if (uid == confideHomeBodyBean.uid.toString()){
return confideHomeBodyBean.linkUrl?:""
}
}
}
return ""
}
} }
\ No newline at end of file
...@@ -132,13 +132,13 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo ...@@ -132,13 +132,13 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo
* 最佳倾诉榜单--点我倾诉 * 最佳倾诉榜单--点我倾诉
* @param linkUrl 跳转地址 * @param linkUrl 跳转地址
*/ */
override fun consultantClick(doctorId: String?, confideId: String?, uid: String?,listenFree : Boolean?) { override fun consultantClick(doctorId: String?, confideId: String?, uid: String?,listenFree : Boolean?, expertUrl:String?) {
confideId?.let { confideId?.let {
ConfideBottomSheetDialogFragment() ConfideBottomSheetDialogFragment()
.showBottomSheetDialog( .showBottomSheetDialog(
mContext as FragmentActivity, mContext as FragmentActivity,
HttpConfig.MH5_URL + ConfideRoute.h5ConfideIntro(it), HttpConfig.MH5_URL + ConfideRoute.h5ConfideIntro(it),
doctorId!!, uid = uid, listenFree = listenFree ?: false doctorId!!, uid = uid, listenFree = listenFree ?: false,expertUrl = expertUrl?:""
) )
} }
} }
......
...@@ -73,7 +73,7 @@ interface IConfideHomeEvent { ...@@ -73,7 +73,7 @@ interface IConfideHomeEvent {
* 咨询师推荐--点我倾诉 * 咨询师推荐--点我倾诉
* @param linkUrl 跳转地址 * @param linkUrl 跳转地址
*/ */
fun consultantClick(doctorId: String?, confideId: String?, uid: String?, listenFree: Boolean?= false) fun consultantClick(doctorId: String?, confideId: String?, uid: String?, listenFree: Boolean?= false, expertUrl : String?="")
fun videoShowClick(index: Int, data: List<ConfideHomeBodyBean>?) fun videoShowClick(index: Int, data: List<ConfideHomeBodyBean>?)
......
...@@ -38,7 +38,7 @@ interface ConfideHomeApi { ...@@ -38,7 +38,7 @@ interface ConfideHomeApi {
// 1=在线 3-通话中 2-离线 // 1=在线 3-通话中 2-离线
@Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA) @Headers(YDL_DOMAIN + YDL_DOMAIN_JAVA)
@GET("auth/listen/dialchangestatus") @GET("auth/listen/dialchangestatus")
fun getDialStatus(@Query("doctorId") doctorId: String): Observable<BaseAPIResponse<DialStatus>> fun getDialStatus(@Query("doctorId") doctorId: String, @Query("listenVersion")listenVersion : String = "2.1"): Observable<BaseAPIResponse<DialStatus>>
@GET @GET
fun recommendDoctor( fun recommendDoctor(
......
...@@ -19,6 +19,12 @@ fun TextView.confideLineText(line: Int) { ...@@ -19,6 +19,12 @@ fun TextView.confideLineText(line: Int) {
4->{ 4->{
text = "继续倾诉" text = "继续倾诉"
} }
5->{
text = "已离线,可预约"
}
6->{
text = "已离线,可留言"
}
} }
} }
......
...@@ -94,7 +94,7 @@ class ConfideHomeRecommendView(var view: IConfideHomeContract.View, context: Con ...@@ -94,7 +94,7 @@ class ConfideHomeRecommendView(var view: IConfideHomeContract.View, context: Con
"1" "1"
) )
confideHomeEvent.consultantClick(bodyBean.doctorId, bodyBean.confidedId, bodyBean.uid?.toString(),bodyBean.listenFree) confideHomeEvent.consultantClick(bodyBean.doctorId, bodyBean.confidedId, bodyBean.uid?.toString(),bodyBean.listenFree,bodyBean.linkUrl)
} }
img_head.setOnClickListener { img_head.setOnClickListener {
......
...@@ -2,6 +2,7 @@ package com.ydl.confide.intro ...@@ -2,6 +2,7 @@ package com.ydl.confide.intro
import android.app.Activity import android.app.Activity
import android.net.Uri import android.net.Uri
import android.text.TextUtils
import android.util.Log import android.util.Log
import android.view.View import android.view.View
import android.widget.SeekBar import android.widget.SeekBar
...@@ -11,6 +12,7 @@ import androidx.databinding.ObservableInt ...@@ -11,6 +12,7 @@ import androidx.databinding.ObservableInt
import androidx.databinding.ViewDataBinding import androidx.databinding.ViewDataBinding
import androidx.fragment.app.FragmentActivity import androidx.fragment.app.FragmentActivity
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.alibaba.android.arouter.launcher.ARouter
import com.dou361.ijkplayer.widget.IjkVideoView import com.dou361.ijkplayer.widget.IjkVideoView
import com.facebook.drawee.backends.pipeline.Fresco import com.facebook.drawee.backends.pipeline.Fresco
import com.facebook.drawee.interfaces.DraweeController import com.facebook.drawee.interfaces.DraweeController
...@@ -35,6 +37,8 @@ import io.reactivex.disposables.Disposable ...@@ -35,6 +37,8 @@ import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.confide_home_activity.* import kotlinx.android.synthetic.main.confide_home_activity.*
import tv.danmaku.ijk.media.player.IjkMediaPlayer import tv.danmaku.ijk.media.player.IjkMediaPlayer
import java.io.UnsupportedEncodingException
import java.net.URLDecoder
import java.net.URLEncoder import java.net.URLEncoder
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
...@@ -77,6 +81,36 @@ internal class ItemIntroHolder(binding: ItemExpertIntroBinding) : ...@@ -77,6 +81,36 @@ internal class ItemIntroHolder(binding: ItemExpertIntroBinding) :
) )
val status = item.lineStatus.get() val status = item.lineStatus.get()
when (status) { when (status) {
5 -> {
if (!TextUtils.isEmpty(item.linkedUrl.get())){
val linkUri = Uri.parse(item.linkedUrl.get())
if (linkUri != null) {
val host = linkUri.host
if (!TextUtils.isEmpty(host) && host == "h5") {
//如果是h5,跳转至NewH5Activity
try {
var params = URLDecoder.decode(linkUri.getQueryParameter("params"),"UTF-8")
ARouter.getInstance().build("/new_h5/h5").withSerializable("routerParam", params).navigation()
}catch (e : NullPointerException){
com.yidianling.common.tools.LogUtil.e("params参数为空")
}catch (e : UnsupportedEncodingException){
com.yidianling.common.tools.LogUtil.e("解码错误")
}catch (e : UnsupportedOperationException){
com.yidianling.common.tools.LogUtil.e("这不是一个uri格式的地址")
}
}
}
}
}
6 -> {
if (!item.uid.isNullOrBlank()) {
(itemView.context as? Activity)?.let { it1 ->
ARouter.getInstance().navigation(IImService::class.java)
?.startChatBySessionId(it1, item.uid!!)
}
}
}
2, 3 -> {//离线,通话中 2, 3 -> {//离线,通话中
(itemView.context as? Activity)?.let { aty -> (itemView.context as? Activity)?.let { aty ->
findRouteService(IImService::class.java).startChat(aty, item.uid!!, 0, 0) findRouteService(IImService::class.java).startChat(aty, item.uid!!, 0, 0)
...@@ -360,6 +394,7 @@ class VideoViewModel { ...@@ -360,6 +394,7 @@ class VideoViewModel {
var doctorId: String? = null var doctorId: String? = null
var confideId: String? = null var confideId: String? = null
var listenFree = ObservableBoolean(false) var listenFree = ObservableBoolean(false)
var linkedUrl = ObservableField<String>("")
} }
private fun genMinProgramPath(url: String): String { private fun genMinProgramPath(url: String): String {
...@@ -371,6 +406,7 @@ private fun genMinProgramPath(url: String): String { ...@@ -371,6 +406,7 @@ private fun genMinProgramPath(url: String): String {
internal fun VideoViewModel.mapOf(bean: ConfideHomeBodyBean): VideoViewModel { internal fun VideoViewModel.mapOf(bean: ConfideHomeBodyBean): VideoViewModel {
name.set(bean.confidedName) name.set(bean.confidedName)
avatar.set(bean.confidedIcon) avatar.set(bean.confidedIcon)
linkedUrl.set(bean.linkUrl)
val num = bean.confideNum?.replace("人", "") ?: "0" val num = bean.confideNum?.replace("人", "") ?: "0"
count.set("倾诉人次 $num") count.set("倾诉人次 $num")
intro.set(bean.confideContent) intro.set(bean.confideContent)
......
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<corners android:radius="26dp" />
<gradient
android:endColor="#FE745B"
android:startColor="#FF8772" />
<stroke
android:width="1dp"
android:color="#69FFFFFF" />
</shape>
\ No newline at end of file
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
android:layout_width="160dp" android:layout_width="160dp"
android:layout_height="47dp" android:layout_height="47dp"
android:layout_marginBottom="28dp" android:layout_marginBottom="28dp"
android:background="@{item.lineStatus==3?@drawable/confide_line_bg_3:(item.lineStatus==2?@drawable/confide_line_bg_2:@drawable/confide_line_bg_1)}" android:background="@{(item.lineStatus == 5 || item.lineStatus == 6) ? @drawable/confide_offline_book_bg : item.lineStatus==3?@drawable/confide_line_bg_3:(item.lineStatus==2?@drawable/confide_line_bg_2:@drawable/confide_line_bg_1)}"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
......
...@@ -690,7 +690,7 @@ public class ErrorMessageConverter { ...@@ -690,7 +690,7 @@ public class ErrorMessageConverter {
return getLocalizedString(R.string.TUIKitErrorSVRNoSuccessResult); // @"批量操作无成功结果"; return getLocalizedString(R.string.TUIKitErrorSVRNoSuccessResult); // @"批量操作无成功结果";
case BaseConstants.ERR_TO_USER_INVALID: case BaseConstants.ERR_TO_USER_INVALID:
return getLocalizedString(R.string.TUIKitErrorSVRToUserInvalid); // @"IM: 无效接收方"; return getLocalizedString(R.string.TUIKitErrorSVRToUserInvalid); // @"IM: 无效接收方";
case BaseConstants.ERR_REQUEST_TIMEOUT: case BaseConstants.ERR_REQUEST_TIME_OUT:
return getLocalizedString(R.string.TUIKitErrorSVRRequestTimeout); // @"请求超时"; return getLocalizedString(R.string.TUIKitErrorSVRRequestTimeout); // @"请求超时";
case BaseConstants.ERR_INIT_CORE_FAIL: case BaseConstants.ERR_INIT_CORE_FAIL:
return getLocalizedString(R.string.TUIKitErrorSVRInitCoreFail); // @"INIT CORE模块失败"; return getLocalizedString(R.string.TUIKitErrorSVRInitCoreFail); // @"INIT CORE模块失败";
......
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