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
123bc6a5
Commit
123bc6a5
authored
May 18, 2022
by
万齐军
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feature: 视频播放
parent
53610264
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
72 additions
and
37 deletions
+72
-37
VideoShowAdapter.kt
m-confide/src/main/java/com/ydl/confide/home/adapter/VideoShowAdapter.kt
+2
-2
ExpertIntroActivity.kt
m-confide/src/main/java/com/ydl/confide/intro/ExpertIntroActivity.kt
+7
-11
ItemIntroHolder.kt
m-confide/src/main/java/com/ydl/confide/intro/ItemIntroHolder.kt
+9
-4
confide_seekbar_style.xml
m-confide/src/main/res/drawable/confide_seekbar_style.xml
+37
-10
confide_seekbar_thumb.xml
m-confide/src/main/res/drawable/confide_seekbar_thumb.xml
+7
-4
item_expert_intro.xml
m-confide/src/main/res/layout/item_expert_intro.xml
+3
-3
BindingAdapter1.kt
ydl-utils/src/main/java/com/yidianling/common/binding/BindingAdapter1.kt
+7
-3
No files found.
m-confide/src/main/java/com/ydl/confide/home/adapter/VideoShowAdapter.kt
View file @
123bc6a5
...
...
@@ -15,7 +15,7 @@ import com.ydl.confide.intro.BindingViewHolder
class
VideoShowAdapter
(
private
val
data
:
List
<
ConfideHomeBodyBean
>?,
private
val
event
:
IConfideHomeEvent
)
:
RecyclerView
.
Adapter
<
BindingViewHolder
<
ItemVideoShowBinding
>>()
{
private
val
dataList
:
List
<
ItemVideoShowViewModel
>
=
data
?.
map
{
ItemVideoShowViewModel
().
mapOf
(
it
)
}
?:
emptyList
()
private
val
dataList
:
List
<
ItemVideoShowViewModel
>
=
data
?.
map
{
ItemVideoShowViewModel
().
mapOf
(
it
)
}
?:
emptyList
()
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
...
...
@@ -74,7 +74,7 @@ internal fun ItemVideoShowViewModel.mapOf(bean: ConfideHomeBodyBean): ItemVideoS
name
.
set
(
bean
.
confidedName
)
coverUrl
.
set
(
bean
.
coverPicture
)
videoCoverUrl
.
set
(
bean
.
coverVideoPicture
)
state
.
set
(
bean
.
confideLine
?:
0
)
state
.
set
(
bean
.
confideLine
?:
0
)
linkUrl
=
bean
.
linkUrl
return
this
}
...
...
m-confide/src/main/java/com/ydl/confide/intro/ExpertIntroActivity.kt
View file @
123bc6a5
...
...
@@ -67,11 +67,6 @@ class ExpertIntroActivity : AppCompatActivity() {
val
h5Paramsqing
=
H5Params
(
YDL_H5
+
"confideOrderList"
,
null
)
NewH5Activity
.
start
(
this
,
h5Paramsqing
)
}
data
.
add
(
VideoViewModel
())
data
.
add
(
VideoViewModel
())
data
.
add
(
VideoViewModel
())
data
.
add
(
VideoViewModel
())
data
.
add
(
VideoViewModel
())
binding
.
viewPager
.
orientation
=
ViewPager2
.
ORIENTATION_VERTICAL
binding
.
viewPager
.
offscreenPageLimit
=
1
adapter
=
IntroAdapter
(
this
,
data
,
this
)
...
...
@@ -89,11 +84,11 @@ class ExpertIntroActivity : AppCompatActivity() {
}
private
fun
loadMore
()
{
data
.
add
(
VideoViewModel
())
data
.
add
(
VideoViewModel
())
data
.
add
(
VideoViewModel
())
data
.
add
(
VideoViewModel
())
data
.
add
(
VideoViewModel
())
adapter
.
notifyItemRangeInserted
(
data
.
size
-
5
,
5
)
//
data.add(VideoViewModel())
//
data.add(VideoViewModel())
//
data.add(VideoViewModel())
//
data.add(VideoViewModel())
//
data.add(VideoViewModel())
//
adapter.notifyItemRangeInserted(data.size - 5, 5)
}
}
\ No newline at end of file
m-confide/src/main/java/com/ydl/confide/intro/ItemIntroHolder.kt
View file @
123bc6a5
...
...
@@ -29,6 +29,8 @@ internal class ItemIntroHolder(binding: ItemExpertIntroBinding) :
private
var
disposable
:
Disposable
?
=
null
private
var
video
:
IjkVideoView
?
=
null
@Volatile
private
var
isTouch
=
false
fun
onDetach
()
{
stopTiming
()
...
...
@@ -66,9 +68,11 @@ internal class ItemIntroHolder(binding: ItemExpertIntroBinding) :
}
override
fun
onStartTrackingTouch
(
seekBar
:
SeekBar
?)
{
isTouch
=
true
}
override
fun
onStopTrackingTouch
(
seekBar
:
SeekBar
?)
{
isTouch
=
false
if
(
seekBar
!=
null
)
{
video
?.
seekTo
(
seekBar
.
progress
)
video
?.
start
()
...
...
@@ -102,6 +106,7 @@ internal class ItemIntroHolder(binding: ItemExpertIntroBinding) :
disposable
=
Observable
.
interval
(
300
,
TimeUnit
.
MILLISECONDS
)
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribeOn
(
Schedulers
.
computation
())
.
filter
{
!
isTouch
}
.
subscribe
{
val
pos
=
(
video
?.
mMediaPlayer
as
IjkMediaPlayer
?)
?.
currentPosition
?:
0
if
(
pos
>
0
)
{
...
...
@@ -118,7 +123,7 @@ internal class ItemIntroHolder(binding: ItemExpertIntroBinding) :
class
VideoViewModel
{
val
name
=
ObservableField
<
String
>(
""
)
val
avatar
=
ObservableField
<
String
>(
""
)
val
count
=
Observable
Int
(
)
val
count
=
Observable
Field
<
String
>(
""
)
val
lineStatus
=
ObservableInt
()
val
intro
=
ObservableField
<
String
>(
""
)
val
tag
=
ObservableField
<
String
>(
""
)
...
...
@@ -132,10 +137,10 @@ class VideoViewModel {
internal
fun
VideoViewModel
.
mapOf
(
bean
:
ConfideHomeBodyBean
):
VideoViewModel
{
name
.
set
(
bean
.
confidedName
)
avatar
.
set
(
bean
.
confidedIcon
)
//
count.set(bean.confideHearNum)
intro
.
set
(
bean
.
c
ategory
Content
)
count
.
set
(
bean
.
confideHearNum
)
intro
.
set
(
bean
.
c
onfide
Content
)
val
sb
=
StringBuilder
()
bean
.
confidedTag
?.
forEach
{
sb
.
append
(
it
).
append
(
"
|
"
)
}
bean
.
confidedTag
?.
forEach
{
sb
.
append
(
it
).
append
(
"
|
"
)
}
sb
.
setLength
(
sb
.
length
-
1
)
tag
.
set
(
sb
.
toString
())
if
(
bean
.
videoUrl
!=
null
)
{
...
...
m-confide/src/main/res/drawable/confide_seekbar_style.xml
View file @
123bc6a5
...
...
@@ -2,10 +2,22 @@
<layer-list
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:id=
"@android:id/background"
>
<shape>
<corners
android:radius=
"4dp"
/>
<solid
android:color=
"#59FFFFFF"
/>
</shape>
<selector>
<item
android:state_pressed=
"true"
>
<shape>
<corners
android:radius=
"4dp"
/>
<solid
android:color=
"#59FFFFFF"
/>
<stroke
android:width=
"1dp"
/>
</shape>
</item>
<item>
<shape>
<corners
android:radius=
"4dp"
/>
<solid
android:color=
"#59FFFFFF"
/>
<stroke
android:width=
"2dp"
/>
</shape>
</item>
</selector>
</item>
<item
android:id=
"@android:id/secondaryProgress"
>
...
...
@@ -18,12 +30,26 @@
</item>
<item
android:id=
"@android:id/progress"
>
<clip>
<shape>
<corners
android:radius=
"4dp"
/>
<solid
android:color=
"@color/white"
/>
</shape>
</clip>
<selector>
<item
android:state_pressed=
"true"
>
<clip>
<shape>
<corners
android:radius=
"4dp"
/>
<solid
android:color=
"@color/white"
/>
<stroke
android:width=
"1dp"
/>
</shape>
</clip>
</item>
<item>
<clip>
<shape>
<corners
android:radius=
"4dp"
/>
<solid
android:color=
"@color/white"
/>
<stroke
android:width=
"2dp"
/>
</shape>
</clip>
</item>
</selector>
</item>
</layer-list>
\ No newline at end of file
m-confide/src/main/res/drawable/confide_seekbar_thumb.xml
View file @
123bc6a5
<?xml version="1.0" encoding="utf-8"?>
<selector
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<item
android:state_pressed=
"true"
>
<shape
android:shape=
"
oval
"
>
<shape
android:shape=
"
rectangle
"
>
<solid
android:color=
"@color/white"
/>
<size
android:width=
"6dp"
android:height=
"6dp"
/>
<size
android:width=
"6dp"
android:height=
"8dp"
/>
<corners
android:radius=
"2dp"
/>
</shape>
</item>
<item>
<item
android:state_pressed=
"false"
>
<shape
android:shape=
"oval"
>
<solid
android:color=
"@color/white"
/>
<size
android:width=
"6dp"
android:height=
"6dp"
/>
<size
android:width=
"8dp"
android:height=
"8dp"
/>
<stroke
android:width=
"2dp"
android:color=
"@color/transparent"
/>
</shape>
</item>
</selector>
\ No newline at end of file
m-confide/src/main/res/layout/item_expert_intro.xml
View file @
123bc6a5
...
...
@@ -52,11 +52,9 @@
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"23dp"
android:maxHeight=
"
4
dp"
android:maxHeight=
"
8
dp"
android:paddingStart=
"0dp"
android:paddingTop=
"4dp"
android:paddingEnd=
"0dp"
android:paddingBottom=
"4dp"
android:progressDrawable=
"@drawable/confide_seekbar_style"
android:splitTrack=
"false"
android:thumb=
"@drawable/confide_seekbar_thumb"
...
...
@@ -146,6 +144,7 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:textColor=
"@color/white"
android:text=
"@{item.count}"
android:textSize=
"13sp"
app:layout_constraintBottom_toBottomOf=
"@+id/tvName"
app:layout_constraintLeft_toRightOf=
"@+id/tvName"
...
...
@@ -201,6 +200,7 @@
android:layout_height=
"46dp"
android:layout_marginRight=
"10dp"
android:layout_marginBottom=
"20dp"
app:circle=
"@{true}"
app:imageUrl=
"@{item.avatar}"
app:layout_constraintBottom_toTopOf=
"@+id/btnChat"
app:layout_constraintRight_toRightOf=
"parent"
/>
...
...
ydl-utils/src/main/java/com/yidianling/common/binding/BindingAdapter1.kt
View file @
123bc6a5
...
...
@@ -7,10 +7,14 @@ import android.widget.ImageView
import
androidx.databinding.BindingAdapter
import
com.ydl.ydl_image.module.GlideApp
@BindingAdapter
(
"imageUrl"
)
fun
setImageUrl
(
imageView
:
ImageView
,
url
:
String
?)
{
@BindingAdapter
(
"imageUrl"
,
"circle"
,
requireAll
=
false
)
fun
setImageUrl
(
imageView
:
ImageView
,
url
:
String
?
,
circle
:
Boolean
=
false
)
{
if
(
url
.
isNullOrEmpty
())
return
GlideApp
.
with
(
imageView
).
load
(
url
).
into
(
imageView
)
if
(
circle
)
{
GlideApp
.
with
(
imageView
).
load
(
url
).
circleCrop
().
into
(
imageView
)
}
else
{
GlideApp
.
with
(
imageView
).
load
(
url
).
into
(
imageView
)
}
}
...
...
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