Commit 0e75b7c4 authored by Schoumi's avatar Schoumi

Fix bug that produce crash due to multiple touch on upload

parent f4e85393
......@@ -74,6 +74,7 @@ public class UploadActivity extends AppCompatActivity {
private List<Integer> deletedDays;
private ProgressDialog progressDialog;
private ImageListAdapter adapter;
private boolean uploadInProgress;
//static value to handle storage durations options
private static final int NEVER = 0;
......@@ -86,6 +87,7 @@ public class UploadActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.upload);
uploadInProgress = false;
Toolbar toolbar = (Toolbar) findViewById(R.id.upload_toolbar);
setSupportActionBar(toolbar);
......@@ -230,6 +232,7 @@ public class UploadActivity extends AppCompatActivity {
@Override
public void allFileUploaded() {
uploadInProgress = false;
runOnUiThread(new Runnable() {
@Override
public void run() {
......@@ -452,6 +455,9 @@ public class UploadActivity extends AppCompatActivity {
}
private void uploadImages(List<Uri> imageUris) {
if(uploadInProgress)
return;
uploadInProgress = true;
//what server we use
Spinner urlSpinner = (Spinner)findViewById(R.id.servers_spinner);
int pos = urlSpinner.getSelectedItemPosition();
......@@ -462,6 +468,7 @@ public class UploadActivity extends AppCompatActivity {
Toast.makeText(UploadActivity.this, getString(R.string.server_list_error), Toast.LENGTH_LONG).show();
}
});
uploadInProgress = false;
return;
}
String url = urls.get(pos);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment