// Path: app/src/main/java/gdg/devfest/passwordmanager/framework/Navigator.java
// public class Navigator {
//   protected final AppCompatActivity activity;
// 
//   public Navigator(AppCompatActivity activity) {
//     this.activity = activity;
//   }
// 
//   public void startCreatePassword() {
//     activity.startActivity(new Intent(activity, PasswordCreateActivity.class));
//   }
// 
//   public void finish() {
//     activity.finish();
//   }
// 
//   public void startReadPassword(int passwordId) {
//     activity.startActivity(
//         new Intent(activity, PasswordReadActivity.class).putExtra("id", passwordId));
//   }
// 
//   public void startUpdatePassword(int passwordId) {
//     activity.startActivity(
//         new Intent(activity, PasswordUpdateActivity.class).putExtra("id", passwordId));
//   }
// 
//   public void startChooseIcon(IconSelectDialog.OnIconSelectedListener onIconSelectedListener) {
//     new IconSelectDialog.Builder(activity).setIcons(Icons.ALL)
//         .setTitle("Choose icon")
//         .setSortIconsByName(true)
//         .setOnIconSelectedListener(onIconSelectedListener)
//         .build()
//         .show(activity.getSupportFragmentManager(), "icons");
//   }
// 
//   public void startCreateCustomField(
//       CustomFieldDialog.OnCustomFieldSubmitListener customFieldSubmitListener) {
//     CustomFieldDialog.newInstance("Create custom field", "", "", customFieldSubmitListener, null)
//         .show(activity.getSupportFragmentManager(), "field");
//   }
// 
//   public void startUpdateCustomField(String name, String value,
//       CustomFieldDialog.OnCustomFieldSubmitListener customFieldSubmitListener,
//       CustomFieldDialog.OnCustomFieldDeleteListener customFieldDeleteListener) {
//     CustomFieldDialog.newInstance("Update custom field", name, value, customFieldSubmitListener,
//         customFieldDeleteListener).show(activity.getSupportFragmentManager(), "field");
//   }
// }
// 
// Path: app/src/main/java/gdg/devfest/passwordmanager/model/Password.java
// public class Password extends RealmObject {
//   @PrimaryKey private int id;
//   private String icon;
//   private String name;
//   private String userName;
//   private String password;
//   private RealmList<CustomField> customFields;
// 
//   public Password() {
//   }
// 
//   public Password(int id, String icon, String name, String userName, String password,
//       List<CustomField> customFields) {
//     this.id = id;
//     this.icon = icon;
//     this.name = name;
//     this.userName = userName;
//     this.password = password;
//     this.customFields = new RealmList<>();
//     this.customFields.addAll(customFields);
//   }
// 
//   public int getId() {
//     return id;
//   }
// 
//   public void setId(int id) {
//     this.id = id;
//   }
// 
//   public String getIcon() {
//     return icon;
//   }
// 
//   public void setIcon(String icon) {
//     this.icon = icon;
//   }
// 
//   public String getName() {
//     return name;
//   }
// 
//   public void setName(String name) {
//     this.name = name;
//   }
// 
//   public String getUserName() {
//     return userName;
//   }
// 
//   public void setUserName(String userName) {
//     this.userName = userName;
//   }
// 
//   public String getPassword() {
//     return password;
//   }
// 
//   public void setPassword(String password) {
//     this.password = password;
//   }
// 
//   public RealmList<CustomField> getCustomFields() {
//     return customFields;
//   }
// 
//   public void setCustomFields(RealmList<CustomField> customFields) {
//     this.customFields = customFields;
//   }
// 
//   //Custom equals is necessary since Realm returns proxy objects
//   @Override public boolean equals(Object obj) {
//     if (!(obj instanceof Password)) return false;
// 
//     Password password = (Password) obj;
// 
//     //TODO: verify equality of CustomFields
// 
//     return this.getId() == password.getId() && this.getIcon().equals(password.getIcon())
//         && this.getName().equals(password.getName()) && this.getUserName()
//         .equals(password.getUserName()) && this.getPassword().equals(password.getPassword());
//   }
// 
//   //TODO: hashCode
// }


import android.databinding.ObservableField;
import android.databinding.ObservableInt;
import android.support.annotation.NonNull;
import gdg.devfest.passwordmanager.framework.Navigator;
import gdg.devfest.passwordmanager.model.Password;
import java.util.ArrayList;
import java.util.List;
package gdg.devfest.passwordmanager.viewmodel;


public class PasswordItemViewModel implements ViewModel {
  private final Navigator navigator;

  public final ObservableInt id;
  public final ObservableField<String> icon;
  public final ObservableField<String> name;
  public final ObservableField<String> userName;

