mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-05 01:35:10 +01:00
Insets for snackbar
This commit is contained in:
parent
71bf9dc828
commit
b94da6b3ed
@ -210,7 +210,9 @@ open class BrowseCatalogueController(bundle: Bundle) :
|
||||
recycler.adapter = adapter
|
||||
|
||||
catalogue_view.addView(recycler, 1)
|
||||
|
||||
recycler.doOnApplyWindowInsets { v, insets, padding ->
|
||||
v.updatePaddingRelative(bottom = padding.bottom + insets.systemWindowInsetBottom)
|
||||
}
|
||||
if (oldPosition != RecyclerView.NO_POSITION) {
|
||||
recycler.layoutManager?.scrollToPosition(oldPosition)
|
||||
}
|
||||
@ -367,6 +369,9 @@ open class BrowseCatalogueController(bundle: Bundle) :
|
||||
presenter.requestNext()
|
||||
}
|
||||
}
|
||||
snack?.view?.doOnApplyWindowInsets { v, _, padding ->
|
||||
v.setPadding(padding.left,0,padding.right,0)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -33,11 +33,13 @@ import eu.kanade.tachiyomi.ui.base.controller.withFadeTransaction
|
||||
import eu.kanade.tachiyomi.ui.category.CategoryController
|
||||
import eu.kanade.tachiyomi.ui.main.MainActivity
|
||||
import eu.kanade.tachiyomi.ui.main.doOnApplyWindowInsets
|
||||
import eu.kanade.tachiyomi.ui.main.marginBottom
|
||||
import eu.kanade.tachiyomi.ui.main.updateLayoutParams
|
||||
import eu.kanade.tachiyomi.ui.main.updatePaddingRelative
|
||||
import eu.kanade.tachiyomi.ui.manga.MangaController
|
||||
import eu.kanade.tachiyomi.ui.migration.MigrationController
|
||||
import eu.kanade.tachiyomi.util.inflate
|
||||
import eu.kanade.tachiyomi.util.marginTop
|
||||
import eu.kanade.tachiyomi.util.toast
|
||||
import kotlinx.android.synthetic.main.chapters_controller.*
|
||||
import kotlinx.android.synthetic.main.library_controller.*
|
||||
@ -200,8 +202,8 @@ class LibraryController(
|
||||
statusScrim.setOnApplyWindowInsetsListener(HeightTopWindowInsetsListener)
|
||||
view.doOnApplyWindowInsets { v, insets, padding ->
|
||||
view.recycler.updatePaddingRelative(
|
||||
bottom = view.recycler.bottom + insets.systemWindowInsetBottom,
|
||||
top = view.recycler.top + insets.systemWindowInsetTop
|
||||
bottom = view.recycler.marginBottom + insets.systemWindowInsetBottom,
|
||||
top = view.recycler.marginTop + insets.systemWindowInsetTop
|
||||
)
|
||||
}
|
||||
return view
|
||||
|
@ -381,11 +381,15 @@ class ChaptersController : NucleusController<ChaptersPresenter>(),
|
||||
destroyActionModeIfNeeded()
|
||||
presenter.downloadChapters(chapters)
|
||||
if (view != null && !presenter.manga.favorite) {
|
||||
recycler?.snack(view.context.getString(R.string.snack_add_to_library), Snackbar.LENGTH_INDEFINITE) {
|
||||
val snack = view.snack(view.context.getString(R.string.snack_add_to_library), Snackbar
|
||||
.LENGTH_INDEFINITE) {
|
||||
setAction(R.string.action_add) {
|
||||
presenter.addToLibrary()
|
||||
}
|
||||
}
|
||||
snack.view.doOnApplyWindowInsets { v, _, padding ->
|
||||
v.setPadding(padding.left,0,padding.right,0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,3 +94,6 @@ fun View.getRound(text: String, random : Boolean = true): TextDrawable {
|
||||
.endConfig()
|
||||
.buildRound(text, if (random) ColorGenerator.MATERIAL.randomColor else ColorGenerator.MATERIAL.getColor(text))
|
||||
}
|
||||
|
||||
inline val View.marginTop: Int
|
||||
get() = (layoutParams as? ViewGroup.MarginLayoutParams)?.topMargin ?: 0
|
||||
|
Loading…
Reference in New Issue
Block a user