summaryrefslogtreecommitdiffstats
path: root/src/org/lineageos/eleven/widgets/SquareFrame.java
blob: 85b0acc39f8c527bb4c6415b92a9d6d992dbe346 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package com.cyanogenmod.eleven.widgets;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.FrameLayout;

public class SquareFrame extends FrameLayout {
    public SquareFrame(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    public void onMeasure(final int widthSpec, final int heightSpec) {
        super.onMeasure(widthSpec, heightSpec);
        final int mSize = Math.min(getMeasuredWidth(), getMeasuredHeight());
        setMeasuredDimension(mSize, mSize);
    }
}