// Path: mvvm-life-cycle/src/main/java/me/henrytao/mvvmlifecycle/rx/UnsubscribeLifeCycle.java
// public enum UnsubscribeLifeCycle {
//   PAUSE,
//   STOP,
//   DESTROY_VIEW,
//   DESTROY
// }
// 
// Path: sample/src/main/java/me/henrytao/mvvmlifecycledemo/ui/base/BaseActivity.java
// public abstract class BaseActivity extends MVVMActivity {
// 
// }
// 
// Path: sample/src/main/java/me/henrytao/mvvmlifecycledemo/ui/base/Constants.java
// public class Constants {
// 
//   public interface Animation {
// 
//     int LONG = 600;
//     int MEDIUM = 400;
//     int SHORT = 200;
//   }
// 
//   public interface Extra {
// 
//     String ID = "ID";
//   }
// 
//   public interface Key {
// 
//     String ID = "ID";
//     String INDEX = "INDEX";
//   }
// }


import me.henrytao.mvvmlifecycledemo.ui.base.Constants;
import android.content.Context;
import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.text.TextUtils;
import android.view.Menu;
import android.view.MenuItem;
import me.henrytao.mdcore.utils.ResourceUtils;
import me.henrytao.mvvmlifecycle.rx.UnsubscribeLifeCycle;
import me.henrytao.mvvmlifecycledemo.R;
import me.henrytao.mvvmlifecycledemo.databinding.TaskAddEditActivityBinding;
import me.henrytao.mvvmlifecycledemo.ui.base.BaseActivity;
/*
 * 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.mvvmlifecycledemo.ui.taskaddedit;



/**
 * Created by henrytao on 4/2/16.
 */
public class TaskAddEditActivity extends BaseActivity {

  public static Intent newIntent(Context context) {
    return newIntent(context, null);
  }

  public static Intent newIntent(Context context, String taskId) {
    Intent intent = new Intent(context, TaskAddEditActivity.class);
    Bundle bundle = new Bundle();
    bundle.putString(Constants.Extra.ID, taskId);
    intent.putExtras(bundle);
    return intent;
  }

  private TaskAddEditActivityBinding mBinding;

  private TaskAddEditViewModel mViewModel;

  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.menu_task_add_edit, menu);
    ResourceUtils.supportDrawableTint(this, menu, ResourceUtils.Palette.PRIMARY);
    return super.onCreateOptionsMenu(menu);
  }

  @Override
  public void onInitializeViewModels() {
    Bundle bundle = getIntent().getExtras();
// Path: mvvm-life-cycle/src/main/java/me/henrytao/mvvmlifecycle/rx/UnsubscribeLifeCycle.java
// public enum UnsubscribeLifeCycle {
//   PAUSE,
//   STOP,
//   DESTROY_VIEW,
//   DESTROY
// }
// 
// Path: sample/src/main/java/me/henrytao/mvvmlifecycledemo/ui/base/BaseActivity.java
// public abstract class BaseActivity extends MVVMActivity {
// 
// }
// 
// Path: sample/src/main/java/me/henrytao/mvvmlifecycledemo/ui/base/Constants.java
// public class Constants {
// 
//   public interface Animation {
// 
//     int LONG = 600;
//     int MEDIUM = 400;
//     int SHORT = 200;
//   }
// 
//   public interface Extra {
// 
//     String ID = "ID";
//   }
// 
//   public interface Key {
// 
//     String ID = "ID";
//     String INDEX = "INDEX";
//   }
// }


// Path: sample/src/main/java/me/henrytao/mvvmlifecycledemo/ui/taskaddedit/TaskAddEditActivity.java
import me.henrytao.mvvmlifecycledemo.ui.base.Constants;
import android.content.Context;
import android.content.Intent;
import android.databinding.DataBindingUtil;
import android.os.Bundle;
import android.support.design.widget.Snackbar;
import android.text.TextUtils;
import android.view.Menu;
import android.view.MenuItem;
import me.henrytao.mdcore.utils.ResourceUtils;
import me.henrytao.mvvmlifecycle.rx.UnsubscribeLifeCycle;
import me.henrytao.mvvmlifecycledemo.R;
import me.henrytao.mvvmlifecycledemo.databinding.TaskAddEditActivityBinding;
import me.henrytao.mvvmlifecycledemo.ui.base.BaseActivity;

/*
 * 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.mvvmlifecycledemo.ui.taskaddedit;



/**
 * Created by henrytao on 4/2/16.
 */
public class TaskAddEditActivity extends BaseActivity {

  public static Intent newIntent(Context context) {
    return newIntent(context, null);
  }

  public static Intent newIntent(Context context, String taskId) {
    Intent intent = new Intent(context, TaskAddEditActivity.class);
    Bundle bundle = new Bundle();
    bundle.putString(Constants.Extra.ID, taskId);
    intent.putExtras(bundle);
    return intent;
  }

  private TaskAddEditActivityBinding mBinding;

  private TaskAddEditViewModel mViewModel;

  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.menu_task_add_edit, menu);
    ResourceUtils.supportDrawableTint(this, menu, ResourceUtils.Palette.PRIMARY);
    return super.onCreateOptionsMenu(menu);
  }

  @Override
  public void onInitializeViewModels() {
    Bundle bundle = getIntent().getExtras();
    String taskId = bundle.getString(Constants.Extra.ID);