LibreTube/app/src/main/java/com/github/libretube/helpers/ClipboardHelper.kt

18 lines
517 B
Kotlin
Raw Normal View History

package com.github.libretube.helpers
2022-10-12 23:26:31 +05:30
import android.content.ClipData
import android.content.ClipboardManager
import android.content.Context
import com.github.libretube.R
class ClipboardHelper(
private val context: Context
) {
fun save(text: String) {
val clipboard: ClipboardManager =
context.getSystemService(Context.CLIPBOARD_SERVICE) as ClipboardManager
val clip = ClipData.newPlainText(context.getString(R.string.copied), text)
clipboard.setPrimaryClip(clip)
}
}