53 lines
1.5 KiB
Java
53 lines
1.5 KiB
Java
package com.google.maps.android.ui;
|
|
|
|
import android.content.Context;
|
|
import android.graphics.Canvas;
|
|
import android.util.AttributeSet;
|
|
import androidx.appcompat.widget.AppCompatTextView;
|
|
|
|
/* loaded from: classes2.dex */
|
|
public class SquareTextView extends AppCompatTextView {
|
|
private int a;
|
|
private int e;
|
|
|
|
public SquareTextView(Context context) {
|
|
super(context);
|
|
this.a = 0;
|
|
this.e = 0;
|
|
}
|
|
|
|
public SquareTextView(Context context, AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
this.a = 0;
|
|
this.e = 0;
|
|
}
|
|
|
|
public SquareTextView(Context context, AttributeSet attributeSet, int i) {
|
|
super(context, attributeSet, i);
|
|
this.a = 0;
|
|
this.e = 0;
|
|
}
|
|
|
|
@Override // androidx.appcompat.widget.AppCompatTextView, android.widget.TextView, android.view.View
|
|
public void onMeasure(int i, int i2) {
|
|
super.onMeasure(i, i2);
|
|
int measuredWidth = getMeasuredWidth();
|
|
int measuredHeight = getMeasuredHeight();
|
|
int max = Math.max(measuredWidth, measuredHeight);
|
|
if (measuredWidth > measuredHeight) {
|
|
this.a = measuredWidth - measuredHeight;
|
|
this.e = 0;
|
|
} else {
|
|
this.a = 0;
|
|
this.e = measuredHeight - measuredWidth;
|
|
}
|
|
setMeasuredDimension(max, max);
|
|
}
|
|
|
|
@Override // android.view.View
|
|
public void draw(Canvas canvas) {
|
|
canvas.translate(this.e / 2, this.a / 2);
|
|
super.draw(canvas);
|
|
}
|
|
}
|