queue: pad the sheet's below-screen overflow so the empty hint centers
This commit is contained in:
@@ -23,6 +23,7 @@ import android.util.AttributeSet
|
|||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.WindowInsets
|
import android.view.WindowInsets
|
||||||
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
import androidx.coordinatorlayout.widget.CoordinatorLayout
|
||||||
|
import androidx.core.view.updatePadding
|
||||||
import com.google.android.material.R as MR
|
import com.google.android.material.R as MR
|
||||||
import com.google.android.material.shape.MaterialShapeDrawable
|
import com.google.android.material.shape.MaterialShapeDrawable
|
||||||
import com.google.android.material.shape.ShapeAppearanceModel
|
import com.google.android.material.shape.ShapeAppearanceModel
|
||||||
@@ -106,6 +107,10 @@ class QueueBottomSheetBehavior<V : View>(context: Context, attributeSet: Attribu
|
|||||||
val bars = insets.systemBarInsetsCompat
|
val bars = insets.systemBarInsetsCompat
|
||||||
val effectiveBarHeight = if (barHeight > 0) barHeight else getIdealBarHeight(child.context)
|
val effectiveBarHeight = if (barHeight > 0) barHeight else getIdealBarHeight(child.context)
|
||||||
expandedOffset = effectiveBarHeight + barSpacing
|
expandedOffset = effectiveBarHeight + barSpacing
|
||||||
|
// The sheet is measured at full height from its expanded offset, so its bottom extends
|
||||||
|
// that far below the screen. Pad the content so it ends at the visible bottom instead
|
||||||
|
// (which also keeps the empty-queue hint visually centered).
|
||||||
|
child.updatePadding(bottom = expandedOffset + bars.bottom)
|
||||||
return insets.replaceSystemBarInsetsCompat(
|
return insets.replaceSystemBarInsetsCompat(
|
||||||
bars.left,
|
bars.left,
|
||||||
bars.top,
|
bars.top,
|
||||||
|
|||||||
Reference in New Issue
Block a user