/**
  * As {@code setCurrent}, but without invalidating a drawable. Subclasses are responsible to call
  * {@code invalidateSelf} on their own.
  *
  * @param newDelegate
  * @return the previous delegate
  */
 protected Drawable setCurrentWithoutInvalidate(Drawable newDelegate) {
   Drawable previousDelegate = mCurrentDelegate;
   DrawableUtils.setCallbacks(previousDelegate, null, null);
   DrawableUtils.setCallbacks(newDelegate, null, null);
   DrawableUtils.setDrawableProperties(newDelegate, mDrawableProperties);
   DrawableUtils.copyProperties(newDelegate, previousDelegate);
   DrawableUtils.setCallbacks(newDelegate, this, this);
   mCurrentDelegate = newDelegate;
   return previousDelegate;
 }
 /**
  * Constructs a new layer drawable.
  *
  * @param layers the layers that this drawable displays
  */
 public ArrayDrawable(Drawable[] layers) {
   Preconditions.checkNotNull(layers);
   mLayers = layers;
   for (int i = 0; i < mLayers.length; i++) {
     DrawableUtils.setCallbacks(mLayers[i], this, this);
   }
   mDrawableParents = new DrawableParent[mLayers.length];
 }
  /** Sets a new drawable at the specified index, and return the previous drawable, if any. */
  @Nullable
  public Drawable setDrawable(int index, @Nullable Drawable drawable) {
    Preconditions.checkArgument(index >= 0);
    Preconditions.checkArgument(index < mLayers.length);
    final Drawable oldDrawable = mLayers[index];
    if (drawable != oldDrawable) {
      if (drawable != null && mIsMutated) {
        drawable.mutate();
      }

      DrawableUtils.setCallbacks(mLayers[index], null, null);
      DrawableUtils.setCallbacks(drawable, null, null);
      DrawableUtils.setDrawableProperties(drawable, mDrawableProperties);
      DrawableUtils.copyProperties(drawable, this);
      DrawableUtils.setCallbacks(drawable, this, this);
      mIsStatefulCalculated = false;
      mLayers[index] = drawable;
      invalidateSelf();
    }
    return oldDrawable;
  }
 private static void setPorterDuffColorFilter(
     Drawable paramDrawable, int paramInt, PorterDuff.Mode paramMode) {
   Drawable localDrawable = paramDrawable;
   if (DrawableUtils.canSafelyMutateDrawable(paramDrawable)) {
     localDrawable = paramDrawable.mutate();
   }
   paramDrawable = paramMode;
   if (paramMode == null) {
     paramDrawable = DEFAULT_MODE;
   }
   localDrawable.setColorFilter(getPorterDuffColorFilter(paramInt, paramDrawable));
 }
 public Drawable getDrawable(Context paramContext, int paramInt, boolean paramBoolean) {
   Object localObject2 = loadDrawableFromDelegates(paramContext, paramInt);
   Object localObject1 = localObject2;
   if (localObject2 == null) {
     localObject1 = android.support.v4.content.a.a(paramContext, paramInt);
   }
   localObject2 = localObject1;
   if (localObject1 != null) {
     localObject2 = tintDrawable(paramContext, paramInt, paramBoolean, (Drawable) localObject1);
   }
   if (localObject2 != null) {
     DrawableUtils.fixDrawable((Drawable) localObject2);
   }
   return (Drawable) localObject2;
 }
 private static boolean tintDrawableUsingColorFilter(
     Context paramContext, int paramInt, Drawable paramDrawable) {
   PorterDuff.Mode localMode = DEFAULT_MODE;
   int i;
   int j;
   if (arrayContains(COLORFILTER_TINT_COLOR_CONTROL_NORMAL, paramInt)) {
     i = R.attr.colorControlNormal;
     j = 1;
     paramInt = -1;
   }
   for (; ; ) {
     if (j != 0) {
       Drawable localDrawable = paramDrawable;
       if (DrawableUtils.canSafelyMutateDrawable(paramDrawable)) {
         localDrawable = paramDrawable.mutate();
       }
       localDrawable.setColorFilter(
           getPorterDuffColorFilter(ThemeUtils.getThemeAttrColor(paramContext, i), localMode));
       if (paramInt != -1) {
         localDrawable.setAlpha(paramInt);
       }
       return true;
       if (arrayContains(COLORFILTER_COLOR_CONTROL_ACTIVATED, paramInt)) {
         i = R.attr.colorControlActivated;
         j = 1;
         paramInt = -1;
         continue;
       }
       if (arrayContains(COLORFILTER_COLOR_BACKGROUND_MULTIPLY, paramInt)) {
         localMode = PorterDuff.Mode.MULTIPLY;
         j = 1;
         i = 16842801;
         paramInt = -1;
         continue;
       }
       if (paramInt == R.drawable.abc_list_divider_mtrl_alpha) {
         i = 16842800;
         paramInt = Math.round(40.8F);
         j = 1;
       }
     } else {
       return false;
     }
     paramInt = -1;
     i = 0;
     j = 0;
   }
 }
 public static void tintDrawable(
     Drawable paramDrawable, TintInfo paramTintInfo, int[] paramArrayOfInt) {
   if ((DrawableUtils.canSafelyMutateDrawable(paramDrawable))
       && (paramDrawable.mutate() != paramDrawable)) {
     Log.d("AppCompatDrawableManager", "Mutated drawable is not the same instance as the input.");
   }
   label63:
   label91:
   label103:
   for (; ; ) {
     return;
     ColorStateList localColorStateList;
     if ((mHasTintList) || (mHasTintMode)) {
       if (mHasTintList) {
         localColorStateList = mTintList;
         if (!mHasTintMode) {
           break label91;
         }
         paramTintInfo = mTintMode;
         paramDrawable.setColorFilter(
             createTintFilter(localColorStateList, paramTintInfo, paramArrayOfInt));
       }
     }
     for (; ; ) {
       if (Build.VERSION.SDK_INT > 23) {
         break label103;
       }
       paramDrawable.invalidateSelf();
       return;
       localColorStateList = null;
       break;
       paramTintInfo = DEFAULT_MODE;
       break label63;
       paramDrawable.clearColorFilter();
     }
   }
 }
 private Drawable tintDrawable(
     Context paramContext, int paramInt, boolean paramBoolean, Drawable paramDrawable) {
   Object localObject = getTintList(paramContext, paramInt);
   if (localObject != null) {
     paramContext = paramDrawable;
     if (DrawableUtils.canSafelyMutateDrawable(paramDrawable)) {
       paramContext = paramDrawable.mutate();
     }
     paramContext = android.support.v4.b.a.a.f(paramContext);
     android.support.v4.b.a.a.a(paramContext, (ColorStateList) localObject);
     paramDrawable = getTintMode(paramInt);
     localObject = paramContext;
     if (paramDrawable != null) {
       android.support.v4.b.a.a.a(paramContext, paramDrawable);
       localObject = paramContext;
     }
   }
   do {
     do {
       return (Drawable) localObject;
       if (paramInt == R.drawable.abc_cab_background_top_material) {
         return new LayerDrawable(
             new Drawable[] {
               getDrawable(paramContext, R.drawable.abc_cab_background_internal_bg),
               getDrawable(paramContext, R.drawable.abc_cab_background_top_mtrl_alpha)
             });
       }
       if (paramInt == R.drawable.abc_seekbar_track_material) {
         localObject = (LayerDrawable) paramDrawable;
         setPorterDuffColorFilter(
             ((LayerDrawable) localObject).findDrawableByLayerId(16908288),
             ThemeUtils.getThemeAttrColor(paramContext, R.attr.colorControlNormal),
             DEFAULT_MODE);
         setPorterDuffColorFilter(
             ((LayerDrawable) localObject).findDrawableByLayerId(16908303),
             ThemeUtils.getThemeAttrColor(paramContext, R.attr.colorControlNormal),
             DEFAULT_MODE);
         setPorterDuffColorFilter(
             ((LayerDrawable) localObject).findDrawableByLayerId(16908301),
             ThemeUtils.getThemeAttrColor(paramContext, R.attr.colorControlActivated),
             DEFAULT_MODE);
         return paramDrawable;
       }
       if ((paramInt == R.drawable.abc_ratingbar_indicator_material)
           || (paramInt == R.drawable.abc_ratingbar_small_material)) {
         localObject = (LayerDrawable) paramDrawable;
         setPorterDuffColorFilter(
             ((LayerDrawable) localObject).findDrawableByLayerId(16908288),
             ThemeUtils.getDisabledThemeAttrColor(paramContext, R.attr.colorControlNormal),
             DEFAULT_MODE);
         setPorterDuffColorFilter(
             ((LayerDrawable) localObject).findDrawableByLayerId(16908303),
             ThemeUtils.getThemeAttrColor(paramContext, R.attr.colorControlActivated),
             DEFAULT_MODE);
         setPorterDuffColorFilter(
             ((LayerDrawable) localObject).findDrawableByLayerId(16908301),
             ThemeUtils.getThemeAttrColor(paramContext, R.attr.colorControlActivated),
             DEFAULT_MODE);
         return paramDrawable;
       }
       localObject = paramDrawable;
     } while (tintDrawableUsingColorFilter(paramContext, paramInt, paramDrawable));
     localObject = paramDrawable;
   } while (!paramBoolean);
   return null;
 }
 /**
  * Constructs a new forwarding drawable.
  *
  * @param drawable drawable that this forwarding drawable will forward to
  */
 public ForwardingDrawable(Drawable drawable) {
   mCurrentDelegate = drawable;
   DrawableUtils.setCallbacks(mCurrentDelegate, this, this);
 }