Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Sign in / Register
Toggle navigation
P
PDF Reader 2
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 Reader 2
Commits
84c1ced5
Commit
84c1ced5
authored
Oct 28, 2024
by
wanglei
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
...
parent
44b02ca7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
10 additions
and
11 deletions
+10
-11
NotificationUiUtil.kt
...c/main/java/com/base/pdfreader2/fcm/NotificationUiUtil.kt
+6
-7
activity_pdf.xml
app/src/main/res/layout/activity_pdf.xml
+3
-3
stay_notification_big.xml
app/src/main/res/layout/stay_notification_big.xml
+1
-1
doc_notification.png
app/src/main/res/mipmap-xxhdpi/doc_notification.png
+0
-0
doc_notification.webp
app/src/main/res/mipmap-xxhdpi/doc_notification.webp
+0
-0
image_notification.png
app/src/main/res/mipmap-xxhdpi/image_notification.png
+0
-0
image_notification.webp
app/src/main/res/mipmap-xxhdpi/image_notification.webp
+0
-0
No files found.
app/src/main/java/com/base/pdfreader2/fcm/NotificationUiUtil.kt
View file @
84c1ced5
...
@@ -57,9 +57,7 @@ import kotlin.random.Random
...
@@ -57,9 +57,7 @@ import kotlin.random.Random
object
NotificationUiUtil
{
object
NotificationUiUtil
{
private
val
TAG
=
"NotificationUiUtil"
private
val
TAG
=
"NotificationUiUtil"
private
const
val
CHANNEL_ID
=
"browser_notification_id"
// 通知渠道ID
var
NOTIFICATION_ID
=
Random
.
nextInt
(
1000
,
1800
)
private
const
val
CHANNEL_NAME
=
"browser_fcm_channel"
// 通知渠道名称
var
NOTIFICATION_ID
=
8999
private
fun
currentDate
():
String
{
private
fun
currentDate
():
String
{
val
dateFormat
=
SimpleDateFormat
(
"yyyy-MM-dd"
,
Locale
.
getDefault
())
val
dateFormat
=
SimpleDateFormat
(
"yyyy-MM-dd"
,
Locale
.
getDefault
())
...
@@ -304,12 +302,13 @@ object NotificationUiUtil {
...
@@ -304,12 +302,13 @@ object NotificationUiUtil {
val
notificationManager
=
context
.
getSystemService
(
Context
.
NOTIFICATION_SERVICE
)
as
NotificationManager
val
notificationManager
=
context
.
getSystemService
(
Context
.
NOTIFICATION_SERVICE
)
as
NotificationManager
val
channelId
=
context
.
resources
.
getString
(
R
.
string
.
app_name
).
replace
(
" "
,
"_"
)
+
"_channel_id"
val
channelName
=
context
.
resources
.
getString
(
R
.
string
.
app_name
).
replace
(
" "
,
"_"
)
+
"_channel"
//创建channel
//创建channel
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
O
)
{
val
channel
=
NotificationChannel
(
val
channel
=
NotificationChannel
(
CHANNEL_ID
,
channelId
,
channelName
,
NotificationManager
.
IMPORTANCE_HIGH
CHANNEL_NAME
,
NotificationManager
.
IMPORTANCE_HIGH
)
)
channel
.
lockscreenVisibility
=
NotificationCompat
.
VISIBILITY_PUBLIC
channel
.
lockscreenVisibility
=
NotificationCompat
.
VISIBILITY_PUBLIC
notificationManager
.
createNotificationChannel
(
channel
)
notificationManager
.
createNotificationChannel
(
channel
)
...
@@ -317,7 +316,7 @@ object NotificationUiUtil {
...
@@ -317,7 +316,7 @@ object NotificationUiUtil {
// Create the notification
// Create the notification
val
builder
:
NotificationCompat
.
Builder
=
NotificationCompat
.
Builder
(
context
,
CHANNEL_ID
)
val
builder
:
NotificationCompat
.
Builder
=
NotificationCompat
.
Builder
(
context
,
channelId
)
//设置状态栏内的小图标
//设置状态栏内的小图标
val
smallIcon
=
IconCompat
.
createFromIcon
(
val
smallIcon
=
IconCompat
.
createFromIcon
(
...
...
app/src/main/res/layout/activity_pdf.xml
View file @
84c1ced5
...
@@ -110,7 +110,7 @@
...
@@ -110,7 +110,7 @@
android:src=
"@mipmap/wancheng"
android:src=
"@mipmap/wancheng"
android:visibility=
"gone"
android:visibility=
"gone"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraint
Start_toStartOf=
"@id/iv_more
"
app:layout_constraint
End_toEndOf=
"parent
"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintTop_toTopOf=
"parent"
tools:ignore=
"ContentDescription"
/>
tools:ignore=
"ContentDescription"
/>
...
@@ -421,8 +421,8 @@
...
@@ -421,8 +421,8 @@
android:layout_gravity=
"center_horizontal"
android:layout_gravity=
"center_horizontal"
android:layout_marginTop=
"20dp"
android:layout_marginTop=
"20dp"
android:max=
"100"
android:max=
"100"
tools:progress=
"50
"
android:progressDrawable=
"@drawable/progress_bar_pdf
"
android:progressDrawable=
"@drawable/progress_bar_pdf
"
/>
tools:progress=
"50
"
/>
</LinearLayout>
</LinearLayout>
...
...
app/src/main/res/layout/stay_notification_big.xml
View file @
84c1ced5
...
@@ -33,7 +33,7 @@
...
@@ -33,7 +33,7 @@
tools:ignore=
"UseCompoundDrawables"
>
tools:ignore=
"UseCompoundDrawables"
>
<ImageView
<ImageView
android:layout_width=
"
23
dp"
android:layout_width=
"
30
dp"
android:layout_height=
"30dp"
android:layout_height=
"30dp"
android:layout_gravity=
"center_horizontal"
android:layout_gravity=
"center_horizontal"
android:src=
"@mipmap/doc_notification"
android:src=
"@mipmap/doc_notification"
...
...
app/src/main/res/mipmap-xxhdpi/doc_notification.png
0 → 100644
View file @
84c1ced5
6.86 KB
app/src/main/res/mipmap-xxhdpi/doc_notification.webp
deleted
100644 → 0
View file @
44b02ca7
File deleted
app/src/main/res/mipmap-xxhdpi/image_notification.png
0 → 100644
View file @
84c1ced5
7.82 KB
app/src/main/res/mipmap-xxhdpi/image_notification.webp
deleted
100644 → 0
View file @
44b02ca7
File deleted
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