Skip manga button added to multi integration
This commit is contained in:
parent
ffd1f950d8
commit
4c5fc25a68
@ -49,7 +49,7 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att
|
|||||||
/**
|
/**
|
||||||
* Recycler view of the list of manga.
|
* 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.
|
* Adapter to hold the manga in this category.
|
||||||
@ -82,8 +82,8 @@ class LibraryCategoryView @JvmOverloads constructor(context: Context, attrs: Att
|
|||||||
recycler.adapter = adapter
|
recycler.adapter = adapter
|
||||||
swipe_refresh.addView(recycler)
|
swipe_refresh.addView(recycler)
|
||||||
|
|
||||||
recycler.addOnScrollListener(object : androidx.recyclerview.widget.RecyclerView.OnScrollListener() {
|
recycler.addOnScrollListener(object : RecyclerView.OnScrollListener() {
|
||||||
override fun onScrollStateChanged(recycler: androidx.recyclerview.widget.RecyclerView, newState: Int) {
|
override fun onScrollStateChanged(recycler: RecyclerView, newState: Int) {
|
||||||
// Disable swipe refresh when view is not at the top
|
// Disable swipe refresh when view is not at the top
|
||||||
val firstPos = (recycler.layoutManager as androidx.recyclerview.widget.LinearLayoutManager)
|
val firstPos = (recycler.layoutManager as androidx.recyclerview.widget.LinearLayoutManager)
|
||||||
.findFirstCompletelyVisibleItemPosition()
|
.findFirstCompletelyVisibleItemPosition()
|
||||||
|
@ -476,7 +476,9 @@ class LibraryController(
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun migrateManga(prevManga: Manga, manga: Manga, replace: Boolean): Manga? {
|
override fun migrateManga(prevManga: Manga, manga: Manga, replace: Boolean): Manga? {
|
||||||
|
if (manga.id != prevManga.id) {
|
||||||
presenter.migrateManga(prevManga, manga, replace = replace)
|
presenter.migrateManga(prevManga, manga, replace = replace)
|
||||||
|
}
|
||||||
val nextManga = migratingMangas.firstOrNull() ?: return null
|
val nextManga = migratingMangas.firstOrNull() ?: return null
|
||||||
migratingMangas.remove(nextManga)
|
migratingMangas.remove(nextManga)
|
||||||
return nextManga
|
return nextManga
|
||||||
|
@ -2,6 +2,10 @@ package eu.kanade.tachiyomi.ui.migration
|
|||||||
|
|
||||||
import android.app.Dialog
|
import android.app.Dialog
|
||||||
import android.os.Bundle
|
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 com.afollestad.materialdialogs.MaterialDialog
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||||
@ -45,6 +49,25 @@ class SearchController(
|
|||||||
newManga = savedInstanceState.getSerializable(::newManga.name) as? Manga
|
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() {
|
fun migrateManga() {
|
||||||
val target = targetController as? MigrationInterface ?: return
|
val target = targetController as? MigrationInterface ?: return
|
||||||
val manga = manga ?: return
|
val manga = manga ?: return
|
||||||
@ -65,7 +88,7 @@ class SearchController(
|
|||||||
|
|
||||||
private fun replaceWithNewSearchController(manga: Manga?) {
|
private fun replaceWithNewSearchController(manga: Manga?) {
|
||||||
if (manga != null) {
|
if (manga != null) {
|
||||||
router.popCurrentController()
|
//router.popCurrentController()
|
||||||
val searchController = SearchController(manga)
|
val searchController = SearchController(manga)
|
||||||
searchController.targetController = targetController
|
searchController.targetController = targetController
|
||||||
searchController.progress = progress + 1
|
searchController.progress = progress + 1
|
||||||
@ -99,14 +122,13 @@ class SearchController(
|
|||||||
.content(R.string.migration_dialog_what_to_include)
|
.content(R.string.migration_dialog_what_to_include)
|
||||||
.items(MigrationFlags.titles.map { resources?.getString(it) })
|
.items(MigrationFlags.titles.map { resources?.getString(it) })
|
||||||
.alwaysCallMultiChoiceCallback()
|
.alwaysCallMultiChoiceCallback()
|
||||||
.itemsCallbackMultiChoice(preselected.toTypedArray(), { _, positions, _ ->
|
.itemsCallbackMultiChoice(preselected.toTypedArray()) { _, positions, _ ->
|
||||||
// Save current settings for the next time
|
// Save current settings for the next time
|
||||||
val newValue = MigrationFlags.getFlagsFromPositions(positions)
|
val newValue = MigrationFlags.getFlagsFromPositions(positions)
|
||||||
preferences.migrateFlags().set(newValue)
|
preferences.migrateFlags().set(newValue)
|
||||||
|
|
||||||
true
|
true
|
||||||
})
|
}.positiveText(R.string.migrate)
|
||||||
.positiveText(R.string.migrate)
|
|
||||||
.negativeText(R.string.copy)
|
.negativeText(R.string.copy)
|
||||||
.neutralText(android.R.string.cancel)
|
.neutralText(android.R.string.cancel)
|
||||||
.onPositive { _, _ ->
|
.onPositive { _, _ ->
|
||||||
|
BIN
app/src/main/res/drawable-hdpi/baseline_skip_next_white_24.png
Normal file
BIN
app/src/main/res/drawable-hdpi/baseline_skip_next_white_24.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 177 B |
BIN
app/src/main/res/drawable-mdpi/baseline_skip_next_white_24.png
Normal file
BIN
app/src/main/res/drawable-mdpi/baseline_skip_next_white_24.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 138 B |
BIN
app/src/main/res/drawable-xhdpi/baseline_skip_next_white_24.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/baseline_skip_next_white_24.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 213 B |
BIN
app/src/main/res/drawable-xxhdpi/baseline_skip_next_white_24.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/baseline_skip_next_white_24.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 270 B |
Binary file not shown.
After Width: | Height: | Size: 333 B |
10
app/src/main/res/drawable/baseline_skip_next_24.xml
Normal file
10
app/src/main/res/drawable/baseline_skip_next_24.xml
Normal 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>
|
@ -42,6 +42,7 @@
|
|||||||
<string name="action_sort_last_read">Last read</string>
|
<string name="action_sort_last_read">Last read</string>
|
||||||
<string name="action_sort_last_updated">Last updated</string>
|
<string name="action_sort_last_updated">Last updated</string>
|
||||||
<string name="action_search">Search</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_global_search">Global search</string>
|
||||||
<string name="action_select_all">Select all</string>
|
<string name="action_select_all">Select all</string>
|
||||||
<string name="action_mark_as_read">Mark as read</string>
|
<string name="action_mark_as_read">Mark as read</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user