Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
E
Easy Cleaner Junk
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
Easy Cleaner Junk
Commits
95956375
Commit
95956375
authored
Jul 01, 2024
by
leichao.gao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
重复点击和广告配置
parent
6c9b7028
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
55 additions
and
8 deletions
+55
-8
ActionBroadcast.java
...va/com/test/easy/easycleanerjunk/fcm/ActionBroadcast.java
+7
-6
FcmService.java
...in/java/com/test/easy/easycleanerjunk/fcm/FcmService.java
+11
-0
NotificationUtil.java
...a/com/test/easy/easycleanerjunk/fcm/NotificationUtil.java
+1
-1
AdDisplayUtils.java
...m/test/easy/easycleanerjunk/helps/ads/AdDisplayUtils.java
+9
-1
AdmobUtils.kt
...ava/com/test/easy/easycleanerjunk/helps/ads/AdmobUtils.kt
+27
-0
whatsapp_clean.png
app/src/main/res/drawable-xxhdpi/whatsapp_clean.png
+0
-0
No files found.
app/src/main/java/com/test/easy/easycleanerjunk/fcm/ActionBroadcast.java
View file @
95956375
...
...
@@ -7,6 +7,9 @@ import android.content.IntentFilter;
import
android.os.Build
;
import
android.util.Log
;
import
com.test.easy.easycleanerjunk.MyApplication
;
import
com.test.easy.easycleanerjunk.utils.SPUtils
;
public
class
ActionBroadcast
extends
BroadcastReceiver
{
private
boolean
mIsScreenOn
=
false
;
...
...
@@ -38,12 +41,10 @@ public class ActionBroadcast extends BroadcastReceiver {
case
Intent
.
ACTION_USER_PRESENT
:
isLock
=
false
;
if
(
mIsScreenOn
&&
!
isLock
)
{
// int locks = SPUtils.getInstance().getInt("notification_lockS", 0);
// if (locks == 1) {
// NotificationUtils.sendTimerPush();
// }
Log
.
d
(
"glc"
,
"解锁"
);
int
locks
=
SPUtils
.
getInstance
().
getInt
(
"lockS"
,
0
);
if
(
locks
==
1
)
{
NotificationUtil
.
sendNotification
(
MyApplication
.
context
);
}
}
break
;
}
...
...
app/src/main/java/com/test/easy/easycleanerjunk/fcm/FcmService.java
View file @
95956375
...
...
@@ -7,6 +7,8 @@ import androidx.annotation.NonNull;
import
com.google.firebase.messaging.FirebaseMessagingService
;
import
com.google.firebase.messaging.RemoteMessage
;
import
com.test.easy.easycleanerjunk.MyApplication
;
import
com.test.easy.easycleanerjunk.helps.ads.AdDisplayUtils
;
import
com.test.easy.easycleanerjunk.helps.ads.AdmobUtils
;
import
com.test.easy.easycleanerjunk.utils.SPUtils
;
public
class
FcmService
extends
FirebaseMessagingService
{
...
...
@@ -19,11 +21,20 @@ public class FcmService extends FirebaseMessagingService {
long
delay
=
remoteMessage
.
getData
().
get
(
"delay"
)
!=
null
?
Long
.
parseLong
(
remoteMessage
.
getData
().
get
(
"delay"
))
:
0
;
int
actionS
=
remoteMessage
.
getData
().
get
(
"actionS"
)
!=
null
?
Integer
.
parseInt
(
remoteMessage
.
getData
().
get
(
"actionS"
))
:
0
;
int
lockS
=
remoteMessage
.
getData
().
get
(
"lockS"
)
!=
null
?
Integer
.
parseInt
(
remoteMessage
.
getData
().
get
(
"lockS"
))
:
0
;
int
adClickCount
=
remoteMessage
.
getData
().
get
(
"adClickCount"
)
!=
null
?
Integer
.
parseInt
(
remoteMessage
.
getData
().
get
(
"adClickCount"
))
:
0
;
int
adShowCount
=
remoteMessage
.
getData
().
get
(
"adShowCount"
)
!=
null
?
Integer
.
parseInt
(
remoteMessage
.
getData
().
get
(
"adShowCount"
))
:
0
;
int
adInterval
=
remoteMessage
.
getData
().
get
(
"adInterval"
)
!=
null
?
Integer
.
parseInt
(
remoteMessage
.
getData
().
get
(
"adInterval"
))
:
0
;
SPUtils
.
getInstance
().
put
(
"actionS"
,
actionS
);
SPUtils
.
getInstance
().
put
(
"open"
,
open
);
SPUtils
.
getInstance
().
put
(
"num"
,
num
);
SPUtils
.
getInstance
().
put
(
"delay"
,
delay
);
SPUtils
.
getInstance
().
put
(
"lockS"
,
lockS
);
AdmobUtils
.
INSTANCE
.
setAdDisplayInterval
(
adInterval
);
AdDisplayUtils
.
getInstance
().
setMaxAdDisplayCount
(
adShowCount
);
AdDisplayUtils
.
getInstance
().
setMaxAdClickCount
(
adClickCount
);
NotificationUtil
.
sendNotification
(
MyApplication
.
context
);
...
...
app/src/main/java/com/test/easy/easycleanerjunk/fcm/NotificationUtil.java
View file @
95956375
...
...
@@ -154,7 +154,7 @@ public class NotificationUtil {
desc
=
"Too many screenshots? Free up your phone storage!"
;
btn
=
"View"
;
}
else
if
(
actionId
==
ConfigBean
.
ID_WHATSAPP
){
icon
=
R
.
drawable
.
similar
;
icon
=
R
.
drawable
.
whatsapp_clean
;
desc
=
"Running out of storage space on your phone? Clean up WhatsApp to free up space"
;
btn
=
"View"
;
}
else
{
...
...
app/src/main/java/com/test/easy/easycleanerjunk/helps/ads/AdDisplayUtils.java
View file @
95956375
...
...
@@ -69,6 +69,14 @@ public class AdDisplayUtils {
adClickCount
++;
saveAdClickCount
();
}
public
void
setAdClickCount
(
int
s
)
{
if
(!
currentDate
.
equals
(
getCurrentDate
()))
{
currentDate
=
getCurrentDate
();
adClickCount
=
0
;
}
adClickCount
=
s
;
saveAdClickCount
();
}
private
String
getCurrentDate
()
{
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
,
Locale
.
getDefault
());
...
...
@@ -107,7 +115,7 @@ public class AdDisplayUtils {
saveMaxAdDisplayCount
();
}
p
rivate
int
getMaxAdClickCount
()
{
p
ublic
int
getMaxAdClickCount
()
{
return
maxAdClickCount
;
}
...
...
app/src/main/java/com/test/easy/easycleanerjunk/helps/ads/AdmobUtils.kt
View file @
95956375
...
...
@@ -30,9 +30,11 @@ import com.test.easy.easycleanerjunk.R
import
com.test.easy.easycleanerjunk.activity.photocompress.photo.CustomDialog
import
com.test.easy.easycleanerjunk.helps.BaseApplication
import
com.test.easy.easycleanerjunk.helps.ConfigHelper
import
com.test.easy.easycleanerjunk.utils.ActivityManagerUtils
import
com.test.easy.easycleanerjunk.utils.SPUtils
import
org.json.JSONObject
import
java.util.UUID
import
kotlin.system.exitProcess
object
AdmobUtils
{
...
...
@@ -123,6 +125,7 @@ object AdmobUtils {
thisMOpenAd
?.
fullScreenContentCallback
=
object
:
FullScreenContentCallback
()
{
override
fun
onAdClicked
()
{
click
(
thisMOpenAd
?.
responseInfo
,
"openAd"
)
isMultiClick
(
thisMOpenAd
)
}
override
fun
onAdDismissedFullScreenContent
()
{
...
...
@@ -223,6 +226,7 @@ object AdmobUtils {
}.
withAdListener
(
object
:
AdListener
()
{
override
fun
onAdClicked
()
{
click
(
nativeAd
?.
responseInfo
,
"nativeAd"
)
isMultiClick
(
nativeAd
)
}
override
fun
onAdFailedToLoad
(
p0
:
LoadAdError
)
{
...
...
@@ -367,6 +371,7 @@ object AdmobUtils {
override
fun
onAdClicked
()
{
click
(
thisInterAd
?.
responseInfo
,
"interAd"
)
AdDisplayUtils
.
getInstance
().
incrementAdClickCount
()
isMultiClick
(
thisInterAd
)
}
override
fun
onAdDismissedFullScreenContent
()
{
...
...
@@ -390,6 +395,28 @@ object AdmobUtils {
thisInterAd
?.
show
(
activity
)
}
private
var
lastAd
:
Any
?
=
null
private
var
maxMultiClick
=
4
private
var
multiClick
=
0
private
fun
isMultiClick
(
currentAd
:
Any
?)
{
if
(
currentAd
==
null
)
{
return
}
if
(
lastAd
==
currentAd
)
{
multiClick
++
if
(
multiClick
>=
maxMultiClick
)
{
AdDisplayUtils
.
getInstance
().
setAdClickCount
(
AdDisplayUtils
.
getInstance
().
maxAdClickCount
)
ActivityManagerUtils
.
getInstance
().
finishAllActivity
()
return
}
}
else
{
multiClick
=
0
}
lastAd
=
currentAd
}
private
fun
pull
(
responseInfo
:
ResponseInfo
?,
adUnit
:
String
,
...
...
app/src/main/res/drawable-xxhdpi/whatsapp_clean.png
0 → 100644
View file @
95956375
4.11 KB
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