From 4c5fc25a68b811b2a7e2dddb445024bed9cbf7b1 Mon Sep 17 00:00:00 2001 From: Jay Date: Sun, 24 Nov 2019 18:30:47 -0800 Subject: [PATCH] Skip manga button added to multi integration --- .../ui/library/LibraryCategoryView.kt | 6 ++-- .../tachiyomi/ui/library/LibraryController.kt | 4 ++- .../ui/migration/SearchController.kt | 30 +++++++++++++++--- .../baseline_skip_next_white_24.png | Bin 0 -> 177 bytes .../baseline_skip_next_white_24.png | Bin 0 -> 138 bytes .../baseline_skip_next_white_24.png | Bin 0 -> 213 bytes .../baseline_skip_next_white_24.png | Bin 0 -> 270 bytes .../baseline_skip_next_white_24.png | Bin 0 -> 333 bytes .../res/drawable/baseline_skip_next_24.xml | 10 ++++++ app/src/main/res/values/strings.xml | 1 + 10 files changed, 43 insertions(+), 8 deletions(-) create mode 100644 app/src/main/res/drawable-hdpi/baseline_skip_next_white_24.png create mode 100644 app/src/main/res/drawable-mdpi/baseline_skip_next_white_24.png create mode 100644 app/src/main/res/drawable-xhdpi/baseline_skip_next_white_24.png create mode 100644 app/src/main/res/drawable-xxhdpi/baseline_skip_next_white_24.png create mode 100644 app/src/main/res/drawable-xxxhdpi/baseline_skip_next_white_24.png create mode 100644 app/src/main/res/drawable/baseline_skip_next_24.xml diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryCategoryView.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryCategoryView.kt index 40e6677410..c8a51dbcdc 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryCategoryView.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryCategoryView.kt @@ -49,7 +49,7 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att /** * Recycler view of the list of manga. */ - private lateinit var recycler: androidx.recyclerview.widget.RecyclerView + private lateinit var recycler: RecyclerView /** * Adapter to hold the manga in this category. @@ -82,8 +82,8 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att recycler.adapter = adapter swipe_refresh.addView(recycler) - recycler.addOnScrollListener(object : androidx.recyclerview.widget.RecyclerView.OnScrollListener() { - override fun onScrollStateChanged(recycler: androidx.recyclerview.widget.RecyclerView, newState: Int) { + recycler.addOnScrollListener(object : RecyclerView.OnScrollListener() { + override fun onScrollStateChanged(recycler: RecyclerView, newState: Int) { // Disable swipe refresh when view is not at the top val firstPos = (recycler.layoutManager as androidx.recyclerview.widget.LinearLayoutManager) .findFirstCompletelyVisibleItemPosition() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt index 04bfa7354c..cd3af33433 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryController.kt @@ -476,7 +476,9 @@ class LibraryController( } override fun migrateManga(prevManga: Manga, manga: Manga, replace: Boolean): Manga? { - presenter.migrateManga(prevManga, manga, replace = replace) + if (manga.id != prevManga.id) { + presenter.migrateManga(prevManga, manga, replace = replace) + } val nextManga = migratingMangas.firstOrNull() ?: return null migratingMangas.remove(nextManga) return nextManga diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SearchController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SearchController.kt index 8db47740e7..8545922bed 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SearchController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SearchController.kt @@ -2,6 +2,10 @@ package eu.kanade.tachiyomi.ui.migration import android.app.Dialog import android.os.Bundle +import android.view.Menu +import android.view.MenuInflater +import android.view.MenuItem +import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat import com.afollestad.materialdialogs.MaterialDialog import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.database.models.Manga @@ -45,6 +49,25 @@ class SearchController( newManga = savedInstanceState.getSerializable(::newManga.name) as? Manga } + override fun onCreateOptionsMenu(menu: Menu, inflater: MenuInflater) { + if (totalProgress > 1) { + val menuItem = menu.add(Menu.NONE, 1, Menu.NONE, R.string.action_skip_manga) + menuItem.icon = VectorDrawableCompat.create(resources!!, R.drawable + .baseline_skip_next_white_24, null) + menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS) + } + } + + override fun onOptionsItemSelected(item: MenuItem): Boolean { + when (item.itemId) { + 1 -> { + newManga = manga + migrateManga() + } + } + return true + } + fun migrateManga() { val target = targetController as? MigrationInterface ?: return val manga = manga ?: return @@ -65,7 +88,7 @@ class SearchController( private fun replaceWithNewSearchController(manga: Manga?) { if (manga != null) { - router.popCurrentController() + //router.popCurrentController() val searchController = SearchController(manga) searchController.targetController = targetController searchController.progress = progress + 1 @@ -99,14 +122,13 @@ class SearchController( .content(R.string.migration_dialog_what_to_include) .items(MigrationFlags.titles.map { resources?.getString(it) }) .alwaysCallMultiChoiceCallback() - .itemsCallbackMultiChoice(preselected.toTypedArray(), { _, positions, _ -> + .itemsCallbackMultiChoice(preselected.toTypedArray()) { _, positions, _ -> // Save current settings for the next time val newValue = MigrationFlags.getFlagsFromPositions(positions) preferences.migrateFlags().set(newValue) true - }) - .positiveText(R.string.migrate) + }.positiveText(R.string.migrate) .negativeText(R.string.copy) .neutralText(android.R.string.cancel) .onPositive { _, _ -> diff --git a/app/src/main/res/drawable-hdpi/baseline_skip_next_white_24.png b/app/src/main/res/drawable-hdpi/baseline_skip_next_white_24.png new file mode 100644 index 0000000000000000000000000000000000000000..f7ddb5882b479b7b5cf195917f63c845f9048ca7 GIT binary patch literal 177 zcmeAS@N?(olHy`uVBq!ia0vp^Dj>|k0wldT1B8K8g{O;SNCjiE#FGS(o~HlW|2{vQ z$jYq3xW{Y$pY4m<92Gu%uRmTd=Ed98So}X!)0l&C-{12~t|+kF_!mFJs9E5_)p~v} zUZ;l4|CSm+$-KYUmriqRYd)5p|F1eg{nt@8-=;lZ;-^~8oK|{4L^)ei=LVZxPg5WR Z1EY9y;W62IeV`i{JYD@<);T3K0RS@OKi2>N literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-mdpi/baseline_skip_next_white_24.png b/app/src/main/res/drawable-mdpi/baseline_skip_next_white_24.png new file mode 100644 index 0000000000000000000000000000000000000000..736df244075ff90e50e5576b7efa4655e18b3b1f GIT binary patch literal 138 zcmeAS@N?(olHy`uVBq!ia0vp^5+KaM0wlfaz7_+iKu;IPkP60R1<{_S|JwgPCw4G0 zHnnU1e6n9uQ_A7N`~Q9ab&g~;G#394?Y!K;aQ|Pr&}v4;ZU4p9LYpPd&MA4hUn}$A lDX+~P(cQ|K6FA%$8D1@3l$BK|-VHRI!PC{xWt~$(69DH6G6w(v literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xhdpi/baseline_skip_next_white_24.png b/app/src/main/res/drawable-xhdpi/baseline_skip_next_white_24.png new file mode 100644 index 0000000000000000000000000000000000000000..203e6369a39190efa0eebb6bcc7419c35371dbf8 GIT binary patch literal 213 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA0wn)(8}b0DIi4<#Ar*{ouL<%v1&TC0yq48H zX`4!hLRfq6Tpc=K7ReJu89{!n;jl1fGN?;>rB)w}23-=4p_{QI2SKc8>XIW5Cu zEzk17_P|veu?MNk#W@c|igJJ0(#N{Mtc!I=wGzVL42;zee9Wijy~8?`sbzqw@3Ruf$pGA;F{bmNlz^`C^kn*rU) N;OXk;vd$@?2>`VfR0041 literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxhdpi/baseline_skip_next_white_24.png b/app/src/main/res/drawable-xxhdpi/baseline_skip_next_white_24.png new file mode 100644 index 0000000000000000000000000000000000000000..a0fd4505a838ca7a0fa0a1ddea751ba58b4b1491 GIT binary patch literal 270 zcmV+p0rCEcP)sMK^0zajjuwxGSg`iu`XONf5j8Ew*>5d)pa1{>07*qoM6N<$g846SJpcdz literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable-xxxhdpi/baseline_skip_next_white_24.png b/app/src/main/res/drawable-xxxhdpi/baseline_skip_next_white_24.png new file mode 100644 index 0000000000000000000000000000000000000000..01c0fbd27f151845dbd95a279c32151a1f98f129 GIT binary patch literal 333 zcmeAS@N?(olHy`uVBq!ia0vp^2_VeD0wg^q?%&M7z$oJB;uuoF`1Y1!hf|=0OJZbM z;^frC(`k>{R@=_-ZL+=5{Vj?An^MG?ZwaOnXVnZd3^|OFqzojd%y0bswdg?m=XbTd zK+}NWf#j^!H!BovE9x7z1gl#+?8;hn{z=2`tx+=>%dQ!i9+>v)B+rJuyH+xqT`f;* z$o)EBGC{oe%S6cp?Z2sPH$3-VVVJ#grtE{QBGOPSgM$XigXCl`JXa6-CeS}w{?Xc7 zeX|cuwftsUF wmL4|Ec08c=W6^Ez_I_I~radL6m>?c$kTz-Q`kpJZT@A$dboFyt=akR{08hq>_y7O^ literal 0 HcmV?d00001 diff --git a/app/src/main/res/drawable/baseline_skip_next_24.xml b/app/src/main/res/drawable/baseline_skip_next_24.xml new file mode 100644 index 0000000000..4f860dba29 --- /dev/null +++ b/app/src/main/res/drawable/baseline_skip_next_24.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index f7d259bd40..72fd2e9ed1 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -42,6 +42,7 @@ Last read Last updated Search + Skip manga Global search Select all Mark as read