按审查报告修复 M1-M4 与 L1-L8;版本 0.7(versionCode 23)
This commit is contained in:
@@ -49,7 +49,7 @@ object Notif {
|
||||
// 提醒通道交给我们自己播放声音与振动,这里保持静默,避免"响两遍"。
|
||||
val alert = NotificationChannel(
|
||||
CHANNEL_ALERT,
|
||||
"计时结束提醒",
|
||||
context.getString(R.string.notif_channel_alert),
|
||||
NotificationManager.IMPORTANCE_HIGH,
|
||||
).apply {
|
||||
enableVibration(false)
|
||||
@@ -130,11 +130,13 @@ object Notif {
|
||||
b.setCustomContentView(rv)
|
||||
b.setCustomBigContentView(rv)
|
||||
|
||||
// 模板动作保留作兜底(自定义布局生效时系统不会重复绘制这两颗按钮)
|
||||
// 模板动作保留作兜底(自定义布局生效时系统不会重复绘制这两颗按钮)。
|
||||
// 文字必须有:屏幕朗读器读兜底动作时靠它提供语义。
|
||||
if (TimerCore.mode == TimerCore.MODE_FOCUS) {
|
||||
b.addAction(
|
||||
NotificationCompat.Action(
|
||||
if (running) R.drawable.ic_pause else R.drawable.ic_play, "",
|
||||
if (running) R.drawable.ic_pause else R.drawable.ic_play,
|
||||
context.getString(if (running) R.string.notif_action_pause else R.string.notif_action_resume),
|
||||
serviceAction(
|
||||
context,
|
||||
if (running) TimerService.ACTION_PAUSE else TimerService.ACTION_RESUME,
|
||||
@@ -145,7 +147,8 @@ object Notif {
|
||||
}
|
||||
b.addAction(
|
||||
NotificationCompat.Action(
|
||||
R.drawable.ic_stop, "",
|
||||
R.drawable.ic_stop,
|
||||
context.getString(R.string.notif_action_stop),
|
||||
serviceAction(context, TimerService.ACTION_STOP, 23),
|
||||
)
|
||||
)
|
||||
|
||||
@@ -104,7 +104,7 @@ class TimerService : Service() {
|
||||
private fun startForegroundCompat() {
|
||||
val notification = Notif.buildOngoing(this)
|
||||
runCatching {
|
||||
// 两参版本会读清单里声明的前台服务类型(dataSync)。
|
||||
// 两参版本会读清单里声明的前台服务类型(specialUse)。
|
||||
// 不用三参 + SPECIAL_USE:该类型 Android 14 才引入,
|
||||
// 在 P30 的 Android 12 上传进去会直接抛 IllegalArgumentException。
|
||||
startForeground(Notif.ID_ONGOING, notification)
|
||||
|
||||
Reference in New Issue
Block a user