Commit ce9c13db authored by mengcuiguang's avatar mengcuiguang

代码优化

parent 907cc3f4
......@@ -44,7 +44,7 @@ public abstract class BannerBaseAdapter<T> extends PagerAdapter {
// return mDatas == null || mDatas.size() == 0 ? 0 : mDatas.size();
// }
public int getCount() {
return mDatas == null || mDatas.size() == 0 ? 0 :Integer.MAX_VALUE;
return mDatas == null || mDatas.size() == 0 ? 0 : Integer.MAX_VALUE;
}
@Override
......@@ -177,9 +177,15 @@ public abstract class BannerBaseAdapter<T> extends PagerAdapter {
}
public void setBannerView(BannerView bannerView) {
this.mBannerView = bannerView;
}
public void setIndex() {
mBannerView.setCurrentIndex(0);
}
/**
* 条目页面的触摸事件
*/
......
......@@ -34,7 +34,10 @@ import com.mints.goodmoney.mvp.presenters.MyPresenter
import com.mints.goodmoney.mvp.views.MyView
import com.mints.goodmoney.service.AppInstallService
import com.mints.goodmoney.ui.activitys.*
import com.mints.goodmoney.ui.adapter.*
import com.mints.goodmoney.ui.adapter.AdBannerAdapter
import com.mints.goodmoney.ui.adapter.GvMyAdapter
import com.mints.goodmoney.ui.adapter.MainMyAdapter
import com.mints.goodmoney.ui.adapter.ViewPagerAdapter
import com.mints.goodmoney.ui.adapter.listener.OnItemChildClickListener
import com.mints.goodmoney.ui.fragment.base.BaseFragment
import com.mints.goodmoney.ui.widgets.ShareDialog
......@@ -127,14 +130,8 @@ class MyFragment : BaseFragment(),
initManager()
initView()
initRecy()
initBanner()
}
private fun initBanner() {
mAdBannerAdapter = AdBannerAdapter(activity)
mAdBannerAdapter?.setOnPageClickListener(this)
banner_view.setAdapter(mAdBannerAdapter)
}
override fun onHiddenChanged(hidden: Boolean) {
if (hidden) { // 不在最前端界面显示
......@@ -147,6 +144,9 @@ class MyFragment : BaseFragment(),
override fun onPause() {
super.onPause()
banner_view.stopAutoScroll()
item_clock_signview.stopRedbox()
}
......@@ -166,9 +166,7 @@ class MyFragment : BaseFragment(),
myPresenter.myRotationChart()
// 防止banner刷新太快
// if (AntiShake.check(fl_my_banner?.id)) return
// BannerManager.getTtBanner(TtCsjAdManager.TT_AD_BANNER_MY, fl_my_banner)
banner_view.startAutoScroll()
// 刷新喜马拉雅信息流
TTPreLoadExpressXmlyManager.getInstance().loadTtFrameLayout()
......@@ -360,15 +358,20 @@ class MyFragment : BaseFragment(),
* 设置Banner
*/
override fun getMyRotationChartSuc(data: RotationChartBean) {
banner_view.visibility = View.VISIBLE
mBannerData = data
mAdBannerAdapter?.let {
val list = mBannerData?.list
list?.add(data.position, null)
it.setData(list)
it.setAdPosition(data.position)
it.notifyDataSetChanged()
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)
it.setData(list)
it.setAdPosition(data.position)
}
banner_view.setAdapter(mAdBannerAdapter)
}
}
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