Commit e6ac82fb authored by mengcuiguang's avatar mengcuiguang

优化banner轮播展示

parent fb3732b2
...@@ -163,8 +163,6 @@ class MyFragment : BaseFragment(), ...@@ -163,8 +163,6 @@ class MyFragment : BaseFragment(),
myPresenter.userLogin() myPresenter.userLogin()
} }
banner_view.startAutoScroll()
// 刷新喜马拉雅信息流 // 刷新喜马拉雅信息流
TTPreLoadExpressXmlyManager.getInstance().loadTtFrameLayout() TTPreLoadExpressXmlyManager.getInstance().loadTtFrameLayout()
} }
...@@ -364,6 +362,7 @@ class MyFragment : BaseFragment(), ...@@ -364,6 +362,7 @@ class MyFragment : BaseFragment(),
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
banner_view.stopAutoScroll()
BannerManager.getTtBanner(TtCsjAdManager.TT_AD_BANNER_MY, fl_my_banner) BannerManager.getTtBanner(TtCsjAdManager.TT_AD_BANNER_MY, fl_my_banner)
} else { } else {
...@@ -380,6 +379,7 @@ class MyFragment : BaseFragment(), ...@@ -380,6 +379,7 @@ class MyFragment : BaseFragment(),
it.setAdPosition(data.position) it.setAdPosition(data.position)
banner_view.setAdapter(it) banner_view.setAdapter(it)
} }
banner_view.startAutoScroll()
} }
} }
......
...@@ -64,8 +64,6 @@ public class BannerView extends FrameLayout { ...@@ -64,8 +64,6 @@ public class BannerView extends FrameLayout {
private boolean isAnimScroll; private boolean isAnimScroll;
private boolean isAutoScroll; private boolean isAutoScroll;
private boolean isStopScroll = false;
private View mRootView; private View mRootView;
private Handler mHandler = new Handler(Looper.getMainLooper()); private Handler mHandler = new Handler(Looper.getMainLooper());
private AutoScrollTask mScrollTask; private AutoScrollTask mScrollTask;
...@@ -173,16 +171,12 @@ public class BannerView extends FrameLayout { ...@@ -173,16 +171,12 @@ public class BannerView extends FrameLayout {
} }
} }
// 一直给自己发消息 // 一直给自己发消息
if (!isStopScroll) {
mHandler.postDelayed(this, mScrollDuration); mHandler.postDelayed(this, mScrollDuration);
} }
}
void start() { void start() {
if (!isStopScroll) {
mHandler.removeCallbacks(this); mHandler.removeCallbacks(this);
mHandler.postDelayed(this, mScrollDuration); mHandler.postDelayed(this, mScrollDuration);
}
} }
...@@ -369,8 +363,4 @@ public class BannerView extends FrameLayout { ...@@ -369,8 +363,4 @@ public class BannerView extends FrameLayout {
mViewPager.setCurrentItem(position); mViewPager.setCurrentItem(position);
} }
public void setStopScroll(boolean stopScroll) {
isStopScroll = stopScroll;
}
} }
include ':demo'
include ':app' include ':app'
include ':shareSdkLib' include ':shareSdkLib'
\ No newline at end of file
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