mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
set MySquareImageView size depending on the thumbnail scrolling orientation
This commit is contained in:
parent
561c81dd42
commit
f740150d49
2 changed files with 4 additions and 2 deletions
|
@ -23,7 +23,6 @@ import com.theartofdev.edmodo.cropper.CropImageView
|
||||||
import kotlinx.android.synthetic.main.view_crop_image.*
|
import kotlinx.android.synthetic.main.view_crop_image.*
|
||||||
import java.io.*
|
import java.io.*
|
||||||
|
|
||||||
|
|
||||||
class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener {
|
class EditActivity : SimpleActivity(), CropImageView.OnCropImageCompleteListener {
|
||||||
val TAG = EditActivity::class.java.simpleName
|
val TAG = EditActivity::class.java.simpleName
|
||||||
val ASPECT_X = "aspectX"
|
val ASPECT_X = "aspectX"
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
package com.simplemobiletools.gallery.views
|
package com.simplemobiletools.gallery.views
|
||||||
|
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
|
import android.support.v7.widget.OrientationHelper
|
||||||
import android.util.AttributeSet
|
import android.util.AttributeSet
|
||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
|
|
||||||
class MySquareImageView : ImageView {
|
class MySquareImageView : ImageView {
|
||||||
|
var orientation = OrientationHelper.VERTICAL
|
||||||
|
|
||||||
constructor(context: Context) : super(context)
|
constructor(context: Context) : super(context)
|
||||||
|
|
||||||
|
@ -14,6 +16,7 @@ class MySquareImageView : ImageView {
|
||||||
|
|
||||||
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
||||||
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
|
||||||
setMeasuredDimension(measuredWidth, measuredWidth)
|
val spec = if (orientation == OrientationHelper.VERTICAL) measuredWidth else measuredHeight
|
||||||
|
setMeasuredDimension(spec, spec)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue