Fix insets in landscape for browse and recents
This commit is contained in:
parent
000be36722
commit
ef166dd712
@ -10,6 +10,7 @@ import android.view.MenuInflater
|
|||||||
import android.view.MenuItem
|
import android.view.MenuItem
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.view.WindowInsets
|
||||||
import androidx.appcompat.widget.SearchView
|
import androidx.appcompat.widget.SearchView
|
||||||
import androidx.core.graphics.ColorUtils
|
import androidx.core.graphics.ColorUtils
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
@ -402,6 +403,7 @@ class RecentsController(bundle: Bundle? = null) :
|
|||||||
binding.downloadBottomSheet.downloadFab.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
binding.downloadBottomSheet.downloadFab.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
||||||
bottomMargin = max(-pad.toInt(), view?.rootWindowInsets?.systemWindowInsetBottom ?: 0) + 16.dpToPx
|
bottomMargin = max(-pad.toInt(), view?.rootWindowInsets?.systemWindowInsetBottom ?: 0) + 16.dpToPx
|
||||||
}
|
}
|
||||||
|
setPadding(binding.downloadBottomSheet.dlBottomSheet.sheetBehavior?.isHideable == true)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setRefreshing(refresh: Boolean) {
|
fun setRefreshing(refresh: Boolean) {
|
||||||
@ -429,11 +431,16 @@ class RecentsController(bundle: Bundle? = null) :
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
fun setPadding(sheetIsHidden: Boolean) {
|
fun setPadding(sheetIsHidden: Boolean, insets: WindowInsets? = null) {
|
||||||
binding.recycler.updatePaddingRelative(bottom = if (sheetIsHidden) 0 else 20.dpToPx)
|
val peekHeight = binding.downloadBottomSheet.dlBottomSheet.sheetBehavior?.peekHeight ?: 0
|
||||||
binding.recycler.updateLayoutParams<ViewGroup.MarginLayoutParams> {
|
val cInsets = insets ?: view?.rootWindowInsets ?: return
|
||||||
bottomMargin = if (sheetIsHidden) 0 else 30.dpToPx
|
binding.recycler.updatePaddingRelative(
|
||||||
}
|
bottom = if (sheetIsHidden) {
|
||||||
|
activityBinding?.bottomNav?.height ?: cInsets.systemWindowInsetBottom
|
||||||
|
} else {
|
||||||
|
peekHeight
|
||||||
|
}
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onActivityResumed(activity: Activity) {
|
override fun onActivityResumed(activity: Activity) {
|
||||||
|
@ -143,7 +143,7 @@ class BrowseController :
|
|||||||
headerHeight = it.systemWindowInsetTop + appBarHeight
|
headerHeight = it.systemWindowInsetTop + appBarHeight
|
||||||
binding.sourceRecycler.updatePaddingRelative(
|
binding.sourceRecycler.updatePaddingRelative(
|
||||||
top = headerHeight,
|
top = headerHeight,
|
||||||
bottom = (activityBinding?.bottomNav?.height ?: 0) + 58.spToPx
|
bottom = (activityBinding?.bottomNav?.height ?: it.getBottomGestureInsets()) + 58.spToPx
|
||||||
)
|
)
|
||||||
if (activityBinding?.bottomNav == null) {
|
if (activityBinding?.bottomNav == null) {
|
||||||
setBottomPadding()
|
setBottomPadding()
|
||||||
@ -299,7 +299,10 @@ class BrowseController :
|
|||||||
bottomMargin = -pad.toInt()
|
bottomMargin = -pad.toInt()
|
||||||
}
|
}
|
||||||
binding.sourceRecycler.updatePaddingRelative(
|
binding.sourceRecycler.updatePaddingRelative(
|
||||||
bottom = (activityBinding?.bottomNav?.height ?: 0) + 58.spToPx
|
bottom = (
|
||||||
|
activityBinding?.bottomNav?.height
|
||||||
|
?: view?.rootWindowInsets?.getBottomGestureInsets() ?: 0
|
||||||
|
) + 58.spToPx
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user