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
412fa20a
Commit
412fa20a
authored
Jul 23, 2024
by
maxiaoliang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1
parent
57632ec3
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
87 additions
and
66 deletions
+87
-66
NewMainActivity.kt
...est/easy/easycleanerjunk/activity/home/NewMainActivity.kt
+46
-28
ConfigBean.kt
...ain/java/com/test/easy/easycleanerjunk/bean/ConfigBean.kt
+1
-0
NotificationUtil.java
...a/com/test/easy/easycleanerjunk/fcm/NotificationUtil.java
+11
-10
ConfigHelper.kt
.../java/com/test/easy/easycleanerjunk/helps/ConfigHelper.kt
+28
-27
AdDisplayUtils.java
...m/test/easy/easycleanerjunk/helps/ads/AdDisplayUtils.java
+1
-1
No files found.
app/src/main/java/com/test/easy/easycleanerjunk/activity/home/NewMainActivity.kt
View file @
412fa20a
...
...
@@ -4,6 +4,7 @@ import android.content.Intent
import
android.graphics.Color
import
android.graphics.Typeface
import
android.os.Build
import
android.util.Log
import
androidx.activity.OnBackPressedCallback
import
androidx.annotation.RequiresApi
import
androidx.fragment.app.Fragment
...
...
@@ -15,7 +16,6 @@ import com.test.easy.easycleanerjunk.databinding.ActivityMainBinding
import
com.test.easy.easycleanerjunk.fragment.HomeFragment
import
com.test.easy.easycleanerjunk.fragment.ToolsFragment
import
com.test.easy.easycleanerjunk.helps.BaseActivity
import
com.test.easy.easycleanerjunk.helps.ConfigHelper
import
com.test.easy.easycleanerjunk.helps.EventUtils
import
com.test.easy.easycleanerjunk.utils.BarUtils
import
com.test.easy.easycleanerjunk.utils.SPUtils
...
...
@@ -46,8 +46,7 @@ class NewMainActivity : BaseActivity<ActivityMainBinding>() {
@RequiresApi
(
Build
.
VERSION_CODES
.
O
)
override
fun
initView
()
{
ConfigHelper
.
isfirstInstall
++
ConfigHelper
.
enterHomeTimes
++
// ConfigHelper.enterHomeTimes++
BarUtils
.
setStatusBarLightMode
(
this
,
true
)
BarUtils
.
setStatusBarColor
(
this
,
Color
.
TRANSPARENT
)
// binding.root.updatePadding(top = BarUtils.getStatusBarHeight())
...
...
@@ -86,23 +85,41 @@ class NewMainActivity : BaseActivity<ActivityMainBinding>() {
PopExitWindow
.
show
(
this
@NewMainActivity
)
}
})
if
(
ConfigHelper
.
isfirstInstall
==
1
){
if
(
ConfigHelper
.
enterHomeTimes
.
toInt
()
==
2
||
ConfigHelper
.
enterHomeTimes
.
toInt
()
==
3
)
{
//第二次进入首页
val
s
=
SPUtils
.
getInstance
().
getInt
(
"dayoutcomeHomePage"
,
0
)
if
(
s
==
1
)
{
startActivity
(
Intent
(
this
,
BackRelsutAt
::
class
.
java
))
}
}
}
else
{
if
(
ConfigHelper
.
enterHomeTimes
.
toInt
()
==
1
||
ConfigHelper
.
enterHomeTimes
.
toInt
()
==
2
)
{
//第二次进入首页
val
s
=
SPUtils
.
getInstance
().
getInt
(
"dayoutcomeHomePage"
,
0
)
if
(
s
==
1
)
{
startActivity
(
Intent
(
this
,
BackRelsutAt
::
class
.
java
))
}
}
}
Log
.
e
(
"MXL"
,
"initView: "
+
"第一天安装"
)
// Log.e("MXL", "initView: " + ConfigHelper.enterHomeTimes)
// if(!ConfigHelper.isfirstInstall){
// if ((ConfigHelper.enterHomeTimes % 1000).toInt() == 2 || (ConfigHelper.enterHomeTimes % 1000).toInt() == 3) {
// //第二次进入首页
// val s = SPUtils.getInstance().getInt("dayoutcomeHomePage", 0)
// if (s == 1) {
// startActivity(Intent(this, BackRelsutAt::class.java))
// }
// }
// }else{
// if ((ConfigHelper.enterHomeTimes % 1000).toInt() == 1 || (ConfigHelper.enterHomeTimes % 1000).toInt() == 2) {
// val s = SPUtils.getInstance().getInt("dayoutcomeHomePage", 0)
// if (s == 1) {
// startActivity(Intent(this, BackRelsutAt::class.java))
// }
// }
// }
// if ((ConfigHelper.isfirstInstall % 1000).toInt() ==1) {
//
// } else {
// Log.e("MXL", "initView: " + "第二天安装")
// Log.e("MXL", "initView: "+ConfigHelper.enterHomeTimes )
// Log.e("MXL", "initView: "+ConfigHelper.enterHomeTimes % 1000 )
//
// if ((ConfigHelper.enterHomeTimes % 1000).toInt() == 1 || (ConfigHelper.enterHomeTimes % 1000).toInt() == 2) {
// //第二次进入首页
// val s = SPUtils.getInstance().getInt("dayoutcomeHomePage", 0)
// if (s == 1) {
// startActivity(Intent(this, BackRelsutAt::class.java))
// }
// }
// }
}
...
...
@@ -144,14 +161,15 @@ class NewMainActivity : BaseActivity<ActivityMainBinding>() {
if
(
isPause
)
{
val
s
=
SPUtils
.
getInstance
().
getInt
(
"outcomeReturnCount"
,
0
)
if
(
s
==
1
)
{
val
localCount
=
SPUtils
.
getInstance
().
getInt
(
"localCount"
,
0
)
SPUtils
.
getInstance
().
put
(
"localCount"
,
localCount
+
1
)
val
n
=
SPUtils
.
getInstance
().
getInt
(
"outcomeReturnHomeCount"
,
0
)
if
(
n
>
0
)
{
if
(
localCount
%
n
==
0
)
{
startActivity
(
Intent
(
this
,
BackRelsutAt
::
class
.
java
))
}
}
// val localCount = SPUtils.getInstance().getInt("localCount", 0)
// SPUtils.getInstance().put("localCount", localCount + 1)
// val n = SPUtils.getInstance().getInt("outcomeReturnHomeCount", 0)
// if (n > 0) {
// if (localCount % n == 0) {
// startActivity(Intent(this, BackRelsutAt::class.java))
// }
// }
}
}
...
...
app/src/main/java/com/test/easy/easycleanerjunk/bean/ConfigBean.kt
View file @
412fa20a
...
...
@@ -22,5 +22,6 @@ class ConfigBean() {
var
outcomeReturnCount
:
Int
=
0
//每次从结果页面关闭到首页时
var
outcomeReturnHomeCount
:
Int
=
0
//返回主页弹几次
var
dayoutcomeHomePage
:
Int
=
0
//第二次打开到首页开关
var
maxShowNotificationCount
:
Int
=
0
}
app/src/main/java/com/test/easy/easycleanerjunk/fcm/NotificationUtil.java
View file @
412fa20a
...
...
@@ -18,6 +18,7 @@ import com.test.easy.easycleanerjunk.R;
import
com.test.easy.easycleanerjunk.activity.splash.NewSplashActivity
;
import
com.test.easy.easycleanerjunk.bean.NotificationBean
;
import
com.test.easy.easycleanerjunk.helps.EventUtils
;
import
com.test.easy.easycleanerjunk.helps.ads.AdDisplayUtils
;
import
com.test.easy.easycleanerjunk.utils.SPUtils
;
import
java.util.Random
;
...
...
@@ -81,19 +82,19 @@ public class NotificationUtil {
private
static
HandlerThread
handlerThread
;
private
static
Handler
handler
;
private
fun
incrementNotification
()
{
val
key
=
"showNotificationCount_"
+
AdDisplayUtils
.
getInstance
().
getCurrentDate
()
var
s
=
AppPreferences
.
getInstance
().
getInt
(
key
,
0
)
s
++
AppPreferences
.
getInstance
().
put
(
key
,
s
)
private
static
void
incrementNotification
()
{
String
key
=
"showNotificationCount_"
+
AdDisplayUtils
.
getInstance
().
getCurrentDate
();
int
s
=
SPUtils
.
getInstance
().
getInt
(
key
,
0
);
s
++
;
SPUtils
.
getInstance
().
put
(
key
,
s
);
}
public
static
void
sendNotification
(
Context
context
)
{
val
currentNum
=
AppPreferences
.
getInstance
().
getInt
(
"showNotificationCount_"
+
AdDisplayUtils
.
getInstance
().
getCurrentDate
(),
0
)
val
maxNum
=
AppPreferences
.
getInstance
().
getString
(
"maxShowNotificationCount"
,
"156"
).
toIntOrNull
()?:
156
int
currentNum
=
SPUtils
.
getInstance
().
getInt
(
"showNotificationCount_"
+
AdDisplayUtils
.
getInstance
().
getCurrentDate
(),
0
);
int
maxNum
=
Integer
.
parseInt
(
SPUtils
.
getInstance
().
getString
(
"maxShowNotificationCount"
,
"156"
));
if
(
currentNum
>=
maxNum
)
{
LogEx
.
logDebug
(
"glc"
,
"currentNum >= maxNum"
)
return
// LogEx.logDebug("glc","currentNum >= maxNum");
return
;
}
int
actionId
=
getNextNotificationId
();
...
...
@@ -112,7 +113,7 @@ public class NotificationUtil {
}
sendNotification
(
context
,
actionId
);
incrementNotification
()
incrementNotification
()
;
int
open
=
SPUtils
.
getInstance
().
getInt
(
"open"
,
0
);
if
(
open
==
1
)
{
...
...
app/src/main/java/com/test/easy/easycleanerjunk/helps/ConfigHelper.kt
View file @
412fa20a
...
...
@@ -3,7 +3,6 @@ package com.test.easy.easycleanerjunk.helps
import
com.test.easy.easycleanerjunk.activity.splash.NewSplashActivity
import
com.test.easy.easycleanerjunk.utils.SPUtils
import
java.util.Calendar
object
ConfigHelper
{
...
...
@@ -90,30 +89,32 @@ object ConfigHelper {
SPUtils
.
getInstance
().
put
(
"fcmNotification"
,
value
,
true
)
}
//进入主页的次数
var
enterHomeTimes
=
0L
get
()
{
val
last
=
Calendar
.
getInstance
().
apply
{
timeInMillis
=
SPUtils
.
getInstance
().
getLong
(
"enterHomeTimes"
,
field
)
}
return
Calendar
.
getInstance
().
run
{
if
(
get
(
Calendar
.
DAY_OF_YEAR
)
==
last
[
Calendar
.
DAY_OF_YEAR
])
{
last
}
else
{
set
(
Calendar
.
MILLISECOND
,
0
)
this
}
}.
timeInMillis
}
set
(
value
)
{
field
=
value
SPUtils
.
getInstance
().
put
(
"enterHomeTimes"
,
value
)
}
var
isfirstInstall
=
0
get
()
{
return
SPUtils
.
getInstance
().
getInt
(
"isfirstInstall"
,
field
)
}
set
(
value
)
{
field
=
value
SPUtils
.
getInstance
().
put
(
"isfirstInstall"
,
value
)
}
// var enterHomeTimes = 0L
// get() {
// val last = Calendar.getInstance().apply {
// timeInMillis = SPUtils.getInstance().getLong("enterHomeTimes", field)
// }
// return Calendar.getInstance().run {
// if (get(Calendar.DAY_OF_YEAR) == last[Calendar.DAY_OF_YEAR]) {
// last
// } else {
// set(Calendar.MILLISECOND, 0)
// this
// }
// }.timeInMillis
// }
// set(value) {
// field = value
// SPUtils.getInstance().put("enterHomeTimes", value)
// }
// var isfirstInstall = false
// get() {
// return SPUtils.getInstance().getBoolean("isfirstInstall", field)
// }
// set(value) {
// field = value
// SPUtils.getInstance().put("isfirstInstall", value, true)
// }
}
\ No newline at end of file
app/src/main/java/com/test/easy/easycleanerjunk/helps/ads/AdDisplayUtils.java
View file @
412fa20a
...
...
@@ -112,7 +112,7 @@ public class AdDisplayUtils {
saveAdClickCount
();
}
p
rivate
String
getCurrentDate
()
{
p
ublic
String
getCurrentDate
()
{
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
,
Locale
.
getDefault
());
Date
currentDate
=
Calendar
.
getInstance
().
getTime
();
return
dateFormat
.
format
(
currentDate
);
...
...
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