From: David A. Velasco Date: Wed, 22 Jan 2014 17:36:52 +0000 (+0100) Subject: Fixed file name shown in the upload and download notifications (not full path) X-Git-Tag: oc-android-1.5.5~69^2~4 X-Git-Url: http://git.linex4red.de/pub/Android/ownCloud.git/commitdiff_plain/85809fc2d24e2efee4a14d04e8b83cca353ca5b0?ds=inline;hp=--cc Fixed file name shown in the upload and download notifications (not full path) --- 85809fc2d24e2efee4a14d04e8b83cca353ca5b0 diff --git a/src/com/owncloud/android/files/services/FileDownloader.java b/src/com/owncloud/android/files/services/FileDownloader.java index c27ec0cc..05f99e07 100644 --- a/src/com/owncloud/android/files/services/FileDownloader.java +++ b/src/com/owncloud/android/files/services/FileDownloader.java @@ -39,6 +39,7 @@ import com.owncloud.android.lib.network.OwnCloudClient; import com.owncloud.android.operations.DownloadFileOperation; import com.owncloud.android.lib.operations.common.RemoteOperationResult; import com.owncloud.android.lib.operations.common.RemoteOperationResult.ResultCode; +import com.owncloud.android.lib.utils.FileUtils; import com.owncloud.android.ui.activity.FileActivity; import com.owncloud.android.ui.activity.FileDisplayActivity; import com.owncloud.android.ui.preview.PreviewImageActivity; @@ -430,10 +431,11 @@ public class FileDownloader extends Service implements OnDatatransferProgressLis * 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, totalToTransfer < 0); + String fileName = filePath.substring(filePath.lastIndexOf(FileUtils.PATH_SEPARATOR + 1)); String text = String.format(getString(R.string.downloader_download_in_progress_content), percent, fileName); mNotification.contentView.setTextViewText(R.id.status_text, text); mNotificationManager.notify(R.string.downloader_download_in_progress_ticker, mNotification); diff --git a/src/com/owncloud/android/files/services/FileUploader.java b/src/com/owncloud/android/files/services/FileUploader.java index fdbe055e..a55ce8cc 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; @@ -700,10 +701,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);