Commit 1968e851 authored by jyx's avatar jyx

Banner数据为空展示广告

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