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
35428122
Commit
35428122
authored
Jul 20, 2023
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加推荐加载功能,未解锁视频不上送后台
parent
0a543b6c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
104 additions
and
31 deletions
+104
-31
FollowAdapter.kt
...main/java/com/xinfu/helivideo/ui/adapter/FollowAdapter.kt
+17
-2
FollowVideoFragment.kt
...va/com/xinfu/helivideo/ui/fragment/FollowVideoFragment.kt
+1
-0
DramaApiDetailActivity.kt
.../java/com/xinfu/helivideo/video/DramaApiDetailActivity.kt
+10
-5
RecommendVideoView.java
...java/com/xinfu/helivideo/video/tx/RecommendVideoView.java
+34
-2
TxVideoFragment.kt
...main/java/com/xinfu/helivideo/video/tx/TxVideoFragment.kt
+19
-4
item_follow.xml
video/app/src/main/res/layout/item_follow.xml
+10
-15
super_short_video_view.xml
video/app/src/main/res/layout/super_short_video_view.xml
+13
-3
No files found.
video/app/src/main/java/com/xinfu/helivideo/ui/adapter/FollowAdapter.kt
View file @
35428122
...
...
@@ -28,18 +28,33 @@ class FollowAdapter(var activity: Activity) :
}
holder
.
getView
<
View
>(
R
.
id
.
fm_mask
).
visibility
=
if
(
showEdit
)
View
.
VISIBLE
else
View
.
GONE
holder
.
getView
<
TextView
>(
R
.
id
.
title_tv
).
text
=
item
.
title
holder
.
getView
<
TextView
>(
R
.
id
.
info_tv
).
text
=
"观看至第${item.seeIndex}集"
holder
.
getView
<
TextView
>(
R
.
id
.
info_tv
).
text
=
"观看至第${item.seeIndex}集"
holder
.
getView
<
TextView
>(
R
.
id
.
complete_tv
).
text
=
if
(
item
.
completeStatus
==
0
)
"已完结"
else
"更新中"
GlideUtils
.
loadImageViewGifForCenterCrop
(
context
,
item
.
coverImage
,
holder
.
getView
(
R
.
id
.
image_iv
))
GlideUtils
.
loadImageViewGifForCenterCrop
(
context
,
item
.
coverImage
,
holder
.
getView
(
R
.
id
.
image_iv
)
)
}
// 设置编辑状态
fun
setEditStyle
(
showEdit
:
Boolean
)
{
this
.
showEdit
=
showEdit
// 清除选中状态
if
(!
this
.
showEdit
)
{
for
(
datum
in
data
)
{
datum
.
isChecked
=
false
}
}
notifyDataSetChanged
()
}
// 设置编辑状态
fun
getEditStyle
():
Boolean
{
return
this
.
showEdit
}
// 全选
fun
fullChoice
()
{
for
(
datum
in
data
)
{
...
...
video/app/src/main/java/com/xinfu/helivideo/ui/fragment/FollowVideoFragment.kt
View file @
35428122
...
...
@@ -68,6 +68,7 @@ class FollowVideoFragment : BaseFragment(), FollowView {
return
@setOnItemLongClickListener
false
}
followAdapter
?.
setOnItemClickListener
{
adapter
,
view
,
position
->
if
(
followAdapter
?.
getEditStyle
()
==
true
)
return
@setOnItemClickListener
LocalVedioManager
.
startVedioDetailActivityForType
(
requireActivity
(),
datas
[
position
]
...
...
video/app/src/main/java/com/xinfu/helivideo/video/DramaApiDetailActivity.kt
View file @
35428122
...
...
@@ -360,12 +360,17 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
if
(
mUnlockIndexMap
[
drama
.
id
]
!!
>
index
)
{
blockView
?.
visibility
=
View
.
GONE
}
mVedioBean
!!
.
seeIndex
=
index
mVedioBean
!!
.
orderTags
=
orderTagsList
LocalVedioManager
.
commitVedio
(
mVedioBean
!!
)
showVipCountDialog
(
index
-
1
)
return
index
>
unlockIndex
&&
hasUnlockList
.
contains
(
index
).
not
()
val
needBlock
=
index
>
unlockIndex
&&
hasUnlockList
.
contains
(
index
).
not
()
if
(!
needBlock
)
{
// 上送视频信息,若未解锁不上送
mVedioBean
!!
.
seeIndex
=
index
mVedioBean
!!
.
orderTags
=
orderTagsList
LocalVedioManager
.
commitVedio
(
mVedioBean
!!
)
showVipCountDialog
(
index
-
1
)
}
return
needBlock
}
override
fun
showAdIfNeeded
(
...
...
video/app/src/main/java/com/xinfu/helivideo/video/tx/RecommendVideoView.java
View file @
35428122
...
...
@@ -11,6 +11,8 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import
androidx.recyclerview.widget.PagerSnapHelper
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.scwang.smartrefresh.layout.SmartRefreshLayout
;
import
com.scwang.smartrefresh.layout.listener.OnLoadMoreListener
;
import
com.xinfu.helivideo.R
;
import
com.xinfu.helivideo.mvp.model.VedioBean
;
import
com.xinfu.helivideo.video.tx.adapter.TxRecommendVideoAdapter
;
...
...
@@ -24,6 +26,7 @@ public class RecommendVideoView extends RelativeLayout {
private
static
final
int
MAX_PLAYER_COUNT_ON_PASS
=
3
;
private
RecyclerView
mRecyclerView
;
private
SmartRefreshLayout
mSmartRefreshLayout
;
private
TxRecommendVideoAdapter
mAdapter
;
private
List
<
VideoModel
>
mUrlList
;
private
LinearLayoutManager
mLayoutManager
;
...
...
@@ -69,11 +72,23 @@ public class RecommendVideoView extends RelativeLayout {
mAdapter
.
setNewInstance
(
mList
);
}
public
void
loadMoreData
(
List
<
VedioBean
>
list
)
{
List
<
VideoModel
>
videoList
=
new
ArrayList
();
for
(
int
i
=
0
;
i
<
list
.
size
();
i
++)
{
videoList
.
add
(
new
VideoModel
(
list
.
get
(
i
).
getRecommendUrl
()));
}
this
.
mList
.
addAll
(
list
);
mUrlList
.
addAll
(
videoList
);
mAdapter
.
notifyItemRangeInserted
(
this
.
mList
.
size
()
-
list
.
size
(),
list
.
size
());
}
public
void
init
(
Context
context
)
{
View
mRootView
=
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
super_short_video_view
,
null
);
addView
(
mRootView
);
mPlayerManager
=
new
PlayerManager
(
getContext
());
mRecyclerView
=
mRootView
.
findViewById
(
R
.
id
.
rv_super_short_video
);
mSmartRefreshLayout
=
mRootView
.
findViewById
(
R
.
id
.
src_video
);
mSmartRefreshLayout
.
setEnableRefresh
(
false
);
mUrlList
=
new
ArrayList
<>();
mSnapHelper
=
new
PagerSnapHelper
();
mSnapHelper
.
attachToRecyclerView
(
mRecyclerView
);
...
...
@@ -86,7 +101,7 @@ public class RecommendVideoView extends RelativeLayout {
}
};
mRecyclerView
.
setLayoutManager
(
mLayoutManager
);
mRecyclerView
.
setItemViewCacheSize
(
6
);
mRecyclerView
.
setItemViewCacheSize
(
10
);
mRecyclerView
.
setHasFixedSize
(
true
);
mRecyclerView
.
setDrawingCacheEnabled
(
true
);
mRecyclerView
.
setDrawingCacheQuality
(
View
.
DRAWING_CACHE_QUALITY_LOW
);
...
...
@@ -125,6 +140,8 @@ public class RecommendVideoView extends RelativeLayout {
private
void
onPageSelectedMethod
(
int
position
)
{
if
(
mOnPageChangeListener
!=
null
)
mOnPageChangeListener
.
onPageChange
(
position
);
if
(
position
>=
mUrlList
.
size
())
return
;
if
(
mLastPositionInIDLE
!=
position
)
{
View
view
=
mSnapHelper
.
findSnapView
(
mLayoutManager
);
if
(
view
==
null
)
{
...
...
@@ -135,7 +152,7 @@ public class RecommendVideoView extends RelativeLayout {
List
<
VideoModel
>
tempUrlList
=
initUrlList
(
position
,
MAX_PLAYER_COUNT_ON_PASS
);
mPlayerManager
.
updateManager
(
tempUrlList
);
TXVodPlayerWrapper
txVodPlayerWrapper
=
mPlayerManager
.
getPlayer
(
mUrlList
.
get
(
position
));
if
(
txVodPlayerWrapper
!=
null
)
{
if
(
txVodPlayerWrapper
!=
null
)
{
Log
.
i
(
TAG
,
"txVodPlayerWrapper "
+
txVodPlayerWrapper
+
"url-- "
+
mUrlList
.
get
(
position
).
videoURL
);
Log
.
i
(
TAG
,
"txVodPlayerWrapper "
+
txVodPlayerWrapper
);
mBaseItemView
.
setTXVodPlayer
(
txVodPlayerWrapper
);
...
...
@@ -234,4 +251,19 @@ public class RecommendVideoView extends RelativeLayout {
public
void
setOnVideoEndListener
(
TXVideoBaseView
.
OnVideoEndListener
onVideoEndListener
)
{
mAdapter
.
setOnVideoEndListener
(
onVideoEndListener
);
}
public
void
hideLoadMore
()
{
mSmartRefreshLayout
.
finishLoadMore
();
mSmartRefreshLayout
.
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
mRecyclerView
.
smoothScrollToPosition
(
mCurrentPosition
);
}
},
200
);
}
public
void
setOnLoadMoreListener
(
OnLoadMoreListener
onLoadMoreListener
)
{
mSmartRefreshLayout
.
setOnLoadMoreListener
(
onLoadMoreListener
);
}
}
video/app/src/main/java/com/xinfu/helivideo/video/tx/TxVideoFragment.kt
View file @
35428122
...
...
@@ -15,7 +15,6 @@ import com.xinfu.helivideo.ui.fragment.base.BaseFragment
import
com.xinfu.helivideo.video.tx.adapter.TxRecommendVideoAdapter
import
kotlinx.android.synthetic.main.fragment_tx_video.*
/**
* @author Assen
* @date 2023/7/5
...
...
@@ -26,6 +25,7 @@ class TxVideoFragment : BaseFragment(), RecommendView {
private
val
recommendPresenter
by
lazy
{
RecommendPresenter
()
}
var
videos
=
arrayListOf
<
VedioBean
>()
private
var
recommendPage
=
1
// 分页
companion
object
{
fun
newInstance
():
Fragment
{
...
...
@@ -41,6 +41,10 @@ class TxVideoFragment : BaseFragment(), RecommendView {
recommendPresenter
.
autoList
()
recommend_view
.
setOnLoadMoreListener
{
recommendPage
++
recommendPresenter
.
autoList
()
}
recommend_view
.
setOnVideoEndListener
{
videos
[
recommend_view
.
currentPosition
].
recommendIndex
++
LocalVedioManager
.
startVedioDetailActivityForType
(
...
...
@@ -118,9 +122,20 @@ class TxVideoFragment : BaseFragment(), RecommendView {
}
override
fun
autoListSuc
(
list
:
BannerList
)
{
videos
.
clear
()
videos
.
addAll
(
list
.
list
)
recommend_view
.
loadData
(
videos
)
val
list1
=
arrayListOf
<
VedioBean
>()
for
(
i
in
0
..
2
)
{
list1
.
add
(
list
.
list
[
i
])
}
if
(
recommendPage
==
1
)
{
videos
.
clear
()
videos
.
addAll
(
list1
)
recommend_view
.
loadData
(
list1
)
}
else
{
videos
.
addAll
(
list1
)
recommend_view
.
loadMoreData
(
list1
)
recommend_view
.
hideLoadMore
()
}
}
override
fun
autoListFail
()
{
...
...
video/app/src/main/res/layout/item_follow.xml
View file @
35428122
...
...
@@ -2,7 +2,7 @@
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
android:layout_width=
"match_parent"
android:layout_height=
"
wrap_content
"
android:layout_height=
"
206dp
"
android:layout_marginTop=
"4dp"
android:layout_marginBottom=
"6dp"
android:orientation=
"vertical"
...
...
@@ -13,13 +13,12 @@
android:id=
"@+id/image_iv"
android:layout_width=
"match_parent"
android:layout_height=
"150dp"
android:scaleType=
"
fitXY
"
android:scaleType=
"
centerCrop
"
android:src=
"@mipmap/ic_launcher_main"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
/>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
...
...
@@ -31,11 +30,11 @@
android:id=
"@+id/complete_tv"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_alignParentEnd=
"true"
android:gravity=
"right"
android:padding
Lef
t=
"6dp"
android:padding
Star
t=
"6dp"
android:paddingTop=
"2dp"
android:paddingRight=
"8dp"
android:layout_alignParentRight=
"true"
android:paddingEnd=
"8dp"
android:paddingBottom=
"2dp"
android:text=
"已完结"
android:textColor=
"@color/white"
...
...
@@ -44,7 +43,7 @@
<TextView
android:id=
"@+id/title_tv"
android:layout_width=
"
106dp
"
android:layout_width=
"
match_parent
"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"10dp"
android:ellipsize=
"end"
...
...
@@ -70,25 +69,21 @@
<FrameLayout
android:id=
"@+id/fm_mask"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@drawable/shape_half_trans2"
app:layout_constraintEnd_toEndOf=
"@id/image_iv"
app:layout_constraintStart_toStartOf=
"@id/image_iv"
app:layout_constraintTop_toTopOf=
"@id/image_iv"
>
android:layout_height=
"match_parent"
android:background=
"@drawable/shape_half_trans2"
>
<CheckBox
android:id=
"@+id/cb"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_gravity=
"end"
android:background=
"@null"
android:button=
"@null"
android:drawableEnd=
"@drawable/selector_cb"
android:minWidth=
"100dp"
android:paddingTop=
"10dp"
android:paddingEnd=
"6dp"
android:paddingBottom=
"17
4
dp"
/>
android:paddingBottom=
"17
0
dp"
/>
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
video/app/src/main/res/layout/super_short_video_view.xml
View file @
35428122
<?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"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
>
<
androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/
rv_super_short
_video"
<
com.scwang.smartrefresh.layout.SmartRefreshLayout
android:id=
"@+id/
src
_video"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
android:layout_height=
"match_parent"
app:srlAccentColor=
"@color/black"
app:srlPrimaryColor=
"#f0f2f5"
>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/rv_super_short_video"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
</com.scwang.smartrefresh.layout.SmartRefreshLayout>
</RelativeLayout>
\ No newline at end of file
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