More ui fixes to recents, bottom nav padding

This commit is contained in:
Jays2Kings 2021-04-11 13:00:30 -04:00
parent 7d9c77f021
commit dc0435c363
4 changed files with 21 additions and 9 deletions

View File

@ -13,6 +13,7 @@ import eu.kanade.tachiyomi.data.download.model.Download
import eu.kanade.tachiyomi.databinding.DownloadBottomSheetBinding
import eu.kanade.tachiyomi.ui.extension.ExtensionDividerItemDecoration
import eu.kanade.tachiyomi.ui.recents.RecentsController
import eu.kanade.tachiyomi.util.view.activityBinding
import eu.kanade.tachiyomi.util.view.collapse
import eu.kanade.tachiyomi.util.view.doOnApplyWindowInsets
import eu.kanade.tachiyomi.util.view.expand
@ -72,7 +73,9 @@ class DownloadBottomSheet @JvmOverloads constructor(
array.recycle()
binding.recyclerLayout.doOnApplyWindowInsets { v, windowInsets, _ ->
v.updateLayoutParams<MarginLayoutParams> {
topMargin = windowInsets.systemWindowInsetTop + headerHeight - binding.sheetLayout.height
topMargin = windowInsets.systemWindowInsetTop +
(controller.activityBinding?.toolbar?.height ?: headerHeight) -
binding.sheetLayout.height
}
}
binding.sheetLayout.setOnClickListener {

View File

@ -806,6 +806,7 @@ class LibraryController(
override fun onActivityResumed(activity: Activity) {
super.onActivityResumed(activity)
if (view == null) return
updateFilterSheetY()
if (observeLater && ::presenter.isInitialized) {
presenter.getLibrary()
}

View File

@ -109,6 +109,7 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
private val updateChecker by lazy { UpdateChecker.getUpdateChecker() }
private val isUpdaterEnabled = BuildConfig.INCLUDE_UPDATER
var tabAnimation: ValueAnimator? = null
fun setUndoSnackBar(snackBar: Snackbar?, extraViewToCheck: View? = null) {
this.snackBar = snackBar
@ -669,19 +670,20 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
}
fun showTabBar(show: Boolean, animate: Boolean = true) {
tabAnimation?.cancel()
if (animate) {
if (show && !binding.tabsFrameLayout.isVisible) {
binding.tabsFrameLayout.alpha = 0f
binding.tabsFrameLayout.isVisible = true
}
val alphaAnimation = ValueAnimator.ofFloat(
tabAnimation = ValueAnimator.ofFloat(
binding.tabsFrameLayout.alpha,
if (show) 1f else 0f
)
alphaAnimation.addUpdateListener { valueAnimator ->
tabAnimation?.addUpdateListener { valueAnimator ->
binding.tabsFrameLayout.alpha = valueAnimator.animatedValue as Float
}
alphaAnimation.addListener(
tabAnimation?.addListener(
EndAnimatorListener {
binding.tabsFrameLayout.isVisible = show
if (!show) {
@ -690,8 +692,8 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
}
}
)
alphaAnimation.duration = 200
alphaAnimation.start()
tabAnimation?.duration = 200
tabAnimation?.start()
} else {
binding.tabsFrameLayout.isVisible = show
}

View File

@ -138,7 +138,7 @@ class RecentsController(bundle: Bundle? = null) :
afterInsets = {
headerHeight = it.systemWindowInsetTop + appBarHeight + 48.dpToPx
binding.fakeAppBar.updateLayoutParams<ViewGroup.MarginLayoutParams> {
height = it.systemWindowInsetTop + appBarHeight
height = it.systemWindowInsetTop + (activityBinding?.toolbar?.height ?: appBarHeight)
}
binding.recycler.updatePaddingRelative(
bottom = activityBinding?.bottomNav?.height ?: 0
@ -168,8 +168,13 @@ class RecentsController(bundle: Bundle? = null) :
binding.downloadBottomSheet.dlRecycler.updatePaddingRelative(
bottom = activityBinding?.bottomNav?.height ?: 0
)
activityBinding?.tabsFrameLayout?.isVisible =
!binding.downloadBottomSheet.root.sheetBehavior.isExpanded()
val isExpanded = binding.downloadBottomSheet.root.sheetBehavior.isExpanded()
activityBinding?.tabsFrameLayout?.isVisible = !isExpanded
if (isExpanded) {
(activity as? MainActivity)?.showTabBar(show = false, animate = false)
}
binding.shadow2.alpha = if (!isExpanded) 0.25f else 0f
binding.shadow.alpha = if (!isExpanded) 0.5f else 0f
binding.fakeAppBar.alpha =
if (binding.downloadBottomSheet.root.sheetBehavior.isExpanded()) 1f else 0f
}
@ -340,6 +345,7 @@ class RecentsController(bundle: Bundle? = null) :
super.onActivityResumed(activity)
if (view != null) {
refresh()
setBottomPadding()
binding.downloadBottomSheet.dlBottomSheet.update()
}
}