// Path: app/src/main/java/com/lgvalle/beaufitulphotos/interfaces/PhotoModel.java
// public interface PhotoModel extends Parcelable {
// 	Integer getId();
// 	String getSmallUrl();
// 	String getLargeUrl();
// 	String getTitle();
// 	String getAuthorName();
// 	Integer getFavorites();
// 	void setFavorites(Integer favorites);
// }
// 
// Path: app/src/main/java/com/lgvalle/beaufitulphotos/utils/PicassoHelper.java
// public class PicassoHelper {
// 	/**
// 	 * Wrap Picasso. Load url into target. Default callback shows error if something wrong happen.
// 	 *
// 	 * @param url    Photo url
// 	 * @param target ImageView where photo is going to be loaded
// 	 */
// 	public static void load(final Context ctx, String url, ImageView target) {
// 		load(ctx, url, target, new Callback() {
// 			@Override
// 			public void onError() {
// 				Toast.makeText(ctx, ctx.getString(R.string.service_error), Toast.LENGTH_SHORT).show();
// 			}
// 
// 			@Override
// 			public void onSuccess() {
// 				/* Photo loaded. Nothing else to do */
// 			}
// 		});
// 	}
// 
// 	/**
// 	 * Wrap Picasso. Load url into target and execute param callback
// 	 *
// 	 * @param url    Photo url
// 	 * @param target ImageView where photo is going to be loaded
// 	 */
// 	public static void load(Context ctx, String url, ImageView target, Callback callback) {
// 		Picasso.with(ctx).load(url).into(target, callback);
// 	}
// 
// 	/**
// 	 * Wrap Picasso. Load url into target, apply blur transformation and execute param callback
// 	 *
// 	 * @param url      Photo url
// 	 * @param target   ImageView where photo is going to be loaded
// 	 * @param callback Callback executed after image is loaded
// 	 */
// 	public static void loadWithBlur(Context ctx, String url, ImageView target, Callback callback) {
// 		// After loading, execute parameter callback
// 		Picasso.with(ctx).load(url).transform(new BlurTransformation(ctx)).into(target, callback);
// 	}
// }
// 
// Path: app/src/main/java/com/lgvalle/beaufitulphotos/utils/Renderer.java
// public abstract class Renderer<T> {
// 	protected View rootView;
// 	protected T content;
// 
// 	/**
// 	 * Need public empty constructor to build empty renderer
// 	 */
// 	public Renderer() {}
// 
// 	/**
// 	 * Default constructor
// 	 */
// 	protected Renderer(T content) {
// 		this.content = content;
// 	}
// 
// 	/**
// 	 * This method is called by RendererAdapter.
// 	 * <p/>
// 	 * Child classes need to implement this method to bind view with model and provide a view object for them.
// 	 *
// 	 * @return A view representing <b>this.content</b>
// 	 */
// 	public abstract View render(Context ctx);
// 
// 	/**
// 	 * Child classes need to implement this method to provide a concrete renderer for each model object
// 	 *
// 	 * @param content Model object for which concrete renderer is providing a view
// 	 */
// 	protected abstract <T> Renderer create(T content, LayoutInflater inflater, ViewGroup parent);
// 
// 	/**
// 	 * Create or recycle a Renderer
// 	 */
// 	public Renderer build(T content, LayoutInflater inflater, ViewGroup parent, View convertView) {
// 		Renderer r;
// 		if (convertView == null) {
// 			r = create(content, inflater, parent);
// 		} else {
// 			r = (Renderer) convertView.getTag();
// 			r.onRecycle(content);
// 		}
// 
// 		return r;
// 	}
// 
// 	/**
// 	 * When recycling a renderer, you only need to set a new content.
// 	 */
// 	protected void onRecycle(T content) {
// 		this.content = content;
// 	}
// 
// 	/**
// 	 * @return Model object of this renderer
// 	 */
// 	protected T getContent() {
// 		return this.content;
// 	}
// 
// 
// }


import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import butterknife.ButterKnife;
import butterknife.InjectView;
import com.facebook.rebound.*;
import com.lgvalle.beaufitulphotos.R;
import com.lgvalle.beaufitulphotos.interfaces.PhotoModel;
import com.lgvalle.beaufitulphotos.utils.PicassoHelper;
import com.lgvalle.beaufitulphotos.utils.Renderer;
package com.lgvalle.beaufitulphotos.gallery;


/**
 * Created by lgvalle on 21/07/14.
 * <p/>
 * Concrete renderer for photomodel object.
 * <p/>
 * This class binds a concrete view with a concrete object.
 */
public class GalleryItemRenderer extends Renderer<PhotoModel> {
	private static final SpringConfig SPRING_CONFIG = SpringConfig.fromOrigamiTensionAndFriction(10, 10);
	private final Spring mSpring = SpringSystem.create().createSpring().setSpringConfig(SPRING_CONFIG).addListener(new SimpleSpringListener() {
		@Override
		public void onSpringUpdate(Spring spring) {
			// Just tell the UI to update based on the springs current state.
			animate();
		}
	});
	/* Views */
	@InjectView(R.id.photo)
	ImageView ivPhoto;
	@InjectView(R.id.photo_title)
	TextView tvPhotoTitle;

	public GalleryItemRenderer() {
		super();
	}

	private GalleryItemRenderer(PhotoModel content, LayoutInflater inflater, ViewGroup parent) {
		super(content);
		this.rootView = inflater.inflate(R.layout.row_photo, parent, false);
		this.rootView.setTag(this);
		ButterKnife.inject(this, rootView);
	}

	/**
	 * Generate a view for this renderer content.
	 *
	 * @param ctx Context
	 * @return A view representing current content
	 */
	@Override
	public View render(Context ctx) {
		// Load photo
// Path: app/src/main/java/com/lgvalle/beaufitulphotos/interfaces/PhotoModel.java
// public interface PhotoModel extends Parcelable {
// 	Integer getId();
// 	String getSmallUrl();
// 	String getLargeUrl();
// 	String getTitle();
// 	String getAuthorName();
// 	Integer getFavorites();
// 	void setFavorites(Integer favorites);
// }
// 
// Path: app/src/main/java/com/lgvalle/beaufitulphotos/utils/PicassoHelper.java
// public class PicassoHelper {
// 	/**
// 	 * Wrap Picasso. Load url into target. Default callback shows error if something wrong happen.
// 	 *
// 	 * @param url    Photo url
// 	 * @param target ImageView where photo is going to be loaded
// 	 */
// 	public static void load(final Context ctx, String url, ImageView target) {
// 		load(ctx, url, target, new Callback() {
// 			@Override
// 			public void onError() {
// 				Toast.makeText(ctx, ctx.getString(R.string.service_error), Toast.LENGTH_SHORT).show();
// 			}
// 
// 			@Override
// 			public void onSuccess() {
// 				/* Photo loaded. Nothing else to do */
// 			}
// 		});
// 	}
// 
// 	/**
// 	 * Wrap Picasso. Load url into target and execute param callback
// 	 *
// 	 * @param url    Photo url
// 	 * @param target ImageView where photo is going to be loaded
// 	 */
// 	public static void load(Context ctx, String url, ImageView target, Callback callback) {
// 		Picasso.with(ctx).load(url).into(target, callback);
// 	}
// 
// 	/**
// 	 * Wrap Picasso. Load url into target, apply blur transformation and execute param callback
// 	 *
// 	 * @param url      Photo url
// 	 * @param target   ImageView where photo is going to be loaded
// 	 * @param callback Callback executed after image is loaded
// 	 */
// 	public static void loadWithBlur(Context ctx, String url, ImageView target, Callback callback) {
// 		// After loading, execute parameter callback
// 		Picasso.with(ctx).load(url).transform(new BlurTransformation(ctx)).into(target, callback);
// 	}
// }
// 
// Path: app/src/main/java/com/lgvalle/beaufitulphotos/utils/Renderer.java
// public abstract class Renderer<T> {
// 	protected View rootView;
// 	protected T content;
// 
// 	/**
// 	 * Need public empty constructor to build empty renderer
// 	 */
// 	public Renderer() {}
// 
// 	/**
// 	 * Default constructor
// 	 */
// 	protected Renderer(T content) {
// 		this.content = content;
// 	}
// 
// 	/**
// 	 * This method is called by RendererAdapter.
// 	 * <p/>
// 	 * Child classes need to implement this method to bind view with model and provide a view object for them.
// 	 *
// 	 * @return A view representing <b>this.content</b>
// 	 */
// 	public abstract View render(Context ctx);
// 
// 	/**
// 	 * Child classes need to implement this method to provide a concrete renderer for each model object
// 	 *
// 	 * @param content Model object for which concrete renderer is providing a view
// 	 */
// 	protected abstract <T> Renderer create(T content, LayoutInflater inflater, ViewGroup parent);
// 
// 	/**
// 	 * Create or recycle a Renderer
// 	 */
// 	public Renderer build(T content, LayoutInflater inflater, ViewGroup parent, View convertView) {
// 		Renderer r;
// 		if (convertView == null) {
// 			r = create(content, inflater, parent);
// 		} else {
// 			r = (Renderer) convertView.getTag();
// 			r.onRecycle(content);
// 		}
// 
// 		return r;
// 	}
// 
// 	/**
// 	 * When recycling a renderer, you only need to set a new content.
// 	 */
// 	protected void onRecycle(T content) {
// 		this.content = content;
// 	}
// 
// 	/**
// 	 * @return Model object of this renderer
// 	 */
// 	protected T getContent() {
// 		return this.content;
// 	}
// 
// 
// }


// Path: app/src/main/java/com/lgvalle/beaufitulphotos/gallery/GalleryItemRenderer.java
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import butterknife.ButterKnife;
import butterknife.InjectView;
import com.facebook.rebound.*;
import com.lgvalle.beaufitulphotos.R;
import com.lgvalle.beaufitulphotos.interfaces.PhotoModel;
import com.lgvalle.beaufitulphotos.utils.PicassoHelper;
import com.lgvalle.beaufitulphotos.utils.Renderer;

package com.lgvalle.beaufitulphotos.gallery;


/**
 * Created by lgvalle on 21/07/14.
 * <p/>
 * Concrete renderer for photomodel object.
 * <p/>
 * This class binds a concrete view with a concrete object.
 */
public class GalleryItemRenderer extends Renderer<PhotoModel> {
	private static final SpringConfig SPRING_CONFIG = SpringConfig.fromOrigamiTensionAndFriction(10, 10);
	private final Spring mSpring = SpringSystem.create().createSpring().setSpringConfig(SPRING_CONFIG).addListener(new SimpleSpringListener() {
		@Override
		public void onSpringUpdate(Spring spring) {
			// Just tell the UI to update based on the springs current state.
			animate();
		}
	});
	/* Views */
	@InjectView(R.id.photo)
	ImageView ivPhoto;
	@InjectView(R.id.photo_title)
	TextView tvPhotoTitle;

	public GalleryItemRenderer() {
		super();
	}

	private GalleryItemRenderer(PhotoModel content, LayoutInflater inflater, ViewGroup parent) {
		super(content);
		this.rootView = inflater.inflate(R.layout.row_photo, parent, false);
		this.rootView.setTag(this);
		ButterKnife.inject(this, rootView);
	}

	/**
	 * Generate a view for this renderer content.
	 *
	 * @param ctx Context
	 * @return A view representing current content
	 */
	@Override
	public View render(Context ctx) {
		// Load photo
		PicassoHelper.load(ctx, getContent().getSmallUrl(), ivPhoto);