Anchored library snackbars above the category hopper

This commit is contained in:
Jay 2020-05-06 23:18:21 -04:00
parent 3529681f90
commit d38bb54d83

View File

@ -525,7 +525,8 @@ class LibraryController(
val view = view ?: return val view = view ?: return
LibraryUpdateService.start(view.context, category) LibraryUpdateService.start(view.context, category)
snack = view.snack(R.string.updating_library) { snack = view.snack(R.string.updating_library) {
anchorView = filter_bottom_sheet anchorView = category_hopper_frame
view.elevation = 15f.dpToPx
setAction(R.string.cancel) { setAction(R.string.cancel) {
LibraryUpdateService.stop(context) LibraryUpdateService.stop(context)
Handler().post { NotificationReceiver.dismissNotification(context, Notifications.ID_LIBRARY_PROGRESS) } Handler().post { NotificationReceiver.dismissNotification(context, Notifications.ID_LIBRARY_PROGRESS) }
@ -968,7 +969,8 @@ class LibraryController(
if (presenter.mangaIsInCategory(item.manga, newHeader?.category?.id)) { if (presenter.mangaIsInCategory(item.manga, newHeader?.category?.id)) {
adapter.moveItem(position, lastItemPosition!!) adapter.moveItem(position, lastItemPosition!!)
snack = view?.snack(R.string.already_in_category) { snack = view?.snack(R.string.already_in_category) {
anchorView = filter_bottom_sheet anchorView = category_hopper_frame
view.elevation = 15f.dpToPx
} }
return return
} }
@ -991,7 +993,8 @@ class LibraryController(
snack = view?.snack( snack = view?.snack(
resources!!.getString(R.string.moved_to_, category.name) resources!!.getString(R.string.moved_to_, category.name)
) { ) {
anchorView = filter_bottom_sheet anchorView = category_hopper_frame
view.elevation = 15f.dpToPx
setAction(R.string.undo) { setAction(R.string.undo) {
manga.category = category.id!! manga.category = category.id!!
presenter.moveMangaToCategory(manga, oldCatId, mangaIds) presenter.moveMangaToCategory(manga, oldCatId, mangaIds)
@ -1012,7 +1015,8 @@ class LibraryController(
}, category.name }, category.name
), Snackbar.LENGTH_LONG ), Snackbar.LENGTH_LONG
) { ) {
anchorView = filter_bottom_sheet anchorView = category_hopper_frame
view.elevation = 15f.dpToPx
setAction(R.string.cancel) { setAction(R.string.cancel) {
LibraryUpdateService.stop(context) LibraryUpdateService.stop(context)
Handler().post { NotificationReceiver.dismissNotification(context, Notifications.ID_LIBRARY_PROGRESS) } Handler().post { NotificationReceiver.dismissNotification(context, Notifications.ID_LIBRARY_PROGRESS) }
@ -1187,7 +1191,8 @@ class LibraryController(
snack = view?.snack( snack = view?.snack(
activity?.getString(R.string.removed_from_library) ?: "", Snackbar.LENGTH_INDEFINITE activity?.getString(R.string.removed_from_library) ?: "", Snackbar.LENGTH_INDEFINITE
) { ) {
anchorView = filter_bottom_sheet anchorView = category_hopper_frame
view.elevation = 15f.dpToPx
var undoing = false var undoing = false
setAction(R.string.undo) { setAction(R.string.undo) {
presenter.reAddMangas(mangas) presenter.reAddMangas(mangas)