use of com.cpjd.roblu.ui.dialogs.FastDialogBuilder in project Roblu by wdavies973.
the class EventCreateMethodPicker method onItemClick.
/**
* This method is called when an item from the list is selected
* @param parent the parent adapter
* @param view the view that was selected
* @param position the vertical position of the selected view
* @param id the ID of the view
*/
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
/*
* User selected manual event creation
*/
if (position == 4) {
startActivityForResult(new Intent(this, EventEditor.class), Constants.GENERAL);
} else /*
* User selected TBA event import
*/
if (position == 0) {
Intent intent = new Intent(this, TBAEventSelector.class);
startActivityForResult(intent, Constants.GENERAL);
} else /*
* User selected Roblu Cloud event import
*/
if (position == 1) {
/*
* First, check if an active cloud event already exists and warn the user
* that they will be disabling that
*/
if (doesActiveEventExist()) {
new FastDialogBuilder().setTitle("Warning").setMessage("It looks like an active cloud event already exists on your device. Importing a new event from Roblu Cloud will disable the local" + " event from cloud syncing. Do you want to proceed?").setPositiveButtonText("Yes").setNegativeButtonText("No").setFastDialogListener(new FastDialogBuilder.FastDialogListener() {
@Override
public void accepted() {
importRobluCloudEvent(-1);
}
@Override
public void denied() {
}
@Override
public void neutral() {
}
}).build(EventCreateMethodPicker.this);
} else
importRobluCloudEvent(-1);
} else /*
* User selected the read only event option, first get their username
*/
if (position == 2) {
importPublicRobluCloudEvent();
} else /*
* User selected import from backup file
*/
if (position == 3) {
/*
* Open a file chooser where the user can select a backup file to use.
* We'll listen to a result in onActivityResult() and import the backup file there
*/
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("*/*");
intent.addCategory(Intent.CATEGORY_OPENABLE);
try {
startActivityForResult(Intent.createChooser(intent, "Select a .roblubackup file"), Constants.FILE_CHOOSER);
} catch (android.content.ActivityNotFoundException ex) {
Utils.showSnackbar(findViewById(R.id.activity_create_event_picker), getApplicationContext(), "No file manager found", true, rui.getPrimaryColor());
}
}
}
Aggregations