Skip to content

Commit

Permalink
add large app icon to all the notification
Browse files Browse the repository at this point in the history
  • Loading branch information
cuong-tran committed Jan 6, 2025
1 parent c5b6141 commit a352872
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 1 deletion.
2 changes: 2 additions & 0 deletions app/src/main/java/eu/kanade/tachiyomi/App.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.graphics.BitmapFactory
import android.os.Build
import android.os.Looper
import android.webkit.WebView
Expand Down Expand Up @@ -157,6 +158,7 @@ class App : Application(), DefaultLifecycleObserver, SingletonImageLoader.Factor
setContentText(stringResource(MR.strings.notification_incognito_text))
setSmallIcon(R.drawable.ic_glasses_24dp)
setColor(ContextCompat.getColor(applicationContext, R.color.ic_launcher))
setLargeIcon(BitmapFactory.decodeResource(applicationContext.resources, R.drawable.komikku))
setOngoing(true)

val pendingIntent = PendingIntent.getBroadcast(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.data.download

import android.content.Context
import android.content.pm.ServiceInfo
import android.graphics.BitmapFactory
import android.os.Build
import androidx.core.content.ContextCompat
import androidx.lifecycle.asFlow
Expand Down Expand Up @@ -33,7 +34,7 @@ import uy.kohesive.injekt.api.get
* This worker is used to manage the downloader. The system can decide to stop the worker, in
* which case the downloader is also stopped. It's also stopped while there's no network available.
*/
class DownloadJob(context: Context, workerParams: WorkerParameters) : CoroutineWorker(context, workerParams) {
class DownloadJob(private val context: Context, workerParams: WorkerParameters) : CoroutineWorker(context, workerParams) {

private val downloadManager: DownloadManager = Injekt.get()
private val downloadPreferences: DownloadPreferences = Injekt.get()
Expand All @@ -43,6 +44,7 @@ class DownloadJob(context: Context, workerParams: WorkerParameters) : CoroutineW
setContentTitle(applicationContext.getString(R.string.download_notifier_downloader_title))
setSmallIcon(android.R.drawable.stat_sys_download)
setColor(ContextCompat.getColor(applicationContext, R.color.ic_launcher))
setLargeIcon(BitmapFactory.decodeResource(context.resources, R.drawable.komikku))
}.build()
return ForegroundInfo(
Notifications.ID_DOWNLOAD_CHAPTER_PROGRESS,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.data.updater
import android.app.PendingIntent
import android.content.Context
import android.content.Intent
import android.graphics.BitmapFactory
import android.net.Uri
import androidx.core.app.NotificationCompat
import androidx.core.content.ContextCompat
Expand All @@ -23,6 +24,7 @@ internal class AppUpdateNotifier(private val context: Context) {

private val notificationBuilder = context.notificationBuilder(Notifications.CHANNEL_APP_UPDATE) {
setColor(ContextCompat.getColor(context, R.color.ic_launcher))
setLargeIcon(BitmapFactory.decodeResource(context.resources, R.drawable.komikku))
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package eu.kanade.tachiyomi.extension.util
import android.app.Service
import android.content.Context
import android.content.Intent
import android.graphics.BitmapFactory
import android.net.Uri
import android.os.IBinder
import androidx.core.content.ContextCompat
Expand All @@ -28,6 +29,7 @@ class ExtensionInstallService : Service() {
val notification = notificationBuilder(Notifications.CHANNEL_EXTENSIONS_UPDATE) {
setSmallIcon(R.drawable.ic_komikku)
setColor(ContextCompat.getColor(applicationContext, R.color.ic_launcher))
setLargeIcon(BitmapFactory.decodeResource(applicationContext.resources, R.drawable.komikku))
setAutoCancel(false)
setOngoing(true)
setShowWhen(false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package eu.kanade.tachiyomi.ui.reader

import android.content.Context
import android.graphics.Bitmap
import android.graphics.BitmapFactory
import android.net.Uri
import androidx.core.app.NotificationCompat
import androidx.core.content.ContextCompat
Expand Down Expand Up @@ -62,6 +63,7 @@ class SaveImageNotifier(private val context: Context) {
fun onError(error: String?) {
// Create notification
with(notificationBuilder) {
setLargeIcon(BitmapFactory.decodeResource(context.resources, R.drawable.komikku))
setContentTitle(context.stringResource(MR.strings.download_notifier_title_error))
setContentText(error ?: context.stringResource(MR.strings.unknown_error))
setSmallIcon(android.R.drawable.ic_menu_report_image)
Expand Down
1 change: 1 addition & 0 deletions app/src/main/java/exh/eh/EHentaiUpdateNotifier.kt
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class EHentaiUpdateNotifier(private val context: Context) {
setContentText(context.stringResource(MR.strings.action_show_errors))
setSmallIcon(R.drawable.ic_komikku)
setColor(ContextCompat.getColor(context, R.color.ic_launcher))
setLargeIcon(notificationBitmap)

setContentIntent(NotificationReceiver.openErrorLogPendingActivity(context, uri))
}
Expand Down

0 comments on commit a352872

Please sign in to comment.