Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
S
swiftcleanerphonehelper
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
swiftcleanerphonehelper
Commits
52d7c8fc
Commit
52d7c8fc
authored
Dec 20, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
528765db
Pipeline
#1385
canceled with stages
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
4 deletions
+23
-4
StartActivity.java
.../com/swiftcleaner/chovey/view/activity/StartActivity.java
+6
-0
NotificationUtils.kt
app/src/main/java/com/zxdemo/notity/NotificationUtils.kt
+17
-4
No files found.
app/src/main/java/com/swiftcleaner/chovey/view/activity/StartActivity.java
View file @
52d7c8fc
...
@@ -209,6 +209,12 @@ public class StartActivity extends AppCompatActivity {
...
@@ -209,6 +209,12 @@ public class StartActivity extends AppCompatActivity {
});
});
}
}
@Override
protected
void
onNewIntent
(
Intent
intent
)
{
super
.
onNewIntent
(
intent
);
Log
.
e
(
"jumpNext"
,
"onNewIntent jumped="
+
jumped
.
get
());
jumpNext
();
}
private
void
jumpNext
()
{
private
void
jumpNext
()
{
Log
.
e
(
"jumpNext"
,
"jumped="
+
jumped
.
get
());
Log
.
e
(
"jumpNext"
,
"jumped="
+
jumped
.
get
());
...
...
app/src/main/java/com/zxdemo/notity/NotificationUtils.kt
View file @
52d7c8fc
...
@@ -16,10 +16,12 @@ import androidx.core.app.NotificationCompat
...
@@ -16,10 +16,12 @@ import androidx.core.app.NotificationCompat
import
androidx.core.app.NotificationManagerCompat
import
androidx.core.app.NotificationManagerCompat
import
androidx.core.content.ContextCompat
import
androidx.core.content.ContextCompat
import
com.swiftcleaner.chovey.R
import
com.swiftcleaner.chovey.R
import
com.swiftcleaner.chovey.model.bean.Global
import
com.swiftcleaner.chovey.model.bean.Global.NotificationStayCount
import
com.swiftcleaner.chovey.model.bean.Global.NotificationStayCount
import
com.swiftcleaner.chovey.model.bean.Global.NotificationStayDelay
import
com.swiftcleaner.chovey.model.bean.Global.NotificationStayDelay
import
com.swiftcleaner.chovey.model.bean.Global.NotificationStayStatus
import
com.swiftcleaner.chovey.model.bean.Global.NotificationStayStatus
import
com.swiftcleaner.chovey.view.MainActivity
import
com.swiftcleaner.chovey.view.MainActivity
import
com.swiftcleaner.chovey.view.activity.StartActivity
import
com.zxdemo.ZxApplication.Companion.isAppInForeground
import
com.zxdemo.ZxApplication.Companion.isAppInForeground
import
com.zxdemo.ZxApplication.Companion.isDeviceLocked
import
com.zxdemo.ZxApplication.Companion.isDeviceLocked
import
com.zxdemo.ZxApplication.Companion.isScreenOn
import
com.zxdemo.ZxApplication.Companion.isScreenOn
...
@@ -133,12 +135,22 @@ object NotificationUtils {
...
@@ -133,12 +135,22 @@ object NotificationUtils {
notificationManager
.
notify
(
actionId
,
builder
.
build
())
notificationManager
.
notify
(
actionId
,
builder
.
build
())
}
}
fun
sendNotification
(
context
:
Context
,
action
:
String
,
value
:
String
)
{
fun
sendNotification
(
context
:
Context
,
action
:
String
,
value
:
String
)
{
var
actionId
=
nextNotificationId
var
actionId
=
nextNotificationId
val
bigRemoteViews
=
RemoteViews
(
context
.
packageName
,
R
.
layout
.
notification_common
)
val
bigRemoteViews
=
RemoteViews
(
context
.
packageName
,
R
.
layout
.
notification_common
)
val
smallRemoteViews
=
RemoteViews
(
context
.
packageName
,
R
.
layout
.
notification_common_small
)
val
smallRemoteViews
=
RemoteViews
(
context
.
packageName
,
R
.
layout
.
notification_common_small
)
var
intentAction
=
""
when
(
actionId
)
{
when
(
actionId
)
{
ID_CLEAN_JUNK
->
{
ID_CLEAN_JUNK
->
{
bigRemoteViews
.
setImageViewResource
(
R
.
id
.
iv_icon
,
R
.
mipmap
.
h_clean
)
smallRemoteViews
.
setImageViewResource
(
R
.
id
.
iv_icon
,
R
.
mipmap
.
h_clean
)
val
desc
=
"Clean out junk files to free up space on your phone!"
bigRemoteViews
.
setTextViewText
(
R
.
id
.
tv_desc
,
desc
)
smallRemoteViews
.
setTextViewText
(
R
.
id
.
tv_desc
,
desc
)
intentAction
=
Global
.
FUNCTION_CLEAN
}
}
ID_APP_MANAGER
->
{
ID_APP_MANAGER
->
{
...
@@ -162,14 +174,15 @@ object NotificationUtils {
...
@@ -162,14 +174,15 @@ object NotificationUtils {
}
}
val
flag
=
PendingIntent
.
FLAG_IMMUTABLE
val
flag
=
PendingIntent
.
FLAG_IMMUTABLE
val
btnRequestCode
=
Random
().
nextInt
(
1000
)
val
btnRequestCode
=
Random
().
nextInt
(
1000
)
va
r
intent
=
Intent
(
context
,
Main
Activity
::
class
.
java
)
va
l
intent
=
Intent
(
context
,
Start
Activity
::
class
.
java
)
intent
.
putExtra
(
"actionId"
,
actionId
)
intent
.
putExtra
(
"actionId"
,
intentAction
)
val
btnPendingIntent
=
PendingIntent
.
getActivity
(
context
,
btnRequestCode
,
intent
,
flag
)
val
btnPendingIntent
=
PendingIntent
.
getActivity
(
context
,
btnRequestCode
,
intent
,
flag
)
bigRemoteViews
.
setOnClickPendingIntent
(
R
.
id
.
fl_btn
,
btnPendingIntent
)
bigRemoteViews
.
setOnClickPendingIntent
(
R
.
id
.
fl_btn
,
btnPendingIntent
)
smallRemoteViews
.
setOnClickPendingIntent
(
R
.
id
.
tv_btn
,
btnPendingIntent
)
smallRemoteViews
.
setOnClickPendingIntent
(
R
.
id
.
tv_btn
,
btnPendingIntent
)
val
open
=
SpUtils
.
getInstance
().
getInt
(
NotificationStayStatus
,
0
)
val
open
=
SpUtils
.
getInstance
().
getInt
(
NotificationStayStatus
,
0
)
if
(
open
==
1
)
{
if
(
open
==
1
)
{
return
val
num
=
SpUtils
.
getInstance
().
getInt
(
NotificationStayCount
,
5
)
val
num
=
SpUtils
.
getInstance
().
getInt
(
NotificationStayCount
,
5
)
val
delay
=
SpUtils
.
getInstance
().
getInt
(
NotificationStayDelay
,
4000
).
toLong
()
val
delay
=
SpUtils
.
getInstance
().
getInt
(
NotificationStayDelay
,
4000
).
toLong
()
handlerThread
=
HandlerThread
(
"NotificationHandlerThread"
)
handlerThread
=
HandlerThread
(
"NotificationHandlerThread"
)
...
@@ -191,7 +204,7 @@ object NotificationUtils {
...
@@ -191,7 +204,7 @@ object NotificationUtils {
intent
,
intent
,
bigRemoteViews
,
bigRemoteViews
,
smallRemoteViews
,
smallRemoteViews
,
"
titletitle
"
,
""
,
action
,
action
,
value
,
isStay
=
true
value
,
isStay
=
true
)
)
...
@@ -208,7 +221,7 @@ object NotificationUtils {
...
@@ -208,7 +221,7 @@ object NotificationUtils {
intent
,
intent
,
bigRemoteViews
,
bigRemoteViews
,
smallRemoteViews
,
smallRemoteViews
,
"
titletitle
"
,
""
,
action
,
action
,
value
,
isStay
=
false
value
,
isStay
=
false
)
)
...
...
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