mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-16 07:10:29 +05:30
21 lines
456 B
Kotlin
21 lines
456 B
Kotlin
package com.github.libretube.extensions
|
|
|
|
import android.content.Context
|
|
import android.os.Handler
|
|
import android.os.Looper
|
|
import android.widget.Toast
|
|
|
|
fun Context.toastFromMainThread(text: String) {
|
|
Handler(Looper.getMainLooper()).post {
|
|
Toast.makeText(
|
|
this,
|
|
text,
|
|
Toast.LENGTH_SHORT
|
|
).show()
|
|
}
|
|
}
|
|
|
|
fun Context.toastFromMainThread(stringId: Int) {
|
|
toastFromMainThread(getString(stringId))
|
|
}
|