what-the-bank/sources/com/scb/phone/view/custom/RectangleRelativeLayout.java

57 lines
1.7 KiB
Java

package com.scb.phone.view.custom;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import androidx.recyclerview.widget.GridLayoutManager;
/* loaded from: classes5.dex */
public class RectangleRelativeLayout extends RelativeLayout {
private int a;
private int e;
public RectangleRelativeLayout(Context context) {
super(context);
this.e = 0;
this.a = 1;
}
public RectangleRelativeLayout(Context context, AttributeSet attributeSet) {
super(context, attributeSet);
this.e = 0;
this.a = 1;
}
public RectangleRelativeLayout(Context context, AttributeSet attributeSet, int i) {
super(context, attributeSet, i);
this.e = 0;
this.a = 1;
}
@Override // android.widget.RelativeLayout, android.view.View
protected void onMeasure(int i, int i2) {
int i3;
if (this.e == 0) {
if (this.a > 1) {
if (getMeasuredWidth() > 0) {
i3 = getMeasuredWidth() / this.a;
} else {
GridLayoutManager.HBt hBt = (GridLayoutManager.HBt) getLayoutParams();
i3 = (getContext().getResources().getDisplayMetrics().widthPixels - ((((ViewGroup.MarginLayoutParams) hBt).leftMargin + ((ViewGroup.MarginLayoutParams) hBt).rightMargin) << 1)) / 3;
}
this.e = View.MeasureSpec.makeMeasureSpec(i3, 1073741824);
} else {
this.e = i;
}
}
super.onMeasure(i, this.e);
}
public void setSpanSize(int i) {
this.a = i;
requestLayout();
}
}