Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
A
appzxhy
Project
Project
Details
Activity
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wanglei
appzxhy
Commits
60b29712
Commit
60b29712
authored
Jun 26, 2025
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[pangle]pangle广告
parent
802e3204
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
79 additions
and
7 deletions
+79
-7
AdsMgr.kt
app/src/main/java/com/base/appzxhy/business/ads/AdsMgr.kt
+8
-2
PangleActivity.kt
...n/java/com/base/appzxhy/business/pangle/PangleActivity.kt
+9
-4
PangleInterMgr.kt
...n/java/com/base/appzxhy/business/pangle/PangleInterMgr.kt
+54
-1
activity_pangle.xml
app/src/main/res/layout/activity_pangle.xml
+8
-0
No files found.
app/src/main/java/com/base/appzxhy/business/ads/AdsMgr.kt
View file @
60b29712
...
...
@@ -23,6 +23,7 @@ import com.base.appzxhy.bean.config.ConfigBean.Companion.configBean
//import com.base.appzxhy.business.ads.applovin.MaxNativeMgr
//import com.base.appzxhy.business.ads.applovin.MaxOpenMgr
import
com.base.appzxhy.business.helper.EventUtils
import
com.base.appzxhy.business.pangle.PangleInterMgr
import
com.base.appzxhy.business.pangle.PangleOpenMgr
import
com.base.appzxhy.utils.AppPreferences
import
com.base.appzxhy.utils.LogEx
...
...
@@ -68,6 +69,10 @@ object AdsMgr {
PangleOpenMgr
()
}
private
val
pangleInterMgr
by
lazy
{
PangleInterMgr
()
}
/**
* 是否初始化
*/
...
...
@@ -253,13 +258,14 @@ object AdsMgr {
// showCallBack?.failed()
// return
// }
LogEx
.
logDebug
(
"showAd"
,
"adSwitch=${adsConfigBean.adSwitch}"
)
val
from
=
activity
::
class
.
java
.
simpleName
//
LogEx.logDebug("showAd", "adSwitch=${adsConfigBean.adSwitch}")
//
val from = activity::class.java.simpleName
// if (true) {
// adInterMgr.show(activity, AdmobEvent("interAd", from).apply { this.isUnLimit = isUnLimit }, showCallBack)
// } else {
// maxInsertMgr.show(activity, isUnLimit, AdMaxEvent("interAd", from), showCallBack)
// }
pangleInterMgr
.
show
(
activity
,
showCallBack
)
}
/**
...
...
app/src/main/java/com/base/appzxhy/business/pangle/PangleActivity.kt
View file @
60b29712
...
...
@@ -11,10 +11,6 @@ import com.base.appzxhy.R
import
com.base.appzxhy.business.ads.AdsMgr
import
com.base.appzxhy.business.ads.AdsShowCallBack
import
com.base.appzxhy.databinding.ActivityPangleBinding
import
com.base.appzxhy.utils.ToastUtils.toast
import
com.bytedance.sdk.openadsdk.api.init.PAGConfig
import
com.bytedance.sdk.openadsdk.api.init.PAGSdk
import
com.bytedance.sdk.openadsdk.api.init.PAGSdk.PAGInitCallback
class
PangleActivity
:
AppCompatActivity
()
{
...
...
@@ -42,6 +38,15 @@ class PangleActivity : AppCompatActivity() {
})
}
binding
.
showInter
.
setOnClickListener
{
AdsMgr
.
showInsert
(
this
,
showCallBack
=
object
:
AdsShowCallBack
()
{
override
fun
next
()
{
}
})
}
}
...
...
app/src/main/java/com/base/appzxhy/business/pangle/PangleInterMgr.kt
View file @
60b29712
package
com.base.appzxhy.business.pangle
import
android.
util.Log
import
android.
app.Activity
import
com.base.appzxhy.GlobalConfig
import
com.base.appzxhy.business.ads.AdsShowCallBack
import
com.base.appzxhy.utils.LogEx
import
com.bytedance.sdk.openadsdk.api.interstitial.PAGInterstitialAd
import
com.bytedance.sdk.openadsdk.api.interstitial.PAGInterstitialAdInteractionListener
import
com.bytedance.sdk.openadsdk.api.interstitial.PAGInterstitialAdLoadListener
import
com.bytedance.sdk.openadsdk.api.interstitial.PAGInterstitialRequest
...
...
@@ -31,4 +32,56 @@ class PangleInterMgr {
}
})
}
fun
show
(
activity
:
Activity
,
showCallBack
:
AdsShowCallBack
?)
{
if
(
activity
.
isFinishing
||
activity
.
isDestroyed
)
{
return
}
this
.
showCallBack
=
showCallBack
if
(
interstitialAd
==
null
)
{
LogEx
.
logDebug
(
TAG
,
"interstitialAd load"
)
load
{
if
(
it
)
{
showReadyAd
(
activity
)
}
else
{
showCallBack
?.
adFailed
()
}
}
}
else
{
LogEx
.
logDebug
(
TAG
,
"interstitialAd ready"
)
showReadyAd
(
activity
)
}
}
private
fun
showReadyAd
(
ac
:
Activity
)
{
if
(
ac
.
isFinishing
||
ac
.
isDestroyed
)
{
return
}
if
(
interstitialAd
==
null
)
{
showCallBack
?.
failed
()
return
}
LogEx
.
logDebug
(
TAG
,
"interstitialAd show"
)
interstitialAd
?.
setAdInteractionListener
(
object
:
PAGInterstitialAdInteractionListener
{
override
fun
onAdShowed
()
{
showCallBack
?.
show
()
interstitialAd
=
null
load
()
}
override
fun
onAdClicked
()
{
}
override
fun
onAdDismissed
()
{
showCallBack
?.
close
()
}
})
interstitialAd
?.
show
(
ac
)
}
}
\ No newline at end of file
app/src/main/res/layout/activity_pangle.xml
View file @
60b29712
...
...
@@ -23,4 +23,12 @@
android:layout_marginVertical=
"@dimen/dp_3"
android:text=
"展示开屏"
/>
<androidx.appcompat.widget.AppCompatButton
android:id=
"@+id/showInter"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_marginVertical=
"@dimen/dp_3"
android:text=
"展示插页"
/>
</LinearLayout>
\ No newline at end of file
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