Fix bug on upload blocked at 100% event if it's done

Fixes #18
pull/1/head
Schoumi 6 years ago
parent 0e75b7c464
commit fe9478b46b
  1. 19
      app/src/main/java/fr/mobdev/goblim/activity/UploadActivity.java

@ -302,6 +302,9 @@ public class UploadActivity extends AppCompatActivity {
}
if(linkIntent != null) {
resetImages();
fileInError.clear();
errorMsg.clear();
results.clear();
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
startActivity(linkIntent);
}
@ -533,25 +536,35 @@ public class UploadActivity extends AppCompatActivity {
if(resultCode == RESULT_OK){
//retrieve uri from the request image activity and prepare
ClipData clip = null;
boolean hasAddUri = false;
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2)
clip = returnIntent.getClipData();
if(clip == null) {
Uri imageUri = returnIntent.getData();
if(imageUri == null)
return;
uris.add(imageUri);
hasAddUri = true;
updateSpanCount();
adapter.addUri(this,imageUri);
} else {
for(int i = 0; clip != null && i < clip.getItemCount(); i++) {
Uri imageUri = clip.getItemAt(i).getUri();
if(imageUri == null)
continue;
uris.add(imageUri);
hasAddUri = true;
updateSpanCount();
adapter.addUri(this,imageUri);
adapter.addUri(this, imageUri);
}
}
Button uploadBt = (Button) findViewById(R.id.upload_button);
uploadBt.setEnabled(false);
if(hasAddUri) {
Button uploadBt = (Button) findViewById(R.id.upload_button);
uploadBt.setEnabled(false);
}
}
}

Loading…
Cancel
Save