Commit 1968e851 authored by jyx's avatar jyx

Banner数据为空展示广告

parent ce9c13db
...@@ -32,12 +32,12 @@ object BannerManager { ...@@ -32,12 +32,12 @@ object BannerManager {
val displayMetrics = MintsApplication.getContext().resources.displayMetrics val displayMetrics = MintsApplication.getContext().resources.displayMetrics
val density = displayMetrics.density val density = displayMetrics.density
// 屏幕宽度 - margin宽度 // 屏幕宽度 - margin宽度
val pxWidth = displayMetrics.widthPixels - (20 * density + 0.5f) val pxWidth = displayMetrics.widthPixels - (10 * density + 0.5f)
return pxWidth / density + 0.5f return pxWidth / density + 0.5f
} }
private fun getViewHeight(): Float { private fun getViewHeight(): Float {
var pxHeight = BubbleUtils.dp2px(150) var pxHeight = BubbleUtils.dp2px(120)
return pxHeight.toFloat() return pxHeight.toFloat()
} }
......
...@@ -359,19 +359,23 @@ class MyFragment : BaseFragment(), ...@@ -359,19 +359,23 @@ class MyFragment : BaseFragment(),
*/ */
override fun getMyRotationChartSuc(data: RotationChartBean) { override fun getMyRotationChartSuc(data: RotationChartBean) {
mBannerData = data mBannerData = data
if (data.isShow) { banner_view.visibility = View.VISIBLE
banner_view.visibility = View.VISIBLE mAdBannerAdapter = AdBannerAdapter(activity)
mAdBannerAdapter = AdBannerAdapter(activity) mAdBannerAdapter?.setOnPageClickListener(this)
mAdBannerAdapter?.setOnPageClickListener(this) mAdBannerAdapter?.let {
mAdBannerAdapter?.let { val list = mutableListOf<RotationChartBean.ListBean?>()
val list = mBannerData?.list if (mBannerData?.list != null || mBannerData?.list!!.size == 0) {
list?.add(data.position, null) list.addAll(it.mDatas)
it.setData(list) banner_view.stopAutoScroll()
it.setAdPosition(data.position) } else {
banner_view.startAutoScroll()
} }
banner_view.setAdapter(mAdBannerAdapter) list.add(data.position, null)
}
it.setData(list)
it.setAdPosition(data.position)
}
banner_view.setAdapter(mAdBannerAdapter)
} }
override fun onRefresh(refreshLayout: RefreshLayout) { override fun onRefresh(refreshLayout: RefreshLayout) {
......
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