LibreTube/app/src/main/java/com/github/libretube/helpers/ClipboardHelper.kt
Isira Seneviratne b2b444d3e5 Convert ClipboardHelper to an object.
Also improve some related code.
2023-02-03 14:47:09 +05:30

15 lines
457 B
Kotlin

package com.github.libretube.helpers
import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import androidx.core.content.getSystemService
import com.github.libretube.R
object ClipboardHelper {
fun save(context: Context, text: String) {
val clip = ClipData.newPlainText(context.getString(R.string.copied), text)
context.getSystemService<ClipboardManager>()!!.setPrimaryClip(clip)
}
}