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
52753f0a
Commit
52753f0a
authored
Jun 18, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
方便拆包修改
parent
eadc463b
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
21 additions
and
35 deletions
+21
-35
RecentAppActivity.kt
...m/test/easy/easycleanerjunk/activity/RecentAppActivity.kt
+11
-31
RateStarPop.kt
...in/java/com/test/easy/easycleanerjunk/view/RateStarPop.kt
+6
-2
pop_layout_star.xml
app/src/main/res/layout/pop_layout_star.xml
+4
-2
No files found.
app/src/main/java/com/test/easy/easycleanerjunk/activity/RecentAppActivity.kt
View file @
52753f0a
...
...
@@ -15,6 +15,7 @@ import android.os.Build
import
android.provider.Settings
import
android.util.Log
import
android.view.View
import
android.widget.Toast
import
androidx.activity.addCallback
import
androidx.core.view.isVisible
import
androidx.fragment.app.Fragment
...
...
@@ -28,6 +29,8 @@ import com.test.easy.easycleanerjunk.fragment.LaunchesFragment
import
com.test.easy.easycleanerjunk.fragment.ScreenTimeFragment
import
com.test.easy.easycleanerjunk.helps.BaseActivity
import
com.test.easy.easycleanerjunk.helps.LogEx
import
com.test.easy.easycleanerjunk.helps.PermissionHelp.checkUsageAccessSettings
import
com.test.easy.easycleanerjunk.helps.PermissionHelp.requestUsageAccessSettings
import
com.test.easy.easycleanerjunk.helps.TimeUtils.TODAY_QUERY
import
com.test.easy.easycleanerjunk.helps.TimeUtils.YESTERDAY_QUERY
import
com.test.easy.easycleanerjunk.helps.TimeUtils.timePair
...
...
@@ -84,22 +87,17 @@ class RecentAppActivity : BaseActivity<ActivityRecentAppBinding>() {
}
}
binding
.
tvGrand
.
setOnClickListener
{
val
intent
=
Intent
(
Settings
.
ACTION_USAGE_ACCESS_SETTINGS
)
intent
.
addCategory
(
"android.intent.category.DEFAULT"
)
intent
.
data
=
Uri
.
parse
(
"package:${context.packageName}"
)
launcher
.
launch
(
intent
)
{
LogEx
.
logDebug
(
TAG
,
"launcher callback"
)
val
obj
=
JSONObject
()
obj
.
put
(
"activity"
,
javaClass
.
simpleName
)
if
(
checkUsageAccessSettings
())
{
requestUsageAccessSettings
(
launcher
,
result
=
{
flag
->
if
(
flag
)
{
binding
.
flPermission
.
visibility
=
View
.
GONE
binding
.
llContent
.
visibility
=
View
.
VISIBLE
intData
()
}
else
{
finishToMain
()
}
}
},
resolveNoAction
=
{
Toast
.
makeText
(
this
,
"no support function"
,
Toast
.
LENGTH_SHORT
).
show
()
})
}
}
...
...
@@ -113,7 +111,7 @@ class RecentAppActivity : BaseActivity<ActivityRecentAppBinding>() {
binding
.
llLottie
.
isVisible
=
false
showFinish
?.
invoke
()
}
},
Random
.
nextLong
(
3000
,
4000
))
},
Random
.
nextLong
(
3000
,
4000
))
}
...
...
@@ -141,6 +139,7 @@ class RecentAppActivity : BaseActivity<ActivityRecentAppBinding>() {
}
}
@SuppressLint
(
"QueryPermissionsNeeded"
)
private
fun
initAppData
()
{
dataList
.
clear
()
...
...
@@ -257,25 +256,6 @@ class RecentAppActivity : BaseActivity<ActivityRecentAppBinding>() {
}
private
fun
checkUsageAccessSettings
():
Boolean
{
val
appOpsManager
=
getSystemService
(
Context
.
APP_OPS_SERVICE
)
as
AppOpsManager
return
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
Q
)
{
appOpsManager
.
unsafeCheckOpNoThrow
(
AppOpsManager
.
OPSTR_GET_USAGE_STATS
,
android
.
os
.
Process
.
myUid
(),
this
.
packageName
)
==
AppOpsManager
.
MODE_ALLOWED
}
else
{
appOpsManager
.
checkOpNoThrow
(
AppOpsManager
.
OPSTR_GET_USAGE_STATS
,
android
.
os
.
Process
.
myUid
(),
this
.
packageName
)
==
AppOpsManager
.
MODE_ALLOWED
}
}
private
fun
isLaunchApp
(
context
:
Context
,
app
:
PackageInfo
,
filterSystem
:
Boolean
=
true
):
Boolean
{
val
flagSystem
=
(
app
.
applicationInfo
.
flags
and
ApplicationInfo
.
FLAG_SYSTEM
)
<
1
...
...
@@ -336,7 +316,7 @@ class RecentAppActivity : BaseActivity<ActivityRecentAppBinding>() {
/**
* 前台运行App+后台运行App=总的启动App
*/
fun
getUsageList
(
context
:
Context
,
startTime
:
Long
,
endTime
:
Long
):
ArrayList
<
UsageStats
>
{
private
fun
getUsageList
(
context
:
Context
,
startTime
:
Long
,
endTime
:
Long
):
ArrayList
<
UsageStats
>
{
val
list
=
arrayListOf
<
UsageStats
>()
val
mUsmManager
=
context
.
getSystemService
(
Context
.
USAGE_STATS_SERVICE
)
as
UsageStatsManager
val
map
=
mUsmManager
.
queryAndAggregateUsageStats
(
startTime
,
endTime
)
...
...
app/src/main/java/com/test/easy/easycleanerjunk/view/RateStarPop.kt
View file @
52753f0a
...
...
@@ -28,7 +28,8 @@ class RateStarPop(private val activity: Activity) : PopupWindow() {
}
}
fun
dismiss
(
activity
:
Activity
){
fun
dismiss
(
activity
:
Activity
)
{
RateStarPop
(
activity
).
dismiss
()
}
}
...
...
@@ -47,7 +48,7 @@ class RateStarPop(private val activity: Activity) : PopupWindow() {
}
@SuppressLint
(
"ClickableViewAccessibility"
)
@SuppressLint
(
"ClickableViewAccessibility"
,
"SetTextI18n"
)
fun
show
()
{
contentView
=
binding
.
root
activity
.
window
.
decorView
.
post
{
...
...
@@ -56,6 +57,9 @@ class RateStarPop(private val activity: Activity) : PopupWindow() {
showAtLocation
(
activity
.
window
.
decorView
,
Gravity
.
CENTER
,
0
,
0
)
}
val
appName
=
activity
.
resources
.
getString
(
R
.
string
.
app_name
)
binding
.
tvTitle
.
text
=
"Thank you for using $appName"
listOf
(
binding
.
idStar1
,
binding
.
idStar2
,
...
...
app/src/main/res/layout/pop_layout_star.xml
View file @
52753f0a
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
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=
"match_parent"
android:background=
"#b3000000"
...
...
@@ -28,13 +29,13 @@
android:src=
"@mipmap/guanbi"
/>
<TextView
android:id=
"@+id/tv_title"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_gravity=
"center_horizontal"
android:layout_marginHorizontal=
"20dp"
android:layout_marginTop=
"15dp"
android:gravity=
"center"
android:text=
"Thank you for using File Manager Select!"
android:textColor=
"#000000"
android:textSize=
"16sp"
android:textStyle=
"bold"
/>
...
...
@@ -48,7 +49,8 @@
android:gravity=
"center"
android:text=
"Thank you very much for taking the time to rate us."
android:textColor=
"#999999"
android:textSize=
"14sp"
/>
android:textSize=
"14sp"
tools:ignore=
"HardcodedText"
/>
<androidx.appcompat.widget.LinearLayoutCompat
android:layout_width=
"match_parent"
...
...
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