  PasswordItemViewModel(Navigator navigator, int id, String icon, String name, String username) {
    this.navigator = navigator;
    this.id = new ObservableInt(id);
    this.icon = new ObservableField<>(icon);
    this.name = new ObservableField<>(name);
    this.userName = new ObservableField<>(username);
  }

// Path: app/src/main/java/gdg/devfest/passwordmanager/framework/Navigator.java
// public class Navigator {
//   protected final AppCompatActivity activity;
// 
//   public Navigator(AppCompatActivity activity) {
//     this.activity = activity;
//   }
// 
//   public void startCreatePassword() {
//     activity.startActivity(new Intent(activity, PasswordCreateActivity.class));
//   }
// 
//   public void finish() {
//     activity.finish();
//   }
// 
//   public void startReadPassword(int passwordId) {
//     activity.startActivity(
//         new Intent(activity, PasswordReadActivity.class).putExtra("id", passwordId));
//   }
// 
//   public void startUpdatePassword(int passwordId) {
//     activity.startActivity(
//         new Intent(activity, PasswordUpdateActivity.class).putExtra("id", passwordId));
//   }
// 
//   public void startChooseIcon(IconSelectDialog.OnIconSelectedListener onIconSelectedListener) {
//     new IconSelectDialog.Builder(activity).setIcons(Icons.ALL)
//         .setTitle("Choose icon")
//         .setSortIconsByName(true)
//         .setOnIconSelectedListener(onIconSelectedListener)
//         .build()
//         .show(activity.getSupportFragmentManager(), "icons");
//   }
// 
//   public void startCreateCustomField(
//       CustomFieldDialog.OnCustomFieldSubmitListener customFieldSubmitListener) {
//     CustomFieldDialog.newInstance("Create custom field", "", "", customFieldSubmitListener, null)
//         .show(activity.getSupportFragmentManager(), "field");
//   }
// 
//   public void startUpdateCustomField(String name, String value,
//       CustomFieldDialog.OnCustomFieldSubmitListener customFieldSubmitListener,
//       CustomFieldDialog.OnCustomFieldDeleteListener customFieldDeleteListener) {
//     CustomFieldDialog.newInstance("Update custom field", name, value, customFieldSubmitListener,
//         customFieldDeleteListener).show(activity.getSupportFragmentManager(), "field");
//   }
// }
// 
// Path: app/src/main/java/gdg/devfest/passwordmanager/model/Password.java
// public class Password extends RealmObject {
//   @PrimaryKey private int id;
//   private String icon;
//   private String name;
//   private String userName;
//   private String password;
//   private RealmList<CustomField> customFields;
// 
//   public Password() {
//   }
// 
//   public Password(int id, String icon, String name, String userName, String password,
//       List<CustomField> customFields) {
//     this.id = id;
//     this.icon = icon;
//     this.name = name;
//     this.userName = userName;
//     this.password = password;
//     this.customFields = new RealmList<>();
//     this.customFields.addAll(customFields);
//   }
// 
//   public int getId() {
//     return id;
//   }
// 
//   public void setId(int id) {
//     this.id = id;
//   }
// 
//   public String getIcon() {
//     return icon;
//   }
// 
//   public void setIcon(String icon) {
//     this.icon = icon;
//   }
// 
//   public String getName() {
//     return name;
//   }
// 
//   public void setName(String name) {
//     this.name = name;
//   }
// 
//   public String getUserName() {
//     return userName;
//   }
// 
//   public void setUserName(String userName) {
//     this.userName = userName;
//   }
// 
//   public String getPassword() {
//     return password;
//   }
// 
//   public void setPassword(String password) {
//     this.password = password;
//   }
// 
//   public RealmList<CustomField> getCustomFields() {
//     return customFields;
//   }
// 
//   public void setCustomFields(RealmList<CustomField> customFields) {
//     this.customFields = customFields;
//   }
// 
//   //Custom equals is necessary since Realm returns proxy objects
//   @Override public boolean equals(Object obj) {
//     if (!(obj instanceof Password)) return false;
// 
//     Password password = (Password) obj;
// 
//     //TODO: verify equality of CustomFields
// 
//     return this.getId() == password.getId() && this.getIcon().equals(password.getIcon())
//         && this.getName().equals(password.getName()) && this.getUserName()
//         .equals(password.getUserName()) && this.getPassword().equals(password.getPassword());
//   }
// 
//   //TODO: hashCode
// }


// Path: app/src/main/java/gdg/devfest/passwordmanager/viewmodel/PasswordItemViewModel.java
import android.databinding.ObservableField;
import android.databinding.ObservableInt;
import android.support.annotation.NonNull;
import gdg.devfest.passwordmanager.framework.Navigator;
import gdg.devfest.passwordmanager.model.Password;
import java.util.ArrayList;
import java.util.List;

package gdg.devfest.passwordmanager.viewmodel;


public class PasswordItemViewModel implements ViewModel {
  private final Navigator navigator;

  public final ObservableInt id;
  public final ObservableField<String> icon;
  public final ObservableField<String> name;
  public final ObservableField<String> userName;

  PasswordItemViewModel(Navigator navigator, int id, String icon, String name, String username) {
    this.navigator = navigator;
    this.id = new ObservableInt(id);
    this.icon = new ObservableField<>(icon);
    this.name = new ObservableField<>(name);
    this.userName = new ObservableField<>(username);
  }

  public static PasswordItemViewModel of(Password password, Navigator navigator) {