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 0000000000..f7ddb5882b Binary files /dev/null and b/app/src/main/res/drawable-hdpi/baseline_skip_next_white_24.png differ 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 0000000000..736df24407 Binary files /dev/null and b/app/src/main/res/drawable-mdpi/baseline_skip_next_white_24.png differ 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 0000000000..203e6369a3 Binary files /dev/null and b/app/src/main/res/drawable-xhdpi/baseline_skip_next_white_24.png differ 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 0000000000..a0fd4505a8 Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/baseline_skip_next_white_24.png differ 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 0000000000..01c0fbd27f Binary files /dev/null and b/app/src/main/res/drawable-xxxhdpi/baseline_skip_next_white_24.png differ 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