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
e2d3b641
Commit
e2d3b641
authored
Jul 02, 2025
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[迭代]原生广告限制
parent
2aadf2c5
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
25 additions
and
23 deletions
+25
-23
MyApplication.kt
app/src/main/java/com/rgt/superr/MyApplication.kt
+1
-1
BaseActivity.kt
app/src/main/java/com/rgt/superr/base/BaseActivity.kt
+1
-0
AdInterMgr.kt
...main/java/com/rgt/superr/business/ads/admob/AdInterMgr.kt
+0
-1
AdNativeMgr.kt
...ain/java/com/rgt/superr/business/ads/admob/AdNativeMgr.kt
+19
-20
AdOpenMgr.kt
.../main/java/com/rgt/superr/business/ads/admob/AdOpenMgr.kt
+3
-1
InstallHelper.kt
...main/java/com/rgt/superr/business/helper/InstallHelper.kt
+1
-0
No files found.
app/src/main/java/com/rgt/superr/MyApplication.kt
View file @
e2d3b641
...
...
@@ -196,7 +196,7 @@ class MyApplication : Application() {
private
var
lastTimePause
=
0L
private
var
lastTimeResume
=
0L
private
fun
isHotLaunch
():
Boolean
{
if
((
lastTimeResume
-
lastTimePause
)
>
50
00
)
{
if
((
lastTimeResume
-
lastTimePause
)
>
35
00
)
{
return
true
}
return
false
...
...
app/src/main/java/com/rgt/superr/base/BaseActivity.kt
View file @
e2d3b641
...
...
@@ -152,6 +152,7 @@ abstract class BaseActivity<VB : ViewBinding>(
// intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT)
intent
.
addFlags
(
Intent
.
FLAG_ACTIVITY_CLEAR_TOP
or
Intent
.
FLAG_ACTIVITY_SINGLE_TOP
)
startActivity
(
intent
)
finish
()
}
var
dialog
:
Dialog
?
=
null
...
...
app/src/main/java/com/rgt/superr/business/ads/admob/AdInterMgr.kt
View file @
e2d3b641
...
...
@@ -101,7 +101,6 @@ class AdInterMgr {
val
admobEvent
=
(
adEvent
as
AdmobEvent
)
val
tag
=
adEvent
.
TAG
LogEx
.
logDebug
(
tag
,
"inter showReadyAd ac=${ac.javaClass.simpleName} currentAd=${adState.currentAd}"
)
if
(
ac
.
isFinishing
||
ac
.
isDestroyed
||
adState
.
currentAd
==
null
)
{
LogEx
.
logDebug
(
tag
,
"inter showReadyAd ac=null isFinishing isDestroyed"
)
showCallBack
?.
failed
()
...
...
app/src/main/java/com/rgt/superr/business/ads/admob/AdNativeMgr.kt
View file @
e2d3b641
...
...
@@ -40,7 +40,7 @@ class AdNativeMgr {
)
{
admobEvent
.
adPulStart
()
if
(!
LimitUtils
.
isAdShow
(
AdsType
.
NATIVE
,
admobEvent
))
{
if
(!
LimitUtils
.
isAdShow
(
NATIVE
,
admobEvent
))
{
return
}
...
...
@@ -90,43 +90,42 @@ class AdNativeMgr {
nativeCallBack
:
((
Any
?)
->
Unit
)?
=
null
)
{
admobEvent
.
adPrepareShow
()
if
(!
LimitUtils
.
isAdShow
(
NATIVE
,
admobEvent
)
||
!
LimitUtils
.
isShowNative
(
NATIVE
,
admobEvent
))
{
cacheItems
.
clear
()
return
}
Log
.
e
(
admobEvent
.
TAG
,
"native can show"
)
admobEvent
.
adPrepareShow
()
if
(!
adAvailable
())
{
//缓存过期了就清空
Log
.
e
(
admobEvent
.
TAG
,
"native cacheItems clear"
)
cacheItems
.
clear
()
}
parent
.
isAdShowed
=
true
val
nativeAd
=
cacheItems
.
peek
()
if
(
nativeAd
==
null
)
{
loadAd
(
parent
.
context
,
admobEvent
)
{
ad
->
Log
.
e
(
admobEvent
.
TAG
,
"native load show"
)
var
showAction
:
(
ad
:
NativeAd
)
->
Unit
=
{
ad
->
parent
.
isAdShowed
=
true
nativeCallBack
?.
invoke
(
ad
)
parent
.
setNativeAd
(
ad
,
layout
)
admobEvent
.
showAd
(
ad
.
responseInfo
)
//添加原生数量
LimitUtils
.
addNativeDisplayNum
()
loadAd
(
MyApplication
.
appContext
,
AdmobEvent
(
"nativeAd"
,
"preload"
),
null
)
}
}
else
{
if
(
nativeAd
==
null
)
{
loadAd
(
parent
.
context
,
admobEvent
)
{
ad
->
Log
.
e
(
TAG
,
"load show"
)
showAction
.
invoke
(
ad
)
}
}
else
{
val
flag
=
cacheItems
.
remove
(
nativeAd
)
Log
.
e
(
admobEvent
.
TAG
,
"native ready show remove=$flag size=${cacheItems.size}"
)
nativeCallBack
?.
invoke
(
nativeAd
)
parent
.
setNativeAd
(
nativeAd
,
layout
)
admobEvent
.
showAd
(
nativeAd
.
responseInfo
)
loadAd
(
MyApplication
.
appContext
,
AdmobEvent
(
"nativeAd"
,
"preload"
),
null
)
Log
.
e
(
TAG
,
"ready show remove=$flag size=${cacheItems.size}"
)
showAction
.
invoke
(
nativeAd
)
}
}
...
...
app/src/main/java/com/rgt/superr/business/ads/admob/AdOpenMgr.kt
View file @
e2d3b641
...
...
@@ -42,7 +42,7 @@ class AdOpenMgr {
adState
.
currentAdEvent
?.
let
{
adEvent
.
reqId
=
it
.
reqId
}
if
(!
adEvent
.
isUnLimit
)
{
if
(!
LimitUtils
.
isAdShow
(
AdsType
.
OPEN
,
adEvent
))
{
if
(!
LimitUtils
.
isAdShow
(
OPEN
,
adEvent
))
{
showCallBack
?.
failed
()
return
}
...
...
@@ -103,6 +103,8 @@ class AdOpenMgr {
LimitUtils
.
addDisplayNum
()
admobEvent
.
showAd
(
this
@run
.
responseInfo
,
ac
)
}
override
fun
onAdFailedToShowFullScreenContent
(
adError
:
AdError
)
{
...
...
app/src/main/java/com/rgt/superr/business/helper/InstallHelper.kt
View file @
e2d3b641
...
...
@@ -16,6 +16,7 @@ object InstallHelps {
private
val
TAG
=
"InstallHelps"
//服务器上报的参数
var
installReferrer
=
""
get
()
{
return
AppPreferences
.
getInstance
().
getString
(
"install_referrer"
,
field
)
...
...
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