package org.commcare.android.view;

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

/**
 * A layout that will enforce a given aspect ratio. Layout should define the attributes ratio_width and ratio_height.
 * @author jschweers
 */
public class AspectRatioLayout extends FrameLayout {
    float mRatioWidth;
    float mRatioHeight;

    public AspectRatioLayout(Context context) {
        super(context);
    }

    public AspectRatioLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
        initializeRatio(context, attrs);
    }

    public AspectRatioLayout(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);
        initializeRatio(context, attrs);
    }
    
    /**
     * Set layout's aspect ratio.
     */
    public void setRatio(float ratioWidth, float ratioHeight) {
        mRatioWidth = ratioWidth;
        mRatioHeight = ratioHeight;
    }
    
    private void initializeRatio(Context context, AttributeSet attrs) {
        if(!isInEditMode()) {
            String namespace = "http://schemas.android.com/apk/lib/" + this.getClass().getPackage().getName();
            mRatioWidth = attrs.getAttributeFloatValue(namespace, "ratio_width", 1);
            mRatioHeight = attrs.getAttributeFloatValue(namespace, "ratio_height", 1);
        }
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(
            MeasureSpec.makeMeasureSpec(widthMeasureSpec, MeasureSpec.EXACTLY),
            MeasureSpec.makeMeasureSpec((int) (widthMeasureSpec * mRatioHeight / mRatioWidth), MeasureSpec.EXACTLY)
        );
    }
}

@@ -577,33 +577,24 @@
 ializeRatio(
-context, 
 attrs);%0A    
@@ -743,25 +743,16 @@
 zeRatio(
-context, 
 attrs);%0A
@@ -990,33 +990,16 @@
 zeRatio(
-Context context, 
 Attribut

Remove unused context arg