Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
E
Easy File Manager 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 File Manager Junk
Commits
3c520af4
Commit
3c520af4
authored
Jun 21, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
同步代码
parent
894cb1af
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
0 deletions
+61
-0
MyApplication.kt
app/src/main/java/com/base/easyfilemanager/MyApplication.kt
+2
-0
ActionBroadcast.kt
.../java/com/base/easyfilemanager/display/ActionBroadcast.kt
+59
-0
No files found.
app/src/main/java/com/base/easyfilemanager/MyApplication.kt
View file @
3c520af4
...
...
@@ -10,6 +10,7 @@ import android.util.Log
import
com.google.android.gms.ads.MobileAds
import
com.google.firebase.FirebaseApp
import
com.base.easyfilemanager.activity.splash.NewSplashActivity
import
com.base.easyfilemanager.display.ActionBroadcast.Companion.initBroadcast
import
com.base.easyfilemanager.display.fcm.FcmHelper
import
com.base.easyfilemanager.helps.BaseApplication
import
com.base.easyfilemanager.helps.ComUtils.requestCfg
...
...
@@ -72,6 +73,7 @@ class MyApplication : BaseApplication() {
FirebaseApp
.
initializeApp
(
this
)
FcmHelper
.
getToken
()
FcmHelper
.
subscribeToTopic
()
context
.
initBroadcast
()
Log
.
d
(
"MyService"
,
"startService:"
+
Process
.
myPid
());
}
...
...
app/src/main/java/com/base/easyfilemanager/display/ActionBroadcast.kt
0 → 100644
View file @
3c520af4
package
com.base.easyfilemanager.display
import
android.content.BroadcastReceiver
import
android.content.Context
import
android.content.Intent
import
android.content.IntentFilter
import
android.os.Build
import
android.util.Log
import
com.base.easyfilemanager.utils.SPUtils
class
ActionBroadcast
:
BroadcastReceiver
()
{
private
var
mIsScreenOn
=
false
private
var
isLock
=
false
companion
object
{
private
val
TAG
=
"ActionBroadcast"
fun
Context
.
initBroadcast
()
{
val
filter
=
IntentFilter
()
filter
.
addAction
(
Intent
.
ACTION_SCREEN_OFF
)
filter
.
addAction
(
Intent
.
ACTION_SCREEN_ON
)
filter
.
addAction
(
Intent
.
ACTION_USER_PRESENT
)
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
TIRAMISU
)
{
registerReceiver
(
ActionBroadcast
(),
filter
,
Context
.
RECEIVER_EXPORTED
)
}
else
{
registerReceiver
(
ActionBroadcast
(),
filter
)
}
}
}
override
fun
onReceive
(
context
:
Context
,
intent
:
Intent
?)
{
val
action
=
intent
?.
action
?:
0
when
(
action
)
{
Intent
.
ACTION_SCREEN_ON
->
{
mIsScreenOn
=
true
}
Intent
.
ACTION_SCREEN_OFF
->
{
mIsScreenOn
=
false
isLock
=
true
}
Intent
.
ACTION_USER_PRESENT
->
{
isLock
=
false
Log
.
d
(
"glc"
,
"解锁"
)
if
(
mIsScreenOn
&&
!
isLock
)
{
// 展示主动推送
val
locks
=
SPUtils
.
getInstance
().
getInt
(
"notification_lockS"
,
0
)
if
(
locks
==
1
)
{
NotificationUtils
.
sendTimerPush
()
}
}
}
}
}
}
\ No newline at end of file
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