Commit ef4cbfd7 by konghaorui

Merge branch 'feature/v3' of…

Merge branch 'feature/v3' of ssh://gitlab.yidianling.com:2224/app_android_lib/YDL-Component into feature/v3
parents 84adfd85 50afbf70
...@@ -44,7 +44,7 @@ ext { ...@@ -44,7 +44,7 @@ ext {
//第三步 若干 //第三步 若干
"m-confide" : "0.0.41.2", "m-confide" : "0.0.41.2",
"m-consultant" : "0.0.51.5", "m-consultant" : "0.0.51.6",
"m-fm" : "0.0.23.4", "m-fm" : "0.0.23.4",
"m-user" : "0.0.41.1", "m-user" : "0.0.41.1",
"m-home" : "0.0.6.25", "m-home" : "0.0.6.25",
......
...@@ -47,7 +47,8 @@ class RecommendListView : LinearLayout { ...@@ -47,7 +47,8 @@ class RecommendListView : LinearLayout {
} }
private var mContext: Context? = null private var mContext: Context? = null
private var mSceneSpecialTopicList = ArrayList<ExpertSearchRecommandBean>() // viewPager的所有item数据 private var mSceneSpecialTopicList =
ArrayList<ExpertSearchRecommandBean>() // viewPager的所有item数据
private var mViewPagerList = ArrayList<LinearLayout>() //viewPager的数据 private var mViewPagerList = ArrayList<LinearLayout>() //viewPager的数据
private var mDoctorSpecialTopicsList = ArrayList<ExpertSearchBigShotBean>() //viewPager的数据 private var mDoctorSpecialTopicsList = ArrayList<ExpertSearchBigShotBean>() //viewPager的数据
private var minHeight: Int = 0 // viewPager最小高度 private var minHeight: Int = 0 // viewPager最小高度
...@@ -88,14 +89,14 @@ class RecommendListView : LinearLayout { ...@@ -88,14 +89,14 @@ class RecommendListView : LinearLayout {
if (it.sceneSpecialTopics == null || it.sceneSpecialTopics.size == 0) { if (it.sceneSpecialTopics == null || it.sceneSpecialTopics.size == 0) {
recommendViewPager.visibility = View.GONE recommendViewPager.visibility = View.GONE
recommendViewPagerIndicator.visibility = View.GONE recommendViewPagerIndicator.visibility = View.GONE
}else { } else {
mSceneSpecialTopicList.addAll(it.sceneSpecialTopics) mSceneSpecialTopicList.addAll(it.sceneSpecialTopics)
recommendViewPager.visibility = View.VISIBLE recommendViewPager.visibility = View.VISIBLE
recommendViewPagerIndicator.visibility = View.VISIBLE recommendViewPagerIndicator.visibility = View.VISIBLE
} }
if (it.doctorSpecialTopics == null || it.doctorSpecialTopics.size == 0) { if (it.doctorSpecialTopics == null || it.doctorSpecialTopics.size == 0) {
itemListView.visibility = View.GONE itemListView.visibility = View.GONE
}else { } else {
mDoctorSpecialTopicsList.addAll(it.doctorSpecialTopics) mDoctorSpecialTopicsList.addAll(it.doctorSpecialTopics)
itemListView.visibility = View.VISIBLE itemListView.visibility = View.VISIBLE
} }
...@@ -132,7 +133,8 @@ class RecommendListView : LinearLayout { ...@@ -132,7 +133,8 @@ class RecommendListView : LinearLayout {
/** /**
* 渲染第一页数据 * 渲染第一页数据
*/ */
val firstPagerHeight = RxImageTool.dp2px(60f * (getMinData(mSceneSpecialTopicList.size + 1, 4 + 1) / 2)) val firstPagerHeight =
RxImageTool.dp2px(60f * (getMinData(mSceneSpecialTopicList.size + 1, 4 + 1) / 2))
val firstPager = getLinearLayout( val firstPager = getLinearLayout(
mContext!!, mContext!!,
firstPagerHeight, VERTICAL firstPagerHeight, VERTICAL
...@@ -155,7 +157,8 @@ class RecommendListView : LinearLayout { ...@@ -155,7 +157,8 @@ class RecommendListView : LinearLayout {
/** /**
* 渲染第二页数据 * 渲染第二页数据
*/ */
val secondPagerHeight = RxImageTool.dp2px(60f * ((mSceneSpecialTopicList.size - 4 + 1) / 2)) val secondPagerHeight =
RxImageTool.dp2px(60f * ((mSceneSpecialTopicList.size - 4 + 1) / 2))
maxHeight = secondPagerHeight + RxImageTool.dp2px(11f) maxHeight = secondPagerHeight + RxImageTool.dp2px(11f)
if (mSceneSpecialTopicList.size > 4) { if (mSceneSpecialTopicList.size > 4) {
val secondPager = getLinearLayout( val secondPager = getLinearLayout(
...@@ -180,7 +183,12 @@ class RecommendListView : LinearLayout { ...@@ -180,7 +183,12 @@ class RecommendListView : LinearLayout {
recommendViewPager.adapter = RecommendViewPagerAdapter() recommendViewPager.adapter = RecommendViewPagerAdapter()
recommendViewPager.currentItem = 0 recommendViewPager.currentItem = 0
setSelectedIndex(0) // 默认为左边选中
if (mSceneSpecialTopicList.size < 4) {
setOnlyOnePage()
} else {
setSelectedIndex(0) // 默认为左边选中
}
addListener() addListener()
} }
...@@ -229,6 +237,13 @@ class RecommendListView : LinearLayout { ...@@ -229,6 +237,13 @@ class RecommendListView : LinearLayout {
} }
} }
private fun setOnlyOnePage() {
leftIndicator.layoutParams = LayoutParams(dp_15, dp_5)
leftIndicator.setBackgroundResource(R.drawable.consultant_indicator_selected)
rightIndicator.visibility = View.GONE
}
private fun getMinData(a: Int, b: Int): Int { private fun getMinData(a: Int, b: Int): Int {
return if (a < b) a else b return if (a < b) a else b
} }
...@@ -313,7 +328,11 @@ class RecommendListView : LinearLayout { ...@@ -313,7 +328,11 @@ class RecommendListView : LinearLayout {
} }
mDoctorSpecialTopicsList.size == 3 -> { mDoctorSpecialTopicsList.size == 3 -> {
val mView = BigShotThreeView(mContext!!) val mView = BigShotThreeView(mContext!!)
mView.setUrl(mDoctorSpecialTopicsList[0], mDoctorSpecialTopicsList[1], mDoctorSpecialTopicsList[2]) mView.setUrl(
mDoctorSpecialTopicsList[0],
mDoctorSpecialTopicsList[1],
mDoctorSpecialTopicsList[2]
)
itemListView.addView(mView) itemListView.addView(mView)
} }
mDoctorSpecialTopicsList.size == 4 -> { mDoctorSpecialTopicsList.size == 4 -> {
...@@ -335,7 +354,11 @@ class RecommendListView : LinearLayout { ...@@ -335,7 +354,11 @@ class RecommendListView : LinearLayout {
mView.layoutParams = params mView.layoutParams = params
val mView1 = BigShotTwoView(mContext!!) val mView1 = BigShotTwoView(mContext!!)
mView.setUrl(mDoctorSpecialTopicsList[0], mDoctorSpecialTopicsList[1], mDoctorSpecialTopicsList[2]) mView.setUrl(
mDoctorSpecialTopicsList[0],
mDoctorSpecialTopicsList[1],
mDoctorSpecialTopicsList[2]
)
mView1.setUrl(mDoctorSpecialTopicsList[3], mDoctorSpecialTopicsList[4]) mView1.setUrl(mDoctorSpecialTopicsList[3], mDoctorSpecialTopicsList[4])
itemListView.addView(mView) itemListView.addView(mView)
itemListView.addView(mView1) itemListView.addView(mView1)
...@@ -347,8 +370,16 @@ class RecommendListView : LinearLayout { ...@@ -347,8 +370,16 @@ class RecommendListView : LinearLayout {
mView.layoutParams = params mView.layoutParams = params
val mView1 = BigShotThreeView(mContext!!) val mView1 = BigShotThreeView(mContext!!)
mView.setUrl(mDoctorSpecialTopicsList[0], mDoctorSpecialTopicsList[1], mDoctorSpecialTopicsList[2]) mView.setUrl(
mView1.setUrl(mDoctorSpecialTopicsList[3], mDoctorSpecialTopicsList[4], mDoctorSpecialTopicsList[5]) mDoctorSpecialTopicsList[0],
mDoctorSpecialTopicsList[1],
mDoctorSpecialTopicsList[2]
)
mView1.setUrl(
mDoctorSpecialTopicsList[3],
mDoctorSpecialTopicsList[4],
mDoctorSpecialTopicsList[5]
)
itemListView.addView(mView) itemListView.addView(mView)
itemListView.addView(mView1) itemListView.addView(mView1)
} }
......
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