use of com.cpjd.roblu.tba.UnpackTBAEvent in project Roblu by wdavies973.
the class EventEditor method createEvent.
/**
* This method is more of a courtesy method to the source code reader,
* an event will get created from EventEditor whenever this method is called, no exceptions.
* @param form the form to save with the event
*/
private void createEvent(RForm form) {
IO io = new IO(getApplicationContext());
REvent event = new REvent(io.getNewEventID(), eventName.getText().toString());
// we call this twice because the /event/ dir is required for the form to save
io.saveEvent(event);
io.saveForm(event.getID(), form);
/*
* We need to check if the user included any TBA information that we should include in this event creation
*/
if (!editing && getIntent().getSerializableExtra("tbaEvent") != null) {
ProgressDialog d = ProgressDialog.show(this, "Hold on tight!", "Generating team profiles from event...", true);
d.setCancelable(false);
event.setKey(((Event) getIntent().getSerializableExtra("tbaEvent")).key);
io.saveEvent(event);
UnpackTBAEvent unpackTBAEvent = new UnpackTBAEvent((Event) getIntent().getSerializableExtra("tbaEvent"), event.getID(), this, d);
if (((Switch) findViewById(R.id.switch1)).isChecked())
unpackTBAEvent.setRandomize(true);
unpackTBAEvent.execute();
} else /*
* If we started the UnpackTask, then we have to wait to return, if not, return now
*/
{
io.saveEvent(event);
Intent result = new Intent();
result.putExtra("eventID", event.getID());
setResult(Constants.NEW_EVENT_CREATED, result);
finish();
}
}
Aggregations