mirror of
https://github.com/SimpleMobileTools/Simple-Gallery.git
synced 2025-06-05 21:59:19 +02:00
simplify the squareImageView creation
This commit is contained in:
@ -14,8 +14,7 @@ class MySquareImageView : ImageView {
|
|||||||
constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(context, attrs, defStyle)
|
constructor(context: Context, attrs: AttributeSet, defStyle: Int) : super(context, attrs, defStyle)
|
||||||
|
|
||||||
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
||||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
|
val spec = if (isVerticalScrolling) widthMeasureSpec else heightMeasureSpec
|
||||||
val spec = if (isVerticalScrolling) measuredWidth else measuredHeight
|
super.onMeasure(spec, spec)
|
||||||
setMeasuredDimension(spec, spec)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user