diff --git a/app/src/main/java/fr/mobdev/goblim/activity/UploadActivity.java b/app/src/main/java/fr/mobdev/goblim/activity/UploadActivity.java index dfd1bb8..f1a922f 100644 --- a/app/src/main/java/fr/mobdev/goblim/activity/UploadActivity.java +++ b/app/src/main/java/fr/mobdev/goblim/activity/UploadActivity.java @@ -74,6 +74,7 @@ public class UploadActivity extends AppCompatActivity { private List 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 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);