Commit cdd63b69 by 万齐军

feat: 视频点击事件跳转h5

parent 3b7cc2c1
ext { ext {
kotlin_version = "1.3.21" kotlin_version = "1.3.21"
dev_mode = true dev_mode = false
ydlPublishVersion = [ ydlPublishVersion = [
// -------------- 业务模块 -------------- // -------------- 业务模块 --------------
......
...@@ -4,8 +4,10 @@ import android.annotation.SuppressLint ...@@ -4,8 +4,10 @@ import android.annotation.SuppressLint
import android.app.Dialog import android.app.Dialog
import android.net.Uri import android.net.Uri
import android.os.Bundle import android.os.Bundle
import android.text.TextUtils import android.view.Gravity
import android.view.* import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout import android.widget.FrameLayout
import android.widget.TextView import android.widget.TextView
import androidx.fragment.app.FragmentActivity import androidx.fragment.app.FragmentActivity
...@@ -26,17 +28,13 @@ import com.ydl.webview.TellData ...@@ -26,17 +28,13 @@ import com.ydl.webview.TellData
import com.ydl.webview.WebModularServiceUtils import com.ydl.webview.WebModularServiceUtils
import com.ydl.ydlcommon.modular.findRouteService import com.ydl.ydlcommon.modular.findRouteService
import com.ydl.ydlcommon.utils.TimeUtil import com.ydl.ydlcommon.utils.TimeUtil
import com.ydl.ydlcommon.utils.log.AliYunLogConfig
import com.ydl.ydlcommon.utils.log.AliYunRichLogsHelper.Companion.getInstance
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
import com.yidianling.user.api.service.IUserService import com.yidianling.user.api.service.IUserService
import io.reactivex.android.schedulers.AndroidSchedulers import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers import io.reactivex.schedulers.Schedulers
import kotlinx.android.synthetic.main.item_expert_intro.*
class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
companion object { companion object {
...@@ -234,8 +232,6 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -234,8 +232,6 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
setting.setAllowFileAccessFromFileURLs(true) setting.setAllowFileAccessFromFileURLs(true)
setting.setAppCacheEnabled(true) setting.setAppCacheEnabled(true)
setting.setAllowFileAccess(true) setting.setAllowFileAccess(true)
// 解决图片不显示
// 解决图片不显示
setting.setBlockNetworkImage(false) setting.setBlockNetworkImage(false)
wv_content!!.scrollBarStyle = View.SCROLLBARS_INSIDE_OVERLAY //滚动条风格,为0指滚动条不占用空间,直接覆盖在网页上 wv_content!!.scrollBarStyle = View.SCROLLBARS_INSIDE_OVERLAY //滚动条风格,为0指滚动条不占用空间,直接覆盖在网页上
...@@ -243,9 +239,8 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() { ...@@ -243,9 +239,8 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
.getJavascripHandler(requireActivity(), tellData = TellData()) .getJavascripHandler(requireActivity(), tellData = TellData())
wv_content!!.addJavascriptInterface(jtoJHandle, "javascriptHandler") wv_content!!.addJavascriptInterface(jtoJHandle, "javascriptHandler")
var jumpurl = "http://192.168.210.152/jy/listenMask?listenerId=257&isFromApp=1" // var jumpurl = "http://192.168.210.152/jy/listenMask?listenerId=257&isFromApp=1"
var url = WebUrlParamsUtils.getSuffix(jumpurl, jtoJHandle.getUriAppendSuffix()) val url = WebUrlParamsUtils.getSuffix(jumpUrl, jtoJHandle.getUriAppendSuffix())
LogUtil.e("AAA" + url)
wv_content.loadUrl(url) wv_content.loadUrl(url)
// wv_content.loadUrl(jumpUrl) // wv_content.loadUrl(jumpUrl)
......
...@@ -7,11 +7,13 @@ import androidx.databinding.ObservableField ...@@ -7,11 +7,13 @@ import androidx.databinding.ObservableField
import androidx.databinding.ObservableInt import androidx.databinding.ObservableInt
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.ydl.confide.R import com.ydl.confide.R
import com.ydl.confide.api.ConfideRoute
import com.ydl.confide.databinding.ItemConfideHomeRecentBinding import com.ydl.confide.databinding.ItemConfideHomeRecentBinding
import com.ydl.confide.databinding.ItemVideoShowBinding import com.ydl.confide.databinding.ItemVideoShowBinding
import com.ydl.confide.home.bean.ConfideHomeBodyBean import com.ydl.confide.home.bean.ConfideHomeBodyBean
import com.ydl.confide.home.event.IConfideHomeEvent import com.ydl.confide.home.event.IConfideHomeEvent
import com.ydl.confide.intro.BindingViewHolder import com.ydl.confide.intro.BindingViewHolder
import com.ydl.ydlcommon.base.config.HttpConfig
class VideoShowAdapter(private val data: List<ConfideHomeBodyBean>?, private val event: IConfideHomeEvent) : class VideoShowAdapter(private val data: List<ConfideHomeBodyBean>?, private val event: IConfideHomeEvent) :
RecyclerView.Adapter<BindingViewHolder<ItemVideoShowBinding>>() { RecyclerView.Adapter<BindingViewHolder<ItemVideoShowBinding>>() {
...@@ -76,8 +78,10 @@ internal fun ItemVideoShowViewModel.mapOf(bean: ConfideHomeBodyBean): ItemVideoS ...@@ -76,8 +78,10 @@ internal fun ItemVideoShowViewModel.mapOf(bean: ConfideHomeBodyBean): ItemVideoS
coverUrl.set(bean.confidedIcon) coverUrl.set(bean.confidedIcon)
videoCoverUrl.set(bean.coverVideoPicture) videoCoverUrl.set(bean.coverVideoPicture)
state.set(bean.confideLine ?: 0) state.set(bean.confideLine ?: 0)
linkUrl = bean.linkUrl
doctorId = bean.doctorId doctorId = bean.doctorId
doctorId?.let {
linkUrl = HttpConfig.MH5_URL + ConfideRoute.h5ConfideIntro(it)
}
return this return this
} }
......
...@@ -7,6 +7,7 @@ import android.net.Uri ...@@ -7,6 +7,7 @@ import android.net.Uri
import android.text.TextUtils import android.text.TextUtils
import android.view.View import android.view.View
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.FragmentActivity
import com.alibaba.fastjson.JSON import com.alibaba.fastjson.JSON
import com.ydl.confide.api.ConfideRoute import com.ydl.confide.api.ConfideRoute
import com.ydl.confide.home.ConfideBottomSheetDialogFragment import com.ydl.confide.home.ConfideBottomSheetDialogFragment
...@@ -131,8 +132,9 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo ...@@ -131,8 +132,9 @@ class ConfideHomeEventImpl(context: Context, var confideHomeView: IConfideHomeCo
* @param linkUrl 跳转地址 * @param linkUrl 跳转地址
*/ */
override fun consultantClick(linkUrl: String?, doctorId: String?) { override fun consultantClick(linkUrl: String?, doctorId: String?) {
if (linkUrl.isNullOrBlank()) return
ConfideBottomSheetDialogFragment() ConfideBottomSheetDialogFragment()
.showBottomSheetDialog(mContext as BaseActivity, linkUrl!!, doctorId!!) .showBottomSheetDialog(mContext as FragmentActivity, linkUrl, doctorId!!)
// link(linkUrl) // link(linkUrl)
} }
......
...@@ -5,20 +5,20 @@ import android.app.Application ...@@ -5,20 +5,20 @@ import android.app.Application
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.net.Uri import android.net.Uri
import androidx.fragment.app.DialogFragment
import android.text.TextUtils import android.text.TextUtils
import androidx.fragment.app.DialogFragment
import androidx.fragment.app.FragmentActivity
import com.alibaba.android.arouter.facade.annotation.Route import com.alibaba.android.arouter.facade.annotation.Route
import com.google.gson.Gson import com.google.gson.Gson
import com.ydl.audioim.YDLavManager import com.ydl.audioim.YDLavManager
import com.ydl.audioim.widget.AxbConfirmDialog import com.ydl.audioim.widget.AxbConfirmDialog
import com.ydl.confide.api.IConfideService import com.ydl.confide.api.IConfideService
import com.ydl.confide.home.ConfideBottomSheetDialogFragment
import com.ydl.confide.home.ConfideHomeActivity import com.ydl.confide.home.ConfideHomeActivity
import com.ydl.webview.TellData import com.ydl.webview.TellData
import com.ydl.ydlcommon.base.BaseApp import com.ydl.ydlcommon.base.BaseApp
import com.ydl.ydlcommon.base.config.YDLConstants import com.ydl.ydlcommon.base.config.YDLConstants
import com.ydl.ydlcommon.utils.YDLCacheUtils import com.ydl.ydlcommon.utils.YDLCacheUtils
import com.yidianling.common.tools.RxSPTool
import com.yidianling.common.tools.ToastUtil
/** /**
* Created by haorui on 2019-12-11 . * Created by haorui on 2019-12-11 .
...@@ -116,5 +116,8 @@ class ConfdieServiceImpl : IConfideService { ...@@ -116,5 +116,8 @@ class ConfdieServiceImpl : IConfideService {
} }
override fun showExpertDetailDialog(activity: FragmentActivity, jumpUrl: String, doctorId: String) {
ConfideBottomSheetDialogFragment().showBottomSheetDialog(activity, jumpUrl, doctorId, false)
}
} }
\ No newline at end of file
...@@ -11,6 +11,7 @@ import androidx.databinding.ViewDataBinding ...@@ -11,6 +11,7 @@ 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.dou361.ijkplayer.widget.IjkVideoView import com.dou361.ijkplayer.widget.IjkVideoView
import com.ydl.confide.api.ConfideRoute
import com.ydl.confide.databinding.ItemExpertIntroBinding import com.ydl.confide.databinding.ItemExpertIntroBinding
import com.ydl.confide.home.ConfideBottomSheetDialogFragment import com.ydl.confide.home.ConfideBottomSheetDialogFragment
import com.ydl.confide.home.bean.ConfideHomeBodyBean import com.ydl.confide.home.bean.ConfideHomeBodyBean
...@@ -57,8 +58,14 @@ internal class ItemIntroHolder(binding: ItemExpertIntroBinding) : ...@@ -57,8 +58,14 @@ internal class ItemIntroHolder(binding: ItemExpertIntroBinding) :
} }
} }
binding.btnEvaluate.setOnClickListener { binding.btnEvaluate.setOnClickListener {
ConfideBottomSheetDialogFragment() item.doctorId?.let {
.showBottomSheetDialog(itemView.context as FragmentActivity, item.linkUrl!!,item.doctorId!!) ConfideBottomSheetDialogFragment()
.showBottomSheetDialog(
itemView.context as FragmentActivity,
HttpConfig.MH5_URL + ConfideRoute.h5ExpertEval(it),
it
)
}
} }
binding.tvName.setOnClickListener { binding.tvName.setOnClickListener {
showDoctorDetail(item) showDoctorDetail(item)
...@@ -69,7 +76,7 @@ internal class ItemIntroHolder(binding: ItemExpertIntroBinding) : ...@@ -69,7 +76,7 @@ internal class ItemIntroHolder(binding: ItemExpertIntroBinding) :
binding.vDisableClick.setOnClickListener { } binding.vDisableClick.setOnClickListener { }
binding.btnShare.setOnClickListener { binding.btnShare.setOnClickListener {
val aty = it.context as? Activity val aty = it.context as? Activity
if (aty != null && !item.linkUrl.isNullOrBlank()) { if (aty != null) {
var shareUrl = "${HttpConfig.MH5_URL}experts/${item.doctorId}" var shareUrl = "${HttpConfig.MH5_URL}experts/${item.doctorId}"
if (!item.confideId.isNullOrBlank()) { if (!item.confideId.isNullOrBlank()) {
shareUrl += "?id=${item.confideId}" shareUrl += "?id=${item.confideId}"
...@@ -193,8 +200,10 @@ internal class ItemIntroHolder(binding: ItemExpertIntroBinding) : ...@@ -193,8 +200,10 @@ internal class ItemIntroHolder(binding: ItemExpertIntroBinding) :
} }
private fun showDoctorDetail(item: VideoViewModel) { private fun showDoctorDetail(item: VideoViewModel) {
ConfideBottomSheetDialogFragment() if (!item.linkUrl.isNullOrBlank()) {
.showBottomSheetDialog(itemView.context as FragmentActivity, item.linkUrl!!, item.doctorId!!) ConfideBottomSheetDialogFragment()
.showBottomSheetDialog(itemView.context as FragmentActivity, item.linkUrl!!, item.doctorId!!)
}
} }
} }
...@@ -247,7 +256,9 @@ internal fun VideoViewModel.mapOf(bean: ConfideHomeBodyBean): VideoViewModel { ...@@ -247,7 +256,9 @@ 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
linkUrl = bean.linkUrl doctorId?.let {
linkUrl = HttpConfig.MH5_URL + ConfideRoute.h5ExpertEval(it)
}
return this return this
} }
......
...@@ -5,6 +5,7 @@ import android.app.Application ...@@ -5,6 +5,7 @@ import android.app.Application
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import androidx.fragment.app.DialogFragment import androidx.fragment.app.DialogFragment
import androidx.fragment.app.FragmentActivity
import com.alibaba.android.arouter.facade.template.IProvider import com.alibaba.android.arouter.facade.template.IProvider
interface IConfideService : IProvider { interface IConfideService : IProvider {
...@@ -26,4 +27,10 @@ interface IConfideService : IProvider { ...@@ -26,4 +27,10 @@ interface IConfideService : IProvider {
fun initYdlavManager(app: Application) fun initYdlavManager(app: Application)
fun showAxbConfirmDialog(activity: Activity?, type: Int, phoneNumber: String?) fun showAxbConfirmDialog(activity: Activity?, type: Int, phoneNumber: String?)
fun showExpertDetailDialog(
activity: FragmentActivity,
jumpUrl: String,
doctorId: String
)
} }
\ No newline at end of file
package com.ydl.confide.api package com.ydl.confide.api
object ConfideRoute{
object ConfideRoute {
const val R_VIDEO_SHOW = "/confide/expert_video" const val R_VIDEO_SHOW = "/confide/expert_video"
fun h5ConfideIntro(id: String) = "/jy/listenMask?listenerId=${id}"
fun h5ExpertEval(id: String) = "/comment/evaList/${id}?listenerId=${id}"
} }
\ No newline at end of file
...@@ -68,14 +68,9 @@ dependencies { ...@@ -68,14 +68,9 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.2.0' implementation 'androidx.appcompat:appcompat:1.2.0'
implementation 'androidx.fragment:fragment-ktx:1.2.4' implementation 'androidx.fragment:fragment-ktx:1.2.4'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.3.0'
api "com.airbnb.android:lottie:3.4.0" api "com.airbnb.android:lottie:3.4.0"
implementation "com.alibaba:arouter-api:$arouter_api" implementation "com.alibaba:arouter-api:$arouter_api"
// 注意此处的依赖方式:kotlin中使用和java中使用方式有不同
kapt "com.alibaba:arouter-compiler:$arouter_compiler" kapt "com.alibaba:arouter-compiler:$arouter_compiler"
implementation rootProject.ext.dependencies["ydl-user-router"] implementation rootProject.ext.dependencies["ydl-user-router"]
...@@ -87,6 +82,7 @@ dependencies { ...@@ -87,6 +82,7 @@ dependencies {
implementation modularPublication('com.ydl:m-tests-api') implementation modularPublication('com.ydl:m-tests-api')
implementation modularPublication('com.ydl:m-home-api') implementation modularPublication('com.ydl:m-home-api')
implementation modularPublication('com.ydl:m-im-api') implementation modularPublication('com.ydl:m-im-api')
implementation modularPublication('com.ydl:m-confide-api')
implementation project(':ydl-webview') implementation project(':ydl-webview')
implementation project(':ydl-media') implementation project(':ydl-media')
implementation project(":ydl-platform") implementation project(":ydl-platform")
...@@ -98,6 +94,7 @@ dependencies { ...@@ -98,6 +94,7 @@ dependencies {
compileOnly rootProject.ext.dependencies["ydl-m-home-api"] compileOnly rootProject.ext.dependencies["ydl-m-home-api"]
compileOnly rootProject.ext.dependencies['ydl-m-tests-api'] compileOnly rootProject.ext.dependencies['ydl-m-tests-api']
compileOnly rootProject.ext.dependencies["ydl-m-im-api"] compileOnly rootProject.ext.dependencies["ydl-m-im-api"]
compileOnly rootProject.ext.dependencies["ydl-m-confide-api"]
api (rootProject.ext.dependencies["ydl-platform"]) { api (rootProject.ext.dependencies["ydl-platform"]) {
transitive = true transitive = true
} }
......
...@@ -7,8 +7,11 @@ import android.os.Bundle ...@@ -7,8 +7,11 @@ import android.os.Bundle
import android.text.TextUtils import android.text.TextUtils
import android.view.View import android.view.View
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.FragmentActivity
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.alibaba.android.arouter.launcher.ARouter import com.alibaba.android.arouter.launcher.ARouter
import com.ydl.confide.api.ConfideRoute
import com.ydl.confide.api.IConfideService
import com.ydl.media.audio.AudioPlayer import com.ydl.media.audio.AudioPlayer
import com.ydl.media.audio.model.Music import com.ydl.media.audio.model.Music
import com.ydl.media.view.PlayTypeEnum import com.ydl.media.view.PlayTypeEnum
...@@ -23,7 +26,7 @@ import com.ydl.ydlcommon.base.config.HttpConfig ...@@ -23,7 +26,7 @@ import com.ydl.ydlcommon.base.config.HttpConfig
import com.ydl.ydlcommon.bean.ShareData import com.ydl.ydlcommon.bean.ShareData
import com.ydl.ydlcommon.data.PlatformRamImpl import com.ydl.ydlcommon.data.PlatformRamImpl
import com.ydl.ydlcommon.modular.ModularServiceManager import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.modular.ModularServiceManager.provide import com.ydl.ydlcommon.modular.findRouteService
import com.ydl.ydlcommon.router.IYDLRouterConstant import com.ydl.ydlcommon.router.IYDLRouterConstant
import com.ydl.ydlcommon.utils.LogUtil import com.ydl.ydlcommon.utils.LogUtil
import com.ydl.ydlcommon.utils.Utils import com.ydl.ydlcommon.utils.Utils
...@@ -357,14 +360,12 @@ open class HomeBaseImpl : IHomeBaseEvent { ...@@ -357,14 +360,12 @@ open class HomeBaseImpl : IHomeBaseEvent {
doctorId.toString() doctorId.toString()
) )
if (linkUrl.startsWith("http")) { findRouteService(IConfideService::class.java)
YDLRouterManager.router( ?.showExpertDetailDialog(
IYDLRouterConstant.ROUTER_H5_H5, mContext as FragmentActivity,
YDLRouterParams().putExtra(IYDLRouterConstant.EXTRA_URL, linkUrl), "" HttpConfig.MH5_URL + ConfideRoute.h5ConfideIntro(doctorId.toString()),
doctorId.toString()
) )
} else {
YDLRouterManager.router(linkUrl)
}
} }
/** /**
......
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