Luke Owncloud 10 anni fa
parent
commit
982befe542

+ 3 - 8
src/com/owncloud/android/files/services/FileUploadService.java

@@ -480,8 +480,6 @@ public class FileUploadService extends IntentService implements OnDatatransferPr
                 Log_OC.d(TAG, "Calling uploadFile for " + upload);
                 RemoteOperationResult uploadResult = uploadFile(uploadDbObject);
                 
-                //TODO check if cancelled by user
-                
                 updateDataseUploadResult(uploadResult, mCurrentUpload);
                 notifyUploadResult(uploadResult, mCurrentUpload);
                 sendFinalBroadcast(uploadResult, mCurrentUpload);                
@@ -539,7 +537,7 @@ public class FileUploadService extends IntentService implements OnDatatransferPr
             }
         }
         reason.append(".");
-        if (reason.length() > 0) {
+        if (reason.length() > 1) {
             return reason.toString();
         }
         if (uploadDbObject.getUploadStatus() == UploadStatus.UPLOAD_LATER) {
@@ -599,11 +597,8 @@ public class FileUploadService extends IntentService implements OnDatatransferPr
             } else if(mCancellationPossible.get()){
                 mCancellationRequested.set(true);
             } else {
-                Log_OC.e(TAG,
-                        "Cannot cancel upload because not in progress. Instead remove from pending upload list. This should not happen.");
-
-                // in this case we have to update the db here. this should never
-                // happen though!
+                // upload not in progress, but pending.
+                // in this case we have to update the db here.
                 UploadDbObject upload = mPendingUploads.remove(buildRemoteName(account, file));
                 upload.setUploadStatus(UploadStatus.UPLOAD_CANCELLED);
                 upload.setLastResult(new RemoteOperationResult(ResultCode.CANCELLED));

+ 7 - 12
src/com/owncloud/android/ui/adapter/ExpandableUploadListAdapter.java

@@ -142,7 +142,7 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
             TextView localPath = (TextView) view.findViewById(R.id.upload_local_path);
             String path = uploadObject.getOCFile().getStoragePath();
             path = path.substring(0, path.length() - file.length() - 1);
-            localPath.setText(path);
+            localPath.setText("Path: " + path);
 
             TextView fileSize = (TextView) view.findViewById(R.id.upload_file_size);
             fileSize.setText(DisplayUtils.bytesToHumanReadable(uploadObject.getOCFile().getFileLength()));
@@ -154,10 +154,10 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
                 status = mActivity.getResources().getString(R.string.uploader_upload_in_progress_ticker);
                 break;
             case UPLOAD_FAILED_GIVE_UP:
-                if(uploadObject.getLastResult() != null) {
-                status = "Upload failed: " + uploadObject.getLastResult().getLogMessage();
-                 } else {
-                     status = "Upload failed.";
+                if (uploadObject.getLastResult() != null) {
+                    status = "Upload failed: " + uploadObject.getLastResult().getLogMessage();
+                } else {
+                    status = "Upload failed.";
                 }
                 break;
             case UPLOAD_FAILED_RETRY:
@@ -172,15 +172,10 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
                 status = FileUploadService.getUploadLaterReason(mActivity, uploadObject);
                 break;
             case UPLOAD_SUCCEEDED:
-                status = "";
+                status = "Completed.";
                 break;
             case UPLOAD_CANCELLED:
-                if(uploadObject.getLastResult() == null){
-                    status = "Upload cancelled.";
-                } else {
-                    status = uploadObject.getLastResult()
-                    .getLogMessage();
-                }
+                status = "Upload cancelled.";
                 break;
             case UPLOAD_PAUSED:
                 status = "Upload paused.";