gd.java 4.85 KB
import android.content.res.ColorStateList;
import android.graphics.PorterDuff.Mode;
import android.graphics.drawable.Drawable;
import android.os.Build.VERSION;
import android.support.v4.view.ViewCompat;
import android.support.v7.appcompat.R.styleable;
import android.support.v7.widget.AppCompatDrawableManager;
import android.support.v7.widget.DrawableUtils;
import android.support.v7.widget.TintTypedArray;
import android.util.AttributeSet;
import android.view.View;

public final class gd
{
  private final View a;
  private final AppCompatDrawableManager b;
  private int c = -1;
  private ha d;
  private ha e;
  private ha f;
  
  public gd(View paramView)
  {
    this.a = paramView;
    this.b = AppCompatDrawableManager.get();
  }
  
  private void b(ColorStateList paramColorStateList)
  {
    if (paramColorStateList != null)
    {
      if (this.d == null) {
        this.d = new ha();
      }
      this.d.a = paramColorStateList;
      this.d.d = true;
    }
    for (;;)
    {
      d();
      return;
      this.d = null;
    }
  }
  
  public final void a()
  {
    this.c = -1;
    b(null);
    d();
  }
  
  public final void a(int paramInt)
  {
    this.c = paramInt;
    if (this.b != null) {}
    for (ColorStateList localColorStateList = this.b.b(this.a.getContext(), paramInt);; localColorStateList = null)
    {
      b(localColorStateList);
      d();
      return;
    }
  }
  
  public final void a(ColorStateList paramColorStateList)
  {
    if (this.e == null) {
      this.e = new ha();
    }
    this.e.a = paramColorStateList;
    this.e.d = true;
    d();
  }
  
  public final void a(PorterDuff.Mode paramMode)
  {
    if (this.e == null) {
      this.e = new ha();
    }
    this.e.b = paramMode;
    this.e.c = true;
    d();
  }
  
  public final void a(AttributeSet paramAttributeSet, int paramInt)
  {
    paramAttributeSet = TintTypedArray.obtainStyledAttributes(this.a.getContext(), paramAttributeSet, R.styleable.ViewBackgroundHelper, paramInt, 0);
    try
    {
      if (paramAttributeSet.hasValue(R.styleable.ViewBackgroundHelper_android_background))
      {
        this.c = paramAttributeSet.getResourceId(R.styleable.ViewBackgroundHelper_android_background, -1);
        ColorStateList localColorStateList = this.b.b(this.a.getContext(), this.c);
        if (localColorStateList != null) {
          b(localColorStateList);
        }
      }
      if (paramAttributeSet.hasValue(R.styleable.ViewBackgroundHelper_backgroundTint)) {
        ViewCompat.setBackgroundTintList(this.a, paramAttributeSet.getColorStateList(R.styleable.ViewBackgroundHelper_backgroundTint));
      }
      if (paramAttributeSet.hasValue(R.styleable.ViewBackgroundHelper_backgroundTintMode)) {
        ViewCompat.setBackgroundTintMode(this.a, DrawableUtils.a(paramAttributeSet.getInt(R.styleable.ViewBackgroundHelper_backgroundTintMode, -1), null));
      }
      return;
    }
    finally
    {
      paramAttributeSet.recycle();
    }
  }
  
  public final ColorStateList b()
  {
    if (this.e != null) {
      return this.e.a;
    }
    return null;
  }
  
  public final PorterDuff.Mode c()
  {
    if (this.e != null) {
      return this.e.b;
    }
    return null;
  }
  
  public final void d()
  {
    int j = 0;
    Drawable localDrawable = this.a.getBackground();
    int i;
    if (localDrawable != null)
    {
      i = Build.VERSION.SDK_INT;
      if (i < 21) {
        break label188;
      }
      if (i != 21) {
        break label176;
      }
      i = 1;
      if (i == 0) {
        break label193;
      }
      if (this.f == null) {
        this.f = new ha();
      }
      ha localha = this.f;
      localha.a = null;
      localha.d = false;
      localha.b = null;
      localha.c = false;
      Object localObject = ViewCompat.getBackgroundTintList(this.a);
      if (localObject != null)
      {
        localha.d = true;
        localha.a = ((ColorStateList)localObject);
      }
      localObject = ViewCompat.getBackgroundTintMode(this.a);
      if (localObject != null)
      {
        localha.c = true;
        localha.b = ((PorterDuff.Mode)localObject);
      }
      if (!localha.d)
      {
        i = j;
        if (!localha.c) {}
      }
      else
      {
        AppCompatDrawableManager.a(localDrawable, localha, this.a.getDrawableState());
        i = 1;
      }
      if (i == 0) {
        break label193;
      }
    }
    label176:
    label188:
    label193:
    do
    {
      return;
      if (this.d != null)
      {
        i = 1;
        break;
      }
      i = 0;
      break;
      if (this.e != null)
      {
        AppCompatDrawableManager.a(localDrawable, this.e, this.a.getDrawableState());
        return;
      }
    } while (this.d == null);
    AppCompatDrawableManager.a(localDrawable, this.d, this.a.getDrawableState());
  }
}


/* Location:              /home/merong/decompile/hackery-dex2jar.jar!/gd.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */