Commit e0715303 by 范玉宾

fix 17930 17935

parent 6a96d7f4
......@@ -8,13 +8,13 @@ ext {
"m-confide" : "0.0.49.74",
"m-consultant" : "0.0.60.25",
"m-fm" : "0.0.30.08",
"m-user" : "0.0.62.10",
"m-home" : "0.0.23.53",
"m-user" : "0.0.62.11",
"m-home" : "0.0.23.55",
"m-im" : "0.0.21.44",
"m-dynamic" : "0.0.7.73",
"m-article" : "0.0.0.10",
"m-muse" : "0.0.28.32",
"m-muse" : "0.0.28.34",
"m-tests" : "0.0.24.18",
"m-course" : "0.0.43.37",
......@@ -93,13 +93,13 @@ ext {
"m-confide" : "0.0.49.74",
"m-consultant" : "0.0.60.25",
"m-fm" : "0.0.30.08",
"m-user" : "0.0.62.10",
"m-home" : "0.0.23.53",
"m-user" : "0.0.62.11",
"m-home" : "0.0.23.55",
"m-im" : "0.0.21.44",
"m-dynamic" : "0.0.7.73",
"m-article" : "0.0.0.8",
"m-muse" : "0.0.28.32",
"m-muse" : "0.0.28.34",
"m-tests" : "0.0.24.18",
"m-course" : "0.0.43.37",
//-------------- 业务模块 API 层 --------------
......
......@@ -14,8 +14,10 @@ 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.yidianling.home.model.bean.MeditationModuleBean
import com.yidianling.user.api.service.IUserService
import kotlinx.android.synthetic.ydl.home_fragment.*
class MeditationTypeAdapter(
......@@ -67,6 +69,9 @@ class MeditationTypeAdapter(
//防止连击
return@setOnClickListener
}
if(!ModularServiceManager.provide(IUserService::class.java).loginByOneKeyLogin(context,true)){
return@setOnClickListener
}
ARouter.getInstance().build("/muse/play")
.withLong("MEDITATION_ID", data[position].meditationId)
.withInt("MEDITATION_TYPE", meditationType)
......
package com.yidianling.home.adapter
import android.content.Context
import android.graphics.Color
import android.media.MediaPlayer
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import androidx.recyclerview.widget.RecyclerView
import com.ydl.ydl_image.module.GlideApp
import com.yidianling.common.tools.LogUtil
import com.yidianling.home.R
import com.yidianling.home.constract.HomeViewConfig
import com.yidianling.home.event.HomeImpl
import com.yidianling.home.model.bean.*
import com.yidianling.home.ui.view.*
import kotlin.properties.Delegates
import kotlinx.android.synthetic.ydl.home_muse_view.view.*
/**
......@@ -227,6 +228,17 @@ class YdlHomeAdapter(private val mContext: Context,
}
//壹点*冥想模块
is HomeMuseViewHolder -> {
holder.museViewView.iv_video_background?.visibility = View.VISIBLE
holder.museViewView.video_view?.setOnInfoListener { mp, what, extra ->
if (what == MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START){
holder.museViewView.video_view?.iv_video_background?.visibility = View.GONE
holder.museViewView.video_view?.setBackgroundColor(Color.TRANSPARENT)
}
true
}
holder.museViewView.video_view?.start()
holder.museViewView.initData(list[holder.viewType].meditationBean)
}
//心灵*电台模块
......
......@@ -2,7 +2,9 @@ package com.yidianling.home.ui.fragment
import android.app.Dialog
import android.content.Context
import android.graphics.Color
import android.graphics.Typeface
import android.media.MediaPlayer
import android.os.Build
import android.text.TextUtils
import android.view.View
......@@ -41,6 +43,9 @@ import com.yidianling.home.ui.view.HomeSpaceItemDecoration
import com.yidianling.home.utils.HomeAnimUtils
import com.yidianling.user.api.service.IUserService
import kotlinx.android.synthetic.ydl.home_fragment.*
import kotlinx.android.synthetic.ydl.home_fragment.tab_layout
import kotlinx.android.synthetic.ydl.home_muse_view.*
import kotlinx.android.synthetic.ydl.home_muse_view.view.*
import kotlin.properties.Delegates
......@@ -523,6 +528,16 @@ open class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterIm
ActionCountUtils.count(HomeBIConstants.YDL_USER_MAIN_PAGE_VISIT)
ActionCountUtils.count("daoyi_advertisement_page|daoyi_advertisement_visit","1")
showConsultAssistantDialog()
iv_video_background?.visibility = View.VISIBLE
video_view?.setOnInfoListener { mp, what, extra ->
if (what == MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START){
iv_video_background?.visibility = View.GONE
video_view?.setBackgroundColor(Color.TRANSPARENT)
}
true
}
video_view?.start()
}
}
......@@ -533,6 +548,7 @@ open class YdlHomeFragment : BaseMvpFragment<IHomeContract.View, HomePresenterIm
ActionCountUtils.count(HomeBIConstants.YDL_HOME_DWELL_TIME,(endTime-startTime).toString())
startTime=0L
}
video_view?.pause()
}
/**
......
......@@ -2,14 +2,12 @@ package com.yidianling.home.ui.view
import android.annotation.SuppressLint
import android.content.Context
import android.graphics.SurfaceTexture
import android.graphics.Color
import android.graphics.Typeface
import android.media.MediaPlayer
import android.text.SpannableString
import android.text.Spanned
import android.text.style.StyleSpan
import android.view.Surface
import android.view.TextureView
import android.view.View
import android.view.ViewGroup
import android.widget.LinearLayout
......@@ -28,7 +26,6 @@ import com.yidianling.home.constract.HomeViewConfig
import com.yidianling.home.event.IHomeEvent
import com.yidianling.home.model.bean.MeditationModuleBean
import kotlinx.android.synthetic.ydl.home_muse_view.view.*
import java.util.concurrent.Executors
/**
* @author <a href="https://www.jianshu.com/u/c1e5310dd724">xujian</a>
......@@ -40,11 +37,6 @@ import java.util.concurrent.Executors
class HomeMuseView(private val mContext: Context, private var homeEvent: IHomeEvent?) :
LinearLayout(mContext) {
private var mSurface: Surface? = null
private var mSurfaceTexture: SurfaceTexture? = null
private var mMediaPlayer:MediaPlayer? = null
private val meditationTitles = mutableListOf<String>()
init {
......@@ -93,74 +85,40 @@ class HomeMuseView(private val mContext: Context, private var homeEvent: IHomeEv
tv_meditation_slogan.text = slogan
val videoUrl = bean.mditationIndexInfo?.videoLink
val videoThumbnailUrl = bean.mditationIndexInfo?.mditationIndexUrl
if (videoUrl.isNullOrBlank()){
Glide.with(this)
.load(bean.mditationIndexInfo?.mditationIndexUrl)
.load(videoThumbnailUrl)
.transition(withCrossFade())
.into(iv_video_background)
}else{
GlideApp.with(this)
.load(bean.mditationIndexInfo?.mditationIndexUrl)
.load(videoThumbnailUrl)
.transition(withCrossFade())
.into(iv_video_background)
video_view?.surfaceTextureListener = object: TextureView.SurfaceTextureListener{
override fun onSurfaceTextureAvailable(
surfaceTexture: SurfaceTexture?,
width: Int,
height: Int
) {
mSurface = Surface(surfaceTexture)
runnable.setParams(videoUrl,bean.mditationIndexInfo?.mditationIndexUrl?:"")
Executors.newSingleThreadExecutor().execute(runnable)
}
override fun onSurfaceTextureSizeChanged(
surface: SurfaceTexture?,
width: Int,
height: Int
) {
}
override fun onSurfaceTextureDestroyed(surface: SurfaceTexture?): Boolean {
// mSurface = null
// mSurfaceTexture = null
try {
mMediaPlayer?.stop()
mMediaPlayer?.release()
}catch (e:Exception){
video_view?.setVideoPath(videoUrl)
video_view?.setOnErrorListener { mp, what, extra ->
Glide.with(this)
.load(bean.mditationIndexInfo?.mditationIndexUrl)
.transition(withCrossFade())
.into(iv_video_background)
true
}
video_view?.setOnPreparedListener {
it?.setVideoScalingMode(MediaPlayer.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING)
video_view?.setOnInfoListener { mp, what, extra ->
if (what == MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START){
iv_video_background.visibility = View.GONE
video_view.setBackgroundColor(Color.TRANSPARENT)
}
return true
true
}
override fun onSurfaceTextureUpdated(surface: SurfaceTexture?) {
}
it?.start()
it?.setVolume(0.0F,0.0F)
}
// video_view?.setVideoPath(videoUrl)
// video_view?.setOnErrorListener { mp, what, extra ->
// Glide.with(this)
// .load(bean.mditationIndexInfo?.mditationIndexUrl)
// .into(iv_video_background)
// true
// }
// video_view?.setOnPreparedListener {
// it?.setVideoScalingMode(MediaPlayer.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING)
// video_view?.setOnInfoListener { mp, what, extra ->
// if (what == MediaPlayer.MEDIA_INFO_VIDEO_RENDERING_START){
// iv_video_background.visibility = View.GONE
// video_view.setBackgroundColor(Color.TRANSPARENT)
// }
// true
// }
// it?.start()
// it?.setVolume(0.0F,0.0F)
// }
// video_view?.setOnCompletionListener { video_view?.start() }
video_view?.setOnCompletionListener { video_view?.start() }
}
......@@ -201,46 +159,4 @@ class HomeMuseView(private val mContext: Context, private var homeEvent: IHomeEv
}
}
private var runnable = object : RunnableWithParams {
var videoUrl:String? = null
var imageUrl:String? = null
override fun setParams(videoUrl: String, imageUrl: String) {
this.videoUrl = videoUrl
this.imageUrl = imageUrl
}
override fun run() {
mMediaPlayer = MediaPlayer()
mMediaPlayer?.setDataSource(videoUrl)
mMediaPlayer?.setSurface(mSurface)
mMediaPlayer?.prepareAsync()
mMediaPlayer?.setVolume(0F, 0F)
mMediaPlayer?.setOnPreparedListener {
iv_video_background.visibility = GONE
mMediaPlayer?.start()
}
mMediaPlayer?.setOnErrorListener { mp, what, extra ->
Glide.with(this@HomeMuseView)
.load(videoUrl)
.transition(withCrossFade())
.into(iv_video_background)
true
}
mMediaPlayer?.setOnCompletionListener {
mMediaPlayer?.start()
}
}
}
interface RunnableWithParams:Runnable {
fun setParams(videoUrl:String,imageUrl:String){
}
}
}
\ No newline at end of file
......@@ -23,11 +23,10 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextureView
<com.yidianling.home.widget.AdaptiveVideoView
android:id="@+id/video_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false" />
......
......@@ -73,12 +73,14 @@ dependencies {
//开发时使用
api project(":ydl-platform")
implementation project(':ydl-media')
implementation modularPublication('com.ydl:m-user-api')
implementation project(':ydl-flutter-base')
implementation project(':ydl-webview')
} else {
//发布时使用
api rootProject.ext.dependencies["ydl-media"]
compileOnly rootProject.ext.dependencies["ydl-m-user-api"]
api (rootProject.ext.dependencies["ydl-webview"]){
transitive = true
}
......
......@@ -14,6 +14,7 @@ import com.ydl.ydlcommon.base.BaseActivity
import com.ydl.ydlcommon.bean.StatusBarOptions
import com.ydl.ydlcommon.data.http.ThrowableConsumer
import com.ydl.ydlcommon.event.MeditationEvent
import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.utils.StatusBarUtils.Companion.setTransparentForImageView
import com.ydl.ydlcommon.utils.StatusBarUtils.Companion.statusBarLightMode
import com.ydl.ydlcommon.utils.Utils
......@@ -26,6 +27,7 @@ import com.yidianling.muse.helper.MediaPlayerManager
import com.yidianling.muse.utils.MediaPlayerTimeUtil
import com.yidianling.muse.widget.QuitMeditationDialog
import com.yidianling.muse.widget.ShareMeditationDialog
import com.yidianling.user.api.service.IUserService
import de.greenrobot.event.EventBus
import io.reactivex.Observable
import io.reactivex.Observer
......@@ -277,6 +279,13 @@ class PlayMeditationActivity : BaseActivity() {
}
iv_collect.setOnClickListener {
if (Utils.isFastClick()) {
//防止连击
return@setOnClickListener
}
if(!ModularServiceManager.provide(IUserService::class.java).loginByOneKeyLogin(this,true)) {
return@setOnClickListener
}
if (meditationId == null || mediaId == null) return@setOnClickListener
MuseHttp.getInstance().collectMeditation(
meditationId = meditationId!!,
......
......@@ -496,9 +496,6 @@ class MineFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener, View.
jtv_test?.postDelayed({ YdlBuryPointUtil.sendPv("PvEvent") }, 300)
jtv_test?.postDelayed({ YdlBuryPointUtil.sendClick("ClickEvent") }, 500)
} else if (id == R.id.ll_meditation) { //冥想
if (!startLoginByStatus(mActivity!!, true)) {
return
}
val h5Params3 = H5Params(MH5_URL + "meditation?hideNavBar=1", null)
NewH5Activity.start(activity, h5Params3)
}
......
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