From 060f0682f49bd20b95d77bf091d34e4073308d58 Mon Sep 17 00:00:00 2001 From: arkon Date: Mon, 3 Aug 2020 14:12:34 -0400 Subject: [PATCH] Fix snackbars not being in viewport properly --- .../ui/browse/source/browse/BrowseSourceController.kt | 3 ++- app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt | 2 -- .../main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceController.kt index 35e4f6087..118d9106f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/browse/BrowseSourceController.kt @@ -46,6 +46,7 @@ import eu.kanade.tachiyomi.util.view.shrinkOnScroll import eu.kanade.tachiyomi.util.view.snack import eu.kanade.tachiyomi.widget.AutofitRecyclerView import eu.kanade.tachiyomi.widget.EmptyView +import kotlinx.android.synthetic.main.main_activity.root_coordinator import kotlinx.coroutines.Job import kotlinx.coroutines.flow.drop import kotlinx.coroutines.flow.filter @@ -403,7 +404,7 @@ open class BrowseSourceController(bundle: Bundle) : binding.emptyView.show(message, actions) } else { - snack = binding.catalogueView.snack(message, Snackbar.LENGTH_INDEFINITE) { + snack = activity!!.root_coordinator?.snack(message, Snackbar.LENGTH_INDEFINITE) { setAction(R.string.action_retry, retryAction) } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt index ac70fd03b..53559dd39 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/main/MainActivity.kt @@ -152,8 +152,6 @@ class MainActivity : BaseActivity() { if (Migrations.upgrade(preferences) && !BuildConfig.DEBUG) { WhatsNewDialogController().showDialog(router) } - - WhatsNewDialogController().showDialog(router) } preferences.extensionUpdatesCount() diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt index 6458e6b17..e62fd0821 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaController.kt @@ -891,7 +891,7 @@ class MangaController : val manga = presenter.manga presenter.downloadChapters(chapters) if (view != null && !manga.favorite) { - binding.recycler.snack(view.context.getString(R.string.snack_add_to_library), Snackbar.LENGTH_INDEFINITE) { + activity!!.root_coordinator?.snack(view.context.getString(R.string.snack_add_to_library), Snackbar.LENGTH_INDEFINITE) { setAction(R.string.action_add) { addToLibrary(manga) }