diff --git a/app/src/main/java/eu/kanade/presentation/manga/MangaScreen.kt b/app/src/main/java/eu/kanade/presentation/manga/MangaScreen.kt index 4747306b5..cb3e9af1e 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/MangaScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/MangaScreen.kt @@ -80,6 +80,7 @@ fun MangaScreen( onDownloadChapter: ((List, ChapterDownloadAction) -> Unit)?, onAddToLibraryClicked: () -> Unit, onWebViewClicked: (() -> Unit)?, + onWebViewLongClicked: (() -> Unit)?, onTrackingClicked: (() -> Unit)?, onTagClicked: (String) -> Unit, onFilterButtonClicked: () -> Unit, @@ -116,6 +117,7 @@ fun MangaScreen( onDownloadChapter = onDownloadChapter, onAddToLibraryClicked = onAddToLibraryClicked, onWebViewClicked = onWebViewClicked, + onWebViewLongClicked = onWebViewLongClicked, onTrackingClicked = onTrackingClicked, onTagClicked = onTagClicked, onFilterClicked = onFilterButtonClicked, @@ -144,6 +146,7 @@ fun MangaScreen( onDownloadChapter = onDownloadChapter, onAddToLibraryClicked = onAddToLibraryClicked, onWebViewClicked = onWebViewClicked, + onWebViewLongClicked = onWebViewLongClicked, onTrackingClicked = onTrackingClicked, onTagClicked = onTagClicked, onFilterButtonClicked = onFilterButtonClicked, @@ -175,6 +178,7 @@ private fun MangaScreenSmallImpl( onDownloadChapter: ((List, ChapterDownloadAction) -> Unit)?, onAddToLibraryClicked: () -> Unit, onWebViewClicked: (() -> Unit)?, + onWebViewLongClicked: (() -> Unit)?, onTrackingClicked: (() -> Unit)?, onTagClicked: (String) -> Unit, onFilterClicked: () -> Unit, @@ -332,6 +336,7 @@ private fun MangaScreenSmallImpl( trackingCount = state.trackingCount, onAddToLibraryClicked = onAddToLibraryClicked, onWebViewClicked = onWebViewClicked, + onWebViewLongClicked = onWebViewLongClicked, onTrackingClicked = onTrackingClicked, onEditCategory = onEditCategoryClicked, ) @@ -381,6 +386,7 @@ fun MangaScreenLargeImpl( onDownloadChapter: ((List, ChapterDownloadAction) -> Unit)?, onAddToLibraryClicked: () -> Unit, onWebViewClicked: (() -> Unit)?, + onWebViewLongClicked: (() -> Unit)?, onTrackingClicked: (() -> Unit)?, onTagClicked: (String) -> Unit, onFilterButtonClicked: () -> Unit, @@ -525,6 +531,7 @@ fun MangaScreenLargeImpl( trackingCount = state.trackingCount, onAddToLibraryClicked = onAddToLibraryClicked, onWebViewClicked = onWebViewClicked, + onWebViewLongClicked = onWebViewLongClicked, onTrackingClicked = onTrackingClicked, onEditCategory = onEditCategoryClicked, ) diff --git a/app/src/main/java/eu/kanade/presentation/manga/components/MangaInfoHeader.kt b/app/src/main/java/eu/kanade/presentation/manga/components/MangaInfoHeader.kt index df3697527..eda1973f9 100644 --- a/app/src/main/java/eu/kanade/presentation/manga/components/MangaInfoHeader.kt +++ b/app/src/main/java/eu/kanade/presentation/manga/components/MangaInfoHeader.kt @@ -162,6 +162,7 @@ fun MangaActionRow( trackingCount: Int, onAddToLibraryClicked: () -> Unit, onWebViewClicked: (() -> Unit)?, + onWebViewLongClicked: (() -> Unit)?, onTrackingClicked: (() -> Unit)?, onEditCategory: (() -> Unit)?, ) { @@ -196,6 +197,7 @@ fun MangaActionRow( icon = Icons.Outlined.Public, color = defaultActionButtonColor, onClick = onWebViewClicked, + onLongClick = onWebViewLongClicked, ) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt index 6d38c96e7..7bab376d2 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt @@ -61,6 +61,7 @@ import eu.kanade.tachiyomi.ui.manga.track.TrackInfoDialogHomeScreen import eu.kanade.tachiyomi.ui.reader.ReaderActivity import eu.kanade.tachiyomi.ui.updates.UpdatesController import eu.kanade.tachiyomi.ui.webview.WebViewActivity +import eu.kanade.tachiyomi.util.system.copyToClipboard import eu.kanade.tachiyomi.util.system.toShareIntent import eu.kanade.tachiyomi.util.system.toast @@ -101,6 +102,7 @@ class MangaScreen( haptic.performHapticFeedback(HapticFeedbackType.LongPress) }, onWebViewClicked = { openMangaInWebView(context, screenModel.manga, screenModel.source) }.takeIf { isHttpSource }, + onWebViewLongClicked = { copyMangaUrl(context, screenModel.manga, screenModel.source) }.takeIf { isHttpSource }, onTrackingClicked = screenModel::showTrackDialog.takeIf { successState.trackingAvailable }, onTagClicked = { performGenreSearch(router, it, screenModel.source!!) }, onFilterButtonClicked = screenModel::showSettingsDialog, @@ -326,4 +328,14 @@ class MangaScreen( val controller = SearchController(manga) router.pushController(controller) } + + /** + * Copy Manga URL to Clipboard + */ + private fun copyMangaUrl(context: Context, manga_: Manga?, source_: Source?) { + val manga = manga_ ?: return + val source = source_ as? HttpSource ?: return + val url = source.getMangaUrl(manga.toSManga()) + context.copyToClipboard(url, url) + } }