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
7b882a5f
Commit
7b882a5f
authored
Jul 31, 2023
by
jyx
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
倒计时弹框添加信息流,解锁页更新样式
parent
3c930a51
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
299 additions
and
102 deletions
+299
-102
DrawExpressManager.kt
...in/java/com/mints/helivideo/ad/draw/DrawExpressManager.kt
+3
-7
ExpressManager.kt
...ain/java/com/mints/helivideo/ad/express/ExpressManager.kt
+2
-1
LocalVedioManager.kt
...ain/java/com/mints/helivideo/manager/LocalVedioManager.kt
+5
-0
HomePresenter.kt
.../java/com/mints/helivideo/mvp/presenters/HomePresenter.kt
+4
-2
HomeView.kt
...p/src/main/java/com/mints/helivideo/mvp/views/HomeView.kt
+3
-0
MainActivity.kt
...ain/java/com/mints/helivideo/ui/activitys/MainActivity.kt
+0
-7
MainFragment.kt
...main/java/com/mints/helivideo/ui/fragment/MainFragment.kt
+34
-3
VipCountDialog.kt
...ain/java/com/mints/helivideo/ui/widgets/VipCountDialog.kt
+41
-2
DramaApiDetailActivity.kt
.../java/com/mints/helivideo/video/DramaApiDetailActivity.kt
+28
-11
TxVideoActivity.kt
...rc/main/java/com/mints/helivideo/video/TxVideoActivity.kt
+27
-19
SuperShortVideoView.java
...ava/com/mints/helivideo/video/tx/SuperShortVideoView.java
+23
-4
TxVideoAdapter.kt
...va/com/mints/helivideo/video/tx/adapter/TxVideoAdapter.kt
+24
-3
activity_main.xml
video/app/src/main/res/layout/activity_main.xml
+1
-1
dialog_vip_count.xml
video/app/src/main/res/layout/dialog_vip_count.xml
+11
-5
drama_activity_api_detail.xml
video/app/src/main/res/layout/drama_activity_api_detail.xml
+29
-17
fragment_main.xml
video/app/src/main/res/layout/fragment_main.xml
+41
-7
item_block_view.xml
video/app/src/main/res/layout/item_block_view.xml
+23
-13
No files found.
video/app/src/main/java/com/mints/helivideo/ad/draw/DrawExpressManager.kt
View file @
7b882a5f
...
...
@@ -36,8 +36,6 @@ class DrawExpressManager {
}
}
private
var
viewCache
=
Stack
<
FrameLayout
>()
private
var
adShowTime
:
Long
=
0
// 防止预加载超时 2秒
private
var
isShowAd
=
false
// 广告是否展示
...
...
@@ -131,11 +129,9 @@ class DrawExpressManager {
return
}
if
(
it
.
size
>
0
)
{
mTTFeedAd
=
it
[
0
]
isLoadSuccess
=
2
showAd
()
}
mTTFeedAd
=
it
[
0
]
isLoadSuccess
=
2
showAd
()
}
}
...
...
video/app/src/main/java/com/mints/helivideo/ad/express/ExpressManager.kt
View file @
7b882a5f
...
...
@@ -99,7 +99,7 @@ class ExpressManager {
* 2:如果是信息流自渲染广告,设置广告图片期望的图片宽高 ,不能为0
* 2:如果是信息流模板广告,宽度设置为希望的宽度,高度设置为0(0为高度选择自适应参数)
*/
.
setImageAcceptedSize
(
UIUtils
.
getAdWidth
(
activity
).
toInt
(),
0
)
.
setImageAcceptedSize
(
UIUtils
.
getAdWidth
(
MintsApplication
.
getContext
()
).
toInt
(),
0
)
.
setAdCount
(
1
)
//请求广告数量为1到3条 (优先采用平台配置的数量)
.
build
()
...
...
@@ -194,6 +194,7 @@ class ExpressManager {
private
fun
showExpressView
(
it
:
TTFeedAd
)
{
it
.
setExpressRenderListener
(
object
:
MediationExpressRenderListener
{
override
fun
onRenderSuccess
(
p0
:
View
?,
p1
:
Float
,
p2
:
Float
,
p3
:
Boolean
)
{
mExpressAdCallback
?.
renderSuccess
(
frameLayout
)
Log
.
i
(
TAG
,
"onRenderSuccess"
)
it
.
setDislikeCallback
(
ForegroundOrBackground
.
getTopActivity
(),
object
:
TTAdDislike
.
DislikeInteractionCallback
{
...
...
video/app/src/main/java/com/mints/helivideo/manager/LocalVedioManager.kt
View file @
7b882a5f
...
...
@@ -7,6 +7,7 @@ import android.text.TextUtils
import
com.bytedance.sdk.dp.DPDrama
import
com.bytedance.sdk.dp.DPSdk
import
com.bytedance.sdk.dp.IDPWidgetFactory
import
com.mints.helivideo.ad.express.ExpressManager
import
com.mints.library.utils.json.JsonUtil
import
com.mints.helivideo.common.Constant
import
com.mints.helivideo.mvp.model.VedioBean
...
...
@@ -98,6 +99,10 @@ object LocalVedioManager {
}
else
{
requestDrama
(
activity
,
data
)
}
if
(!
UserManager
.
getInstance
().
vipFlag
)
{
ExpressManager
.
instance
.
preLoadAd
()
}
}
// 请求穿山甲数据
...
...
video/app/src/main/java/com/mints/helivideo/mvp/presenters/HomePresenter.kt
View file @
7b882a5f
...
...
@@ -94,8 +94,10 @@ class HomePresenter : BasePresenter<HomeView>() {
200
->
{
val
data
=
baseResponse
.
data
if
(
data
!=
null
)
{
AppPreferencesManager
.
get
()
.
put
(
Constant
.
LUCKY_FLAG
,
data
.
isShow
)
view
.
showTurnSuc
(
data
)
// AppPreferencesManager.get()
// .put(Constant.LUCKY_FLAG, data.isShow)
// AppPreferencesManager.get()
// .put(Constant.LUCKY_COMPLETE, data.complete)
// AppPreferencesManager.get()
...
...
video/app/src/main/java/com/mints/helivideo/mvp/views/HomeView.kt
View file @
7b882a5f
...
...
@@ -3,6 +3,7 @@ package com.mints.helivideo.mvp.views
import
com.mints.helivideo.mvp.model.BannerList
import
com.mints.helivideo.mvp.model.HotStyleTypesList
import
com.mints.helivideo.mvp.model.IndexList
import
com.mints.helivideo.mvp.model.NineShowBean
interface
HomeView
:
BaseView
{
...
...
@@ -10,4 +11,6 @@ interface HomeView : BaseView {
fun
topTabsSuc
(
data
:
BannerList
?)
fun
ordersSuc
(
data
:
BannerList
?)
fun
getSoltVedioSuc
(
data
:
IndexList
?)
fun
showTurnSuc
(
data
:
NineShowBean
)
}
video/app/src/main/java/com/mints/helivideo/ui/activitys/MainActivity.kt
View file @
7b882a5f
...
...
@@ -8,7 +8,6 @@ import android.os.Bundle
import
android.view.Gravity
import
android.view.KeyEvent
import
android.view.View
import
android.widget.LinearLayout
import
android.widget.TextView
import
androidx.core.content.ContextCompat
import
androidx.fragment.app.Fragment
...
...
@@ -19,8 +18,6 @@ import com.lzf.easyfloat.anim.DefaultAnimator
import
com.lzf.easyfloat.enums.SidePattern
import
com.mints.helivideo.MintsApplication
import
com.mints.helivideo.R
import
com.mints.helivideo.ad.AdManager
import
com.mints.helivideo.ad.express.ExpressManager
import
com.mints.helivideo.common.AppConfig
import
com.mints.helivideo.common.Constant
import
com.mints.helivideo.ui.activitys.base.BaseActivity
...
...
@@ -41,7 +38,6 @@ class MainActivity : BaseActivity(), View.OnClickListener {
private
var
audioManager
:
AudioManager
?
=
null
var
contentLayout
:
LinearLayout
?
=
null
var
tabIvLoan
:
TextView
?
=
null
var
tabIvRecommend
:
TextView
?
=
null
var
tabIvMy
:
TextView
?
=
null
...
...
@@ -64,8 +60,6 @@ class MainActivity : BaseActivity(), View.OnClickListener {
audioManager
=
getSystemService
(
Context
.
AUDIO_SERVICE
)
as
AudioManager
contentLayout
=
findViewById
(
R
.
id
.
content_layout
)
tabIvLoan
=
findViewById
(
R
.
id
.
tab_iv_loan
)
tabIvRecommend
=
findViewById
(
R
.
id
.
tab_iv_recommend
)
tabIvMy
=
findViewById
(
R
.
id
.
tab_iv_my
)
...
...
@@ -91,7 +85,6 @@ class MainActivity : BaseActivity(), View.OnClickListener {
initEditView
()
// 初始化短剧SDK
// initEasyFloat()
}
...
...
video/app/src/main/java/com/mints/helivideo/ui/fragment/MainFragment.kt
View file @
7b882a5f
package
com.mints.helivideo.ui.fragment
import
android.os.Bundle
import
android.os.Handler
import
android.os.Looper
import
android.text.TextUtils
...
...
@@ -23,13 +22,14 @@ import com.mints.helivideo.manager.UserManager
import
com.mints.helivideo.mvp.model.*
import
com.mints.helivideo.mvp.presenters.HomePresenter
import
com.mints.helivideo.mvp.views.HomeView
import
com.mints.helivideo.ui.activitys.NineActivity
import
com.mints.helivideo.ui.activitys.VipActivity
import
com.mints.helivideo.ui.adapter.HomeVideoPageAdapter
import
com.mints.helivideo.ui.adapter.ImageTitleAdapter
import
com.mints.helivideo.ui.adapter.TopAdapter
import
com.mints.helivideo.ui.fragment.base.LazyLoadBaseFragment
import
com.mints.helivideo.utils.AppPreferencesManager
import
com.mints.helivideo.utils.
AppPreferencesManager.get
import
com.mints.helivideo.utils.
SpanUtils
import
com.mints.library.utils.GlideUtils
import
com.mints.library.utils.nodoubleclick.AntiShake
import
kotlinx.android.synthetic.main.fragment_main.*
...
...
@@ -123,6 +123,7 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
srlMainPage
.
setOnRefreshListener
(
this
)
iv_main_watching_close
.
setOnClickListener
(
this
)
tv_main_watching_goto
.
setOnClickListener
(
this
)
ll_lucky
.
setOnClickListener
(
this
)
}
override
fun
onClick
(
v
:
View
?)
{
...
...
@@ -139,6 +140,9 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
LocalVedioManager
.
startVedioDetailActivityForType
(
requireActivity
(),
cacheVedio
)
}
}
R
.
id
.
ll_lucky
->
{
readyGo
(
NineActivity
::
class
.
java
)
}
}
}
...
...
@@ -292,14 +296,40 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
}
override
fun
getSoltVedioSuc
(
data
:
IndexList
?)
{
get
().
put
(
Constant
.
IS_FIRST_VEDIO
,
true
)
AppPreferencesManager
.
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
)
}
}
}
override
fun
showTurnSuc
(
data
:
NineShowBean
)
{
AppPreferencesManager
.
get
().
put
(
Constant
.
LUCKY_FLAG
,
data
.
isShow
)
if
(!
data
.
isShow
||
UserManager
.
getInstance
().
vipFlag
)
{
ll_lucky
.
visibility
=
View
.
GONE
return
}
else
{
ll_lucky
.
visibility
=
View
.
VISIBLE
}
val
complete
=
data
.
complete
val
need
=
data
.
need
if
(
complete
>=
need
)
{
tv_lucky_status
.
text
=
SpanUtils
()
.
append
(
"可领取"
)
.
setForegroundColor
(
resources
.
getColor
(
R
.
color
.
apk_uninstalled
))
.
create
()
}
else
{
tv_lucky_status
.
text
=
SpanUtils
()
.
append
(
complete
.
toString
())
.
setForegroundColor
(
resources
.
getColor
(
R
.
color
.
red
))
.
append
(
"/"
)
.
append
(
need
.
toString
())
.
create
()
}
}
...
...
@@ -311,4 +341,5 @@ class MainFragment : LazyLoadBaseFragment(), HomeView, View.OnClickListener, OnR
vpAdapter
?.
getFragments
()
?.
get
(
mSelectTabIndex
)
?.
onResume
()
}
}
}
\ No newline at end of file
video/app/src/main/java/com/mints/helivideo/ui/widgets/VipCountDialog.kt
View file @
7b882a5f
...
...
@@ -8,12 +8,16 @@ import android.view.Gravity
import
android.view.KeyEvent
import
android.view.View
import
android.view.WindowManager
import
android.widget.FrameLayout
import
android.widget.TextView
import
com.mints.helivideo.R
import
com.mints.helivideo.ad.express.ExpressAdCallback
import
com.mints.helivideo.ad.express.ExpressManager
import
com.mints.helivideo.mvp.model.VedioBean
import
com.mints.helivideo.ui.activitys.VipActivity
import
com.mints.helivideo.ui.widgets.countdowntimer.CountDownTimerSupport
import
com.mints.helivideo.ui.widgets.countdowntimer.OnCountDownTimerListener
import
com.mints.helivideo.utils.UIUtils
class
VipCountDialog
(
activity
:
Activity
,
vedioBean
:
VedioBean
,
tipList
:
ArrayList
<
String
>?)
:
Dialog
(
activity
,
R
.
style
.
dialog
)
{
...
...
@@ -21,6 +25,8 @@ class VipCountDialog(activity: Activity, vedioBean: VedioBean, tipList: ArrayLis
private
val
lp
:
WindowManager
.
LayoutParams
var
timer
:
CountDownTimerSupport
?
=
null
private
val
flAd
:
FrameLayout
init
{
setContentView
(
R
.
layout
.
dialog_vip_count
)
// 设置window属性
...
...
@@ -42,6 +48,9 @@ class VipCountDialog(activity: Activity, vedioBean: VedioBean, tipList: ArrayLis
val
tv_dialog_vip_count_left
=
findViewById
<
TextView
>(
R
.
id
.
tv_dialog_vip_count_left
)
val
tv_dialog_vip_count_right
=
findViewById
<
TextView
>(
R
.
id
.
tv_dialog_vip_count_right
)
flAd
=
findViewById
(
R
.
id
.
fl_ad
)
timer
=
CountDownTimerSupport
(
3000L
,
1000
)
timer
?.
setOnCountDownTimerListener
(
object
:
OnCountDownTimerListener
{
override
fun
onTick
(
millisUntilFinished
:
Long
)
{
...
...
@@ -67,6 +76,8 @@ class VipCountDialog(activity: Activity, vedioBean: VedioBean, tipList: ArrayLis
readyGo
(
activity
,
VipActivity
::
class
.
java
,
bundle
)
dismiss
()
}
showAd
()
}
override
fun
dismiss
()
{
...
...
@@ -91,12 +102,40 @@ class VipCountDialog(activity: Activity, vedioBean: VedioBean, tipList: ArrayLis
fun
onDialogDismiss
()
}
fun
readyGo
(
activity
:
Activity
,
clazz
:
Class
<
*
>?,
bundle
:
Bundle
?)
{
private
fun
readyGo
(
activity
:
Activity
,
clazz
:
Class
<
*
>?,
bundle
:
Bundle
?)
{
val
intent
=
Intent
(
activity
,
clazz
)
if
(
null
!=
bundle
)
{
intent
.
putExtras
(
bundle
)
}
activity
.
startActivity
(
intent
)
}
private
fun
showAd
()
{
ExpressManager
.
instance
.
getAdView
(
object
:
ExpressAdCallback
{
override
fun
loadSuccess
(
adView
:
FrameLayout
?)
{
adView
?.
let
{
UIUtils
.
removeFromParent
(
it
)
flAd
.
removeAllViews
()
flAd
.
addView
(
it
)
}
ExpressManager
.
instance
.
preLoadAd
()
}
override
fun
renderSuccess
(
adView
:
FrameLayout
?):
Boolean
{
adView
?.
let
{
UIUtils
.
removeFromParent
(
it
)
flAd
.
removeAllViews
()
flAd
.
addView
(
it
)
}
ExpressManager
.
instance
.
preLoadAd
()
return
false
}
override
fun
loadFail
()
{
}
})
}
}
\ No newline at end of file
video/app/src/main/java/com/mints/helivideo/video/DramaApiDetailActivity.kt
View file @
7b882a5f
...
...
@@ -167,7 +167,17 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
episode_tv
.
text
=
String
.
format
(
"共%d集 更新中"
,
it
.
total
)
}
info_tv
.
text
=
String
.
format
(
"第%d集"
,
mVedioBean
!!
.
seeIndex
)
unlock
.
text
=
String
.
format
(
"看广告解锁%d集"
,
lockSet
)
unlock
.
text
=
String
.
format
(
"观看激励视频"
)
tv_title
.
text
=
String
.
format
(
"解锁%s·第%d-%d集"
,
it
.
title
,
mInitUnlockIndex
+
1
,
mInitUnlockIndex
+
lockSet
)
tv_info
.
text
=
String
.
format
(
"看激励视频解锁%d集剧情\n请按照顺序解锁"
,
lockSet
)
if
(
mVedioBean
!!
.
collect
==
0
)
{
setCollectImage
(
zan_iv
)
}
else
{
...
...
@@ -235,6 +245,7 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
override
fun
onDestroy
()
{
dpWidget
?.
destroy
()
ExpressManager
.
instance
.
destroy
()
super
.
onDestroy
()
}
...
...
@@ -373,9 +384,6 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
)
info_tv
.
text
=
String
.
format
(
"第%d集"
,
index
)
// if (mUnlockIndexMap[drama.id]!! > index) {
// blockView?.visibility = View.GONE
// }
mCurrentIndex
=
index
showVipCountDialog
(
index
-
1
)
localShowLucky
(
index
-
1
)
...
...
@@ -406,6 +414,12 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
unlockCallback
=
callback
// 展示广告
tv_title
.
text
=
String
.
format
(
"解锁%s·第%d-%d集"
,
drama
.
title
,
mInitUnlockIndex
+
1
,
mInitUnlockIndex
+
lockSet
)
showAdView
()
dpWidget
?.
let
{
widget
->
...
...
@@ -441,13 +455,11 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
videoPresenter
.
unlock
(
it
)
}
// 更新解锁集数
for
(
i
in
0
until
lockSet
)
{
for
(
i
in
1
until
lockSet
)
{
val
hasUnlockList
:
MutableList
<
Int
>
=
mHasUnlockIndexMap
[
drama
.
id
]
?:
mutableListOf
()
hasUnlockList
.
add
(
widget
.
currentDramaIndex
+
lockSet
)
mHasUnlockIndexMap
[
drama
.
id
]
?:
mutableListOf
()
hasUnlockList
.
add
(
widget
.
currentDramaIndex
+
i
)
mHasUnlockIndexMap
[
drama
.
id
]
=
hasUnlockList
}
mInitUnlockIndex
=
mUnlockIndexMap
[
drama
.
id
]
!!
+
lockSet
...
...
@@ -476,7 +488,6 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
videoPresenter
.
unlock
(
it
)
}
// 更新解锁集数
for
(
i
in
1
until
lockSet
)
{
val
hasUnlockList
:
MutableList
<
Int
>
=
...
...
@@ -497,7 +508,6 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
}
})
}
}
}
...
...
@@ -785,6 +795,13 @@ class DramaApiDetailActivity : BaseActivity(), VideoEpisodeAdapter.OnEpisodeClic
}
override
fun
renderSuccess
(
adView
:
FrameLayout
?):
Boolean
{
adView
?.
let
{
UIUtils
.
removeFromParent
(
it
)
fl_ad
.
removeAllViews
()
fl_ad
.
addView
(
it
)
}
ExpressManager
.
instance
.
preLoadAd
()
return
false
}
...
...
video/app/src/main/java/com/mints/helivideo/video/TxVideoActivity.kt
View file @
7b882a5f
...
...
@@ -98,6 +98,9 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
super_short_video_view
.
onDestroy
()
super
.
onDestroy
()
super_short_video_view
.
releasePlayer
()
DrawExpressManager
.
instance
.
destroy
()
ExpressManager
.
instance
.
destroy
()
videoPresenter
.
detachView
()
}
...
...
@@ -115,7 +118,7 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
super_short_video_view
.
setOnCustomChildClickListener
(
this
)
super_short_video_view
.
setOnPageChangeListener
{
if
(
super_short_video_view
.
isAdPosition
(
it
))
{
if
(
super_short_video_view
.
isAdPosition
(
it
)
||
super_short_video_view
.
isLuckPosition
(
it
)
)
{
fm_bottom
.
visibility
=
View
.
GONE
ll_lucky
.
visibility
=
View
.
GONE
super_short_video_view
.
pause
()
...
...
@@ -128,7 +131,7 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
showVipCountDialog
(
readIndex
)
localShowLucky
(
readIndex
)
//
VIdeoi
ndex -> seeIndex
//
videoI
ndex -> seeIndex
val
data
=
super_short_video_view
.
data
if
(
data
.
size
>
it
&&
data
[
it
].
itemType
==
MULTI_ITEM_1
)
{
mVedioBean
!!
.
seeIndex
=
data
[
it
].
video
!!
.
vedioIndex
...
...
@@ -227,6 +230,7 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
AppPreferencesManager
.
get
()
.
put
(
Constant
.
LUCKY_FLAG
,
data
.
isShow
)
isLuckyShow
=
data
.
isShow
if
(
isLuckyShow
)
{
val
complete
=
data
.
complete
val
need
=
data
.
need
...
...
@@ -363,8 +367,11 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
private
fun
showVipCountDialog
(
index
:
Int
)
{
if
(
isFinishing
)
return
if
(
mVedioBean
!!
.
tipMaxIndex
==
0
||
index
==
1
||
mVedioBean
!!
.
tipMaxIndex
<
index
||
index
>
mVedioBean
!!
.
unlockIndex
)
{
if
(
mVedioBean
!!
.
tipMaxIndex
==
0
||
index
==
1
||
mVedioBean
!!
.
tipMaxIndex
<
index
||
index
>
mVedioBean
!!
.
unlockIndex
)
{
return
}
...
...
@@ -383,24 +390,25 @@ class TxVideoActivity : BaseActivity(), View.OnClickListener, VideoView,
val
localLucky
=
AppPreferencesManager
.
get
()
.
getBoolean
(
Constant
.
LUCKY_FLAG
,
false
)
if
(
UserManager
.
getInstance
().
vipFlag
)
{
if
(
isLuckyShow
||
localLucky
)
{
ll_lucky
.
visibility
=
View
.
VISIBLE
}
else
{
ll_lucky
.
visibility
=
View
.
GONE
return
}
if
(
mVedioBean
!=
null
&&
(
isLuckyShow
||
localLucky
))
{
if
(
index
>
mVedioBean
!!
.
unlockIndex
)
{
// 解锁界面
ll_lucky
.
visibility
=
View
.
GONE
}
else
{
// 超过免费剧
if
(
index
>
mVedioBean
!!
.
freeIndex
)
{
ll_lucky
.
visibility
=
View
.
VISIBLE
}
else
{
ll_lucky
.
visibility
=
View
.
GONE
}
}
}
//
if (mVedioBean != null && (isLuckyShow || localLucky)) {
//
if (index > mVedioBean!!.unlockIndex) {
//
// 解锁界面
//
ll_lucky.visibility = View.GONE
//
} else {
//
// 超过免费剧
//
if (index > mVedioBean!!.freeIndex) {
//
ll_lucky.visibility = View.VISIBLE
//
} else {
//
ll_lucky.visibility = View.GONE
//
}
//
}
//
}
}
// 获取当前下标真正代表的集数
...
...
video/app/src/main/java/com/mints/helivideo/video/tx/SuperShortVideoView.java
View file @
7b882a5f
package
com
.
mints
.
helivideo
.
video
.
tx
;
import
static
com
.
mints
.
helivideo
.
mvp
.
model
.
VideoMultiItemEntityKt
.
MULTI_ITEM_1
;
import
static
com
.
mints
.
helivideo
.
mvp
.
model
.
VideoMultiItemEntityKt
.
MULTI_ITEM_2
;
import
static
com
.
mints
.
helivideo
.
mvp
.
model
.
VideoMultiItemEntityKt
.
MULTI_ITEM_3
;
import
android.content.Context
;
...
...
@@ -221,6 +222,8 @@ public class SuperShortVideoView extends RelativeLayout {
mRecyclerView
.
post
(()
->
{
Log
.
i
(
TAG
,
"onItemClick"
);
mCurrentPosition
=
position
;
addAdView
(
mCurrentPosition
);
onPageSelectedMethod
(
position
);
});
}
...
...
@@ -268,19 +271,35 @@ public class SuperShortVideoView extends RelativeLayout {
return
false
;
}
public
boolean
isLuckPosition
(
int
position
)
{
if
(
mList
!=
null
&&
mList
.
size
()
>
0
)
{
return
mList
.
get
(
position
).
getItemType
()
==
MULTI_ITEM_2
;
}
return
false
;
}
private
int
lastAddAdPosition
=
0
;
private
void
addAdView
(
int
position
)
{
// VIP 不展示
if
(
UserManager
.
getInstance
().
getVipFlag
())
return
;
// 每隔3个视频出现一个广告
if
(
position
+
1
<
2
||
(
position
+
1
)
%
3
!=
0
||
lastAddAdPosition
>
position
)
return
;
if
(
position
+
1
<
2
||
(
position
+
1
)
%
3
!=
0
||
lastAddAdPosition
>
position
||
isAdPosition
(
position
)
||
isLuckPosition
(
position
))
return
;
int
addAdPosition
=
position
+
1
;
// 校验是否是最后一页
if
(
addAdPosition
>=
mList
.
size
())
{
addAdPosition
=
position
;
}
if
(
DrawExpressManager
.
Companion
.
getInstance
().
getAdIsLoadSuc
())
{
VideoMultiItemEntity
itemAD
=
new
VideoMultiItemEntity
(
MULTI_ITEM_3
,
null
,
new
VideoModel
(
""
));
mList
.
add
(
position
+
1
,
itemAD
);
mAdapter
.
notifyItemInserted
(
position
+
1
);
lastAddAdPosition
=
position
+
1
;
mList
.
add
(
addAdPosition
,
itemAD
);
mAdapter
.
notifyItemInserted
(
addAdPosition
);
lastAddAdPosition
=
addAdPosition
;
}
}
}
video/app/src/main/java/com/mints/helivideo/video/tx/adapter/TxVideoAdapter.kt
View file @
7b882a5f
...
...
@@ -20,6 +20,7 @@ import com.mints.helivideo.manager.UserManager
import
com.mints.helivideo.mvp.model.*
import
com.mints.helivideo.utils.UIUtils
import
com.mints.helivideo.video.tx.TXVideoBaseView
import
kotlinx.android.synthetic.main.drama_activity_api_detail.*
class
TxVideoAdapter
:
BaseMultiItemQuickAdapter
<
VideoMultiItemEntity
,
BaseViewHolder
>()
{
...
...
@@ -82,9 +83,21 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH
vipBtn
.
visibility
=
View
.
GONE
}
holder
.
getView
<
TextView
>(
R
.
id
.
unlock
).
text
=
"看广告解锁"
+
vedioBean
?.
adGiveVedioNum
+
"集"
holder
.
getView
<
View
>(
R
.
id
.
unlock
).
setOnClickListener
{
mOnCustomChildClickListener
?.
onCustomChildClick
(
it
,
holder
.
adapterPosition
)
vedioBean
?.
let
{
holder
.
getView
<
TextView
>(
R
.
id
.
tv_title
).
text
=
String
.
format
(
"解锁%s·第%d-%d集"
,
it
.
title
,
it
.
unlockIndex
+
1
,
it
.
unlockIndex
+
it
.
adGiveVedioNum
)
holder
.
getView
<
TextView
>(
R
.
id
.
tv_info
).
text
=
String
.
format
(
"看激励视频解锁%d集剧情\n请按照顺序解锁"
,
it
.
adGiveVedioNum
)
holder
.
getView
<
TextView
>(
R
.
id
.
unlock
).
text
=
String
.
format
(
"查看激励视频"
)
holder
.
getView
<
View
>(
R
.
id
.
unlock
).
setOnClickListener
{
it2
->
mOnCustomChildClickListener
?.
onCustomChildClick
(
it2
,
holder
.
adapterPosition
)
}
}
ExpressManager
.
instance
.
getAdView
(
object
:
ExpressAdCallback
{
...
...
@@ -100,6 +113,14 @@ class TxVideoAdapter : BaseMultiItemQuickAdapter<VideoMultiItemEntity, BaseViewH
}
override
fun
renderSuccess
(
adView
:
FrameLayout
?):
Boolean
{
adView
?.
let
{
UIUtils
.
removeFromParent
(
it
)
val
fmAd
=
holder
.
getView
<
FrameLayout
>(
R
.
id
.
fl_ad
)
fmAd
.
removeAllViews
()
fmAd
.
addView
(
it
)
}
ExpressManager
.
instance
.
preLoadAd
()
return
false
}
...
...
video/app/src/main/res/layout/activity_main.xml
View file @
7b882a5f
...
...
@@ -4,7 +4,7 @@
android:layout_height=
"match_parent"
android:clipChildren=
"false"
>
<
Linear
Layout
<
Frame
Layout
android:id=
"@+id/content_layout"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
...
...
video/app/src/main/res/layout/dialog_vip_count.xml
View file @
7b882a5f
...
...
@@ -8,10 +8,8 @@
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_centerInParent=
"true"
android:layout_marginStart=
"50dp"
android:layout_marginTop=
"50dp"
android:layout_marginEnd=
"50dp"
android:layout_marginBottom=
"50dp"
android:layout_marginStart=
"15dp"
android:layout_marginEnd=
"15dp"
android:background=
"@mipmap/bg_vip_count"
android:orientation=
"vertical"
>
...
...
@@ -53,7 +51,6 @@
android:textStyle=
"bold"
/>
</LinearLayout>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
...
...
@@ -75,5 +72,14 @@
android:textColor=
"#6C4D22"
android:textSize=
"18sp"
android:textStyle=
"bold"
/>
<FrameLayout
android:id=
"@+id/fl_ad"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"20dp"
android:background=
"@drawable/shape_bg_write"
/>
</LinearLayout>
</RelativeLayout>
video/app/src/main/res/layout/drama_activity_api_detail.xml
View file @
7b882a5f
...
...
@@ -6,11 +6,11 @@
android:background=
"#77090909"
>
<FrameLayout
android:keepScreenOn=
"true"
android:id=
"@+id/fl_container"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:layout_marginBottom=
"50dp"
/>
android:layout_marginBottom=
"50dp"
android:keepScreenOn=
"true"
/>
<View
android:id=
"@+id/view"
...
...
@@ -64,9 +64,9 @@
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"1dp"
android:layout_marginBottom=
"220dp"
android:visibility=
"gone"
android:gravity=
"center"
android:orientation=
"vertical"
android:visibility=
"gone"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintRight_toRightOf=
"parent"
>
...
...
@@ -176,18 +176,38 @@
<LinearLayout
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
android:background=
"#10ffffff"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:layout_marginStart=
"15dp"
android:layout_marginEnd=
"15dp"
android:background=
"@drawable/shape_bg_write"
android:gravity=
"center"
android:orientation=
"vertical"
>
<FrameLayout
android:id=
"@+id/fl_ad"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@drawable/shape_bg_write"
/>
<TextView
android:id=
"@+id/tv_title"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"30dp"
android:layout_marginTop=
"10dp"
android:layout_marginBottom=
"10dp"
android:text=
"试看已结束"
android:textColor=
"@color/white"
android:textSize=
"16sp"
/>
android:textColor=
"@color/black"
android:textSize=
"16sp"
android:textStyle=
"bold"
/>
<TextView
android:id=
"@+id/tv_info"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"30dp"
android:gravity=
"center"
android:text=
"试看已结束"
/>
<Button
android:id=
"@+id/unlock"
...
...
@@ -202,19 +222,11 @@
android:id=
"@+id/vip"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"10dp"
android:background=
"@mipmap/bg_detail_bottom"
android:textColor=
"@color/white"
android:visibility=
"gone"
/>
<com.mints.helivideo.ui.widgets.RoundRectLayout
android:id=
"@+id/fl_ad"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_margin=
"15dp"
android:background=
"@drawable/shape_bg_write"
android:elevation=
"2dp"
/>
</LinearLayout>
</FrameLayout>
...
...
video/app/src/main/res/layout/fragment_main.xml
View file @
7b882a5f
<
Relative
Layout
xmlns:android=
"http://schemas.android.com/apk/res/android"
<
androidx.constraintlayout.widget.Constraint
Layout
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"
...
...
@@ -8,7 +8,8 @@
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:scaleType=
"fitXY"
android:src=
"@mipmap/bg_main"
></ImageView>
android:src=
"@mipmap/bg_main"
app:layout_constraintTop_toTopOf=
"parent"
/>
<LinearLayout
android:layout_width=
"match_parent"
...
...
@@ -116,9 +117,9 @@
<FrameLayout
android:id=
"@+id/fl_main_banner"
android:layout_width=
"wrap_content"
android:layout_gravity=
"center_vertical"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"4dp"
></FrameLayout>
android:layout_gravity=
"center_vertical"
android:layout_marginLeft=
"4dp"
/>
</LinearLayout>
</LinearLayout>
...
...
@@ -170,7 +171,10 @@
android:layout_marginLeft=
"10dp"
android:layout_marginRight=
"10dp"
android:layout_marginBottom=
"10dp"
android:background=
"@drawable/shape_bg_black"
>
android:background=
"@drawable/shape_bg_black"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
>
<ImageView
android:id=
"@+id/iv_main_watching_pic"
...
...
@@ -225,7 +229,7 @@
android:layout_height=
"wrap_content"
android:layout_alignParentRight=
"true"
android:padding=
"6dp"
android:src=
"@mipmap/ic_quit_white"
></ImageView
>
android:src=
"@mipmap/ic_quit_white"
/
>
<TextView
android:id=
"@+id/tv_main_watching_goto"
...
...
@@ -244,4 +248,34 @@
android:textStyle=
"bold"
/>
</RelativeLayout>
</LinearLayout>
</RelativeLayout>
<LinearLayout
android:id=
"@+id/ll_lucky"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginEnd=
"10dp"
android:layout_marginBottom=
"120dp"
android:gravity=
"center"
android:orientation=
"vertical"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toEndOf=
"parent"
>
<ImageView
android:layout_width=
"80dp"
android:layout_height=
"70dp"
android:src=
"@mipmap/ic_get_mobile"
/>
<TextView
android:id=
"@+id/tv_lucky_status"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginTop=
"6dp"
android:background=
"@drawable/shape_bg_black2"
android:paddingLeft=
"16dp"
android:paddingRight=
"16dp"
android:text=
"0/5"
android:textColor=
"@color/white"
android:textSize=
"12sp"
/>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
video/app/src/main/res/layout/item_block_view.xml
View file @
7b882a5f
...
...
@@ -20,16 +20,36 @@
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center"
android:layout_marginStart=
"15dp"
android:layout_marginEnd=
"15dp"
android:background=
"@drawable/shape_bg_write"
android:gravity=
"center"
android:orientation=
"vertical"
>
<FrameLayout
android:id=
"@+id/fl_ad"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:background=
"@drawable/shape_bg_write"
/>
<TextView
android:id=
"@+id/tv_title"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"30dp"
android:layout_marginTop=
"10dp"
android:layout_marginBottom=
"10dp"
android:text=
"试看已结束"
android:textColor=
"@color/white"
android:textSize=
"16sp"
/>
android:textColor=
"@color/black"
android:textSize=
"16sp"
android:textStyle=
"bold"
/>
<TextView
android:id=
"@+id/tv_info"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginBottom=
"30dp"
android:gravity=
"center"
android:text=
"试看已结束"
/>
<Button
android:id=
"@+id/unlock"
...
...
@@ -48,18 +68,8 @@
android:textColor=
"@color/white"
android:visibility=
"gone"
/>
<com.mints.helivideo.ui.widgets.RoundRectLayout
android:id=
"@+id/fl_ad"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginStart=
"15dp"
android:layout_marginTop=
"20dp"
android:layout_marginEnd=
"15dp"
android:background=
"@drawable/shape_bg_write"
/>
</LinearLayout>
</FrameLayout>
</FrameLayout>
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