Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
P
PDF Viewer Scanner White ago
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
kuxulei
PDF Viewer Scanner White ago
Commits
535a918c
Commit
535a918c
authored
Oct 17, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
55d5928a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
11 deletions
+17
-11
NotificationUiUtil.kt
.../com/base/pdfviewerscannerwhite/fcm/NotificationUiUtil.kt
+8
-8
PopupConstObject.kt
...va/com/base/pdfviewerscannerwhite/fcm/PopupConstObject.kt
+3
-2
MeidaContentObserver.kt
...ase/pdfviewerscannerwhite/service/MeidaContentObserver.kt
+6
-1
No files found.
app/src/main/java/com/base/pdfviewerscannerwhite/fcm/NotificationUiUtil.kt
View file @
535a918c
...
@@ -27,7 +27,7 @@ import com.base.pdfviewerscannerwhite.fcm.PopupConstObject.popup_interval
...
@@ -27,7 +27,7 @@ import com.base.pdfviewerscannerwhite.fcm.PopupConstObject.popup_interval
import
com.base.pdfviewerscannerwhite.fcm.PopupConstObject.popup_lock_interval
import
com.base.pdfviewerscannerwhite.fcm.PopupConstObject.popup_lock_interval
import
com.base.pdfviewerscannerwhite.fcm.PopupConstObject.popup_start
import
com.base.pdfviewerscannerwhite.fcm.PopupConstObject.popup_start
import
com.base.pdfviewerscannerwhite.fcm.PopupConstObject.popup_status
import
com.base.pdfviewerscannerwhite.fcm.PopupConstObject.popup_status
import
com.base.pdfviewerscannerwhite.fcm.PopupConstObject.popup_tim
b
er_interval
import
com.base.pdfviewerscannerwhite.fcm.PopupConstObject.popup_timer_interval
import
com.base.pdfviewerscannerwhite.helper.EventUtils
import
com.base.pdfviewerscannerwhite.helper.EventUtils
import
com.base.pdfviewerscannerwhite.helper.MyApplication
import
com.base.pdfviewerscannerwhite.helper.MyApplication
import
com.base.pdfviewerscannerwhite.ui.splash.SplashActivity
import
com.base.pdfviewerscannerwhite.ui.splash.SplashActivity
...
@@ -74,7 +74,7 @@ object NotificationUiUtil {
...
@@ -74,7 +74,7 @@ object NotificationUiUtil {
AppPreferences
.
getInstance
().
put
(
"lastPopupTime"
,
value
,
true
)
AppPreferences
.
getInstance
().
put
(
"lastPopupTime"
,
value
,
true
)
}
}
fun
canSendNotification
(
where
:
String
):
Boolean
{
fun
canSendNotification
(
where
:
String
,
actionId
:
String
):
Boolean
{
//是否开启推送
//是否开启推送
val
status
=
AppPreferences
.
getInstance
().
getString
(
popup_status
,
"1"
).
toInt
()
val
status
=
AppPreferences
.
getInstance
().
getString
(
popup_status
,
"1"
).
toInt
()
if
(
status
==
0
)
{
if
(
status
==
0
)
{
...
@@ -86,7 +86,7 @@ object NotificationUiUtil {
...
@@ -86,7 +86,7 @@ object NotificationUiUtil {
val
count
=
AppPreferences
.
getInstance
().
getString
(
popup_count
,
"20"
).
toInt
()
val
count
=
AppPreferences
.
getInstance
().
getString
(
popup_count
,
"20"
).
toInt
()
if
(
dayPopupCount
>
count
)
{
if
(
dayPopupCount
>
count
)
{
LogEx
.
logDebug
(
"canSendNotification"
,
"count"
)
LogEx
.
logDebug
(
"canSendNotification"
,
"count"
)
EventUtils
.
event
(
"Notification_Error"
,
"dayPopupCount=$dayPopupCount count=$count"
)
EventUtils
.
event
(
"Notification_Error"
,
"dayPopupCount=$dayPopupCount count=$count
where=$where actionId=$actionId
"
)
return
false
return
false
}
}
//判断是否在时间区域
//判断是否在时间区域
...
@@ -95,15 +95,15 @@ object NotificationUiUtil {
...
@@ -95,15 +95,15 @@ object NotificationUiUtil {
val
calendar
=
Calendar
.
getInstance
()
val
calendar
=
Calendar
.
getInstance
()
val
currentHour
=
calendar
.
get
(
Calendar
.
HOUR_OF_DAY
)
val
currentHour
=
calendar
.
get
(
Calendar
.
HOUR_OF_DAY
)
if
(
currentHour
!
in
start
until
end
)
{
if
(
currentHour
!
in
start
until
end
)
{
LogEx
.
logDebug
(
"canSendNotification"
,
"start
end currentHour=$currentHour start=$start end=$end"
)
LogEx
.
logDebug
(
"canSendNotification"
,
"start
-
end currentHour=$currentHour start=$start end=$end"
)
EventUtils
.
event
(
"Notification_Error"
,
"start=$start end=$end currentHour=$currentHour"
)
EventUtils
.
event
(
"Notification_Error"
,
"start=$start end=$end currentHour=$currentHour
where=$where actionId=$actionId
"
)
return
false
return
false
}
}
//单位分钟
//单位分钟
var
interval
=
AppPreferences
.
getInstance
().
getString
(
popup_interval
,
"1"
).
toInt
()
var
interval
=
AppPreferences
.
getInstance
().
getString
(
popup_interval
,
"1"
).
toInt
()
if
(
where
==
POPUP_WHERE_TIMBER
)
{
if
(
where
==
POPUP_WHERE_TIMBER
)
{
interval
=
AppPreferences
.
getInstance
().
getString
(
popup_tim
b
er_interval
,
"7"
).
toInt
()
interval
=
AppPreferences
.
getInstance
().
getString
(
popup_timer_interval
,
"7"
).
toInt
()
}
}
if
(
where
==
POPUP_WHERE_LOCK
)
{
if
(
where
==
POPUP_WHERE_LOCK
)
{
interval
=
AppPreferences
.
getInstance
().
getString
(
popup_lock_interval
,
"1"
).
toInt
()
interval
=
AppPreferences
.
getInstance
().
getString
(
popup_lock_interval
,
"1"
).
toInt
()
...
@@ -112,7 +112,7 @@ object NotificationUiUtil {
...
@@ -112,7 +112,7 @@ object NotificationUiUtil {
interval
=
AppPreferences
.
getInstance
().
getString
(
popup_fcm_interval
,
"1"
).
toInt
()
interval
=
AppPreferences
.
getInstance
().
getString
(
popup_fcm_interval
,
"1"
).
toInt
()
}
}
if
(
System
.
currentTimeMillis
()
-
lastPopupTime
<
interval
*
60
*
1000L
)
{
if
(
System
.
currentTimeMillis
()
-
lastPopupTime
<
interval
*
60
*
1000L
)
{
EventUtils
.
event
(
"Notification_Error"
,
"where=$where interval=$interval"
)
EventUtils
.
event
(
"Notification_Error"
,
"where=$where
actionId=$actionId
interval=$interval"
)
LogEx
.
logDebug
(
"canSendNotification"
,
"interval"
)
LogEx
.
logDebug
(
"canSendNotification"
,
"interval"
)
return
false
return
false
}
}
...
@@ -122,7 +122,7 @@ object NotificationUiUtil {
...
@@ -122,7 +122,7 @@ object NotificationUiUtil {
@SuppressLint
(
"RemoteViewLayout"
)
@SuppressLint
(
"RemoteViewLayout"
)
fun
sendNotification
(
context
:
Context
,
actionId
:
String
,
where
:
String
=
""
)
{
fun
sendNotification
(
context
:
Context
,
actionId
:
String
,
where
:
String
=
""
)
{
if
(!
canSendNotification
(
where
))
return
if
(!
canSendNotification
(
where
,
actionId
))
return
val
bigRemoteViews
=
RemoteViews
(
MyApplication
.
context
.
packageName
,
R
.
layout
.
notification_message
)
val
bigRemoteViews
=
RemoteViews
(
MyApplication
.
context
.
packageName
,
R
.
layout
.
notification_message
)
val
smallRemoteViews
=
RemoteViews
(
MyApplication
.
context
.
packageName
,
R
.
layout
.
notification_message
)
val
smallRemoteViews
=
RemoteViews
(
MyApplication
.
context
.
packageName
,
R
.
layout
.
notification_message
)
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/fcm/PopupConstObject.kt
View file @
535a918c
...
@@ -4,9 +4,10 @@ import com.base.pdfviewerscannerwhite.utils.AppPreferences
...
@@ -4,9 +4,10 @@ import com.base.pdfviewerscannerwhite.utils.AppPreferences
object
PopupConstObject
{
object
PopupConstObject
{
const
val
POPUP_WHERE_TIMBER
=
"Tim
b
er"
const
val
POPUP_WHERE_TIMBER
=
"Timer"
const
val
POPUP_WHERE_LOCK
=
"Lock"
const
val
POPUP_WHERE_LOCK
=
"Lock"
const
val
POPUP_WHERE_FCM
=
"fcm"
const
val
POPUP_WHERE_FCM
=
"fcm"
const
val
POPUP_WHERE_MEDIA_CHANGE
=
"media_change"
//推送总开关 0 关 1开
//推送总开关 0 关 1开
val
popup_status
=
"popup_status"
val
popup_status
=
"popup_status"
...
@@ -17,7 +18,7 @@ object PopupConstObject {
...
@@ -17,7 +18,7 @@ object PopupConstObject {
val
popup_start
=
"popup_start"
val
popup_start
=
"popup_start"
val
popup_end
=
"popup_end"
val
popup_end
=
"popup_end"
val
popup_interval
=
"popup_interval"
val
popup_interval
=
"popup_interval"
val
popup_tim
b
er_interval
=
"popup_timber_interval"
val
popup_timer_interval
=
"popup_timber_interval"
val
popup_lock_interval
=
"popup_lock_interval"
val
popup_lock_interval
=
"popup_lock_interval"
val
popup_fcm_interval
=
"popup_fcm_interval"
val
popup_fcm_interval
=
"popup_fcm_interval"
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/service/MeidaContentObserver.kt
View file @
535a918c
...
@@ -8,6 +8,7 @@ import android.net.Uri
...
@@ -8,6 +8,7 @@ import android.net.Uri
import
android.provider.MediaStore
import
android.provider.MediaStore
import
com.base.pdfviewerscannerwhite.bean.ConstObject
import
com.base.pdfviewerscannerwhite.bean.ConstObject
import
com.base.pdfviewerscannerwhite.fcm.NotificationUiUtil
import
com.base.pdfviewerscannerwhite.fcm.NotificationUiUtil
import
com.base.pdfviewerscannerwhite.fcm.PopupConstObject
import
com.base.pdfviewerscannerwhite.utils.LogEx
import
com.base.pdfviewerscannerwhite.utils.LogEx
/**
/**
...
@@ -22,7 +23,11 @@ class MediaContentObserver(val context: Context) : ContentObserver(null) {
...
@@ -22,7 +23,11 @@ class MediaContentObserver(val context: Context) : ContentObserver(null) {
super
.
onChange
(
selfChange
,
uri
)
super
.
onChange
(
selfChange
,
uri
)
LogEx
.
logDebug
(
TAG
,
"uri=${uri.toString()}"
)
LogEx
.
logDebug
(
TAG
,
"uri=${uri.toString()}"
)
if
(
uri
.
toString
().
contains
(
"images"
))
{
if
(
uri
.
toString
().
contains
(
"images"
))
{
NotificationUiUtil
.
sendNotification
(
context
,
ConstObject
.
NOTIFICATION_ACTION_NEW_IMAGE_PDF
)
NotificationUiUtil
.
sendNotification
(
context
,
ConstObject
.
NOTIFICATION_ACTION_NEW_IMAGE_PDF
,
PopupConstObject
.
POPUP_WHERE_MEDIA_CHANGE
)
}
}
// uri?.let { queryNewMediaFiles(it) }
// uri?.let { queryNewMediaFiles(it) }
}
}
...
...
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