Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
android_flowbox
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_flowbox
Commits
11910e77
Commit
11910e77
authored
Jul 19, 2021
by
mengcuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test
parent
60aa978b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
78 additions
and
74 deletions
+78
-74
InterstitialGroManager.java
...com/mints/flowbox/ad/inscreen/InterstitialGroManager.java
+7
-6
WifiAdManager.kt
app/src/main/java/com/mints/flowbox/ad/wifi/WifiAdManager.kt
+71
-68
No files found.
app/src/main/java/com/mints/flowbox/ad/inscreen/InterstitialGroManager.java
View file @
11910e77
...
...
@@ -4,6 +4,7 @@ import android.app.Activity;
import
com.bytedance.msdk.api.AdError
;
import
com.bytedance.msdk.api.AdSlot
;
import
com.bytedance.msdk.api.GDTExtraOption
;
import
com.bytedance.msdk.api.TTMediationAdSdk
;
import
com.bytedance.msdk.api.TTSettingConfigCallback
;
import
com.bytedance.msdk.api.TTVideoOption
;
...
...
@@ -76,15 +77,15 @@ public class InterstitialGroManager {
* 注:每次加载插屏广告的时候需要新建一个TTInterstitialAd,否则可能会出现广告填充问题
* ( 例如:mInterstitialAd = new TTInterstitialAd(this, adUnitId);)
*/
// if (isMain) {
// mInterstitialAd = new TTInterstitialAd(activity, CsjGroMoreManager.INSTANCE.getAPP_IN_MAIN_AD_UNIT_INTERSTITIAL_ID());
// } else {
// mInterstitialAd = new TTInterstitialAd(activity, CsjGroMoreManager.INSTANCE.getAPP_IN_MAIN_AD_UNIT_INTERSTITIAL_ID());
// }
mInterstitialAd
=
new
TTInterstitialAd
(
activity
,
CsjGroMoreManager
.
INSTANCE
.
getAPP_IN_MAIN_AD_UNIT_INTERSTITIAL_ID
());
// mInterstitialAd = new TTInterstitialAd(activity, CsjGroMoreManager.INSTANCE.getAPP_IN_MAIN_AD_UNIT_INTERSTITIAL_ID());
mInterstitialAd
=
new
TTInterstitialAd
(
activity
,
"946369785"
);
//模板1.0
TTVideoOption
videoOption
=
VideoOptionUtil
.
getTTVideoOption
();
// //模板2.0
// if (mExpressType == GDTExtraOption.FeedExpressType.FEED_EXPRESS_TYPE_2) {
// }
videoOption
=
VideoOptionUtil
.
getTTVideoOption2
();
//创建插屏广告请求参数AdSlot,具体参数含义参考文档
AdSlot
adSlot
=
new
AdSlot
.
Builder
()
...
...
app/src/main/java/com/mints/flowbox/ad/wifi/WifiAdManager.kt
View file @
11910e77
...
...
@@ -2,6 +2,9 @@ package com.mints.flowbox.ad.wifi
import
android.app.Activity
import
com.mints.flowbox.ad.full.FullGroManager
import
com.mints.flowbox.ad.inscreen.InterstitialGroManager
import
com.mints.flowbox.common.Constant
import
java.util.*
/**
* wifi广告管理
...
...
@@ -19,28 +22,28 @@ class WifiAdManager private constructor() {
private
var
wifiAdStatusListener
:
WifiAdStatusListener
?
=
null
// groMore插屏
//
private var interstitialGroManager: InterstitialGroManager? = null
private
var
interstitialGroManager
:
InterstitialGroManager
?
=
null
// groMore全屏
private
var
fullGroManager
:
FullGroManager
?
=
null
// 当前广告类型
//
private var currentAdType = ""
private
var
currentAdType
=
""
/**
* 预加载广告,必须传入activity
*/
fun
loadWifiAd
(
activity
:
Activity
)
{
//
currentAdType = getCurrentAdType()
//
//
when (currentAdType) {
//
Constant.GROMORE_INSERTSCREEN_AD -> {
//
preLoadInterstitialGroMore(activity)
//
}
//
Constant.GROMORE_FULL_AD -> {
// preLoadFullGroMore(activity,
true)
//
}
//
}
currentAdType
=
getCurrentAdType
()
when
(
currentAdType
)
{
Constant
.
GROMORE_INSERTSCREEN_AD
->
{
preLoadInterstitialGroMore
(
activity
)
}
Constant
.
GROMORE_FULL_AD
->
{
preLoadFullGroMore
(
activity
,
true
)
}
}
preLoadFullGroMore
(
activity
,
true
)
}
...
...
@@ -48,7 +51,7 @@ class WifiAdManager private constructor() {
/**
* 定义广告类型规则
*/
//
private fun getCurrentAdType(): String {
private
fun
getCurrentAdType
():
String
{
// var tempAdType = ""
// val randomInt = Random().nextInt(10)
// if (randomInt % 2 == 0) {
...
...
@@ -58,19 +61,19 @@ class WifiAdManager private constructor() {
// }
//
// return tempAdType
// return Constant.GROMORE_FULL
_AD
//
}
return
Constant
.
GROMORE_INSERTSCREEN
_AD
}
/**
* 插屏
*/
//
private fun preLoadInterstitialGroMore(activity: Activity) {
//
if (interstitialGroManager != null) {
//
interstitialGroManager?.onDestroy()
//
}
//
interstitialGroManager = InterstitialGroManager()
// interstitialGroManager?.loadInsertScreenAd(activity, false
)
//
}
private
fun
preLoadInterstitialGroMore
(
activity
:
Activity
)
{
if
(
interstitialGroManager
!=
null
)
{
interstitialGroManager
?.
onDestroy
()
}
interstitialGroManager
=
InterstitialGroManager
()
interstitialGroManager
?.
loadInsertScreenAd
(
activity
,
false
,
2
)
}
/**
* 全屏
...
...
@@ -88,61 +91,61 @@ class WifiAdManager private constructor() {
* 展示广告
*/
fun
showInterstitial
()
{
//
when (currentAdType) {
////
Constant.GROMORE_INSERTSCREEN_AD -> {
////
interstitialGroManager?.setWifiAdStatusListener(object : WifiAdStatusListener {
////
override fun adSuccess() {
////
////
}
////
////
override fun adFail() {
////
////
}
////
////
override fun adClose() {
////
wifiAdStatusListener?.adClose()
////
}
////
})
////
interstitialGroManager?.showInteractionAd()
////
}
//
Constant.GROMORE_FULL_AD -> {
fullGroManager
?.
setWifiAdStatusListener
(
wifiAdStatusListener
)
fullGroManager
?.
showFullAd
()
//
}
//
}
when
(
currentAdType
)
{
Constant
.
GROMORE_INSERTSCREEN_AD
->
{
interstitialGroManager
?.
setWifiAdStatusListener
(
object
:
WifiAdStatusListener
{
override
fun
adSuccess
()
{
}
override
fun
adFail
()
{
}
override
fun
adClose
()
{
wifiAdStatusListener
?.
adClose
()
}
})
interstitialGroManager
?.
showInteractionAd
()
}
Constant
.
GROMORE_FULL_AD
->
{
fullGroManager
?.
setWifiAdStatusListener
(
wifiAdStatusListener
)
fullGroManager
?.
showFullAd
()
}
}
}
/**
* 展示广告
*/
fun
showInterstitial
(
_activity
:
Activity
)
{
//
when (currentAdType) {
//
Constant.GROMORE_INSERTSCREEN_AD -> {
//
interstitialGroManager?.setWifiAdStatusListener(object : WifiAdStatusListener {
//
override fun adSuccess() {
//
//
}
//
//
override fun adFail() {
//
//
}
//
//
override fun adClose() {
//
wifiAdStatusListener?.adClose()
//
}
//
})
//
interstitialGroManager?.showInteractionAd(_activity)
//
}
//
Constant.GROMORE_FULL_AD -> {
fullGroManager
?.
showFullAd
(
_activity
,
wifiAdStatusListener
)
//
}
//
}
when
(
currentAdType
)
{
Constant
.
GROMORE_INSERTSCREEN_AD
->
{
interstitialGroManager
?.
setWifiAdStatusListener
(
object
:
WifiAdStatusListener
{
override
fun
adSuccess
()
{
}
override
fun
adFail
()
{
}
override
fun
adClose
()
{
wifiAdStatusListener
?.
adClose
()
}
})
interstitialGroManager
?.
showInteractionAd
(
_activity
)
}
Constant
.
GROMORE_FULL_AD
->
{
fullGroManager
?.
showFullAd
(
_activity
,
wifiAdStatusListener
)
}
}
}
fun
onDestroy
()
{
//
interstitialGroManager?.onDestroy()
//
interstitialGroManager?.setWifiAdStatusListener(null)
//
interstitialGroManager = null
interstitialGroManager
?.
onDestroy
()
interstitialGroManager
?.
setWifiAdStatusListener
(
null
)
interstitialGroManager
=
null
fullGroManager
?.
onDestroy
()
fullGroManager
=
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