No trash button for successful uploads

This commit is contained in:
David A. Velasco 2016-03-29 17:42:14 +02:00
parent d098d07889
commit be00353096
2 changed files with 8 additions and 26 deletions

View file

@ -324,29 +324,6 @@ public class OCUpload implements Parcelable {
}
}
/**
* Returns true when user is able to cancel this upload. That is, when
* upload is currently in progress or scheduled for upload.
*/
public boolean userCanCancelUpload() {
if (getUploadStatus() == UploadStatus.UPLOAD_IN_PROGRESS) {
return true;
}
return false;
}
/**
* Returns true when user can choose to retry this upload. That is, when
* upload has failed for any reason.
*/
public boolean userCanRetryUpload() {
if (getUploadStatus() == UploadStatus.UPLOAD_FAILED) {
return true;
}
return false;
}
/****
*
*/

View file

@ -326,7 +326,7 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
/// bind listeners to perform actions
ImageButton rightButton = (ImageButton) view.findViewById(R.id.upload_right_button);
if (upload.userCanCancelUpload()) {
if (upload.getUploadStatus() == UploadStatus.UPLOAD_IN_PROGRESS) {
//Cancel
rightButton.setImageResource(R.drawable.ic_cancel);
rightButton.setOnClickListener(new OnClickListener() {
@ -339,7 +339,8 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
}
}
});
} else {
} else if (upload.getUploadStatus() == UploadStatus.UPLOAD_FAILED) {
//Delete
rightButton.setImageResource(R.drawable.ic_action_delete);
rightButton.setOnClickListener(new OnClickListener() {
@ -349,9 +350,13 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
refreshView();
}
});
} else { // UploadStatus.UPLOAD_SUCCESS
rightButton.setVisibility(View.INVISIBLE);
}
if (upload.userCanRetryUpload()) {
// retry
if (upload.getUploadStatus() == UploadStatus.UPLOAD_FAILED) {
if (UploadResult.CREDENTIAL_ERROR.equals(upload.getLastResult())) {
view.setOnClickListener(new OnClickListener() {
@Override