From 760a38f403c236512956cb914ecb75fdd2828e06 Mon Sep 17 00:00:00 2001 From: kunfei Date: Thu, 7 Nov 2019 17:03:48 +0800 Subject: [PATCH] up --- app/src/main/java/io/legado/app/constant/AppConst.kt | 4 ++++ app/src/main/java/io/legado/app/service/AudioPlayService.kt | 2 +- .../main/java/io/legado/app/service/BaseReadAloudService.kt | 2 +- app/src/main/java/io/legado/app/service/WebService.kt | 3 +-- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/io/legado/app/constant/AppConst.kt b/app/src/main/java/io/legado/app/constant/AppConst.kt index d3548c9f1..00d744fce 100644 --- a/app/src/main/java/io/legado/app/constant/AppConst.kt +++ b/app/src/main/java/io/legado/app/constant/AppConst.kt @@ -55,4 +55,8 @@ object AppConst { set(value) { App.INSTANCE.putPrefBoolean("bookGroupAudio", value) } + + const val notificationIdRead = 12 + const val notificationIdAudio = 13 + const val notificationIdWeb = 14 } \ No newline at end of file diff --git a/app/src/main/java/io/legado/app/service/AudioPlayService.kt b/app/src/main/java/io/legado/app/service/AudioPlayService.kt index 4b1e4912b..b4b56f4d5 100644 --- a/app/src/main/java/io/legado/app/service/AudioPlayService.kt +++ b/app/src/main/java/io/legado/app/service/AudioPlayService.kt @@ -343,7 +343,7 @@ class AudioPlayService : BaseService(), ) builder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC) val notification = builder.build() - startForeground(112201, notification) + startForeground(AppConst.notificationIdAudio, notification) } /** diff --git a/app/src/main/java/io/legado/app/service/BaseReadAloudService.kt b/app/src/main/java/io/legado/app/service/BaseReadAloudService.kt index 431eaa8db..20d0887b8 100644 --- a/app/src/main/java/io/legado/app/service/BaseReadAloudService.kt +++ b/app/src/main/java/io/legado/app/service/BaseReadAloudService.kt @@ -320,7 +320,7 @@ abstract class BaseReadAloudService : BaseService(), ) builder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC) val notification = builder.build() - startForeground(112201, notification) + startForeground(AppConst.notificationIdRead, notification) } abstract fun aloudServicePendingIntent(actionStr: String): PendingIntent? diff --git a/app/src/main/java/io/legado/app/service/WebService.kt b/app/src/main/java/io/legado/app/service/WebService.kt index eec294aa1..a87fb520d 100644 --- a/app/src/main/java/io/legado/app/service/WebService.kt +++ b/app/src/main/java/io/legado/app/service/WebService.kt @@ -63,7 +63,6 @@ class WebService : BaseService() { ) builder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC) val notification = builder.build() - val notificationId = 1122 - startForeground(notificationId, notification) + startForeground(AppConst.notificationIdWeb, notification) } } \ No newline at end of file