瀏覽代碼

Change error label for uploads when app is killed

Juan Carlos González Cabrero 9 年之前
父節點
當前提交
b1d46eb8ab

+ 2 - 1
res/values/strings.xml

@@ -131,7 +131,8 @@
     <string name="uploads_view_upload_status_failed_localfile_error">Local file not found</string>
     <string name="uploads_view_upload_status_failed_permission_error">Permission error</string>
     <string name="uploads_view_upload_status_conflict">Conflict</string>
-    <string name="uploads_view_upload_status_unknown_fail">Error uploading</string>
+    <string name="uploads_view_upload_status_service_interrupted">App was terminated</string>
+    <string name="uploads_view_upload_status_unknown_fail">Unknown error</string>
     <string name="uploads_view_upload_status_waiting_for_wifi">Waiting for wifi connectivity</string>
     <string name="uploads_view_later_waiting_to_upload">Waiting to upload</string>
     <string name="downloader_download_in_progress_ticker">Downloading &#8230;</string>

+ 4 - 1
src/com/owncloud/android/db/UploadResult.java

@@ -33,7 +33,8 @@ public enum UploadResult {
     PRIVILEDGES_ERROR(6),
     CANCELLED(7),
     FILE_NOT_FOUND(8),
-    DELAYED_FOR_WIFI(9);
+    DELAYED_FOR_WIFI(9),
+    SERVICE_INTERRUPTED(10);
 
     private final int value;
 
@@ -68,6 +69,8 @@ public enum UploadResult {
                 return FILE_NOT_FOUND;
             case 9:
                 return DELAYED_FOR_WIFI;
+            case 10:
+                return SERVICE_INTERRUPTED;
         }
         return null;
     }

+ 1 - 1
src/com/owncloud/android/files/services/FileUploader.java

@@ -343,7 +343,7 @@ public class FileUploader extends Service
         mUploadsStorageManager = new UploadsStorageManager(getContentResolver());
 
         int failedCounter = mUploadsStorageManager.failInProgressUploads(
-            UploadResult.UNKNOWN    // Add UploadResult.KILLED?
+            UploadResult.SERVICE_INTERRUPTED    // Add UploadResult.KILLED?
         );
         if (failedCounter > 0) {
             resurrection();

+ 5 - 0
src/com/owncloud/android/ui/adapter/ExpandableUploadListAdapter.java

@@ -541,6 +541,11 @@ public class ExpandableUploadListAdapter extends BaseExpandableListAdapter imple
                             R.string.uploads_view_upload_status_conflict
                         );
                         break;
+                    case SERVICE_INTERRUPTED:
+                        status =  mParentActivity.getString(
+                            R.string.uploads_view_upload_status_service_interrupted
+                        );
+                        break;
                     case UNKNOWN:
                         status = mParentActivity.getString(
                             R.string.uploads_view_upload_status_unknown_fail