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
390ba8e0
Commit
390ba8e0
authored
3 years ago
by
范玉宾
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add meditation child type more
parent
2a4e7104
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
145 additions
and
48 deletions
+145
-48
MeditationTypeAdapter.kt
m-home/src/main/java/com/yidianling/home/MeditationTypeAdapter.kt
+61
-14
MeditationTypeView.kt
m-home/src/main/java/com/yidianling/home/MeditationTypeView.kt
+0
-26
MeditationTypeModel.kt
m-home/src/main/java/com/yidianling/home/model/MeditationTypeModel.kt
+2
-1
icon_more_arrow_right.xml
m-home/src/main/res/drawable/icon_more_arrow_right.xml
+18
-0
HomeMuseView.kt
m-home/src/ydl/java/com/yidianling/home/ui/view/HomeMuseView.kt
+6
-5
bg_more_meditation.xml
m-home/src/ydl/res/drawable/bg_more_meditation.xml
+9
-0
layout_meditation_entrance.xml
m-home/src/ydl/res/layout/layout_meditation_entrance.xml
+2
-1
layout_meditation_item.xml
m-home/src/ydl/res/layout/layout_meditation_item.xml
+2
-1
layout_meditation_more_type.xml
m-home/src/ydl/res/layout/layout_meditation_more_type.xml
+45
-0
No files found.
m-home/src/main/java/com/yidianling/home/MeditationTypeAdapter.kt
View file @
390ba8e0
...
...
@@ -5,28 +5,56 @@ import android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
android.widget.ImageView
import
android.widget.LinearLayout
import
android.widget.TextView
import
androidx.recyclerview.widget.RecyclerView
import
com.bumptech.glide.Glide
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.home.model.MeditationTypeModel
class
MeditationTypeAdapter
(
private
val
context
:
Context
,
private
val
data
:
List
<
MeditationTypeModel
>):
RecyclerView
.
Adapter
<
MeditationTypeAdapter
.
MeditationTypeViewHolder
>()
{
class
MeditationTypeAdapter
(
private
val
context
:
Context
,
private
val
data
:
List
<
MeditationTypeModel
>
)
:
RecyclerView
.
Adapter
<
RecyclerView
.
ViewHolder
>()
{
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
MeditationTypeViewHolder
{
return
MeditationTypeViewHolder
(
LayoutInflater
.
from
(
context
)
.
inflate
(
R
.
layout
.
layout_meditation_item
,
parent
,
false
))
}
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
RecyclerView
.
ViewHolder
{
return
when
(
viewType
)
{
CONTENT_TYPE
->
{
MeditationTypeViewHolder
(
LayoutInflater
.
from
(
context
)
.
inflate
(
R
.
layout
.
layout_meditation_item
,
parent
,
false
)
)
}
else
->
{
MeditationTypeMoreViewHolder
(
LayoutInflater
.
from
(
context
)
.
inflate
(
R
.
layout
.
layout_meditation_more_type
,
parent
,
false
)
)
override
fun
onBindViewHolder
(
holder
:
MeditationTypeViewHolder
,
position
:
Int
)
{
holder
.
ivType
?.
let
{
Glide
.
with
(
context
)
.
load
(
data
[
position
].
imageUrl
)
.
into
(
it
)
}
}
holder
.
tvName
?.
let
{
it
.
text
=
data
[
position
].
name
}
override
fun
onBindViewHolder
(
holder
:
RecyclerView
.
ViewHolder
,
position
:
Int
)
{
when
(
holder
)
{
is
MeditationTypeViewHolder
->
{
holder
.
ivType
?.
let
{
Glide
.
with
(
context
)
.
load
(
data
[
position
].
imageUrl
)
.
into
(
it
)
}
holder
.
tvName
?.
let
{
it
.
text
=
data
[
position
].
name
}
}
is
MeditationTypeMoreViewHolder
->
{
holder
.
llMoreLayout
?.
setOnClickListener
{
ToastUtil
.
toastShort
(
"查看更多类型!"
)
}
}
}
}
...
...
@@ -35,12 +63,30 @@ private val data:List<MeditationTypeModel>):RecyclerView.Adapter<MeditationTypeA
return
data
.
size
}
override
fun
getItemId
(
position
:
Int
)
=
position
.
toLong
()
inner
class
MeditationTypeViewHolder
(
itemView
:
View
):
RecyclerView
.
ViewHolder
(
itemView
){
override
fun
getItemViewType
(
position
:
Int
):
Int
{
val
isMore
=
data
[
position
].
isMore
return
if
(
isMore
)
{
FOOTER_TYPE
}
else
{
CONTENT_TYPE
}
}
inner
class
MeditationTypeViewHolder
(
itemView
:
View
)
:
RecyclerView
.
ViewHolder
(
itemView
)
{
val
ivType
:
ImageView
?
=
itemView
.
findViewById
(
R
.
id
.
iv_meditation_type
)
val
tvName
:
TextView
?
=
itemView
.
findViewById
(
R
.
id
.
tv_meditation_type
)
}
inner
class
MeditationTypeMoreViewHolder
(
itemView
:
View
)
:
RecyclerView
.
ViewHolder
(
itemView
)
{
val
llMoreLayout
:
LinearLayout
?
=
itemView
.
findViewById
(
R
.
id
.
ll_more_type
)
}
companion
object
{
const
val
CONTENT_TYPE
=
0
const
val
FOOTER_TYPE
=
1
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
m-home/src/main/java/com/yidianling/home/MeditationTypeView.kt
deleted
100644 → 0
View file @
2a4e7104
package
com.yidianling.home
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
com.yidianling.home.model.bean.MuseModuleBean
class
MeditationTypeView
(
layoutInflater
:
LayoutInflater
,
container
:
ViewGroup
?)
{
val
view
:
View
=
layoutInflater
.
inflate
(
R
.
layout
.
layout_meditation_entrance
,
container
,
false
)
private
val
rv
:
RecyclerView
init
{
rv
=
view
.
findViewById
(
R
.
id
.
rv_meditation_type
)
}
fun
bind
(
muse
:
MuseModuleBean
.
MuseDetailBean
){
rv
.
layoutManager
=
LinearLayoutManager
(
view
.
context
,
LinearLayoutManager
.
HORIZONTAL
,
false
)
rv
.
adapter
=
null
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
m-home/src/main/java/com/yidianling/home/model/MeditationTypeModel.kt
View file @
390ba8e0
...
...
@@ -3,5 +3,6 @@ package com.yidianling.home.model
data class
MeditationTypeModel
(
val
imageUrl
:
String
,
val
name
:
String
,
val
id
:
String
val
id
:
String
,
val
isMore
:
Boolean
=
false
)
This diff is collapsed.
Click to expand it.
m-home/src/main/res/drawable/icon_more_arrow_right.xml
0 → 100644
View file @
390ba8e0
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"15dp"
android:height=
"10dp"
android:viewportWidth=
"15"
android:viewportHeight=
"10"
>
<path
android:pathData=
"M12.1864,5.6796L0.9072,5.6796C0.4062,5.6796 0,5.2735 0,4.7724C-0,4.2714 0.4062,3.8652 0.9072,3.8652L12.1864,3.8652C12.6874,3.8652 13.0936,4.2714 13.0936,4.7724C13.0936,5.2735 12.6874,5.6796 12.1864,5.6796Z"
android:strokeWidth=
"1"
android:fillColor=
"#FFFFFF"
android:fillType=
"nonZero"
android:strokeColor=
"#00000000"
/>
<path
android:pathData=
"M8.1304,8.7724C8.0454,8.6876 7.9976,8.5725 7.9976,8.4524C7.9976,8.3324 8.0454,8.2172 8.1304,8.1324L11.4904,4.7724L8.1304,1.4124C7.9538,1.2357 7.9538,0.9492 8.1304,0.7724L8.7704,0.1324C8.9472,-0.0441 9.2336,-0.0441 9.4104,0.1324L13.3433,4.0653C13.7338,4.4559 13.7338,5.089 13.3433,5.4796L9.4104,9.4124L9.4104,9.4124C9.2336,9.589 8.9472,9.589 8.7704,9.4124L8.1304,8.7724Z"
android:strokeWidth=
"1"
android:fillColor=
"#FFFFFF"
android:fillType=
"nonZero"
android:strokeColor=
"#00000000"
/>
</vector>
This diff is collapsed.
Click to expand it.
m-home/src/ydl/java/com/yidianling/home/ui/view/HomeMuseView.kt
View file @
390ba8e0
...
...
@@ -15,9 +15,7 @@ import com.google.android.material.tabs.TabLayout
import
com.google.android.material.tabs.TabLayoutMediator
import
com.google.gson.Gson
import
com.ydl.ydl_image.module.GlideApp
import
com.ydl.ydlcommon.utils.LogUtil
import
com.yidianling.home.MeditationViewPagerAdapter
import
com.yidianling.home.MeditationTypeAdapter
import
com.yidianling.home.R
import
com.yidianling.home.constract.HomeViewConfig
import
com.yidianling.home.event.IHomeEvent
...
...
@@ -133,18 +131,21 @@ class HomeMuseView(private val mContext: Context, private var homeEvent: IHomeEv
val
innerData
=
mutableListOf
<
MeditationTypeModel
>()
for
(
i
in
0
until
3
){
for
(
i
in
0
until
4
){
val
name
=
when
(
i
){
0
->
"溪流"
1
->
"田园"
else
->
"雨声"
2
->
"雨声"
else
->
"更多"
}
val
imageUrl
=
when
(
i
){
0
->
"https://img0.baidu.com/it/u=2451025451,2376393604&fm=253&fmt=auto&app=138&f=JPEG?w=499&h=328"
1
->
"https://gimg2.baidu.com/image_search/src=http%3A%2F%2Fimg.9ku.com%2Fgeshoutuji%2Fsingertuji%2F4%2F40945%2F40945_1.jpg&refer=http%3A%2F%2Fimg.9ku.com&app=2002&size=f9999,10000&q=a80&n=0&g=0n&fmt=auto?sec=1654863419&t=aaea1ecc66afc7859a0cf64c06c6f2a4"
2
->
"https://img2.baidu.com/it/u=3357363842,3633429992&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=740"
else
->
"https://img2.baidu.com/it/u=3357363842,3633429992&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=740"
}
innerData
.
add
(
MeditationTypeModel
(
imageUrl
,
name
,
i
.
toString
()))
val
isMore
=
i
==
3
innerData
.
add
(
MeditationTypeModel
(
imageUrl
,
name
,
i
.
toString
(),
isMore
))
}
for
(
i
in
0
until
3
){
...
...
This diff is collapsed.
Click to expand it.
m-home/src/ydl/res/drawable/bg_more_meditation.xml
0 → 100644
View file @
390ba8e0
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:shape=
"rectangle"
>
<solid
android:color=
"#33FFFFFF"
/>
<corners
android:radius=
"8dp"
/>
</shape>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
m-home/src/ydl/res/layout/layout_meditation_entrance.xml
View file @
390ba8e0
...
...
@@ -3,13 +3,14 @@
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:
layout_margin
Start=
"10dp"
android:
padding
Start=
"10dp"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_meditation_type"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:clipToPadding=
"false"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
...
...
This diff is collapsed.
Click to expand it.
m-home/src/ydl/res/layout/layout_meditation_item.xml
View file @
390ba8e0
...
...
@@ -4,12 +4,13 @@
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:
layout_margin
Horizontal=
"6dp"
>
android:
padding
Horizontal=
"6dp"
>
<androidx.cardview.widget.CardView
android:id=
"@+id/card_view"
android:layout_width=
"105dp"
android:layout_height=
"102dp"
android:clipToPadding=
"false"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
...
...
This diff is collapsed.
Click to expand it.
m-home/src/ydl/res/layout/layout_meditation_more_type.xml
0 → 100644
View file @
390ba8e0
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
tools:background=
"@color/baby_blue"
android:layout_marginHorizontal=
"6dp"
>
<LinearLayout
android:id=
"@+id/ll_more_type"
android:layout_width=
"40dp"
android:layout_height=
"102dp"
android:background=
"@drawable/bg_more_meditation"
android:gravity=
"center_horizontal"
android:orientation=
"vertical"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"bottom|start"
android:layout_marginTop=
"25dp"
android:layout_marginHorizontal=
"13dp"
android:text=
"更多"
android:textColor=
"@color/white"
android:textSize=
"14sp"
android:textStyle=
"bold"
android:layout_marginBottom=
"8dp"
/>
<ImageView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:src=
"@drawable/icon_more_arrow_right"
/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
This diff is collapsed.
Click to expand it.
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