From 5cd2f669a1e3174ca1babccfa2ff7b3cd7868616 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 23 Oct 2019 17:30:07 +0800 Subject: [PATCH 1/3] up --- .../io/legado/app/service/ShareService.kt | 8 ------ .../java/io/legado/app/service/WebService.kt | 25 +++++++++++++++++++ app/src/main/res/values/strings.xml | 1 + 3 files changed, 26 insertions(+), 8 deletions(-) delete mode 100644 app/src/main/java/io/legado/app/service/ShareService.kt diff --git a/app/src/main/java/io/legado/app/service/ShareService.kt b/app/src/main/java/io/legado/app/service/ShareService.kt deleted file mode 100644 index 49624ecc3..000000000 --- a/app/src/main/java/io/legado/app/service/ShareService.kt +++ /dev/null @@ -1,8 +0,0 @@ -package io.legado.app.service - -import io.legado.app.base.BaseService - -class ShareService : BaseService() { - - -} \ No newline at end of file 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 3dcefd09d..eec294aa1 100644 --- a/app/src/main/java/io/legado/app/service/WebService.kt +++ b/app/src/main/java/io/legado/app/service/WebService.kt @@ -2,8 +2,12 @@ package io.legado.app.service import android.content.Context import android.content.Intent +import androidx.core.app.NotificationCompat +import io.legado.app.R import io.legado.app.base.BaseService import io.legado.app.constant.Action +import io.legado.app.constant.AppConst +import io.legado.app.help.IntentHelp import org.jetbrains.anko.startService class WebService : BaseService() { @@ -28,6 +32,7 @@ class WebService : BaseService() { override fun onCreate() { super.onCreate() isRun = true + updateNotification(getString(R.string.service_starting)) } override fun onDestroy() { @@ -41,4 +46,24 @@ class WebService : BaseService() { } return super.onStartCommand(intent, flags, startId) } + + /** + * 更新通知 + */ + private fun updateNotification(content: String) { + val builder = NotificationCompat.Builder(this, AppConst.channelIdWeb) + .setSmallIcon(R.drawable.ic_web_service_noti) + .setOngoing(true) + .setContentTitle(getString(R.string.web_service)) + .setContentText(content) + builder.addAction( + R.drawable.ic_stop_black_24dp, + getString(R.string.cancel), + IntentHelp.servicePendingIntent(this, Action.stop) + ) + builder.setVisibility(NotificationCompat.VISIBILITY_PUBLIC) + val notification = builder.build() + val notificationId = 1122 + startForeground(notificationId, notification) + } } \ No newline at end of file diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 47d72c6a5..b2f63d0ba 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -534,5 +534,6 @@ 筛选发现 当前位置: 精准搜索 + 正在启动服务 From 89c4b9284751fd55053d231d3e722c5b630a0df8 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 23 Oct 2019 17:30:38 +0800 Subject: [PATCH 2/3] up --- app/src/main/res/menu/book_source.xml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/app/src/main/res/menu/book_source.xml b/app/src/main/res/menu/book_source.xml index 7569e2fe9..1aa312bc4 100644 --- a/app/src/main/res/menu/book_source.xml +++ b/app/src/main/res/menu/book_source.xml @@ -120,10 +120,4 @@ android:title="@string/check_select_source" app:showAsAction="never" /> - - From b81698459efa9708de58da5816854d0361bbb2ee Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 23 Oct 2019 19:11:51 +0800 Subject: [PATCH 3/3] up --- app/google-services .json | 69 +++++++++++++++++++++++++++++ app/src/debug/google-services .json | 69 +++++++++++++++++++++++++++++ 2 files changed, 138 insertions(+) create mode 100644 app/google-services .json create mode 100644 app/src/debug/google-services .json diff --git a/app/google-services .json b/app/google-services .json new file mode 100644 index 000000000..8cc19b1d5 --- /dev/null +++ b/app/google-services .json @@ -0,0 +1,69 @@ +{ + "project_info": { + "project_number": "453392274790", + "firebase_url": "https://legado-fca69.firebaseio.com", + "project_id": "legado-fca69", + "storage_bucket": "legado-fca69.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:453392274790:android:1d2b1eefbe0e78cff624a7", + "android_client_info": { + "package_name": "io.legado.app" + } + }, + "oauth_client": [ + { + "client_id": "453392274790-hnbpatpce9hbjiggj76hgo7queu86atq.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyD90mfNLhA7cAzzI9SonpSz5mrF5BnmyJA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "453392274790-hnbpatpce9hbjiggj76hgo7queu86atq.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:453392274790:android:c4eac14b1410eec5f624a7", + "android_client_info": { + "package_name": "io.legado.app.debug" + } + }, + "oauth_client": [ + { + "client_id": "453392274790-hnbpatpce9hbjiggj76hgo7queu86atq.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyD90mfNLhA7cAzzI9SonpSz5mrF5BnmyJA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "453392274790-hnbpatpce9hbjiggj76hgo7queu86atq.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file diff --git a/app/src/debug/google-services .json b/app/src/debug/google-services .json new file mode 100644 index 000000000..8cc19b1d5 --- /dev/null +++ b/app/src/debug/google-services .json @@ -0,0 +1,69 @@ +{ + "project_info": { + "project_number": "453392274790", + "firebase_url": "https://legado-fca69.firebaseio.com", + "project_id": "legado-fca69", + "storage_bucket": "legado-fca69.appspot.com" + }, + "client": [ + { + "client_info": { + "mobilesdk_app_id": "1:453392274790:android:1d2b1eefbe0e78cff624a7", + "android_client_info": { + "package_name": "io.legado.app" + } + }, + "oauth_client": [ + { + "client_id": "453392274790-hnbpatpce9hbjiggj76hgo7queu86atq.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyD90mfNLhA7cAzzI9SonpSz5mrF5BnmyJA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "453392274790-hnbpatpce9hbjiggj76hgo7queu86atq.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + }, + { + "client_info": { + "mobilesdk_app_id": "1:453392274790:android:c4eac14b1410eec5f624a7", + "android_client_info": { + "package_name": "io.legado.app.debug" + } + }, + "oauth_client": [ + { + "client_id": "453392274790-hnbpatpce9hbjiggj76hgo7queu86atq.apps.googleusercontent.com", + "client_type": 3 + } + ], + "api_key": [ + { + "current_key": "AIzaSyD90mfNLhA7cAzzI9SonpSz5mrF5BnmyJA" + } + ], + "services": { + "appinvite_service": { + "other_platform_oauth_client": [ + { + "client_id": "453392274790-hnbpatpce9hbjiggj76hgo7queu86atq.apps.googleusercontent.com", + "client_type": 3 + } + ] + } + } + } + ], + "configuration_version": "1" +} \ No newline at end of file