From e97956ee694b8563145aa264f9faca672a5f461f Mon Sep 17 00:00:00 2001 From: Jays2Kings Date: Sun, 18 Jul 2021 21:38:25 -0400 Subject: [PATCH] Change "Download" to "Update" for Android 12 for new app updates --- .../java/eu/kanade/tachiyomi/data/updater/UpdaterNotifier.kt | 4 +++- .../java/eu/kanade/tachiyomi/ui/setting/AboutController.kt | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdaterNotifier.kt b/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdaterNotifier.kt index eee2d771b1..a7a4561a41 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdaterNotifier.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/updater/UpdaterNotifier.kt @@ -4,6 +4,7 @@ import android.app.PendingIntent import android.content.Context import android.content.Intent import android.net.Uri +import android.os.Build import androidx.core.app.NotificationCompat import androidx.core.content.ContextCompat import androidx.core.net.toUri @@ -58,10 +59,11 @@ internal class UpdaterNotifier(private val context: Context) { setSmallIcon(android.R.drawable.stat_sys_download_done) color = context.getResourceColor(R.attr.colorAccent) clearActions() + val isOnA12 = Build.VERSION.SDK_INT >= Build.VERSION_CODES.S // Download action addAction( android.R.drawable.stat_sys_download_done, - context.getString(R.string.download), + context.getString(if (isOnA12) R.string.update else R.string.download), PendingIntent.getService( context, 0, diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/AboutController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/AboutController.kt index 9c421daf97..e0df1f654c 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/AboutController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/AboutController.kt @@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.setting import android.app.Dialog import android.content.Intent +import android.os.Build import android.os.Bundle import androidx.core.net.toUri import androidx.preference.PreferenceScreen @@ -190,10 +191,11 @@ class AboutController : SettingsController() { ) override fun onCreateDialog(savedViewState: Bundle?): Dialog { + val isOnA12 = Build.VERSION.SDK_INT >= Build.VERSION_CODES.S return MaterialDialog(activity!!) .title(R.string.new_version_available) .message(text = args.getString(BODY_KEY) ?: "") - .positiveButton(R.string.download) { + .positiveButton(if (isOnA12) R.string.update else R.string.download) { val appContext = applicationContext if (appContext != null) { // Start download