// Path: mvvm-life-cycle/src/main/java/me/henrytao/mvvmlifecycle/MVVMLifeCycle.java
// public interface MVVMLifeCycle {
// 
//   void onActivityResult(int requestCode, int resultCode, Intent data);
// 
//   void onCreate();
// 
//   void onCreateView();
// 
//   void onDestroy();
// 
//   void onDestroyView();
// 
//   void onPause();
// 
//   void onRestoreInstanceState(Bundle savedInstanceState);
// 
//   void onResume();
// 
//   void onSaveInstanceState(Bundle outState);
// 
//   void onStart();
// 
//   void onStop();
// }
// 
// Path: mvvm-life-cycle/src/main/java/me/henrytao/mvvmlifecycle/rx/SubscriptionManager.java
// public class SubscriptionManager implements ISubscriptionManager {
// 
//   private Map<UnsubscribeLifeCycle, Map<String, Subscription>> mSubscriptions;
// 
//   public SubscriptionManager() {
//     mSubscriptions = new HashMap<>();
//   }
// 
//   @Override
//   public void manageSubscription(Subscription subscription, UnsubscribeLifeCycle unsubscribeLifeCycle) {
//     manageSubscription(UUID.randomUUID().toString(), subscription, unsubscribeLifeCycle);
//   }
// 
//   @Override
//   public void manageSubscription(String id, Subscription subscription, UnsubscribeLifeCycle unsubscribeLifeCycle) {
//     Map<String, Subscription> subscriptions = getSubscriptions(unsubscribeLifeCycle);
//     if (subscriptions.containsKey(id)) {
//       unsubscribe(id);
//     }
//     subscriptions.put(id, subscription);
//   }
// 
//   @Override
//   public void unsubscribe(UnsubscribeLifeCycle unsubscribeLifeCycle) {
//     unsubscribe(getSubscriptions(unsubscribeLifeCycle));
//   }
// 
//   @Override
//   public void unsubscribe() {
//     for (Map.Entry<UnsubscribeLifeCycle, Map<String, Subscription>> entry : mSubscriptions.entrySet()) {
//       unsubscribe(entry.getValue());
//     }
//     mSubscriptions.clear();
//   }
// 
//   @Override
//   public void unsubscribe(String id) {
//     for (Map.Entry<UnsubscribeLifeCycle, Map<String, Subscription>> entry : mSubscriptions.entrySet()) {
//       unsubscribe(entry.getValue().get(id));
//     }
//   }
// 
//   private Map<String, Subscription> getSubscriptions(UnsubscribeLifeCycle unsubscribeLifeCycle) {
//     Map<String, Subscription> subscriptions = mSubscriptions.get(unsubscribeLifeCycle);
//     if (subscriptions == null) {
//       subscriptions = new HashMap<>();
//       mSubscriptions.put(unsubscribeLifeCycle, subscriptions);
//     }
//     return subscriptions;
//   }
// 
//   private void unsubscribe(Map<String, Subscription> subscriptions) {
//     for (Map.Entry<String, Subscription> entry : subscriptions.entrySet()) {
//       unsubscribe(entry.getValue());
//     }
//     subscriptions.clear();
//   }
// 
//   private void unsubscribe(Subscription subscription) {
//     if (subscription != null && !subscription.isUnsubscribed()) {
//       subscription.unsubscribe();
//     }
//   }
// }
// 
// Path: mvvm-life-cycle/src/main/java/me/henrytao/mvvmlifecycle/rx/UnsubscribeLifeCycle.java
// public enum UnsubscribeLifeCycle {
//   PAUSE,
//   STOP,
//   DESTROY_VIEW,
//   DESTROY
// }


import android.content.Intent;
import android.databinding.BaseObservable;
import android.os.Bundle;
import me.henrytao.mvvmlifecycle.MVVMLifeCycle;
import me.henrytao.mvvmlifecycle.rx.SubscriptionManager;
import me.henrytao.mvvmlifecycle.rx.UnsubscribeLifeCycle;
import rx.Subscription;
/*
 * Copyright 2016 "Henry Tao <hi@henrytao.me>"
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package me.henrytao.mvvmlifecycle.viewmodel;



/**
 * Created by henrytao on 4/24/16.
 */
public class SimpleViewModel extends BaseObservable implements MVVMLifeCycle {

  private boolean mIsDestroy;

  private boolean mIsDestroyView;

  private boolean mIsPause;

  private boolean mIsStop;

// Path: mvvm-life-cycle/src/main/java/me/henrytao/mvvmlifecycle/MVVMLifeCycle.java
// public interface MVVMLifeCycle {
// 
//   void onActivityResult(int requestCode, int resultCode, Intent data);
// 
//   void onCreate();
// 
//   void onCreateView();
// 
//   void onDestroy();
// 
//   void onDestroyView();
// 
//   void onPause();
// 
//   void onRestoreInstanceState(Bundle savedInstanceState);
// 
//   void onResume();
// 
//   void onSaveInstanceState(Bundle outState);
// 
//   void onStart();
// 
//   void onStop();
// }
// 
// Path: mvvm-life-cycle/src/main/java/me/henrytao/mvvmlifecycle/rx/SubscriptionManager.java
// public class SubscriptionManager implements ISubscriptionManager {
// 
//   private Map<UnsubscribeLifeCycle, Map<String, Subscription>> mSubscriptions;
// 
//   public SubscriptionManager() {
//     mSubscriptions = new HashMap<>();
//   }
// 
//   @Override
//   public void manageSubscription(Subscription subscription, UnsubscribeLifeCycle unsubscribeLifeCycle) {
//     manageSubscription(UUID.randomUUID().toString(), subscription, unsubscribeLifeCycle);
//   }
// 
//   @Override
//   public void manageSubscription(String id, Subscription subscription, UnsubscribeLifeCycle unsubscribeLifeCycle) {
//     Map<String, Subscription> subscriptions = getSubscriptions(unsubscribeLifeCycle);
//     if (subscriptions.containsKey(id)) {
//       unsubscribe(id);
//     }
//     subscriptions.put(id, subscription);
//   }
// 
//   @Override
//   public void unsubscribe(UnsubscribeLifeCycle unsubscribeLifeCycle) {
//     unsubscribe(getSubscriptions(unsubscribeLifeCycle));
//   }
// 
//   @Override
//   public void unsubscribe() {
//     for (Map.Entry<UnsubscribeLifeCycle, Map<String, Subscription>> entry : mSubscriptions.entrySet()) {
//       unsubscribe(entry.getValue());
//     }
//     mSubscriptions.clear();
//   }
// 
//   @Override
//   public void unsubscribe(String id) {
//     for (Map.Entry<UnsubscribeLifeCycle, Map<String, Subscription>> entry : mSubscriptions.entrySet()) {
//       unsubscribe(entry.getValue().get(id));
//     }
//   }
// 
//   private Map<String, Subscription> getSubscriptions(UnsubscribeLifeCycle unsubscribeLifeCycle) {
//     Map<String, Subscription> subscriptions = mSubscriptions.get(unsubscribeLifeCycle);
//     if (subscriptions == null) {
//       subscriptions = new HashMap<>();
//       mSubscriptions.put(unsubscribeLifeCycle, subscriptions);
//     }
//     return subscriptions;
//   }
// 
//   private void unsubscribe(Map<String, Subscription> subscriptions) {
//     for (Map.Entry<String, Subscription> entry : subscriptions.entrySet()) {
//       unsubscribe(entry.getValue());
//     }
//     subscriptions.clear();
//   }
// 
//   private void unsubscribe(Subscription subscription) {
//     if (subscription != null && !subscription.isUnsubscribed()) {
//       subscription.unsubscribe();
//     }
//   }
// }
// 
// Path: mvvm-life-cycle/src/main/java/me/henrytao/mvvmlifecycle/rx/UnsubscribeLifeCycle.java
// public enum UnsubscribeLifeCycle {
//   PAUSE,
//   STOP,
//   DESTROY_VIEW,
//   DESTROY
// }


// Path: mvvm-life-cycle/src/main/java/me/henrytao/mvvmlifecycle/viewmodel/SimpleViewModel.java
import android.content.Intent;
import android.databinding.BaseObservable;
import android.os.Bundle;
import me.henrytao.mvvmlifecycle.MVVMLifeCycle;
import me.henrytao.mvvmlifecycle.rx.SubscriptionManager;
import me.henrytao.mvvmlifecycle.rx.UnsubscribeLifeCycle;
import rx.Subscription;

/*
 * Copyright 2016 "Henry Tao <hi@henrytao.me>"
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package me.henrytao.mvvmlifecycle.viewmodel;



/**
 * Created by henrytao on 4/24/16.
 */
public class SimpleViewModel extends BaseObservable implements MVVMLifeCycle {

  private boolean mIsDestroy;

  private boolean mIsDestroyView;

  private boolean mIsPause;

  private boolean mIsStop;

  private SubscriptionManager mSubscriptionManager = new SubscriptionManager();