Another fix for mass migration

Also fixing some deprecated code
This commit is contained in:
Jay 2020-01-04 23:21:10 -08:00
parent 332e8c9487
commit 2535ea92eb
4 changed files with 20 additions and 15 deletions

View File

@ -163,9 +163,12 @@ class MigrationListController(bundle: Bundle? = null) : BaseController(bundle),
val localManga = smartSearchEngine.networkToLocalManga(searchResult, source.id)
val chapters = source.fetchChapterList(localManga).toSingle().await(
Schedulers.io())
withContext(Dispatchers.IO) {
try {
syncChaptersWithSource(db, chapters, localManga, source)
}
catch (e: Exception) {
return@async null
}
manga.progress.send(validSources.size to processedSources.incrementAndGet())
localManga to chapters.size
} else {
@ -260,8 +263,10 @@ class MigrationListController(bundle: Bundle? = null) : BaseController(bundle),
}
override fun noMigration() {
activity?.toast(R.string.no_migrations)
router.popCurrentController()
launchUI {
activity?.toast(R.string.no_migrations)
router.popCurrentController()
}
}
override fun onMenuItemClick(position: Int, item: MenuItem) {

View File

@ -41,7 +41,7 @@ class MigrationProcessAdapter(
}
fun sourceFinished() {
if (mangasSkipped() == itemCount || itemCount == 0) menuItemListener.noMigration()
if (itemCount == 0) menuItemListener.noMigration()
if (allMangasDone()) menuItemListener.enableButtons()
}

View File

@ -9,11 +9,11 @@
<TextView
android:id="@+id/title"
style="@style/TextAppearance.Regular.SubHeading"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/material_component_text_fields_padding_above_and_below_label"
app:layout_constraintBottom_toTopOf="@+id/source_card"
app:layout_constraintHeight_default="wrap"
app:layout_constrainedHeight="true"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="Title" />
@ -22,11 +22,11 @@
android:id="@+id/source_card"
style="@style/Theme.Widget.CardView.Item"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_height="wrap_content"
android:minHeight="144dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHeight_default="wrap"
app:layout_constrainedHeight="true"
app:layout_constraintStart_toStartOf="parent">
<ProgressBar

View File

@ -15,11 +15,11 @@
<ProgressBar
android:id="@+id/progress"
style="?android:attr/progressBarStyleSmall"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:visibility="gone"
app:layout_constraintHeight_default="wrap"
app:layout_constraintWidth_default="wrap"
app:layout_constrainedHeight="true"
app:layout_constrainedWidth="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@ -41,12 +41,12 @@
android:id="@+id/tvTitle"
style="@style/TextAppearance.Regular.Caption"
android:layout_width="104dp"
android:layout_height="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="0dp"
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
app:layout_constraintHeight_default="wrap"
app:layout_constrainedHeight="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/itemImage"