Merge pull request #3400 from Isira-Seneviratne/Fix_lint

Fix lint issue.
This commit is contained in:
Bnyro 2023-03-26 12:10:33 +02:00 committed by GitHub
commit 9ad095f9d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -21,11 +21,11 @@ fun Context.toastFromMainThread(stringId: Int) {
toastFromMainThread(getString(stringId)) toastFromMainThread(getString(stringId))
} }
suspend fun Context.toastFromMainDispatcher(text: String, length: Int = Toast.LENGTH_SHORT) = withContext( suspend fun Context.toastFromMainDispatcher(text: String, length: Int = Toast.LENGTH_SHORT) {
Dispatchers.Main withContext(Dispatchers.Main) {
) {
Toast.makeText(this@toastFromMainDispatcher, text, length).show() Toast.makeText(this@toastFromMainDispatcher, text, length).show()
} }
}
suspend fun Context.toastFromMainDispatcher(stringId: Int, length: Int = Toast.LENGTH_SHORT) { suspend fun Context.toastFromMainDispatcher(stringId: Int, length: Int = Toast.LENGTH_SHORT) {
toastFromMainDispatcher(getString(stringId), length) toastFromMainDispatcher(getString(stringId), length)