// 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/PasswordInteractor.java
// public class PasswordInteractor {
//   private final Realm realm;
// 
//   public PasswordInteractor(Realm realm) {
//     this.realm = realm;
//   }
// 
//   public RealmResults<Password> readPasswords() {
//     return realm.where(Password.class).findAll();
//   }
// 
//   public void createPassword(String icon, String name, String userName, String password,
//       List<CustomField> customFields) {
//     Password passwordEntity = new Password(id(), icon, name, userName, password, customFields);
//     realm.executeTransaction(realm1 -> realm1.copyToRealm(passwordEntity));
//   }
// 
//   public Password readPassword(int id) {
//     return realm.where(Password.class).equalTo("id", id).findFirst();
//   }
// 
//   public void updatePassword(Password realmPassword, String icon, String name, String userName,
//       String password, List<CustomField> customFields) {
//     realm.executeTransaction(realm1 -> {
//       realmPassword.setIcon(icon);
//       realmPassword.setName(name);
//       realmPassword.setUserName(userName);
//       realmPassword.setPassword(password);
//       realmPassword.getCustomFields().deleteAllFromRealm();
//       realmPassword.getCustomFields().addAll(customFields);
//     });
//   }
// 
//   public void deletePassword(Password password) {
//     realm.executeTransaction(realm1 -> {
//       password.getCustomFields().deleteAllFromRealm();
//       password.deleteFromRealm();
//     });
//   }
// 
//   private int id() {
//     Number number = realm.where(Password.class).max("id");
//     return number != null ? number.intValue() + 1 : 0;
//   }
// }


import android.databinding.ObservableArrayList;
import android.databinding.ObservableField;
import android.databinding.ObservableList;
import android.util.Base64;
import gdg.devfest.passwordmanager.framework.Navigator;
import gdg.devfest.passwordmanager.model.PasswordInteractor;
import java.security.SecureRandom;
import pl.coreorb.selectiondialogs.data.SelectableIcon;
package gdg.devfest.passwordmanager.viewmodel;


public class PasswordCreateViewModel implements ViewModel {
  private final Navigator navigator;
// 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/PasswordInteractor.java
// public class PasswordInteractor {
//   private final Realm realm;
// 
//   public PasswordInteractor(Realm realm) {
//     this.realm = realm;
//   }
// 
//   public RealmResults<Password> readPasswords() {
//     return realm.where(Password.class).findAll();
//   }
// 
//   public void createPassword(String icon, String name, String userName, String password,
//       List<CustomField> customFields) {
//     Password passwordEntity = new Password(id(), icon, name, userName, password, customFields);
//     realm.executeTransaction(realm1 -> realm1.copyToRealm(passwordEntity));
//   }
// 
//   public Password readPassword(int id) {
//     return realm.where(Password.class).equalTo("id", id).findFirst();
//   }
// 
//   public void updatePassword(Password realmPassword, String icon, String name, String userName,
//       String password, List<CustomField> customFields) {
//     realm.executeTransaction(realm1 -> {
//       realmPassword.setIcon(icon);
//       realmPassword.setName(name);
//       realmPassword.setUserName(userName);
//       realmPassword.setPassword(password);
//       realmPassword.getCustomFields().deleteAllFromRealm();
//       realmPassword.getCustomFields().addAll(customFields);
//     });
//   }
// 
//   public void deletePassword(Password password) {
//     realm.executeTransaction(realm1 -> {
//       password.getCustomFields().deleteAllFromRealm();
//       password.deleteFromRealm();
//     });
//   }
// 
//   private int id() {
//     Number number = realm.where(Password.class).max("id");
//     return number != null ? number.intValue() + 1 : 0;
//   }
// }


// Path: app/src/main/java/gdg/devfest/passwordmanager/viewmodel/PasswordCreateViewModel.java
import android.databinding.ObservableArrayList;
import android.databinding.ObservableField;
import android.databinding.ObservableList;
import android.util.Base64;
import gdg.devfest.passwordmanager.framework.Navigator;
import gdg.devfest.passwordmanager.model.PasswordInteractor;
import java.security.SecureRandom;
import pl.coreorb.selectiondialogs.data.SelectableIcon;

package gdg.devfest.passwordmanager.viewmodel;


public class PasswordCreateViewModel implements ViewModel {
  private final Navigator navigator;
  private final PasswordInteractor interactor;