Commit fb3732b2 authored by jyx's avatar jyx

Banner显示错误问题修复

parent 8618525c
...@@ -11,6 +11,7 @@ import com.mints.goodmoney.manager.UserManager ...@@ -11,6 +11,7 @@ import com.mints.goodmoney.manager.UserManager
import com.mints.goodmoney.mvp.model.* import com.mints.goodmoney.mvp.model.*
import com.mints.goodmoney.mvp.views.MyView import com.mints.goodmoney.mvp.views.MyView
import com.mints.goodmoney.utils.DeviceUuidFactory import com.mints.goodmoney.utils.DeviceUuidFactory
import com.mints.goodmoney.utils.LogUtil
import com.mints.library.net.neterror.BaseSubscriber import com.mints.library.net.neterror.BaseSubscriber
import com.mints.library.net.neterror.Throwable import com.mints.library.net.neterror.Throwable
import java.util.* import java.util.*
......
package com.mints.goodmoney.mvp.views package com.mints.goodmoney.mvp.views
import com.google.gson.JsonObject
import com.mints.goodmoney.mvp.model.* import com.mints.goodmoney.mvp.model.*
......
...@@ -163,9 +163,7 @@ class MyFragment : BaseFragment(), ...@@ -163,9 +163,7 @@ class MyFragment : BaseFragment(),
myPresenter.userLogin() myPresenter.userLogin()
} }
if (banner_view.visibility == View.VISIBLE) { banner_view.startAutoScroll()
banner_view.startAutoScroll()
}
// 刷新喜马拉雅信息流 // 刷新喜马拉雅信息流
TTPreLoadExpressXmlyManager.getInstance().loadTtFrameLayout() TTPreLoadExpressXmlyManager.getInstance().loadTtFrameLayout()
...@@ -361,18 +359,24 @@ class MyFragment : BaseFragment(), ...@@ -361,18 +359,24 @@ class MyFragment : BaseFragment(),
mBannerData = data mBannerData = data
if (mBannerData?.list == null || mBannerData?.list!!.size == 0) { if (mBannerData?.list == null || mBannerData?.list!!.size == 0) {
mAdBannerAdapter = null
fl_my_banner.visibility = View.VISIBLE fl_my_banner.visibility = View.VISIBLE
LogUtil.d("TAG", "getMyRotationChartSuc") LogUtil.d("TAG", "getMyRotationChartSuc")
banner_view.visibility = View.GONE banner_view.visibility = View.GONE
BannerManager.getTtBanner(TtCsjAdManager.TT_AD_BANNER_MY, fl_my_banner) BannerManager.getTtBanner(TtCsjAdManager.TT_AD_BANNER_MY, fl_my_banner)
} else { } else {
fl_my_banner.visibility = View.GONE fl_my_banner.visibility = View.GONE
banner_view.visibility = View.VISIBLE banner_view.visibility = View.VISIBLE
mAdBannerAdapter = AdBannerAdapter(activity) mAdBannerAdapter = AdBannerAdapter(activity)
mAdBannerAdapter?.let { mAdBannerAdapter?.let {
val list: MutableList<RotationChartBean.ListBean?> = mutableListOf()
list.addAll(mBannerData?.list!!)
list.add(data.position, null)
it.setOnPageClickListener(this) it.setOnPageClickListener(this)
it.setData(mBannerData?.list) it.setData(list)
it.setAdPosition(data.position) it.setAdPosition(data.position)
banner_view.setAdapter(it) banner_view.setAdapter(it)
} }
......
...@@ -289,7 +289,7 @@ public class BannerView extends FrameLayout { ...@@ -289,7 +289,7 @@ public class BannerView extends FrameLayout {
* 开启自动轮播 * 开启自动轮播
*/ */
public void startAutoScroll() { public void startAutoScroll() {
if (mScrollTask == null) return; if (mScrollTask == null || getVisibility() == View.GONE) return;
mScrollTask.start(); mScrollTask.start();
setAnimationScroll((int) mAnimDuration); setAnimationScroll((int) mAnimDuration);
} }
...@@ -298,7 +298,7 @@ public class BannerView extends FrameLayout { ...@@ -298,7 +298,7 @@ public class BannerView extends FrameLayout {
* 停止自动轮播 * 停止自动轮播
*/ */
public void stopAutoScroll() { public void stopAutoScroll() {
if (mScrollTask == null) return; if (mScrollTask == null || getVisibility() == View.GONE) return;
mScrollTask.stop(); mScrollTask.stop();
} }
......
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