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
2106f8cc
Commit
2106f8cc
authored
Oct 12, 2024
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
70e9872b
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
64 deletions
+26
-64
SplashManager.kt
...in/java/com/duben/xixiplayletu/ad/splash/SplashManager.kt
+26
-64
No files found.
video/app/src/main/java/com/duben/xixiplayletu/ad/splash/SplashManager.kt
View file @
2106f8cc
...
...
@@ -7,6 +7,7 @@ import com.bytedance.sdk.openadsdk.*
import
com.bytedance.sdk.openadsdk.mediation.MediationConstant
import
com.bytedance.sdk.openadsdk.mediation.ad.MediationAdSlot
import
com.bytedance.sdk.openadsdk.mediation.ad.MediationSplashRequestInfo
import
com.duben.xixiplayletu.BuildConfig
import
com.duben.xixiplayletu.MintsApplication
import
com.duben.xixiplayletu.ad.AdStatusListener
import
com.duben.xixiplayletu.common.Constant
...
...
@@ -14,8 +15,8 @@ import com.duben.xixiplayletu.manager.TrackManager
import
com.duben.xixiplayletu.utils.LogUtil
import
com.duben.xixiplayletu.utils.UIUtils
import
java.lang.ref.WeakReference
import
java.util.HashMap
import
com.duben.xixiplayletu.BuildConfig
/**
* 应用内-网赚开屏
*/
...
...
@@ -30,7 +31,7 @@ object SplashManager {
private
val
TAG
=
SplashManager
::
class
.
java
.
simpleName
private
var
mTTSplashAd
:
TT
SplashAd
?
=
null
private
var
mTTSplashAd
:
CSJ
SplashAd
?
=
null
private
const
val
AD_TIME_OUT
=
5000
//开屏广告加载超时时间
private
var
isLoadSuccess
=
0
//0-加载失败/未加载 1-加载中 2-加载成功
...
...
@@ -61,21 +62,19 @@ object SplashManager {
)
.
build
()
adNativeLoader
.
loadSplashAd
(
adslot
,
object
:
TTAdNative
.
SplashAdListener
{
override
fun
onError
(
p0
:
Int
,
p1
:
String
?)
{
adNativeLoader
.
loadSplashAd
(
adslot
,
object
:
TTAdNative
.
CSJSplashAdListener
{
override
fun
onSplashLoadSuccess
(
p0
:
CSJSplashAd
?)
{
}
override
fun
onSplashLoadFail
(
p0
:
CSJAdError
?)
{
LogUtil
.
e
(
TAG
,
"gromore 开屏广告--> 3、Gromore onSplash
AdLoadFail adErrorCode=${p0} "
+
p1
"gromore 开屏广告--> 3、Gromore onSplash
LoadFail adErrorCode=${p0?.code} "
)
isLoadSuccess
=
0
}
override
fun
onTimeout
()
{
LogUtil
.
d
(
TAG
,
"gromore 开屏广告--> 3、Gromore onAdLoadTimeout"
)
isLoadSuccess
=
0
}
override
fun
onSplashAdLoad
(
p0
:
TTSplashAd
?)
{
override
fun
onSplashRenderSuccess
(
p0
:
CSJSplashAd
?)
{
LogUtil
.
d
(
TAG
,
"gromore 开屏广告--> 3、Gromore onSplashAdLoadSuccess"
)
LogUtil
.
d
(
"SplashNewActivity-->"
,
"333333--> ad show"
)
...
...
@@ -83,7 +82,15 @@ object SplashManager {
mTTSplashAd
=
p0
}
})
override
fun
onSplashRenderFail
(
p0
:
CSJSplashAd
?,
p1
:
CSJAdError
?)
{
LogUtil
.
e
(
TAG
,
"gromore 开屏广告--> 3、Gromore onSplashRenderFail adErrorCode=${p1?.code} "
)
isLoadSuccess
=
0
}
},
AD_TIME_OUT
)
}
/**
...
...
@@ -95,48 +102,7 @@ object SplashManager {
if
(
mTTSplashAd
!=
null
&&
isLoadSuccess
==
2
)
{
LogUtil
.
d
(
TAG
,
"gromore 开屏广告--> 准备调用show"
)
mTTSplashAd
?.
let
{
it
.
setSplashInteractionListener
(
adInteractionListener
)
// it.setSplashClickEyeListener(object: ISplashClickEyeListener {
// override fun onSplashClickEyeAnimationStart() {
// }
//
// override fun onSplashClickEyeAnimationFinish() {
// }
//
// override fun isSupportSplashClickEye(isSupport: Boolean): Boolean {
// var dp = it.splashClickEyeSizeToDp
//
// // 点睛相关处理
// val minWindowSizeFromSdk: IntArray = it.getSplashClickEyeSizeToDp()
// val flContent=it.splashView
// val params: ViewGroup.LayoutParams = flContent.getLayoutParams() as ViewGroup.LayoutParams
// params.height = UIUtils.dp2px(activity, minWindowSizeFromSdk[1].toFloat())
// params.width = UIUtils.dp2px(activity, minWindowSizeFromSdk[0].toFloat())
// flContent.setLayoutParams(params)
// flContent.setBackgroundResource(R.color.common_half_alpha)
// flContent.translationX = 200f
// flContent.translationY = 200f
// it.splashClickEyeAnimationFinish()
// return false
// }
// })
// it.setSplashCardListener(object : ISplashCardListener {
// override fun onSplashEyeReady() {
// it.splashClickEyeAnimationFinish()
// }
//
// override fun onSplashClickEyeClose() {
// adStatusListener?.adClose(null)
// }
//
// override fun setSupportSplashClickEye(isSupport: Boolean) {
// }
//
// override fun getActivity(): Activity {
// return activity
// }
//
// })
it
.
setSplashAdListener
(
adInteractionListener
)
view
.
addView
(
it
.
splashView
)
}
}
else
{
...
...
@@ -155,12 +121,8 @@ object SplashManager {
*/
fun
isSuccessStatus
()
=
isLoadSuccess
==
2
val
adInteractionListener
=
object
:
TTSplashAd
.
AdInteractionListener
{
override
fun
onAdClicked
(
p0
:
View
?,
p1
:
Int
)
{
LogUtil
.
d
(
TAG
,
"gromore 开屏广告--> 7、onAdClicked "
)
}
override
fun
onAdShow
(
p0
:
View
?,
p1
:
Int
)
{
val
adInteractionListener
=
object
:
CSJSplashAd
.
SplashAdListener
{
override
fun
onSplashAdShow
(
p0
:
CSJSplashAd
?)
{
isShowAd
=
true
LogUtil
.
d
(
TAG
,
"gromore 开屏广告--> 6、onAdShow "
)
...
...
@@ -174,12 +136,12 @@ object SplashManager {
}
}
override
fun
on
AdSkip
(
)
{
LogUtil
.
d
(
TAG
,
"gromore 开屏广告--> 7、onAd
Skip
"
)
override
fun
on
SplashAdClick
(
p0
:
CSJSplashAd
?
)
{
LogUtil
.
d
(
TAG
,
"gromore 开屏广告--> 7、onAd
Dismiss
"
)
adStatusListener
?.
adClose
(
null
)
}
override
fun
on
AdTimeOver
(
)
{
override
fun
on
SplashAdClose
(
p0
:
CSJSplashAd
?,
p1
:
Int
)
{
LogUtil
.
d
(
TAG
,
"gromore 开屏广告--> 7、onAdDismiss "
)
adStatusListener
?.
adClose
(
null
)
}
...
...
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