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
2c78df18
Commit
2c78df18
authored
Jul 18, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/master'
parents
9cb9b2a8
8a92733b
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
43 additions
and
45 deletions
+43
-45
AdDisplayUtils.java
...c/main/java/com/base/datarecovery/ads/AdDisplayUtils.java
+18
-2
AdmobInterstitialUtils.kt
...com/base/datarecovery/ads/admob/AdmobInterstitialUtils.kt
+3
-29
AdmobNativeUtils.kt
.../java/com/base/datarecovery/ads/admob/AdmobNativeUtils.kt
+2
-5
AdmobOpenUtils.kt
...in/java/com/base/datarecovery/ads/admob/AdmobOpenUtils.kt
+2
-2
AdMaxEvent.kt
...src/main/java/com/base/datarecovery/ads/max/AdMaxEvent.kt
+2
-1
AdMaxInterstitialUtils.kt
...a/com/base/datarecovery/ads/max/AdMaxInterstitialUtils.kt
+8
-3
AdMaxNativeUtils.kt
...in/java/com/base/datarecovery/ads/max/AdMaxNativeUtils.kt
+1
-1
AdMaxOpenUtils.kt
...main/java/com/base/datarecovery/ads/max/AdMaxOpenUtils.kt
+2
-2
NotificationUtil.kt
...c/main/java/com/base/datarecovery/fcm/NotificationUtil.kt
+5
-0
No files found.
app/src/main/java/com/base/datarecovery/ads/AdDisplayUtils.java
View file @
2c78df18
...
@@ -5,6 +5,11 @@ import android.util.Log;
...
@@ -5,6 +5,11 @@ import android.util.Log;
import
com.base.datarecovery.MyApplication
;
import
com.base.datarecovery.MyApplication
;
import
com.base.datarecovery.help.BaseApplication
;
import
com.base.datarecovery.help.BaseApplication
;
import
com.base.datarecovery.utils.EventUtils
;
import
com.base.datarecovery.utils.LogEx
;
import
org.json.JSONException
;
import
org.json.JSONObject
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.Calendar
;
import
java.util.Calendar
;
...
@@ -64,8 +69,19 @@ public class AdDisplayUtils {
...
@@ -64,8 +69,19 @@ public class AdDisplayUtils {
return
adClickCount
<
getMaxAdClickCount
();
return
adClickCount
<
getMaxAdClickCount
();
}
}
public
boolean
shouldShowAd
()
{
public
boolean
shouldShowAd
(
String
ad_unit
)
{
return
shouldDisplayAd
()
&&
shouldIncrementClickCount
()
&&
shouldIncrementRequestFailAd
();
boolean
s
=
shouldDisplayAd
()
&&
shouldIncrementClickCount
()
&&
shouldIncrementRequestFailAd
();
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
()
{
public
void
incrementAdDisplayCount
()
{
...
...
app/src/main/java/com/base/datarecovery/ads/admob/AdmobInterstitialUtils.kt
View file @
2c78df18
...
@@ -70,7 +70,7 @@ object AdmobInterstitialUtils {
...
@@ -70,7 +70,7 @@ object AdmobInterstitialUtils {
return
return
}
}
if
(!
AdDisplayUtils
.
getInstance
().
shouldShowAd
())
{
if
(!
AdDisplayUtils
.
getInstance
().
shouldShowAd
(
"interAd"
))
{
onHidden
?.
invoke
()
onHidden
?.
invoke
()
return
return
}
}
...
@@ -87,7 +87,7 @@ object AdmobInterstitialUtils {
...
@@ -87,7 +87,7 @@ object AdmobInterstitialUtils {
onLoad
?.
invoke
()
onLoad
?.
invoke
()
return
return
}
}
if
(!
AdDisplayUtils
.
getInstance
().
shouldShowAd
())
{
if
(!
AdDisplayUtils
.
getInstance
().
shouldShowAd
(
"interAd"
))
{
onLoad
?.
invoke
()
onLoad
?.
invoke
()
return
return
}
}
...
@@ -133,33 +133,7 @@ object AdmobInterstitialUtils {
...
@@ -133,33 +133,7 @@ object AdmobInterstitialUtils {
onHidden
:
(()
->
Unit
)?,
onHidden
:
(()
->
Unit
)?,
interval
:
Int
interval
:
Int
)
{
)
{
// if (!isShowDialog) {
displayInterstitialAd
(
activity
,
onHidden
)
// displayInterstitialAd(activity, onHidden)
// return
// }
//
// if (customDialog != null && customDialog?.isShowing == true) {
// return // 如果对话框已经显示,则不再显示
// }
//
// customDialog = CustomDialog(activity, R.layout.dialog_ad_loading)
// customDialog?.setCountdownText(R.id.dialog_ad_loading_text)
// val countdownTimer = object : CountDownTimer((interval * 1000).toLong(), 1000) {
// override fun onTick(millisUntilFinished: Long) {
// val seconds = (millisUntilFinished / 1000).toInt()
// customDialog?.updateCountdownText("Advertising in preparation ($seconds" + "s)...")
// }
//
// override fun onFinish() {
displayInterstitialAd
(
activity
,
onHidden
)
// if (!activity.isDestroyed && !activity.isFinishing) {
// customDialog?.dismiss()
// }
// customDialog = null
// }
// }
// countdownTimer.start()
// customDialog?.show()
}
}
private
fun
showAdDialogAndLoadInterstitial
(
private
fun
showAdDialogAndLoadInterstitial
(
...
...
app/src/main/java/com/base/datarecovery/ads/admob/AdmobNativeUtils.kt
View file @
2c78df18
...
@@ -39,7 +39,7 @@ object AdmobNativeUtils {
...
@@ -39,7 +39,7 @@ object AdmobNativeUtils {
return
return
}
}
isLoading
=
true
isLoading
=
true
if
(!
AdDisplayUtils
.
getInstance
().
shouldShowAd
())
{
if
(!
AdDisplayUtils
.
getInstance
().
shouldShowAd
(
"interAd"
))
{
return
return
}
}
...
@@ -79,10 +79,7 @@ object AdmobNativeUtils {
...
@@ -79,10 +79,7 @@ object AdmobNativeUtils {
fun
showNativeAd
(
activity
:
Activity
?,
parent
:
ViewGroup
,
layout
:
Int
=
R
.
layout
.
layout_native_custom
)
{
fun
showNativeAd
(
activity
:
Activity
?,
parent
:
ViewGroup
,
layout
:
Int
=
R
.
layout
.
layout_native_custom
)
{
val
obj
=
JSONObject
()
if
(!
AdDisplayUtils
.
getInstance
().
shouldShowAd
(
"NativeAd"
))
{
obj
.
put
(
"ad_unit"
,
"NativeAd"
)
EventUtils
.
event
(
"ad_prepare_show"
,
ext
=
obj
)
if
(!
AdDisplayUtils
.
getInstance
().
shouldShowAd
())
{
return
return
}
}
loadingListener
=
{
loadingListener
=
{
...
...
app/src/main/java/com/base/datarecovery/ads/admob/AdmobOpenUtils.kt
View file @
2c78df18
...
@@ -32,7 +32,7 @@ object AdmobOpenUtils {
...
@@ -32,7 +32,7 @@ object AdmobOpenUtils {
onLoad
?.
invoke
(
1
)
onLoad
?.
invoke
(
1
)
return
return
}
}
if
(!
AdDisplayUtils
.
getInstance
().
shouldShowAd
())
{
if
(!
AdDisplayUtils
.
getInstance
().
shouldShowAd
(
"openAd"
))
{
onLoad
?.
invoke
(
2
)
onLoad
?.
invoke
(
2
)
return
return
}
}
...
@@ -71,7 +71,7 @@ object AdmobOpenUtils {
...
@@ -71,7 +71,7 @@ object AdmobOpenUtils {
if
(
activity
.
isFinishing
||
activity
.
isDestroyed
)
{
if
(
activity
.
isFinishing
||
activity
.
isDestroyed
)
{
return
return
}
}
if
(!
AdDisplayUtils
.
getInstance
().
shouldShowAd
())
{
if
(!
AdDisplayUtils
.
getInstance
().
shouldShowAd
(
"openAd"
))
{
onHidden
?.
invoke
(
1
)
onHidden
?.
invoke
(
1
)
return
return
}
}
...
...
app/src/main/java/com/base/datarecovery/ads/max/AdMaxEvent.kt
View file @
2c78df18
...
@@ -61,7 +61,7 @@ object AdMaxEvent {
...
@@ -61,7 +61,7 @@ object AdMaxEvent {
}
}
fun
showAd
(
ad
:
MaxAd
?,
adUnit
:
String
)
{
fun
showAd
(
ad
:
MaxAd
?,
adUnit
:
String
,
activity
:
Activity
)
{
val
obj
=
JSONObject
()
val
obj
=
JSONObject
()
obj
.
put
(
"UnitId"
,
ad
?.
adUnitId
)
obj
.
put
(
"UnitId"
,
ad
?.
adUnitId
)
obj
.
put
(
"ad_unit"
,
adUnit
)
obj
.
put
(
"ad_unit"
,
adUnit
)
...
@@ -74,6 +74,7 @@ object AdMaxEvent {
...
@@ -74,6 +74,7 @@ object AdMaxEvent {
obj
.
put
(
"networkplacement"
,
ad
?.
networkPlacement
)
obj
.
put
(
"networkplacement"
,
ad
?.
networkPlacement
)
obj
.
put
(
"latency"
,
ad
?.
requestLatencyMillis
)
obj
.
put
(
"latency"
,
ad
?.
requestLatencyMillis
)
obj
.
put
(
"valueMicros"
,
ad
?.
revenue
)
obj
.
put
(
"valueMicros"
,
ad
?.
revenue
)
obj
.
put
(
"from"
,
activity
.
javaClass
.
simpleName
)
if
(!
adUnit
.
equals
(
"nativeAd"
)){
if
(!
adUnit
.
equals
(
"nativeAd"
)){
EventUtils
.
event
(
"ad_show"
,
ext
=
obj
)
EventUtils
.
event
(
"ad_show"
,
ext
=
obj
)
}
else
{
}
else
{
...
...
app/src/main/java/com/base/datarecovery/ads/max/AdMaxInterstitialUtils.kt
View file @
2c78df18
...
@@ -66,7 +66,7 @@ object AdMaxInterstitialUtils {
...
@@ -66,7 +66,7 @@ object AdMaxInterstitialUtils {
override
fun
onAdDisplayed
(
p0
:
MaxAd
)
{
override
fun
onAdDisplayed
(
p0
:
MaxAd
)
{
LogEx
.
logDebug
(
TAG
,
"onAdDisplayed"
)
LogEx
.
logDebug
(
TAG
,
"onAdDisplayed"
)
AdDisplayUtils
.
getInstance
().
incrementAdDisplayCount
()
AdDisplayUtils
.
getInstance
().
incrementAdDisplayCount
()
AdMaxEvent
.
showAd
(
p0
,
"interAd"
)
AdMaxEvent
.
showAd
(
p0
,
"interAd"
,
activity
)
}
}
override
fun
onAdHidden
(
p0
:
MaxAd
)
{
override
fun
onAdHidden
(
p0
:
MaxAd
)
{
...
@@ -118,7 +118,7 @@ object AdMaxInterstitialUtils {
...
@@ -118,7 +118,7 @@ object AdMaxInterstitialUtils {
}
}
if
(!
AdDisplayUtils
.
getInstance
().
shouldShowAd
())
{
if
(!
AdDisplayUtils
.
getInstance
().
shouldShowAd
(
"interAd"
))
{
onHidden
?.
invoke
()
onHidden
?.
invoke
()
return
return
}
}
...
@@ -128,6 +128,11 @@ object AdMaxInterstitialUtils {
...
@@ -128,6 +128,11 @@ object AdMaxInterstitialUtils {
LogEx
.
logDebug
(
TAG
,
"isReady=true"
)
LogEx
.
logDebug
(
TAG
,
"isReady=true"
)
interstitialAd
?.
showAd
()
interstitialAd
?.
showAd
()
}
else
{
}
else
{
LogEx
.
logDebug
(
TAG
,
"onAdDisplayFailed"
)
val
obj2
=
JSONObject
()
obj2
.
put
(
"reason"
,
"no ad"
)
obj2
.
put
(
"ad_unit"
,
"interAd"
)
EventUtils
.
event
(
"ad_show_error"
,
ext
=
obj2
)
interstitialAd
?.
loadAd
()
interstitialAd
?.
loadAd
()
LogEx
.
logDebug
(
TAG
,
"isReady=false"
)
LogEx
.
logDebug
(
TAG
,
"isReady=false"
)
showAdDialogAndLoadInterstitial
(
activity
)
showAdDialogAndLoadInterstitial
(
activity
)
...
@@ -159,7 +164,7 @@ object AdMaxInterstitialUtils {
...
@@ -159,7 +164,7 @@ object AdMaxInterstitialUtils {
fun
loadInterstitialAd
(
activity
:
Activity
)
{
fun
loadInterstitialAd
(
activity
:
Activity
)
{
setListener
(
activity
)
setListener
(
activity
)
if
(!
AdDisplayUtils
.
getInstance
().
shouldShowAd
())
{
if
(!
AdDisplayUtils
.
getInstance
().
shouldShowAd
(
"interAd"
))
{
return
return
}
}
if
(
interstitialAd
?.
isReady
==
true
)
{
if
(
interstitialAd
?.
isReady
==
true
)
{
...
...
app/src/main/java/com/base/datarecovery/ads/max/AdMaxNativeUtils.kt
View file @
2c78df18
...
@@ -109,7 +109,7 @@ object AdMaxNativeUtils {
...
@@ -109,7 +109,7 @@ object AdMaxNativeUtils {
fun
showNativeAd
(
activity
:
Activity
,
parent
:
ViewGroup
,
layout
:
Int
)
{
fun
showNativeAd
(
activity
:
Activity
,
parent
:
ViewGroup
,
layout
:
Int
)
{
setNativeAdListener
()
setNativeAdListener
()
if
(!
AdDisplayUtils
.
getInstance
().
shouldShowAd
())
{
if
(!
AdDisplayUtils
.
getInstance
().
shouldShowAd
(
"nativeAd"
))
{
return
return
}
}
loadingListener
=
{
loadingListener
=
{
...
...
app/src/main/java/com/base/datarecovery/ads/max/AdMaxOpenUtils.kt
View file @
2c78df18
...
@@ -83,7 +83,7 @@ object AdMaxOpenUtils {
...
@@ -83,7 +83,7 @@ object AdMaxOpenUtils {
return
return
}
}
if
(!
AdDisplayUtils
.
getInstance
().
shouldShowAd
())
{
if
(!
AdDisplayUtils
.
getInstance
().
shouldShowAd
(
"openAd"
))
{
LogEx
.
logDebug
(
TAG
,
"!shouldShowAd"
)
LogEx
.
logDebug
(
TAG
,
"!shouldShowAd"
)
onHidden
?.
invoke
()
onHidden
?.
invoke
()
return
return
...
@@ -128,7 +128,7 @@ object AdMaxOpenUtils {
...
@@ -128,7 +128,7 @@ object AdMaxOpenUtils {
fun
loadAppOpenAd
(
activity
:
Activity
)
{
fun
loadAppOpenAd
(
activity
:
Activity
)
{
setListener
(
activity
)
setListener
(
activity
)
if
(!
AdDisplayUtils
.
getInstance
().
shouldShowAd
())
{
if
(!
AdDisplayUtils
.
getInstance
().
shouldShowAd
(
"openAd"
))
{
LogEx
.
logDebug
(
TAG
,
"!shouldShowAd"
)
LogEx
.
logDebug
(
TAG
,
"!shouldShowAd"
)
return
return
}
}
...
...
app/src/main/java/com/base/datarecovery/fcm/NotificationUtil.kt
View file @
2c78df18
...
@@ -9,6 +9,7 @@ import android.graphics.drawable.Icon
...
@@ -9,6 +9,7 @@ import android.graphics.drawable.Icon
import
android.os.Build
import
android.os.Build
import
android.os.Handler
import
android.os.Handler
import
android.os.HandlerThread
import
android.os.HandlerThread
import
android.util.Log
import
android.widget.RemoteViews
import
android.widget.RemoteViews
import
androidx.core.app.NotificationCompat
import
androidx.core.app.NotificationCompat
import
androidx.core.graphics.drawable.IconCompat
import
androidx.core.graphics.drawable.IconCompat
...
@@ -28,6 +29,7 @@ import com.base.datarecovery.utils.CleanJunkStringResourceManager
...
@@ -28,6 +29,7 @@ import com.base.datarecovery.utils.CleanJunkStringResourceManager
import
com.base.datarecovery.utils.DocumentRecoveryStringManager
import
com.base.datarecovery.utils.DocumentRecoveryStringManager
import
com.base.datarecovery.utils.DuplicatePhotoStringResourceManager
import
com.base.datarecovery.utils.DuplicatePhotoStringResourceManager
import
com.base.datarecovery.utils.EventUtils
import
com.base.datarecovery.utils.EventUtils
import
com.base.datarecovery.utils.LogEx
import
com.base.datarecovery.utils.PhotoRecoveryStringManager
import
com.base.datarecovery.utils.PhotoRecoveryStringManager
import
com.base.datarecovery.utils.PrivacySpaceStringManager
import
com.base.datarecovery.utils.PrivacySpaceStringManager
import
com.base.datarecovery.utils.ScreenshotCleanupStringManager
import
com.base.datarecovery.utils.ScreenshotCleanupStringManager
...
@@ -217,6 +219,7 @@ object NotificationUtil {
...
@@ -217,6 +219,7 @@ object NotificationUtil {
val
currentNum
=
AppPreferences
.
getInstance
().
getInt
(
"showNotificationCount_"
+
AdDisplayUtils
.
getInstance
().
getCurrentDate
(),
0
)
val
currentNum
=
AppPreferences
.
getInstance
().
getInt
(
"showNotificationCount_"
+
AdDisplayUtils
.
getInstance
().
getCurrentDate
(),
0
)
val
maxNum
=
AppPreferences
.
getInstance
().
getString
(
"maxShowNotificationCount"
,
"100"
).
toIntOrNull
()
?:
100
val
maxNum
=
AppPreferences
.
getInstance
().
getString
(
"maxShowNotificationCount"
,
"100"
).
toIntOrNull
()
?:
100
if
(
currentNum
>=
maxNum
)
{
if
(
currentNum
>=
maxNum
)
{
LogEx
.
logDebug
(
"glc"
,
"currentNum >= maxNum"
)
return
return
}
}
...
@@ -224,6 +227,7 @@ object NotificationUtil {
...
@@ -224,6 +227,7 @@ object NotificationUtil {
EventUtils
.
event
(
"showNotification"
,
null
,
null
,
false
)
EventUtils
.
event
(
"showNotification"
,
null
,
null
,
false
)
if
(
MyApplication
.
PAUSED_VALUE
==
1
)
{
if
(
MyApplication
.
PAUSED_VALUE
==
1
)
{
LogEx
.
logDebug
(
"glc"
,
"MyApplication.PAUSED_VALUE == 1)"
)
return
return
}
}
...
@@ -233,6 +237,7 @@ object NotificationUtil {
...
@@ -233,6 +237,7 @@ object NotificationUtil {
val
nowTime
=
System
.
currentTimeMillis
()
val
nowTime
=
System
.
currentTimeMillis
()
val
x
=
nowTime
-
lastTime
val
x
=
nowTime
-
lastTime
if
(
x
<
(
interval
*
1000
))
{
if
(
x
<
(
interval
*
1000
))
{
LogEx
.
logDebug
(
"glc"
,
"sendNotification x < (interval * 1000)"
)
return
return
}
}
...
...
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