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
44865996
Commit
44865996
authored
Jul 23, 2023
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
开通vip后更新页面状态
parent
bc053e74
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
247 additions
and
158 deletions
+247
-158
compiler.xml
video/.idea/compiler.xml
+1
-1
misc.xml
video/.idea/misc.xml
+1
-2
Constant.kt
.../app/src/main/java/com/xinfu/helivideo/common/Constant.kt
+4
-0
MainFragment.kt
...main/java/com/xinfu/helivideo/ui/fragment/MainFragment.kt
+5
-0
DramaApiDetailActivity.kt
.../java/com/xinfu/helivideo/video/DramaApiDetailActivity.kt
+145
-95
TxVideoActivity.kt
...rc/main/java/com/xinfu/helivideo/video/TxVideoActivity.kt
+47
-30
SuperShortVideoView.java
...ava/com/xinfu/helivideo/video/tx/SuperShortVideoView.java
+1
-0
TXVideoBaseView.java
...in/java/com/xinfu/helivideo/video/tx/TXVideoBaseView.java
+5
-0
TXVodPlayerWrapper.java
...java/com/xinfu/helivideo/video/tx/TXVodPlayerWrapper.java
+4
-0
TxVideoAdapter.kt
...va/com/xinfu/helivideo/video/tx/adapter/TxVideoAdapter.kt
+34
-30
No files found.
video/.idea/compiler.xml
View file @
44865996
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"CompilerConfiguration"
>
<bytecodeTargetLevel
target=
"1
1
"
/>
<bytecodeTargetLevel
target=
"1
7
"
/>
</component>
</project>
\ No newline at end of file
video/.idea/misc.xml
View file @
44865996
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<component
name=
"ExternalStorageConfigurationManager"
enabled=
"true"
/>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1
1"
default=
"true"
project-jdk-name=
"Android Studio default JDK
"
project-jdk-type=
"JavaSDK"
>
<component
name=
"ProjectRootManager"
version=
"2"
languageLevel=
"JDK_1
7"
default=
"true"
project-jdk-name=
"jbr-17
"
project-jdk-type=
"JavaSDK"
>
<output
url=
"file://$PROJECT_DIR$/build/classes"
/>
</component>
<component
name=
"ProjectType"
>
...
...
video/app/src/main/java/com/xinfu/helivideo/common/Constant.kt
View file @
44865996
...
...
@@ -35,6 +35,10 @@ object Constant {
const
val
FRAGMENT_CLICK_THREE
=
2
const
val
VIP_REQUEST_CODE
=
0
x111
// 协议地址
var
REGISTER_URL
=
"http://mints-web.mints-id.com/agreements/helivideo/yhxy.html"
//注册协议
var
PRIVACY_URL
=
"http://mints-web.mints-id.com/agreements/helivideo/syzc.html"
//隐私协议
...
...
video/app/src/main/java/com/xinfu/helivideo/ui/fragment/MainFragment.kt
View file @
44865996
...
...
@@ -292,6 +292,11 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
get
().
put
(
Constant
.
IS_FIRST_VEDIO
,
true
)
if
(
data
!=
null
&&
data
.
vedioMsg
!=
null
)
{
LocalVedioManager
.
startVedioDetailActivityForType
(
requireActivity
(),
data
.
vedioMsg
)
}
else
{
if
(
UserManager
.
getInstance
().
newFlag
&&
!
UserManager
.
getInstance
().
vipFlag
)
{
readyGo
(
VipActivity
::
class
.
java
)
}
}
}
...
...
video/app/src/main/java/com/xinfu/helivideo/video/DramaApiDetailActivity.kt
View file @
44865996
This diff is collapsed.
Click to expand it.
video/app/src/main/java/com/xinfu/helivideo/video/TxVideoActivity.kt
View file @
44865996
package
com.xinfu.helivideo.video
import
android.app.Dialog
import
android.content.Intent
import
android.os.Bundle
import
android.os.Handler
import
android.os.Looper
import
android.view.KeyEvent
import
android.view.View
import
com.google.gson.Gson
import
com.xinfu.helivideo.R
...
...
@@ -20,7 +20,6 @@ import com.xinfu.helivideo.mvp.model.VedioBean
import
com.xinfu.helivideo.mvp.model.VideoMultiItemEntity
import
com.xinfu.helivideo.mvp.presenters.VideoPresenter
import
com.xinfu.helivideo.mvp.views.VideoView
import
com.xinfu.helivideo.ui.activitys.MainActivity
import
com.xinfu.helivideo.ui.activitys.VipActivity
import
com.xinfu.helivideo.ui.activitys.base.BaseActivity
import
com.xinfu.helivideo.ui.adapter.VideoEpisodeAdapter
...
...
@@ -32,7 +31,7 @@ import com.xinfu.library.utils.nodoubleclick.AntiShake
import
kotlinx.android.synthetic.main.activity_tx_video.*
class
TxVideoActivity
:
BaseActivity
(),
View
.
OnClickListener
,
VideoView
,
VideoEpisodeAdapter
.
OnEpisodeClickListener
,
TxVideoAdapter
.
OnCustomChildClickListener
{
VideoEpisodeAdapter
.
OnEpisodeClickListener
,
TxVideoAdapter
.
OnCustomChildClickListener
{
var
videos
=
ArrayList
<
VedioEpisodeBean
>()
...
...
@@ -90,9 +89,9 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
private
fun
initView
()
{
episode_tv
.
text
=
String
.
format
(
"共%d集 %s"
,
mVedioBean
?.
vedioTotal
,
if
(
mVedioBean
?.
completeStatus
==
0
)
"已完结"
else
"更新中"
"共%d集 %s"
,
mVedioBean
?.
vedioTotal
,
if
(
mVedioBean
?.
completeStatus
==
0
)
"已完结"
else
"更新中"
)
super_short_video_view
.
setOnCustomChildClickListener
(
this
)
...
...
@@ -118,9 +117,11 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
R
.
id
.
close_iv
->
{
finish
()
}
R
.
id
.
fm_bottom
->
{
showEpisodeDialog
()
}
else
->
{}
}
}
...
...
@@ -227,26 +228,28 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
}
}
}
R
.
id
.
leave
->
{
// 返回
finish
()
}
R
.
id
.
unlock
->
{
// 看广告解锁
val
carrierType
=
Constant
.
CARRIERTYPE_TX_VEDIO
AdManager
.
instance
.
showAd
(
this
,
carrierType
,
object
:
AdStatusListener
{
var
canFail
=
false
override
fun
adSuccess
()
{
canFail
=
true
}
override
fun
adFail
()
{
if
(
canFail
)
return
NoPreAdManager
.
loadVideoAd
(
this
@TxVideoActivity
,
carrierType
,
object
:
AdStatusListener
{
object
:
AdStatusListener
{
var
canFail
=
false
override
fun
adSuccess
()
{
canFail
=
true
}
override
fun
adFail
()
{
if
(
canFail
)
return
NoPreAdManager
.
loadVideoAd
(
this
@TxVideoActivity
,
carrierType
,
object
:
AdStatusListener
{
override
fun
adFail
()
{
showToast
(
"广告太火爆了,请稍候再试"
)
}
...
...
@@ -261,24 +264,26 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
}
}
})
}
}
override
fun
adClose
(
vo
:
HashMap
<
String
,
Any
>?)
{
vo
?.
let
{
vo
[
"vedioId"
]
=
mVedioBean
!!
.
vedioId
videoPresenter
.
unlock
(
vo
)
override
fun
adClose
(
vo
:
HashMap
<
String
,
Any
>?)
{
vo
?.
let
{
vo
[
"vedioId"
]
=
mVedioBean
!!
.
vedioId
videoPresenter
.
unlock
(
vo
)
}
}
}
})
})
}
R
.
id
.
vip
->
{
// 开通VIP
val
bundle
=
Bundle
()
bundle
.
putString
(
VipActivity
.
VEDIO_ID
,
mVedioBean
!!
.
vedioId
.
toString
())
bundle
.
putString
(
VipActivity
.
THIRD_ID
,
mVedioBean
!!
.
thirdId
)
readyGo
(
VipActivity
::
class
.
java
,
bundle
)
readyGo
ForResult
(
VipActivity
::
class
.
java
,
Constant
.
VIP_REQUEST_CODE
,
bundle
)
}
else
->
{}
}
}
...
...
@@ -291,13 +296,25 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
}
VipCountDialog
(
this
,
mVedioBean
!!
,
tipList
)
.
setOnDialogDismiss
(
object
:
VipCountDialog
.
OnDialogDismiss
{
override
fun
onDialogDismiss
()
{}
})
.
show
()
.
setOnDialogDismiss
(
object
:
VipCountDialog
.
OnDialogDismiss
{
override
fun
onDialogDismiss
()
{}
})
.
show
()
}
private
fun
getPosition
()
=
super_short_video_view
.
currentPosition
override
fun
onActivityResult
(
requestCode
:
Int
,
resultCode
:
Int
,
data
:
Intent
?)
{
super
.
onActivityResult
(
requestCode
,
resultCode
,
data
)
if
(
requestCode
==
Constant
.
VIP_REQUEST_CODE
)
{
if
(
UserManager
.
getInstance
().
vipFlag
)
{
// 重置状态
isPlayNext
=
false
playIndex
=
super_short_video_view
.
currentPosition
mVedioBean
?.
let
{
videoPresenter
.
getIndexList
(
""
+
it
.
vedioId
)
}
}
}
}
}
\ No newline at end of file
video/app/src/main/java/com/xinfu/helivideo/video/tx/SuperShortVideoView.java
View file @
44865996
...
...
@@ -79,6 +79,7 @@ public class SuperShortVideoView extends RelativeLayout {
videoList
.
add
(
new
VideoModel
(
list
.
get
(
i
).
getVideo
().
getVedioUrl
()));
}
}
mUrlList
.
clear
();
mUrlList
.
addAll
(
videoList
);
mAdapter
.
setVedioBean
(
vedioBean
);
mAdapter
.
setNewInstance
(
mList
);
...
...
video/app/src/main/java/com/xinfu/helivideo/video/tx/TXVideoBaseView.java
View file @
44865996
...
...
@@ -260,6 +260,11 @@ public class TXVideoBaseView extends RelativeLayout implements View.OnClickListe
}
}
@Override
public
void
onResume
()
{
mIvCover
.
setVisibility
(
GONE
);
}
public
void
setOnVideoEndListener
(
OnVideoEndListener
onVideoEndListener
)
{
this
.
mOnVideoEndListener
=
onVideoEndListener
;
}
...
...
video/app/src/main/java/com/xinfu/helivideo/video/tx/TXVodPlayerWrapper.java
View file @
44865996
...
...
@@ -58,6 +58,9 @@ public class TXVodPlayerWrapper implements ITXVodPlayListener {
+
mVodPlayer
.
hashCode
()
+
" mUrl "
+
mUrl
);
if
(
mStartOnPrepare
)
{
mVodPlayer
.
resume
();
if
(
mOnPlayEventChangedListener
!=
null
)
{
mOnPlayEventChangedListener
.
onResume
();
}
mStartOnPrepare
=
false
;
playerStatusChanged
(
TxVodStatus
.
TX_VIDEO_PLAYER_STATUS_PLAYING
);
}
...
...
@@ -182,6 +185,7 @@ public class TXVodPlayerWrapper implements ITXVodPlayListener {
void
onRcvFirstFrame
();
void
onEnded
();
void
onResume
();
}
public
TXVodPlayer
getVodPlayer
()
{
...
...
video/app/src/main/java/com/xinfu/helivideo/video/tx/adapter/TxVideoAdapter.kt
View file @
44865996
...
...
@@ -3,6 +3,7 @@ package com.xinfu.helivideo.video.tx.adapter
import
android.view.View
import
android.widget.LinearLayout
import
android.widget.TextView
import
android.widget.Toast
import
com.airbnb.lottie.LottieAnimationView
import
com.airbnb.lottie.LottieComposition
import
com.airbnb.lottie.LottieCompositionFactory
...
...
@@ -16,7 +17,6 @@ import com.xinfu.helivideo.manager.UserManager
import
com.xinfu.helivideo.mvp.model.VedioBean
import
com.xinfu.helivideo.mvp.model.VideoMultiItemEntity
import
com.xinfu.helivideo.video.tx.TXVideoBaseView
import
kotlinx.android.synthetic.main.fragment_main_my.*
class
TxVideoAdapter
:
BaseMultiItemQuickAdapter
<
VideoMultiItemEntity
,
BaseViewHolder
>()
{
...
...
@@ -37,17 +37,17 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH
private
fun
initLockHolder
(
holder
:
BaseViewHolder
)
{
Glide
.
with
(
context
).
load
(
vedioBean
?.
coverImage
)
.
into
(
holder
.
getView
(
R
.
id
.
iv_bg
))
.
into
(
holder
.
getView
(
R
.
id
.
iv_bg
))
val
vipBtn
=
holder
.
getView
<
View
>(
R
.
id
.
vip
)
if
(
UserManager
.
getInstance
().
newFlag
)
{
// 匹配
vipBtn
.
visibility
=
View
.
VISIBLE
vipBtn
.
visibility
=
View
.
VISIBLE
vipBtn
.
setOnClickListener
{
mOnCustomChildClickListener
?.
onCustomChildClick
(
it
,
holder
.
adapterPosition
)
}
}
else
{
// 未匹配
vipBtn
.
visibility
=
View
.
GONE
vipBtn
.
visibility
=
View
.
GONE
}
holder
.
getView
<
TextView
>(
R
.
id
.
unlock
).
text
=
"看广告解锁"
+
vedioBean
?.
adGiveVedioNum
+
"集"
...
...
@@ -65,9 +65,9 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH
holder
.
setText
(
R
.
id
.
zan_num_tv
,
""
+
vedioBean
?.
hot
)
//缩略图
Glide
.
with
(
context
).
load
(
vedioBean
?.
coverImage
)
.
skipMemoryCache
(
true
)
.
diskCacheStrategy
(
DiskCacheStrategy
.
ALL
).
centerCrop
()
.
into
(
holder
.
getView
<
TXVideoBaseView
>(
R
.
id
.
baseItemView
).
findViewById
(
R
.
id
.
iv_cover
))
.
skipMemoryCache
(
true
)
.
diskCacheStrategy
(
DiskCacheStrategy
.
ALL
).
centerCrop
()
.
into
(
holder
.
getView
<
TXVideoBaseView
>(
R
.
id
.
baseItemView
).
findViewById
(
R
.
id
.
iv_cover
))
holder
.
getView
<
LinearLayout
>(
R
.
id
.
ll_collect
).
setOnClickListener
{
mOnCustomChildClickListener
?.
onCustomChildClick
(
it
,
holder
.
adapterPosition
)
...
...
@@ -87,15 +87,19 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH
}
holder
.
getView
<
TXVideoBaseView
>(
R
.
id
.
baseItemView
)
.
setOnVideoEndListener
(
mOnVideoEndListener
)
.
setOnVideoEndListener
(
mOnVideoEndListener
)
}
override
fun
onViewDetachedFromWindow
(
holder
:
BaseViewHolder
)
{
super
.
onViewDetachedFromWindow
(
holder
)
if
(
holder
.
itemViewType
==
VideoMultiItemEntity
.
MULTI_ITEM_1
)
{
holder
.
getView
<
TXVideoBaseView
>(
R
.
id
.
baseItemView
).
pausePlayer
()
holder
.
getView
<
TXVideoBaseView
>(
R
.
id
.
baseItemView
).
stopForPlaying
()
vedioBean
?.
let
{
if
(
it
.
seeIndex
!=
holder
.
layoutPosition
+
1
)
{
holder
.
getView
<
TXVideoBaseView
>(
R
.
id
.
baseItemView
).
pausePlayer
()
holder
.
getView
<
TXVideoBaseView
>(
R
.
id
.
baseItemView
).
stopForPlaying
()
}
}
}
}
...
...
@@ -109,44 +113,44 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH
private
fun
setCollectImage
(
view
:
LottieAnimationView
)
{
val
lottieDrawable
=
LottieDrawable
()
LottieCompositionFactory
.
fromAsset
(
context
,
"home_collect.json"
)
.
addListener
{
result
:
LottieComposition
?
->
lottieDrawable
.
setImagesAssetsFolder
(
"images/"
)
lottieDrawable
.
composition
=
result
}
.
addListener
{
result
:
LottieComposition
?
->
lottieDrawable
.
setImagesAssetsFolder
(
"images/"
)
lottieDrawable
.
composition
=
result
}
view
.
setImageDrawable
(
lottieDrawable
)
}
private
fun
setCancelCollectImage
(
view
:
LottieAnimationView
)
{
val
lottieDrawable
=
LottieDrawable
()
LottieCompositionFactory
.
fromAsset
(
context
,
"home_cancel_collect.json"
)
.
addListener
{
result
:
LottieComposition
?
->
lottieDrawable
.
setImagesAssetsFolder
(
"images/"
)
lottieDrawable
.
composition
=
result
}
.
addListener
{
result
:
LottieComposition
?
->
lottieDrawable
.
setImagesAssetsFolder
(
"images/"
)
lottieDrawable
.
composition
=
result
}
view
.
setImageDrawable
(
lottieDrawable
)
}
private
fun
playCollectAnim
(
view
:
LottieAnimationView
)
{
val
lottieDrawable
=
LottieDrawable
()
LottieCompositionFactory
.
fromAsset
(
context
,
"home_collect.json"
)
.
addListener
{
result
:
LottieComposition
?
->
lottieDrawable
.
setImagesAssetsFolder
(
"images/"
)
lottieDrawable
.
composition
=
result
lottieDrawable
.
loop
(
false
)
lottieDrawable
.
playAnimation
()
}
.
addListener
{
result
:
LottieComposition
?
->
lottieDrawable
.
setImagesAssetsFolder
(
"images/"
)
lottieDrawable
.
composition
=
result
lottieDrawable
.
loop
(
false
)
lottieDrawable
.
playAnimation
()
}
view
.
setImageDrawable
(
lottieDrawable
)
}
private
fun
playCancelCollectAnim
(
view
:
LottieAnimationView
)
{
val
lottieDrawable
=
LottieDrawable
()
LottieCompositionFactory
.
fromAsset
(
context
,
"home_cancel_collect.json"
)
.
addListener
{
result
:
LottieComposition
?
->
lottieDrawable
.
setImagesAssetsFolder
(
"images/"
)
lottieDrawable
.
composition
=
result
lottieDrawable
.
loop
(
false
)
lottieDrawable
.
playAnimation
()
}
.
addListener
{
result
:
LottieComposition
?
->
lottieDrawable
.
setImagesAssetsFolder
(
"images/"
)
lottieDrawable
.
composition
=
result
lottieDrawable
.
loop
(
false
)
lottieDrawable
.
playAnimation
()
}
view
.
setImageDrawable
(
lottieDrawable
)
}
...
...
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