// Path: app/src/main/java/github/daneren2005/dsub/util/DrawableTint.java
// public class DrawableTint {
// 	private static final Map<Integer, Integer> attrMap = new HashMap<>();
// 	private static final WeakHashMap<Integer, Drawable> tintedDrawables = new WeakHashMap<>();
// 
// 	public static Drawable getTintedDrawable(Context context, @DrawableRes int drawableRes) {
// 		return getTintedDrawable(context, drawableRes, R.attr.colorAccent);
// 	}
// 	public static Drawable getTintedDrawable(Context context, @DrawableRes int drawableRes, @AttrRes int colorAttr) {
// 		if(tintedDrawables.containsKey(drawableRes)) {
// 			return tintedDrawables.get(drawableRes);
// 		}
// 
// 		int color = getColorRes(context, colorAttr);
// 		Drawable background = context.getResources().getDrawable(drawableRes);
// 		background.setColorFilter(color, PorterDuff.Mode.SRC_IN);
// 		tintedDrawables.put(drawableRes, background);
// 		return background;
// 	}
// 	public static Drawable getTintedDrawableFromColor(Context context, @DrawableRes int drawableRes, @ColorRes int colorRes) {
// 		if(tintedDrawables.containsKey(drawableRes)) {
// 			return tintedDrawables.get(drawableRes);
// 		}
// 
// 		int color = context.getResources().getColor(colorRes);
// 		Drawable background = context.getResources().getDrawable(drawableRes);
// 		background.setColorFilter(color, PorterDuff.Mode.SRC_IN);
// 		tintedDrawables.put(drawableRes, background);
// 		return background;
// 	}
// 	public static int getColorRes(Context context, @AttrRes int colorAttr) {
// 		int color;
// 		if(attrMap.containsKey(colorAttr)) {
// 			color = attrMap.get(colorAttr);
// 		} else {
// 			TypedValue typedValue = new TypedValue();
// 			Resources.Theme theme = context.getTheme();
// 			theme.resolveAttribute(colorAttr, typedValue, true);
// 			color = typedValue.data;
// 			attrMap.put(colorAttr, color);
// 		}
// 
// 		return color;
// 	}
// 	public static int getDrawableRes(Context context, @AttrRes int drawableAttr) {
// 		if(attrMap.containsKey(drawableAttr)) {
// 			return attrMap.get(drawableAttr);
// 		} else {
// 			int[] attrs = new int[]{drawableAttr};
// 			TypedArray typedArray = context.obtainStyledAttributes(attrs);
// 			@DrawableRes int drawableRes = typedArray.getResourceId(0, 0);
// 			typedArray.recycle();
// 			attrMap.put(drawableAttr, drawableRes);
// 			return drawableRes;
// 		}
// 	}
// 	public static Drawable getTintedAttrDrawable(Context context, @AttrRes int drawableAttr, @AttrRes int colorAttr) {
// 		if(tintedDrawables.containsKey(drawableAttr)) {
// 			return getTintedDrawable(context, attrMap.get(drawableAttr), colorAttr);
// 		}
// 
// 		@DrawableRes int drawableRes = getDrawableRes(context, drawableAttr);
// 		return getTintedDrawable(context, drawableRes, colorAttr);
// 	}
// 
// 	public static void clearCache() {
// 		attrMap.clear();
// 		tintedDrawables.clear();
// 	}
// }
// 
// Path: app/src/main/java/github/daneren2005/dsub/util/SilentBackgroundTask.java
// public abstract class SilentBackgroundTask<T> extends BackgroundTask<T> {
//     public SilentBackgroundTask(Context context) {
//         super(context);
//     }
// 
//     @Override
//     public void execute() {
// 		queue.offer(task = new Task());
//     }
// 
// 	@Override
// 	protected void done(T result) {
// 		// Don't do anything unless overriden
// 	}
// 
//     @Override
//     public void updateProgress(int messageId) {
//     }
// 
//     @Override
//     public void updateProgress(String message) {
//     }
// }


import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.Looper;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RatingBar;
import java.util.ArrayList;
import java.util.List;
import java.util.WeakHashMap;
import github.daneren2005.dsub.domain.MusicDirectory;
import github.daneren2005.dsub.R;
import github.daneren2005.dsub.util.DrawableTint;
import github.daneren2005.dsub.util.SilentBackgroundTask;
/*
 This file is part of Subsonic.

 Subsonic is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 Subsonic is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with Subsonic.  If not, see <http://www.gnu.org/licenses/>.

 Copyright 2009 (C) Sindre Mehus
 */
package github.daneren2005.dsub.view;




public abstract class UpdateView<T> extends LinearLayout {
	private static final String TAG = UpdateView.class.getSimpleName();
	private static final WeakHashMap<UpdateView, ?> INSTANCES = new WeakHashMap<UpdateView, Object>();

	protected static Handler backgroundHandler;
	protected static Handler uiHandler;
	private static Runnable updateRunnable;
	private static int activeActivities = 0;

	protected Context context;
	protected T item;
	protected RatingBar ratingBar;
	protected ImageButton starButton;
	protected ImageView moreButton;
	protected View coverArtView;
	
	protected boolean exists = false;
	protected boolean pinned = false;
	protected boolean shaded = false;
	protected boolean starred = false;
	protected boolean isStarred = false;
	protected int isRated = 0;
	protected int rating = 0;
// Path: app/src/main/java/github/daneren2005/dsub/util/DrawableTint.java
// public class DrawableTint {
// 	private static final Map<Integer, Integer> attrMap = new HashMap<>();
// 	private static final WeakHashMap<Integer, Drawable> tintedDrawables = new WeakHashMap<>();
// 
// 	public static Drawable getTintedDrawable(Context context, @DrawableRes int drawableRes) {
// 		return getTintedDrawable(context, drawableRes, R.attr.colorAccent);
// 	}
// 	public static Drawable getTintedDrawable(Context context, @DrawableRes int drawableRes, @AttrRes int colorAttr) {
// 		if(tintedDrawables.containsKey(drawableRes)) {
// 			return tintedDrawables.get(drawableRes);
// 		}
// 
// 		int color = getColorRes(context, colorAttr);
// 		Drawable background = context.getResources().getDrawable(drawableRes);
// 		background.setColorFilter(color, PorterDuff.Mode.SRC_IN);
// 		tintedDrawables.put(drawableRes, background);
// 		return background;
// 	}
// 	public static Drawable getTintedDrawableFromColor(Context context, @DrawableRes int drawableRes, @ColorRes int colorRes) {
// 		if(tintedDrawables.containsKey(drawableRes)) {
// 			return tintedDrawables.get(drawableRes);
// 		}
// 
// 		int color = context.getResources().getColor(colorRes);
// 		Drawable background = context.getResources().getDrawable(drawableRes);
// 		background.setColorFilter(color, PorterDuff.Mode.SRC_IN);
// 		tintedDrawables.put(drawableRes, background);
// 		return background;
// 	}
// 	public static int getColorRes(Context context, @AttrRes int colorAttr) {
// 		int color;
// 		if(attrMap.containsKey(colorAttr)) {
// 			color = attrMap.get(colorAttr);
// 		} else {
// 			TypedValue typedValue = new TypedValue();
// 			Resources.Theme theme = context.getTheme();
// 			theme.resolveAttribute(colorAttr, typedValue, true);
// 			color = typedValue.data;
// 			attrMap.put(colorAttr, color);
// 		}
// 
// 		return color;
// 	}
// 	public static int getDrawableRes(Context context, @AttrRes int drawableAttr) {
// 		if(attrMap.containsKey(drawableAttr)) {
// 			return attrMap.get(drawableAttr);
// 		} else {
// 			int[] attrs = new int[]{drawableAttr};
// 			TypedArray typedArray = context.obtainStyledAttributes(attrs);
// 			@DrawableRes int drawableRes = typedArray.getResourceId(0, 0);
// 			typedArray.recycle();
// 			attrMap.put(drawableAttr, drawableRes);
// 			return drawableRes;
// 		}
// 	}
// 	public static Drawable getTintedAttrDrawable(Context context, @AttrRes int drawableAttr, @AttrRes int colorAttr) {
// 		if(tintedDrawables.containsKey(drawableAttr)) {
// 			return getTintedDrawable(context, attrMap.get(drawableAttr), colorAttr);
// 		}
// 
// 		@DrawableRes int drawableRes = getDrawableRes(context, drawableAttr);
// 		return getTintedDrawable(context, drawableRes, colorAttr);
// 	}
// 
// 	public static void clearCache() {
// 		attrMap.clear();
// 		tintedDrawables.clear();
// 	}
// }
// 
// Path: app/src/main/java/github/daneren2005/dsub/util/SilentBackgroundTask.java
// public abstract class SilentBackgroundTask<T> extends BackgroundTask<T> {
//     public SilentBackgroundTask(Context context) {
//         super(context);
//     }
// 
//     @Override
//     public void execute() {
// 		queue.offer(task = new Task());
//     }
// 
// 	@Override
// 	protected void done(T result) {
// 		// Don't do anything unless overriden
// 	}
// 
//     @Override
//     public void updateProgress(int messageId) {
//     }
// 
//     @Override
//     public void updateProgress(String message) {
//     }
// }


// Path: app/src/main/java/github/daneren2005/dsub/view/UpdateView.java
import android.content.Context;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.Looper;
import android.support.v7.widget.RecyclerView;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AbsListView;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RatingBar;
import java.util.ArrayList;
import java.util.List;
import java.util.WeakHashMap;
import github.daneren2005.dsub.domain.MusicDirectory;
import github.daneren2005.dsub.R;
import github.daneren2005.dsub.util.DrawableTint;
import github.daneren2005.dsub.util.SilentBackgroundTask;

/*
 This file is part of Subsonic.

 Subsonic is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 Subsonic is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with Subsonic.  If not, see <http://www.gnu.org/licenses/>.

 Copyright 2009 (C) Sindre Mehus
 */
package github.daneren2005.dsub.view;




public abstract class UpdateView<T> extends LinearLayout {
	private static final String TAG = UpdateView.class.getSimpleName();
	private static final WeakHashMap<UpdateView, ?> INSTANCES = new WeakHashMap<UpdateView, Object>();

	protected static Handler backgroundHandler;
	protected static Handler uiHandler;
	private static Runnable updateRunnable;
	private static int activeActivities = 0;

	protected Context context;
	protected T item;
	protected RatingBar ratingBar;
	protected ImageButton starButton;
	protected ImageView moreButton;
	protected View coverArtView;
	
	protected boolean exists = false;
	protected boolean pinned = false;
	protected boolean shaded = false;
	protected boolean starred = false;
	protected boolean isStarred = false;
	protected int isRated = 0;
	protected int rating = 0;
	protected SilentBackgroundTask<Void> imageTask = null;