Skip to content

Instantly share code, notes, and snippets.

@MwBakker
Last active December 19, 2018 15:57
Show Gist options
  • Save MwBakker/88d79d21f31070659b1a0ec05ba22864 to your computer and use it in GitHub Desktop.
Save MwBakker/88d79d21f31070659b1a0ec05ba22864 to your computer and use it in GitHub Desktop.
private DialogCmdHandler dialogHandler(Dialog customDialog, Storage storage)
{
return new DialogCmdHandler()
{
@Override
public void editItem()
{
Intent intent = new Intent(MainActivity.this, StorageActivity.class);
intent.putExtra("storage_name", storage.getStorageName());
intent.putExtra("storage_loc", storage.getStorageLoc());
// This one is being performed after the switch of activity..
mainVM.getStorageRepository().getAmountOfRacks(storage.storageID).observe(MainActivity.this, rackAmount ->
{
intent.putExtra("storage_rack_amount", rackAmount);
});
intent.putExtra("purpose", "Save storage edit");
switchActivity(intent);
}
@Override
public void deleteItem()
{
mainVM.getStorageRepository().deleteStorage(storage);
}
@Override
public void cancelDialog()
{
customDialog.dismiss();
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment