// Path: app/src/main/java/io/github/droidkaigi/confsched2017/repository/sessions/MySessionsRepository.java
// @Singleton
// public class MySessionsRepository implements MySessionsDataSource {
// 
//     private final MySessionsDataSource localDataSource;
// 
//     private Map<Integer, MySession> cachedMySessions;
// 
//     @Inject
//     public MySessionsRepository(MySessionsLocalDataSource localDataSource) {
//         this.localDataSource = localDataSource;
//         this.cachedMySessions = new LinkedHashMap<>();
//     }
// 
//     @Override
//     public Single<List<MySession>> findAll() {
//         if (cachedMySessions != null && !cachedMySessions.isEmpty()) {
//             return Single.create(emitter -> {
//                 emitter.onSuccess(new ArrayList<>(cachedMySessions.values()));
//             });
//         }
// 
//         return localDataSource.findAll().doOnSuccess(this::refreshCache);
//     }
// 
//     @Override
//     public Completable save(@NonNull Session session) {
//         cachedMySessions.put(session.id, new MySession(session));
//         return localDataSource.save(session);
//     }
// 
//     @Override
//     public Single<Integer> delete(@NonNull Session session) {
//         cachedMySessions.remove(session.id);
//         return localDataSource.delete(session);
//     }
// 
//     @Override
//     public boolean isExist(int sessionId) {
//         return localDataSource.isExist(sessionId);
//     }
// 
//     private void refreshCache(List<MySession> mySessions) {
//         if (cachedMySessions == null) {
//             cachedMySessions = new LinkedHashMap<>();
//         }
//         cachedMySessions.clear();
//         for (MySession mySession : mySessions) {
//             cachedMySessions.put(mySession.session.id, mySession);
//         }
//     }
// }
// 
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/view/helper/Navigator.java
// @ActivityScope
// public class Navigator {
// 
//     private final Activity activity;
// 
//     @Inject
//     public Navigator(AppCompatActivity activity) {
//         this.activity = activity;
//     }
// 
//     public void navigateToSessionDetail(@NonNull Session session, @Nullable Class<? extends Activity> parentClass) {
//         activity.startActivity(SessionDetailActivity.createIntent(activity, session.id, parentClass));
//     }
// 
//     public void navigateToFeedbackPage(@NonNull Session session) {
//         activity.startActivity(SessionFeedbackActivity.createIntent(activity, session.id));
//     }
// 
//     public void navigateToSponsorsPage() {
//         activity.startActivity(SponsorsActivity.createIntent(activity));
//     }
// 
//     public void navigateToContributorsPage() {
//         activity.startActivity(ContributorsActivity.createIntent(activity));
//     }
// 
//     public void navigateToLicensePage() {
//         activity.startActivity(LicensesActivity.createIntent(activity));
//     }
// 
//     public void navigateToWebPage(@NonNull String url) {
//         if (TextUtils.isEmpty(url) || !URLUtil.isNetworkUrl(url)) {
//             return;
//         }
// 
//         CustomTabsIntent intent = new CustomTabsIntent.Builder()
//                 .setShowTitle(true)
//                 .setToolbarColor(ContextCompat.getColor(activity, R.color.theme))
//                 .build();
// 
//         intent.launchUrl(activity, Uri.parse(url));
//     }
// 
//     public void showConfirmDialog(@StringRes int titleResId, @StringRes int messageResId,
//             @NonNull ConfirmDialogListener listener) {
//         new AlertDialog.Builder(activity, R.style.DialogTheme)
//                 .setTitle(titleResId)
//                 .setMessage(messageResId)
//                 .setPositiveButton(android.R.string.ok, (dialogInterface, i) -> listener.onClickPositiveButton())
//                 .setNegativeButton(android.R.string.cancel, (dialogInterface, i) -> listener.onClickNegativeButton())
//                 .show();
//     }
// 
//     public interface ConfirmDialogListener {
// 
//         void onClickPositiveButton();
// 
//         void onClickNegativeButton();
//     }
// 
// }


import com.annimon.stream.Stream;
import android.content.Context;
import android.databinding.BaseObservable;
import android.support.annotation.NonNull;
import android.view.View;
import java.util.List;
import java.util.Locale;
import javax.inject.Inject;
import io.github.droidkaigi.confsched2017.model.Session;
import io.github.droidkaigi.confsched2017.repository.sessions.MySessionsRepository;
import io.github.droidkaigi.confsched2017.repository.sessions.SessionsRepository;
import io.github.droidkaigi.confsched2017.view.helper.Navigator;
import io.reactivex.Single;
package io.github.droidkaigi.confsched2017.viewmodel;






public final class SearchViewModel extends BaseObservable implements ViewModel {

    private final Navigator navigator;

    private SessionsRepository sessionsRepository;

    private MySessionsRepository mySessionsRepository;

    private Callback callback;

    @Inject
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/repository/sessions/MySessionsRepository.java
// @Singleton
// public class MySessionsRepository implements MySessionsDataSource {
// 
//     private final MySessionsDataSource localDataSource;
// 
//     private Map<Integer, MySession> cachedMySessions;
// 
//     @Inject
//     public MySessionsRepository(MySessionsLocalDataSource localDataSource) {
//         this.localDataSource = localDataSource;
//         this.cachedMySessions = new LinkedHashMap<>();
//     }
// 
//     @Override
//     public Single<List<MySession>> findAll() {
//         if (cachedMySessions != null && !cachedMySessions.isEmpty()) {
//             return Single.create(emitter -> {
//                 emitter.onSuccess(new ArrayList<>(cachedMySessions.values()));
//             });
//         }
// 
//         return localDataSource.findAll().doOnSuccess(this::refreshCache);
//     }
// 
//     @Override
//     public Completable save(@NonNull Session session) {
//         cachedMySessions.put(session.id, new MySession(session));
//         return localDataSource.save(session);
//     }
// 
//     @Override
//     public Single<Integer> delete(@NonNull Session session) {
//         cachedMySessions.remove(session.id);
//         return localDataSource.delete(session);
//     }
// 
//     @Override
//     public boolean isExist(int sessionId) {
//         return localDataSource.isExist(sessionId);
//     }
// 
//     private void refreshCache(List<MySession> mySessions) {
//         if (cachedMySessions == null) {
//             cachedMySessions = new LinkedHashMap<>();
//         }
//         cachedMySessions.clear();
//         for (MySession mySession : mySessions) {
//             cachedMySessions.put(mySession.session.id, mySession);
//         }
//     }
// }
// 
// Path: app/src/main/java/io/github/droidkaigi/confsched2017/view/helper/Navigator.java
// @ActivityScope
// public class Navigator {
// 
//     private final Activity activity;
// 
//     @Inject
//     public Navigator(AppCompatActivity activity) {
//         this.activity = activity;
//     }
// 
//     public void navigateToSessionDetail(@NonNull Session session, @Nullable Class<? extends Activity> parentClass) {
//         activity.startActivity(SessionDetailActivity.createIntent(activity, session.id, parentClass));
//     }
// 
//     public void navigateToFeedbackPage(@NonNull Session session) {
//         activity.startActivity(SessionFeedbackActivity.createIntent(activity, session.id));
//     }
// 
//     public void navigateToSponsorsPage() {
//         activity.startActivity(SponsorsActivity.createIntent(activity));
//     }
// 
//     public void navigateToContributorsPage() {
//         activity.startActivity(ContributorsActivity.createIntent(activity));
//     }
// 
//     public void navigateToLicensePage() {
//         activity.startActivity(LicensesActivity.createIntent(activity));
//     }
// 
//     public void navigateToWebPage(@NonNull String url) {
//         if (TextUtils.isEmpty(url) || !URLUtil.isNetworkUrl(url)) {
//             return;
//         }
// 
//         CustomTabsIntent intent = new CustomTabsIntent.Builder()
//                 .setShowTitle(true)
//                 .setToolbarColor(ContextCompat.getColor(activity, R.color.theme))
//                 .build();
// 
//         intent.launchUrl(activity, Uri.parse(url));
//     }
// 
//     public void showConfirmDialog(@StringRes int titleResId, @StringRes int messageResId,
//             @NonNull ConfirmDialogListener listener) {
//         new AlertDialog.Builder(activity, R.style.DialogTheme)
//                 .setTitle(titleResId)
//                 .setMessage(messageResId)
//                 .setPositiveButton(android.R.string.ok, (dialogInterface, i) -> listener.onClickPositiveButton())
//                 .setNegativeButton(android.R.string.cancel, (dialogInterface, i) -> listener.onClickNegativeButton())
//                 .show();
//     }
// 
//     public interface ConfirmDialogListener {
// 
//         void onClickPositiveButton();
// 
//         void onClickNegativeButton();
//     }
// 
// }


// Path: app/src/main/java/io/github/droidkaigi/confsched2017/viewmodel/SearchViewModel.java
import com.annimon.stream.Stream;
import android.content.Context;
import android.databinding.BaseObservable;
import android.support.annotation.NonNull;
import android.view.View;
import java.util.List;
import java.util.Locale;
import javax.inject.Inject;
import io.github.droidkaigi.confsched2017.model.Session;
import io.github.droidkaigi.confsched2017.repository.sessions.MySessionsRepository;
import io.github.droidkaigi.confsched2017.repository.sessions.SessionsRepository;
import io.github.droidkaigi.confsched2017.view.helper.Navigator;
import io.reactivex.Single;

package io.github.droidkaigi.confsched2017.viewmodel;






public final class SearchViewModel extends BaseObservable implements ViewModel {

    private final Navigator navigator;

    private SessionsRepository sessionsRepository;

    private MySessionsRepository mySessionsRepository;

    private Callback callback;

    @Inject
    SearchViewModel(Navigator navigator, SessionsRepository sessionsRepository, MySessionsRepository mySessionsRepository) {