mirror of
https://github.com/libre-tube/LibreTube.git
synced 2024-12-17 07:40:29 +05:30
18 lines
514 B
Kotlin
18 lines
514 B
Kotlin
|
package com.github.libretube.util
|
||
|
|
||
|
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)
|
||
|
}
|
||
|
}
|