From dda7e677a5d0e42f6cedae4ecf0fe58a11cab9ad Mon Sep 17 00:00:00 2001 From: arkon Date: Thu, 6 Aug 2020 19:05:07 -0400 Subject: [PATCH] Dismiss add manga snackbar when leaving controller (closes #3614) --- .../eu/kanade/tachiyomi/ui/manga/MangaController.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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 e62fd0821..75647d5c1 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 @@ -130,14 +130,15 @@ class MangaController : private var chaptersHeaderAdapter: MangaChaptersHeaderAdapter? = null private var chaptersAdapter: ChaptersAdapter? = null - /** - * Sheet containing filter/sort/display items. - */ + // Sheet containing filter/sort/display items. private var settingsSheet: ChaptersSettingsSheet? = null private var actionFab: ExtendedFloatingActionButton? = null private var actionFabScrollListener: RecyclerView.OnScrollListener? = null + // Snackbar to add manga to library after downloading chapter(s) + private var addSnackbar: Snackbar? = null + /** * Action mode for multiple selection. */ @@ -316,6 +317,7 @@ class MangaController : chaptersHeaderAdapter = null chaptersAdapter = null settingsSheet = null + addSnackbar?.dismiss() updateToolbarTitleAlpha(255) super.onDestroyView(view) } @@ -891,7 +893,7 @@ class MangaController : val manga = presenter.manga presenter.downloadChapters(chapters) if (view != null && !manga.favorite) { - activity!!.root_coordinator?.snack(view.context.getString(R.string.snack_add_to_library), Snackbar.LENGTH_INDEFINITE) { + addSnackbar = activity!!.root_coordinator?.snack(view.context.getString(R.string.snack_add_to_library), Snackbar.LENGTH_INDEFINITE) { setAction(R.string.action_add) { addToLibrary(manga) }