...
|
...
|
@@ -36,18 +36,150 @@ import com.youth.banner.indicator.CircleIndicator |
|
|
* auth:张继
|
|
|
* des:
|
|
|
*/
|
|
|
class HomeFragment : BaseLifeCycleFragment<MineViewModel,FragmentHomeBinding>(FragmentHomeBinding::inflate){
|
|
|
class HomeFragment :
|
|
|
BaseLifeCycleFragment<MineViewModel, FragmentHomeBinding>(FragmentHomeBinding::inflate) {
|
|
|
override fun initDataObserver() {
|
|
|
|
|
|
}
|
|
|
|
|
|
// override fun initImmersionBar() {
|
|
|
// ImmersionBar.with(this).statusBarColor(R.color.color_25).statusBarDarkFont(true).init()
|
|
|
// }
|
|
|
//
|
|
|
// override fun immersionBarEnabled(): Boolean {
|
|
|
// return true
|
|
|
// }
|
|
|
override fun initData() {
|
|
|
super.initData()
|
|
|
binding.apply {
|
|
|
//搜索
|
|
|
search.setOnClickListener {
|
|
|
startActivity(SearchActivity::class.java)
|
|
|
}
|
|
|
banner.setAdapter(object : BannerImageAdapter<Int>(
|
|
|
mutableListOf(
|
|
|
R.mipmap.banner,
|
|
|
R.mipmap.banner,
|
|
|
R.mipmap.banner
|
|
|
)
|
|
|
) {
|
|
|
override fun onBindView(
|
|
|
holder: BannerImageHolder,
|
|
|
data: Int,
|
|
|
position: Int,
|
|
|
size: Int
|
|
|
) {
|
|
|
Glide.with(requireActivity())
|
|
|
.load(data)
|
|
|
.apply(RequestOptions.bitmapTransform(RoundedCorners(8)))
|
|
|
.into(holder.imageView)
|
|
|
|
|
|
}
|
|
|
}).addBannerLifecycleObserver(requireActivity())
|
|
|
.indicator = CircleIndicator(requireContext())
|
|
|
|
|
|
|
|
|
// 共享资料库
|
|
|
database.setOnClickListener {
|
|
|
startActivity(DatabaseActivity::class.java)
|
|
|
}
|
|
|
|
|
|
// 共享资料库
|
|
|
txtCourse.setOnClickListener {
|
|
|
startActivity(TextCourseActivity::class.java)
|
|
|
}
|
|
|
// 在线课程
|
|
|
onlineCourse.setOnClickListener {
|
|
|
startActivity(OnlineActivity::class.java)
|
|
|
}
|
|
|
|
|
|
// 视频课程
|
|
|
videoCourse.addItemDecoration(object : RecyclerView.ItemDecoration() {
|
|
|
override fun getItemOffsets(
|
|
|
outRect: Rect,
|
|
|
view: View,
|
|
|
parent: RecyclerView,
|
|
|
state: RecyclerView.State
|
|
|
) {
|
|
|
super.getItemOffsets(outRect, view, parent, state)
|
|
|
if (parent.getChildAdapterPosition(view) % 2 == 0) {
|
|
|
outRect.top = 24
|
|
|
outRect.right = 15
|
|
|
} else {
|
|
|
outRect.top = 24
|
|
|
outRect.left = 15
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
val videoCourseAdapter = VideoCourseAdapter()
|
|
|
val list = mutableListOf(
|
|
|
VideoCourse(R.mipmap.banner, "10课时", "自动化制作课程", "", "张钧-三岗职位培训班"),
|
|
|
VideoCourse(R.mipmap.banner, "10课时", "自动化制作课程", "", "张钧-三岗职位培训班"),
|
|
|
VideoCourse(R.mipmap.banner, "10课时", "自动化制作课程", "", "张钧-三岗职位培训班"),
|
|
|
VideoCourse(R.mipmap.banner, "10课时", "自动化制作课程", "", "张钧-三岗职位培训班"),
|
|
|
)
|
|
|
videoCourse.adapter = videoCourseAdapter
|
|
|
videoCourseAdapter.addList(list)
|
|
|
|
|
|
val recommendDataAdapter = RecommendDataAdapter()
|
|
|
val recommendList = mutableListOf(
|
|
|
RecommendData(
|
|
|
R.mipmap.banner,
|
|
|
"思维导图高分作文法(高中)议论",
|
|
|
"从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"
|
|
|
),
|
|
|
RecommendData(
|
|
|
R.mipmap.banner,
|
|
|
"思维导图高分作文法(高中)议论",
|
|
|
"从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"
|
|
|
),
|
|
|
RecommendData(
|
|
|
R.mipmap.banner,
|
|
|
"思维导图高分作文法(高中)议论",
|
|
|
"从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"
|
|
|
),
|
|
|
RecommendData(
|
|
|
R.mipmap.banner,
|
|
|
"思维导图高分作文法(高中)议论",
|
|
|
"从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"
|
|
|
),
|
|
|
RecommendData(
|
|
|
R.mipmap.banner,
|
|
|
"思维导图高分作文法(高中)议论",
|
|
|
"从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"
|
|
|
),
|
|
|
RecommendData(
|
|
|
R.mipmap.banner,
|
|
|
"思维导图高分作文法(高中)议论",
|
|
|
"从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"
|
|
|
),
|
|
|
RecommendData(
|
|
|
R.mipmap.banner,
|
|
|
"思维导图高分作文法(高中)议论",
|
|
|
"从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"
|
|
|
),
|
|
|
RecommendData(
|
|
|
R.mipmap.banner,
|
|
|
"思维导图高分作文法(高中)议论",
|
|
|
"从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"
|
|
|
),
|
|
|
RecommendData(
|
|
|
R.mipmap.banner,
|
|
|
"思维导图高分作文法(高中)议论",
|
|
|
"从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"
|
|
|
),
|
|
|
RecommendData(
|
|
|
R.mipmap.banner,
|
|
|
"思维导图高分作文法(高中)议论",
|
|
|
"从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"
|
|
|
),
|
|
|
RecommendData(
|
|
|
R.mipmap.banner,
|
|
|
"思维导图高分作文法(高中)议论",
|
|
|
"从这个角度看,康得在不经意间这样说过,既然我已踏上了这条道路,那么"
|
|
|
),
|
|
|
)
|
|
|
recommendedData.adapter = recommendDataAdapter
|
|
|
recommendDataAdapter.addList(recommendList)
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
//class HomeFragment : Fragment() {
|
...
|
...
|
|