Change "Download" to "Update" for Android 12 for new app updates

This commit is contained in:
Jays2Kings 2021-07-18 21:38:25 -04:00
parent 5f0157499e
commit e97956ee69
2 changed files with 6 additions and 2 deletions

View File

@ -4,6 +4,7 @@ import android.app.PendingIntent
import android.content.Context import android.content.Context
import android.content.Intent import android.content.Intent
import android.net.Uri import android.net.Uri
import android.os.Build
import androidx.core.app.NotificationCompat import androidx.core.app.NotificationCompat
import androidx.core.content.ContextCompat import androidx.core.content.ContextCompat
import androidx.core.net.toUri import androidx.core.net.toUri
@ -58,10 +59,11 @@ internal class UpdaterNotifier(private val context: Context) {
setSmallIcon(android.R.drawable.stat_sys_download_done) setSmallIcon(android.R.drawable.stat_sys_download_done)
color = context.getResourceColor(R.attr.colorAccent) color = context.getResourceColor(R.attr.colorAccent)
clearActions() clearActions()
val isOnA12 = Build.VERSION.SDK_INT >= Build.VERSION_CODES.S
// Download action // Download action
addAction( addAction(
android.R.drawable.stat_sys_download_done, 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( PendingIntent.getService(
context, context,
0, 0,

View File

@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.setting
import android.app.Dialog import android.app.Dialog
import android.content.Intent import android.content.Intent
import android.os.Build
import android.os.Bundle import android.os.Bundle
import androidx.core.net.toUri import androidx.core.net.toUri
import androidx.preference.PreferenceScreen import androidx.preference.PreferenceScreen
@ -190,10 +191,11 @@ class AboutController : SettingsController() {
) )
override fun onCreateDialog(savedViewState: Bundle?): Dialog { override fun onCreateDialog(savedViewState: Bundle?): Dialog {
val isOnA12 = Build.VERSION.SDK_INT >= Build.VERSION_CODES.S
return MaterialDialog(activity!!) return MaterialDialog(activity!!)
.title(R.string.new_version_available) .title(R.string.new_version_available)
.message(text = args.getString(BODY_KEY) ?: "") .message(text = args.getString(BODY_KEY) ?: "")
.positiveButton(R.string.download) { .positiveButton(if (isOnA12) R.string.update else R.string.download) {
val appContext = applicationContext val appContext = applicationContext
if (appContext != null) { if (appContext != null) {
// Start download // Start download