From cd9487f94cac610cdeb31dcd9139f6cc9dc7026c Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 23 Jul 2022 19:37:26 -0400 Subject: [PATCH] Set splash screen ready state for history and updates pages --- .../java/eu/kanade/presentation/history/HistoryScreen.kt | 6 ++++++ .../kanade/tachiyomi/ui/recent/updates/UpdatesController.kt | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/app/src/main/java/eu/kanade/presentation/history/HistoryScreen.kt b/app/src/main/java/eu/kanade/presentation/history/HistoryScreen.kt index aeeaba192b..84c4e21d04 100644 --- a/app/src/main/java/eu/kanade/presentation/history/HistoryScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/history/HistoryScreen.kt @@ -15,6 +15,7 @@ import eu.kanade.presentation.history.components.HistoryDeleteAllDialog import eu.kanade.presentation.history.components.HistoryDeleteDialog import eu.kanade.presentation.history.components.HistoryToolbar import eu.kanade.tachiyomi.R +import eu.kanade.tachiyomi.ui.main.MainActivity import eu.kanade.tachiyomi.ui.reader.ReaderActivity import eu.kanade.tachiyomi.ui.recent.history.HistoryPresenter import eu.kanade.tachiyomi.ui.recent.history.HistoryPresenter.Dialog @@ -47,6 +48,11 @@ fun HistoryScreen( onClickDelete = { presenter.dialog = Dialog.Delete(it) }, ) } + LaunchedEffect(items.loadState.refresh) { + if (items.loadState.refresh is LoadState.NotLoading) { + (presenter.view?.activity as? MainActivity)?.ready = true + } + } } val onDismissRequest = { presenter.dialog = null } when (val dialog = presenter.dialog) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesController.kt index bfb93c6c6d..17d8ee3a28 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/recent/updates/UpdatesController.kt @@ -4,6 +4,7 @@ import androidx.activity.OnBackPressedDispatcherOwner import androidx.appcompat.app.AlertDialog import androidx.compose.material3.Text import androidx.compose.runtime.Composable +import androidx.compose.runtime.LaunchedEffect import androidx.compose.runtime.collectAsState import androidx.compose.runtime.getValue import com.google.android.material.dialog.MaterialAlertDialogBuilder @@ -57,6 +58,11 @@ class UpdatesController : onMultiDeleteClicked = this::deleteChaptersWithConfirmation, ) } + LaunchedEffect(state) { + if (state !is UpdatesState.Loading) { + (activity as? MainActivity)?.ready = true + } + } } private fun updateLibrary() {