Initial version -- added millennium read funcionality
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
package com.google.maps.android.ui;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.SystemClock;
|
||||
import android.view.animation.AccelerateDecelerateInterpolator;
|
||||
import com.google.android.gms.maps.model.LatLng;
|
||||
import com.google.android.gms.maps.model.Marker;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class AnimationUtil {
|
||||
public static void animateMarkerTo(final Marker marker, final LatLng latLng) {
|
||||
final LatLngInterpolator.Linear linear = new LatLngInterpolator.Linear();
|
||||
final LatLng position = marker.getPosition();
|
||||
final Handler handler = new Handler();
|
||||
final long jUptimeMillis = SystemClock.uptimeMillis();
|
||||
final AccelerateDecelerateInterpolator accelerateDecelerateInterpolator = new AccelerateDecelerateInterpolator();
|
||||
handler.post(new Runnable() { // from class: com.google.maps.android.ui.AnimationUtil.1
|
||||
long elapsed;
|
||||
float t;
|
||||
float v;
|
||||
|
||||
@Override // java.lang.Runnable
|
||||
public void run() {
|
||||
long jUptimeMillis2 = SystemClock.uptimeMillis() - jUptimeMillis;
|
||||
this.elapsed = jUptimeMillis2;
|
||||
float f = jUptimeMillis2 / 2000.0f;
|
||||
this.t = f;
|
||||
float interpolation = accelerateDecelerateInterpolator.getInterpolation(f);
|
||||
this.v = interpolation;
|
||||
marker.setPosition(linear.interpolate(interpolation, position, latLng));
|
||||
if (this.t < 1.0f) {
|
||||
handler.postDelayed(this, 16L);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
interface LatLngInterpolator {
|
||||
LatLng interpolate(float f, LatLng latLng, LatLng latLng2);
|
||||
|
||||
public static class Linear implements LatLngInterpolator {
|
||||
@Override // com.google.maps.android.ui.AnimationUtil.LatLngInterpolator
|
||||
public LatLng interpolate(float f, LatLng latLng, LatLng latLng2) {
|
||||
double d = f;
|
||||
double d2 = ((latLng2.latitude - latLng.latitude) * d) + latLng.latitude;
|
||||
double dSignum = latLng2.longitude - latLng.longitude;
|
||||
if (Math.abs(dSignum) > 180.0d) {
|
||||
dSignum -= Math.signum(dSignum) * 360.0d;
|
||||
}
|
||||
return new LatLng(d2, (dSignum * d) + latLng.longitude);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.google.maps.android.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.ColorFilter;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import com.google.maps.android.R;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
class BubbleDrawable extends Drawable {
|
||||
private int mColor = -1;
|
||||
private final Drawable mMask;
|
||||
private final Drawable mShadow;
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public int getOpacity() {
|
||||
return -3;
|
||||
}
|
||||
|
||||
public BubbleDrawable(Context context) {
|
||||
this.mMask = ContextCompat.getDrawable(context, R.drawable.amu_bubble_mask);
|
||||
this.mShadow = ContextCompat.getDrawable(context, R.drawable.amu_bubble_shadow);
|
||||
}
|
||||
|
||||
public void setColor(int i) {
|
||||
this.mColor = i;
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void draw(Canvas canvas) {
|
||||
this.mMask.draw(canvas);
|
||||
canvas.drawColor(this.mColor, PorterDuff.Mode.SRC_IN);
|
||||
this.mShadow.draw(canvas);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setAlpha(int i) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setColorFilter(ColorFilter colorFilter) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setBounds(int i, int i2, int i3, int i4) {
|
||||
this.mMask.setBounds(i, i2, i3, i4);
|
||||
this.mShadow.setBounds(i, i2, i3, i4);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public void setBounds(Rect rect) {
|
||||
this.mMask.setBounds(rect);
|
||||
this.mShadow.setBounds(rect);
|
||||
}
|
||||
|
||||
@Override // android.graphics.drawable.Drawable
|
||||
public boolean getPadding(Rect rect) {
|
||||
return this.mMask.getPadding(rect);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.google.maps.android.ui;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
@Deprecated
|
||||
public class BubbleIconFactory {
|
||||
}
|
||||
@@ -0,0 +1,181 @@
|
||||
package com.google.maps.android.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Rect;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
import com.google.maps.android.R;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class IconGenerator {
|
||||
public static final int STYLE_BLUE = 4;
|
||||
public static final int STYLE_DEFAULT = 1;
|
||||
public static final int STYLE_GREEN = 5;
|
||||
public static final int STYLE_ORANGE = 7;
|
||||
public static final int STYLE_PURPLE = 6;
|
||||
public static final int STYLE_RED = 3;
|
||||
public static final int STYLE_WHITE = 2;
|
||||
private float mAnchorU = 0.5f;
|
||||
private float mAnchorV = 1.0f;
|
||||
private BubbleDrawable mBackground;
|
||||
private ViewGroup mContainer;
|
||||
private View mContentView;
|
||||
private final Context mContext;
|
||||
private int mRotation;
|
||||
private RotationLayout mRotationLayout;
|
||||
private TextView mTextView;
|
||||
|
||||
private static int getStyleColor(int i) {
|
||||
if (i == 3) {
|
||||
return -3407872;
|
||||
}
|
||||
if (i == 4) {
|
||||
return -16737844;
|
||||
}
|
||||
if (i == 5) {
|
||||
return -10053376;
|
||||
}
|
||||
if (i != 6) {
|
||||
return i != 7 ? -1 : -30720;
|
||||
}
|
||||
return -6736948;
|
||||
}
|
||||
|
||||
public IconGenerator(Context context) {
|
||||
this.mContext = context;
|
||||
this.mBackground = new BubbleDrawable(context);
|
||||
ViewGroup viewGroup = (ViewGroup) LayoutInflater.from(context).inflate(R.layout.amu_text_bubble, (ViewGroup) null);
|
||||
this.mContainer = viewGroup;
|
||||
RotationLayout rotationLayout = (RotationLayout) viewGroup.getChildAt(0);
|
||||
this.mRotationLayout = rotationLayout;
|
||||
TextView textView = (TextView) rotationLayout.findViewById(R.id.amu_text);
|
||||
this.mTextView = textView;
|
||||
this.mContentView = textView;
|
||||
setStyle(1);
|
||||
}
|
||||
|
||||
public Bitmap makeIcon(CharSequence charSequence) {
|
||||
TextView textView = this.mTextView;
|
||||
if (textView != null) {
|
||||
textView.setText(charSequence);
|
||||
}
|
||||
return makeIcon();
|
||||
}
|
||||
|
||||
public Bitmap makeIcon() {
|
||||
int iMakeMeasureSpec = View.MeasureSpec.makeMeasureSpec(0, 0);
|
||||
this.mContainer.measure(iMakeMeasureSpec, iMakeMeasureSpec);
|
||||
int measuredWidth = this.mContainer.getMeasuredWidth();
|
||||
int measuredHeight = this.mContainer.getMeasuredHeight();
|
||||
this.mContainer.layout(0, 0, measuredWidth, measuredHeight);
|
||||
int i = this.mRotation;
|
||||
if (i == 1 || i == 3) {
|
||||
measuredHeight = this.mContainer.getMeasuredWidth();
|
||||
measuredWidth = this.mContainer.getMeasuredHeight();
|
||||
}
|
||||
Bitmap bitmapCreateBitmap = Bitmap.createBitmap(measuredWidth, measuredHeight, Bitmap.Config.ARGB_8888);
|
||||
bitmapCreateBitmap.eraseColor(0);
|
||||
Canvas canvas = new Canvas(bitmapCreateBitmap);
|
||||
int i2 = this.mRotation;
|
||||
if (i2 == 1) {
|
||||
canvas.translate(measuredWidth, 0.0f);
|
||||
canvas.rotate(90.0f);
|
||||
} else if (i2 == 2) {
|
||||
canvas.rotate(180.0f, measuredWidth / 2, measuredHeight / 2);
|
||||
} else if (i2 == 3) {
|
||||
canvas.translate(0.0f, measuredHeight);
|
||||
canvas.rotate(270.0f);
|
||||
}
|
||||
this.mContainer.draw(canvas);
|
||||
return bitmapCreateBitmap;
|
||||
}
|
||||
|
||||
public void setContentView(View view) {
|
||||
this.mRotationLayout.removeAllViews();
|
||||
this.mRotationLayout.addView(view);
|
||||
this.mContentView = view;
|
||||
View viewFindViewById = this.mRotationLayout.findViewById(R.id.amu_text);
|
||||
this.mTextView = viewFindViewById instanceof TextView ? (TextView) viewFindViewById : null;
|
||||
}
|
||||
|
||||
public void setContentRotation(int i) {
|
||||
this.mRotationLayout.setViewRotation(i);
|
||||
}
|
||||
|
||||
public void setRotation(int i) {
|
||||
this.mRotation = ((i + 360) % 360) / 90;
|
||||
}
|
||||
|
||||
public float getAnchorU() {
|
||||
return rotateAnchor(this.mAnchorU, this.mAnchorV);
|
||||
}
|
||||
|
||||
public float getAnchorV() {
|
||||
return rotateAnchor(this.mAnchorV, this.mAnchorU);
|
||||
}
|
||||
|
||||
private float rotateAnchor(float f, float f2) {
|
||||
int i = this.mRotation;
|
||||
if (i == 0) {
|
||||
return f;
|
||||
}
|
||||
if (i == 1) {
|
||||
return 1.0f - f2;
|
||||
}
|
||||
if (i == 2) {
|
||||
return 1.0f - f;
|
||||
}
|
||||
if (i == 3) {
|
||||
return f2;
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
|
||||
public void setTextAppearance(Context context, int i) {
|
||||
TextView textView = this.mTextView;
|
||||
if (textView != null) {
|
||||
textView.setTextAppearance(context, i);
|
||||
}
|
||||
}
|
||||
|
||||
public void setTextAppearance(int i) {
|
||||
setTextAppearance(this.mContext, i);
|
||||
}
|
||||
|
||||
public void setStyle(int i) {
|
||||
setColor(getStyleColor(i));
|
||||
setTextAppearance(this.mContext, getTextStyle(i));
|
||||
}
|
||||
|
||||
public void setColor(int i) {
|
||||
this.mBackground.setColor(i);
|
||||
setBackground(this.mBackground);
|
||||
}
|
||||
|
||||
public void setBackground(Drawable drawable) {
|
||||
this.mContainer.setBackgroundDrawable(drawable);
|
||||
if (drawable != null) {
|
||||
Rect rect = new Rect();
|
||||
drawable.getPadding(rect);
|
||||
this.mContainer.setPadding(rect.left, rect.top, rect.right, rect.bottom);
|
||||
return;
|
||||
}
|
||||
this.mContainer.setPadding(0, 0, 0, 0);
|
||||
}
|
||||
|
||||
public void setContentPadding(int i, int i2, int i3, int i4) {
|
||||
this.mContentView.setPadding(i, i2, i3, i4);
|
||||
}
|
||||
|
||||
private static int getTextStyle(int i) {
|
||||
if (i != 3 && i != 4 && i != 5 && i != 6 && i != 7) {
|
||||
return R.style.amu_Bubble_TextAppearance_Dark;
|
||||
}
|
||||
return R.style.amu_Bubble_TextAppearance_Light;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.google.maps.android.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.FrameLayout;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class RotationLayout extends FrameLayout {
|
||||
private int mRotation;
|
||||
|
||||
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.mRotation;
|
||||
if (i3 == 1 || i3 == 3) {
|
||||
super.onMeasure(i, i2);
|
||||
setMeasuredDimension(getMeasuredHeight(), getMeasuredWidth());
|
||||
} else {
|
||||
super.onMeasure(i, i2);
|
||||
}
|
||||
}
|
||||
|
||||
public void setViewRotation(int i) {
|
||||
this.mRotation = ((i + 360) % 360) / 90;
|
||||
}
|
||||
|
||||
@Override // android.view.ViewGroup, android.view.View
|
||||
public void dispatchDraw(Canvas canvas) {
|
||||
int i = this.mRotation;
|
||||
if (i == 0) {
|
||||
super.dispatchDraw(canvas);
|
||||
return;
|
||||
}
|
||||
if (i == 1) {
|
||||
canvas.translate(getWidth(), 0.0f);
|
||||
canvas.rotate(90.0f, getWidth() / 2, 0.0f);
|
||||
canvas.translate(getHeight() / 2, getWidth() / 2);
|
||||
} else if (i == 2) {
|
||||
canvas.rotate(180.0f, getWidth() / 2, getHeight() / 2);
|
||||
} else {
|
||||
canvas.translate(0.0f, getHeight());
|
||||
canvas.rotate(270.0f, getWidth() / 2, 0.0f);
|
||||
canvas.translate(getHeight() / 2, (-getWidth()) / 2);
|
||||
}
|
||||
super.dispatchDraw(canvas);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.google.maps.android.ui;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Canvas;
|
||||
import android.util.AttributeSet;
|
||||
import android.widget.TextView;
|
||||
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class SquareTextView extends TextView {
|
||||
private int mOffsetLeft;
|
||||
private int mOffsetTop;
|
||||
|
||||
public SquareTextView(Context context) {
|
||||
super(context);
|
||||
this.mOffsetTop = 0;
|
||||
this.mOffsetLeft = 0;
|
||||
}
|
||||
|
||||
public SquareTextView(Context context, AttributeSet attributeSet) {
|
||||
super(context, attributeSet);
|
||||
this.mOffsetTop = 0;
|
||||
this.mOffsetLeft = 0;
|
||||
}
|
||||
|
||||
public SquareTextView(Context context, AttributeSet attributeSet, int i) {
|
||||
super(context, attributeSet, i);
|
||||
this.mOffsetTop = 0;
|
||||
this.mOffsetLeft = 0;
|
||||
}
|
||||
|
||||
@Override // android.widget.TextView, android.view.View
|
||||
protected void onMeasure(int i, int i2) {
|
||||
super.onMeasure(i, i2);
|
||||
int measuredWidth = getMeasuredWidth();
|
||||
int measuredHeight = getMeasuredHeight();
|
||||
int iMax = Math.max(measuredWidth, measuredHeight);
|
||||
if (measuredWidth > measuredHeight) {
|
||||
this.mOffsetTop = measuredWidth - measuredHeight;
|
||||
this.mOffsetLeft = 0;
|
||||
} else {
|
||||
this.mOffsetTop = 0;
|
||||
this.mOffsetLeft = measuredHeight - measuredWidth;
|
||||
}
|
||||
setMeasuredDimension(iMax, iMax);
|
||||
}
|
||||
|
||||
@Override // android.view.View
|
||||
public void draw(Canvas canvas) {
|
||||
canvas.translate(this.mOffsetLeft / 2, this.mOffsetTop / 2);
|
||||
super.draw(canvas);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user