AvatarBuilderPreviewFlash.java 4.96 KB
package com.bitstrips.imoji.abv3.preview;

import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.support.annotation.Keep;
import android.support.annotation.NonNull;

public class AvatarBuilderPreviewFlash
{
  private final AvatarBuilderPreviewView a;
  private final int b;
  private float c;
  private float d;
  private float e;
  private float f;
  private final Drawable g;
  private AnimatorSet h;
  private int i;
  
  AvatarBuilderPreviewFlash(@NonNull AvatarBuilderPreviewView paramAvatarBuilderPreviewView)
  {
    this.a = paramAvatarBuilderPreviewView;
    paramAvatarBuilderPreviewView = this.a.getResources();
    this.g = paramAvatarBuilderPreviewView.getDrawable(2130837607);
    this.b = paramAvatarBuilderPreviewView.getDimensionPixelSize(2131361921);
  }
  
  private void a()
  {
    ObjectAnimator localObjectAnimator1 = ObjectAnimator.ofFloat(this, "flashOpacityA", new float[] { 0.0F, 0.9F, 0.0F });
    localObjectAnimator1.setDuration(200L);
    localObjectAnimator1.setStartDelay(100L);
    ObjectAnimator localObjectAnimator2 = ObjectAnimator.ofFloat(this, "flashOpacityB", new float[] { 0.0F, 0.8F, 0.0F });
    localObjectAnimator2.setDuration(200L);
    localObjectAnimator2.setStartDelay(200L);
    ObjectAnimator localObjectAnimator3 = ObjectAnimator.ofFloat(this, "flashOpacityC", new float[] { 0.0F, 0.65F, 0.0F });
    localObjectAnimator3.setDuration(200L);
    localObjectAnimator3.setStartDelay(300L);
    ObjectAnimator localObjectAnimator4 = ObjectAnimator.ofFloat(this, "flashOpacityD", new float[] { 0.0F, 0.75F, 0.0F });
    localObjectAnimator4.setDuration(200L);
    localObjectAnimator4.setStartDelay(400L);
    ValueAnimator localValueAnimator = ValueAnimator.ofFloat(new float[] { 0.0F, 1.0F });
    localValueAnimator.setDuration(600L);
    localValueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener()
    {
      public final void onAnimationUpdate(ValueAnimator paramAnonymousValueAnimator)
      {
        AvatarBuilderPreviewFlash.a(AvatarBuilderPreviewFlash.this).invalidate();
      }
    });
    this.h = new AnimatorSet();
    this.h.playTogether(new Animator[] { localObjectAnimator1, localObjectAnimator2, localObjectAnimator3, localObjectAnimator4, localValueAnimator });
    this.h.start();
    this.h.addListener(new AnimatorListenerAdapter()
    {
      public final void onAnimationEnd(Animator paramAnonymousAnimator)
      {
        super.onAnimationEnd(paramAnonymousAnimator);
        AvatarBuilderPreviewFlash.b(AvatarBuilderPreviewFlash.this);
        if ((AvatarBuilderPreviewFlash.c(AvatarBuilderPreviewFlash.this) < 3) && (AvatarBuilderPreviewFlash.d(AvatarBuilderPreviewFlash.this) == paramAnonymousAnimator)) {
          AvatarBuilderPreviewFlash.e(AvatarBuilderPreviewFlash.this);
        }
      }
    });
  }
  
  private void a(Canvas paramCanvas, float paramFloat1, float paramFloat2, float paramFloat3)
  {
    if (this.h == null) {
      return;
    }
    int j = (int)paramFloat1;
    int k = (int)paramFloat1;
    int m = this.b;
    int n = (int)paramFloat2;
    int i1 = (int)paramFloat2;
    int i2 = this.b;
    this.g.setBounds(j, n, k + m, i1 + i2);
    this.g.setAlpha((int)(255.0F * paramFloat3));
    this.g.draw(paramCanvas);
  }
  
  public void draw(Canvas paramCanvas)
  {
    float f1 = paramCanvas.getWidth();
    float f2 = paramCanvas.getHeight();
    float f3 = this.b / 2;
    a(paramCanvas, f1 - this.b, 0.0F, this.c);
    a(paramCanvas, 0.0F, f2 - this.b, this.d);
    a(paramCanvas, f1 - f3, (f2 - this.b) / 2.0F, this.e);
    a(paramCanvas, -f3, -f3, this.f);
  }
  
  @Keep
  public float getFlashOpacityA()
  {
    return this.c;
  }
  
  @Keep
  public float getFlashOpacityB()
  {
    return this.d;
  }
  
  @Keep
  public float getFlashOpacityC()
  {
    return this.e;
  }
  
  @Keep
  public float getFlashOpacityD()
  {
    return this.f;
  }
  
  @Keep
  public void setFlashOpacityA(float paramFloat)
  {
    this.c = paramFloat;
  }
  
  @Keep
  public void setFlashOpacityB(float paramFloat)
  {
    this.d = paramFloat;
  }
  
  @Keep
  public void setFlashOpacityC(float paramFloat)
  {
    this.e = paramFloat;
  }
  
  @Keep
  public void setFlashOpacityD(float paramFloat)
  {
    this.f = paramFloat;
  }
  
  public void startAnimation()
  {
    stopAnimation();
    a();
  }
  
  public void stopAnimation()
  {
    if (this.h != null)
    {
      this.h.cancel();
      this.h = null;
    }
    this.c = 0.0F;
    this.d = 0.0F;
    this.e = 0.0F;
    this.f = 0.0F;
    this.i = 0;
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/com/bitstrips/imoji/abv3/preview/AvatarBuilderPreviewFlash.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */