Skip manga button added to multi integration

This commit is contained in:
Jay 2019-11-24 18:30:47 -08:00
parent ffd1f950d8
commit 4c5fc25a68
10 changed files with 43 additions and 8 deletions

View File

@ -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()

View File

@ -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

View File

@ -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 { _, _ ->

Binary file not shown.

After

Width:  |  Height:  |  Size: 177 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 138 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 213 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 270 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 333 B

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M6,18l8.5,-6L6,6v12zM16,6v12h2V6h-2z"/>
</vector>

View File

@ -42,6 +42,7 @@
<string name="action_sort_last_read">Last read</string>
<string name="action_sort_last_updated">Last updated</string>
<string name="action_search">Search</string>
<string name="action_skip_manga">Skip manga</string>
<string name="action_global_search">Global search</string>
<string name="action_select_all">Select all</string>
<string name="action_mark_as_read">Mark as read</string>