打点事件更新
This commit is contained in:
parent
05499cddb4
commit
c7e66e2ab2
@ -21,12 +21,15 @@ class LaunchActivity : MoBaseActivity() {
|
||||
private const val MSG_PROGRESS = 0
|
||||
private const val MSG_LOAD_AD_LOADED = 1
|
||||
private const val MSG_LOAD_AD_FAIL = 2
|
||||
|
||||
const val FROM_TYPE = "STARTED_FROM_ON_ACTIVITY_STARTED_TYPE"
|
||||
}
|
||||
|
||||
private lateinit var binding: ActivityLaunchBinding
|
||||
private val mMaxLoading = 10000L//最大超时
|
||||
private var progress = 0f
|
||||
private val delayMillis = mMaxLoading / 100
|
||||
private var type = -1
|
||||
|
||||
private val handler = object : Handler(Looper.getMainLooper()) {
|
||||
override fun handleMessage(msg: Message) {
|
||||
@ -78,6 +81,8 @@ class LaunchActivity : MoBaseActivity() {
|
||||
override suspend fun main() {
|
||||
binding = ActivityLaunchBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
AnalysisUtil.logEvent(AnalysisUtil.LAUNCH_PV)
|
||||
type = intent.getIntExtra(FROM_TYPE, -1)
|
||||
loadAd()
|
||||
handler.sendEmptyMessageDelayed(MSG_PROGRESS, delayMillis)
|
||||
immersionBar {
|
||||
@ -88,12 +93,18 @@ class LaunchActivity : MoBaseActivity() {
|
||||
|
||||
private fun toMainActivity() {
|
||||
if (!withPermission()) {
|
||||
if (type == 1) {//如果type等于1,则是从后台进入的应用,不进行跳转直接关闭启动页
|
||||
finish()
|
||||
return
|
||||
}
|
||||
startActivity(Intent(this, MainActivity::class.java))
|
||||
} else {
|
||||
if (type == 1) {
|
||||
finish()
|
||||
return
|
||||
}
|
||||
startActivity(Intent(this, PrimaryActivity::class.java))
|
||||
}
|
||||
AnalysisUtil.logEvent(AnalysisUtil.LAUNCH_PV)
|
||||
finish()
|
||||
}
|
||||
|
||||
private fun loadAd() {
|
||||
|
||||
@ -88,6 +88,7 @@ class MoPlayDetailsActivity : MoBaseActivity(), Player.Listener {
|
||||
override suspend fun main() {
|
||||
binding = ActivityMoPlayDetailsBinding.inflate(layoutInflater)
|
||||
setContentView(binding.root)
|
||||
AnalysisUtil.logEvent(AnalysisUtil.PLAYER_B_PV)
|
||||
showAD()
|
||||
initImmersionBar()
|
||||
initClick()
|
||||
@ -754,8 +755,6 @@ class MoPlayDetailsActivity : MoBaseActivity(), Player.Listener {
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
meController?.removeListener(playerListener)
|
||||
|
||||
AnalysisUtil.logEvent(AnalysisUtil.PLAYER_B_PV)
|
||||
}
|
||||
|
||||
private fun updateProgressUi() {
|
||||
|
||||
@ -33,8 +33,6 @@ class RealHumanVoiceAdapter(
|
||||
val intent = Intent(context, PlayDetailsActivity::class.java);
|
||||
intent.putExtra(PlayDetailsActivity.KEY_DETAILS_AUDIO, audio)
|
||||
context.startActivity(intent)
|
||||
|
||||
AnalysisUtil.logEvent(AnalysisUtil.HOME_A_PV)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -69,9 +69,6 @@ class ResponsiveListAdapter(
|
||||
holder.bind(url, name, desc, videoId)
|
||||
|
||||
holder.itemView.setOnClickListener {
|
||||
//离开上报,那就跳走上报。
|
||||
AnalysisUtil.logEvent(AnalysisUtil.HOME_B_PV)
|
||||
|
||||
val intent = Intent(context, MoPlayDetailsActivity::class.java)
|
||||
intent.putExtra(MoPlayDetailsActivity.PLAY_DETAILS_VIDEO_ID, videoId)
|
||||
intent.putExtra(MoPlayDetailsActivity.PLAY_DETAILS_PLAY_LIST_ID, playlistId)
|
||||
|
||||
@ -35,8 +35,6 @@ class SoundsOfAppliancesAdapter(
|
||||
intent.putExtra(PlayDetailsActivity.KEY_DETAILS_AUDIO, audio)
|
||||
context.startActivity(intent)
|
||||
// mediaPlayer.setDataSource(this, Uri.parse("file:///android_asset/${audio.file}"))
|
||||
|
||||
AnalysisUtil.logEvent(AnalysisUtil.HOME_A_PV)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -35,8 +35,6 @@ class SoundsOfNatureAdapter(
|
||||
intent.putExtra(PlayDetailsActivity.KEY_DETAILS_AUDIO, audio)
|
||||
context.startActivity(intent)
|
||||
// mediaPlayer.setDataSource(this, Uri.parse("file:///android_asset/${audio.file}"))
|
||||
|
||||
AnalysisUtil.logEvent(AnalysisUtil.HOME_A_PV)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -70,8 +70,6 @@ class TowRowListAdapter(
|
||||
holder.bind(url = url, name = name, desc = desc)
|
||||
|
||||
holder.itemView.setOnClickListener {
|
||||
//离开上报,那就跳走上报。
|
||||
AnalysisUtil.logEvent(AnalysisUtil.HOME_B_PV)
|
||||
if (itemClickListener != null) {
|
||||
itemClickListener?.onItemClick(position)
|
||||
}
|
||||
|
||||
@ -74,6 +74,7 @@ class HomeFragment : Fragment() {
|
||||
@SuppressLint("NotifyDataSetChanged")
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
AnalysisUtil.logEvent(AnalysisUtil.HOME_A_PV)
|
||||
if (melody.offline.music.App.currentPlayingAudio != null) {
|
||||
if (melody.offline.music.App.realHumanVoiceList.isNotEmpty()) {
|
||||
for ((index, audio) in melody.offline.music.App.realHumanVoiceList.withIndex()) {
|
||||
@ -107,13 +108,10 @@ class HomeFragment : Fragment() {
|
||||
super.onHiddenChanged(hidden)
|
||||
if (!hidden) {
|
||||
initImmersionBar()
|
||||
|
||||
AnalysisUtil.logEvent(AnalysisUtil.HOME_A_PV)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
AnalysisUtil.logEvent(AnalysisUtil.HOME_A_PV)
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
|
||||
@ -15,7 +15,9 @@ import melody.offline.music.view.MusicTowRowListView
|
||||
import kotlinx.coroutines.channels.Channel
|
||||
import kotlinx.coroutines.isActive
|
||||
import kotlinx.coroutines.selects.select
|
||||
import melody.offline.music.ads.AnalysisAdState
|
||||
import melody.offline.music.util.AnalysisUtil
|
||||
import org.json.JSONObject
|
||||
|
||||
class MoHomeFragment : MoBaseFragment<FragmentMoHomeBinding>() {
|
||||
|
||||
@ -71,9 +73,9 @@ class MoHomeFragment : MoBaseFragment<FragmentMoHomeBinding>() {
|
||||
private suspend fun initData() {
|
||||
showLoadingUi()
|
||||
Innertube.homePage(appStore.myVisitorData)?.onSuccess {
|
||||
AnalysisUtil.logEvent(AnalysisUtil.HOME_B_MODULE_SHOW_SUCCESS_ACTION)
|
||||
showDataUi()
|
||||
if (it.homePage.isNotEmpty()) {
|
||||
AnalysisUtil.logEvent(AnalysisUtil.HOME_B_MODULE_SHOW_SUCCESS_ACTION)
|
||||
for (home: Innertube.HomePage in it.homePage) {
|
||||
for (content: MusicCarouselShelfRenderer.Content in home.contents) {
|
||||
if (content.musicResponsiveListItemRenderer != null) {
|
||||
@ -99,11 +101,11 @@ class MoHomeFragment : MoBaseFragment<FragmentMoHomeBinding>() {
|
||||
initHomeDataMore(it)
|
||||
} else {
|
||||
LogD(TAG, "homePage size 0")
|
||||
showNoContentUi()
|
||||
showNoContentUi("homePage size 0")
|
||||
}
|
||||
}?.onFailure {
|
||||
showNoContentUi()
|
||||
LogD(TAG, "homePage onFailure->${it}")
|
||||
showNoContentUi(it.message.toString())
|
||||
}
|
||||
}
|
||||
|
||||
@ -152,21 +154,17 @@ class MoHomeFragment : MoBaseFragment<FragmentMoHomeBinding>() {
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
initImmersionBar()
|
||||
AnalysisUtil.logEvent(AnalysisUtil.HOME_B_PV)
|
||||
}
|
||||
|
||||
override fun onHiddenChanged(hidden: Boolean) {
|
||||
super.onHiddenChanged(hidden)
|
||||
if (!hidden) {
|
||||
initImmersionBar()
|
||||
} else {
|
||||
//离开上报,那就隐藏上报。
|
||||
AnalysisUtil.logEvent(AnalysisUtil.HOME_B_PV)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
//离开上报
|
||||
AnalysisUtil.logEvent(AnalysisUtil.HOME_B_PV)
|
||||
super.onDestroy()
|
||||
}
|
||||
|
||||
@ -180,7 +178,12 @@ class MoHomeFragment : MoBaseFragment<FragmentMoHomeBinding>() {
|
||||
binding.noContentLayout.visibility = View.GONE
|
||||
}
|
||||
|
||||
private fun showNoContentUi() {
|
||||
private fun showNoContentUi(string: String) {
|
||||
val jsonObject = JSONObject()
|
||||
jsonObject.put("fail", string)
|
||||
val map = mutableMapOf(Pair(AnalysisUtil.PARAM_VALUE, jsonObject.toString()))
|
||||
AnalysisUtil.logEvent(AnalysisUtil.HOME_B_MODULE_SHOW_FAIL_ACTION, map)
|
||||
|
||||
binding.loadingLayout.visibility = View.GONE
|
||||
binding.noContentLayout.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
@ -65,14 +65,12 @@ class MoMeFragment : MoBaseFragment<FragmentMoMeBinding>() {
|
||||
val intent = Intent(requireActivity(), SettingsActivity::class.java)
|
||||
intent.putExtra(SettingsActivity.FROM_TO_SETTING, MoMeFragment::class.java)
|
||||
startActivity(intent)
|
||||
AnalysisUtil.logEvent(AnalysisUtil.ME_B_PV)
|
||||
}
|
||||
binding.likedSongsBtn.setOnClickListener {
|
||||
val count = binding.likedSongsTv.text.toString().trim().toInt()
|
||||
if (count > 0) {
|
||||
val intent = Intent(context, MoLikedSongsActivity::class.java)
|
||||
startActivity(intent)
|
||||
AnalysisUtil.logEvent(AnalysisUtil.ME_B_PV)
|
||||
} else {
|
||||
Toast.makeText(
|
||||
activity, getString(R.string.liked_songs_no_data_prompt), Toast.LENGTH_LONG
|
||||
@ -84,7 +82,6 @@ class MoMeFragment : MoBaseFragment<FragmentMoMeBinding>() {
|
||||
if (count > 0) {
|
||||
val intent = Intent(context, MoOfflineSongsActivity::class.java)
|
||||
startActivity(intent)
|
||||
AnalysisUtil.logEvent(AnalysisUtil.ME_B_PV)
|
||||
} else {
|
||||
Toast.makeText(
|
||||
activity, getString(R.string.offline_songs_no_data_prompt), Toast.LENGTH_LONG
|
||||
@ -108,7 +105,7 @@ class MoMeFragment : MoBaseFragment<FragmentMoMeBinding>() {
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
initImmersionBar()
|
||||
|
||||
AnalysisUtil.logEvent(AnalysisUtil.ME_B_PV)
|
||||
LolAdWrapper.shared.loadAdShowNativeAd(
|
||||
requireActivity(),
|
||||
AdPlacement.NATIVE_ME_PAGE_LIST,
|
||||
@ -122,8 +119,6 @@ class MoMeFragment : MoBaseFragment<FragmentMoMeBinding>() {
|
||||
super.onHiddenChanged(hidden)
|
||||
if (!hidden) {
|
||||
initImmersionBar()
|
||||
} else {
|
||||
AnalysisUtil.logEvent(AnalysisUtil.ME_B_PV)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -81,6 +81,7 @@ class SearchFragment : MoBaseFragment<FragmentSearchBinding>(), TextWatcher,
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
AnalysisUtil.logEvent(AnalysisUtil.SEARCH_PV)
|
||||
LolAdWrapper.shared.loadAdShowNativeAd(
|
||||
requireActivity(),
|
||||
AdPlacement.NATIVE_SEARCH,
|
||||
@ -179,6 +180,7 @@ class SearchFragment : MoBaseFragment<FragmentSearchBinding>(), TextWatcher,
|
||||
}
|
||||
|
||||
is Request.SearchData -> {
|
||||
AnalysisUtil.logEvent(AnalysisUtil.SEARCH_TRIGGER)
|
||||
LolAdWrapper.shared.showAdTiming(
|
||||
requireActivity(), AdPlacement.INST_SEARCH
|
||||
)
|
||||
@ -239,9 +241,6 @@ class SearchFragment : MoBaseFragment<FragmentSearchBinding>(), TextWatcher,
|
||||
binding.searchEdit.clearFocus()
|
||||
binding.searchEdit.text.clear()
|
||||
binding.contentLayout.removeAllViews()
|
||||
|
||||
//隐藏上报
|
||||
AnalysisUtil.logEvent(AnalysisUtil.SEARCH_PV)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -17,6 +17,7 @@ object AnalysisUtil {
|
||||
const val HOME_A_PV = "home_a_pv"//A面首页曝光
|
||||
const val HOME_B_PV = "home_b_pv"//B面首页曝光
|
||||
const val HOME_B_MODULE_SHOW_SUCCESS_ACTION = "home_b_module_show_success_action"//首页资源曝光成功
|
||||
const val HOME_B_MODULE_SHOW_FAIL_ACTION = "home_b_module_show_fail_action"//首页资源曝光失败
|
||||
const val HOME_B_MODULE_CLICK = "home_b_module_click"//点击首页模块
|
||||
const val ME_B_PV = "me_b_pv"//B面我的曝光
|
||||
const val PLAYER_B_PV = "player_b_pv"//B面播放器曝光
|
||||
@ -31,6 +32,7 @@ object AnalysisUtil {
|
||||
const val SEARCH_SUG_CLICK = "search_sug_click"//点击sug结果
|
||||
const val SEARCH_RESULT_PV = "search_result_pv"//搜索结果曝光
|
||||
const val SEARCH_RESULT_SUCCESS_ACTION = "search_result_success_action"//搜索有结果
|
||||
const val SEARCH_TRIGGER = "search_trigger "//触发搜索
|
||||
|
||||
|
||||
private const val AD_INST_SPLASH_SUCCESS = "ad_user_open_success"//首页开屏广告展示成功
|
||||
|
||||
@ -13,7 +13,8 @@ import melody.offline.music.activity.LaunchActivity
|
||||
*
|
||||
* @param application 应用程序实例。
|
||||
*/
|
||||
class AppLifecycleHandler(private val application: Application) : Application.ActivityLifecycleCallbacks {
|
||||
class AppLifecycleHandler(private val application: Application) :
|
||||
Application.ActivityLifecycleCallbacks {
|
||||
|
||||
private var activityReferences = 0
|
||||
private var isActivityChangingConfigurations = false
|
||||
@ -34,6 +35,7 @@ class AppLifecycleHandler(private val application: Application) : Application.Ac
|
||||
//间隔时间是否满足,当前不是启动页,当前不是广告show
|
||||
if (currentTime - lastPausedTime > intervalTime && activity !is LaunchActivity && !isAdShowing) {
|
||||
val intent = Intent(activity, LaunchActivity::class.java)
|
||||
intent.putExtra(LaunchActivity.FROM_TYPE, 1)
|
||||
activity.startActivity(intent)
|
||||
}
|
||||
}
|
||||
|
||||
@ -81,24 +81,6 @@ class MusicPlayerView(
|
||||
}
|
||||
}
|
||||
goDetailsBtn.setOnClickListener {
|
||||
when (context) {
|
||||
is PrimaryActivity -> {
|
||||
when (context.getCurrentFragment()) {
|
||||
is MoHomeFragment -> {
|
||||
AnalysisUtil.logEvent(AnalysisUtil.HOME_B_PV)
|
||||
}
|
||||
|
||||
is SearchFragment -> {
|
||||
AnalysisUtil.logEvent(AnalysisUtil.SEARCH_PV)
|
||||
}
|
||||
|
||||
is MoMeFragment -> {
|
||||
AnalysisUtil.logEvent(AnalysisUtil.ME_B_PV)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val intent = Intent(context, MoPlayDetailsActivity::class.java)
|
||||
intent.putExtra(
|
||||
MoPlayDetailsActivity.PLAY_DETAILS_COME_FROM,
|
||||
|
||||
@ -38,7 +38,6 @@ class SearchResultOptimalView(context: Context, data: Innertube.SearchDataPage)
|
||||
|
||||
val playBtn = contentView?.findViewById<LinearLayout>(R.id.playBtn)
|
||||
playBtn?.setOnClickListener {
|
||||
AnalysisUtil.logEvent(AnalysisUtil.SEARCH_PV)
|
||||
if (optimalBean != null) {
|
||||
if (!optimalBean.videoId.isNullOrEmpty()) {
|
||||
val intent = Intent(context, MoPlayDetailsActivity::class.java)
|
||||
|
||||
@ -23,7 +23,6 @@ class SearchResultOtherView(context: Context, data: Innertube.SearchDataPage) :
|
||||
|
||||
val moreBtn = contentView?.findViewById<LinearLayout>(R.id.moreBtn)
|
||||
moreBtn?.setOnClickListener {
|
||||
AnalysisUtil.logEvent(AnalysisUtil.SEARCH_PV)
|
||||
val intent = Intent(context, MoSearchMoreActivity::class.java)
|
||||
intent.putExtra(MoSearchMoreActivity.SEARCH_MORE_QUERY, data.query)
|
||||
intent.putExtra(MoSearchMoreActivity.SEARCH_MORE_PARAMS, data.params)
|
||||
@ -32,11 +31,6 @@ class SearchResultOtherView(context: Context, data: Innertube.SearchDataPage) :
|
||||
|
||||
val rv = contentView?.findViewById<RecyclerView>(R.id.rv)
|
||||
val adapter = SearchResultOtherAdapter(context, data.searchResultList)
|
||||
adapter.setOnItemClickListener(object :SearchResultOtherAdapter.OnItemClickListener{
|
||||
override fun onItemClick(position: Int) {
|
||||
AnalysisUtil.logEvent(AnalysisUtil.SEARCH_PV)
|
||||
}
|
||||
})
|
||||
rv?.layoutManager = LinearLayoutManager(context, LinearLayoutManager.VERTICAL, false)
|
||||
rv?.adapter = adapter
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user