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
bfa4cd0d
Commit
bfa4cd0d
authored
Oct 11, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
12e4231e
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
148 additions
and
0 deletions
+148
-0
ConstObject.kt
...n/java/com/base/pdfviewerscannerwhite/bean/ConstObject.kt
+5
-0
NotificationUiUtil.kt
.../com/base/pdfviewerscannerwhite/fcm/NotificationUiUtil.kt
+60
-0
ScreenStatusReceiver.java
.../base/pdfviewerscannerwhite/fcm/ScreenStatusReceiver.java
+73
-0
MyApplication.kt
...va/com/base/pdfviewerscannerwhite/helper/MyApplication.kt
+2
-0
strings.xml
app/src/main/res/values/strings.xml
+8
-0
No files found.
app/src/main/java/com/base/pdfviewerscannerwhite/bean/ConstObject.kt
View file @
bfa4cd0d
...
@@ -45,6 +45,11 @@ object ConstObject {
...
@@ -45,6 +45,11 @@ object ConstObject {
const
val
NOTIFICATION_ACTION_BOOKMARK
=
"notification_action_bookmark"
const
val
NOTIFICATION_ACTION_BOOKMARK
=
"notification_action_bookmark"
const
val
NOTIFICATION_ACTION_NEW_IMAGE_PDF
=
"notification_action_new_image_pdf"
const
val
NOTIFICATION_ACTION_NEW_IMAGE_PDF
=
"notification_action_new_image_pdf"
const
val
NOTIFICATION_ACTION_READ_PDF
=
"notification_action_read_pdf"
const
val
NOTIFICATION_ACTION_READ_DOCUMENTS
=
"notification_action_read_documents"
const
val
NOTIFICATION_ACTION_UN_VIEW_FILES
=
"notification_action_un_view_files"
const
val
NOTIFICATION_ACTION_IMPORTANT_DOCUMENT
=
"notification_action_important_document"
const
val
SHORTCUT_SCAN_PDF
=
"shortcut_scan_pdf"
const
val
SHORTCUT_SCAN_PDF
=
"shortcut_scan_pdf"
const
val
SHORTCUT_SPLIT_PDF
=
"shortcut_split_pdf"
const
val
SHORTCUT_SPLIT_PDF
=
"shortcut_split_pdf"
const
val
SHORTCUT_MERGE_PDF
=
"shortcut_merge_pdf"
const
val
SHORTCUT_MERGE_PDF
=
"shortcut_merge_pdf"
...
...
app/src/main/java/com/base/pdfviewerscannerwhite/fcm/NotificationUiUtil.kt
View file @
bfa4cd0d
...
@@ -12,7 +12,11 @@ import android.widget.RemoteViews
...
@@ -12,7 +12,11 @@ import android.widget.RemoteViews
import
androidx.core.app.NotificationCompat
import
androidx.core.app.NotificationCompat
import
androidx.core.graphics.drawable.IconCompat
import
androidx.core.graphics.drawable.IconCompat
import
com.base.pdfviewerscannerwhite.R
import
com.base.pdfviewerscannerwhite.R
import
com.base.pdfviewerscannerwhite.bean.ConstObject.NOTIFICATION_ACTION_IMPORTANT_DOCUMENT
import
com.base.pdfviewerscannerwhite.bean.ConstObject.NOTIFICATION_ACTION_NEW_IMAGE_PDF
import
com.base.pdfviewerscannerwhite.bean.ConstObject.NOTIFICATION_ACTION_NEW_IMAGE_PDF
import
com.base.pdfviewerscannerwhite.bean.ConstObject.NOTIFICATION_ACTION_READ_DOCUMENTS
import
com.base.pdfviewerscannerwhite.bean.ConstObject.NOTIFICATION_ACTION_READ_PDF
import
com.base.pdfviewerscannerwhite.bean.ConstObject.NOTIFICATION_ACTION_UN_VIEW_FILES
import
com.base.pdfviewerscannerwhite.fcm.PopupConstObject.popup_count
import
com.base.pdfviewerscannerwhite.fcm.PopupConstObject.popup_count
import
com.base.pdfviewerscannerwhite.fcm.PopupConstObject.popup_end
import
com.base.pdfviewerscannerwhite.fcm.PopupConstObject.popup_end
import
com.base.pdfviewerscannerwhite.fcm.PopupConstObject.popup_interval
import
com.base.pdfviewerscannerwhite.fcm.PopupConstObject.popup_interval
...
@@ -115,6 +119,46 @@ object NotificationUiUtil {
...
@@ -115,6 +119,46 @@ object NotificationUiUtil {
smallRemoteViews
.
setTextViewText
(
R
.
id
.
tv_desc
,
desc
)
smallRemoteViews
.
setTextViewText
(
R
.
id
.
tv_desc
,
desc
)
sendCustomNotification
(
context
,
intent
,
bigRemoteViews
,
smallRemoteViews
)
sendCustomNotification
(
context
,
intent
,
bigRemoteViews
,
smallRemoteViews
)
}
}
NOTIFICATION_ACTION_READ_PDF
->
{
val
tittle
=
context
.
getString
(
R
.
string
.
read_your_pdf_file
)
val
desc
=
context
.
getString
(
R
.
string
.
did_you_miss_this_pdf_file
)
bigRemoteViews
.
setTextViewText
(
R
.
id
.
tv_tittle
,
tittle
)
smallRemoteViews
.
setTextViewText
(
R
.
id
.
tv_tittle
,
tittle
)
bigRemoteViews
.
setTextViewText
(
R
.
id
.
tv_desc
,
desc
)
smallRemoteViews
.
setTextViewText
(
R
.
id
.
tv_desc
,
desc
)
sendCustomNotification
(
context
,
intent
,
bigRemoteViews
,
smallRemoteViews
)
}
NOTIFICATION_ACTION_READ_DOCUMENTS
->
{
val
tittle
=
context
.
getString
(
R
.
string
.
read_more_phone_documents
)
val
desc
=
context
.
getString
(
R
.
string
.
click_to_read_and_edit_your_document
)
bigRemoteViews
.
setTextViewText
(
R
.
id
.
tv_tittle
,
tittle
)
smallRemoteViews
.
setTextViewText
(
R
.
id
.
tv_tittle
,
tittle
)
bigRemoteViews
.
setTextViewText
(
R
.
id
.
tv_desc
,
desc
)
smallRemoteViews
.
setTextViewText
(
R
.
id
.
tv_desc
,
desc
)
sendCustomNotification
(
context
,
intent
,
bigRemoteViews
,
smallRemoteViews
)
}
NOTIFICATION_ACTION_UN_VIEW_FILES
->
{
val
tittle
=
context
.
getString
(
R
.
string
.
there_are_unviewed_files
)
val
desc
=
context
.
getString
(
R
.
string
.
click_to_read_now
)
bigRemoteViews
.
setTextViewText
(
R
.
id
.
tv_tittle
,
tittle
)
smallRemoteViews
.
setTextViewText
(
R
.
id
.
tv_tittle
,
tittle
)
bigRemoteViews
.
setTextViewText
(
R
.
id
.
tv_desc
,
desc
)
smallRemoteViews
.
setTextViewText
(
R
.
id
.
tv_desc
,
desc
)
sendCustomNotification
(
context
,
intent
,
bigRemoteViews
,
smallRemoteViews
)
}
NOTIFICATION_ACTION_IMPORTANT_DOCUMENT
->
{
val
tittle
=
context
.
getString
(
R
.
string
.
don_t_miss_important_documents
)
val
desc
=
context
.
getString
(
R
.
string
.
view_now
)
bigRemoteViews
.
setTextViewText
(
R
.
id
.
tv_tittle
,
tittle
)
smallRemoteViews
.
setTextViewText
(
R
.
id
.
tv_tittle
,
tittle
)
bigRemoteViews
.
setTextViewText
(
R
.
id
.
tv_desc
,
desc
)
smallRemoteViews
.
setTextViewText
(
R
.
id
.
tv_desc
,
desc
)
sendCustomNotification
(
context
,
intent
,
bigRemoteViews
,
smallRemoteViews
)
}
}
}
}
}
...
@@ -187,4 +231,20 @@ object NotificationUiUtil {
...
@@ -187,4 +231,20 @@ object NotificationUiUtil {
lastPopupTime
=
System
.
currentTimeMillis
()
lastPopupTime
=
System
.
currentTimeMillis
()
}
}
val
looper_actionId
=
listOf
(
NOTIFICATION_ACTION_READ_PDF
,
NOTIFICATION_ACTION_READ_DOCUMENTS
,
NOTIFICATION_ACTION_UN_VIEW_FILES
,
NOTIFICATION_ACTION_IMPORTANT_DOCUMENT
)
var
actionIdList
=
arrayListOf
<
String
>()
fun
getNextActionId
():
String
{
if
(
actionIdList
.
isEmpty
())
{
actionIdList
.
addAll
(
looper_actionId
)
}
val
next
=
actionIdList
[
0
]
actionIdList
.
removeAt
(
0
)
return
next
}
}
}
\ No newline at end of file
app/src/main/java/com/base/pdfviewerscannerwhite/fcm/ScreenStatusReceiver.java
0 → 100644
View file @
bfa4cd0d
package
com
.
base
.
pdfviewerscannerwhite
.
fcm
;
import
android.content.BroadcastReceiver
;
import
android.content.Context
;
import
android.content.Intent
;
import
android.content.IntentFilter
;
import
android.os.Build
;
import
com.base.pdfviewerscannerwhite.utils.AppPreferences
;
import
java.util.Objects
;
public
class
ScreenStatusReceiver
extends
BroadcastReceiver
{
private
static
boolean
isDeviceInteractive
=
true
;
private
static
boolean
isSecureLockActive
=
false
;
public
static
void
setupScreenStatusListener
(
Context
context
)
{
IntentFilter
intentFilter
=
new
IntentFilter
();
intentFilter
.
addAction
(
Intent
.
ACTION_SCREEN_OFF
);
intentFilter
.
addAction
(
Intent
.
ACTION_SCREEN_ON
);
intentFilter
.
addAction
(
Intent
.
ACTION_USER_PRESENT
);
final
Context
applicationContext
=
context
.
getApplicationContext
();
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
TIRAMISU
)
{
applicationContext
.
registerReceiver
(
new
ScreenStatusReceiver
(),
intentFilter
,
Context
.
RECEIVER_EXPORTED
);
}
else
{
applicationContext
.
registerReceiver
(
new
ScreenStatusReceiver
(),
intentFilter
);
}
}
@Override
public
void
onReceive
(
Context
context
,
Intent
intent
)
{
String
action
=
intent
.
getAction
();
switch
(
Objects
.
requireNonNull
(
action
))
{
case
Intent
.
ACTION_SCREEN_ON
:
setDeviceInteractive
(
true
);
break
;
case
Intent
.
ACTION_SCREEN_OFF
:
setDeviceInteractive
(
false
);
setSecureLockActive
(
true
);
break
;
case
Intent
.
ACTION_USER_PRESENT
:
setSecureLockActive
(
false
);
if
(
isDeviceInteractive
()
&&
!
isSecureLockActive
())
{
int
secureSetting
=
Integer
.
parseInt
(
AppPreferences
.
getInstance
().
getString
(
"lockS"
,
"1"
));
if
(
secureSetting
==
1
)
{
String
actionId
=
NotificationUiUtil
.
INSTANCE
.
getNextActionId
();
NotificationUiUtil
.
INSTANCE
.
sendNotification
(
context
,
actionId
);
}
}
break
;
}
}
private
void
setDeviceInteractive
(
boolean
interactive
)
{
isDeviceInteractive
=
interactive
;
}
public
static
boolean
isDeviceInteractive
()
{
return
isDeviceInteractive
;
}
private
void
setSecureLockActive
(
boolean
active
)
{
isSecureLockActive
=
active
;
}
public
static
boolean
isSecureLockActive
()
{
return
isSecureLockActive
;
}
}
\ No newline at end of file
app/src/main/java/com/base/pdfviewerscannerwhite/helper/MyApplication.kt
View file @
bfa4cd0d
...
@@ -6,6 +6,7 @@ import android.content.Intent
...
@@ -6,6 +6,7 @@ import android.content.Intent
import
android.os.Bundle
import
android.os.Bundle
import
android.text.TextUtils
import
android.text.TextUtils
import
com.base.pdfviewerscannerwhite.fcm.FCMManager
import
com.base.pdfviewerscannerwhite.fcm.FCMManager
import
com.base.pdfviewerscannerwhite.fcm.ScreenStatusReceiver
import
com.base.pdfviewerscannerwhite.ui.splash.SplashActivity
import
com.base.pdfviewerscannerwhite.ui.splash.SplashActivity
import
com.base.pdfviewerscannerwhite.utils.ActivityManagerUtils
import
com.base.pdfviewerscannerwhite.utils.ActivityManagerUtils
import
com.base.pdfviewerscannerwhite.utils.AppPreferences
import
com.base.pdfviewerscannerwhite.utils.AppPreferences
...
@@ -69,6 +70,7 @@ class MyApplication : Application() {
...
@@ -69,6 +70,7 @@ class MyApplication : Application() {
FCMManager
.
subscribeToTopic
(
topic
)
FCMManager
.
subscribeToTopic
(
topic
)
InstallHelps
.
init
()
InstallHelps
.
init
()
initLifeListener
()
initLifeListener
()
ScreenStatusReceiver
.
setupScreenStatusListener
(
this
)
}
}
...
...
app/src/main/res/values/strings.xml
View file @
bfa4cd0d
...
@@ -85,5 +85,13 @@
...
@@ -85,5 +85,13 @@
<string
name=
"preparing_advertisement"
>
Preparing advertisement...
</string>
<string
name=
"preparing_advertisement"
>
Preparing advertisement...
</string>
<string
name=
"new_image_for_creating_pdf"
>
New image for creating PDF
</string>
<string
name=
"new_image_for_creating_pdf"
>
New image for creating PDF
</string>
<string
name=
"edit_images_to_create_pdf_files"
>
Edit images to create PDF files
</string>
<string
name=
"edit_images_to_create_pdf_files"
>
Edit images to create PDF files
</string>
<string
name=
"read_your_pdf_file"
>
Read your PDF file
</string>
<string
name=
"did_you_miss_this_pdf_file"
>
Did you miss this PDF file?
</string>
<string
name=
"read_more_phone_documents"
>
Read more phone documents
</string>
<string
name=
"click_to_read_and_edit_your_document"
>
Click to read and edit your document
</string>
<string
name=
"there_are_unviewed_files"
>
There are unviewed files
</string>
<string
name=
"click_to_read_now"
>
Click to read now
</string>
<string
name=
"don_t_miss_important_documents"
>
Don\'t miss important documents
</string>
<string
name=
"view_now"
>
View Now
</string>
</resources>
</resources>
\ 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