Commit 96588987 by fengquan

Merge branch 'd/v4.3.98' into feat/fq/confide_search

# Conflicts:
#	config.gradle
#	m-confide/src/main/java/com/ydl/confide/home/ConfideHomeActivity.kt
parents faaeec78 eed8bfcc
...@@ -9,7 +9,7 @@ ext { ...@@ -9,7 +9,7 @@ ext {
"m-consultant" : "0.0.60.68", "m-consultant" : "0.0.60.68",
"m-fm" : "0.0.30.09", "m-fm" : "0.0.30.09",
"m-user" : "0.0.62.54", "m-user" : "0.0.62.54",
"m-home" : "0.0.23.90", "m-home" : "0.0.23.93",
"m-im" : "0.0.21.58", "m-im" : "0.0.21.58",
"m-dynamic" : "0.0.7.74", "m-dynamic" : "0.0.7.74",
"m-article" : "0.0.0.10", "m-article" : "0.0.0.10",
...@@ -17,6 +17,7 @@ ext { ...@@ -17,6 +17,7 @@ ext {
"m-tests" : "0.0.24.18", "m-tests" : "0.0.24.18",
"m-course" : "0.0.43.39", "m-course" : "0.0.43.39",
//-------------- 功能组件 -------------- //-------------- 功能组件 --------------
//mdt 组件 //mdt 组件
...@@ -95,7 +96,7 @@ ext { ...@@ -95,7 +96,7 @@ ext {
"m-consultant" : "0.0.60.68", "m-consultant" : "0.0.60.68",
"m-fm" : "0.0.30.09", "m-fm" : "0.0.30.09",
"m-user" : "0.0.62.54", "m-user" : "0.0.62.54",
"m-home" : "0.0.23.90", "m-home" : "0.0.23.93",
"m-im" : "0.0.21.58", "m-im" : "0.0.21.58",
"m-dynamic" : "0.0.7.74", "m-dynamic" : "0.0.7.74",
"m-article" : "0.0.0.10", "m-article" : "0.0.0.10",
...@@ -103,6 +104,8 @@ ext { ...@@ -103,6 +104,8 @@ ext {
"m-muse" : "0.0.28.81", "m-muse" : "0.0.28.81",
"m-tests" : "0.0.24.18", "m-tests" : "0.0.24.18",
"m-course" : "0.0.43.39", "m-course" : "0.0.43.39",
//-------------- 功能组件 -------------- //-------------- 功能组件 --------------
//mdt 组件 //mdt 组件
......
...@@ -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,7 +229,48 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -211,7 +229,48 @@ 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
...@@ -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()
...@@ -234,17 +294,17 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -234,17 +294,17 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
FrameLayout.LayoutParams.WRAP_CONTENT FrameLayout.LayoutParams.WRAP_CONTENT
).apply { gravity = Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL } ).apply { gravity = Gravity.BOTTOM or Gravity.CENTER_HORIZONTAL }
dialog?.window?.addContentView(itemView, layoutParams) dialog?.window?.addContentView(itemView, layoutParams)
bottomSheet = bottomSheet =
(it as BottomSheetDialog).findViewById<View>(com.google.android.material.R.id.design_bottom_sheet) as FrameLayout? (it as BottomSheetDialog).findViewById<View>(com.google.android.material.R.id.design_bottom_sheet) as FrameLayout?
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()
......
...@@ -11,10 +11,15 @@ import android.view.View ...@@ -11,10 +11,15 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.view.WindowManager import android.view.WindowManager
import android.widget.TextView import android.widget.TextView
import android.view.animation.AccelerateInterpolator
import android.view.animation.DecelerateInterpolator
import android.widget.ImageView
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
...@@ -34,6 +39,7 @@ import com.ydl.confide.home.event.ConfideHomeEventImpl ...@@ -34,6 +39,7 @@ import com.ydl.confide.home.event.ConfideHomeEventImpl
import com.ydl.confide.home.event.IConfideHomeEvent import com.ydl.confide.home.event.IConfideHomeEvent
import com.ydl.confide.home.listener.ConfideHomeRecycleViewListener import com.ydl.confide.home.listener.ConfideHomeRecycleViewListener
import com.ydl.confide.home.listener.ConfideHomeRecyleSuspendListener import com.ydl.confide.home.listener.ConfideHomeRecyleSuspendListener
import com.ydl.confide.home.listener.HideScrollListener
import com.ydl.confide.home.modular.service.ConfideWebServiceImpl import com.ydl.confide.home.modular.service.ConfideWebServiceImpl
import com.ydl.confide.home.presenter.ConfideHomePresenterImpl import com.ydl.confide.home.presenter.ConfideHomePresenterImpl
import com.ydl.confide.home.util.ConfideHomeUtils import com.ydl.confide.home.util.ConfideHomeUtils
...@@ -56,6 +62,7 @@ import com.yidianling.common.tools.ToastUtil ...@@ -56,6 +62,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.*
/** /**
...@@ -68,7 +75,7 @@ import kotlinx.android.synthetic.main.confide_title_bar.* ...@@ -68,7 +75,7 @@ import kotlinx.android.synthetic.main.confide_title_bar.*
@Route(path = ConfideRoute.R_CONFIDE_HOME) @Route(path = ConfideRoute.R_CONFIDE_HOME)
class ConfideHomeActivity : class ConfideHomeActivity :
BaseLceActivity<IConfideHomeContract.View, IConfideHomeContract.Presenter>(), BaseLceActivity<IConfideHomeContract.View, IConfideHomeContract.Presenter>(),
IConfideHomeContract.View, XRecyclerView.LoadingListener { IConfideHomeContract.View, XRecyclerView.LoadingListener,HideScrollListener {
private var listenFree = false private var listenFree = false
...@@ -228,7 +235,6 @@ class ConfideHomeActivity : ...@@ -228,7 +235,6 @@ class ConfideHomeActivity :
// mPresenter.loadLocalData(this) // mPresenter.loadLocalData(this)
rv_list.refresh() rv_list.refresh()
initClick() initClick()
initQuickConsultDialog()
initStatusBar() initStatusBar()
// ModularServiceManager.provide(IConsultantService::class.java).showConfideListDialog(this) // ModularServiceManager.provide(IConsultantService::class.java).showConfideListDialog(this)
// ActionCountUtils.count("daoyi_advertisement_page|daoyi_advertisement_visit","17") // ActionCountUtils.count("daoyi_advertisement_page|daoyi_advertisement_visit","17")
...@@ -269,7 +275,7 @@ class ConfideHomeActivity : ...@@ -269,7 +275,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()
...@@ -278,6 +284,11 @@ class ConfideHomeActivity : ...@@ -278,6 +284,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
} }
...@@ -297,41 +308,6 @@ class ConfideHomeActivity : ...@@ -297,41 +308,6 @@ class ConfideHomeActivity :
} }
/** /**
* 监听控制一键倾诉浮层的显示与隐藏
*/
private fun initQuickConsultDialog() {
rv_list.addOnScrollListener(object : RecyclerView.OnScrollListener() {
override fun onScrollStateChanged(recyclerView: RecyclerView, newState: Int) {
super.onScrollStateChanged(recyclerView, newState)
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
quick_consult_card.visibility = View.VISIBLE
}
// val layoutManager: RecyclerView.LayoutManager = recyclerView?.layoutManager!!
// val linearManager = layoutManager as LinearLayoutManager
// if (linearManager is LinearLayoutManager) {
// val firstItemPosition = linearManager.findFirstCompletelyVisibleItemPosition()
// if (firstItemPosition > 3) {
// quick_consult_card.visibility = View.VISIBLE
// }else {
// quick_consult_card.visibility = View.GONE
// }
// }
}
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy)
if (dy <= 0) {
//向上滚动恢复显示
quick_consult_card.visibility = View.VISIBLE
} else {
//向下滚动隐藏
quick_consult_card.visibility = View.GONE
}
}
})
}
/**
* 初始化一键倾诉浮层的点击事件 * 初始化一键倾诉浮层的点击事件
*/ */
private fun initClick() { private fun initClick() {
...@@ -345,7 +321,8 @@ class ConfideHomeActivity : ...@@ -345,7 +321,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
) )
} }
...@@ -388,7 +365,7 @@ class ConfideHomeActivity : ...@@ -388,7 +365,7 @@ class ConfideHomeActivity :
} }
//用于滑动筛选模块置顶 //用于滑动筛选模块置顶
if (null == listScrollListener) { if (null == listScrollListener) {
listScrollListener = ConfideHomeRecycleViewListener() listScrollListener = ConfideHomeRecycleViewListener(this)
} }
rv_list.addOnScrollListener(listScrollListener!!) rv_list.addOnScrollListener(listScrollListener!!)
//用于显示筛选悬浮按钮 //用于显示筛选悬浮按钮
...@@ -731,4 +708,30 @@ class ConfideHomeActivity : ...@@ -731,4 +708,30 @@ class ConfideHomeActivity :
} }
super.onBackPressed() super.onBackPressed()
} }
override fun onHide() {
val lp = quick_consult_card.layoutParams as RelativeLayout.LayoutParams
quick_consult_card.animate().translationY(
(quick_consult_card.height + lp.bottomMargin).toFloat()
).setDuration(1000)
.interpolator = AccelerateInterpolator(3f)
}
override fun onShow() {
quick_consult_card.animate().translationY(0F).setDuration(1000)
.interpolator = DecelerateInterpolator(3f)
}
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(
......
...@@ -13,7 +13,7 @@ import com.yidianling.common.tools.RxImageTool ...@@ -13,7 +13,7 @@ import com.yidianling.common.tools.RxImageTool
* @Company 壹点灵 * @Company 壹点灵
* @date 2018/9/25 * @date 2018/9/25
*/ */
class ConfideHomeRecycleViewListener : RecyclerView.OnScrollListener() { class ConfideHomeRecycleViewListener() : RecyclerView.OnScrollListener() {
/** /**
* 筛选模块位置 * 筛选模块位置
*/ */
...@@ -23,6 +23,15 @@ class ConfideHomeRecycleViewListener : RecyclerView.OnScrollListener() { ...@@ -23,6 +23,15 @@ class ConfideHomeRecycleViewListener : RecyclerView.OnScrollListener() {
*/ */
private var move = false private var move = false
private lateinit var listener: HideScrollListener
private var visible = true
constructor(listener: HideScrollListener):this(){
this.listener = listener
}
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) { override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
super.onScrolled(recyclerView, dx, dy) super.onScrolled(recyclerView, dx, dy)
//在这里进行第二次滚动(最后的距离) //在这里进行第二次滚动(最后的距离)
...@@ -37,6 +46,15 @@ class ConfideHomeRecycleViewListener : RecyclerView.OnScrollListener() { ...@@ -37,6 +46,15 @@ class ConfideHomeRecycleViewListener : RecyclerView.OnScrollListener() {
recyclerView.scrollBy(0, top) recyclerView.scrollBy(0, top)
} }
} }
if (dy > 0 && visible) {
visible = false
listener.onHide()
} else if (dy < 0 && !visible) {
visible = true
listener.onShow()
}
} }
/** /**
...@@ -82,4 +100,6 @@ class ConfideHomeRecycleViewListener : RecyclerView.OnScrollListener() { ...@@ -82,4 +100,6 @@ class ConfideHomeRecycleViewListener : RecyclerView.OnScrollListener() {
// move = true // move = true
// } // }
} }
} }
\ No newline at end of file
package com.ydl.confide.home.listener
interface HideScrollListener {
fun onHide()
fun onShow()
}
\ No newline at end of file
...@@ -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
......
...@@ -34,8 +34,7 @@ ...@@ -34,8 +34,7 @@
android:elevation="2dp" android:elevation="2dp"
android:paddingBottom="1dp" android:paddingBottom="1dp"
android:paddingRight="@dimen/platform_dp_8" android:paddingRight="@dimen/platform_dp_8"
android:visibility="gone" android:visibility="visible">
tools:visibility="visible">
<ImageView <ImageView
android:id="@+id/confide_logo" android:id="@+id/confide_logo"
......
...@@ -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"
......
package com.yidianling.home.adapter
import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView
import androidx.recyclerview.widget.RecyclerView
import com.alibaba.android.arouter.launcher.ARouter
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.utils.Utils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.yidianling.home.R
import com.yidianling.home.constants.HomeBIConstants
import com.yidianling.home.model.bean.MeditationModuleBean
import com.yidianling.user.api.service.IUserService
import kotlinx.android.synthetic.ydl.home_fragment.*
class HomeConfideAdapter(
private val context: Context,
private val data: List<MeditationModuleBean.MeditationDetail>?,
private val moreLink: String?,
private val homeLink: String? = null,
private val cateId: Long? = null,
private val buried: String? = null,
private val mark: Int? = null,
private val meditationType: Int? = null
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
return when (viewType) {
CONTENT_TYPE -> {
MeditationTypeViewHolder(
LayoutInflater.from(context)
.inflate(R.layout.home_layout_meditation_item, parent, false)
)
}
else -> {
MeditationTypeMoreViewHolder(
LayoutInflater.from(context)
.inflate(R.layout.home_layout_meditation_more_type, parent, false)
)
}
}
}
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
when (holder) {
is MeditationTypeViewHolder -> {
holder.ivType?.let {
Glide.with(context)
.load(data?.get(position)?.coverImageUrl)
.thumbnail(0.1f)
.transition(DrawableTransitionOptions.withCrossFade())
.into(it)
}
holder.tvName?.let {
it.text = data?.get(position)?.title ?: ""
}
holder.cvLayout?.setOnClickListener {
ActionCountUtils.baiDuCountSign3(
HomeBIConstants.YDL_USER_MAIN_PAGE_MUSE,
HomeBIConstants.YDL_HOME_MEDITATION_CLICK,
buried ?: "",
(position + 1).toString(),
""
)
if (meditationType == 0) {
if (Utils.isFastClick()) {
//防止连击
return@setOnClickListener
}
if (!ModularServiceManager.provide(IUserService::class.java)
.loginByOneKeyLogin(context, true)
) {
return@setOnClickListener
}
if (data == null) {
return@setOnClickListener
}
ARouter.getInstance().build("/muse/play")
.withLong("MEDITATION_ID", data[position]?.meditationId)
.withInt("MEDITATION_TYPE", meditationType)
.withFloat("MEDIA_DURATION", data[position].duration ?: 0.0f)
.withString("MEDIA_URL", data[position].mediaIdCoverImageUrl)
.withString("MEDIA_COVER_URL", data[position].mediaIdCoverImageUrl)
.navigation()
// YDLRouterManager.router(ROUTER_MUSE_PLAY,
// YDLRouterParams().putExtra("MEDITATION_ID" , data[position]?.meditationId.toString())
// .putExtra("MEDITATION_TYPE", meditationType.toString())
// .putExtra("MEDIA_DURATION", (data[position].duration?:0).toString())
// .putExtra("MEDIA_URL", data[position].mediaIdCoverImageUrl.toString())
// .putExtra("MEDIA_COVER_URL", data[position].mediaIdCoverImageUrl.toString()))
} else {
if (Utils.isFastClick()) {
//防止连击
return@setOnClickListener
}
if (data == null) {
return@setOnClickListener
}
val homeLink =
"${homeLink}mark=$mark&cateId=$cateId&meditationId=${data[position]?.meditationId}"
if (!homeLink.isNullOrBlank()) {
NewH5Activity.start(context, H5Params(homeLink, null))
}
}
}
}
is MeditationTypeMoreViewHolder -> {
holder.llMoreLayout?.setOnClickListener {
if (Utils.isFastClick()) {
//防止连击
return@setOnClickListener
}
//冥想助眠更多点击事件
ActionCountUtils.count(
HomeBIConstants.YDL_HOME_MEDITATION_VOICE_MORE_CLICK,
buried ?: ""
)
val moreLink = "${moreLink}mark=$mark&cateId=$cateId"
if (!moreLink.isNullOrBlank()) {
NewH5Activity.start(context, H5Params(moreLink, null))
}
}
}
}
}
override fun getItemCount(): Int {
return if (data?.isNotEmpty() == true) {
data.size + 1
} else {
0
}
}
override fun getItemId(position: Int) = position.toLong()
override fun getItemViewType(position: Int): Int {
return if (data?.isNotEmpty() == true && position == data.size) {
FOOTER_TYPE
} else {
CONTENT_TYPE
}
}
inner class MeditationTypeViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val cvLayout: FrameLayout? = itemView.findViewById(R.id.fl_layout)
val ivType: ImageView? = itemView.findViewById(R.id.iv_meditation_type)
val tvName: TextView? = itemView.findViewById(R.id.tv_meditation_type)
}
inner class MeditationTypeMoreViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val llMoreLayout: LinearLayout? = itemView.findViewById(R.id.ll_more_type)
}
companion object {
const val CONTENT_TYPE = 0
const val FOOTER_TYPE = 1
}
}
\ No newline at end of file
...@@ -325,7 +325,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -325,7 +325,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
boolean isExpert = null!=ActionHandlerStorage.getL(sessionId)&&ActionHandlerStorage.getL(sessionId).getUserType() == 2; boolean isExpert = null!=ActionHandlerStorage.getL(sessionId)&&ActionHandlerStorage.getL(sessionId).getUserType() == 2;
ServiceImpl.Companion.getInstance().canViewConsult("") ServiceImpl.Companion.getInstance().canViewConsult(ActionHandlerStorage.getL(sessionId).getInfo().doctorId)
.subscribeOn(Schedulers.io()) .subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) .observeOn(AndroidSchedulers.mainThread())
.subscribe(response -> { .subscribe(response -> {
...@@ -441,13 +441,13 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy { ...@@ -441,13 +441,13 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
getInputPanel().setInputHintContent(res.data.getInputBoxReminder()); getInputPanel().setInputHintContent(res.data.getInputBoxReminder());
} }
} }
if ("200".equals(res.code) && res.data != null) { // if ("200".equals(res.code) && res.data != null) {
if (res.data.getStatus() == 0) { // if (res.data.getStatus() == 0) {
if (null != getActivity() && null != rela_zixun) { // if (null != getActivity() && null != rela_zixun) {
rela_zixun.setVisibility(View.GONE); // rela_zixun.setVisibility(View.GONE);
} // }
} // }
} // }
}, throwable -> { }, throwable -> {
}); });
if (ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getUserType() == 1 && ModularServiceManager.INSTANCE.provide(IUserService.class).getUserInfo().getUser_type() == 3) { if (ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getUserType() == 1 && ModularServiceManager.INSTANCE.provide(IUserService.class).getUserInfo().getUser_type() == 3) {
......
...@@ -3,6 +3,7 @@ package com.yidianling.uikit.custom.widget; ...@@ -3,6 +3,7 @@ package com.yidianling.uikit.custom.widget;
import android.content.Context; import android.content.Context;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.ImageView; import android.widget.ImageView;
...@@ -20,6 +21,7 @@ import com.netease.nimlib.sdk.msg.model.IMMessage; ...@@ -20,6 +21,7 @@ import com.netease.nimlib.sdk.msg.model.IMMessage;
import com.ydl.confide.api.ConfideRoute; import com.ydl.confide.api.ConfideRoute;
import com.ydl.confide.api.IConfideService; import com.ydl.confide.api.IConfideService;
import com.ydl.ydlcommon.base.config.HttpConfig; import com.ydl.ydlcommon.base.config.HttpConfig;
import com.ydl.ydlcommon.router.IYDLRouterConstant;
import com.ydl.ydlcommon.utils.Utils; import com.ydl.ydlcommon.utils.Utils;
import com.yidianling.common.tools.RxImageTool; import com.yidianling.common.tools.RxImageTool;
import com.yidianling.common.tools.ToastUtil; import com.yidianling.common.tools.ToastUtil;
...@@ -34,8 +36,12 @@ import com.ydl.ydlcommon.utils.StringUtils; ...@@ -34,8 +36,12 @@ import com.ydl.ydlcommon.utils.StringUtils;
import com.ydl.ydlcommon.utils.YDLCacheUtils; import com.ydl.ydlcommon.utils.YDLCacheUtils;
import java.util.HashMap;
import kotlin.Pair;
import static com.ydl.ydlcommon.modular.ModularServiceManagerKt.findRouteService; import static com.ydl.ydlcommon.modular.ModularServiceManagerKt.findRouteService;
import static com.ydl.ydlcommon.modular.ModularServiceManagerKt.route;
/** /**
* Created by haorui on 2019/5/22. * Created by haorui on 2019/5/22.
...@@ -140,23 +146,24 @@ public class ConfideOrderInfoView extends RelativeLayout { ...@@ -140,23 +146,24 @@ public class ConfideOrderInfoView extends RelativeLayout {
//点击整个view,跳转订单详情页面 //点击整个view,跳转订单详情页面
setOnClickListener(view -> { setOnClickListener(view -> {
if (Utils.isFastClick()){ if (Utils.isFastClick()) {
return; return;
} }
String remainTime = ActionHandlerStorage.getL(mSessionId).getInfo().listenOrderRemainTime; String remainTime = ActionHandlerStorage.getL(mSessionId).getInfo().listenOrderRemainTime;
if(TextUtils.isEmpty(remainTime)){ if (TextUtils.isEmpty(remainTime)) {
if (!TextUtils.isEmpty(info.listenOrderUrl)) {//订单详情 Pair<String, String> confideId = new Pair<>(IYDLRouterConstant.EXTRA_CONFIDEDID,
H5Params h5Params = new H5Params(info.listenOrderUrl, "订单详情"); info.listenerId);
NewH5Activity.start(mContext, h5Params); Pair<String, String> doctorId = new Pair<>(IYDLRouterConstant.EXTRA_DOCTORID,
} info.doctorId);
}else { route(getContext(), ConfideRoute.R_CONFIDE_HOME, confideId, doctorId);
if (info!=null){ } else {
if (info != null) {
String confideId = info.listenerId; String confideId = info.listenerId;
findRouteService(IConfideService.class) findRouteService(IConfideService.class)
.showExpertDetailDialog( .showExpertDetailDialog(
(FragmentActivity)mContext, (FragmentActivity) mContext,
HttpConfig.Companion.getMH5_URL() + ConfideRoute.INSTANCE.h5ConfideIntro(confideId), HttpConfig.Companion.getMH5_URL() + ConfideRoute.INSTANCE.h5ConfideIntro(confideId),
info.doctorId, info.doctorId,
info.toUid); info.toUid);
...@@ -209,4 +216,7 @@ public class ConfideOrderInfoView extends RelativeLayout { ...@@ -209,4 +216,7 @@ public class ConfideOrderInfoView extends RelativeLayout {
}); });
MessageListPanelHelper.getInstance().notifyAddMessage(message); MessageListPanelHelper.getInstance().notifyAddMessage(message);
} }
} }
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