Commit 43da4807 authored by mengcuiguang's avatar mengcuiguang

优化banner点击

parent 7e38fad0
......@@ -1510,14 +1510,20 @@ class MyFragment : BaseFragment(),
*/
override fun onPageClick(position: Int) {
mBannerData?.let {
val pkg = it.list[position].pkg
if (!TextUtils.isEmpty(pkg) && AppUtil.checkPackInfo(activity!!, pkg)) {
// 广告不在最后banner展示时,需要position-1,否则加入穿山甲广告导致数据越界
var serverBannerPosition = position
if (it.list.size != it.position) {
serverBannerPosition = position - 1
}
val pkg = it.list[serverBannerPosition].pkg
if (!TextUtils.isEmpty(pkg) && AppUtil.checkPackInfo(requireActivity(), pkg)) {
AppTryPlayManager.toTryPlay(pkg)
} else {
//未安装
val bundle = Bundle()
bundle.putString(WebActivity.WEB_TITLE, it.list[position].title)
bundle.putString(WebActivity.WEB_URL, it.list[position].url)
bundle.putString(WebActivity.WEB_TITLE, it.list[serverBannerPosition].title)
bundle.putString(WebActivity.WEB_URL, it.list[serverBannerPosition].url)
readyGo(WebActivity::class.java, bundle)
}
}
......
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