mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-14 16:45:06 +01:00
More ui fixes to recents, bottom nav padding
This commit is contained in:
parent
7d9c77f021
commit
dc0435c363
@ -13,6 +13,7 @@ import eu.kanade.tachiyomi.data.download.model.Download
|
|||||||
import eu.kanade.tachiyomi.databinding.DownloadBottomSheetBinding
|
import eu.kanade.tachiyomi.databinding.DownloadBottomSheetBinding
|
||||||
import eu.kanade.tachiyomi.ui.extension.ExtensionDividerItemDecoration
|
import eu.kanade.tachiyomi.ui.extension.ExtensionDividerItemDecoration
|
||||||
import eu.kanade.tachiyomi.ui.recents.RecentsController
|
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.collapse
|
||||||
import eu.kanade.tachiyomi.util.view.doOnApplyWindowInsets
|
import eu.kanade.tachiyomi.util.view.doOnApplyWindowInsets
|
||||||
import eu.kanade.tachiyomi.util.view.expand
|
import eu.kanade.tachiyomi.util.view.expand
|
||||||
@ -72,7 +73,9 @@ class DownloadBottomSheet @JvmOverloads constructor(
|
|||||||
array.recycle()
|
array.recycle()
|
||||||
binding.recyclerLayout.doOnApplyWindowInsets { v, windowInsets, _ ->
|
binding.recyclerLayout.doOnApplyWindowInsets { v, windowInsets, _ ->
|
||||||
v.updateLayoutParams<MarginLayoutParams> {
|
v.updateLayoutParams<MarginLayoutParams> {
|
||||||
topMargin = windowInsets.systemWindowInsetTop + headerHeight - binding.sheetLayout.height
|
topMargin = windowInsets.systemWindowInsetTop +
|
||||||
|
(controller.activityBinding?.toolbar?.height ?: headerHeight) -
|
||||||
|
binding.sheetLayout.height
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
binding.sheetLayout.setOnClickListener {
|
binding.sheetLayout.setOnClickListener {
|
||||||
|
@ -806,6 +806,7 @@ class LibraryController(
|
|||||||
override fun onActivityResumed(activity: Activity) {
|
override fun onActivityResumed(activity: Activity) {
|
||||||
super.onActivityResumed(activity)
|
super.onActivityResumed(activity)
|
||||||
if (view == null) return
|
if (view == null) return
|
||||||
|
updateFilterSheetY()
|
||||||
if (observeLater && ::presenter.isInitialized) {
|
if (observeLater && ::presenter.isInitialized) {
|
||||||
presenter.getLibrary()
|
presenter.getLibrary()
|
||||||
}
|
}
|
||||||
|
@ -109,6 +109,7 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
|
|||||||
|
|
||||||
private val updateChecker by lazy { UpdateChecker.getUpdateChecker() }
|
private val updateChecker by lazy { UpdateChecker.getUpdateChecker() }
|
||||||
private val isUpdaterEnabled = BuildConfig.INCLUDE_UPDATER
|
private val isUpdaterEnabled = BuildConfig.INCLUDE_UPDATER
|
||||||
|
var tabAnimation: ValueAnimator? = null
|
||||||
|
|
||||||
fun setUndoSnackBar(snackBar: Snackbar?, extraViewToCheck: View? = null) {
|
fun setUndoSnackBar(snackBar: Snackbar?, extraViewToCheck: View? = null) {
|
||||||
this.snackBar = snackBar
|
this.snackBar = snackBar
|
||||||
@ -669,19 +670,20 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun showTabBar(show: Boolean, animate: Boolean = true) {
|
fun showTabBar(show: Boolean, animate: Boolean = true) {
|
||||||
|
tabAnimation?.cancel()
|
||||||
if (animate) {
|
if (animate) {
|
||||||
if (show && !binding.tabsFrameLayout.isVisible) {
|
if (show && !binding.tabsFrameLayout.isVisible) {
|
||||||
binding.tabsFrameLayout.alpha = 0f
|
binding.tabsFrameLayout.alpha = 0f
|
||||||
binding.tabsFrameLayout.isVisible = true
|
binding.tabsFrameLayout.isVisible = true
|
||||||
}
|
}
|
||||||
val alphaAnimation = ValueAnimator.ofFloat(
|
tabAnimation = ValueAnimator.ofFloat(
|
||||||
binding.tabsFrameLayout.alpha,
|
binding.tabsFrameLayout.alpha,
|
||||||
if (show) 1f else 0f
|
if (show) 1f else 0f
|
||||||
)
|
)
|
||||||
alphaAnimation.addUpdateListener { valueAnimator ->
|
tabAnimation?.addUpdateListener { valueAnimator ->
|
||||||
binding.tabsFrameLayout.alpha = valueAnimator.animatedValue as Float
|
binding.tabsFrameLayout.alpha = valueAnimator.animatedValue as Float
|
||||||
}
|
}
|
||||||
alphaAnimation.addListener(
|
tabAnimation?.addListener(
|
||||||
EndAnimatorListener {
|
EndAnimatorListener {
|
||||||
binding.tabsFrameLayout.isVisible = show
|
binding.tabsFrameLayout.isVisible = show
|
||||||
if (!show) {
|
if (!show) {
|
||||||
@ -690,8 +692,8 @@ open class MainActivity : BaseActivity<MainActivityBinding>(), DownloadServiceLi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
alphaAnimation.duration = 200
|
tabAnimation?.duration = 200
|
||||||
alphaAnimation.start()
|
tabAnimation?.start()
|
||||||
} else {
|
} else {
|
||||||
binding.tabsFrameLayout.isVisible = show
|
binding.tabsFrameLayout.isVisible = show
|
||||||
}
|
}
|
||||||
|
@ -138,7 +138,7 @@ class RecentsController(bundle: Bundle? = null) :
|
|||||||
afterInsets = {
|
afterInsets = {
|
||||||
headerHeight = it.systemWindowInsetTop + appBarHeight + 48.dpToPx
|
headerHeight = it.systemWindowInsetTop + appBarHeight + 48.dpToPx
|
||||||
binding.fakeAppBar.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
binding.fakeAppBar.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||||
height = it.systemWindowInsetTop + appBarHeight
|
height = it.systemWindowInsetTop + (activityBinding?.toolbar?.height ?: appBarHeight)
|
||||||
}
|
}
|
||||||
binding.recycler.updatePaddingRelative(
|
binding.recycler.updatePaddingRelative(
|
||||||
bottom = activityBinding?.bottomNav?.height ?: 0
|
bottom = activityBinding?.bottomNav?.height ?: 0
|
||||||
@ -168,8 +168,13 @@ class RecentsController(bundle: Bundle? = null) :
|
|||||||
binding.downloadBottomSheet.dlRecycler.updatePaddingRelative(
|
binding.downloadBottomSheet.dlRecycler.updatePaddingRelative(
|
||||||
bottom = activityBinding?.bottomNav?.height ?: 0
|
bottom = activityBinding?.bottomNav?.height ?: 0
|
||||||
)
|
)
|
||||||
activityBinding?.tabsFrameLayout?.isVisible =
|
val isExpanded = binding.downloadBottomSheet.root.sheetBehavior.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 =
|
binding.fakeAppBar.alpha =
|
||||||
if (binding.downloadBottomSheet.root.sheetBehavior.isExpanded()) 1f else 0f
|
if (binding.downloadBottomSheet.root.sheetBehavior.isExpanded()) 1f else 0f
|
||||||
}
|
}
|
||||||
@ -340,6 +345,7 @@ class RecentsController(bundle: Bundle? = null) :
|
|||||||
super.onActivityResumed(activity)
|
super.onActivityResumed(activity)
|
||||||
if (view != null) {
|
if (view != null) {
|
||||||
refresh()
|
refresh()
|
||||||
|
setBottomPadding()
|
||||||
binding.downloadBottomSheet.dlBottomSheet.update()
|
binding.downloadBottomSheet.dlBottomSheet.update()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user