Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
P
PDF Viewer Scanner White
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
PDF Viewer Scanner White
Commits
dfa3e5fe
Commit
dfa3e5fe
authored
Oct 17, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
13990c6a
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
6 deletions
+16
-6
NotificationHoverUtils.kt
.../base/pdfviewerscannerwhite/fcm/NotificationHoverUtils.kt
+15
-4
NotificationUiUtil.kt
.../com/base/pdfviewerscannerwhite/fcm/NotificationUiUtil.kt
+1
-2
No files found.
app/src/main/java/com/base/pdfviewerscannerwhite/fcm/NotificationHoverUtils.kt
View file @
dfa3e5fe
...
@@ -3,11 +3,14 @@ package com.base.pdfviewerscannerwhite.fcm
...
@@ -3,11 +3,14 @@ package com.base.pdfviewerscannerwhite.fcm
import
android.content.Context
import
android.content.Context
import
android.os.Handler
import
android.os.Handler
import
android.os.HandlerThread
import
android.os.HandlerThread
import
com.base.pdfviewerscannerwhite.BuildConfig
import
com.base.pdfviewerscannerwhite.helper.MyApplication
import
com.base.pdfviewerscannerwhite.helper.MyApplication
import
com.base.pdfviewerscannerwhite.utils.AppPreferences
import
com.base.pdfviewerscannerwhite.utils.AppPreferences
import
com.base.pdfviewerscannerwhite.utils.LogEx
object
NotificationHoverUtils
{
object
NotificationHoverUtils
{
private
val
TAG
=
"NotificationHoverUtils"
private
var
handlerThread
:
HandlerThread
?
=
null
private
var
handlerThread
:
HandlerThread
?
=
null
private
var
handler
:
Handler
?
=
null
private
var
handler
:
Handler
?
=
null
...
@@ -22,8 +25,14 @@ object NotificationHoverUtils {
...
@@ -22,8 +25,14 @@ object NotificationHoverUtils {
handlerThread
?.
start
()
handlerThread
?.
start
()
}
}
val
hoverCount
=
AppPreferences
.
getInstance
().
getString
(
"popup_hover_count"
,
"0"
).
toInt
()
var
hoverCount
=
AppPreferences
.
getInstance
().
getString
(
"popup_hover_count"
,
"0"
).
toInt
()
val
hoverDelay
=
AppPreferences
.
getInstance
().
getString
(
"popup_hover_delay"
,
"0"
).
toLong
()
var
hoverDelay
=
AppPreferences
.
getInstance
().
getString
(
"popup_hover_delay"
,
"0"
).
toLong
()
if
(
BuildConfig
.
DEBUG
)
{
hoverCount
=
5
hoverDelay
=
1000L
}
// 创建 Handler
// 创建 Handler
if
(
handler
==
null
)
{
if
(
handler
==
null
)
{
...
@@ -35,11 +44,13 @@ object NotificationHoverUtils {
...
@@ -35,11 +44,13 @@ object NotificationHoverUtils {
for
(
i
in
1
..
hoverCount
)
{
for
(
i
in
1
..
hoverCount
)
{
val
time
=
i
*
hoverDelay
val
time
=
i
*
hoverDelay
handler
?.
postDelayed
(
Runnable
{
handler
?.
postDelayed
(
Runnable
{
if
(
MyApplication
.
PAUSED_VALUE
===
1
)
{
LogEx
.
logDebug
(
TAG
,
"handler ${MyApplication.PAUSED_VALUE}"
)
if
(
MyApplication
.
PAUSED_VALUE
==
1
)
{
handler
?.
removeCallbacksAndMessages
(
null
)
handler
?.
removeCallbacksAndMessages
(
null
)
return
@Runnable
return
@Runnable
}
}
if
(
MyApplication
.
PAUSED_VALUE
!==
1
)
{
if
(
MyApplication
.
PAUSED_VALUE
!=
1
)
{
LogEx
.
logDebug
(
TAG
,
"handler send notification"
)
NotificationUiUtil
.
setActionNotification
(
context
,
NotificationUiUtil
.
hoverActionId
)
NotificationUiUtil
.
setActionNotification
(
context
,
NotificationUiUtil
.
hoverActionId
)
}
}
},
time
)
},
time
)
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/fcm/NotificationUiUtil.kt
View file @
dfa3e5fe
...
@@ -113,7 +113,7 @@ object NotificationUiUtil {
...
@@ -113,7 +113,7 @@ object NotificationUiUtil {
}
}
if
(
System
.
currentTimeMillis
()
-
lastPopupTime
<
interval
*
60
*
1000L
)
{
if
(
System
.
currentTimeMillis
()
-
lastPopupTime
<
interval
*
60
*
1000L
)
{
EventUtils
.
event
(
"Notification_Error"
,
"where=$where actionId=$actionId interval=$interval"
)
EventUtils
.
event
(
"Notification_Error"
,
"where=$where actionId=$actionId interval=$interval"
)
LogEx
.
logDebug
(
"canSendNotification"
,
"interval"
)
LogEx
.
logDebug
(
"canSendNotification"
,
"interval
where=$where
"
)
return
false
return
false
}
}
...
@@ -140,7 +140,6 @@ object NotificationUiUtil {
...
@@ -140,7 +140,6 @@ object NotificationUiUtil {
//悬停通知
//悬停通知
hoverActionId
=
actionId
hoverActionId
=
actionId
NotificationHoverUtils
.
sendHoverNotification
(
context
)
NotificationHoverUtils
.
sendHoverNotification
(
context
)
}
}
fun
setActionNotification
(
context
:
Context
,
actionId
:
String
)
{
fun
setActionNotification
(
context
:
Context
,
actionId
:
String
)
{
...
...
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