// Path: app/src/main/java/io/github/krtkush/marsexplorer/RESTClients/DataModels/PhotosJsonDataModels/Photos.java
// @AutoValue
// public abstract class Photos {
// 
//     /**
//      *Details of the image taken by the rover
//      */
// 
//     @SerializedName("id")
//     public abstract Integer id();
// 
//     @SerializedName("sol")
//     public abstract Integer sol();
// 
//     @SerializedName("img_src")
//     public abstract String imgSource();
// 
//     @SerializedName("earth_date")
//     public abstract String earthDate();
// 
//     @SerializedName("rover")
//     public abstract Rover rover();
// 
//     @SerializedName("camera")
//     public abstract Camera camera();
// 
//     public static TypeAdapter<Photos> typeAdapter(Gson gson) {
//         return new AutoValue_Photos.GsonTypeAdapter(gson);
//     }
// }
// 
// Path: app/src/main/java/io/github/krtkush/marsexplorer/RoverExplorer/ExpandedPhoto/ExpandedPhotosConstants.java
// public class ExpandedPhotosConstants {
// 
//     // Constants for identifying data being passed via intents
//     public static final String imageUrl = "ImageUrl";
// }
// 
// Path: app/src/main/java/io/github/krtkush/marsexplorer/RoverExplorer/ExpandedPhoto/PhotoExpandedViewActivity.java
// public class PhotoExpandedViewActivity extends AppCompatActivity {
// 
//     @BindView(R.id.expandedPhotoHolder) ImageView expandedPhotoHolder;
// 
//     private PhotoExpandedViewInteractor presenterInteractor;
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_photo_expanded_view);
// 
//         // Initialise butterknife, timber and the presenter layer
//         ButterKnife.bind(PhotoExpandedViewActivity.this);
//         Timber.tag(PhotoExpandedViewActivity.this.getClass().getSimpleName());
//         presenterInteractor = new PhotoExpandedViewPresenterLayer(this);
// 
//         // Fetch the url of the image to be displayed and then show that image.
//         presenterInteractor.getImageUrl();
//     }
// 
//     /**
//      * Set the images.
//      * @param imagePath
//      */
//     protected void setImage(String imagePath) {
// 
//         ActivityCompat.postponeEnterTransition(this);
//         Picasso.with(this.getApplicationContext())
//                 .load(imagePath)
//                 .fit()
//                 .centerCrop()
//                 .placeholder(R.drawable.square_placeholder)
//                 .into(expandedPhotoHolder, new Callback() {
//                     @Override
//                     public void onSuccess() {
//                         ActivityCompat
//                                 .startPostponedEnterTransition(PhotoExpandedViewActivity.this);
//                     }
// 
//                     @Override
//                     public void onError() {
//                         ActivityCompat
//                                 .startPostponedEnterTransition(PhotoExpandedViewActivity.this);
//                     }
//                 });
//     }
// }


import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AlphaAnimation;
import android.view.animation.AnimationSet;
import android.view.animation.TranslateAnimation;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.squareup.picasso.Callback;
import com.squareup.picasso.Picasso;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import io.github.krtkush.marsexplorer.R;
import io.github.krtkush.marsexplorer.RESTClients.DataModels.PhotosJsonDataModels.Photos;
import io.github.krtkush.marsexplorer.RoverExplorer.ExpandedPhoto.ExpandedPhotosConstants;
import io.github.krtkush.marsexplorer.RoverExplorer.ExpandedPhoto.PhotoExpandedViewActivity;
        AlphaAnimation alphaAnimation = new AlphaAnimation(0.2f, 1.0f);
        alphaAnimation.setDuration(1500);

        // Prepare the scroll effect
        TranslateAnimation scrollAnimation = new TranslateAnimation(0.0f, 0.0f, 1000.0f, 0.0f);
        scrollAnimation.setDuration(700);

        // Consolidate all the animations
        AnimationSet animationSet = new AnimationSet(true);
        animationSet.addAnimation(alphaAnimation);
        animationSet.addAnimation(scrollAnimation);

        view.startAnimation(animationSet);
    }

    @Override
    public int getItemCount() {
        return photos.size();
    }

    @Override
    public void onViewDetachedFromWindow(RecyclerView.ViewHolder holder) {
        super.onViewDetachedFromWindow(holder);

        holder.itemView.clearAnimation();
    }

    public class PhotosViewHolder extends RecyclerView.ViewHolder {

        @BindView(R.id.photoHolderLayout) RelativeLayout photoHolderLayout;
// Path: app/src/main/java/io/github/krtkush/marsexplorer/RESTClients/DataModels/PhotosJsonDataModels/Photos.java
// @AutoValue
// public abstract class Photos {
// 
//     /**
//      *Details of the image taken by the rover
//      */
// 
//     @SerializedName("id")
//     public abstract Integer id();
// 
//     @SerializedName("sol")
//     public abstract Integer sol();
// 
//     @SerializedName("img_src")
//     public abstract String imgSource();
// 
//     @SerializedName("earth_date")
//     public abstract String earthDate();
// 
//     @SerializedName("rover")
//     public abstract Rover rover();
// 
//     @SerializedName("camera")
//     public abstract Camera camera();
// 
//     public static TypeAdapter<Photos> typeAdapter(Gson gson) {
//         return new AutoValue_Photos.GsonTypeAdapter(gson);
//     }
// }
// 
// Path: app/src/main/java/io/github/krtkush/marsexplorer/RoverExplorer/ExpandedPhoto/ExpandedPhotosConstants.java
// public class ExpandedPhotosConstants {
// 
//     // Constants for identifying data being passed via intents
//     public static final String imageUrl = "ImageUrl";
// }
// 
// Path: app/src/main/java/io/github/krtkush/marsexplorer/RoverExplorer/ExpandedPhoto/PhotoExpandedViewActivity.java
// public class PhotoExpandedViewActivity extends AppCompatActivity {
// 
//     @BindView(R.id.expandedPhotoHolder) ImageView expandedPhotoHolder;
// 
//     private PhotoExpandedViewInteractor presenterInteractor;
// 
//     @Override
//     protected void onCreate(Bundle savedInstanceState) {
//         super.onCreate(savedInstanceState);
//         setContentView(R.layout.activity_photo_expanded_view);
// 
//         // Initialise butterknife, timber and the presenter layer
//         ButterKnife.bind(PhotoExpandedViewActivity.this);
//         Timber.tag(PhotoExpandedViewActivity.this.getClass().getSimpleName());
//         presenterInteractor = new PhotoExpandedViewPresenterLayer(this);
// 
//         // Fetch the url of the image to be displayed and then show that image.
//         presenterInteractor.getImageUrl();
//     }
// 
//     /**
//      * Set the images.
//      * @param imagePath
//      */
//     protected void setImage(String imagePath) {
// 
//         ActivityCompat.postponeEnterTransition(this);
//         Picasso.with(this.getApplicationContext())
//                 .load(imagePath)
//                 .fit()
//                 .centerCrop()
//                 .placeholder(R.drawable.square_placeholder)
//                 .into(expandedPhotoHolder, new Callback() {
//                     @Override
//                     public void onSuccess() {
//                         ActivityCompat
//                                 .startPostponedEnterTransition(PhotoExpandedViewActivity.this);
//                     }
// 
//                     @Override
//                     public void onError() {
//                         ActivityCompat
//                                 .startPostponedEnterTransition(PhotoExpandedViewActivity.this);
//                     }
//                 });
//     }
// }


// Path: app/src/main/java/io/github/krtkush/marsexplorer/RoverExplorer/ExplorerFragment/PhotosRecyclerViewAdapter.java
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AlphaAnimation;
import android.view.animation.AnimationSet;
import android.view.animation.TranslateAnimation;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.squareup.picasso.Callback;
import com.squareup.picasso.Picasso;
import java.util.List;
import butterknife.BindView;
import butterknife.ButterKnife;
import io.github.krtkush.marsexplorer.R;
import io.github.krtkush.marsexplorer.RESTClients.DataModels.PhotosJsonDataModels.Photos;
import io.github.krtkush.marsexplorer.RoverExplorer.ExpandedPhoto.ExpandedPhotosConstants;
import io.github.krtkush.marsexplorer.RoverExplorer.ExpandedPhoto.PhotoExpandedViewActivity;

        AlphaAnimation alphaAnimation = new AlphaAnimation(0.2f, 1.0f);
        alphaAnimation.setDuration(1500);

        // Prepare the scroll effect
        TranslateAnimation scrollAnimation = new TranslateAnimation(0.0f, 0.0f, 1000.0f, 0.0f);
        scrollAnimation.setDuration(700);

        // Consolidate all the animations
        AnimationSet animationSet = new AnimationSet(true);
        animationSet.addAnimation(alphaAnimation);
        animationSet.addAnimation(scrollAnimation);

        view.startAnimation(animationSet);
    }

    @Override
    public int getItemCount() {
        return photos.size();
    }

    @Override
    public void onViewDetachedFromWindow(RecyclerView.ViewHolder holder) {
        super.onViewDetachedFromWindow(holder);

        holder.itemView.clearAnimation();
    }

    public class PhotosViewHolder extends RecyclerView.ViewHolder {

        @BindView(R.id.photoHolderLayout) RelativeLayout photoHolderLayout;
        @BindView(R.id.photoHolder) ImageView photoHolder;