本基础框架抽离于已上线项目KoalaVpn
效果图如下:
- 内置本人多年总结完善的通用标题头,无侵入式页面布局,动态注入方式,有多个重载方法,及其容易定制和方便使用,例如项目LineListActivity界面演示的例子,完全不需要在xml布局里面写标题头(只是暂时就得舍弃dataBinding了),支持直接注入动态View或Xml,更多详细例子可点击去之前的android框架项目查看
stephenCommonTopTitleView = StephenCommonTopTitleView(this)
stephenCommonTopTitleView.run {
setTitleBgColor(ResourcesCompat.getColor(resources, R.color.white, null))
setTitleLeftIcon(R.drawable.icon_back_btn, getTitleLeftLp(25, 25, 15))
setTitleCenterText(getString(R.string.title_line_list), 18, "#FF212121", false)
setTitleLeftClickListener(View.OnClickListener { backBtnClickResponse() })
}
- 内置本人多年总结完善的通用无数据提示,无侵入式页面布局,动态注入方式,有多个重载方法,及其容易定制和方便使用,例如项目演示的例子
val stephenCommonNoDataView = StephenCommonNoDataView(this)
stephenCommonNoDataView.run {
setMainNoDataBgColorVal(ResourcesCompat.getColor(resources, R.color.white, null))
setMainContainerBgColorVal(ResourcesCompat.getColor(resources, R.color.white, null))
setCenterTextViewStr(getString(R.string.line_load_fail_title), arrayOf(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.CENTER_HORIZONTAL),
25, 25, 100, -1)
setCenterTextSizeSpAndColorVal(16, Color.parseColor("#666666"))
setCenterText2ViewStr(getString(R.string.line_load_fail_desc), 7)
setCenterText2SizeSpAndColorVal(14, Color.parseColor("#B2B2B2"))
}
- 通用标题头可和通用无数据提示搭配使用,完美,例如项目演示的例子
override fun getLayoutView(): View? {
stephenCommonTopTitleView = StephenCommonTopTitleView(this)
stephenCommonTopTitleView.run {
setTitleBgColor(ResourcesCompat.getColor(resources, R.color.white, null))
setTitleLeftIcon(R.drawable.icon_back_btn, getTitleLeftLp(25, 25, 15))
setTitleCenterText(getString(R.string.title_line_list), 18, "#FF212121", false)
setTitleLeftClickListener(View.OnClickListener { backBtnClickResponse() })
}
val stephenCommonNoDataView = StephenCommonNoDataView(this)
stephenCommonNoDataView.run {
setMainNoDataBgColorVal(ResourcesCompat.getColor(resources, R.color.white, null))
setMainContainerBgColorVal(ResourcesCompat.getColor(resources, R.color.white, null))
setCenterTextViewStr(getString(R.string.line_load_fail_title), arrayOf(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.CENTER_HORIZONTAL),
25, 25, 100, -1)
setCenterTextSizeSpAndColorVal(16, Color.parseColor("#666666"))
setCenterText2ViewStr(getString(R.string.line_load_fail_desc), 7)
setCenterText2SizeSpAndColorVal(14, Color.parseColor("#B2B2B2"))
}
stephenCommonNoDataTool = StephenCommonNoDataTool(this, stephenCommonNoDataView, globalBottomBtnClickListener = View.OnClickListener {
initData()
})
val mainLy = LinearLayout(this)
mainLy.orientation = LinearLayout.VERTICAL
mSectionLayout = QMUIStickySectionLayout(this)
mSectionLayout.id = ToolUtils.instance.generateViewId()
mSectionLayout.setLayoutManager(object : LinearLayoutManager(this) {
override fun generateDefaultLayoutParams(): RecyclerView.LayoutParams {
return RecyclerView.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)
}
})
mainLy.addView(mSectionLayout, LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0, 1f))
mAdViewLy = LinearLayout(this)
mAdViewLy.orientation = LinearLayout.VERTICAL
mainLy.addView(mAdViewLy, LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT))
return stephenCommonTopTitleView.injectCommTitleViewToAllViewReturnView(stephenCommonNoDataView.initAndInjectNoDataViewForAllView(mainLy))
}