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
0b3f990c
Commit
0b3f990c
authored
May 12, 2022
by
万齐军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feature: 倾诉2.0首页改版
parent
c4202080
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
276 additions
and
31 deletions
+276
-31
ConfideHomeAdapter.kt
m-confide/src/main/java/com/ydl/confide/home/adapter/ConfideHomeAdapter.kt
+48
-12
VideoShowAdapter.kt
m-confide/src/main/java/com/ydl/confide/home/adapter/VideoShowAdapter.kt
+77
-0
ConfideHomeBodyBean.kt
m-confide/src/main/java/com/ydl/confide/home/bean/ConfideHomeBodyBean.kt
+3
-0
IConfideHomeConfig.kt
m-confide/src/main/java/com/ydl/confide/home/config/IConfideHomeConfig.kt
+1
-0
ic_action_confide_customer.png
m-confide/src/main/res/drawable-xxhdpi/ic_action_confide_customer.png
+0
-0
ic_action_confide_help.png
m-confide/src/main/res/drawable-xxhdpi/ic_action_confide_help.png
+0
-0
ic_action_confide_order.png
m-confide/src/main/res/drawable-xxhdpi/ic_action_confide_order.png
+0
-0
confide_title_bar.xml
m-confide/src/main/res/layout/confide_title_bar.xml
+62
-19
item_confide_home_recent.xml
m-confide/src/main/res/layout/item_confide_home_recent.xml
+46
-0
item_video_show.xml
m-confide/src/main/res/layout/item_video_show.xml
+39
-0
No files found.
m-confide/src/main/java/com/ydl/confide/home/adapter/ConfideHomeAdapter.kt
View file @
0b3f990c
...
...
@@ -4,12 +4,14 @@ import android.content.Context
import
androidx.recyclerview.widget.RecyclerView
import
android.view.View
import
android.view.ViewGroup
import
androidx.recyclerview.widget.LinearLayoutManager
import
com.ydl.confide.R
import
com.ydl.confide.home.bean.ConfideHomeDataBean
import
com.ydl.confide.home.config.IConfideHomeConfig
import
com.ydl.confide.home.contract.IConfideHomeContract
import
com.ydl.confide.home.event.IConfideHomeEvent
import
com.ydl.confide.home.widget.*
import
com.ydl.ydlcommon.utils.DisplayUtils
/**
* @author yuanwai
...
...
@@ -73,17 +75,26 @@ class ConfideHomeAdapter(private val mContext: Context,
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
RecyclerView
.
ViewHolder
{
when
(
viewType
)
{
//banner
IConfideHomeConfig
.
TYPE_BANNER
->
{
return
BannerViewHolder
(
ConfideHomeBannerView
(
parent
.
context
,
confideHomeEvent
))
}
//
IConfideHomeConfig.TYPE_BANNER -> {
//
return BannerViewHolder(ConfideHomeBannerView(parent.context, confideHomeEvent))
//
}
//最近倾诉
IConfideHomeConfig
.
TYPE_RECENTLY_CONFIDED
->
{
return
ConsultViewHolder
(
ConfideHomeRecentView
(
parent
.
context
,
confideHomeEvent
))
// return ConsultViewHolder(ConfideHomeRecentView(parent.context, confideHomeEvent))
val
recyclerView
=
RecyclerView
(
parent
.
context
)
recyclerView
.
layoutParams
=
ViewGroup
.
MarginLayoutParams
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
).
apply
{
leftMargin
=
DisplayUtils
.
dip2px
(
parent
.
context
,
4F
)
rightMargin
=
DisplayUtils
.
dip2px
(
parent
.
context
,
4F
)
}
return
RecentConfideHolder
(
recyclerView
)
}
//分类
IConfideHomeConfig
.
TYPE_CATEGORY
->
{
return
CategoryViewHolder
(
ConfideHomeCategoryView
(
parent
.
context
,
confideHomeEvent
,
confideHomeView
))
}
//
IConfideHomeConfig.TYPE_CATEGORY -> {
//
return CategoryViewHolder(ConfideHomeCategoryView(parent.context, confideHomeEvent, confideHomeView))
//
}
//筛选模块
IConfideHomeConfig
.
TYPE_RECOMMEND_FILTER
->
{
return
FilterViewHolder
(
ConfideHomeFilterView
(
parent
.
context
,
confideHomeView
))
...
...
@@ -92,6 +103,17 @@ class ConfideHomeAdapter(private val mContext: Context,
IConfideHomeConfig
.
TYPE_RECOMMEND
->
{
return
RecommendViewHolder
(
ConfideHomeRecommendView
(
confideHomeView
,
parent
.
context
,
confideHomeEvent
))
}
IConfideHomeConfig
.
TYPE_VIDEO_SHOW
->
{
val
recyclerView
=
RecyclerView
(
parent
.
context
)
recyclerView
.
layoutParams
=
ViewGroup
.
MarginLayoutParams
(
ViewGroup
.
LayoutParams
.
MATCH_PARENT
,
ViewGroup
.
LayoutParams
.
WRAP_CONTENT
).
apply
{
leftMargin
=
DisplayUtils
.
dip2px
(
parent
.
context
,
6F
)
rightMargin
=
DisplayUtils
.
dip2px
(
parent
.
context
,
6F
)
}
return
VideoShowHolder
(
recyclerView
)
}
// //听声寻人
// IConfideHomeConfig.TYPE_SOUND -> {
//// return ConfideHomeListenAndFoundViewHolder(ConfideHomeListenAndFoundView(parent.context, confideHomeEvent))
...
...
@@ -103,25 +125,36 @@ class ConfideHomeAdapter(private val mContext: Context,
}
override
fun
onBindViewHolder
(
holder
:
RecyclerView
.
ViewHolder
,
position
:
Int
)
=
if
(
holder
is
BannerViewHolder
&&
null
!=
holder
.
bannerView
)
{
/*
if (holder is BannerViewHolder && null != holder.bannerView) {
//banner
holder.bannerView!!.initData(mListData!![position])
} else if (holder is CategoryViewHolder && null != holder.categoryView) {
//分类
holder.categoryView!!.initData(mListData!![position])
}
else
if
(
holder
is
FilterViewHolder
&&
null
!=
holder
.
filterView
)
{
} else
*/
if
(
holder
is
FilterViewHolder
&&
null
!=
holder
.
filterView
)
{
mFilterViewHolder
=
holder
//筛选模块
holder
.
filterView
.
initData
(
mListData
!!
[
position
])
}
else
if
(
holder
is
ConfideHomeListenAndFoundViewHolder
)
{
//听声寻人
// holder.confideHomeListenAndFoundView!!.initData(mListData!![position])
}
else
if
(
holder
is
ConsultViewHolder
&&
null
!=
holder
.
consultView
)
{
//最近倾诉
holder
.
consultView
!!
.
initData
(
mListData
!!
[
position
])
}
else
if
(
holder
is
RecentConfideHolder
)
{
//最近倾诉
holder
.
rv
.
layoutManager
=
LinearLayoutManager
(
holder
.
itemView
.
context
,
RecyclerView
.
HORIZONTAL
,
false
)
val
recentBody
=
mListData
!!
[
position
].
body
val
data
=
recentBody
?.
map
{
ItemVideoShowViewModel
().
mapOf
(
it
)
}
?:
emptyList
()
holder
.
rv
.
adapter
=
RecentConfideAdapter
(
data
)
// holder.consultView!!.initData(mListData!![position])
}
else
if
(
holder
is
RecommendViewHolder
&&
null
!=
mListData
!!
[
position
]
&&
null
!=
mListData
!!
[
position
].
body
&&
!
mListData
!!
[
position
].
body
!!
.
isEmpty
())
{
//为你推荐
holder
.
confideHomeRecommendView
.
initData
(
mListData
!!
[
position
].
body
!!
[
0
],
position
,
mListData
!!
[
position
].
recommendId
)
}
else
if
(
holder
is
VideoShowHolder
)
{
holder
.
rv
.
layoutManager
=
LinearLayoutManager
(
holder
.
itemView
.
context
,
RecyclerView
.
HORIZONTAL
,
false
)
val
recentBody
=
mListData
!!
[
position
].
body
val
data
=
recentBody
?.
map
{
ItemVideoShowViewModel
().
mapOf
(
it
)
}
?:
emptyList
()
holder
.
rv
.
adapter
=
VideoShowAdapter
(
data
)
}
else
if
(
holder
is
EmptyViewHolder
)
{
}
else
{
...
...
@@ -184,4 +217,6 @@ class ConfideHomeAdapter(private val mContext: Context,
view
=
itemView
}
}
class
VideoShowHolder
(
val
rv
:
RecyclerView
)
:
RecyclerView
.
ViewHolder
(
rv
)
class
RecentConfideHolder
(
val
rv
:
RecyclerView
)
:
RecyclerView
.
ViewHolder
(
rv
)
}
\ No newline at end of file
m-confide/src/main/java/com/ydl/confide/home/adapter/VideoShowAdapter.kt
0 → 100644
View file @
0b3f990c
package
com.ydl.confide.home.adapter
import
android.view.LayoutInflater
import
android.view.ViewGroup
import
androidx.databinding.DataBindingUtil
import
androidx.databinding.ObservableField
import
androidx.recyclerview.widget.RecyclerView
import
com.ydl.confide.R
import
com.ydl.confide.databinding.ItemConfideHomeRecentBinding
import
com.ydl.confide.databinding.ItemVideoShowBinding
import
com.ydl.confide.home.bean.ConfideHomeBodyBean
import
com.ydl.confide.home.bean.ConfideHomeDataBean
import
com.ydl.confide.intro.BindingViewHolder
class
VideoShowAdapter
(
val
data
:
List
<
ItemVideoShowViewModel
>)
:
RecyclerView
.
Adapter
<
BindingViewHolder
<
ItemVideoShowBinding
>>()
{
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
BindingViewHolder
<
ItemVideoShowBinding
>
{
val
layoutInflater
=
LayoutInflater
.
from
(
parent
.
context
)
val
binding
=
DataBindingUtil
.
inflate
<
ItemVideoShowBinding
>(
layoutInflater
,
R
.
layout
.
item_video_show
,
parent
,
false
)
return
BindingViewHolder
(
binding
)
}
override
fun
onBindViewHolder
(
holder
:
BindingViewHolder
<
ItemVideoShowBinding
>,
position
:
Int
)
{
holder
.
binding
.
item
=
data
[
position
]
}
override
fun
getItemCount
()
=
data
.
size
}
class
RecentConfideAdapter
(
val
data
:
List
<
ItemVideoShowViewModel
>)
:
RecyclerView
.
Adapter
<
BindingViewHolder
<
ItemConfideHomeRecentBinding
>>()
{
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
BindingViewHolder
<
ItemConfideHomeRecentBinding
>
{
val
layoutInflater
=
LayoutInflater
.
from
(
parent
.
context
)
val
binding
=
DataBindingUtil
.
inflate
<
ItemConfideHomeRecentBinding
>(
layoutInflater
,
R
.
layout
.
item_confide_home_recent
,
parent
,
false
)
return
BindingViewHolder
(
binding
)
}
override
fun
onBindViewHolder
(
holder
:
BindingViewHolder
<
ItemConfideHomeRecentBinding
>,
position
:
Int
)
{
holder
.
binding
.
item
=
data
[
position
]
}
override
fun
getItemCount
()
=
data
.
size
}
class
ItemVideoShowViewModel
{
val
name
=
ObservableField
<
String
>(
""
)
val
coverUrl
=
ObservableField
<
String
>(
""
)
val
videoCoverUrl
=
ObservableField
<
String
>(
""
)
val
state
=
ObservableField
<
String
>(
""
)
}
internal
fun
ItemVideoShowViewModel
.
mapOf
(
bean
:
ConfideHomeBodyBean
):
ItemVideoShowViewModel
{
name
.
set
(
bean
.
confidedName
)
coverUrl
.
set
(
bean
.
confidedIcon
/*coverPicture*/
)
videoCoverUrl
.
set
(
bean
.
confidedIcon
/*coverVideoPicture*/
)
state
.
set
(
bean
.
confideLine
.
toString
())
return
this
}
m-confide/src/main/java/com/ydl/confide/home/bean/ConfideHomeBodyBean.kt
View file @
0b3f990c
...
...
@@ -50,6 +50,9 @@ data class ConfideHomeBodyBean(
val
couponMoney
:
String
?,
//新用户优惠文案
val
couponText
:
String
?,
val
videoUrl
:
String
?,
val
coverVideoPicture
:
String
?,
val
coverPicture
:
String
?,
/**
* banner数据
*/
...
...
m-confide/src/main/java/com/ydl/confide/home/config/IConfideHomeConfig.kt
View file @
0b3f990c
...
...
@@ -21,6 +21,7 @@ interface IConfideHomeConfig{
const
val
TYPE_SOUND
=
6
const
val
TYPE_CONSULTANT
=
7
const
val
TYPE_FOOTER
=
999
const
val
TYPE_VIDEO_SHOW
=
8
/**
* section id. 与上面相对应
*/
...
...
m-confide/src/main/res/drawable-xxhdpi/ic_action_confide_customer.png
0 → 100644
View file @
0b3f990c
1.59 KB
m-confide/src/main/res/drawable-xxhdpi/ic_action_confide_help.png
0 → 100644
View file @
0b3f990c
1.44 KB
m-confide/src/main/res/drawable-xxhdpi/ic_action_confide_order.png
0 → 100644
View file @
0b3f990c
1.01 KB
m-confide/src/main/res/layout/confide_title_bar.xml
View file @
0b3f990c
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:
orientation=
"horizontal
"
android:
id=
"@+id/rl_confide_title_layout
"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
android:background=
"@drawable/confide_common_bg"
android:id=
"@+id/rl_confide_title_layout"
>
android:orientation=
"horizontal"
>
<
Linear
Layout
<
androidx.constraintlayout.widget.Constraint
Layout
android:id=
"@+id/ll_bar_root"
android:orientation=
"horizontal"
android:layout_width=
"match_parent"
android:layout_height=
"48dp"
>
android:layout_height=
"48dp"
android:orientation=
"horizontal"
>
<ImageView
android:id=
"@+id/img_back"
android:layout_width=
"
wrap_content
"
android:layout_height=
"
wrap_content
"
android:layout_width=
"
40dp
"
android:layout_height=
"
0dp
"
android:layout_gravity=
"center_vertical"
android:layout_marginLeft=
"15dp"
android:layout_marginRight=
"15dp"
android:background=
"@drawable/confide_back"
/>
android:scaleType=
"center"
android:src=
"@drawable/confide_back"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:id=
"@+id/tv_title"
android:layout_width=
"0px"
android:layout_height=
"match_parent"
android:layout_weight=
"1"
android:gravity=
"center"
android:text
Size=
"17dp
"
android:text
=
"@string/confide_title
"
android:textColor=
"#FFFFFF"
android:text=
"@string/confide_title"
/>
<ImageView
android:textSize=
"17dp"
app:layout_constraintLeft_toLeftOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
/>
<TextView
android:id=
"@+id/img_mine"
android:layout_width=
"
wrap_content
"
android:layout_width=
"
40dp
"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_marginLeft=
"15dp"
android:layout_marginRight=
"15dp"
android:background=
"@drawable/confide_mine"
/>
</LinearLayout>
android:drawableTop=
"@drawable/ic_action_confide_order"
android:drawablePadding=
"4dp"
android:gravity=
"center"
android:text=
"订单"
android:textColor=
"@color/_9"
android:textSize=
"7sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintRight_toLeftOf=
"@+id/img_customer"
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:id=
"@+id/img_customer"
android:layout_width=
"40dp"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:drawableTop=
"@drawable/ic_action_confide_customer"
android:drawablePadding=
"4dp"
android:gravity=
"center"
android:text=
"客服"
android:textColor=
"@color/_9"
android:textSize=
"7sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintRight_toLeftOf=
"@+id/img_help"
app:layout_constraintTop_toTopOf=
"parent"
/>
<TextView
android:id=
"@+id/img_help"
android:layout_width=
"40dp"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:drawableTop=
"@drawable/ic_action_confide_help"
android:drawablePadding=
"4dp"
android:gravity=
"center"
android:text=
"帮助"
android:textColor=
"@color/_9"
android:textSize=
"7sp"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
</RelativeLayout>
m-confide/src/main/res/layout/item_confide_home_recent.xml
0 → 100644
View file @
0b3f990c
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<data>
<variable
name=
"item"
type=
"com.ydl.confide.home.adapter.ItemVideoShowViewModel"
/>
</data>
<androidx.cardview.widget.CardView
android:layout_width=
"52dp"
android:layout_height=
"52dp"
android:layout_marginLeft=
"8dp"
android:layout_marginTop=
"10dp"
android:layout_marginRight=
"8dp"
android:layout_marginBottom=
"10dp"
app:cardCornerRadius=
"6dp"
app:cardElevation=
"0dp"
>
<ImageView
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
app:imageUrl=
"@{item.coverUrl}"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"bottom|center"
android:layout_marginBottom=
"10dp"
android:text=
"@{item.name}"
android:textColor=
"@color/white"
android:textSize=
"10sp"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"top|left"
android:layout_marginBottom=
"2dp"
android:text=
"@{item.state}"
android:textColor=
"@color/white"
android:textSize=
"7sp"
/>
</androidx.cardview.widget.CardView>
</layout>
m-confide/src/main/res/layout/item_video_show.xml
0 → 100644
View file @
0b3f990c
<?xml version="1.0" encoding="utf-8"?>
<layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<data>
<variable
name=
"item"
type=
"com.ydl.confide.home.adapter.ItemVideoShowViewModel"
/>
</data>
<androidx.cardview.widget.CardView
android:layout_width=
"180dp"
android:layout_height=
"140dp"
android:layout_marginLeft=
"5dp"
android:layout_marginTop=
"20dp"
android:layout_marginRight=
"5dp"
android:layout_marginBottom=
"10dp"
app:cardCornerRadius=
"8dp"
app:cardElevation=
"0dp"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"bottom|left"
android:layout_marginLeft=
"10dp"
android:layout_marginBottom=
"10dp"
android:text=
"@{item.name}"
android:textColor=
"@color/white"
android:textSize=
"15sp"
/>
<ImageView
android:layout_width=
"33dp"
android:layout_height=
"33dp"
android:layout_gravity=
"center"
android:src=
"@drawable/ic_video_play"
app:imageUrl=
"@{item.videoCoverUrl}"
/>
</androidx.cardview.widget.CardView>
</layout>
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