Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
D
Data Recovery White
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
Data Recovery White
Commits
215a4720
Commit
215a4720
authored
Jul 18, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
f45689a8
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
36 additions
and
33 deletions
+36
-33
AdDisplayUtils.java
...c/main/java/com/base/datarecovery/ads/AdDisplayUtils.java
+14
-13
AdMaxEvent.kt
...src/main/java/com/base/datarecovery/ads/max/AdMaxEvent.kt
+5
-5
AdMaxInterstitialUtils.kt
...a/com/base/datarecovery/ads/max/AdMaxInterstitialUtils.kt
+6
-3
AdMaxNativeUtils.kt
...in/java/com/base/datarecovery/ads/max/AdMaxNativeUtils.kt
+4
-2
AdMaxOpenUtils.kt
...main/java/com/base/datarecovery/ads/max/AdMaxOpenUtils.kt
+7
-10
No files found.
app/src/main/java/com/base/datarecovery/ads/AdDisplayUtils.java
View file @
215a4720
...
...
@@ -70,19 +70,20 @@ public class AdDisplayUtils {
}
public
boolean
shouldShowAd
(
String
ad_unit
)
{
boolean
s
=
shouldDisplayAd
()
&&
shouldIncrementClickCount
()
&&
shouldIncrementRequestFailAd
();
if
(!
s
)
{
LogEx
.
INSTANCE
.
logDebug
(
"glc"
,
"!shouldShowAd"
,
false
);
JSONObject
obj2
=
new
JSONObject
();
try
{
obj2
.
put
(
"reason"
,
"no ad"
);
obj2
.
put
(
"ad_unit"
,
ad_unit
);
EventUtils
.
INSTANCE
.
event
(
"ad_show_error"
,
null
,
obj2
,
false
);
}
catch
(
JSONException
e
)
{
}
}
return
s
;
return
true
;
// boolean s = shouldDisplayAd() && shouldIncrementClickCount() && shouldIncrementRequestFailAd();
// if (!s) {
// LogEx.INSTANCE.logDebug("glc", "!shouldShowAd", false);
// JSONObject obj2 = new JSONObject();
// try {
// obj2.put("reason", "no ad");
// obj2.put("ad_unit", ad_unit);
// EventUtils.INSTANCE.event("ad_show_error", null, obj2, false);
// } catch (JSONException e) {
//
// }
// }
// return s;
}
public
void
incrementAdDisplayCount
()
{
...
...
app/src/main/java/com/base/datarecovery/ads/max/AdMaxEvent.kt
View file @
215a4720
...
...
@@ -30,7 +30,7 @@ object AdMaxEvent {
obj
.
put
(
"networkplacement"
,
ad
?.
networkPlacement
)
obj
.
put
(
"latency"
,
ad
?.
requestLatencyMillis
)
obj
.
put
(
"valueMicros"
,
ad
?.
revenue
)
obj
.
put
(
"mediation"
,
"applovin"
)
obj
.
put
(
"mediation"
,
"applovin"
)
if
(
error
==
null
)
{
obj
.
put
(
"status"
,
"1"
)
}
else
{
...
...
@@ -55,7 +55,7 @@ object AdMaxEvent {
obj
.
put
(
"networkplacement"
,
ad
?.
networkPlacement
)
obj
.
put
(
"latency"
,
ad
?.
requestLatencyMillis
)
obj
.
put
(
"valueMicros"
,
ad
?.
revenue
)
obj
.
put
(
"mediation"
,
"applovin"
)
obj
.
put
(
"mediation"
,
"applovin"
)
if
(!
adUnit
.
equals
(
"nativeAd"
))
{
EventUtils
.
event
(
"ad_click"
,
ext
=
obj
)
}
else
{
...
...
@@ -64,7 +64,7 @@ object AdMaxEvent {
}
fun
showAd
(
ad
:
MaxAd
?,
adUnit
:
String
,
activity
:
Activity
?)
{
fun
showAd
(
ad
:
MaxAd
?,
adUnit
:
String
,
activity
:
String
?)
{
val
obj
=
JSONObject
()
obj
.
put
(
"UnitId"
,
ad
?.
adUnitId
)
obj
.
put
(
"ad_unit"
,
adUnit
)
...
...
@@ -78,8 +78,8 @@ object AdMaxEvent {
obj
.
put
(
"latency"
,
ad
?.
requestLatencyMillis
)
obj
.
put
(
"valueMicros"
,
ad
?.
revenue
)
obj
.
put
(
"from"
,
activity
?.
javaClass
?.
simpleName
)
obj
.
put
(
"mediation"
,
"applovin"
)
LogEx
.
logDebug
(
"glc"
,
"from:
"
+
activity
?.
javaClass
?.
simpleName
)
obj
.
put
(
"mediation"
,
"applovin"
)
LogEx
.
logDebug
(
"glc"
,
"from:
$activity"
)
if
(!
adUnit
.
equals
(
"nativeAd"
))
{
EventUtils
.
event
(
"ad_show"
,
ext
=
obj
)
}
else
{
...
...
app/src/main/java/com/base/datarecovery/ads/max/AdMaxInterstitialUtils.kt
View file @
215a4720
...
...
@@ -32,7 +32,10 @@ object AdMaxInterstitialUtils {
@SuppressLint
(
"StaticFieldLeak"
)
private
var
customDialog
:
CustomDialog
?
=
null
private
var
activityString
:
String
=
""
private
fun
setListener
(
activity
:
Activity
)
{
activityString
=
activity
::
class
.
java
.
toString
()
if
(
interstitialAd
==
null
)
{
interstitialAd
=
MaxInterstitialAd
(
ConfigHelper
.
interAdMaxId
,
activity
)
...
...
@@ -65,7 +68,7 @@ object AdMaxInterstitialUtils {
override
fun
onAdDisplayed
(
p0
:
MaxAd
)
{
LogEx
.
logDebug
(
TAG
,
"onAdDisplayed"
)
AdDisplayUtils
.
getInstance
().
incrementAdDisplayCount
()
AdMaxEvent
.
showAd
(
p0
,
"interAd"
,
activity
)
AdMaxEvent
.
showAd
(
p0
,
"interAd"
,
activity
String
)
}
override
fun
onAdHidden
(
p0
:
MaxAd
)
{
...
...
@@ -76,7 +79,7 @@ object AdMaxInterstitialUtils {
}
override
fun
onAdClicked
(
p0
:
MaxAd
)
{
LogEx
.
logDebug
(
TAG
,
"onAdClicked"
)
LogEx
.
logDebug
(
TAG
,
"onAdClicked
activity=$activityString
"
)
AdDisplayUtils
.
getInstance
().
incrementAdClickCount
()
AdMaxEvent
.
clickAd
(
p0
,
"interAd"
)
}
...
...
@@ -117,7 +120,7 @@ object AdMaxInterstitialUtils {
return
}
LogEx
.
logDebug
(
TAG
,
"showInterstitialAd,展示插屏广告"
)
LogEx
.
logDebug
(
TAG
,
"showInterstitialAd,展示插屏广告"
)
val
obj1
=
JSONObject
()
obj1
.
put
(
"ad_unit"
,
"interAd"
)
...
...
app/src/main/java/com/base/datarecovery/ads/max/AdMaxNativeUtils.kt
View file @
215a4720
...
...
@@ -26,6 +26,7 @@ object AdMaxNativeUtils {
private
var
nativeLoadTime
=
Long
.
MAX_VALUE
private
var
haveSetAdListener
:
Boolean
=
false
private
var
loadingListener
:
(()
->
Unit
)?
=
null
private
var
activityString
:
String
=
""
private
fun
setNativeAdListener
()
{
if
(!
haveSetAdListener
)
{
//加载展示监听
...
...
@@ -107,7 +108,8 @@ object AdMaxNativeUtils {
}
fun
showNativeAd
(
activity
:
Activity
,
parent
:
ViewGroup
,
layout
:
Int
)
{
fun
showNativeAd
(
activity
:
Activity
,
parent
:
ViewGroup
,
layout
:
Int
)
{
activityString
=
activity
::
class
.
java
.
toString
()
setNativeAdListener
()
if
(!
AdDisplayUtils
.
getInstance
().
shouldShowAd
(
"nativeAd"
))
{
return
...
...
@@ -126,7 +128,7 @@ object AdMaxNativeUtils {
nativeAdLoader
.
render
(
adView
,
nativeAd
)
parent
.
removeAllViews
()
parent
.
addView
(
adView
)
nativeAd
?.
let
{
AdMaxEvent
.
showAd
(
it
,
"nativeAd"
,
activity
)
}
nativeAd
?.
let
{
AdMaxEvent
.
showAd
(
it
,
"nativeAd"
,
activityString
)
}
AdDisplayUtils
.
getInstance
().
incrementAdDisplayCount
()
}
}
...
...
app/src/main/java/com/base/datarecovery/ads/max/AdMaxOpenUtils.kt
View file @
215a4720
...
...
@@ -20,10 +20,12 @@ object AdMaxOpenUtils {
private
var
openLoadTime
=
Long
.
MAX_VALUE
private
var
onHidden
:
(()
->
Unit
)?
=
null
private
var
loadingListener
:
(()
->
Unit
)?
=
null
private
var
activityString
=
""
private
fun
setListener
(
context
:
Activity
)
{
private
fun
setListener
(
activity
:
Activity
)
{
activityString
=
activity
::
class
.
java
.
toString
()
if
(
appOpenAd
==
null
)
{
appOpenAd
=
MaxAppOpenAd
(
ConfigHelper
.
openAdMaxId
,
context
)
appOpenAd
=
MaxAppOpenAd
(
ConfigHelper
.
openAdMaxId
,
activity
)
appOpenAd
?.
setListener
(
object
:
MaxAdListener
{
override
fun
onAdLoaded
(
p0
:
MaxAd
)
{
...
...
@@ -45,18 +47,17 @@ object AdMaxOpenUtils {
override
fun
onAdDisplayed
(
p0
:
MaxAd
)
{
AdDisplayUtils
.
getInstance
().
incrementAdDisplayCount
()
AdMaxEvent
.
showAd
(
p0
,
"openAd"
,
Activity
()
)
AdMaxEvent
.
showAd
(
p0
,
"openAd"
,
activityString
)
}
override
fun
onAdHidden
(
p0
:
MaxAd
)
{
onHidden
?.
invoke
()
loadAppOpenAd
(
context
)
loadAppOpenAd
(
activity
)
loadingListener
=
null
}
override
fun
onAdClicked
(
p0
:
MaxAd
)
{
AdDisplayUtils
.
getInstance
().
incrementAdClickCount
()
// com.base.datarecovery.ads.max.AdMaxEvent.clickAd(appOpenAd, "openAd")
AdmobCommonUtils
.
isMultiClick
(
appOpenAd
)
AdMaxEvent
.
clickAd
(
p0
,
"openAd"
)
}
...
...
@@ -65,7 +66,7 @@ object AdMaxOpenUtils {
override
fun
onAdDisplayFailed
(
p0
:
MaxAd
,
p1
:
MaxError
)
{
LogEx
.
logDebug
(
TAG
,
"onAdDisplayFailed"
)
onHidden
?.
invoke
()
loadAppOpenAd
(
context
)
loadAppOpenAd
(
activity
)
val
obj
=
JSONObject
()
obj
.
put
(
"code"
,
p1
.
code
)
obj
.
put
(
"reason"
,
p1
.
message
)
...
...
@@ -137,15 +138,11 @@ object AdMaxOpenUtils {
}
if
(
appOpenAd
?.
isReady
==
true
)
{
LogEx
.
logDebug
(
TAG
,
"appOpenAd?.isReady == true"
)
return
}
if
(
AdmobMaxHelper
.
isAdInit
.
get
())
{
LogEx
.
logDebug
(
TAG
,
"loadAppOpenAd2"
)
appOpenAd
?.
loadAd
()
}
else
{
LogEx
.
logDebug
(
TAG
,
"loadAppOpenAd3"
)
}
}
...
...
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