Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
C
clean master
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
clean master
Commits
ca631f9d
Commit
ca631f9d
authored
May 15, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
直接复制拆包大法
parent
8eb149d9
Pipeline
#1082
canceled with stages
Changes
13
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
54 additions
and
59 deletions
+54
-59
.gitignore
.gitignore
+10
-0
executionHistory.lock
.gradle/8.0/executionHistory/executionHistory.lock
+0
-0
fileHashes.bin
.gradle/8.0/fileHashes/fileHashes.bin
+0
-0
fileHashes.lock
.gradle/8.0/fileHashes/fileHashes.lock
+0
-0
resourceHashesCache.bin
.gradle/8.0/fileHashes/resourceHashesCache.bin
+0
-0
buildOutputCleanup.lock
.gradle/buildOutputCleanup/buildOutputCleanup.lock
+0
-0
outputFiles.bin
.gradle/buildOutputCleanup/outputFiles.bin
+0
-0
ActionBroadcast.kt
.../com/zxhyis/toolss/common/notification/ActionBroadcast.kt
+1
-31
NotificationHelper.kt
...m/zxhyis/toolss/common/notification/NotificationHelper.kt
+4
-3
NotificationTimerTask.kt
...xhyis/toolss/common/notification/NotificationTimerTask.kt
+2
-3
LaunchesFragment.kt
...com/zxhyis/toolss/ui/page/recentusage/LaunchesFragment.kt
+16
-5
RecentAppActivity.kt
...om/zxhyis/toolss/ui/page/recentusage/RecentAppActivity.kt
+17
-12
ScreenTimeFragment.kt
...m/zxhyis/toolss/ui/page/recentusage/ScreenTimeFragment.kt
+4
-5
No files found.
.gitignore
0 → 100644
View file @
ca631f9d
*.iml
/local.properties
/.gradle
/.idea
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
/gradle/wrapper.gradle-wrapper.jar
.gradle/8.0/executionHistory/executionHistory.lock
deleted
100644 → 0
View file @
8eb149d9
File deleted
.gradle/8.0/fileHashes/fileHashes.bin
deleted
100644 → 0
View file @
8eb149d9
File deleted
.gradle/8.0/fileHashes/fileHashes.lock
deleted
100644 → 0
View file @
8eb149d9
File deleted
.gradle/8.0/fileHashes/resourceHashesCache.bin
deleted
100644 → 0
View file @
8eb149d9
File deleted
.gradle/buildOutputCleanup/buildOutputCleanup.lock
deleted
100644 → 0
View file @
8eb149d9
File deleted
.gradle/buildOutputCleanup/outputFiles.bin
deleted
100644 → 0
View file @
8eb149d9
File deleted
app/src/main/java/com/zxhyis/toolss/common/notification/ActionBroadcast.kt
View file @
ca631f9d
...
...
@@ -95,7 +95,7 @@ class ActionBroadcast : BroadcastReceiver() {
val
isPushCfg
=
PushManager
.
isPush
(
ID_LOW_BATTERY_PUSH
)
if
(
flag2
&&
isPushCfg
)
{
FileApp
.
fContext
.
postActionNotification
(
ID_LOW_BATTERY_PUSH
)
FileApp
.
fContext
.
postActionNotification
(
ID_LOW_BATTERY_PUSH
,
extra
=
level
)
}
}
}
...
...
@@ -103,34 +103,4 @@ class ActionBroadcast : BroadcastReceiver() {
}
}
fun
lowJunkPush
(
context
:
Context
)
{
val
activityManager
=
context
.
getSystemService
(
Context
.
ACTIVITY_SERVICE
)
as
ActivityManager
val
memoryInfo
=
ActivityManager
.
MemoryInfo
()
activityManager
.
getMemoryInfo
(
memoryInfo
)
val
availableMemory
=
memoryInfo
.
availMem
val
totalMemory
=
memoryInfo
.
totalMem
val
num
=
totalMemory
-
availableMemory
val
entity
=
ComUtils
.
getPushTypeData
(
"22005"
)
if
(
num
>=
(
entity
?.
feature_ex1
?:
0
))
{
// 展示性能变差推送
val
flag
=
PushManager
.
isPush
(
PushCfg
.
ID_LOW_RAM_PUSH
)
if
(
flag
)
{
FileApp
.
fContext
.
postActionNotification
(
ID_LOW_RAM_PUSH
)
}
}
}
fun
charging
(
intent
:
Intent
?)
{
//电量发生变化
val
level
=
intent
?.
getIntExtra
(
BatteryManager
.
EXTRA_LEVEL
,
-
1
)
?:
-
1
val
scale
:
Int
?
=
intent
?.
getIntExtra
(
BatteryManager
.
EXTRA_SCALE
,
-
1
)
//低电量阀值推送
val
config
=
ComUtils
.
getPushTypeData
(
ID_LOW_BATTERY_PUSH
.
toString
())
val
flag
=
PushManager
.
isPush
(
ID_LOW_BATTERY_PUSH
)
val
lowValue
=
config
?.
feature_ex1
?:
0
if
(
flag
&&
(
level
<
lowValue
))
{
FileApp
.
fContext
.
postActionNotification
(
ID_LOW_BATTERY_PUSH
)
}
}
}
\ No newline at end of file
app/src/main/java/com/zxhyis/toolss/common/notification/NotificationHelper.kt
View file @
ca631f9d
...
...
@@ -150,9 +150,10 @@ object NotificationHelper {
/**
* 发送通知对于
* @param extra 额外参数
*/
@SuppressLint
(
"RemoteViewLayout"
)
fun
Context
.
postActionNotification
(
actionId
:
Int
,
eventParams
:
EventParams
?
=
null
)
{
fun
Context
.
postActionNotification
(
actionId
:
Int
,
eventParams
:
EventParams
?
=
null
,
extra
:
Int
?
=
null
)
{
val
remoteViews
=
RemoteViews
(
packageName
,
R
.
layout
.
notification_common
)
...
...
@@ -247,13 +248,13 @@ object NotificationHelper {
ID_LOW_BATTERY_PUSH
->
{
remoteViews
.
setImageViewResource
(
R
.
id
.
iv_icon
,
R
.
mipmap
.
dianliangdi
)
remoteViews
.
setTextViewText
(
R
.
id
.
tv_desc
,
"The battery is
less than 50
%, view the battery information"
)
remoteViews
.
setTextViewText
(
R
.
id
.
tv_desc
,
"The battery is
$extra
%, view the battery information"
)
remoteViews
.
setTextViewText
(
R
.
id
.
tv_btn
,
"View"
)
}
ID_LOW_RAM_PUSH
->
{
remoteViews
.
setImageViewResource
(
R
.
id
.
iv_icon
,
R
.
mipmap
.
neicundi
)
remoteViews
.
setTextViewText
(
R
.
id
.
tv_desc
,
"Ram usage reached
60
%, optimize now!"
)
remoteViews
.
setTextViewText
(
R
.
id
.
tv_desc
,
"Ram usage reached
$extra
%, optimize now!"
)
remoteViews
.
setTextViewText
(
R
.
id
.
tv_btn
,
"Optimize"
)
}
...
...
app/src/main/java/com/zxhyis/toolss/common/notification/NotificationTimerTask.kt
View file @
ca631f9d
package
com.zxhyis.toolss.common.notification
import
android.content.Context
import
com.zxhyis.toolss.FileApp
import
com.zxhyis.toolss.ad.EventHelper
import
com.zxhyis.toolss.ad.PushManager
...
...
@@ -12,7 +11,6 @@ import com.zxhyis.toolss.ad.queryDataStoreBlock
import
com.zxhyis.toolss.common.notification.NotificationHelper.postActionNotification
import
com.zxhyis.toolss.logic.LogEx
import
com.zxhyis.toolss.logic.RamMemoryEx
import
com.zxhyis.toolss.logic.toast
import
java.util.TimerTask
import
kotlin.time.Duration.Companion.minutes
import
kotlin.time.DurationUnit
...
...
@@ -31,12 +29,13 @@ class NotificationTimerTask(val eventParams: EventParams?) : TimerTask() {
fun
oneShotNotification
(
noLimit
:
Boolean
=
false
)
{
//内存低于阀值推送
val
flag
=
postRamLower60
()
if
(
flag
)
{
val
log
=
"postRamLower60 isPush=$flag"
EventHelper
.
event
(
"pushCircleOrder_isPush"
,
log
,
eventParams
=
eventParams
)
val
extra
=
RamMemoryEx
.
getMemoryUsage
(
FileApp
.
fContext
).
toInt
()
FileApp
.
fContext
.
postActionNotification
(
ID_LOW_RAM_PUSH
,
eventParams
,
extra
)
return
}
...
...
app/src/main/java/com/zxhyis/toolss/ui/page/recentusage/LaunchesFragment.kt
View file @
ca631f9d
...
...
@@ -10,6 +10,7 @@ import android.os.Bundle
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewManager
import
androidx.core.content.ContextCompat
import
androidx.fragment.app.Fragment
import
com.zxhyis.toolss.R
...
...
@@ -53,7 +54,7 @@ class LaunchesFragment : Fragment(), ReportInterface {
super
.
onViewCreated
(
view
,
savedInstanceState
)
setTextFont
()
adapter
=
RecentAppAdapter
(
requireActivity
(),
RecentAppAdapter
.
UI_LAUNCHES_MODE
)
adapter
=
RecentAppAdapter
(
requireActivity
(),
RecentAppAdapter
.
UI_LAUNCHES_MODE
)
binding
.
rv
.
adapter
=
adapter
binding
.
clLaunches
.
setOnClick
(
javaClass
.
simpleName
)
{
...
...
@@ -92,13 +93,19 @@ class LaunchesFragment : Fragment(), ReportInterface {
todayUI
(
false
)
pageReport
()
LogEx
.
logDebug
(
TAG
,
"onViewCreated"
)
}
override
fun
onResume
()
{
super
.
onResume
()
LogEx
.
logDebug
(
TAG
,
"onResume"
)
}
@SuppressLint
(
"SetTextI18n"
)
fun
todayUI
(
isReFresh
:
Boolean
=
true
)
{
binding
.
tvDate
.
text
=
"Today"
+
simpleDateFormat2
.
format
(
System
.
currentTimeMillis
())
if
(
isReFresh
)
{
(
requireActivity
()
as
RecentAppActivity
).
changeTimeRefresh
(
AppViewModel
.
TODAY_QUERY
)
(
requireActivity
()
as
RecentAppActivity
).
changeTimeRefresh
(
AppViewModel
.
TODAY_QUERY
,
0
)
}
}
...
...
@@ -106,7 +113,7 @@ class LaunchesFragment : Fragment(), ReportInterface {
fun
recent60UI
(
isReFresh
:
Boolean
=
true
)
{
binding
.
tvDate
.
text
=
"Recent 60 minus"
if
(
isReFresh
)
{
(
requireActivity
()
as
RecentAppActivity
).
changeTimeRefresh
(
AppViewModel
.
PAST_60_MINUS_QUERY
)
(
requireActivity
()
as
RecentAppActivity
).
changeTimeRefresh
(
AppViewModel
.
PAST_60_MINUS_QUERY
,
0
)
}
}
...
...
@@ -115,7 +122,7 @@ class LaunchesFragment : Fragment(), ReportInterface {
binding
.
tvDate
.
text
=
"Yesterday"
+
simpleDateFormat2
.
format
(
System
.
currentTimeMillis
()
-
24
.
hours
.
toLong
(
DurationUnit
.
MILLISECONDS
))
if
(
isReFresh
)
{
(
requireActivity
()
as
RecentAppActivity
).
changeTimeRefresh
(
AppViewModel
.
YESTERDAY_QUERY
)
(
requireActivity
()
as
RecentAppActivity
).
changeTimeRefresh
(
AppViewModel
.
YESTERDAY_QUERY
,
0
)
}
}
...
...
@@ -123,7 +130,7 @@ class LaunchesFragment : Fragment(), ReportInterface {
fun
sevenDaysUI
(
isReFresh
:
Boolean
=
true
)
{
binding
.
tvDate
.
text
=
"Last 7 days"
if
(
isReFresh
)
{
(
requireActivity
()
as
RecentAppActivity
).
changeTimeRefresh
(
AppViewModel
.
SEVEN_DAYS_QUERY
)
(
requireActivity
()
as
RecentAppActivity
).
changeTimeRefresh
(
AppViewModel
.
SEVEN_DAYS_QUERY
,
0
)
}
}
...
...
@@ -287,7 +294,11 @@ class LaunchesFragment : Fragment(), ReportInterface {
binding
.
tvDate
.
setTypeface
(
fontMediumTypeface
)
}
/**
* 更新数据
*/
fun
setAppUseData
(
dataList
:
List
<
AppBean
>)
{
LogEx
.
logDebug
(
TAG
,
"setAppUseData"
)
this
.
dataList
.
clear
()
this
.
dataList
.
addAll
(
dataList
)
//setLaunchNumber()
...
...
app/src/main/java/com/zxhyis/toolss/ui/page/recentusage/RecentAppActivity.kt
View file @
ca631f9d
...
...
@@ -142,7 +142,7 @@ class RecentAppActivity : AppCompatActivity(), ReportInterface {
//更新UI数据
launch
(
Dispatchers
.
Main
)
{
updateFragmentData
()
updateFragmentData
(
0
,
1
)
}
}
}
...
...
@@ -171,12 +171,17 @@ class RecentAppActivity : AppCompatActivity(), ReportInterface {
}
private
fun
updateFragmentData
()
{
val
launchesFragment
=
pages
[
0
]
as
LaunchesFragment
val
screenTimeFragment
=
pages
[
1
]
as
ScreenTimeFragment
private
fun
updateFragmentData
(
vararg
position
:
Int
)
{
if
(
position
.
contains
(
0
))
{
val
launchesFragment
=
pages
[
0
]
as
LaunchesFragment
launchesFragment
.
setAppUseData
(
dataList
)
}
if
(
position
.
contains
(
1
))
{
val
screenTimeFragment
=
pages
[
1
]
as
ScreenTimeFragment
screenTimeFragment
.
setScreenData
(
dataList
)
}
launchesFragment
.
setAppUseData
(
dataList
)
screenTimeFragment
.
setScreenData
(
dataList
)
}
private
fun
setScreenTimeData
(
queryTime
:
Int
=
TODAY_QUERY
)
{
...
...
@@ -209,16 +214,16 @@ class RecentAppActivity : AppCompatActivity(), ReportInterface {
if
(
hashMap
.
keys
.
contains
(
app
.
pkg
))
{
val
value
=
hashMap
[
app
.
pkg
]
if
(
value
!=
null
)
{
val
tempList
=
arrayListOf
<
UsageEvents
.
Event
>()
tempList
.
addAll
(
value
)
app
.
usageEvents
?.
also
{
evens
->
tempList
.
addAll
(
evens
)
}
app
.
usageEvents
=
tempList
val
tempList
2
=
arrayListOf
<
UsageEvents
.
Event
>()
tempList
2
.
addAll
(
value
)
app
.
usageEvents
?.
also
{
evens
->
tempList
2
.
addAll
(
evens
)
}
app
.
usageEvents
=
tempList
2
}
}
}
}
fun
changeTimeRefresh
(
queryTime
:
Int
)
{
fun
changeTimeRefresh
(
queryTime
:
Int
,
fragmentPosition
:
Int
)
{
lifecycleScope
.
launch
(
Dispatchers
.
IO
)
{
initAppData
()
...
...
@@ -229,7 +234,7 @@ class RecentAppActivity : AppCompatActivity(), ReportInterface {
setScreenTimeData
(
queryTime
)
//更新UI数据
launch
(
Dispatchers
.
Main
)
{
updateFragmentData
()
}
launch
(
Dispatchers
.
Main
)
{
updateFragmentData
(
fragmentPosition
)
}
}
}
...
...
app/src/main/java/com/zxhyis/toolss/ui/page/recentusage/ScreenTimeFragment.kt
View file @
ca631f9d
...
...
@@ -86,7 +86,6 @@ class ScreenTimeFragment : Fragment(), ReportInterface {
todayUI
(
false
)
// initChart()
pageReport
()
adapter
.
setData
(
this
.
dataList
)
}
private
fun
initChart
()
{
...
...
@@ -158,7 +157,7 @@ class ScreenTimeFragment : Fragment(), ReportInterface {
fun
todayUI
(
isReFresh
:
Boolean
=
true
)
{
binding
.
tvDate
.
text
=
"Today"
+
simpleDateFormat2
.
format
(
System
.
currentTimeMillis
())
if
(
isReFresh
)
{
(
requireActivity
()
as
RecentAppActivity
).
changeTimeRefresh
(
AppViewModel
.
TODAY_QUERY
)
(
requireActivity
()
as
RecentAppActivity
).
changeTimeRefresh
(
AppViewModel
.
TODAY_QUERY
,
1
)
}
}
...
...
@@ -166,7 +165,7 @@ class ScreenTimeFragment : Fragment(), ReportInterface {
fun
recent60UI
(
isReFresh
:
Boolean
=
true
)
{
binding
.
tvDate
.
text
=
"Recent 60 minus"
if
(
isReFresh
)
{
(
requireActivity
()
as
RecentAppActivity
).
changeTimeRefresh
(
AppViewModel
.
PAST_60_MINUS_QUERY
)
(
requireActivity
()
as
RecentAppActivity
).
changeTimeRefresh
(
AppViewModel
.
PAST_60_MINUS_QUERY
,
1
)
}
}
...
...
@@ -179,7 +178,7 @@ class ScreenTimeFragment : Fragment(), ReportInterface {
)
)
if
(
isReFresh
)
{
(
requireActivity
()
as
RecentAppActivity
).
changeTimeRefresh
(
AppViewModel
.
YESTERDAY_QUERY
)
(
requireActivity
()
as
RecentAppActivity
).
changeTimeRefresh
(
AppViewModel
.
YESTERDAY_QUERY
,
1
)
}
}
...
...
@@ -187,7 +186,7 @@ class ScreenTimeFragment : Fragment(), ReportInterface {
fun
sevenDaysUI
(
isReFresh
:
Boolean
=
true
)
{
binding
.
tvDate
.
text
=
"Last 7 days"
if
(
isReFresh
)
{
(
requireActivity
()
as
RecentAppActivity
).
changeTimeRefresh
(
AppViewModel
.
SEVEN_DAYS_QUERY
)
(
requireActivity
()
as
RecentAppActivity
).
changeTimeRefresh
(
AppViewModel
.
SEVEN_DAYS_QUERY
,
1
)
}
}
...
...
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