package com.google.maps.android.ui; import android.content.Context; import android.graphics.Canvas; import android.util.AttributeSet; import android.widget.FrameLayout; import com.google.android.gms.maps.model.BitmapDescriptorFactory; /* loaded from: classes2.dex */ public class RotationLayout extends FrameLayout { private int e; public RotationLayout(Context context) { super(context); } public RotationLayout(Context context, AttributeSet attributeSet) { super(context, attributeSet); } public RotationLayout(Context context, AttributeSet attributeSet, int i) { super(context, attributeSet, i); } @Override // android.widget.FrameLayout, android.view.View protected void onMeasure(int i, int i2) { int i3 = this.e; if (i3 == 1 || i3 == 3) { super.onMeasure(i, i2); setMeasuredDimension(getMeasuredHeight(), getMeasuredWidth()); } else { super.onMeasure(i, i2); } } public void setViewRotation(int i) { this.e = ((i + 360) % 360) / 90; } @Override // android.view.ViewGroup, android.view.View public void dispatchDraw(Canvas canvas) { int i = this.e; if (i == 0) { super.dispatchDraw(canvas); return; } if (i == 1) { canvas.translate(getWidth(), BitmapDescriptorFactory.HUE_RED); canvas.rotate(90.0f, getWidth() / 2, BitmapDescriptorFactory.HUE_RED); canvas.translate(getHeight() / 2, getWidth() / 2); } else if (i == 2) { canvas.rotate(180.0f, getWidth() / 2, getHeight() / 2); } else { canvas.translate(BitmapDescriptorFactory.HUE_RED, getHeight()); canvas.rotate(270.0f, getWidth() / 2, BitmapDescriptorFactory.HUE_RED); canvas.translate(getHeight() / 2, (-getWidth()) / 2); } super.dispatchDraw(canvas); } }