// Path: app/src/main/java/com/nilhcem/droidconde/data/app/DataProvider.java
// @Singleton
// public class DataProvider {
// 
//     private final AppMapper appMapper;
//     private final NetworkMapper networkMapper;
//     private final DroidconService service;
//     private final SpeakersDao speakersDao;
//     private final SessionsDao sessionsDao;
//     private final DataProviderCache cache;
// 
//     @Inject
//     public DataProvider(AppMapper appMapper, NetworkMapper networkMapper, DroidconService service, SpeakersDao speakersDao, SessionsDao sessionsDao) {
//         this.appMapper = appMapper;
//         this.networkMapper = networkMapper;
//         this.service = service;
//         this.speakersDao = speakersDao;
//         this.sessionsDao = sessionsDao;
//         this.cache = new DataProviderCache();
//     }
// 
//     public Observable<Schedule> getSchedule() {
//         sessionsDao.initSelectedSessionsMemory();
//         return getSessions().map(appMapper::toSchedule);
//     }
// 
//     public Observable<List<Speaker>> getSpeakers() {
//         return Observable.create(subscriber -> speakersDao.getSpeakers().subscribe(speakers -> {
//             if (!speakers.isEmpty()) {
//                 subscriber.onNext(speakers);
//             }
// 
//             if (!subscriber.isUnsubscribed()) {
//                 getSpeakersFromNetwork(subscriber);
//             }
//             subscriber.onCompleted();
//         }, subscriber::onError));
//     }
// 
//     private void getSpeakersFromNetwork(Subscriber<? super List<Speaker>> subscriber) {
//         List<Speaker> fromCache = cache.getSpeakers();
//         if (fromCache == null) {
//             service.loadSpeakers()
//                     .map(networkMapper::toAppSpeakers)
//                     .subscribe(speakers -> {
//                         subscriber.onNext(speakers);
//                         speakersDao.saveSpeakers(speakers);
//                         cache.saveSpeakers(speakers);
//                     }, throwable -> Timber.e(throwable, "Error getting speakers from network"));
//         } else {
//             subscriber.onNext(fromCache);
//         }
//     }
// 
//     private Observable<List<Session>> getSessions() {
//         return Observable.create(subscriber -> sessionsDao.getSessions().subscribe(sessions -> {
//             if (!sessions.isEmpty()) {
//                 subscriber.onNext(sessions);
//             }
// 
//             if (!subscriber.isUnsubscribed()) {
//                 getSessionsFromNetwork(subscriber);
//             }
//             subscriber.onCompleted();
//         }, subscriber::onError));
//     }
// 
//     private void getSessionsFromNetwork(Subscriber<? super List<Session>> subscriber) {
//         List<Session> fromCache = cache.getSessions();
//         if (fromCache == null) {
//             Observable.zip(
//                     service.loadSessions(),
//                     getSpeakers().last().map(appMapper::speakersToMap),
//                     networkMapper::toAppSessions)
//                     .subscribe(sessions -> {
//                         subscriber.onNext(sessions);
//                         sessionsDao.saveSessions(sessions);
//                         cache.saveSessions(sessions);
//                     }, throwable -> Timber.e(throwable, "Error getting sessions from network"));
//         } else {
//             subscriber.onNext(fromCache);
//         }
//     }
// }
// 
// Path: app/src/main/java/com/nilhcem/droidconde/data/app/model/Schedule.java
// public class Schedule extends ArrayList<ScheduleDay> implements Parcelable {
// 
//     public static final Parcelable.Creator<Schedule> CREATOR = new Parcelable.Creator<Schedule>() {
//         public Schedule createFromParcel(Parcel source) {
//             return new Schedule(source);
//         }
// 
//         public Schedule[] newArray(int size) {
//             return new Schedule[size];
//         }
//     };
// 
//     public Schedule() {
//     }
// 
//     protected Schedule(Parcel in) {
//         addAll(in.createTypedArrayList(ScheduleDay.CREATOR));
//     }
// 
//     @Override
//     public int describeContents() {
//         return 0;
//     }
// 
//     @Override
//     public void writeToParcel(Parcel dest, int flags) {
//         dest.writeTypedList(this);
//     }
// }
// 
// Path: app/src/main/java/com/nilhcem/droidconde/ui/BaseFragmentPresenter.java
// public abstract class BaseFragmentPresenter<V> extends BasePresenter<V> {
// 
//     public BaseFragmentPresenter(V view) {
//         super(view);
//     }
// 
//     @CallSuper
//     public void onCreate(Bundle savedInstanceState) {
//         if (savedInstanceState != null) {
//             Icepick.restoreInstanceState(this, savedInstanceState);
//         }
//     }
// 
//     public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
//         // Nothing to do by default
//     }
// 
//     public void onStart() {
//         // Nothing to do by default
//     }
// 
//     public void onResume() {
//         // Nothing to do by default
//     }
// 
//     public void onStop() {
//         // Nothing to do by default
//     }
// 
//     @CallSuper
//     public void onSaveInstanceState(Bundle outState) {
//         Icepick.saveInstanceState(this, outState);
//     }
// }


import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import com.nilhcem.droidconde.data.app.DataProvider;
import com.nilhcem.droidconde.data.app.model.Schedule;
import com.nilhcem.droidconde.ui.BaseFragmentPresenter;
import icepick.State;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
import timber.log.Timber;
package com.nilhcem.droidconde.ui.schedule.pager;




public class SchedulePagerPresenter extends BaseFragmentPresenter<SchedulePagerMvp.View> implements SchedulePagerMvp.Presenter {

