From 6e4d4739a656551b349b728351b64437ad2e7ea7 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 16 May 2020 12:27:56 -0400 Subject: [PATCH] Add migrate option from manga info view (closes #1903) (doesnt actually do anything in SY) (cherry picked from commit 035038a0b659b76530aaefa15a354b2622cce5e0) # Conflicts: # app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt --- .../ui/manga/info/MangaInfoController.kt | 36 ++++++++++++++----- app/src/main/res/menu/manga_info.xml | 10 ++++++ app/src/main/res/values/strings.xml | 1 + 3 files changed, 39 insertions(+), 8 deletions(-) create mode 100644 app/src/main/res/menu/manga_info.xml diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt index 8947a92a8..71d621021 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/info/MangaInfoController.kt @@ -163,7 +163,10 @@ class MangaInfoController(private val fromSource: Boolean = false) : binding.mangaFullTitle.longClicks() .onEach { - activity?.copyToClipboard(view.context.getString(R.string.title), binding.mangaFullTitle.text.toString()) + activity?.copyToClipboard( + view.context.getString(R.string.title), + binding.mangaFullTitle.text.toString() + ) } .launchIn(scope) @@ -175,7 +178,10 @@ class MangaInfoController(private val fromSource: Boolean = false) : binding.mangaArtist.longClicks() .onEach { - activity?.copyToClipboard(binding.mangaArtistLabel.text.toString(), binding.mangaArtist.text.toString()) + activity?.copyToClipboard( + binding.mangaArtistLabel.text.toString(), + binding.mangaArtist.text.toString() + ) } .launchIn(scope) @@ -193,7 +199,10 @@ class MangaInfoController(private val fromSource: Boolean = false) : .onEach { // EXH Special case E-Hentai/ExHentai to ignore author field (unused) if (!isEHentaiBasedSource()) { - activity?.copyToClipboard(binding.mangaAuthor.text.toString(), binding.mangaAuthor.text.toString()) + activity?.copyToClipboard( + binding.mangaAuthor.text.toString(), + binding.mangaAuthor.text.toString() + ) } } .launchIn(scope) @@ -209,13 +218,19 @@ class MangaInfoController(private val fromSource: Boolean = false) : binding.mangaSummary.longClicks() .onEach { - activity?.copyToClipboard(view.context.getString(R.string.description), binding.mangaSummary.text.toString()) + activity?.copyToClipboard( + view.context.getString(R.string.description), + binding.mangaSummary.text.toString() + ) } .launchIn(scope) binding.mangaCover.longClicks() .onEach { - activity?.copyToClipboard(view.context.getString(R.string.title), presenter.manga.title) + activity?.copyToClipboard( + view.context.getString(R.string.title), + presenter.manga.title + ) } .launchIn(scope) @@ -437,7 +452,8 @@ class MangaInfoController(private val fromSource: Boolean = false) : } private fun toggleMangaInfo(context: Context) { - val isExpanded = binding.mangaInfoToggle.text == context.getString(R.string.manga_info_collapse) + val isExpanded = + binding.mangaInfoToggle.text == context.getString(R.string.manga_info_collapse) binding.mangaInfoToggle.text = if (isExpanded) { @@ -554,8 +570,12 @@ class MangaInfoController(private val fromSource: Boolean = false) : // Set the Favorite drawable to the correct one. // Border drawable if false, filled drawable if true. binding.btnFavorite.apply { - icon = ContextCompat.getDrawable(context, if (isFavorite) R.drawable.ic_favorite_24dp else R.drawable.ic_favorite_border_24dp) - text = context.getString(if (isFavorite) R.string.in_library else R.string.add_to_library) + icon = ContextCompat.getDrawable( + context, + if (isFavorite) R.drawable.ic_favorite_24dp else R.drawable.ic_favorite_border_24dp + ) + text = + context.getString(if (isFavorite) R.string.in_library else R.string.add_to_library) isChecked = isFavorite } } diff --git a/app/src/main/res/menu/manga_info.xml b/app/src/main/res/menu/manga_info.xml new file mode 100644 index 000000000..f77c19f4d --- /dev/null +++ b/app/src/main/res/menu/manga_info.xml @@ -0,0 +1,10 @@ + + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index ab3cb5b60..67ace19d3 100755 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -78,6 +78,7 @@ Move Open in browser Open in WebView + Migrate Display mode Display Grid