list: fix fastscroll layout issues
This commit is contained in:
parent
3e54c032fe
commit
6d09e06424
1 changed files with 9 additions and 7 deletions
|
@ -79,8 +79,6 @@ import org.oxycblt.auxio.util.systemBarInsetsCompat
|
||||||
* - New scroll position backend
|
* - New scroll position backend
|
||||||
*
|
*
|
||||||
* @author Hai Zhang, Alexander Capehart (OxygenCobalt)
|
* @author Hai Zhang, Alexander Capehart (OxygenCobalt)
|
||||||
*
|
|
||||||
* TODO: Add vibration when popup changes
|
|
||||||
*/
|
*/
|
||||||
class FastScrollRecyclerView
|
class FastScrollRecyclerView
|
||||||
@JvmOverloads
|
@JvmOverloads
|
||||||
|
@ -123,11 +121,16 @@ constructor(context: Context, attrs: AttributeSet? = null, @AttrRes defStyleAttr
|
||||||
.getDimenPixels(com.google.android.material.R.dimen.m3_sys_elevation_level1)
|
.getDimenPixels(com.google.android.material.R.dimen.m3_sys_elevation_level1)
|
||||||
.toFloat()
|
.toFloat()
|
||||||
background = context.getDrawableCompat(R.drawable.ui_popup)
|
background = context.getDrawableCompat(R.drawable.ui_popup)
|
||||||
updatePaddingRelative(end = context.getDimenPixels(R.dimen.spacing_tiny) / 2)
|
val paddingStart = context.getDimenPixels(R.dimen.spacing_medium)
|
||||||
|
val paddingEnd = paddingStart + context.getDimenPixels(R.dimen.spacing_tiny) / 2
|
||||||
|
updatePaddingRelative(start = paddingStart, end = paddingEnd)
|
||||||
layoutParams =
|
layoutParams =
|
||||||
FrameLayout.LayoutParams(
|
FrameLayout.LayoutParams(
|
||||||
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT)
|
||||||
.apply { gravity = Gravity.CENTER_HORIZONTAL or Gravity.TOP }
|
.apply {
|
||||||
|
marginEnd = context.getDimenPixels(R.dimen.size_touchable_small)
|
||||||
|
gravity = Gravity.CENTER_HORIZONTAL or Gravity.TOP
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private val popupSlider =
|
private val popupSlider =
|
||||||
MaterialFadingSlider(MaterialSlider.large(context, popupView.minimumWidth / 2)).apply {
|
MaterialFadingSlider(MaterialSlider.large(context, popupView.minimumWidth / 2)).apply {
|
||||||
|
@ -293,14 +296,13 @@ constructor(context: Context, attrs: AttributeSet? = null, @AttrRes defStyleAttr
|
||||||
val popupHeight = popupView.measuredHeight
|
val popupHeight = popupView.measuredHeight
|
||||||
val popupLeft =
|
val popupLeft =
|
||||||
if (layoutDirection == View.LAYOUT_DIRECTION_RTL) {
|
if (layoutDirection == View.LAYOUT_DIRECTION_RTL) {
|
||||||
thumbPadding.left + thumbWidth + popupLayoutParams.leftMargin + popupWidth / 2
|
thumbPadding.left + thumbWidth + popupLayoutParams.leftMargin
|
||||||
} else {
|
} else {
|
||||||
width -
|
width -
|
||||||
thumbPadding.right -
|
thumbPadding.right -
|
||||||
thumbWidth -
|
thumbWidth -
|
||||||
popupLayoutParams.rightMargin -
|
popupLayoutParams.rightMargin -
|
||||||
popupWidth -
|
popupWidth
|
||||||
popupWidth / 2
|
|
||||||
}
|
}
|
||||||
|
|
||||||
val popupAnchorY = popupHeight / 2
|
val popupAnchorY = popupHeight / 2
|
||||||
|
|
Loading…
Reference in a new issue