From be5802e47335cded38af67979e45f060e3779595 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 19 Nov 2022 22:37:48 -0500 Subject: [PATCH] Add back track icon onClick and title onLongClick actions Closes #8565 Closes #8536 --- .../presentation/components/TrackLogoIcon.kt | 10 +++++++++- .../presentation/manga/TrackInfoDialogHome.kt | 16 ++++++++++++++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/components/TrackLogoIcon.kt b/app/src/main/java/eu/kanade/presentation/components/TrackLogoIcon.kt index ea70d3705b..e798155c26 100644 --- a/app/src/main/java/eu/kanade/presentation/components/TrackLogoIcon.kt +++ b/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), diff --git a/app/src/main/java/eu/kanade/presentation/manga/TrackInfoDialogHome.kt b/app/src/main/java/eu/kanade/presentation/manga/TrackInfoDialogHome.kt index cc4de8c65e..9022829fa7 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/TrackInfoDialogHome.kt +++ b/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, ) {