package com.google.android.m4b.maps.bu;

import android.content.Context;
import android.graphics.Matrix;
import android.graphics.Matrix.ScaleToFit;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.os.IBinder;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import com.google.android.m4b.maps.R.animator;
import com.google.android.m4b.maps.R.drawable;
import com.google.android.m4b.maps.model.CameraPosition;
import com.google.android.m4b.maps.r.n;
import com.google.common.annotations.VisibleForTesting;

public final class m extends ImageView
  implements Animation.AnimationListener, n
{
  private Matrix a;
  private Matrix b;
  private float c;
  private float d;

  @VisibleForTesting
  private Animation e;

  @VisibleForTesting
  private Animation f;
  private boolean g;

  public m(Context paramContext)
  {
    super(paramContext);
    setScaleType(ImageView.ScaleType.MATRIX);
    setImageResource(R.drawable.ic_compass_needle);
    setBackgroundResource(R.drawable.button_compass_selector);
    this.e = AnimationUtils.loadAnimation(paramContext, R.animator.compass_button_fade_in);
    this.e.setAnimationListener(this);
    this.f = AnimationUtils.loadAnimation(paramContext, R.animator.compass_button_fade_out);
    this.f.setAnimationListener(this);
  }

  private void a()
  {
    if ((this.a != null) && (this.b != null))
    {
      this.b.set(this.a);
      this.b.postRotate(-this.c, getWidth() / 2.0F, getHeight() / 2.0F);
      float f3 = 0.7F * (this.d / 90.0F);
      this.b.postScale(1.0F, 1.0F - f3);
      this.b.postTranslate(0.0F, f3 / 2.0F * getHeight());
      setImageMatrix(this.b);
    }
    float f1 = this.d;
    float f2 = this.c;
    int j;
    int i;
    if (f1 <= 0.5F)
    {
      if ((f2 >= 0.5F) && (f2 <= 359.5F))
        break label178;
      j = 1;
      i = 0;
      if (j != 0);
    }
    else
    {
      i = 1;
    }
    if (i == 0)
      if ((getVisibility() == 0) && (getAnimation() != this.f))
        startAnimation(this.f);
    label178: 
    do
    {
      return;
      j = 0;
      break;
      if ((getVisibility() == 0) && (getAnimation() == this.f))
      {
        clearAnimation();
        return;
      }
    }
    while ((getVisibility() != 4) || (getAnimation() == this.e));
    startAnimation(this.e);
  }

  public final void a(CameraPosition paramCameraPosition)
  {
    if (!this.g)
      return;
    this.c = paramCameraPosition.bearing;
    this.d = paramCameraPosition.tilt;
    a();
  }

  public final void a(boolean paramBoolean, CameraPosition paramCameraPosition)
  {
    this.g = paramBoolean;
    if (paramBoolean)
    {
      setVisibility(4);
      a(paramCameraPosition);
      return;
    }
    clearAnimation();
    setVisibility(8);
  }

  public final IBinder asBinder()
  {
    return null;
  }

  public final void onAnimationEnd(Animation paramAnimation)
  {
    if ((paramAnimation == this.f) && (this.g))
      setVisibility(4);
  }

  public final void onAnimationRepeat(Animation paramAnimation)
  {
  }

  public final void onAnimationStart(Animation paramAnimation)
  {
    if ((paramAnimation == this.e) && (this.g))
      setVisibility(0);
  }

  protected final void onSizeChanged(int paramInt1, int paramInt2, int paramInt3, int paramInt4)
  {
    super.onSizeChanged(paramInt1, paramInt2, paramInt3, paramInt4);
    this.a = new Matrix();
    this.b = new Matrix();
    RectF localRectF1 = new RectF(0.0F, 0.0F, paramInt1, paramInt2);
    RectF localRectF2 = new RectF(0.0F, 0.0F, getDrawable().getIntrinsicWidth(), getDrawable().getIntrinsicHeight());
    this.a.setRectToRect(localRectF2, localRectF1, Matrix.ScaleToFit.CENTER);
    a();
  }
}

/* Location:           C:\Documents and Settings\Cesar Cabello Cea\Mis documentos\Downloads\apk-downloader\com.ikea.kompis-6_dex2jar.jar
 * Qualified Name:     com.google.android.m4b.maps.bu.m
 * JD-Core Version:    0.6.2
 */