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 { ...@@ -74,6 +74,7 @@ public class UploadActivity extends AppCompatActivity {
private List<Integer> deletedDays; private List<Integer> deletedDays;
private ProgressDialog progressDialog; private ProgressDialog progressDialog;
private ImageListAdapter adapter; private ImageListAdapter adapter;
private boolean uploadInProgress;
//static value to handle storage durations options //static value to handle storage durations options
private static final int NEVER = 0; private static final int NEVER = 0;
...@@ -86,6 +87,7 @@ public class UploadActivity extends AppCompatActivity { ...@@ -86,6 +87,7 @@ public class UploadActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
setContentView(R.layout.upload); setContentView(R.layout.upload);
uploadInProgress = false;
Toolbar toolbar = (Toolbar) findViewById(R.id.upload_toolbar); Toolbar toolbar = (Toolbar) findViewById(R.id.upload_toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
...@@ -230,6 +232,7 @@ public class UploadActivity extends AppCompatActivity { ...@@ -230,6 +232,7 @@ public class UploadActivity extends AppCompatActivity {
@Override @Override
public void allFileUploaded() { public void allFileUploaded() {
uploadInProgress = false;
runOnUiThread(new Runnable() { runOnUiThread(new Runnable() {
@Override @Override
public void run() { public void run() {
...@@ -452,6 +455,9 @@ public class UploadActivity extends AppCompatActivity { ...@@ -452,6 +455,9 @@ public class UploadActivity extends AppCompatActivity {
} }
private void uploadImages(List<Uri> imageUris) { private void uploadImages(List<Uri> imageUris) {
if(uploadInProgress)
return;
uploadInProgress = true;
//what server we use //what server we use
Spinner urlSpinner = (Spinner)findViewById(R.id.servers_spinner); Spinner urlSpinner = (Spinner)findViewById(R.id.servers_spinner);
int pos = urlSpinner.getSelectedItemPosition(); int pos = urlSpinner.getSelectedItemPosition();
...@@ -462,6 +468,7 @@ public class UploadActivity extends AppCompatActivity { ...@@ -462,6 +468,7 @@ public class UploadActivity extends AppCompatActivity {
Toast.makeText(UploadActivity.this, getString(R.string.server_list_error), Toast.LENGTH_LONG).show(); Toast.makeText(UploadActivity.this, getString(R.string.server_list_error), Toast.LENGTH_LONG).show();
} }
}); });
uploadInProgress = false;
return; return;
} }
String url = urls.get(pos); 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