From fcb409f551e0da0f1e9467acde8d3466d025e378 Mon Sep 17 00:00:00 2001 From: zyrouge Date: Thu, 18 Apr 2024 19:54:15 +0530 Subject: [PATCH] chore: lint --- .../zyrouge/symphony/ui/components/LongPressCopyableText.kt | 3 --- app/src/main/java/io/github/zyrouge/symphony/utils/Compose.kt | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/io/github/zyrouge/symphony/ui/components/LongPressCopyableText.kt b/app/src/main/java/io/github/zyrouge/symphony/ui/components/LongPressCopyableText.kt index e7f00559..6d76f32c 100644 --- a/app/src/main/java/io/github/zyrouge/symphony/ui/components/LongPressCopyableText.kt +++ b/app/src/main/java/io/github/zyrouge/symphony/ui/components/LongPressCopyableText.kt @@ -5,14 +5,11 @@ import androidx.compose.material3.Text import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import androidx.compose.ui.input.pointer.pointerInput -import androidx.compose.ui.platform.LocalClipboardManager import io.github.zyrouge.symphony.ui.helpers.ViewContext import io.github.zyrouge.symphony.utils.copyToClipboardWithToast @Composable fun LongPressCopyableText(context: ViewContext, text: String) { - val clipboardManager = LocalClipboardManager.current - Text( text, modifier = Modifier.pointerInput(Unit) { diff --git a/app/src/main/java/io/github/zyrouge/symphony/utils/Compose.kt b/app/src/main/java/io/github/zyrouge/symphony/utils/Compose.kt index 702ab63f..4c91a2d4 100644 --- a/app/src/main/java/io/github/zyrouge/symphony/utils/Compose.kt +++ b/app/src/main/java/io/github/zyrouge/symphony/utils/Compose.kt @@ -1,15 +1,15 @@ package io.github.zyrouge.symphony.utils +import android.content.ClipData import android.content.ClipboardManager import android.widget.Toast -import androidx.compose.ui.text.AnnotatedString import io.github.zyrouge.symphony.ui.helpers.ViewContext fun wrapInViewContext(fn: (ViewContext) -> T) = fn fun copyToClipboardWithToast(context: ViewContext, text: String) { val clipboardManager = context.activity.getSystemService(ClipboardManager::class.java) - clipboardManager.setText(AnnotatedString(text)) + clipboardManager.setPrimaryClip(ClipData.newPlainText(null, text)) Toast.makeText( context.activity, context.symphony.t.CopiedXToClipboard(text),