X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/blobdiff_plain/1dc21189349224779d09decb886280a69af8d09a..7a4ac199930a37c73b76e76003a86a8978b65f0b:/src/com/owncloud/android/files/services/FileUploader.java diff --git a/src/com/owncloud/android/files/services/FileUploader.java b/src/com/owncloud/android/files/services/FileUploader.java index fdbe055e..0cffa28d 100644 --- a/src/com/owncloud/android/files/services/FileUploader.java +++ b/src/com/owncloud/android/files/services/FileUploader.java @@ -41,6 +41,7 @@ import com.owncloud.android.operations.UploadFileOperation; import com.owncloud.android.lib.operations.common.RemoteOperationResult.ResultCode; import com.owncloud.android.lib.operations.remote.ExistenceCheckRemoteOperation; import com.owncloud.android.lib.operations.remote.ReadRemoteFileOperation; +import com.owncloud.android.lib.utils.FileUtils; import com.owncloud.android.lib.utils.OwnCloudVersion; import com.owncloud.android.lib.network.OnDatatransferProgressListener; import com.owncloud.android.lib.accounts.OwnCloudAccount; @@ -252,7 +253,10 @@ public class FileUploader extends Service implements OnDatatransferProgressListe } } - OwnCloudVersion ocv = new OwnCloudVersion(AccountManager.get(this).getUserData(account, OwnCloudAccount.Constants.KEY_OC_VERSION)); + AccountManager aMgr = AccountManager.get(this); + String version = aMgr.getUserData(account, OwnCloudAccount.Constants.KEY_OC_VERSION); + String versionString = aMgr.getUserData(account, OwnCloudAccount.Constants.KEY_OC_VERSION_STRING); + OwnCloudVersion ocv = new OwnCloudVersion(version, versionString); boolean chunked = FileUploader.chunkedUploadIsSupported(ocv); AbstractList requestedUploads = new Vector(); String uploadKey = null; @@ -596,6 +600,9 @@ public class FileUploader extends Service implements OnDatatransferProgressListe */ private void saveUploadedFile() { OCFile file = mCurrentUpload.getFile(); + if (file.fileExists()) { + file = mStorageManager.getFileById(file.getFileId()); + } long syncDate = System.currentTimeMillis(); file.setLastSyncDateForData(syncDate); @@ -604,7 +611,7 @@ public class FileUploader extends Service implements OnDatatransferProgressListe ReadRemoteFileOperation operation = new ReadRemoteFileOperation(mCurrentUpload.getRemotePath()); RemoteOperationResult result = operation.execute(mUploadClient); if (result.isSuccess()) { - updateOCFile(file, result.getData().get(0)); + updateOCFile(file, (RemoteFile) result.getData().get(0)); file.setLastSyncDateForProperties(syncDate); } @@ -700,10 +707,11 @@ public class FileUploader extends Service implements OnDatatransferProgressListe * Callback method to update the progress bar in the status notification */ @Override - public void onTransferProgress(long progressRate, long totalTransferredSoFar, long totalToTransfer, String fileName) { + public void onTransferProgress(long progressRate, long totalTransferredSoFar, long totalToTransfer, String filePath) { int percent = (int) (100.0 * ((double) totalTransferredSoFar) / ((double) totalToTransfer)); if (percent != mLastPercent) { mNotification.contentView.setProgressBar(R.id.status_progress, 100, percent, false); + String fileName = filePath.substring(filePath.lastIndexOf(FileUtils.PATH_SEPARATOR) + 1); String text = String.format(getString(R.string.uploader_upload_in_progress_content), percent, fileName); mNotification.contentView.setTextViewText(R.id.status_text, text); mNotificationManager.notify(R.string.uploader_upload_in_progress_ticker, mNotification);