Copy source ID to clipboard when long pressing source in migrate list (closes #6479)

This commit is contained in:
arkon 2022-01-26 23:00:43 -05:00
parent b459234ddc
commit 879dacfba6

View File

@ -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.NucleusController
import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
import eu.kanade.tachiyomi.ui.browse.migration.manga.MigrationMangaController import eu.kanade.tachiyomi.ui.browse.migration.manga.MigrationMangaController
import eu.kanade.tachiyomi.util.system.copyToClipboard
import eu.kanade.tachiyomi.util.system.openInBrowser import eu.kanade.tachiyomi.util.system.openInBrowser
import uy.kohesive.injekt.injectLazy import uy.kohesive.injekt.injectLazy
class MigrationSourcesController : class MigrationSourcesController :
NucleusController<MigrationSourcesControllerBinding, MigrationSourcesPresenter>(), NucleusController<MigrationSourcesControllerBinding, MigrationSourcesPresenter>(),
FlexibleAdapter.OnItemClickListener { FlexibleAdapter.OnItemClickListener,
FlexibleAdapter.OnItemLongClickListener {
private val preferences: PreferencesHelper by injectLazy() private val preferences: PreferencesHelper by injectLazy()
@ -103,6 +105,12 @@ class MigrationSourcesController :
return false 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 { enum class DirectionSetting {
ASCENDING, ASCENDING,
DESCENDING; DESCENDING;