Commit eed8bfcc by 刘鹏

Merge branch 'fix/fq/fq_v4.3.98' into 'd/v4.3.98'

Fix/fq/fq v4.3.98

See merge request app_android_lib/YDL-Component!172
parents e932a552 1d59ecc6
...@@ -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
...@@ -57,7 +61,9 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -57,7 +61,9 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
private const val KEY_JUMP_URL = "jumpUrl" private const val KEY_JUMP_URL = "jumpUrl"
private const val KEY_DOCTOR_ID = "doctor_id" private const val KEY_DOCTOR_ID = "doctor_id"
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_UID = "uid" private const val KEY_UID = "uid"
private const val EXPERT_URL = "expert_url"
} }
private var firstVisitWXH5PayUrl = true private var firstVisitWXH5PayUrl = true
...@@ -73,31 +79,39 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -73,31 +79,39 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
lateinit var ivCall: ImageView lateinit var ivCall: ImageView
lateinit var tvTime: TextView lateinit var tvTime: TextView
lateinit var first_order: SimpleDraweeView lateinit var first_order: SimpleDraweeView
lateinit var free: SimpleDraweeView
lateinit var confideProgress: View lateinit var confideProgress: View
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 bottomSheet :FrameLayout?=null var lineStatus: Int = 0
var mJtoJHandle:IJavascriptHandler?=null var bottomSheet: FrameLayout? = null
var mJtoJHandle: IJavascriptHandler? = null
private var behavior: BottomSheetBehavior<*>? = null private var behavior: BottomSheetBehavior<*>? = null
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
fun showBottomSheetDialog( fun showBottomSheetDialog(
activity: FragmentActivity, activity: FragmentActivity,
jumpUrl: String, jumpUrl: String,
doctorId: String, doctorId: String,
shouldShow: Boolean = false, shouldShow: Boolean = false,
uid: String? = null uid: String? = null,
listenFree: Boolean = false,
expertUrl: String = ""
) { ) {
arguments = Bundle().apply { arguments = Bundle().apply {
putString(KEY_JUMP_URL, jumpUrl) putString(KEY_JUMP_URL, jumpUrl)
putString(KEY_DOCTOR_ID, doctorId) putString(KEY_DOCTOR_ID, doctorId)
putBoolean(KEY_SHOULD_SHOW, shouldShow) putBoolean(KEY_SHOULD_SHOW, shouldShow)
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")
} }
...@@ -120,11 +134,16 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -120,11 +134,16 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
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
onLoadDialStatus(doctorId) onLoadDialStatus(doctorId)
// + // +
wv_content = view.findViewById<ProgressWebView>(com.ydl.webview.R.id.wv_content) wv_content = view.findViewById<ProgressWebView>(com.ydl.webview.R.id.wv_content)
...@@ -175,20 +194,19 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -175,20 +194,19 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
ivCall = itemView.findViewById<ImageView>(R.id.ivCall) ivCall = itemView.findViewById<ImageView>(R.id.ivCall)
tvTime = itemView.findViewById<TextView>(R.id.tvTime) tvTime = itemView.findViewById<TextView>(R.id.tvTime)
first_order = itemView.findViewById<SimpleDraweeView>(R.id.first_order) first_order = itemView.findViewById<SimpleDraweeView>(R.id.first_order)
free = itemView.findViewById<SimpleDraweeView>(R.id.free)
val userService = findRouteService(IUserService::class.java) val userService = findRouteService(IUserService::class.java)
val isLogin = userService.isLogin()
first_order.visibility = if (isLogin) View.GONE else View.VISIBLE
isLogin = userService.isLogin()
first_order.visibility = if (isLogin) View.GONE else View.VISIBLE
val controller: DraweeController = Fresco.newDraweeControllerBuilder() val controller: DraweeController = Fresco.newDraweeControllerBuilder()
.setUri(Uri.parse("res://drawable/"+R.drawable.first_order)) .setUri(Uri.parse("res://drawable/" + R.drawable.confide_first_order))
.setOldController(first_order.controller) .setOldController(first_order.controller)
.setAutoPlayAnimations(true) // 是否自动播放Gif动画 .setAutoPlayAnimations(true) // 是否自动播放Gif动画
.build() .build()
first_order.controller = controller first_order.controller = controller
layoutCall.setOnClickListener { layoutCall.setOnClickListener {
ActionCountUtils.record( ActionCountUtils.record(
"ydl_experts_detail_popupwindows_page", "ydl_experts_detail_popupwindows_page",
...@@ -211,8 +229,49 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -211,8 +229,49 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
.show() .show()
return@setOnClickListener return@setOnClickListener
} }
when (lineStatus) {
1, 4 -> {
callJsFun(wv_content, "listenCallClick()") 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
confideProgress.visibility = View.VISIBLE confideProgress.visibility = View.VISIBLE
...@@ -220,6 +279,7 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -220,6 +279,7 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
} }
} }
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog { override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
val dialog = super.onCreateDialog(savedInstanceState) as BottomSheetDialog val dialog = super.onCreateDialog(savedInstanceState) as BottomSheetDialog
onShowReady() onShowReady()
...@@ -239,12 +299,12 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -239,12 +299,12 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
behavior = BottomSheetBehavior.from(bottomSheet!!) behavior = BottomSheetBehavior.from(bottomSheet!!)
behavior?.peekHeight = (resources.displayMetrics.heightPixels * 0.7F).roundToInt() behavior?.peekHeight = (resources.displayMetrics.heightPixels * 0.7F).roundToInt()
if (jumpUrl?.contains("payPage=1")){ if (jumpUrl?.contains("payPage=1")) {
//支付高度 //支付高度
setMaxHeight(RxImageTool.dp2px(450f)) setMaxHeight(RxImageTool.dp2px(450f))
behavior?.isHideable = false behavior?.isHideable = false
rl_title.visibility = View.GONE rl_title.visibility = View.GONE
}else{ } else {
setMaxHeight(resources.displayMetrics.heightPixels) setMaxHeight(resources.displayMetrics.heightPixels)
} }
//true是跳过peekHeight,直接滑下去,false是可以滑动到顶部还可以保持peekHeight在滑下去 //true是跳过peekHeight,直接滑下去,false是可以滑动到顶部还可以保持peekHeight在滑下去
...@@ -255,7 +315,7 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -255,7 +315,7 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
BottomSheetBehavior.STATE_EXPANDED -> { BottomSheetBehavior.STATE_EXPANDED -> {
bottomSheet.background = ColorDrawable(Color.WHITE) bottomSheet.background = ColorDrawable(Color.WHITE)
if (!jumpUrl?.contains("payPage=1")){ if (!jumpUrl?.contains("payPage=1")) {
rl_title.visibility = View.VISIBLE rl_title.visibility = View.VISIBLE
text_title.visibility = View.VISIBLE text_title.visibility = View.VISIBLE
close_webview_Icon.visibility = View.VISIBLE close_webview_Icon.visibility = View.VISIBLE
...@@ -285,10 +345,12 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -285,10 +345,12 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
} }
return dialog return dialog
} }
private fun setMaxHeight(height : Int){
private fun setMaxHeight(height: Int) {
bottomSheet?.layoutParams?.height = height bottomSheet?.layoutParams?.height = height
bottomSheet?.requestLayout() bottomSheet?.requestLayout()
} }
private fun callJsFun(wv_content: ProgressWebView, funcName: String) { private fun callJsFun(wv_content: ProgressWebView, funcName: String) {
val sb = StringBuffer("javascript:") val sb = StringBuffer("javascript:")
sb.append(funcName) sb.append(funcName)
...@@ -330,6 +392,11 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -330,6 +392,11 @@ 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)
if (activity is ConfideHomeActivity) {
val confideHomeActivity = activity as ConfideHomeActivity
expertUrl = confideHomeActivity?.searchLinkUrlByUid(uid) ?: ""
}
callJsFun(wv_content, "setUnRead(${getUnReadByUid(uid = uid)})") callJsFun(wv_content, "setUnRead(${getUnReadByUid(uid = uid)})")
} }
...@@ -515,7 +582,19 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -515,7 +582,19 @@ 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) {
free.visibility = View.VISIBLE
val controller: DraweeController = Fresco.newDraweeControllerBuilder()
.setUri(Uri.parse("res://drawable/" + R.drawable.confide_free))
.setOldController(free.controller)
.setAutoPlayAnimations(true) // 是否自动播放Gif动画
.build()
free.controller = controller
} else {
free.visibility = View.GONE
}
/* /*
* 1在线 2离线 3通话中 4 继续倾诉 * 1在线 2离线 3通话中 4 继续倾诉
* */ * */
...@@ -536,7 +615,12 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -536,7 +615,12 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
context?.getDrawable(R.drawable.confide_line_bg_2) context?.getDrawable(R.drawable.confide_line_bg_2)
if (showTip) { if (showTip) {
if (!uid.isNullOrBlank()) { if (!uid.isNullOrBlank()) {
findRouteService(IImService::class.java).startChat(requireActivity(), uid!!, 0, 0) findRouteService(IImService::class.java).startChat(
requireActivity(),
uid!!,
0,
0
)
} }
} }
} }
...@@ -550,7 +634,12 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -550,7 +634,12 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
if (showTip) { if (showTip) {
ToastUtil.toastShort("对方正在通话中,请稍后拨打") ToastUtil.toastShort("对方正在通话中,请稍后拨打")
if (!uid.isNullOrBlank()) { if (!uid.isNullOrBlank()) {
findRouteService(IImService::class.java).startChat(requireActivity(), uid!!, 0, 0) findRouteService(IImService::class.java).startChat(
requireActivity(),
uid!!,
0,
0
)
} }
} }
} }
...@@ -567,6 +656,20 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -567,6 +656,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()) {
...@@ -581,10 +684,12 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -581,10 +684,12 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
wv_content.destroy() wv_content.destroy()
EventBus.getDefault().unregister(this) EventBus.getDefault().unregister(this)
} }
//登录成功 //登录成功
fun onEvent(event: UserLoginEvent) { fun onEvent(event: UserLoginEvent) {
loadUrl() loadUrl()
} }
//绑定成功 //绑定成功
fun onEvent(event: UserBindPhoneEvent) { fun onEvent(event: UserBindPhoneEvent) {
loadUrl() loadUrl()
......
...@@ -9,14 +9,14 @@ import android.view.View ...@@ -9,14 +9,14 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.view.WindowManager import android.view.WindowManager
import android.view.animation.AccelerateInterpolator import android.view.animation.AccelerateInterpolator
import android.view.animation.Animation
import android.view.animation.DecelerateInterpolator import android.view.animation.DecelerateInterpolator
import android.view.animation.TranslateAnimation import android.widget.ImageView
import android.widget.RelativeLayout import android.widget.RelativeLayout
import androidx.fragment.app.FragmentActivity import androidx.fragment.app.FragmentActivity
import androidx.recyclerview.widget.RecyclerView
import androidx.recyclerview.widget.SimpleItemAnimator import androidx.recyclerview.widget.SimpleItemAnimator
import com.alibaba.android.arouter.facade.annotation.Route import com.alibaba.android.arouter.facade.annotation.Route
import com.bumptech.glide.Glide
import com.bumptech.glide.load.engine.DiskCacheStrategy
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
import com.jcodecraeer.xrecyclerview.ProgressStyle import com.jcodecraeer.xrecyclerview.ProgressStyle
...@@ -57,6 +57,7 @@ import com.yidianling.common.tools.ToastUtil ...@@ -57,6 +57,7 @@ import com.yidianling.common.tools.ToastUtil
import com.yidianling.im.api.service.IImService import com.yidianling.im.api.service.IImService
import com.yidianling.user.api.service.IUserService import com.yidianling.user.api.service.IUserService
import kotlinx.android.synthetic.main.confide_home_activity.* import kotlinx.android.synthetic.main.confide_home_activity.*
import kotlinx.android.synthetic.main.confide_recommend_view_new.view.*
import kotlinx.android.synthetic.main.confide_title_bar.* import kotlinx.android.synthetic.main.confide_title_bar.*
/** /**
...@@ -264,7 +265,7 @@ class ConfideHomeActivity : ...@@ -264,7 +265,7 @@ class ConfideHomeActivity :
findViewById<View>(R.id.confide_Free).visibility = if (isLogin) View.GONE else View.VISIBLE findViewById<View>(R.id.confide_Free).visibility = if (isLogin) View.GONE else View.VISIBLE
if (!isLogin) { if (!isLogin) {
val controller: DraweeController = Fresco.newDraweeControllerBuilder() val controller: DraweeController = Fresco.newDraweeControllerBuilder()
.setUri(Uri.parse("res://drawable/" + R.drawable.first_order)) .setUri(Uri.parse("res://drawable/" + R.drawable.confide_first_order))
.setOldController(confide_Free.controller) .setOldController(confide_Free.controller)
.setAutoPlayAnimations(true) // 是否自动播放Gif动画 .setAutoPlayAnimations(true) // 是否自动播放Gif动画
.build() .build()
...@@ -273,6 +274,11 @@ class ConfideHomeActivity : ...@@ -273,6 +274,11 @@ class ConfideHomeActivity :
if (isLogin) { if (isLogin) {
findViewById<View>(R.id.confideRed).visibility = findViewById<View>(R.id.confideRed).visibility =
if (listenFree) View.VISIBLE else View.GONE if (listenFree) View.VISIBLE else View.GONE
Glide.with(this)
.load(R.drawable.confide__free)
.diskCacheStrategy(DiskCacheStrategy.RESOURCE)
.into(findViewById<ImageView>(R.id.confideRed))
(quick_consult_btn.layoutParams as? ViewGroup.MarginLayoutParams)?.rightMargin = (quick_consult_btn.layoutParams as? ViewGroup.MarginLayoutParams)?.rightMargin =
if (listenFree) dp48 / 2 else 0 if (listenFree) dp48 / 2 else 0
} }
...@@ -305,7 +311,8 @@ class ConfideHomeActivity : ...@@ -305,7 +311,8 @@ class ConfideHomeActivity :
this as FragmentActivity, this as FragmentActivity,
HttpConfig.MH5_URL + ConfideRoute.h5ConfideIntro("0"), HttpConfig.MH5_URL + ConfideRoute.h5ConfideIntro("0"),
"0", "0",
true true,
listenFree = listenFree
) )
...@@ -640,4 +647,15 @@ class ConfideHomeActivity : ...@@ -640,4 +647,15 @@ class ConfideHomeActivity :
} }
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?) { 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 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?) 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(
......
...@@ -16,9 +16,15 @@ fun TextView.confideLineText(line: Int) { ...@@ -16,9 +16,15 @@ fun TextView.confideLineText(line: Int) {
3 -> { 3 -> {
text = "通话中" text = "通话中"
} }
4->{ 4 -> {
text = "继续倾诉" text = "继续倾诉"
} }
5 -> {
text = "已离线,可预约"
}
6 -> {
text = "已离线,可留言"
}
} }
} }
......
...@@ -243,7 +243,7 @@ class ConfideHomeRecommendExpertItemView(mContext: Context, private var confideH ...@@ -243,7 +243,7 @@ class ConfideHomeRecommendExpertItemView(mContext: Context, private var confideH
private fun click(bodyBean: ConfideHomeBodyBean) { private fun click(bodyBean: ConfideHomeBodyBean) {
when (bodyBean.confideLine) {//1在线 2离线 3通话中 when (bodyBean.confideLine) {//1在线 2离线 3通话中
1, 3, 4 -> { 1, 3, 4 -> {
confideHomeEvent.consultantClick(bodyBean.doctorId, bodyBean.confidedId, bodyBean.uid?.toString()) confideHomeEvent.consultantClick(bodyBean.doctorId, bodyBean.confidedId, bodyBean.uid?.toString(), bodyBean.listenFree)
} }
2 -> { 2 -> {
//跳转私聊 并发送自定义消息 //跳转私聊 并发送自定义消息
......
...@@ -94,7 +94,8 @@ class ConfideHomeRecommendView(var view: IConfideHomeContract.View, context: Con ...@@ -94,7 +94,8 @@ class ConfideHomeRecommendView(var view: IConfideHomeContract.View, context: Con
"1" "1"
) )
confideHomeEvent.consultantClick(bodyBean.doctorId, bodyBean.confidedId, bodyBean.uid?.toString()) confideHomeEvent.consultantClick(bodyBean.doctorId, bodyBean.confidedId, bodyBean.uid?.toString(), bodyBean.listenFree,bodyBean.linkUrl)
} }
img_head.setOnClickListener { img_head.setOnClickListener {
ActionCountUtils.record("listen_counselor_list_page", "head_portrait_click", "2") ActionCountUtils.record("listen_counselor_list_page", "head_portrait_click", "2")
...@@ -344,7 +345,7 @@ class ConfideHomeRecommendView(var view: IConfideHomeContract.View, context: Con ...@@ -344,7 +345,7 @@ class ConfideHomeRecommendView(var view: IConfideHomeContract.View, context: Con
if (bodyBean.confideLine == 3) { if (bodyBean.confideLine == 3) {
} }
confideHomeEvent.consultantClick(bodyBean.doctorId, bodyBean.confidedId, bodyBean.uid?.toString()) confideHomeEvent.consultantClick(bodyBean.doctorId, bodyBean.confidedId, bodyBean.uid?.toString(), bodyBean.listenFree)
} }
2 -> { 2 -> {
//跳转私聊 并发送自定义消息 //跳转私聊 并发送自定义消息
......
...@@ -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)
...@@ -226,12 +260,19 @@ internal class ItemIntroHolder(binding: ItemExpertIntroBinding) : ...@@ -226,12 +260,19 @@ internal class ItemIntroHolder(binding: ItemExpertIntroBinding) :
} }
val controller: DraweeController = Fresco.newDraweeControllerBuilder() val controller: DraweeController = Fresco.newDraweeControllerBuilder()
.setUri(Uri.parse("res://drawable/" + R.drawable.first_order)) .setUri(Uri.parse("res://drawable/" + R.drawable.confide_first_order))
.setOldController(binding.confideFirstFree.controller) .setOldController(binding.confideFirstFree.controller)
.setAutoPlayAnimations(true) // 是否自动播放Gif动画 .setAutoPlayAnimations(true) // 是否自动播放Gif动画
.build() .build()
binding.confideFirstFree.controller = controller binding.confideFirstFree.controller = controller
val freeController: DraweeController = Fresco.newDraweeControllerBuilder()
.setUri(Uri.parse("res://drawable/" + R.drawable.confide_free))
.setOldController(binding.free.controller)
.setAutoPlayAnimations(true) // 是否自动播放Gif动画
.build()
binding.free.controller = freeController
binding.seekbar.progress = 0 binding.seekbar.progress = 0
binding.seekbar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener { binding.seekbar.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) { override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
...@@ -330,7 +371,8 @@ internal class ItemIntroHolder(binding: ItemExpertIntroBinding) : ...@@ -330,7 +371,8 @@ internal class ItemIntroHolder(binding: ItemExpertIntroBinding) :
itemView.context as FragmentActivity, itemView.context as FragmentActivity,
url, url,
item.doctorId!!, item.doctorId!!,
uid = item.uid uid = item.uid,
listenFree = item.listenFree.get()
) )
} }
} }
...@@ -352,6 +394,8 @@ class VideoViewModel { ...@@ -352,6 +394,8 @@ class VideoViewModel {
var uid: String? = null var uid: String? = null
var doctorId: String? = null var doctorId: String? = null
var confideId: String? = null var confideId: String? = null
var listenFree = ObservableBoolean(false)
var linkedUrl = ObservableField<String>("")
} }
private fun genMinProgramPath(url: String): String { private fun genMinProgramPath(url: String): String {
...@@ -363,6 +407,7 @@ private fun genMinProgramPath(url: String): String { ...@@ -363,6 +407,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)
...@@ -385,6 +430,11 @@ internal fun VideoViewModel.mapOf(bean: ConfideHomeBodyBean): VideoViewModel { ...@@ -385,6 +430,11 @@ internal fun VideoViewModel.mapOf(bean: ConfideHomeBodyBean): VideoViewModel {
uid = bean.uid?.toString() uid = bean.uid?.toString()
doctorId = bean.doctorId doctorId = bean.doctorId
confideId = bean.confidedId confideId = bean.confidedId
if (bean.listenFree == null) {
listenFree.set(false)
} else {
listenFree.set(bean.listenFree!!)
}
return this return this
} }
......
<?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
...@@ -83,12 +83,24 @@ ...@@ -83,12 +83,24 @@
app:layout_constraintCircleRadius="70dp" />--> app:layout_constraintCircleRadius="70dp" />-->
<com.facebook.drawee.view.SimpleDraweeView <com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/free"
android:layout_width="@dimen/platform_dp_48"
android:layout_height="@dimen/platform_dp_24"
app:layout_constraintCircle="@+id/layoutCall"
app:layout_constraintCircleAngle="70"
app:layout_constraintCircleRadius="70dp"
android:visibility="gone"
tools:ignore="MissingConstraints" />
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/first_order" android:id="@+id/first_order"
android:layout_width="@dimen/platform_dp_64" android:layout_width="@dimen/platform_dp_48"
android:layout_height="@dimen/platform_dp_34" android:layout_height="@dimen/platform_dp_24"
app:layout_constraintCircle="@+id/layoutCall" app:layout_constraintCircle="@+id/layoutCall"
app:layout_constraintCircleAngle="70" app:layout_constraintCircleAngle="70"
app:layout_constraintCircleRadius="70dp"/> app:layout_constraintCircleRadius="70dp"
android:visibility="gone"
tools:ignore="MissingConstraints" />
<LinearLayout <LinearLayout
......
...@@ -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"
...@@ -166,13 +166,24 @@ ...@@ -166,13 +166,24 @@
app:layout_constraintCircleRadius="70dp" />--> app:layout_constraintCircleRadius="70dp" />-->
<com.facebook.drawee.view.SimpleDraweeView <com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/free"
android:layout_width="@dimen/platform_dp_48"
android:layout_height="@dimen/platform_dp_24"
android:visibility="@{item.listenFree?View.VISIBLE:View.GONE}"
app:layout_constraintCircle="@+id/layoutCall"
app:layout_constraintCircleAngle="70"
app:layout_constraintCircleRadius="70dp"
tools:ignore="MissingConstraints" />
<com.facebook.drawee.view.SimpleDraweeView
android:id="@+id/confide_first_free" android:id="@+id/confide_first_free"
android:layout_width="@dimen/platform_dp_64" android:layout_width="@dimen/platform_dp_48"
android:layout_height="@dimen/platform_dp_34" android:layout_height="@dimen/platform_dp_24"
android:visibility="@{item.showFreeTag?View.VISIBLE:View.GONE}" android:visibility="@{item.showFreeTag?View.VISIBLE:View.GONE}"
app:layout_constraintCircle="@+id/layoutCall" app:layout_constraintCircle="@+id/layoutCall"
app:layout_constraintCircleAngle="70" app:layout_constraintCircleAngle="70"
app:layout_constraintCircleRadius="70dp" /> app:layout_constraintCircleRadius="70dp"
tools:ignore="MissingConstraints" />
<TextView <TextView
android:id="@+id/tvTag" android:id="@+id/tvTag"
......
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