class SyFragment :BaseFragment() {
override fun initData() {
recyclerView_hot.layoutManager=LinearLayoutManager(context,LinearLayoutManager.HORIZONTAL,false)
recyclerView_net.layoutManager=GridLayoutManager(context,2)
runBlocking {
val bannerBean=async { HttpUtils.apiService.getBanner()}
xBanner_id.setBannerData(R.layout.banner,bannerBean.await().banner)
xBanner_id.loadImage { banner, model, view, position ->
(view as SimpleDraweeView).setImageURI((model as Banner).image)
}
val syHotData=async { HttpUtils.apiService.getVipHot() }
recyclerView_hot.adapter=SyHotAdapter(syHotData.await().viphot)
val syNewData=async { HttpUtils.apiService.getVipNew() }
recyclerView_net.adapter=SyNewAdapter(syNewData.await().shops)
}
}
override fun setLayoutId()=R.layout.fragment_sy
}```
Kotlin的fragment的java类
最新推荐文章于 2024-03-26 09:56:15 发布