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

Fixes #18
This commit is contained in:
Schoumi 2017-05-03 11:27:02 +02:00
parent 0e75b7c464
commit fe9478b46b

View file

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