Commit 1b4ccdf4 by 刘鹏

feat: 埋点完成

parent e8c6a1ea
...@@ -16,6 +16,8 @@ import com.ydl.webview.H5Params ...@@ -16,6 +16,8 @@ import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity import com.ydl.webview.NewH5Activity
import com.ydl.ydlcommon.modular.ModularServiceManager import com.ydl.ydlcommon.modular.ModularServiceManager
import com.ydl.ydlcommon.utils.Utils import com.ydl.ydlcommon.utils.Utils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.yidianling.home.constants.HomeBIConstants
import com.yidianling.home.model.bean.MeditationModuleBean import com.yidianling.home.model.bean.MeditationModuleBean
import com.yidianling.user.api.service.IUserService import com.yidianling.user.api.service.IUserService
import kotlinx.android.synthetic.ydl.home_fragment.* import kotlinx.android.synthetic.ydl.home_fragment.*
...@@ -26,6 +28,7 @@ class MeditationTypeAdapter( ...@@ -26,6 +28,7 @@ class MeditationTypeAdapter(
private val moreLink: String?, private val moreLink: String?,
private val homeLink:String?=null, private val homeLink:String?=null,
private val cateId:Long?=null, private val cateId:Long?=null,
private val buried:String?=null,
private val mark:Int?=null, private val mark:Int?=null,
private val meditationType: Int? = null private val meditationType: Int? = null
) : RecyclerView.Adapter<RecyclerView.ViewHolder>() { ) : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
...@@ -64,6 +67,13 @@ class MeditationTypeAdapter( ...@@ -64,6 +67,13 @@ class MeditationTypeAdapter(
} }
holder.cvLayout?.setOnClickListener { holder.cvLayout?.setOnClickListener {
ActionCountUtils.baiDuCountSign3(
HomeBIConstants.YDL_USER_MAIN_PAGE_MUSE,
HomeBIConstants.YDL_HOME_MEDITATION_CLICK,
buried ?: "",
(position+1).toString(),
""
)
if (meditationType == 0){ if (meditationType == 0){
if (Utils.isFastClick()) { if (Utils.isFastClick()) {
//防止连击 //防止连击
...@@ -103,6 +113,9 @@ class MeditationTypeAdapter( ...@@ -103,6 +113,9 @@ class MeditationTypeAdapter(
//防止连击 //防止连击
return@setOnClickListener return@setOnClickListener
} }
//冥想助眠更多点击事件
ActionCountUtils.count(HomeBIConstants.YDL_HOME_MEDITATION_VOICE_MORE_CLICK,buried?:"")
val moreLink = "${moreLink}mark=$mark&cateId=$cateId" val moreLink = "${moreLink}mark=$mark&cateId=$cateId"
if (!moreLink.isNullOrBlank()) { if (!moreLink.isNullOrBlank()) {
NewH5Activity.start(context, H5Params(moreLink, null)) NewH5Activity.start(context, H5Params(moreLink, null))
......
...@@ -27,6 +27,7 @@ class MeditationViewPagerAdapter(private val context: Context, private val data: ...@@ -27,6 +27,7 @@ class MeditationViewPagerAdapter(private val context: Context, private val data:
moreLink = it.lowerFloorMore?:"", moreLink = it.lowerFloorMore?:"",
homeLink = it.mditationDetailUrl, homeLink = it.mditationDetailUrl,
cateId = it.cateId, cateId = it.cateId,
buried = it.buried,
mark = it.mark, mark = it.mark,
meditationType = it.meditionType) meditationType = it.meditionType)
} }
......
...@@ -41,7 +41,13 @@ class HomeBIConstants { ...@@ -41,7 +41,13 @@ class HomeBIConstants {
const val YDL_HOME_ZHUMIANICON: String = YDL_USER_MAIN_PAGE + "ydl_user_sleep_aid_type_click" // 首页_助眠_icon const val YDL_HOME_ZHUMIANICON: String = YDL_USER_MAIN_PAGE + "ydl_user_sleep_aid_type_click" // 首页_助眠_icon
const val YDL_HOME_SEARCH_TAG: String = YDL_USER_MAIN_PAGE + "ydl_user_search_tag" // 首页_定制咨询点击tag const val YDL_HOME_SEARCH_TAG: String = YDL_USER_MAIN_PAGE + "ydl_user_search_tag" // 首页_定制咨询点击tag
const val YDL_HOME_POPUPWINDOWS_PAGE_POPUP: String = YDL_USER_MAIN_PAGE + "popupwindows_page_popup" // 首页弹窗页面弹出事件(99元3小时弹出事件) const val YDL_HOME_POPUPWINDOWS_PAGE_POPUP: String = YDL_USER_MAIN_PAGE + "popupwindows_page_popup" // 首页弹窗页面弹出事件(99元3小时弹出事件)
//首页_冥想(ydl_user_main_page)
const val YDL_USER_MAIN_PAGE_MUSE: String = "ydl_user_main_page"//壹点灵用户版首页 partId
const val YDL_HOME_MEDITATION_MORE_CLICK: String = YDL_USER_MAIN_PAGE + "main_meditation_more_click" // 冥想助眠更多点击事件
const val YDL_HOME_MEDITATION_SUBJECT_CLICK: String = YDL_USER_MAIN_PAGE + "main_meditation_subject_click" // 冥想|声音|睡眠点击事件
const val YDL_HOME_MEDITATION_VOICE_MORE_CLICK: String = YDL_USER_MAIN_PAGE + "main_meditation_voice_more_click" // 冥想|声音|睡眠_更多点击事件
const val YDL_HOME_MEDITATION_CLICK: String = "main_meditation_meditation_click" // 冥想_声音点击事件
} }
......
...@@ -12,16 +12,15 @@ import android.view.View ...@@ -12,16 +12,15 @@ import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
import android.widget.LinearLayout import android.widget.LinearLayout
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide
import com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions.withCrossFade
import com.google.android.material.tabs.TabLayout import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayoutMediator import com.google.android.material.tabs.TabLayoutMediator
import com.ydl.webview.H5Params import com.ydl.webview.H5Params
import com.ydl.webview.NewH5Activity import com.ydl.webview.NewH5Activity
import com.ydl.ydl_image.module.GlideApp
import com.ydl.ydlcommon.utils.Utils import com.ydl.ydlcommon.utils.Utils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.yidianling.home.MeditationViewPagerAdapter import com.yidianling.home.MeditationViewPagerAdapter
import com.yidianling.home.R import com.yidianling.home.R
import com.yidianling.home.constants.HomeBIConstants
import com.yidianling.home.constract.HomeViewConfig import com.yidianling.home.constract.HomeViewConfig
import com.yidianling.home.event.IHomeEvent import com.yidianling.home.event.IHomeEvent
import com.yidianling.home.model.bean.MeditationModuleBean import com.yidianling.home.model.bean.MeditationModuleBean
...@@ -68,6 +67,8 @@ class HomeMuseView(private val mContext: Context, private var homeEvent: IHomeEv ...@@ -68,6 +67,8 @@ class HomeMuseView(private val mContext: Context, private var homeEvent: IHomeEv
//防止连击 //防止连击
return@setOnClickListener return@setOnClickListener
} }
//冥想助眠更多点击事件
ActionCountUtils.count(HomeBIConstants.YDL_HOME_MEDITATION_MORE_CLICK)
if (!moreLink.isNullOrBlank()) { if (!moreLink.isNullOrBlank()) {
NewH5Activity.start(context, H5Params(moreLink, null)) NewH5Activity.start(context, H5Params(moreLink, null))
} }
...@@ -127,6 +128,10 @@ class HomeMuseView(private val mContext: Context, private var homeEvent: IHomeEv ...@@ -127,6 +128,10 @@ class HomeMuseView(private val mContext: Context, private var homeEvent: IHomeEv
tab_layout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener { tab_layout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener {
override fun onTabSelected(tab: TabLayout.Tab?) { override fun onTabSelected(tab: TabLayout.Tab?) {
//冥想|声音|睡眠点击事件
ActionCountUtils.count(HomeBIConstants.YDL_HOME_MEDITATION_SUBJECT_CLICK,
tab?.let { bean?.mditationListResponse?.get(it.position)?.buried } ?:"")
var text: String? = tab?.text.toString().trim() var text: String? = tab?.text.toString().trim()
val spStr = SpannableString(text) val spStr = SpannableString(text)
val styleSpan = StyleSpan(Typeface.BOLD) val styleSpan = StyleSpan(Typeface.BOLD)
......
...@@ -19,15 +19,16 @@ import com.ydl.ydlcommon.utils.StatusBarUtils ...@@ -19,15 +19,16 @@ import com.ydl.ydlcommon.utils.StatusBarUtils
import com.ydl.ydlcommon.utils.StatusBarUtils.Companion.setTransparentForImageView import com.ydl.ydlcommon.utils.StatusBarUtils.Companion.setTransparentForImageView
import com.ydl.ydlcommon.utils.StatusBarUtils.Companion.statusBarLightMode import com.ydl.ydlcommon.utils.StatusBarUtils.Companion.statusBarLightMode
import com.ydl.ydlcommon.utils.Utils import com.ydl.ydlcommon.utils.Utils
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.ydl.ydlcommon.utils.remind.ToastHelper.Companion.show import com.ydl.ydlcommon.utils.remind.ToastHelper.Companion.show
import com.yidianling.common.tools.ToastUtil import com.yidianling.common.tools.ToastUtil
import com.yidianling.home.http.MuseHttp import com.yidianling.home.http.MuseHttp
import com.yidianling.muse.R import com.yidianling.muse.R
import com.yidianling.muse.bean.MeditationPlayModuleBean import com.yidianling.muse.bean.MeditationPlayModuleBean
import com.yidianling.muse.constants.MuseBIConstants
import com.yidianling.muse.event.MeditationFloatEvent import com.yidianling.muse.event.MeditationFloatEvent
import com.yidianling.muse.helper.MediaPlayerManager import com.yidianling.muse.helper.MediaPlayerManager
import com.yidianling.muse.utils.MediaPlayerTimeUtil import com.yidianling.muse.utils.MediaPlayerTimeUtil
import com.yidianling.muse.utils.MeditationFloatPermissionUtil
import com.yidianling.muse.widget.QuitMeditationDialog import com.yidianling.muse.widget.QuitMeditationDialog
import com.yidianling.muse.widget.ShareMeditationDialog import com.yidianling.muse.widget.ShareMeditationDialog
import com.yidianling.user.api.service.IUserService import com.yidianling.user.api.service.IUserService
...@@ -88,7 +89,7 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -88,7 +89,7 @@ class PlayMeditationActivity : BaseActivity() {
private var mObserver: Observer<Long>? = null private var mObserver: Observer<Long>? = null
private var status = 0 private var status = 0
private var buried:String? = null private var buried: String? = null
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
setTransparentForImageView(this, null) setTransparentForImageView(this, null)
...@@ -134,7 +135,10 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -134,7 +135,10 @@ class PlayMeditationActivity : BaseActivity() {
module.mediaList?.forEach { meditationPlayBean -> module.mediaList?.forEach { meditationPlayBean ->
if (meditationPlayBean.mediaId == mediaId) { if (meditationPlayBean.mediaId == mediaId) {
currentMeditation = meditationPlayBean.copy(mediaType = meditationType,meditationId = meditationId!!) currentMeditation = meditationPlayBean.copy(
mediaType = meditationType,
meditationId = meditationId!!
)
mediaId = module?.mediaId ?: 0L mediaId = module?.mediaId ?: 0L
val title = meditationPlayBean.title ?: "未知标题" val title = meditationPlayBean.title ?: "未知标题"
...@@ -168,6 +172,15 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -168,6 +172,15 @@ class PlayMeditationActivity : BaseActivity() {
) )
initMediaPlayer(mediaUrl, currentPosition) initMediaPlayer(mediaUrl, currentPosition)
//快进点击事件
ActionCountUtils.baiDuCountSign3(
MuseBIConstants.YDL_MUSE_MEDITATION_MUSIC_PLAY_PAGE,
MuseBIConstants.YDL_MUSE_PLAY_PAGE_VISIT,
currentMeditation?.title ?: "",
buried ?: "",
""
)
} }
} }
} }
...@@ -199,7 +212,8 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -199,7 +212,8 @@ class PlayMeditationActivity : BaseActivity() {
if (meditationPlayBean.mediaId == mediaId) { if (meditationPlayBean.mediaId == mediaId) {
currentMeditation = meditationPlayBean.copy(meditationId = meditationId!!) currentMeditation =
meditationPlayBean.copy(meditationId = meditationId!!)
mediaId = module?.mediaId ?: 0L mediaId = module?.mediaId ?: 0L
val title = meditationPlayBean.title val title = meditationPlayBean.title
...@@ -289,6 +303,14 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -289,6 +303,14 @@ class PlayMeditationActivity : BaseActivity() {
//防止连击 //防止连击
return@setOnClickListener return@setOnClickListener
} }
//列表点击事件
ActionCountUtils.baiDuCountSign3(
MuseBIConstants.YDL_MUSE_MEDITATION_MUSIC_PLAY_PAGE,
MuseBIConstants.YDL_MUSE_PLAY_LIST_CLICK,
currentMeditation?.title ?: "",
buried ?: "",
""
)
if (!mediaListLink.isNullOrBlank()) { if (!mediaListLink.isNullOrBlank()) {
NewH5Activity.start(this, H5Params(mediaListLink!!, null)) NewH5Activity.start(this, H5Params(mediaListLink!!, null))
} }
...@@ -299,7 +321,18 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -299,7 +321,18 @@ class PlayMeditationActivity : BaseActivity() {
//防止连击 //防止连击
return@setOnClickListener return@setOnClickListener
} }
if(!ModularServiceManager.provide(IUserService::class.java).loginByOneKeyLogin(this,true)) { //快进点击事件
ActionCountUtils.baiDuCountSign3(
MuseBIConstants.YDL_MUSE_MEDITATION_MUSIC_PLAY_PAGE,
MuseBIConstants.YDL_MUSE_PLAY_COLLECT_CLICK,
currentMeditation?.title ?: "",
buried ?: "",
""
)
if (!ModularServiceManager.provide(IUserService::class.java)
.loginByOneKeyLogin(this, true)
) {
return@setOnClickListener return@setOnClickListener
} }
if (meditationId == null || mediaId == null) return@setOnClickListener if (meditationId == null || mediaId == null) return@setOnClickListener
...@@ -347,6 +380,15 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -347,6 +380,15 @@ class PlayMeditationActivity : BaseActivity() {
.into(iv_bg) .into(iv_bg)
iv_close.setOnClickListener { iv_close.setOnClickListener {
//关闭点击事件
ActionCountUtils.baiDuCountSign3(
MuseBIConstants.YDL_MUSE_MEDITATION_MUSIC_PLAY_PAGE,
MuseBIConstants.YDL_MUSE_PLAY_CLOSE_CLICK,
currentMeditation?.title ?: "",
buried ?: "",
""
)
if (quitDialog == null) { if (quitDialog == null) {
quitDialog = QuitMeditationDialog.newInstance() quitDialog = QuitMeditationDialog.newInstance()
} }
...@@ -382,23 +424,39 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -382,23 +424,39 @@ class PlayMeditationActivity : BaseActivity() {
} }
iv_back.setOnClickListener { iv_back.setOnClickListener {
//收起点击事件
val event = MeditationFloatEvent(true,meditationDetail = currentMeditation) ActionCountUtils.baiDuCountSign3(
MuseBIConstants.YDL_MUSE_MEDITATION_MUSIC_PLAY_PAGE,
MuseBIConstants.YDL_MUSE_PLAY_PACK_CLICK,
currentMeditation?.title ?: "",
buried ?: "",
""
)
val event = MeditationFloatEvent(true, meditationDetail = currentMeditation)
EventBus.getDefault().post(event) EventBus.getDefault().post(event)
Handler().postDelayed({ Handler().postDelayed({
finish() finish()
},300) }, 300)
} }
iv_share.setOnClickListener { iv_share.setOnClickListener {
//分享点击事件
ActionCountUtils.baiDuCountSign3(
MuseBIConstants.YDL_MUSE_MEDITATION_MUSIC_PLAY_PAGE,
MuseBIConstants.YDL_MUSE_PLAY_SHARE_CLICK,
currentMeditation?.title ?: "",
buried ?: "",
""
)
if (shareDialog == null) { if (shareDialog == null) {
shareDialog = ShareMeditationDialog shareDialog = ShareMeditationDialog
.newInstance( .newInstance(
shareTitle = shareTitle, shareTitle = shareTitle,
shareContent = shareContent, shareContent = shareContent,
shareUrl = shareUrl, shareUrl = shareUrl,
shareImageUrl = shareImageUrl) shareImageUrl = shareImageUrl
)
} }
if (shareDialog != null && shareDialog?.isAdded == false) { if (shareDialog != null && shareDialog?.isAdded == false) {
shareDialog?.show(supportFragmentManager, ShareMeditationDialog.TAG) shareDialog?.show(supportFragmentManager, ShareMeditationDialog.TAG)
...@@ -407,6 +465,14 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -407,6 +465,14 @@ class PlayMeditationActivity : BaseActivity() {
} }
iv_time_off.setOnClickListener { iv_time_off.setOnClickListener {
//定时 ioc点击事件
ActionCountUtils.baiDuCountSign3(
MuseBIConstants.YDL_MUSE_MEDITATION_MUSIC_PLAY_PAGE,
MuseBIConstants.YDL_MUSE_PLAY_IOC_CLICK,
currentMeditation?.title ?: "",
buried ?: "",
""
)
startActivityForResult( startActivityForResult(
Intent(this, MeditationTimeOffActivity::class.java), Intent(this, MeditationTimeOffActivity::class.java),
request_code request_code
...@@ -414,6 +480,14 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -414,6 +480,14 @@ class PlayMeditationActivity : BaseActivity() {
} }
ll_pure_music_time_off.setOnClickListener { ll_pure_music_time_off.setOnClickListener {
//定时 ioc点击事件
ActionCountUtils.baiDuCountSign3(
MuseBIConstants.YDL_MUSE_MEDITATION_MUSIC_PLAY_PAGE,
MuseBIConstants.YDL_MUSE_PLAY_IOC_CLICK,
currentMeditation?.title ?: "",
buried ?: "",
""
)
startActivityForResult( startActivityForResult(
Intent(this, MeditationTimeOffActivity::class.java), Intent(this, MeditationTimeOffActivity::class.java),
request_code request_code
...@@ -429,6 +503,15 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -429,6 +503,15 @@ class PlayMeditationActivity : BaseActivity() {
playTime = (seekbar_play_progress.progress / 1000.00).roundToInt(), playTime = (seekbar_play_progress.progress / 1000.00).roundToInt(),
isComplete = 0 isComplete = 0
) )
//暂停埋点
ActionCountUtils.baiDuCountSign3(
MuseBIConstants.YDL_MUSE_MEDITATION_MUSIC_PLAY_PAGE,
MuseBIConstants.YDL_MUSE_PLAY_PAUSE_CLICK,
currentMeditation?.title ?: "",
buried ?: "",
""
)
} else { } else {
val duration = mMediaPlayer?.duration val duration = mMediaPlayer?.duration
...@@ -446,7 +529,14 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -446,7 +529,14 @@ class PlayMeditationActivity : BaseActivity() {
} }
} }
}, 0, 50) }, 0, 50)
//播放埋点
ActionCountUtils.baiDuCountSign3(
MuseBIConstants.YDL_MUSE_MEDITATION_MUSIC_PLAY_PAGE,
MuseBIConstants.YDL_MUSE_PLAY_PLAY_CLICK,
currentMeditation?.title ?: "",
buried ?: "",
""
)
} }
isPlaying = !isPlaying isPlaying = !isPlaying
if (isPlaying) { if (isPlaying) {
...@@ -458,9 +548,16 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -458,9 +548,16 @@ class PlayMeditationActivity : BaseActivity() {
} }
exo_prev.setOnClickListener { exo_prev.setOnClickListener {
//上一曲埋点
ActionCountUtils.baiDuCountSign3(
MuseBIConstants.YDL_MUSE_MEDITATION_MUSIC_PLAY_PAGE,
MuseBIConstants.YDL_MUSE_PLAY_LAST_CLICK,
currentMeditation?.title ?: "",
buried ?: "",
""
)
val currentPosition = meditations.indexOf(currentMeditation) val currentPosition = meditations.indexOf(currentMeditation)
if (currentPosition > 0){ if (currentPosition > 0) {
if (meditationId == null || mediaId == null) return@setOnClickListener if (meditationId == null || mediaId == null) return@setOnClickListener
postPlayRecord(isQuit = 0, playTime = 0, isComplete = 0) postPlayRecord(isQuit = 0, playTime = 0, isComplete = 0)
...@@ -489,15 +586,23 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -489,15 +586,23 @@ class PlayMeditationActivity : BaseActivity() {
} }
) )
initMediaPlayer(mediaUrl,currentPosition) initMediaPlayer(mediaUrl, currentPosition)
}else{ } else {
ToastUtil.toastShort("当前已经是第一首") ToastUtil.toastShort("当前已经是第一首")
} }
} }
exo_next.setOnClickListener { exo_next.setOnClickListener {
//下一个点击事件
ActionCountUtils.baiDuCountSign3(
MuseBIConstants.YDL_MUSE_MEDITATION_MUSIC_PLAY_PAGE,
MuseBIConstants.YDL_MUSE_PLAY_NEXT_CLICK,
currentMeditation?.title ?: "",
buried ?: "",
""
)
val currentPosition = meditations.indexOf(currentMeditation) val currentPosition = meditations.indexOf(currentMeditation)
if (currentPosition < meditations.size - 1){ if (currentPosition < meditations.size - 1) {
if (meditationId == null || mediaId == null) return@setOnClickListener if (meditationId == null || mediaId == null) return@setOnClickListener
postPlayRecord(isQuit = 0, playTime = 0, isComplete = 0) postPlayRecord(isQuit = 0, playTime = 0, isComplete = 0)
...@@ -526,13 +631,21 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -526,13 +631,21 @@ class PlayMeditationActivity : BaseActivity() {
} }
) )
initMediaPlayer(mediaUrl,currentPosition) initMediaPlayer(mediaUrl, currentPosition)
}else{ } else {
ToastUtil.toastShort("当前已经是最后一首") ToastUtil.toastShort("当前已经是最后一首")
} }
} }
exo_rew.setOnClickListener { exo_rew.setOnClickListener {
//快退点击事件
ActionCountUtils.baiDuCountSign3(
MuseBIConstants.YDL_MUSE_MEDITATION_MUSIC_PLAY_PAGE,
MuseBIConstants.YDL_MUSE_PLAY_REW_CLICK,
currentMeditation?.title ?: "",
buried ?: "",
""
)
val currentPosition = MediaPlayerManager val currentPosition = MediaPlayerManager
.getInstance(this@PlayMeditationActivity)?.getMediaPlayer()?.currentPosition .getInstance(this@PlayMeditationActivity)?.getMediaPlayer()?.currentPosition
val seekPosition = 0.coerceAtLeast(currentPosition?.minus(15000) ?: 0) val seekPosition = 0.coerceAtLeast(currentPosition?.minus(15000) ?: 0)
...@@ -542,7 +655,14 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -542,7 +655,14 @@ class PlayMeditationActivity : BaseActivity() {
} }
exo_ffwd.setOnClickListener { exo_ffwd.setOnClickListener {
//快进点击事件
ActionCountUtils.baiDuCountSign3(
MuseBIConstants.YDL_MUSE_MEDITATION_MUSIC_PLAY_PAGE,
MuseBIConstants.YDL_MUSE_PLAY_SPEED_CLICK,
currentMeditation?.title ?: "",
buried ?: "",
""
)
val currentPosition = MediaPlayerManager val currentPosition = MediaPlayerManager
.getInstance(this@PlayMeditationActivity)?.getMediaPlayer()?.currentPosition .getInstance(this@PlayMeditationActivity)?.getMediaPlayer()?.currentPosition
val seekPosition = duration.coerceAtMost(currentPosition?.plus(15000) ?: 0) val seekPosition = duration.coerceAtMost(currentPosition?.plus(15000) ?: 0)
...@@ -553,6 +673,7 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -553,6 +673,7 @@ class PlayMeditationActivity : BaseActivity() {
seekbar_play_progress.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener { seekbar_play_progress.setOnSeekBarChangeListener(object : SeekBar.OnSeekBarChangeListener {
override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) { override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
if (mMediaPlayer != null) { if (mMediaPlayer != null) {
val totalDuration = mMediaPlayer!!.duration / 1000 val totalDuration = mMediaPlayer!!.duration / 1000
val position = mMediaPlayer!!.currentPosition val position = mMediaPlayer!!.currentPosition
...@@ -563,6 +684,14 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -563,6 +684,14 @@ class PlayMeditationActivity : BaseActivity() {
} }
override fun onStartTrackingTouch(seekBar: SeekBar?) { override fun onStartTrackingTouch(seekBar: SeekBar?) {
//进度条点击事件
ActionCountUtils.baiDuCountSign3(
MuseBIConstants.YDL_MUSE_MEDITATION_MUSIC_PLAY_PAGE,
MuseBIConstants.YDL_MUSE_PLAY_PROGRESS_CLICK,
currentMeditation?.title ?: "",
buried ?: "",
""
)
isSeekbarChanging = true isSeekbarChanging = true
} }
...@@ -587,37 +716,40 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -587,37 +716,40 @@ class PlayMeditationActivity : BaseActivity() {
} }
private fun initPlayCompletionListener(isLoop:Boolean = false,isSingle:Boolean = false){ private fun initPlayCompletionListener(isLoop: Boolean = false, isSingle: Boolean = false) {
mMediaPlayer?.setOnCompletionListener { mMediaPlayer?.setOnCompletionListener {
postPlayRecord(isQuit = 0, postPlayRecord(
isQuit = 0,
playTime = (seekbar_play_progress.progress / 1000.00).roundToInt(), playTime = (seekbar_play_progress.progress / 1000.00).roundToInt(),
isComplete = 1) isComplete = 1
)
if (isLoop){ if (isLoop) {
if (isSingle || meditations.size == 1){ if (isSingle || meditations.size == 1) {
MediaPlayerManager.getInstance(this)?.setAudioPath(currentMeditation?.mediaUrl?:"") MediaPlayerManager.getInstance(this)
}else{ ?.setAudioPath(currentMeditation?.mediaUrl ?: "")
} else {
currentMeditationIndex = meditations.indexOf(currentMeditation) currentMeditationIndex = meditations.indexOf(currentMeditation)
if(currentMeditationIndex == meditations.size - 1){ if (currentMeditationIndex == meditations.size - 1) {
currentMeditationIndex = 0 currentMeditationIndex = 0
}else{ } else {
currentMeditationIndex++ currentMeditationIndex++
} }
currentMeditation = meditations[currentMeditationIndex] currentMeditation = meditations[currentMeditationIndex]
val event = MeditationEvent( val event = MeditationEvent(
currentMeditation?.mediaId?.toInt()?:0, currentMeditation?.mediaId?.toInt() ?: 0,
meditationId?:0L, meditationId ?: 0L,
meditationType?:0, meditationType ?: 0,
businessType, businessType,
status = status, status = status,
buried = buried?:"", buried = buried ?: "",
mediaUrl = currentMeditation?.mediaUrl?:"", mediaUrl = currentMeditation?.mediaUrl ?: "",
mediaCoverUrl = currentMeditation?.coverImageUrl?:"", mediaCoverUrl = currentMeditation?.coverImageUrl ?: "",
title = currentMeditation?.title?:"", title = currentMeditation?.title ?: "",
desc = currentMeditation?.desc?:"" desc = currentMeditation?.desc ?: ""
) )
EventBus.getDefault().post(event) EventBus.getDefault().post(event)
} }
...@@ -630,7 +762,7 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -630,7 +762,7 @@ class PlayMeditationActivity : BaseActivity() {
exo_play.setImageResource(R.drawable.icon_pause_meditation) exo_play.setImageResource(R.drawable.icon_pause_meditation)
false false
} }
if (mMediaPlayer?.isPlaying == true){ if (mMediaPlayer?.isPlaying == true) {
mMediaPlayer?.pause() mMediaPlayer?.pause()
} }
} }
...@@ -722,7 +854,8 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -722,7 +854,8 @@ class PlayMeditationActivity : BaseActivity() {
mTimer.schedule(object : TimerTask() { mTimer.schedule(object : TimerTask() {
override fun run() { override fun run() {
if (!isSeekbarChanging) { if (!isSeekbarChanging) {
seekbar_play_progress.progress = mMediaPlayer?.currentPosition ?: 0 seekbar_play_progress.progress =
mMediaPlayer?.currentPosition ?: 0
} }
} }
}, 0, 50) }, 0, 50)
...@@ -739,13 +872,13 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -739,13 +872,13 @@ class PlayMeditationActivity : BaseActivity() {
val minute = data?.extras?.getInt("TIME_OFF_MINUTE", 0) val minute = data?.extras?.getInt("TIME_OFF_MINUTE", 0)
if (minute != null && minute > 0) { if (minute != null && minute > 0) {
if (meditationType == 0) { if (meditationType == 0) {
initPlayCompletionListener(isLoop = true,isSingle = true) initPlayCompletionListener(isLoop = true, isSingle = true)
tv_time_off_pure_music.visibility = View.VISIBLE tv_time_off_pure_music.visibility = View.VISIBLE
tv_time_off.visibility = View.GONE tv_time_off.visibility = View.GONE
mDisposable?.dispose() mDisposable?.dispose()
initRxTimeOff((minute * 60 * 1000).toLong(), 0) initRxTimeOff((minute * 60 * 1000).toLong(), 0)
} else { } else {
initPlayCompletionListener(isLoop = true,isSingle = false) initPlayCompletionListener(isLoop = true, isSingle = false)
tv_time_off_pure_music.visibility = View.GONE tv_time_off_pure_music.visibility = View.GONE
tv_time_off.visibility = View.VISIBLE tv_time_off.visibility = View.VISIBLE
mDisposable?.dispose() mDisposable?.dispose()
...@@ -840,7 +973,7 @@ class PlayMeditationActivity : BaseActivity() { ...@@ -840,7 +973,7 @@ class PlayMeditationActivity : BaseActivity() {
} }
override fun onBackPressed() { override fun onBackPressed() {
val event = MeditationFloatEvent(true,meditationDetail = currentMeditation) val event = MeditationFloatEvent(true, meditationDetail = currentMeditation)
EventBus.getDefault().post(event) EventBus.getDefault().post(event)
super.onBackPressed() super.onBackPressed()
} }
......
package com.yidianling.muse.constants
/**
* @author liunpeng
* */
class MuseBIConstants {
companion object {
//音乐播放页(meditation_music_play_page)
const val YDL_MUSE_MEDITATION_MUSIC_PLAY_PAGE: String =
"meditation_music_play_page"//音乐播放页(meditation_music_play_page)
const val YDL_MUSE_PLAY_PACK_CLICK: String =
"music_play_pack_click"//收起点击事件 sign1: 内容标题 sign2(传入字符串): meditation(冥想播放), voice(轻音乐播放), sleep(睡眠播放)
const val YDL_MUSE_PLAY_CLOSE_CLICK: String =
"music_play_close_click" //关闭点击事件 sign1: 内容标题 sign2(传入字符串): meditation(冥想播放), voice(轻音乐播放), sleep(睡眠播放)
const val YDL_MUSE_PLAY_COLLECT_CLICK: String =
"music_play_collect_click"//收藏点击事件 sign1: 内容标题 sign2(传入字符串): meditation(冥想播放), voice(轻音乐播放), sleep(睡眠播放)
const val YDL_MUSE_PLAY_SHARE_CLICK: String =
"music_play_share_click"//分享点击事件 sign1: 内容标题 sign2(传入字符串): meditation(冥想播放), voice(轻音乐播放), sleep(睡眠播放)
const val YDL_MUSE_PLAY_IOC_CLICK: String =
"music_play_ioc_click"//定时 ioc点击事件 sign1: 内容标题 sign2(传入字符串): meditation(冥想播放), voice(轻音乐播放), sleep(睡眠播放)
const val YDL_MUSE_PLAY_PROGRESS_CLICK: String =
"music_play_progress_click"//进度条点击事件 sign1: 内容标题 sign2(传入字符串): meditation(冥想播放), voice(轻音乐播放), sleep(睡眠播放)
const val YDL_MUSE_PLAY_SPEED_CLICK: String =
"music_play_speed_click"//快进点击事件 sign1: 内容标题 sign2(传入字符串): meditation(冥想播放), voice(轻音乐播放), sleep(睡眠播放)
const val YDL_MUSE_PLAY_REW_CLICK: String =
"music_play_rew_click"//快退点击事件 sign1: 内容标题 sign2(传入字符串): meditation(冥想播放), voice(轻音乐播放), sleep(睡眠播放)
const val YDL_MUSE_PLAY_NEXT_CLICK: String =
"music_play_next_click"//下一个点击事件 sign1: 内容标题 sign2(传入字符串): meditation(冥想播放), voice(轻音乐播放), sleep(睡眠播放)
const val YDL_MUSE_PLAY_LAST_CLICK: String =
"music_play_last_click"//上一个点击事件 sign1: 内容标题 sign2(传入字符串): meditation(冥想播放), voice(轻音乐播放), sleep(睡眠播放)
const val YDL_MUSE_PLAY_PAUSE_CLICK: String =
"music_play_pause_click"//暂停点击事件 sign1: 内容标题 sign2(传入字符串): meditation(冥想播放), voice(轻音乐播放), sleep(睡眠播放)
const val YDL_MUSE_PLAY_PLAY_CLICK: String =
"music_play_play_click"//播放点击事件 sign1: 内容标题 sign2(传入字符串): meditation(冥想播放), voice(轻音乐播放), sleep(睡眠播放)
const val YDL_MUSE_PLAY_PAGE_VISIT: String =
"music_play_page_visit"//曝光事件 sign1: 内容标题 sign2(传入字符串): meditation(冥想播放), voice(轻音乐播放), sleep(睡眠播放)
const val YDL_MUSE_PLAY_CHANGE_CLICK: String =
"music_play_change_click"//切换音频点击事件 sign1: 内容标题 sign2(传入字符串): meditation(冥想播放), voice(轻音乐播放), sleep(睡眠播放)
const val YDL_MUSE_PLAY_LIST_CLICK: String =
"music_play_list_click"//列表点击事件 sign1: 内容标题 sign2(传入字符串): meditation(冥想播放), voice(轻音乐播放), sleep(睡眠播放)
//悬浮窗(meditation_floating_window_play)
private const val YDL_MUSE_MEDITATION_FLOATING_WINDOW: String =
"meditation_floating_window_play|"//悬浮窗
const val YDL_MUSE_MEDITATION_WINDOW_PLAY_CLICK: String =
YDL_MUSE_MEDITATION_FLOATING_WINDOW + "meditation_floating_window_play_click"//悬浮窗播放点击事件
const val YDL_MUSE_MEDITATION_WINDOW_PAUSE_CLICK: String =
YDL_MUSE_MEDITATION_FLOATING_WINDOW + "meditation_floating_window_pause_click"//悬浮窗暂停点击事件
const val YDL_MUSE_MEDITATION_WINDOW_CLOSE_CLICK: String =
YDL_MUSE_MEDITATION_FLOATING_WINDOW + "meditation_floating_window_close_click"//悬浮窗关闭点击事件
const val YDL_MUSE_MEDITATION_WINDOW_CLICK: String =
YDL_MUSE_MEDITATION_FLOATING_WINDOW + "meditation_floating_window_click"//悬浮窗播放区域点击 事件
}
}
\ No newline at end of file
...@@ -21,10 +21,12 @@ import androidx.core.app.NotificationCompat ...@@ -21,10 +21,12 @@ import androidx.core.app.NotificationCompat
import androidx.lifecycle.LifecycleService import androidx.lifecycle.LifecycleService
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.ydl.ydlcommon.data.http.ThrowableConsumer import com.ydl.ydlcommon.data.http.ThrowableConsumer
import com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import com.yidianling.home.http.MuseHttp import com.yidianling.home.http.MuseHttp
import com.yidianling.muse.R import com.yidianling.muse.R
import com.yidianling.muse.activity.PlayMeditationActivity import com.yidianling.muse.activity.PlayMeditationActivity
import com.yidianling.muse.bean.MeditationPlayModuleBean import com.yidianling.muse.bean.MeditationPlayModuleBean
import com.yidianling.muse.constants.MuseBIConstants
import com.yidianling.muse.event.MeditationFloatEvent import com.yidianling.muse.event.MeditationFloatEvent
import com.yidianling.muse.helper.MediaPlayerManager import com.yidianling.muse.helper.MediaPlayerManager
import de.greenrobot.event.EventBus import de.greenrobot.event.EventBus
...@@ -117,6 +119,9 @@ class MeditationWindowService : LifecycleService() { ...@@ -117,6 +119,9 @@ class MeditationWindowService : LifecycleService() {
private fun updateFloatView(meditation: MeditationPlayModuleBean.MeditationDetail) { private fun updateFloatView(meditation: MeditationPlayModuleBean.MeditationDetail) {
mMediaPlayer = MediaPlayerManager.getInstance(this)?.getMediaPlayer() mMediaPlayer = MediaPlayerManager.getInstance(this)?.getMediaPlayer()
floatRootView?.setOnClickListener { floatRootView?.setOnClickListener {
//悬浮窗暂停点击事件
ActionCountUtils.count(MuseBIConstants.YDL_MUSE_MEDITATION_WINDOW_CLICK,"")
val intent = Intent(this, PlayMeditationActivity::class.java) val intent = Intent(this, PlayMeditationActivity::class.java)
intent.putExtra("MEDIA_ID", meditation.mediaId) intent.putExtra("MEDIA_ID", meditation.mediaId)
intent.putExtra("MEDITATION_ID", meditation.meditationId) intent.putExtra("MEDITATION_ID", meditation.meditationId)
...@@ -143,6 +148,9 @@ class MeditationWindowService : LifecycleService() { ...@@ -143,6 +148,9 @@ class MeditationWindowService : LifecycleService() {
ivPlayOrPause?.setOnClickListener { ivPlayOrPause?.setOnClickListener {
if (mMediaPlayer?.isPlaying == true) { if (mMediaPlayer?.isPlaying == true) {
//悬浮窗暂停点击事件
ActionCountUtils.count(MuseBIConstants.YDL_MUSE_MEDITATION_WINDOW_PAUSE_CLICK,"")
MediaPlayerManager.getInstance(this)?.pause() MediaPlayerManager.getInstance(this)?.pause()
if (meditation.meditationId != null && meditation.mediaId != null) { if (meditation.meditationId != null && meditation.mediaId != null) {
MuseHttp.getInstance().postMeditationPlayRecord( MuseHttp.getInstance().postMeditationPlayRecord(
...@@ -164,6 +172,8 @@ class MeditationWindowService : LifecycleService() { ...@@ -164,6 +172,8 @@ class MeditationWindowService : LifecycleService() {
}) })
} }
} else { } else {
//悬浮窗播放点击事件
ActionCountUtils.count(MuseBIConstants.YDL_MUSE_MEDITATION_WINDOW_PLAY_CLICK,"")
MediaPlayerManager.getInstance(this)?.play() MediaPlayerManager.getInstance(this)?.play()
} }
if (mMediaPlayer?.isPlaying == true) { if (mMediaPlayer?.isPlaying == true) {
...@@ -194,6 +204,9 @@ class MeditationWindowService : LifecycleService() { ...@@ -194,6 +204,9 @@ class MeditationWindowService : LifecycleService() {
} }
ivClose?.setOnClickListener { ivClose?.setOnClickListener {
//悬浮窗关闭点击事件
ActionCountUtils.count(MuseBIConstants.YDL_MUSE_MEDITATION_WINDOW_CLOSE_CLICK,"")
postPlayRecord( postPlayRecord(
1, (ivProgress?.curProcess?.div(1000.00))?.roundToInt() ?: 0, 1, (ivProgress?.curProcess?.div(1000.00))?.roundToInt() ?: 0,
0, 0,
......
...@@ -492,6 +492,7 @@ class MineFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener, View. ...@@ -492,6 +492,7 @@ class MineFragment : BaseFragment(), SwipeRefreshLayout.OnRefreshListener, View.
jtv_test?.postDelayed({ YdlBuryPointUtil.sendPv("PvEvent") }, 300) jtv_test?.postDelayed({ YdlBuryPointUtil.sendPv("PvEvent") }, 300)
jtv_test?.postDelayed({ YdlBuryPointUtil.sendClick("ClickEvent") }, 500) jtv_test?.postDelayed({ YdlBuryPointUtil.sendClick("ClickEvent") }, 500)
} else if (id == R.id.ll_meditation) { //冥想 } else if (id == R.id.ll_meditation) { //冥想
count(UserMyPageEvent.YDL_USER_MY_MIDDLE_TYPE_CLICK, "冥想")
val h5Params3 = H5Params(MH5_URL + "meditation?hideNavBar=1", null) val h5Params3 = H5Params(MH5_URL + "meditation?hideNavBar=1", null)
NewH5Activity.start(activity, h5Params3) 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