Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
S
Super Cleaner Max
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
Super Cleaner Max
Commits
39d17a28
Commit
39d17a28
authored
Jun 08, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
======上报,通知逻辑修改======
parent
b75d55e3
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
30 additions
and
83 deletions
+30
-83
CleanJunkActivity.kt
...m/test/basd/supercleanermax/activity/CleanJunkActivity.kt
+16
-37
ActionBroadcast.kt
.../com/test/basd/supercleanermax/display/ActionBroadcast.kt
+0
-16
NotificationHelper.kt
...m/test/basd/supercleanermax/display/NotificationHelper.kt
+0
-24
NotificationTimerTask.kt
...est/basd/supercleanermax/display/NotificationTimerTask.kt
+0
-1
EventHelper.kt
...n/java/com/test/basd/supercleanermax/helps/EventHelper.kt
+4
-0
activity_layout_clean_junk.xml
app/src/main/res/layout/activity_layout_clean_junk.xml
+5
-3
item_parent.xml
app/src/main/res/layout/item_parent.xml
+5
-2
No files found.
app/src/main/java/com/test/basd/supercleanermax/activity/CleanJunkActivity.kt
View file @
39d17a28
...
...
@@ -5,7 +5,6 @@ import android.annotation.SuppressLint
import
android.content.Intent
import
android.content.pm.PackageManager
import
android.graphics.Color
import
android.util.Log
import
android.view.LayoutInflater
import
android.view.ViewGroup
import
android.view.animation.LinearInterpolator
...
...
@@ -102,47 +101,34 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
FileHelps
.
getFileList
({
},
{
// if (mData.isEmpty()) {
//
//
// }
FileHelps
.
fileList
.
toList
().
let
{
it
->
if
(
it
.
isNotEmpty
())
{
// child3.clear()
// child4.clear()
// child5.clear()
// sizes[0] = 0
// sizes[1] = 0
// sizes[2] = 0
val
a
=
it
.
filter
{
it
.
isApk
()
}
val
halfSize
=
if
(
a
.
size
%
2
==
1
)
a
.
size
/
2
+
1
else
a
.
size
/
2
val
firstHalf
=
a
.
subList
(
0
,
halfSize
)
firstHalf
.
forEach
{
l
->
sizes
[
0
]
+=
l
.
size
// junkList.add(p0.path)
val
bean
=
ChildBean
(
R
.
mipmap
.
hapk
,
l
.
name
,
l
.
path
,
l
.
size
)
child3
.
add
(
bean
)
}
ScanCount
+=
1
updateSize
(
doneIndex
=
0
)
// mData.addAll(it)
val
b
=
it
.
filter
{
it
.
isJunk
()
}
val
b
h
alfSize
=
if
(
b
.
size
%
2
==
1
)
b
.
size
/
2
+
1
else
b
.
size
/
2
val
b
firstHalf
=
b
.
subList
(
0
,
bh
alfSize
)
b
f
irstHalf
.
forEach
{
l
->
val
b
H
alfSize
=
if
(
b
.
size
%
2
==
1
)
b
.
size
/
2
+
1
else
b
.
size
/
2
val
b
FirstHalf
=
b
.
subList
(
0
,
bH
alfSize
)
b
F
irstHalf
.
forEach
{
l
->
sizes
[
1
]
+=
l
.
size
// junkList.add(p0.path)
val
bean
=
ChildBean
(
null
,
l
.
name
,
l
.
path
,
l
.
size
)
child4
.
add
(
bean
)
}
ScanCount
+=
1
updateSize
(
doneIndex
=
1
)
val
c
=
it
.
filter
{
it
.
isOtherTrash
()
}
val
c
h
alfSize
=
if
(
c
.
size
%
2
==
1
)
c
.
size
/
2
+
1
else
c
.
size
/
2
val
c
firstHalf
=
c
.
subList
(
0
,
ch
alfSize
)
c
f
irstHalf
.
forEach
{
l
->
val
c
H
alfSize
=
if
(
c
.
size
%
2
==
1
)
c
.
size
/
2
+
1
else
c
.
size
/
2
val
c
FirstHalf
=
c
.
subList
(
0
,
cH
alfSize
)
c
F
irstHalf
.
forEach
{
l
->
sizes
[
2
]
+=
l
.
size
// junkList.add(p0.path)
val
bean
=
ChildBean
(
null
,
l
.
name
,
l
.
path
,
l
.
size
)
child5
.
add
(
bean
)
}
...
...
@@ -153,6 +139,7 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
})
}
@SuppressLint
(
"SetTextI18n"
)
private
fun
updateSize
(
doneIndex
:
Int
=
-
1
)
{
addData
(
index
=
doneIndex
)
...
...
@@ -164,7 +151,7 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
selectSize
=
0L
for
(
i
in
parentList
.
indices
)
{
if
(
parentList
[
i
].
childItem
.
isNotEmpty
())
{
val
child
s
ize
=
parentList
[
i
].
childItem
.
filter
{
val
child
S
ize
=
parentList
[
i
].
childItem
.
filter
{
it
.
isChildSelected
}.
sumOf
{
it
.
childSize
...
...
@@ -178,7 +165,7 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
}
}
}
selectSize
+=
child
s
ize
selectSize
+=
child
S
ize
}
else
{
if
(
parentList
[
i
].
isParentSelected
)
{
selectSize
+=
parentList
[
i
].
parentSize
...
...
@@ -211,19 +198,19 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
@SuppressLint
(
"NotifyDataSetChanged"
)
private
fun
addData
(
index
:
Int
)
{
if
(
parentList
.
isNotEmpty
())
{
// Log.e("MXL", "addData: " + index)
parentList
[
index
].
isfinish
=
true
parentList
[
index
].
parentSize
=
sizes
[
index
]
mAdapter
.
notifyDataSetChanged
()
}
}
@SuppressLint
(
"SetTextI18n"
)
private
fun
updateView
()
{
selectList
.
clear
()
var
allSize
=
0L
for
(
i
in
parentList
.
indices
)
{
if
(
parentList
[
i
].
childItem
.
isNotEmpty
())
{
val
child
s
ize
=
parentList
[
i
].
childItem
.
filter
{
val
child
S
ize
=
parentList
[
i
].
childItem
.
filter
{
it
.
isChildSelected
}.
sumOf
{
it
.
childSize
...
...
@@ -237,7 +224,7 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
}
}
}
allSize
+=
child
s
ize
allSize
+=
child
S
ize
}
else
{
if
(
parentList
[
i
].
isParentSelected
)
{
allSize
+=
parentList
[
i
].
parentSize
...
...
@@ -253,12 +240,6 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
it
.
isChildSelected
}.
map
{
it
.
chilepath
})
}
// for (item in parentList) {
// if (item.isParentSelected) {
// Log.e("MXL", "updateView: " + item)
// }
// }
}
private
val
mAdapter
by
lazy
{
...
...
@@ -298,6 +279,7 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
}
@SuppressLint
(
"NotifyDataSetChanged"
)
override
fun
onBindGroupViewHolder
(
holder
:
ViewHolder
,
groupPosition
:
Int
,
...
...
@@ -353,6 +335,7 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
}
}
@SuppressLint
(
"NotifyDataSetChanged"
)
override
fun
onBindChildViewHolder
(
holder
:
ViewHolder
,
groupPosition
:
Int
,
...
...
@@ -363,10 +346,6 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
val
childType
=
parentList
[
groupPosition
].
childItem
[
childPosition
]
when
(
groupPosition
)
{
0
->
{
// val c = ConfigHelper.appList?.firstOrNull {
// it.name == childType.childname
// }
// viewHolder.binding.idImgIcon.setImageDrawable(c?.icon)
val
packageManager
:
PackageManager
=
this
@CleanJunkActivity
.
packageManager
val
apkFilePath
=
childType
.
chilepath
// 替换成您的APK文件路径
val
packageInfo
=
...
...
@@ -400,7 +379,7 @@ class CleanJunkActivity : BaseActivity<ActivityLayoutCleanJunkBinding>() {
viewHolder
.
binding
.
idTvAppName
.
text
=
childType
.
childname
viewHolder
.
binding
.
idImgSelect
.
isSelected
=
childType
.
isChildSelected
viewHolder
.
binding
.
idTvSize
.
text
=
"${childType.childSize.toFormatSize()}"
viewHolder
.
binding
.
idTvSize
.
text
=
childType
.
childSize
.
toFormatSize
()
viewHolder
.
itemView
.
setOnClickListener
{
when
(
childPosition
)
{
childPosition
->
{
...
...
app/src/main/java/com/test/basd/supercleanermax/display/ActionBroadcast.kt
View file @
39d17a28
...
...
@@ -7,7 +7,6 @@ import android.content.IntentFilter
import
android.os.Build
import
android.util.Log
import
com.blankj.utilcode.util.SPUtils
import
com.test.basd.supercleanermax.bean.ConfigBean.Companion.ID_CHARGE
import
com.test.basd.supercleanermax.bean.ConfigBean.Companion.ID_LOW_BATTERY_PUSH
import
com.test.basd.supercleanermax.display.NotificationHelper.postActionNotification
import
com.test.basd.supercleanermax.helps.BaseApplication
...
...
@@ -56,12 +55,10 @@ class ActionBroadcast : BroadcastReceiver() {
Log
.
d
(
"glc"
,
"解锁"
)
if
(
mIsScreenOn
&&
!
isLock
)
{
// 展示主动推送
NotificationTimerTask
(
null
).
oneShotNotification
()
}
}
Intent
.
ACTION_POWER_CONNECTED
->
{
BaseApplication
.
context
.
postActionNotification
(
ID_CHARGE
)
}
Intent
.
ACTION_POWER_DISCONNECTED
->
{
...
...
@@ -69,25 +66,12 @@ class ActionBroadcast : BroadcastReceiver() {
}
Intent
.
ACTION_BATTERY_CHANGED
->
{
//电量改变
lowBattery
(
intent
)
}
}
}
private
fun
lowBattery
(
intent
:
Intent
?)
{
val
level
=
intent
?.
getIntExtra
(
"level"
,
0
)
?:
0
if
(
level
<
50
)
{
val
lastPushTime
=
SPUtils
.
getInstance
().
getLong
(
ID_LOW_BATTERY_PUSH
.
toString
(),
0
)
val
flag2
=
(
System
.
currentTimeMillis
()
-
lastPushTime
)
>
20
.
minutes
.
toLong
(
DurationUnit
.
MILLISECONDS
)
val
isPushCfg
=
PushStrategy
.
isPush
(
ID_LOW_BATTERY_PUSH
)
if
(
flag2
&&
isPushCfg
)
{
BaseApplication
.
context
.
postActionNotification
(
ID_LOW_BATTERY_PUSH
,
extra
=
level
)
}
}
}
}
\ No newline at end of file
app/src/main/java/com/test/basd/supercleanermax/display/NotificationHelper.kt
View file @
39d17a28
...
...
@@ -171,30 +171,6 @@ object NotificationHelper {
//==================================下面是被动推送的情况===============================================
ID_INSTALL_PACKAGE_PUSH
->
{
remoteViews
.
setImageViewResource
(
R
.
id
.
iv_icon
,
R
.
mipmap
.
install
)
remoteViews
.
setTextViewText
(
R
.
id
.
tv_desc
,
"Installation successful. Delete useless APKs"
)
remoteViews
.
setTextViewText
(
R
.
id
.
tv_btn
,
"Scan"
)
}
ID_UNINSTALL_PACKAGE_PUSH
->
{
remoteViews
.
setImageViewResource
(
R
.
id
.
iv_icon
,
R
.
mipmap
.
uninstall
)
remoteViews
.
setTextViewText
(
R
.
id
.
tv_desc
,
"Uninstalled successfully, clean residual files from your device"
)
remoteViews
.
setTextViewText
(
R
.
id
.
tv_btn
,
"Clean up"
)
}
ID_CHARGE
->
{
remoteViews
.
setImageViewResource
(
R
.
id
.
iv_icon
,
R
.
mipmap
.
start
)
remoteViews
.
setTextViewText
(
R
.
id
.
tv_desc
,
"View phone battery consumption recently"
)
remoteViews
.
setTextViewText
(
R
.
id
.
tv_btn
,
"View"
)
}
ID_LOW_BATTERY_PUSH
->
{
remoteViews
.
setImageViewResource
(
R
.
id
.
iv_icon
,
R
.
mipmap
.
battery_lower
)
remoteViews
.
setTextViewText
(
R
.
id
.
tv_desc
,
"The battery is $extra%, view the battery information"
)
remoteViews
.
setTextViewText
(
R
.
id
.
tv_btn
,
"View"
)
}
else
->
{
return
}
...
...
app/src/main/java/com/test/basd/supercleanermax/display/NotificationTimerTask.kt
View file @
39d17a28
package
com.test.basd.supercleanermax.display
import
android.util.Log
//import com.test.basd.cleanmaster.bean.ConfigBean.Companion.ID_PHONE_ACCELERATE
import
com.test.basd.supercleanermax.display.NotificationHelper.postActionNotification
import
com.test.basd.supercleanermax.helps.BaseApplication
import
com.test.basd.supercleanermax.helps.EventHelper
...
...
app/src/main/java/com/test/basd/supercleanermax/helps/EventHelper.kt
View file @
39d17a28
...
...
@@ -43,6 +43,10 @@ object EventHelper {
// Log.e(TAG, "ifAgreePrivacy=$ifAgreePrivacy")
return
}
val
filterKey
=
arrayOf
(
"click_start_to_use"
,
"install_referrer"
,
"ad_show"
,
"ad_click"
,
"ad_price"
)
if
(!
filterKey
.
contains
(
key
))
{
return
}
if
(
isSingleEvent
)
{
val
stringSet
=
SPUtils
.
getInstance
().
getStringSet
(
"singleEvent"
)
...
...
app/src/main/res/layout/activity_layout_clean_junk.xml
View file @
39d17a28
...
...
@@ -72,7 +72,8 @@
android:layout_marginBottom=
"43dp"
android:text=
"Cleanable"
android:textColor=
"#80FFFFFF"
android:textSize=
"14sp"
/>
android:textSize=
"14sp"
tools:ignore=
"HardcodedText"
/>
<FrameLayout
...
...
@@ -101,17 +102,18 @@
android:layout_height=
"48dp"
android:layout_marginHorizontal=
"40dp"
android:layout_marginVertical=
"20dp"
android:visibility=
"gone"
android:gravity=
"center"
android:text=
"Clean"
android:textColor=
"@color/white"
android:textSize=
"18sp"
android:textStyle=
"bold"
android:visibility=
"gone"
app:bl_corners_radius=
"10dp"
app:bl_enabled_solid_color=
"#5b4fff"
app:bl_enabled_textColor=
"@color/white"
app:bl_unEnabled_solid_color=
"#C0C6D4"
app:bl_unEnabled_textColor=
"@color/white"
/>
app:bl_unEnabled_textColor=
"@color/white"
tools:ignore=
"HardcodedText"
/>
</androidx.appcompat.widget.LinearLayoutCompat>
</FrameLayout>
...
...
app/src/main/res/layout/item_parent.xml
View file @
39d17a28
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
>
...
...
@@ -30,7 +31,8 @@
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"Cache garbage"
android:textSize=
"14sp"
/>
android:textSize=
"14sp"
tools:ignore=
"HardcodedText"
/>
<View
android:layout_width=
"wrap_content"
...
...
@@ -43,7 +45,8 @@
android:layout_height=
"wrap_content"
android:text=
"3.3MB"
android:textColor=
"#999999"
android:textSize=
"13sp"
/>
android:textSize=
"13sp"
tools:ignore=
"HardcodedText"
/>
<FrameLayout
android:layout_width=
"wrap_content"
...
...
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