    @State Schedule schedule;

// Path: app/src/main/java/com/nilhcem/droidconde/data/app/DataProvider.java
// @Singleton
// public class DataProvider {
// 
//     private final AppMapper appMapper;
//     private final NetworkMapper networkMapper;
//     private final DroidconService service;
//     private final SpeakersDao speakersDao;
//     private final SessionsDao sessionsDao;
//     private final DataProviderCache cache;
// 
//     @Inject
//     public DataProvider(AppMapper appMapper, NetworkMapper networkMapper, DroidconService service, SpeakersDao speakersDao, SessionsDao sessionsDao) {
//         this.appMapper = appMapper;
//         this.networkMapper = networkMapper;
//         this.service = service;
//         this.speakersDao = speakersDao;
//         this.sessionsDao = sessionsDao;
//         this.cache = new DataProviderCache();
//     }
// 
//     public Observable<Schedule> getSchedule() {
//         sessionsDao.initSelectedSessionsMemory();
//         return getSessions().map(appMapper::toSchedule);
//     }
// 
//     public Observable<List<Speaker>> getSpeakers() {
//         return Observable.create(subscriber -> speakersDao.getSpeakers().subscribe(speakers -> {
//             if (!speakers.isEmpty()) {
//                 subscriber.onNext(speakers);
//             }
// 
//             if (!subscriber.isUnsubscribed()) {
//                 getSpeakersFromNetwork(subscriber);
//             }
//             subscriber.onCompleted();
//         }, subscriber::onError));
//     }
// 
//     private void getSpeakersFromNetwork(Subscriber<? super List<Speaker>> subscriber) {
//         List<Speaker> fromCache = cache.getSpeakers();
//         if (fromCache == null) {
//             service.loadSpeakers()
//                     .map(networkMapper::toAppSpeakers)
//                     .subscribe(speakers -> {
//                         subscriber.onNext(speakers);
//                         speakersDao.saveSpeakers(speakers);
//                         cache.saveSpeakers(speakers);
//                     }, throwable -> Timber.e(throwable, "Error getting speakers from network"));
//         } else {
//             subscriber.onNext(fromCache);
//         }
//     }
// 
//     private Observable<List<Session>> getSessions() {
//         return Observable.create(subscriber -> sessionsDao.getSessions().subscribe(sessions -> {
//             if (!sessions.isEmpty()) {
//                 subscriber.onNext(sessions);
//             }
// 
//             if (!subscriber.isUnsubscribed()) {
//                 getSessionsFromNetwork(subscriber);
//             }
//             subscriber.onCompleted();
//         }, subscriber::onError));
//     }
// 
//     private void getSessionsFromNetwork(Subscriber<? super List<Session>> subscriber) {
//         List<Session> fromCache = cache.getSessions();
//         if (fromCache == null) {
//             Observable.zip(
//                     service.loadSessions(),
//                     getSpeakers().last().map(appMapper::speakersToMap),
//                     networkMapper::toAppSessions)
//                     .subscribe(sessions -> {
//                         subscriber.onNext(sessions);
//                         sessionsDao.saveSessions(sessions);
//                         cache.saveSessions(sessions);
//                     }, throwable -> Timber.e(throwable, "Error getting sessions from network"));
//         } else {
//             subscriber.onNext(fromCache);
//         }
//     }
// }
// 
// Path: app/src/main/java/com/nilhcem/droidconde/data/app/model/Schedule.java
// public class Schedule extends ArrayList<ScheduleDay> implements Parcelable {
// 
//     public static final Parcelable.Creator<Schedule> CREATOR = new Parcelable.Creator<Schedule>() {
//         public Schedule createFromParcel(Parcel source) {
//             return new Schedule(source);
//         }
// 
//         public Schedule[] newArray(int size) {
//             return new Schedule[size];
//         }
//     };
// 
//     public Schedule() {
//     }
// 
//     protected Schedule(Parcel in) {
//         addAll(in.createTypedArrayList(ScheduleDay.CREATOR));
//     }
// 
//     @Override
//     public int describeContents() {
//         return 0;
//     }
// 
//     @Override
//     public void writeToParcel(Parcel dest, int flags) {
//         dest.writeTypedList(this);
//     }
// }
// 
// Path: app/src/main/java/com/nilhcem/droidconde/ui/BaseFragmentPresenter.java
// public abstract class BaseFragmentPresenter<V> extends BasePresenter<V> {
// 
//     public BaseFragmentPresenter(V view) {
//         super(view);
//     }
// 
//     @CallSuper
//     public void onCreate(Bundle savedInstanceState) {
//         if (savedInstanceState != null) {
//             Icepick.restoreInstanceState(this, savedInstanceState);
//         }
//     }
// 
//     public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
//         // Nothing to do by default
//     }
// 
//     public void onStart() {
//         // Nothing to do by default
//     }
// 
//     public void onResume() {
//         // Nothing to do by default
//     }
// 
//     public void onStop() {
//         // Nothing to do by default
//     }
// 
//     @CallSuper
//     public void onSaveInstanceState(Bundle outState) {
//         Icepick.saveInstanceState(this, outState);
//     }
// }


// Path: app/src/main/java/com/nilhcem/droidconde/ui/schedule/pager/SchedulePagerPresenter.java
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.view.View;
import com.nilhcem.droidconde.data.app.DataProvider;
import com.nilhcem.droidconde.data.app.model.Schedule;
import com.nilhcem.droidconde.ui.BaseFragmentPresenter;
import icepick.State;
import rx.Subscription;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;
import timber.log.Timber;

package com.nilhcem.droidconde.ui.schedule.pager;




public class SchedulePagerPresenter extends BaseFragmentPresenter<SchedulePagerMvp.View> implements SchedulePagerMvp.Presenter {

    @State Schedule schedule;

    private final DataProvider dataProvider;