Browse Source

Add back track icon onClick and title onLongClick actions

Closes #8565
Closes #8536
arkon 2 years ago
parent
commit
be5802e473

+ 9 - 1
app/src/main/java/eu/kanade/presentation/components/TrackLogoIcon.kt

@@ -13,14 +13,22 @@ import androidx.compose.ui.graphics.Color
 import androidx.compose.ui.res.painterResource
 import androidx.compose.ui.res.stringResource
 import androidx.compose.ui.unit.dp
+import eu.kanade.presentation.util.clickableNoIndication
 import eu.kanade.tachiyomi.data.track.TrackService
 
 @Composable
 fun TrackLogoIcon(
     service: TrackService,
+    onClick: (() -> Unit)? = null,
 ) {
+    val modifier = if (onClick != null) {
+        Modifier.clickableNoIndication(onClick = onClick)
+    } else {
+        Modifier
+    }
+
     Box(
-        modifier = Modifier
+        modifier = modifier
             .size(48.dp)
             .background(color = Color(service.getLogoColor()), shape = MaterialTheme.shapes.medium)
             .padding(4.dp),

+ 14 - 2
app/src/main/java/eu/kanade/presentation/manga/TrackInfoDialogHome.kt

@@ -3,6 +3,7 @@ package eu.kanade.presentation.manga
 import androidx.compose.animation.animateContentSize
 import androidx.compose.foundation.background
 import androidx.compose.foundation.clickable
+import androidx.compose.foundation.combinedClickable
 import androidx.compose.foundation.layout.Arrangement
 import androidx.compose.foundation.layout.Box
 import androidx.compose.foundation.layout.Column
@@ -33,6 +34,7 @@ import androidx.compose.ui.Alignment
 import androidx.compose.ui.Modifier
 import androidx.compose.ui.draw.alpha
 import androidx.compose.ui.draw.clip
+import androidx.compose.ui.platform.LocalContext
 import androidx.compose.ui.res.stringResource
 import androidx.compose.ui.text.style.TextOverflow
 import androidx.compose.ui.unit.dp
@@ -43,6 +45,7 @@ import eu.kanade.presentation.components.VerticalDivider
 import eu.kanade.tachiyomi.R
 import eu.kanade.tachiyomi.data.track.TrackService
 import eu.kanade.tachiyomi.ui.manga.track.TrackItem
+import eu.kanade.tachiyomi.util.system.copyToClipboard
 import java.text.DateFormat
 
 private const val UnsetStatusTextAlpha = 0.5F
@@ -133,16 +136,25 @@ private fun TrackInfoItem(
     onOpenInBrowser: () -> Unit,
     onRemoved: () -> Unit,
 ) {
+    val context = LocalContext.current
     Column {
         Row(
             verticalAlignment = Alignment.CenterVertically,
         ) {
-            TrackLogoIcon(service)
+            TrackLogoIcon(
+                service = service,
+                onClick = onOpenInBrowser,
+            )
             Box(
                 modifier = Modifier
                     .height(48.dp)
                     .weight(1f)
-                    .clickable(onClick = onNewSearch)
+                    .combinedClickable(
+                        onClick = onNewSearch,
+                        onLongClick = {
+                            context.copyToClipboard(title, title)
+                        },
+                    )
                     .padding(start = 16.dp),
                 contentAlignment = Alignment.CenterStart,
             ) {