Prework
This commit is contained in:
parent
4ec1b18b47
commit
1b702eae07
2 changed files with 44 additions and 7 deletions
|
|
@ -0,0 +1,31 @@
|
|||
package com.kabouzeid.gramophone.views;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.ImageView;
|
||||
|
||||
/**
|
||||
* @author Karim Abou Zeid (kabouzeid)
|
||||
*/
|
||||
public class SquareFitImageView extends ImageView {
|
||||
|
||||
public SquareFitImageView(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
public SquareFitImageView(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
|
||||
public SquareFitImageView(Context context, AttributeSet attrs, int defStyle) {
|
||||
super(context, attrs, defStyle);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
final int newWidth = Math.min(widthMeasureSpec, heightMeasureSpec);
|
||||
//noinspection SuspiciousNameCombination
|
||||
super.onMeasure(newWidth, newWidth);
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue