mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
simplify the squareImageView creation
This commit is contained in:
parent
6f3fd675e2
commit
8f8dd04920
1 changed files with 2 additions and 3 deletions
|
@ -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)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue