// Path: app/src/main/java/io/github/krtkush/marsexplorer/MarsExplorerApplication.java
// public class MarsExplorerApplication extends Application {
// 
//     // Variable that holds instance of the application class
//     private static MarsExplorerApplication marsExplorerApplicationInstance;
//     // Variable that holds instance of the photos API interface
//     private NASARestApiClient.NASAMarsPhotosApiInterface nasaMarsPhotosApiInterface;
//     // Variable to hold instance of the weather API interface
//     private MarsWeatherClient.MarsWeatherInterface marsWeatherInterface;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
// 
//         marsExplorerApplicationInstance = this;
// 
//         // Initialize the API interfaces.
//         nasaMarsPhotosApiInterface = NASARestApiClient.getNasaMarsPhotosApiInterface();
//         marsWeatherInterface = MarsWeatherClient.getMarsWeatherInterface();
// 
//         // Initialize calligraphy with the preferred font.
//         CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
//                 .setDefaultFontPath("fonts/Lato-Regular.ttf")
//                 .setFontAttrId(R.attr.fontPath)
//                 .build()
//         );
// 
//         // Initialize timber logging tool only if in debug mode.
//         if(BuildConfig.DEBUG)
//             Timber.plant(new Timber.DebugTree());
// 
//         // Initialize picasso cache indicator and logging only if in debug mode.
//         if(BuildConfig.DEBUG) {
//             Picasso
//                     .with(marsExplorerApplicationInstance)
//                     .setIndicatorsEnabled(true);
// 
//             Picasso
//                     .with(marsExplorerApplicationInstance)
//                     .setLoggingEnabled(true);
//         }
// 
//         // Initialize Leak Canary only if in debug mode.
//         if(BuildConfig.DEBUG)
//             LeakCanary.install(this);
// 
//         // Initialize fabric only if NOT in debug mode.
// /*        if(!BuildConfig.DEBUG)
//             Fabric.with(this, new Crashlytics());*/
//     }
// 
//     /**
//      * @return Instance of the application class (App Context)
//      */
//     public static MarsExplorerApplication getApplicationInstance() {
//         return marsExplorerApplicationInstance;
//     }
// 
//     /**
//      * @return Instance of the NASAMarsPhotosApiInterface
//      */
//     public NASARestApiClient.NASAMarsPhotosApiInterface getNasaMarsPhotosApiInterface() {
//         return nasaMarsPhotosApiInterface;
//     }
// 
//     /**
//      * @return Instance of MarsWeatherInterface
//      */
//     public MarsWeatherClient.MarsWeatherInterface getMarsWeatherInterface() {
//         return marsWeatherInterface;
//     }
// }
// 
// 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/RESTClients/DataModels/PhotosJsonDataModels/PhotosResultDM.java
// @AutoValue
// public abstract class PhotosResultDM {
// 
//     /**
//      * List of all the photos and their respective details taken by a rover.
//      */
// 
//     @SerializedName("photos")
//     public abstract List<Photos> photos();
// 
//     public static TypeAdapter<PhotosResultDM> typeAdapter(Gson gson) {
//         return new AutoValue_PhotosResultDM.GsonTypeAdapter(gson);
//     }
// }
// 
// Path: app/src/main/java/io/github/krtkush/marsexplorer/RoverExplorer/RoverExplorerConstants.java
// public class RoverExplorerConstants {
// 
//     // Constants for identifying data being passed via intents
//     public static final String roverNameExtra = "roverName";
//     public static final String roverMaxSolExtra = "maxSol";
//     public static final String roverSolTrackExtra = "solTrack";
// }


import android.os.Bundle;
import android.os.Handler;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import java.util.ArrayList;
import java.util.List;
import io.github.krtkush.marsexplorer.MarsExplorerApplication;
import io.github.krtkush.marsexplorer.R;
import io.github.krtkush.marsexplorer.RESTClients.DataModels.PhotosJsonDataModels.Photos;
import io.github.krtkush.marsexplorer.RESTClients.DataModels.PhotosJsonDataModels.PhotosResultDM;
import io.github.krtkush.marsexplorer.RoverExplorer.RoverExplorerConstants;
import rx.Observable;
import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
import timber.log.Timber;
package io.github.krtkush.marsexplorer.RoverExplorer.ExplorerFragment;




/**
 * Created by kartikeykushwaha on 17/07/16.
 */
public class RoverExplorerPresenterLayer implements RoverExplorerPresenterInteractor {

    private RoverExplorerFragment fragment;
    private String roverName;
    private String roverSol;
    private Subscriber<PhotosResultDM> nasaMarsPhotoSubscriber;

    // Variables related to RecyclerView
    private PhotosRecyclerViewAdapter photosRecyclerViewAdapter;
    // List of all the photos and their respective details
// Path: app/src/main/java/io/github/krtkush/marsexplorer/MarsExplorerApplication.java
// public class MarsExplorerApplication extends Application {
// 
//     // Variable that holds instance of the application class
//     private static MarsExplorerApplication marsExplorerApplicationInstance;
//     // Variable that holds instance of the photos API interface
//     private NASARestApiClient.NASAMarsPhotosApiInterface nasaMarsPhotosApiInterface;
//     // Variable to hold instance of the weather API interface
//     private MarsWeatherClient.MarsWeatherInterface marsWeatherInterface;
// 
//     @Override
//     public void onCreate() {
//         super.onCreate();
// 
//         marsExplorerApplicationInstance = this;
// 
//         // Initialize the API interfaces.
//         nasaMarsPhotosApiInterface = NASARestApiClient.getNasaMarsPhotosApiInterface();
//         marsWeatherInterface = MarsWeatherClient.getMarsWeatherInterface();
// 
//         // Initialize calligraphy with the preferred font.
//         CalligraphyConfig.initDefault(new CalligraphyConfig.Builder()
//                 .setDefaultFontPath("fonts/Lato-Regular.ttf")
//                 .setFontAttrId(R.attr.fontPath)
//                 .build()
//         );
// 
//         // Initialize timber logging tool only if in debug mode.
//         if(BuildConfig.DEBUG)
//             Timber.plant(new Timber.DebugTree());
// 
//         // Initialize picasso cache indicator and logging only if in debug mode.
//         if(BuildConfig.DEBUG) {
//             Picasso
//                     .with(marsExplorerApplicationInstance)
//                     .setIndicatorsEnabled(true);
// 
//             Picasso
//                     .with(marsExplorerApplicationInstance)
//                     .setLoggingEnabled(true);
//         }
// 
//         // Initialize Leak Canary only if in debug mode.
//         if(BuildConfig.DEBUG)
//             LeakCanary.install(this);
// 
//         // Initialize fabric only if NOT in debug mode.
// /*        if(!BuildConfig.DEBUG)
//             Fabric.with(this, new Crashlytics());*/
//     }
// 
//     /**
//      * @return Instance of the application class (App Context)
//      */
//     public static MarsExplorerApplication getApplicationInstance() {
//         return marsExplorerApplicationInstance;
//     }
// 
//     /**
//      * @return Instance of the NASAMarsPhotosApiInterface
//      */
//     public NASARestApiClient.NASAMarsPhotosApiInterface getNasaMarsPhotosApiInterface() {
//         return nasaMarsPhotosApiInterface;
//     }
// 
//     /**
//      * @return Instance of MarsWeatherInterface
//      */
//     public MarsWeatherClient.MarsWeatherInterface getMarsWeatherInterface() {
//         return marsWeatherInterface;
//     }
// }
// 
// 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/RESTClients/DataModels/PhotosJsonDataModels/PhotosResultDM.java
// @AutoValue
// public abstract class PhotosResultDM {
// 
//     /**
//      * List of all the photos and their respective details taken by a rover.
//      */
// 
//     @SerializedName("photos")
//     public abstract List<Photos> photos();
// 
//     public static TypeAdapter<PhotosResultDM> typeAdapter(Gson gson) {
//         return new AutoValue_PhotosResultDM.GsonTypeAdapter(gson);
//     }
// }
// 
// Path: app/src/main/java/io/github/krtkush/marsexplorer/RoverExplorer/RoverExplorerConstants.java
// public class RoverExplorerConstants {
// 
//     // Constants for identifying data being passed via intents
//     public static final String roverNameExtra = "roverName";
//     public static final String roverMaxSolExtra = "maxSol";
//     public static final String roverSolTrackExtra = "solTrack";
// }


// Path: app/src/main/java/io/github/krtkush/marsexplorer/RoverExplorer/ExplorerFragment/RoverExplorerPresenterLayer.java
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.widget.SwipeRefreshLayout;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import java.util.ArrayList;
import java.util.List;
import io.github.krtkush.marsexplorer.MarsExplorerApplication;
import io.github.krtkush.marsexplorer.R;
import io.github.krtkush.marsexplorer.RESTClients.DataModels.PhotosJsonDataModels.Photos;
import io.github.krtkush.marsexplorer.RESTClients.DataModels.PhotosJsonDataModels.PhotosResultDM;
import io.github.krtkush.marsexplorer.RoverExplorer.RoverExplorerConstants;
import rx.Observable;
import rx.Subscriber;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
import timber.log.Timber;

package io.github.krtkush.marsexplorer.RoverExplorer.ExplorerFragment;




/**
 * Created by kartikeykushwaha on 17/07/16.
 */
public class RoverExplorerPresenterLayer implements RoverExplorerPresenterInteractor {

    private RoverExplorerFragment fragment;
    private String roverName;
    private String roverSol;
    private Subscriber<PhotosResultDM> nasaMarsPhotoSubscriber;

    // Variables related to RecyclerView
    private PhotosRecyclerViewAdapter photosRecyclerViewAdapter;
    // List of all the photos and their respective details
    private List<Photos> photoList;