180 lines
6.0 KiB
Java
180 lines
6.0 KiB
Java
package o;
|
|
|
|
import android.content.Context;
|
|
import android.graphics.Canvas;
|
|
import android.graphics.Paint;
|
|
import android.graphics.Rect;
|
|
import android.os.Build;
|
|
import android.util.DisplayMetrics;
|
|
import android.view.View;
|
|
import android.view.ViewConfiguration;
|
|
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
|
|
|
/* renamed from: o.PWv, reason: case insensitive filesystem */
|
|
/* loaded from: classes.dex */
|
|
public abstract class AbstractC0810PWv {
|
|
private static Rect d;
|
|
private static Paint.FontMetrics f;
|
|
private static DisplayMetrics j;
|
|
public static final float e = Float.intBitsToFloat(1);
|
|
private static Rect b = new Rect();
|
|
private static Paint.FontMetrics h = new Paint.FontMetrics();
|
|
private static Rect a = new Rect();
|
|
private static vTS c = new tsQ(1);
|
|
|
|
public static float c(float f2) {
|
|
while (f2 < BitmapDescriptorFactory.HUE_RED) {
|
|
f2 += 360.0f;
|
|
}
|
|
return f2 % 360.0f;
|
|
}
|
|
|
|
static {
|
|
new Rect();
|
|
d = new Rect();
|
|
f = new Paint.FontMetrics();
|
|
}
|
|
|
|
public static void a(Context context) {
|
|
if (context == null) {
|
|
ViewConfiguration.getMinimumFlingVelocity();
|
|
ViewConfiguration.getMaximumFlingVelocity();
|
|
} else {
|
|
ViewConfiguration viewConfiguration = ViewConfiguration.get(context);
|
|
viewConfiguration.getScaledMinimumFlingVelocity();
|
|
viewConfiguration.getScaledMaximumFlingVelocity();
|
|
j = context.getResources().getDisplayMetrics();
|
|
}
|
|
}
|
|
|
|
public static float d(float f2) {
|
|
DisplayMetrics displayMetrics = j;
|
|
return displayMetrics == null ? f2 : f2 * displayMetrics.density;
|
|
}
|
|
|
|
public static int He_(Paint paint, String str) {
|
|
return (int) paint.measureText(str);
|
|
}
|
|
|
|
public static int Hc_(Paint paint, String str) {
|
|
Rect rect = b;
|
|
rect.set(0, 0, 0, 0);
|
|
paint.getTextBounds(str, 0, str.length(), rect);
|
|
return rect.height();
|
|
}
|
|
|
|
public static float Hh_(Paint paint, Paint.FontMetrics fontMetrics) {
|
|
paint.getFontMetrics(fontMetrics);
|
|
return fontMetrics.descent - fontMetrics.ascent;
|
|
}
|
|
|
|
public static float Hj_(Paint paint, Paint.FontMetrics fontMetrics) {
|
|
paint.getFontMetrics(fontMetrics);
|
|
return (fontMetrics.ascent - fontMetrics.top) + fontMetrics.bottom;
|
|
}
|
|
|
|
public static RlR Hd_(Paint paint, String str) {
|
|
RlR c2 = RlR.c(BitmapDescriptorFactory.HUE_RED, BitmapDescriptorFactory.HUE_RED);
|
|
Rect rect = a;
|
|
rect.set(0, 0, 0, 0);
|
|
paint.getTextBounds(str, 0, str.length(), rect);
|
|
c2.c = rect.width();
|
|
c2.a = rect.height();
|
|
return c2;
|
|
}
|
|
|
|
public static float a(double d2) {
|
|
if (Double.isInfinite(d2) || Double.isNaN(d2) || d2 == 0.0d) {
|
|
return BitmapDescriptorFactory.HUE_RED;
|
|
}
|
|
float pow = (float) Math.pow(10.0d, 1 - ((int) Math.ceil((float) Math.log10(d2 < 0.0d ? -d2 : d2))));
|
|
return ((float) Math.round(d2 * pow)) / pow;
|
|
}
|
|
|
|
public static int e(float f2) {
|
|
float a2 = a(f2);
|
|
if (Float.isInfinite(a2)) {
|
|
return 0;
|
|
}
|
|
return ((int) Math.ceil(-Math.log10(a2))) + 2;
|
|
}
|
|
|
|
public static double b(double d2) {
|
|
if (d2 == Double.POSITIVE_INFINITY) {
|
|
return d2;
|
|
}
|
|
double d3 = d2 + 0.0d;
|
|
return Double.longBitsToDouble(Double.doubleToRawLongBits(d3) + (d3 >= 0.0d ? 1L : -1L));
|
|
}
|
|
|
|
public static void b(QFQ qfq, float f2, float f3, QFQ qfq2) {
|
|
double d2 = f2;
|
|
double d3 = f3;
|
|
qfq2.a = (float) (qfq.a + (Math.cos(Math.toRadians(d3)) * d2));
|
|
qfq2.e = (float) (qfq.e + (d2 * Math.sin(Math.toRadians(d3))));
|
|
}
|
|
|
|
public static void c(View view) {
|
|
view.postInvalidateOnAnimation();
|
|
}
|
|
|
|
public static void Hf_(Canvas canvas, String str, float f2, float f3, Paint paint, QFQ qfq, float f4) {
|
|
float fontMetrics = paint.getFontMetrics(f);
|
|
paint.getTextBounds(str, 0, str.length(), d);
|
|
float f5 = BitmapDescriptorFactory.HUE_RED - d.left;
|
|
float f6 = (-f.ascent) + BitmapDescriptorFactory.HUE_RED;
|
|
Paint.Align textAlign = paint.getTextAlign();
|
|
paint.setTextAlign(Paint.Align.LEFT);
|
|
if (f4 != BitmapDescriptorFactory.HUE_RED) {
|
|
float width = d.width();
|
|
if (qfq.a != 0.5f || qfq.e != 0.5f) {
|
|
RlR a2 = a(d.width(), fontMetrics, 0.017453292f * f4);
|
|
f2 -= a2.c * (qfq.a - 0.5f);
|
|
f3 -= a2.a * (qfq.e - 0.5f);
|
|
RlR.a(a2);
|
|
}
|
|
canvas.save();
|
|
canvas.translate(f2, f3);
|
|
canvas.rotate(f4);
|
|
canvas.drawText(str, f5 - (width * 0.5f), f6 - (fontMetrics * 0.5f), paint);
|
|
canvas.restore();
|
|
} else {
|
|
if (qfq.a != BitmapDescriptorFactory.HUE_RED || qfq.e != BitmapDescriptorFactory.HUE_RED) {
|
|
f5 -= d.width() * qfq.a;
|
|
f6 -= fontMetrics * qfq.e;
|
|
}
|
|
canvas.drawText(str, f5 + f2, f6 + f3, paint);
|
|
}
|
|
paint.setTextAlign(textAlign);
|
|
}
|
|
|
|
public static RlR d(float f2, float f3, float f4) {
|
|
return a(f2, f3, f4 * 0.017453292f);
|
|
}
|
|
|
|
private static RlR a(float f2, float f3, float f4) {
|
|
double d2 = f4;
|
|
return RlR.c(Math.abs(((float) Math.cos(d2)) * f2) + Math.abs(((float) Math.sin(d2)) * f3), Math.abs(f2 * ((float) Math.sin(d2))) + Math.abs(f3 * ((float) Math.cos(d2))));
|
|
}
|
|
|
|
public static float Hg_(Paint paint) {
|
|
Paint.FontMetrics fontMetrics = h;
|
|
paint.getFontMetrics(fontMetrics);
|
|
return fontMetrics.descent - fontMetrics.ascent;
|
|
}
|
|
|
|
public static float Hi_(Paint paint) {
|
|
Paint.FontMetrics fontMetrics = h;
|
|
paint.getFontMetrics(fontMetrics);
|
|
return (fontMetrics.ascent - fontMetrics.top) + fontMetrics.bottom;
|
|
}
|
|
|
|
public static int e() {
|
|
return Build.VERSION.SDK_INT;
|
|
}
|
|
|
|
public static vTS a() {
|
|
return c;
|
|
}
|
|
}
|