Fix bug that produce crash due to multiple touch on upload

pull/1/head
Schoumi 6 years ago
parent f4e853933a
commit 0e75b7c464
  1. 7
      app/src/main/java/fr/mobdev/goblim/activity/UploadActivity.java

@ -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);

Loading…
Cancel
Save