private void finishClosing() { if (!proposalSelected) { DialogInformation.build(this) .show(getString(R.string.tienes_que_seleccionar_un_lugar), DialogInformation.ICON_ALERT); return; } Event event = imin.getUser().getCurrentEvent(); event.setFinalDateTimeProposal(imin.getUser().getSelectedDateTimeProposal()); event.setFinalLocationProposal(imin.getUser().getSelectedLocationProposal()); event.setFinalDateTimeProposalId( imin.getUser().getSelectedDateTimeProposal().getPublicProposalId()); event.setFinalLocationProposalId( imin.getUser().getSelectedLocationProposal().getPublicProposalId()); // Ask the user DialogProposal dialogProposal = DialogProposal.build( this, new DialogProposal.OnClickListener() { @Override public void onClick(Event event, boolean result) { if (result) { // Yes button clicked eventClose(); } } }); dialogProposal.show(imin.getUser(), imin.getUser().getCurrentEvent()); }
// Get the current selected event private void eventClose() { Event event = imin.getUser().getCurrentEvent(); // Go ahead with event closing showCloseDialog(); Proposal finalDateTimeProposal = event.getFinalDateTimeProposal(); Proposal finalLocationProposal = event.getFinalLocationProposal(); String finalDateTimeProposalId = finalDateTimeProposal.getPublicProposalId(); String finalLocationProposalId = finalLocationProposal.getPublicProposalId(); event.setFinalDateTimeProposalId(finalDateTimeProposalId); event.setFinalLocationProposalId(finalDateTimeProposalId); // Run an asynchronous task to retrieve the single event configurationInstance.taskCloseEvent = new TaskCloseEvent(this); TaskCloseEventParams params = new TaskCloseEventParams( imin.getUser().getPrivateUserId(), event.getId(), true, finalDateTimeProposalId, finalLocationProposalId); configurationInstance.taskCloseEvent.execute(params); }