Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_vedio
Project
Project
Details
Activity
Releases
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
android
android_vedio
Commits
48e2cea2
Commit
48e2cea2
authored
Jul 18, 2023
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
a7c3260f
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
10 deletions
+22
-10
RecommendVideoView.java
...java/com/xinfu/helivideo/video/tx/RecommendVideoView.java
+7
-0
TxVideoFragment.kt
...main/java/com/xinfu/helivideo/video/tx/TxVideoFragment.kt
+4
-1
TxRecommendVideoAdapter.kt
...nfu/helivideo/video/tx/adapter/TxRecommendVideoAdapter.kt
+3
-1
fragment_main.xml
video/app/src/main/res/layout/fragment_main.xml
+8
-8
No files found.
video/app/src/main/java/com/xinfu/helivideo/video/tx/RecommendVideoView.java
View file @
48e2cea2
...
@@ -53,6 +53,13 @@ public class RecommendVideoView extends RelativeLayout {
...
@@ -53,6 +53,13 @@ public class RecommendVideoView extends RelativeLayout {
}
}
public
void
loadData
(
List
<
VedioBean
>
list
)
{
public
void
loadData
(
List
<
VedioBean
>
list
)
{
if
(
this
.
mList
!=
null
)
{
this
.
mList
.
clear
();
}
if
(
this
.
mUrlList
!=
null
)
{
this
.
mUrlList
.
clear
();
}
this
.
mList
=
list
;
this
.
mList
=
list
;
List
<
VideoModel
>
videoList
=
new
ArrayList
();
List
<
VideoModel
>
videoList
=
new
ArrayList
();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
...
...
video/app/src/main/java/com/xinfu/helivideo/video/tx/TxVideoFragment.kt
View file @
48e2cea2
...
@@ -39,6 +39,8 @@ class TxVideoFragment : BaseFragment(), RecommendView {
...
@@ -39,6 +39,8 @@ class TxVideoFragment : BaseFragment(), RecommendView {
override
fun
initViewsAndEvents
()
{
override
fun
initViewsAndEvents
()
{
recommendPresenter
.
attachView
(
this
)
recommendPresenter
.
attachView
(
this
)
recommendPresenter
.
autoList
()
recommend_view
.
setOnVideoEndListener
{
recommend_view
.
setOnVideoEndListener
{
videos
[
recommend_view
.
currentPosition
].
recommendIndex
++
videos
[
recommend_view
.
currentPosition
].
recommendIndex
++
LocalVedioManager
.
startVedioDetailActivityForType
(
LocalVedioManager
.
startVedioDetailActivityForType
(
...
@@ -61,8 +63,10 @@ class TxVideoFragment : BaseFragment(), RecommendView {
...
@@ -61,8 +63,10 @@ class TxVideoFragment : BaseFragment(), RecommendView {
}
}
R
.
id
.
ll_collect
->
{
R
.
id
.
ll_collect
->
{
if
(
videos
[
position
].
collect
==
0
)
{
if
(
videos
[
position
].
collect
==
0
)
{
videos
[
position
].
collect
=
1
recommendPresenter
.
collect
(
""
+
videos
[
position
].
vedioId
)
recommendPresenter
.
collect
(
""
+
videos
[
position
].
vedioId
)
}
else
{
}
else
{
videos
[
position
].
collect
=
0
recommendPresenter
.
cancelCollect
(
""
+
videos
[
position
].
vedioId
)
recommendPresenter
.
cancelCollect
(
""
+
videos
[
position
].
vedioId
)
}
}
}
}
...
@@ -78,7 +82,6 @@ class TxVideoFragment : BaseFragment(), RecommendView {
...
@@ -78,7 +82,6 @@ class TxVideoFragment : BaseFragment(), RecommendView {
super
.
onResume
()
super
.
onResume
()
if
(
AppConfig
.
fragmentClickFlag
!=
Constant
.
FRAGMENT_CLICK_TWO
)
return
if
(
AppConfig
.
fragmentClickFlag
!=
Constant
.
FRAGMENT_CLICK_TWO
)
return
recommendPresenter
.
autoList
()
recommend_view
.
resume
()
recommend_view
.
resume
()
}
}
...
...
video/app/src/main/java/com/xinfu/helivideo/video/tx/adapter/TxRecommendVideoAdapter.kt
View file @
48e2cea2
...
@@ -43,12 +43,12 @@ class TxRecommendVideoAdapter :
...
@@ -43,12 +43,12 @@ class TxRecommendVideoAdapter :
holder
.
setText
(
R
.
id
.
tv_collect_num
,
item
.
hot
)
holder
.
setText
(
R
.
id
.
tv_collect_num
,
item
.
hot
)
holder
.
getView
<
View
>(
R
.
id
.
ll_collect
).
setOnClickListener
{
holder
.
getView
<
View
>(
R
.
id
.
ll_collect
).
setOnClickListener
{
mOnCustomChildClickListener
?.
onCustomChildClick
(
it
,
holder
.
adapterPosition
)
if
(
item
.
collect
==
0
)
{
if
(
item
.
collect
==
0
)
{
playCollectAnim
(
holder
.
getView
(
R
.
id
.
iv_collect
))
playCollectAnim
(
holder
.
getView
(
R
.
id
.
iv_collect
))
}
else
{
}
else
{
playCancelCollectAnim
(
holder
.
getView
(
R
.
id
.
iv_collect
))
playCancelCollectAnim
(
holder
.
getView
(
R
.
id
.
iv_collect
))
}
}
mOnCustomChildClickListener
?.
onCustomChildClick
(
it
,
holder
.
adapterPosition
)
}
}
holder
.
getView
<
View
>(
R
.
id
.
ll_bottom
).
setOnClickListener
{
holder
.
getView
<
View
>(
R
.
id
.
ll_bottom
).
setOnClickListener
{
mOnCustomChildClickListener
?.
onCustomChildClick
(
it
,
holder
.
adapterPosition
)
mOnCustomChildClickListener
?.
onCustomChildClick
(
it
,
holder
.
adapterPosition
)
...
@@ -90,6 +90,7 @@ class TxRecommendVideoAdapter :
...
@@ -90,6 +90,7 @@ class TxRecommendVideoAdapter :
}
}
private
fun
playCollectAnim
(
view
:
LottieAnimationView
)
{
private
fun
playCollectAnim
(
view
:
LottieAnimationView
)
{
view
.
setImageDrawable
(
null
)
val
lottieDrawable
=
LottieDrawable
()
val
lottieDrawable
=
LottieDrawable
()
LottieCompositionFactory
.
fromAsset
(
context
,
"home_collect.json"
)
LottieCompositionFactory
.
fromAsset
(
context
,
"home_collect.json"
)
.
addListener
{
result
:
LottieComposition
?
->
.
addListener
{
result
:
LottieComposition
?
->
...
@@ -102,6 +103,7 @@ class TxRecommendVideoAdapter :
...
@@ -102,6 +103,7 @@ class TxRecommendVideoAdapter :
}
}
private
fun
playCancelCollectAnim
(
view
:
LottieAnimationView
)
{
private
fun
playCancelCollectAnim
(
view
:
LottieAnimationView
)
{
view
.
setImageDrawable
(
null
)
val
lottieDrawable
=
LottieDrawable
()
val
lottieDrawable
=
LottieDrawable
()
LottieCompositionFactory
.
fromAsset
(
context
,
"home_cancel_collect.json"
)
LottieCompositionFactory
.
fromAsset
(
context
,
"home_cancel_collect.json"
)
.
addListener
{
result
:
LottieComposition
?
->
.
addListener
{
result
:
LottieComposition
?
->
...
...
video/app/src/main/res/layout/fragment_main.xml
View file @
48e2cea2
...
@@ -112,14 +112,6 @@
...
@@ -112,14 +112,6 @@
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.CollapsingToolbarLayout>
</com.google.android.material.appbar.AppBarLayout>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
app:layout_behavior=
"@string/appbar_scrolling_view_behavior"
>
<com.google.android.material.tabs.TabLayout
<com.google.android.material.tabs.TabLayout
android:id=
"@+id/tablayout"
android:id=
"@+id/tablayout"
android:layout_width=
"wrap_content"
android:layout_width=
"wrap_content"
...
@@ -135,6 +127,14 @@
...
@@ -135,6 +127,14 @@
app:tabPaddingStart=
"6dp"
app:tabPaddingStart=
"6dp"
app:tabRippleColor=
"@null"
/>
app:tabRippleColor=
"@null"
/>
</com.google.android.material.appbar.AppBarLayout>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
app:layout_behavior=
"@string/appbar_scrolling_view_behavior"
>
<androidx.viewpager2.widget.ViewPager2
<androidx.viewpager2.widget.ViewPager2
android:id=
"@+id/vp2"
android:id=
"@+id/vp2"
android:layout_width=
"match_parent"
android:layout_width=
"match_parent"
...
...
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