Implement copying of Manga URL to Clipboard (#8587)
feat: Implement copying of Manga URL to Clipboard (cherry picked from commit ef3a6c80a7638209a5a41a0923bd9195380429aa) # Conflicts: # app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaScreen.kt
This commit is contained in:
parent
6a79e90b53
commit
c07ccf7943
@ -102,6 +102,7 @@ fun MangaScreen(
|
||||
onDownloadChapter: ((List<ChapterItem>, ChapterDownloadAction) -> Unit)?,
|
||||
onAddToLibraryClicked: () -> Unit,
|
||||
onWebViewClicked: (() -> Unit)?,
|
||||
onWebViewLongClicked: (() -> Unit)?,
|
||||
onTrackingClicked: (() -> Unit)?,
|
||||
onTagClicked: (String) -> Unit,
|
||||
onFilterButtonClicked: () -> Unit,
|
||||
@ -148,6 +149,7 @@ fun MangaScreen(
|
||||
onDownloadChapter = onDownloadChapter,
|
||||
onAddToLibraryClicked = onAddToLibraryClicked,
|
||||
onWebViewClicked = onWebViewClicked,
|
||||
onWebViewLongClicked = onWebViewLongClicked,
|
||||
onTrackingClicked = onTrackingClicked,
|
||||
onTagClicked = onTagClicked,
|
||||
onFilterClicked = onFilterButtonClicked,
|
||||
@ -186,6 +188,7 @@ fun MangaScreen(
|
||||
onDownloadChapter = onDownloadChapter,
|
||||
onAddToLibraryClicked = onAddToLibraryClicked,
|
||||
onWebViewClicked = onWebViewClicked,
|
||||
onWebViewLongClicked = onWebViewLongClicked,
|
||||
onTrackingClicked = onTrackingClicked,
|
||||
onTagClicked = onTagClicked,
|
||||
onFilterButtonClicked = onFilterButtonClicked,
|
||||
@ -227,6 +230,7 @@ private fun MangaScreenSmallImpl(
|
||||
onDownloadChapter: ((List<ChapterItem>, ChapterDownloadAction) -> Unit)?,
|
||||
onAddToLibraryClicked: () -> Unit,
|
||||
onWebViewClicked: (() -> Unit)?,
|
||||
onWebViewLongClicked: (() -> Unit)?,
|
||||
onTrackingClicked: (() -> Unit)?,
|
||||
onTagClicked: (String) -> Unit,
|
||||
onFilterClicked: () -> Unit,
|
||||
@ -403,6 +407,7 @@ private fun MangaScreenSmallImpl(
|
||||
trackingCount = state.trackingCount,
|
||||
onAddToLibraryClicked = onAddToLibraryClicked,
|
||||
onWebViewClicked = onWebViewClicked,
|
||||
onWebViewLongClicked = onWebViewLongClicked,
|
||||
onTrackingClicked = onTrackingClicked,
|
||||
onEditCategory = onEditCategoryClicked,
|
||||
// SY -->
|
||||
@ -505,6 +510,7 @@ fun MangaScreenLargeImpl(
|
||||
onDownloadChapter: ((List<ChapterItem>, ChapterDownloadAction) -> Unit)?,
|
||||
onAddToLibraryClicked: () -> Unit,
|
||||
onWebViewClicked: (() -> Unit)?,
|
||||
onWebViewLongClicked: (() -> Unit)?,
|
||||
onTrackingClicked: (() -> Unit)?,
|
||||
onTagClicked: (String) -> Unit,
|
||||
onFilterButtonClicked: () -> Unit,
|
||||
@ -669,6 +675,7 @@ fun MangaScreenLargeImpl(
|
||||
trackingCount = state.trackingCount,
|
||||
onAddToLibraryClicked = onAddToLibraryClicked,
|
||||
onWebViewClicked = onWebViewClicked,
|
||||
onWebViewLongClicked = onWebViewLongClicked,
|
||||
onTrackingClicked = onTrackingClicked,
|
||||
onEditCategory = onEditCategoryClicked,
|
||||
// SY -->
|
||||
|
@ -160,6 +160,7 @@ fun MangaActionRow(
|
||||
trackingCount: Int,
|
||||
onAddToLibraryClicked: () -> Unit,
|
||||
onWebViewClicked: (() -> Unit)?,
|
||||
onWebViewLongClicked: (() -> Unit)?,
|
||||
onTrackingClicked: (() -> Unit)?,
|
||||
onEditCategory: (() -> Unit)?,
|
||||
// SY -->
|
||||
@ -197,6 +198,7 @@ fun MangaActionRow(
|
||||
icon = Icons.Outlined.Public,
|
||||
color = defaultActionButtonColor,
|
||||
onClick = onWebViewClicked,
|
||||
onLongClick = onWebViewLongClicked,
|
||||
)
|
||||
}
|
||||
// SY -->
|
||||
|
@ -77,6 +77,7 @@ import eu.kanade.tachiyomi.ui.webview.WebViewActivity
|
||||
import eu.kanade.tachiyomi.util.chapter.getNextUnread
|
||||
import eu.kanade.tachiyomi.util.lang.launchUI
|
||||
import eu.kanade.tachiyomi.util.lang.withNonCancellableContext
|
||||
import eu.kanade.tachiyomi.util.system.copyToClipboard
|
||||
import eu.kanade.tachiyomi.util.system.toShareIntent
|
||||
import eu.kanade.tachiyomi.util.system.toast
|
||||
import exh.md.similar.MangaDexSimilarController
|
||||
@ -152,6 +153,7 @@ class MangaScreen(
|
||||
}
|
||||
}.takeIf { isHttpSource },
|
||||
// SY <--
|
||||
onWebViewLongClicked = { copyMangaUrl(context, screenModel.manga, screenModel.source) }.takeIf { isHttpSource },
|
||||
onTrackingClicked = screenModel::showTrackDialog.takeIf { successState.trackingAvailable },
|
||||
onTagClicked = { performGenreSearch(router, it, screenModel.source!!) },
|
||||
onFilterButtonClicked = screenModel::showSettingsDialog,
|
||||
@ -433,6 +435,16 @@ class MangaScreen(
|
||||
// SY <--
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
}
|
||||
|
||||
// SY -->
|
||||
private fun openMetadataViewer(router: Router, manga: Manga) {
|
||||
router.pushController(MetadataViewController(manga))
|
||||
|
Loading…
x
Reference in New Issue
Block a user