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
e611b1d6
Commit
e611b1d6
authored
Jul 12, 2023
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
优化广告加载逻辑,视频优化
parent
885630a6
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
42 additions
and
53 deletions
+42
-53
AndroidManifest.xml
video/app/src/main/AndroidManifest.xml
+1
-1
AdManager.kt
...o/app/src/main/java/com/mints/wisdomclean/ad/AdManager.kt
+4
-21
InMoneyVideo.java
...ain/java/com/mints/wisdomclean/ad/video/InMoneyVideo.java
+0
-10
InMoneyVideoNoPre.java
...ava/com/mints/wisdomclean/ad/video/InMoneyVideoNoPre.java
+5
-11
MainActivity.kt
...n/java/com/mints/wisdomclean/ui/activitys/MainActivity.kt
+2
-2
SplashActivity.kt
...java/com/mints/wisdomclean/ui/activitys/SplashActivity.kt
+3
-4
CycleProgress.java
.../java/com/mints/wisdomclean/ui/widgets/CycleProgress.java
+1
-1
VideoActivity.kt
...rc/main/java/com/mints/wisdomclean/video/VideoActivity.kt
+24
-2
VideoAdapter.kt
...src/main/java/com/mints/wisdomclean/video/VideoAdapter.kt
+2
-1
No files found.
video/app/src/main/AndroidManifest.xml
View file @
e611b1d6
...
@@ -20,7 +20,7 @@
...
@@ -20,7 +20,7 @@
<application
<application
android:name=
".MintsApplication"
android:name=
".MintsApplication"
android:allowBackup=
"
fals
e"
android:allowBackup=
"
tru
e"
android:icon=
"@mipmap/ic_launcher_main"
android:icon=
"@mipmap/ic_launcher_main"
android:label=
"@string/app_name"
android:label=
"@string/app_name"
android:largeHeap=
"true"
android:largeHeap=
"true"
...
...
video/app/src/main/java/com/mints/wisdomclean/ad/AdManager.kt
View file @
e611b1d6
package
com.mints.wisdomclean.ad
package
com.mints.wisdomclean.ad
import
android.app.Activity
import
android.app.Activity
import
com.mints.wisdomclean.ad.splash.SplashManager
import
com.mints.wisdomclean.ad.video.InMoneyVideo
import
com.mints.wisdomclean.ad.video.InMoneyVideo
/**
/**
...
@@ -8,8 +9,6 @@ import com.mints.wisdomclean.ad.video.InMoneyVideo
...
@@ -8,8 +9,6 @@ import com.mints.wisdomclean.ad.video.InMoneyVideo
*/
*/
class
AdManager
{
class
AdManager
{
private
val
TAG
=
AdManager
::
class
.
java
.
simpleName
companion
object
{
companion
object
{
const
val
AD_NO_SHOWTIME_OUT
=
50
// 广告请示成功但在规定时间内未展示
const
val
AD_NO_SHOWTIME_OUT
=
50
// 广告请示成功但在规定时间内未展示
...
@@ -26,8 +25,7 @@ class AdManager {
...
@@ -26,8 +25,7 @@ class AdManager {
* isPreLoad:是否是预加载调用,需要躲避监听
* isPreLoad:是否是预加载调用,需要躲避监听
*/
*/
fun
preLoadAd
(
activity
:
Activity
,
isPreLoad
:
Boolean
=
false
)
{
fun
preLoadAd
(
activity
:
Activity
,
isPreLoad
:
Boolean
=
false
)
{
// 加载激励视频广告
InMoneyVideo
.
getInstance
().
preLoadAd
(
activity
,
isPreLoad
)
this
.
loadRewardVideo
(
activity
,
isPreLoad
)
}
}
/**
/**
...
@@ -37,21 +35,6 @@ class AdManager {
...
@@ -37,21 +35,6 @@ class AdManager {
activity
:
Activity
,
activity
:
Activity
,
carrierType
:
String
,
carrierType
:
String
,
AdStatusListener
:
AdStatusListener
?,
AdStatusListener
:
AdStatusListener
?,
)
{
// 加载激励视频广告
showRewardVideo
(
activity
,
AdStatusListener
,
carrierType
)
}
// 预加载激励视频广告
private
fun
loadRewardVideo
(
activity
:
Activity
,
isPreLoad
:
Boolean
=
false
)
{
InMoneyVideo
.
getInstance
().
preLoadAd
(
activity
,
isPreLoad
)
}
// 展示激励视频广告
private
fun
showRewardVideo
(
activity
:
Activity
,
AdStatusListener
:
AdStatusListener
?,
carrierType
:
String
,
)
{
)
{
InMoneyVideo
.
getInstance
()
InMoneyVideo
.
getInstance
()
.
showRewardAd
(
.
showRewardAd
(
...
@@ -61,12 +44,12 @@ class AdManager {
...
@@ -61,12 +44,12 @@ class AdManager {
)
)
}
}
/**
/**
* 开屏页使用-预加载广告
* 开屏页使用-预加载广告
*/
*/
fun
splashPreLoadAll
(
activity
:
Activity
)
{
fun
splashPreLoadAll
(
activity
:
Activity
)
{
this
.
loadRewardVideo
(
activity
)
SplashManager
.
preLoadAd
(
activity
)
this
.
preLoadAd
(
activity
)
}
}
}
}
\ No newline at end of file
video/app/src/main/java/com/mints/wisdomclean/ad/video/InMoneyVideo.java
View file @
e611b1d6
...
@@ -226,14 +226,11 @@ public class InMoneyVideo {
...
@@ -226,14 +226,11 @@ public class InMoneyVideo {
public
void
onRewardedAdShow
()
{
public
void
onRewardedAdShow
()
{
if
(
mttRewardAd
!=
null
)
{
if
(
mttRewardAd
!=
null
)
{
if
(
mttRewardAd
.
getShowEcpm
()
!=
null
)
{
if
(
mttRewardAd
.
getShowEcpm
()
!=
null
)
{
nowAdcode
=
mttRewardAd
.
getShowEcpm
().
getAdNetworkRitId
();
nowAdcode
=
mttRewardAd
.
getShowEcpm
().
getAdNetworkRitId
();
nowEcpm
=
mttRewardAd
.
getShowEcpm
().
getPreEcpm
();
nowEcpm
=
mttRewardAd
.
getShowEcpm
().
getPreEcpm
();
nowAdSource
=
mttRewardAd
.
getShowEcpm
().
getAdNetworkPlatformName
();
nowAdSource
=
mttRewardAd
.
getShowEcpm
().
getAdNetworkPlatformName
();
}
}
}
}
LogUtil
.
d
(
TAG
,
"gromore应用内激励视频广告-->onRewardedAdShow"
);
LogUtil
.
d
(
TAG
,
"gromore应用内激励视频广告-->onRewardedAdShow"
);
...
@@ -310,13 +307,6 @@ public class InMoneyVideo {
...
@@ -310,13 +307,6 @@ public class InMoneyVideo {
* 激励视频播放完毕,验证是否有效发放奖励的回调
* 激励视频播放完毕,验证是否有效发放奖励的回调
*/
*/
public
void
onRewardVerify
(
RewardItem
rewardItem
)
{
public
void
onRewardVerify
(
RewardItem
rewardItem
)
{
// Map<String, Object> customData = rewardItem.getCustomData();
// if (customData != null) {
// String adnName = (String) customData.get(RewardItem.KEY_ADN_NAME);
// if (RewardItem.KEY_GDT.equals(adnName)) {
// LogUtil.d(TAG, "rewardItem gdt: " + customData.get(RewardItem.KEY_GDT_TRANS_ID));
// }
// }
}
}
/**
/**
...
...
video/app/src/main/java/com/mints/wisdomclean/ad/video/InMoneyVideoNoPre.java
View file @
e611b1d6
...
@@ -14,6 +14,7 @@ import com.bytedance.msdk.api.v2.slot.GMAdOptionUtil;
...
@@ -14,6 +14,7 @@ import com.bytedance.msdk.api.v2.slot.GMAdOptionUtil;
import
com.bytedance.msdk.api.v2.slot.GMAdSlotRewardVideo
;
import
com.bytedance.msdk.api.v2.slot.GMAdSlotRewardVideo
;
import
com.mints.library.utils.json.JsonUtil
;
import
com.mints.library.utils.json.JsonUtil
;
import
com.mints.wisdomclean.BuildConfig
;
import
com.mints.wisdomclean.BuildConfig
;
import
com.mints.wisdomclean.ad.AdManager
;
import
com.mints.wisdomclean.ad.AdStatusListener
;
import
com.mints.wisdomclean.ad.AdStatusListener
;
import
com.mints.wisdomclean.manager.UserManager
;
import
com.mints.wisdomclean.manager.UserManager
;
import
com.mints.wisdomclean.utils.LogUtil
;
import
com.mints.wisdomclean.utils.LogUtil
;
...
@@ -166,10 +167,10 @@ public class InMoneyVideoNoPre {
...
@@ -166,10 +167,10 @@ public class InMoneyVideoNoPre {
LogUtil
.
d
(
TAG
,
"InMoneyVideoNoPre应用内激励视频广告-->onRewardedAdShow"
);
LogUtil
.
d
(
TAG
,
"InMoneyVideoNoPre应用内激励视频广告-->onRewardedAdShow"
);
// 预加载
// 预加载
//
if (weakActivity.get() != null) {
if
(
weakActivity
.
get
()
!=
null
)
{
//
LogUtil.d(TAG, "InMoneyVideoNoPre应用内激励视频广告->onFullVideoAdShow 触发预加载下次广告");
LogUtil
.
d
(
TAG
,
"InMoneyVideoNoPre应用内激励视频广告->onFullVideoAdShow 触发预加载下次广告"
);
//
AdManager.Companion.getInstance().preLoadAd(weakActivity.get(),true);
AdManager
.
Companion
.
getInstance
().
preLoadAd
(
weakActivity
.
get
(),
true
);
//
}
}
}
}
@Override
@Override
...
@@ -231,13 +232,6 @@ public class InMoneyVideoNoPre {
...
@@ -231,13 +232,6 @@ public class InMoneyVideoNoPre {
* 激励视频播放完毕,验证是否有效发放奖励的回调
* 激励视频播放完毕,验证是否有效发放奖励的回调
*/
*/
public
void
onRewardVerify
(
RewardItem
rewardItem
)
{
public
void
onRewardVerify
(
RewardItem
rewardItem
)
{
// Map<String, Object> customData = rewardItem.getCustomData();
// if (customData != null) {
// String adnName = (String) customData.get(RewardItem.KEY_ADN_NAME);
// if (RewardItem.KEY_GDT.equals(adnName)) {
// LogUtil.d(TAG, "rewardItem gdt: " + customData.get(RewardItem.KEY_GDT_TRANS_ID));
// }
// }
}
}
/**
/**
...
...
video/app/src/main/java/com/mints/wisdomclean/ui/activitys/MainActivity.kt
View file @
e611b1d6
...
@@ -65,7 +65,7 @@ class MainActivity : BaseActivity(), View.OnClickListener {
...
@@ -65,7 +65,7 @@ class MainActivity : BaseActivity(), View.OnClickListener {
tabIvRecommend
=
findViewById
(
R
.
id
.
tab_iv_recommend
)
tabIvRecommend
=
findViewById
(
R
.
id
.
tab_iv_recommend
)
tabIvMy
=
findViewById
(
R
.
id
.
tab_iv_my
)
tabIvMy
=
findViewById
(
R
.
id
.
tab_iv_my
)
findViewById
<
View
>(
R
.
id
.
tab_rl_loan
).
setOnClickListener
(
this
)
findViewById
<
View
>(
R
.
id
.
tab_rl_loan
).
setOnClickListener
(
this
)
findViewById
<
View
>(
R
.
id
.
tab_
iv
_recommend
).
setOnClickListener
(
this
)
findViewById
<
View
>(
R
.
id
.
tab_
rl
_recommend
).
setOnClickListener
(
this
)
findViewById
<
View
>(
R
.
id
.
tab_rl_my
).
setOnClickListener
(
this
)
findViewById
<
View
>(
R
.
id
.
tab_rl_my
).
setOnClickListener
(
this
)
AppConfig
.
fragmentClickFlag
=
Constant
.
FRAGMENT_CLICK_ONE
AppConfig
.
fragmentClickFlag
=
Constant
.
FRAGMENT_CLICK_ONE
if
(
mainFragment
==
null
)
{
if
(
mainFragment
==
null
)
{
...
@@ -189,7 +189,7 @@ class MainActivity : BaseActivity(), View.OnClickListener {
...
@@ -189,7 +189,7 @@ class MainActivity : BaseActivity(), View.OnClickListener {
override
fun
onClick
(
view
:
View
)
{
override
fun
onClick
(
view
:
View
)
{
when
(
view
.
id
)
{
when
(
view
.
id
)
{
R
.
id
.
tab_rl_loan
->
clickTab1Layout
()
R
.
id
.
tab_rl_loan
->
clickTab1Layout
()
R
.
id
.
tab_
iv
_recommend
->
clickTab2Layout
()
R
.
id
.
tab_
rl
_recommend
->
clickTab2Layout
()
R
.
id
.
tab_rl_my
->
clickTab3Layout
()
R
.
id
.
tab_rl_my
->
clickTab3Layout
()
}
}
}
}
...
...
video/app/src/main/java/com/mints/wisdomclean/ui/activitys/SplashActivity.kt
View file @
e611b1d6
...
@@ -5,12 +5,11 @@ import android.os.Bundle
...
@@ -5,12 +5,11 @@ import android.os.Bundle
import
android.view.KeyEvent
import
android.view.KeyEvent
import
android.view.View
import
android.view.View
import
com.mints.wisdomclean.R
import
com.mints.wisdomclean.R
import
com.mints.wisdomclean.ad.AdManager
import
com.mints.wisdomclean.ad.splash.SplashManager
import
com.mints.wisdomclean.ad.splash.SplashManager
import
com.mints.wisdomclean.common.AppConfig
import
com.mints.wisdomclean.common.Constant
import
com.mints.wisdomclean.common.Constant
import
com.mints.wisdomclean.common.Constant.PRIVACY_URL
import
com.mints.wisdomclean.common.Constant.PRIVACY_URL
import
com.mints.wisdomclean.common.Constant.REGISTER_URL
import
com.mints.wisdomclean.common.Constant.REGISTER_URL
import
com.mints.wisdomclean.common.DeviceInfo.Companion.instance
import
com.mints.wisdomclean.manager.TrackManager
import
com.mints.wisdomclean.manager.TrackManager
import
com.mints.wisdomclean.manager.UserManager
import
com.mints.wisdomclean.manager.UserManager
import
com.mints.wisdomclean.ui.activitys.WebActivity
import
com.mints.wisdomclean.ui.activitys.WebActivity
...
@@ -71,7 +70,7 @@ class SplashActivity : BaseActivity() {
...
@@ -71,7 +70,7 @@ class SplashActivity : BaseActivity() {
private
fun
initData
()
{
private
fun
initData
()
{
val
firstSplash
=
get
().
getBoolean
(
Constant
.
FIRST_SPLASH
,
true
)
val
firstSplash
=
get
().
getBoolean
(
Constant
.
FIRST_SPLASH
,
true
)
if
(!
firstSplash
)
{
if
(!
firstSplash
)
{
SplashManager
.
preLoadAd
(
this
)
AdManager
.
instance
.
splashPreLoadAll
(
this
)
}
}
mProgressBar
!!
.
startOneAnim
()
mProgressBar
!!
.
startOneAnim
()
try
{
try
{
...
@@ -92,7 +91,7 @@ class SplashActivity : BaseActivity() {
...
@@ -92,7 +91,7 @@ class SplashActivity : BaseActivity() {
// 第一次安装时,延迟加载开屏广告,因为广告sdk还未初始化完成
// 第一次安装时,延迟加载开屏广告,因为广告sdk还未初始化完成
val
firstSplash
=
get
().
getBoolean
(
Constant
.
FIRST_SPLASH
,
true
)
val
firstSplash
=
get
().
getBoolean
(
Constant
.
FIRST_SPLASH
,
true
)
if
(
firstSplash
&&
millisUntilFinished
==
(
AD_TIME_OUT
-
2000
).
toLong
())
{
if
(
firstSplash
&&
millisUntilFinished
==
(
AD_TIME_OUT
-
2000
).
toLong
())
{
SplashManager
.
preLoadAd
(
this
@SplashActivity
)
AdManager
.
instance
.
splashPreLoadAll
(
this
@SplashActivity
)
get
().
put
(
Constant
.
FIRST_SPLASH
,
false
)
get
().
put
(
Constant
.
FIRST_SPLASH
,
false
)
}
}
...
...
video/app/src/main/java/com/mints/wisdomclean/ui/widgets/CycleProgress.java
View file @
e611b1d6
...
@@ -104,7 +104,7 @@ public class CycleProgress extends View {
...
@@ -104,7 +104,7 @@ public class CycleProgress extends View {
pathMeasure
.
getSegment
(
0
,
pathMeasure
.
getLength
()
*
mAnimatorValue
,
dstPath
,
true
);
pathMeasure
.
getSegment
(
0
,
pathMeasure
.
getLength
()
*
mAnimatorValue
,
dstPath
,
true
);
//渐变
//渐变
Shader
mShader
=
new
LinearGradient
(
mStrokeWidth
/
2
,
mStrokeWidth
/
2
,
mProgressWidth
,
mHeight
-
mStrokeWidth
/
2
,
Shader
mShader
=
new
LinearGradient
(
mStrokeWidth
/
2
,
mStrokeWidth
/
2
,
mProgressWidth
,
mHeight
-
mStrokeWidth
/
2
,
Color
.
parseColor
(
"#
08DA9B"
),
Color
.
parseColor
(
"#3ADAFA
"
),
Shader
.
TileMode
.
REPEAT
);
Color
.
parseColor
(
"#
F96856"
),
Color
.
parseColor
(
"#EC325C
"
),
Shader
.
TileMode
.
REPEAT
);
//遮罩
//遮罩
mProgressPaint
.
setXfermode
(
new
PorterDuffXfermode
(
PorterDuff
.
Mode
.
SRC_IN
));
mProgressPaint
.
setXfermode
(
new
PorterDuffXfermode
(
PorterDuff
.
Mode
.
SRC_IN
));
mProgressPaint
.
setShader
(
mShader
);
mProgressPaint
.
setShader
(
mShader
);
...
...
video/app/src/main/java/com/mints/wisdomclean/video/VideoActivity.kt
View file @
e611b1d6
...
@@ -14,6 +14,7 @@ import com.google.gson.Gson
...
@@ -14,6 +14,7 @@ import com.google.gson.Gson
import
com.mints.wisdomclean.R
import
com.mints.wisdomclean.R
import
com.mints.wisdomclean.ad.AdManager
import
com.mints.wisdomclean.ad.AdManager
import
com.mints.wisdomclean.ad.AdStatusListener
import
com.mints.wisdomclean.ad.AdStatusListener
import
com.mints.wisdomclean.ad.NoPreAdManager
import
com.mints.wisdomclean.common.Constant
import
com.mints.wisdomclean.common.Constant
import
com.mints.wisdomclean.manager.LocalVedioManager
import
com.mints.wisdomclean.manager.LocalVedioManager
import
com.mints.wisdomclean.mvp.model.IndexList
import
com.mints.wisdomclean.mvp.model.IndexList
...
@@ -299,10 +300,31 @@ class VideoActivity : BaseActivity(), View.OnClickListener, VideoView,
...
@@ -299,10 +300,31 @@ class VideoActivity : BaseActivity(), View.OnClickListener, VideoView,
// 看广告解锁
// 看广告解锁
AdManager
.
instance
.
showAd
(
this
,
""
,
AdManager
.
instance
.
showAd
(
this
,
""
,
object
:
AdStatusListener
{
object
:
AdStatusListener
{
override
fun
adSuccess
()
{}
var
canFail
=
false
override
fun
adSuccess
()
{
canFail
=
true
}
override
fun
adFail
()
{
override
fun
adFail
()
{
showToast
(
"广告太火爆了,请稍候再试"
)
if
(
canFail
)
return
NoPreAdManager
.
loadVideoAd
(
this
@VideoActivity
,
""
,
object
:
AdStatusListener
{
override
fun
adFail
()
{
showToast
(
"广告太火爆了,请稍候再试"
)
}
override
fun
adSuccess
()
{
}
override
fun
adClose
(
vo
:
HashMap
<
String
,
Any
>?)
{
vo
?.
let
{
vo
[
"vedioId"
]
=
mVedioBean
!!
.
vedioId
videoPresenter
.
unlock
(
vo
)
}
}
})
}
}
override
fun
adClose
(
vo
:
HashMap
<
String
,
Any
>?)
{
override
fun
adClose
(
vo
:
HashMap
<
String
,
Any
>?)
{
...
...
video/app/src/main/java/com/mints/wisdomclean/video/VideoAdapter.kt
View file @
e611b1d6
...
@@ -99,7 +99,8 @@ class VideoAdapter(private var vedioBean: VedioBean) :
...
@@ -99,7 +99,8 @@ class VideoAdapter(private var vedioBean: VedioBean) :
//缓存当前,播放当前
//缓存当前,播放当前
val
proxyUrl
=
proxy
?.
getProxyUrl
(
item
.
video
.
vedioUrl
).
toString
()
//设置视
val
proxyUrl
=
proxy
?.
getProxyUrl
(
item
.
video
.
vedioUrl
).
toString
()
//设置视
setPlay
(
holder
.
getView
(
R
.
id
.
jz_video
),
proxyUrl
)
// setPlay(holder.getView(R.id.jz_video), proxyUrl)
setPlay
(
holder
.
getView
(
R
.
id
.
jz_video
),
item
.
video
.
vedioUrl
)
}
}
fun
setPlay
(
jzvdStdTikTok
:
JzvdStdTikTok
,
path
:
String
)
{
fun
setPlay
(
jzvdStdTikTok
:
JzvdStdTikTok
,
path
:
String
)
{
...
...
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