mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-27 04:43:54 +01:00
Add 'if' check for file exists
This commit is contained in:
parent
b6997db681
commit
b5ccc36a77
1 changed files with 20 additions and 17 deletions
|
|
@ -77,25 +77,28 @@ public class ExistingFileAsync extends AsyncTask<Void, Void, Boolean> {
|
||||||
super.onPostExecute(fileExists);
|
super.onPostExecute(fileExists);
|
||||||
//TODO: Add Dialog here to tell user file exists, do you want to continue? Yes/No
|
//TODO: Add Dialog here to tell user file exists, do you want to continue? Yes/No
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
if (fileExists) {
|
||||||
|
|
||||||
builder.setMessage("This file already exists in Commons. Are you sure you want to proceed?")
|
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||||
.setTitle("Warning");
|
|
||||||
builder.setPositiveButton("No", new DialogInterface.OnClickListener() {
|
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
|
||||||
//Go back to ContributionsActivity
|
|
||||||
Intent intent = new Intent(context, ContributionsActivity.class);
|
|
||||||
context.startActivity(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
builder.setMessage("This file already exists in Commons. Are you sure you want to proceed?")
|
||||||
builder.setNegativeButton("Yes", new DialogInterface.OnClickListener() {
|
.setTitle("Warning");
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
builder.setPositiveButton("No", new DialogInterface.OnClickListener() {
|
||||||
//No need to do anything, user remains on upload screen
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
}
|
//Go back to ContributionsActivity
|
||||||
});
|
Intent intent = new Intent(context, ContributionsActivity.class);
|
||||||
|
context.startActivity(intent);
|
||||||
|
}
|
||||||
|
|
||||||
AlertDialog dialog = builder.create();
|
});
|
||||||
dialog.show();
|
builder.setNegativeButton("Yes", new DialogInterface.OnClickListener() {
|
||||||
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
//No need to do anything, user remains on upload screen
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
AlertDialog dialog = builder.create();
|
||||||
|
dialog.show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue