content: package com.alium.orin.glide;
  
  import android.graphics.drawable.Drawable;
  import android.widget.ImageView;
  
  import com.alium.orin.glide.palette.BitmapPaletteWrapper;
  import com.alium.orin.util.PhonographColorUtil;
  import com.bumptech.glide.request.animation.GlideAnimation;
  import com.kabouzeid.appthemehelper.util.ATHUtil;
  import com.alium.orin.R;
  import com.alium.orin.glide.palette.BitmapPaletteTarget;
  
  public abstract class PhonographColoredTarget extends BitmapPaletteTarget {
      public PhonographColoredTarget(ImageView view) {
          super(view);
      }
  
      @Override
      public void onLoadFailed(Exception e, Drawable errorDrawable) {
          super.onLoadFailed(e, errorDrawable);
          onColorReady(getDefaultFooterColor());
      }
  
      @Override
      public void onResourceReady(BitmapPaletteWrapper resource, GlideAnimation<? super BitmapPaletteWrapper> glideAnimation) {
          super.onResourceReady(resource, glideAnimation);
          onColorReady(PhonographColorUtil.getColor(resource.getPalette(), getDefaultFooterColor()));
      }
  
      protected int getDefaultFooterColor() {
          return ATHUtil.resolveColor(getView().getContext(), R.attr.defaultFooterColor);
      }
  
      protected int getAlbumArtistFooterColor() {
          return ATHUtil.resolveColor(getView().getContext(), R.attr.cardBackgroundColor);
      }
  
      public abstract void onColorReady(int color);
  }
  