From 879dacfba6c681d45287596c34395ee8db0a217e Mon Sep 17 00:00:00 2001 From: arkon Date: Wed, 26 Jan 2022 23:00:43 -0500 Subject: [PATCH] Copy source ID to clipboard when long pressing source in migrate list (closes #6479) --- .../migration/sources/MigrationSourcesController.kt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrationSourcesController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrationSourcesController.kt index 166fb22a61..81adb4aec7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrationSourcesController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/sources/MigrationSourcesController.kt @@ -14,12 +14,14 @@ import eu.kanade.tachiyomi.databinding.MigrationSourcesControllerBinding import eu.kanade.tachiyomi.ui.base.controller.NucleusController import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.browse.migration.manga.MigrationMangaController +import eu.kanade.tachiyomi.util.system.copyToClipboard import eu.kanade.tachiyomi.util.system.openInBrowser import uy.kohesive.injekt.injectLazy class MigrationSourcesController : NucleusController(), - FlexibleAdapter.OnItemClickListener { + FlexibleAdapter.OnItemClickListener, + FlexibleAdapter.OnItemLongClickListener { private val preferences: PreferencesHelper by injectLazy() @@ -103,6 +105,12 @@ class MigrationSourcesController : return false } + override fun onItemLongClick(position: Int) { + val item = adapter?.getItem(position) as? SourceItem ?: return + val sourceId = item.source.id.toString() + activity?.copyToClipboard(sourceId, sourceId) + } + enum class DirectionSetting { ASCENDING, DESCENDING;