Commit 077b56ca by fengquan

fix: 介绍弹层拨打按钮未展示“免费”图标-bug

parent cdd04085
...@@ -57,6 +57,7 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -57,6 +57,7 @@ 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"
} }
...@@ -73,6 +74,7 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -73,6 +74,7 @@ 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
...@@ -81,22 +83,25 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -81,22 +83,25 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
var mJtoJHandle:IJavascriptHandler?=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
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
) { ) {
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) }
} }
show(activity.supportFragmentManager, "confide_bottom_showdialog") show(activity.supportFragmentManager, "confide_bottom_showdialog")
...@@ -125,6 +130,7 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -125,6 +130,7 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
doctorId = arguments?.getString(KEY_DOCTOR_ID) ?: "" doctorId = arguments?.getString(KEY_DOCTOR_ID) ?: ""
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 +181,19 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -175,20 +181,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",
...@@ -516,6 +521,18 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -516,6 +521,18 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
if (resp.code == "200") { if (resp.code == "200") {
layoutCall.visibility = View.VISIBLE layoutCall.visibility = View.VISIBLE
val lineStatus = resp.data?.confideLine ?: 2 val 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 继续倾诉
* */ * */
......
...@@ -8,10 +8,13 @@ import android.os.Build ...@@ -8,10 +8,13 @@ import android.os.Build
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.view.WindowManager import android.view.WindowManager
import android.widget.ImageView
import androidx.fragment.app.FragmentActivity import androidx.fragment.app.FragmentActivity
import androidx.recyclerview.widget.RecyclerView 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
...@@ -51,6 +54,7 @@ import com.yidianling.common.tools.ToastUtil ...@@ -51,6 +54,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.*
/** /**
...@@ -259,7 +263,7 @@ class ConfideHomeActivity : ...@@ -259,7 +263,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()
...@@ -268,6 +272,11 @@ class ConfideHomeActivity : ...@@ -268,6 +272,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
} }
...@@ -335,7 +344,8 @@ class ConfideHomeActivity : ...@@ -335,7 +344,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
) )
......
...@@ -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?) {
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
) )
} }
} }
......
...@@ -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)
fun videoShowClick(index: Int, data: List<ConfideHomeBodyBean>?) fun videoShowClick(index: Int, data: List<ConfideHomeBodyBean>?)
......
...@@ -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)
} }
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 -> {
//跳转私聊 并发送自定义消息 //跳转私聊 并发送自定义消息
......
...@@ -226,12 +226,19 @@ internal class ItemIntroHolder(binding: ItemExpertIntroBinding) : ...@@ -226,12 +226,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) {
...@@ -352,6 +359,7 @@ class VideoViewModel { ...@@ -352,6 +359,7 @@ 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)
} }
private fun genMinProgramPath(url: String): String { private fun genMinProgramPath(url: String): String {
...@@ -385,6 +393,11 @@ internal fun VideoViewModel.mapOf(bean: ConfideHomeBodyBean): VideoViewModel { ...@@ -385,6 +393,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
} }
......
...@@ -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
......
...@@ -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