From b0520df1dd4ff169f03b744954e181df94459efe Mon Sep 17 00:00:00 2001 From: Ivan Iskandar <12537387+ivaniskandar@users.noreply.github.com> Date: Sun, 14 Aug 2022 19:44:24 +0700 Subject: [PATCH] Use application context to create toast (#7756) --- .../java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt b/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt index b04121003..cb6b12483 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/system/ContextExtensions.kt @@ -69,7 +69,7 @@ fun Context.toast(@StringRes resource: Int, duration: Int = Toast.LENGTH_SHORT, * @param duration the duration of the toast. Defaults to short. */ fun Context.toast(text: String?, duration: Int = Toast.LENGTH_SHORT, block: (Toast) -> Unit = {}): Toast { - return Toast.makeText(this, text.orEmpty(), duration).also { + return Toast.makeText(applicationContext, text.orEmpty(), duration).also { block(it) it.show() }