@Override public Boolean onBackPressed() { Command commandOk = new Command() { public void execute() { MainActivity.getInstance().mCurrentWorkday.startGpsControl(); Dialogs.createDialog( "SFS", "Визит завершен?", new Command() { @Override public void execute() { _entity.IsCompleted = true; _entity.TaskEnd = new Date(); _entity.save(); closeView(); Dialogs.createDialog( "", "Провести обмен?", _sync, new Command() { @Override public void execute() { // forceShowTargets(); } }) .show(); } }, new Command() { @Override public void execute() { _entity.IsCompleted = false; _entity.TaskEnd = new Date(); _entity.save(); closeView(); Dialogs.createDialog( "SFS", "Провести обмен?", _sync, new Command() { @Override public void execute() { forceShowTargets(); } }) .show(); } }) .show(); } }; Command commandCancel = new Command() { public void execute() { cancelCloseView(); } }; Dialogs.createDialog("SFS", "Закрыть визит?", commandOk, commandCancel).show(); return true; }
@SuppressWarnings("resource") protected void forceShowTargets() { Dialogs.createDialog( "", "", new VisitTargetTab(getContext(), _entity).inflate(), null, Command.NO_OP, null) .show(); }