Skip to content

Commit

Permalink
fix notification appearance
Browse files Browse the repository at this point in the history
  • Loading branch information
StageGuard committed Nov 2, 2024
1 parent 678ca51 commit e48af81
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
6 changes: 3 additions & 3 deletions app/android/src/main/kotlin/AniApplication.kt
Original file line number Diff line number Diff line change
Expand Up @@ -175,10 +175,10 @@ class AniApplication : Application() {
return startForegroundService(
Intent(this, AniTorrentService::class.java).apply {
putExtra("app_name", me.him188.ani.R.string.app_name)
putExtra("app_service_title_text_idle", me.him188.ani.R.string.app_service_content_text)
putExtra("app_service_title_text_working", me.him188.ani.R.string.app_service_content_text)
putExtra("app_service_title_text_idle", me.him188.ani.R.string.app_service_title_text_idle)
putExtra("app_service_title_text_working", me.him188.ani.R.string.app_service_title_text_working)
putExtra("app_service_content_text", me.him188.ani.R.string.app_service_content_text)
putExtra("app_service_stop_text", me.him188.ani.R.string.app_service_content_text)
putExtra("app_service_stop_text", me.him188.ani.R.string.app_service_stop_text)
putExtra("app_icon", me.him188.ani.R.mipmap.a_round)
putExtra("open_activity_intent", Intent(this@AniApplication, MainActivity::class.java))
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,14 @@ class ServiceNotification(
.also { notificationService.createNotificationChannel(it) }
}

fun parseNotificationStrategyFromIntent(intent: Intent?): NotificationAppearance {
fun parseNotificationStrategyFromIntent(intent: Intent?) {
val name = intent.getStringOrDefault("app_name") {
defaultNotificationAppearance.name
}
val titleIdle = intent.getStringOrDefault("app_service_title_text_idle") {
// TODO
val titleIdle = "BT 下载服务正在运行"/*intent.getStringOrDefault("app_service_title_text_idle") {
defaultNotificationAppearance.titleIdle
}
}*/
val titleWorking = intent.getStringOrDefault("app_service_title_text_working") {
defaultNotificationAppearance.titleWorking
}
Expand All @@ -74,7 +75,7 @@ class ServiceNotification(
intent?.getParcelableExtra<Intent>("open_activity_intent")
}

return NotificationAppearance(
notificationAppearance = NotificationAppearance(
name = name,
titleIdle = titleIdle,
titleWorking = titleWorking,
Expand Down Expand Up @@ -164,7 +165,7 @@ class ServiceNotification(

private val defaultNotificationAppearance = NotificationAppearance(
name = "Animeko BT 引擎服务",
titleIdle = "没有下载任务",
titleIdle = "BT 下载服务正在运行",
titleWorking = "正在下载 %1\$d 个资源",
content = "下载:%1\$s,上传:%2\$s",
stopActionText = "停止",
Expand Down

0 comments on commit e48af81

Please sign in to comment.