Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_payclear
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_payclear
Commits
9249decf
Commit
9249decf
authored
Jan 11, 2023
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
代码优化
parent
3b5714d4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
194 deletions
+7
-194
AdHelper.kt
payclear/app/src/main/java/com/mints/bcurd/ad/AdHelper.kt
+0
-17
InMoneySplash.kt
.../src/main/java/com/mints/bcurd/ad/splash/InMoneySplash.kt
+7
-177
No files found.
payclear/app/src/main/java/com/mints/bcurd/ad/AdHelper.kt
View file @
9249decf
package
com.mints.bcurd.ad
package
com.mints.bcurd.ad
import
android.app.Activity
import
com.mints.bcurd.ad.AdManager
import
com.mints.bcurd.ad.express.ExpressManager
import
com.mints.bcurd.common.Constant
/**
/**
* 描述:广告管理
* 描述:广告管理
* 作者:孟崔广
* 作者:孟崔广
* 时间:2021/08/10 10:51
* 时间:2021/08/10 10:51
*/
*/
object
AdHelper
{
object
AdHelper
{
const
val
AD_NO_SHOWTIME_OUT
=
50
// 广告请示成功但在规定时间内未展示
const
val
AD_NO_SHOWTIME_OUT
=
50
// 广告请示成功但在规定时间内未展示
const
val
AD_REQUEST_TIME_OUT
=
1
// 广告预加载时长超时
const
val
AD_REQUEST_TIME_OUT
=
1
// 广告预加载时长超时
/**
* 预加载应用内广告
*/
fun
preInAd
(
activity
:
Activity
?)
{
// 预加载信息流
ExpressManager
.
loadExpress
(
Constant
.
CARRIER_SPLASH
)
activity
?.
let
{
AdManager
.
instance
.
splashPreLoadAll
(
activity
)
}
}
}
}
\ No newline at end of file
payclear/app/src/main/java/com/mints/bcurd/ad/splash/InMoneySplash.kt
View file @
9249decf
...
@@ -5,18 +5,14 @@ import android.widget.FrameLayout
...
@@ -5,18 +5,14 @@ import android.widget.FrameLayout
import
com.bytedance.msdk.adapter.pangle.PangleNetworkRequestInfo
import
com.bytedance.msdk.adapter.pangle.PangleNetworkRequestInfo
import
com.bytedance.msdk.api.AdError
import
com.bytedance.msdk.api.AdError
import
com.bytedance.msdk.api.v2.GMAdConstant
import
com.bytedance.msdk.api.v2.GMAdConstant
import
com.bytedance.msdk.api.v2.GMNetworkRequestInfo
import
com.bytedance.msdk.api.v2.ad.splash.GMSplashAd
import
com.bytedance.msdk.api.v2.ad.splash.GMSplashAd
import
com.bytedance.msdk.api.v2.ad.splash.GMSplashAdListener
import
com.bytedance.msdk.api.v2.ad.splash.GMSplashAdListener
import
com.bytedance.msdk.api.v2.ad.splash.GMSplashAdLoadCallback
import
com.bytedance.msdk.api.v2.ad.splash.GMSplashAdLoadCallback
import
com.bytedance.msdk.api.v2.slot.GMAdSlotSplash
import
com.bytedance.msdk.api.v2.slot.GMAdSlotSplash
import
com.mints.tanzhi.WifiAdStatusListener
import
com.mints.bcurd.ad.AdHelper
import
com.mints.tanzhi.AdHelper
import
com.mints.bcurd.ad.WifiAdStatusListener
import
com.mints.tanzhi.AdReportManager
import
com.mints.tanzhi.AdReportManager.eventSplash
import
com.mints.bcurd.common.Constant
import
com.mints.bcurd.common.Constant
import
com.mints.bcurd.manager.CsjGroMoreManager
import
com.mints.bcurd.manager.CsjGroMoreManager
import
com.mints.bcurd.manager.CsjGroMoreManager.getInMoneySplashId
import
com.mints.bcurd.manager.TTGroMoreAdManagerHolder
import
com.mints.bcurd.manager.TTGroMoreAdManagerHolder
import
com.mints.bcurd.manager.TrackManager
import
com.mints.bcurd.manager.TrackManager
import
com.mints.bcurd.utils.LogUtil
import
com.mints.bcurd.utils.LogUtil
...
@@ -48,14 +44,6 @@ object InMoneySplash {
...
@@ -48,14 +44,6 @@ object InMoneySplash {
*/
*/
fun
preLoadAd
(
activity
:
Activity
)
{
fun
preLoadAd
(
activity
:
Activity
)
{
val
weakActivity
=
WeakReference
<
Activity
>(
activity
)
val
weakActivity
=
WeakReference
<
Activity
>(
activity
)
// 不加载广告
// if (!AppPreferencesManager.get().getBoolean(Constant.GROMORE_LOAD_SPLASH, true)) {
// isLoadSuccess = 0
// LogUtil.d(TAG, "开屏 不加载广告 load")
//
// return
// }
val
isOversped
=
TimeRender
.
isOverspedMin
(
adLoadTime
,
AdHelper
.
AD_NO_SHOWTIME_OUT
)
val
isOversped
=
TimeRender
.
isOverspedMin
(
adLoadTime
,
AdHelper
.
AD_NO_SHOWTIME_OUT
)
val
isPreingOversped
=
TimeRender
.
isOverspedMin
(
adPreingTime
,
AdHelper
.
AD_REQUEST_TIME_OUT
)
val
isPreingOversped
=
TimeRender
.
isOverspedMin
(
adPreingTime
,
AdHelper
.
AD_REQUEST_TIME_OUT
)
LogUtil
.
d
(
LogUtil
.
d
(
...
@@ -71,19 +59,7 @@ object InMoneySplash {
...
@@ -71,19 +59,7 @@ object InMoneySplash {
isLoadSuccess
=
1
isLoadSuccess
=
1
LogUtil
.
d
(
TAG
,
"gromore应用内开屏广告-> 2、执行预加载去了=$isLoadSuccess"
)
LogUtil
.
d
(
TAG
,
"gromore应用内开屏广告-> 2、执行预加载去了=$isLoadSuccess"
)
adUnitId
=
getInMoneySplashId
()
adUnitId
=
CsjGroMoreManager
.
IN_MONEY_SPLASH_CODE
eventSplash
(
AdReportManager
.
EVENT_TYPE_REQUEST
,
""
,
adUnitId
,
""
,
""
,
""
,
""
,
System
.
currentTimeMillis
(),
Constant
.
CARRIER_SPLASH
,
""
)
mTTSplashAd
=
GMSplashAd
(
weakActivity
.
get
(),
adUnitId
)
mTTSplashAd
=
GMSplashAd
(
weakActivity
.
get
(),
adUnitId
)
val
adSlot
=
GMAdSlotSplash
.
Builder
()
val
adSlot
=
GMAdSlotSplash
.
Builder
()
...
@@ -94,95 +70,31 @@ object InMoneySplash {
...
@@ -94,95 +70,31 @@ object InMoneySplash {
.
build
()
.
build
()
//自定义兜底方案 选择使用
//自定义兜底方案 选择使用
val
gmNetworkRequestInfo
=
//
val gmNetworkRequestInfo =
PangleNetworkRequestInfo
(
TTGroMoreAdManagerHolder
.
CURRENT_USE_APPID
,
"102165872"
)
//
PangleNetworkRequestInfo(TTGroMoreAdManagerHolder.CURRENT_USE_APPID, "102165872")
//step4:请求广告,调用开屏广告异步请求接口,对请求回调的广告作渲染处理
//step4:请求广告,调用开屏广告异步请求接口,对请求回调的广告作渲染处理
mTTSplashAd
?.
setAdSplashListener
(
mSplashAdListener
)
mTTSplashAd
?.
setAdSplashListener
(
mSplashAdListener
)
mTTSplashAd
?.
loadAd
(
adSlot
,
gmNetworkRequestInfo
,
object
:
GMSplashAdLoadCallback
{
//
mTTSplashAd?.loadAd(adSlot, gmNetworkRequestInfo, object : GMSplashAdLoadCallback {
//
mTTSplashAd?.loadAd(adSlot, object : GMSplashAdLoadCallback {
mTTSplashAd
?.
loadAd
(
adSlot
,
object
:
GMSplashAdLoadCallback
{
override
fun
onSplashAdLoadFail
(
adError
:
AdError
)
{
override
fun
onSplashAdLoadFail
(
adError
:
AdError
)
{
AdReportManager
.
lazyRegister
(
Constant
.
GRO_MORE_ADTYPE0
,
AdReportManager
.
REQUEST_FAIL
,
adError
.
code
.
toString
(),
adError
.
message
)
LogUtil
.
d
(
LogUtil
.
d
(
TAG
,
TAG
,
"gromore应用内开屏广告--> 3、Gromore onSplashAdLoadFail "
+
adError
.
message
+
"list ==>"
+
JsonUtil
.
toJson
(
mTTSplashAd
?.
adLoadInfoList
)
"gromore应用内开屏广告--> 3、Gromore onSplashAdLoadFail "
+
adError
.
message
+
"list ==>"
+
JsonUtil
.
toJson
(
mTTSplashAd
?.
adLoadInfoList
)
)
)
if
(
mTTSplashAd
!=
null
)
{
eventSplash
(
AdReportManager
.
EVENT_TYPE_FAIL
,
mTTSplashAd
?.
showEcpm
?.
adNetworkRitId
,
adUnitId
,
mTTSplashAd
?.
showEcpm
?.
preEcpm
,
mTTSplashAd
?.
showEcpm
?.
adNetworkPlatformName
,
adError
.
code
.
toString
(),
adError
.
message
,
System
.
currentTimeMillis
(),
Constant
.
CARRIER_SPLASH
,
""
)
}
isLoadSuccess
=
0
isLoadSuccess
=
0
}
}
override
fun
onSplashAdLoadSuccess
()
{
override
fun
onSplashAdLoadSuccess
()
{
AdReportManager
.
lazyRegister
(
Constant
.
GRO_MORE_ADTYPE0
,
AdReportManager
.
REQUEST_SUC
,
""
,
""
)
LogUtil
.
d
(
TAG
,
"gromore应用内开屏广告--> 3、Gromore onSplashAdLoadSuccess "
)
LogUtil
.
d
(
TAG
,
"gromore应用内开屏广告--> 3、Gromore onSplashAdLoadSuccess "
)
if
(
mTTSplashAd
!=
null
)
{
eventSplash
(
AdReportManager
.
EVENT_TYPE_SUC
,
mTTSplashAd
?.
showEcpm
?.
adNetworkRitId
,
adUnitId
,
mTTSplashAd
?.
showEcpm
?.
preEcpm
,
mTTSplashAd
?.
showEcpm
?.
adNetworkPlatformName
,
""
,
""
,
System
.
currentTimeMillis
(),
Constant
.
CARRIER_SPLASH
,
""
)
}
isLoadSuccess
=
2
isLoadSuccess
=
2
}
}
override
fun
onAdLoadTimeout
()
{
override
fun
onAdLoadTimeout
()
{
AdReportManager
.
lazyRegister
(
Constant
.
GRO_MORE_ADTYPE0
,
AdReportManager
.
REQUEST_FAIL
,
""
,
""
)
LogUtil
.
d
(
TAG
,
"gromore应用内开屏广告--> 3、Gromore onAdLoadTimeout "
)
LogUtil
.
d
(
TAG
,
"gromore应用内开屏广告--> 3、Gromore onAdLoadTimeout "
)
isLoadSuccess
=
0
isLoadSuccess
=
0
if
(
mTTSplashAd
!=
null
)
{
eventSplash
(
AdReportManager
.
EVENT_TYPE_SHOWFAIL
,
mTTSplashAd
?.
showEcpm
?.
adNetworkRitId
,
adUnitId
,
mTTSplashAd
?.
showEcpm
?.
preEcpm
,
mTTSplashAd
?.
showEcpm
?.
adNetworkPlatformName
,
""
,
""
,
System
.
currentTimeMillis
(),
Constant
.
CARRIER_SPLASH
,
"超时"
)
}
}
}
})
})
}
}
...
@@ -227,36 +139,8 @@ object InMoneySplash {
...
@@ -227,36 +139,8 @@ object InMoneySplash {
override
fun
onAdClicked
()
{
override
fun
onAdClicked
()
{
LogUtil
.
d
(
TAG
,
"gromore应用内开屏广告--> 7、onAdClicked "
)
LogUtil
.
d
(
TAG
,
"gromore应用内开屏广告--> 7、onAdClicked "
)
if
(
mTTSplashAd
!=
null
)
{
eventSplash
(
AdReportManager
.
EVENT_TYPE_CLICK
,
mTTSplashAd
?.
showEcpm
?.
adNetworkRitId
,
adUnitId
,
mTTSplashAd
?.
showEcpm
?.
preEcpm
,
mTTSplashAd
?.
showEcpm
?.
adNetworkPlatformName
,
""
,
""
,
System
.
currentTimeMillis
(),
Constant
.
CARRIER_SPLASH
,
""
)
}
if
(
isClickScreen
)
{
if
(
isClickScreen
)
{
// 防止重复
// 防止重复
if
(
mTTSplashAd
!=
null
)
{
eventSplash
(
AdReportManager
.
EVENT_TYPE_REPEAT
,
mTTSplashAd
?.
showEcpm
?.
adNetworkRitId
,
adUnitId
,
mTTSplashAd
?.
showEcpm
?.
preEcpm
,
mTTSplashAd
?.
showEcpm
?.
adNetworkPlatformName
,
""
,
""
,
System
.
currentTimeMillis
(),
Constant
.
CARRIER_SPLASH
,
""
)
}
isClickScreen
=
false
isClickScreen
=
false
}
}
}
}
...
@@ -264,32 +148,6 @@ object InMoneySplash {
...
@@ -264,32 +148,6 @@ object InMoneySplash {
override
fun
onAdShow
()
{
override
fun
onAdShow
()
{
LogUtil
.
d
(
TAG
,
"gromore应用内开屏广告--> 6、onAdShow "
)
LogUtil
.
d
(
TAG
,
"gromore应用内开屏广告--> 6、onAdShow "
)
isShowAd
=
true
isShowAd
=
true
if
(
mTTSplashAd
!=
null
)
{
val
vo
=
HashMap
<
String
,
Any
>()
mTTSplashAd
?.
let
{
vo
[
"adcode"
]
=
it
.
showEcpm
.
adNetworkRitId
vo
[
"ecpm"
]
=
it
.
showEcpm
.
preEcpm
vo
[
"adSource"
]
=
it
.
showEcpm
.
adNetworkPlatformName
vo
[
"adType"
]
=
Constant
.
GRO_MORE_ADTYPE0
vo
[
"adid"
]
=
getInMoneySplashId
()
vo
[
"isAddCoin"
]
=
false
TrackManager
.
getInstance
().
cmtGroMoreInfo
(
vo
)
}
}
if
(
mTTSplashAd
!=
null
)
{
eventSplash
(
AdReportManager
.
EVENT_TYPE_SHOW
,
mTTSplashAd
?.
showEcpm
?.
adNetworkRitId
,
adUnitId
,
mTTSplashAd
?.
showEcpm
?.
preEcpm
,
mTTSplashAd
?.
showEcpm
?.
adNetworkPlatformName
,
""
,
""
,
System
.
currentTimeMillis
(),
Constant
.
CARRIER_SPLASH
,
""
)
}
}
}
override
fun
onAdShowFail
(
adError
:
AdError
)
{
override
fun
onAdShowFail
(
adError
:
AdError
)
{
...
@@ -298,20 +156,6 @@ object InMoneySplash {
...
@@ -298,20 +156,6 @@ object InMoneySplash {
"gromore应用内开屏广告--> 6、onAdShowFail ${adError.code} ${adError.message}"
"gromore应用内开屏广告--> 6、onAdShowFail ${adError.code} ${adError.message}"
)
)
if
(
mTTSplashAd
!=
null
)
{
eventSplash
(
AdReportManager
.
EVENT_TYPE_SHOWFAIL
,
mTTSplashAd
?.
showEcpm
?.
adNetworkRitId
,
adUnitId
,
mTTSplashAd
?.
showEcpm
?.
preEcpm
,
mTTSplashAd
?.
showEcpm
?.
adNetworkPlatformName
,
adError
.
code
.
toString
(),
adError
.
message
,
System
.
currentTimeMillis
(),
Constant
.
CARRIER_SPLASH
,
"onAdShowFail"
)
}
wifiAdStatusListener
?.
adFail
()
wifiAdStatusListener
?.
adFail
()
}
}
...
@@ -325,20 +169,6 @@ object InMoneySplash {
...
@@ -325,20 +169,6 @@ object InMoneySplash {
LogUtil
.
d
(
TAG
,
"gromore应用内开屏广告--> 7、onAdDismiss "
)
LogUtil
.
d
(
TAG
,
"gromore应用内开屏广告--> 7、onAdDismiss "
)
wifiAdStatusListener
?.
adClose
()
wifiAdStatusListener
?.
adClose
()
if
(
mTTSplashAd
!=
null
)
{
eventSplash
(
AdReportManager
.
EVENT_TYPE_CLOSE
,
mTTSplashAd
?.
showEcpm
?.
adNetworkRitId
,
adUnitId
,
mTTSplashAd
?.
showEcpm
?.
preEcpm
,
mTTSplashAd
?.
showEcpm
?.
adNetworkPlatformName
,
""
,
""
,
System
.
currentTimeMillis
(),
Constant
.
CARRIER_SPLASH
,
""
)
}
}
}
}
}
...
...
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