Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨凯
YDL-Component-Medical
Commits
af81f135
Commit
af81f135
authored
Dec 21, 2019
by
徐健
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
back
parent
263c8326
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
41 additions
and
10 deletions
+41
-10
RecommendListView.kt
m-consultant/src/main/java/com/yidianling/consultant/ui/view/topView/RecommendListView.kt
+41
-10
No files found.
m-consultant/src/main/java/com/yidianling/consultant/ui/view/topView/RecommendListView.kt
View file @
af81f135
...
@@ -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
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment