Browse Source

Retry action on list items of Updates view like in iOS

Juan Carlos González Cabrero 9 years ago
parent
commit
d5fa3a5578

+ 0 - 3
src/com/owncloud/android/db/OCUpload.java

@@ -318,7 +318,6 @@ public class OCUpload implements Parcelable{
         switch (this.getUploadStatus()) {
             case UPLOAD_IN_PROGRESS:
             case UPLOAD_LATER:
-            case UPLOAD_FAILED_RETRY:
                 return true;
             default:
                 return false;
@@ -336,8 +335,6 @@ public class OCUpload implements Parcelable{
             case UPLOAD_FAILED_GIVE_UP: //TODO this case needs to be handled as described by
                 // https://github.com/owncloud/android/issues/765#issuecomment-66490312
             case UPLOAD_LATER: //upload is already schedule but allow user to increase priority
-            case UPLOAD_SUCCEEDED: // if user wants let him to re-upload (maybe
-                // remote file was deleted...)
                 return true;
             default:
                 return false;

+ 1 - 1
src/com/owncloud/android/files/FileOperationsHelper.java

@@ -537,7 +537,7 @@ public class FileOperationsHelper {
             upload.removeAllUploadRestrictions(); //only this object, upload DB stays untouched.
             uploaderBinder.retry(account, upload);
         }  else {
-            Log_OC.w(TAG, "uploaderBinder not set. Cannot remove " + upload.getOCFile());
+            Log_OC.w(TAG, "uploaderBinder not set. Cannot retry the upload of " + upload.getOCFile());
         }
     }
     

+ 10 - 11
src/com/owncloud/android/ui/adapter/ExpandableUploadListAdapter.java

@@ -355,17 +355,7 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
             statusTextView.setText(status);
 
             ImageButton rightButton = (ImageButton) view.findViewById(R.id.upload_right_button);
-            if (upload.userCanRetryUpload()
-                    && upload.getUploadStatus() != UploadStatus.UPLOAD_SUCCEEDED) {
-                //Refresh   - TODO test buttons in Android 4.x
-                rightButton.setImageResource(R.drawable.ic_refresh);
-                rightButton.setOnClickListener(new OnClickListener() {
-                    @Override
-                    public void onClick(View v) {
-                        mParentActivity.getFileOperationsHelper().retryUpload(upload);
-                    }
-                });
-            } else if (upload.userCanCancelUpload()) {
+            if (upload.userCanCancelUpload()) {
                 //Cancel
                 rightButton.setImageResource(R.drawable.ic_cancel);
                 rightButton.setOnClickListener(new OnClickListener() {
@@ -386,6 +376,15 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
                 });
             }
 
+            if (upload.userCanRetryUpload()) {
+                    view.setOnClickListener(new OnClickListener() {
+                        @Override
+                        public void onClick(View v) {
+                            mParentActivity.getFileOperationsHelper().retryUpload(upload);
+                        }
+                    });
+            }
+
 
             ImageView fileIcon = (ImageView) view.findViewById(R.id.thumbnail);
             fileIcon.setImageResource(R.drawable.file);