-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added values to some more elements of the transfer item view
- Loading branch information
Showing
4 changed files
with
174 additions
and
18 deletions.
There are no files selected for viewing
64 changes: 64 additions & 0 deletions
64
owncloudApp/src/main/java/com/owncloud/android/extensions/OCTransferExt.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/** | ||
* ownCloud Android client application | ||
* | ||
* @author Juan Carlos Garrote Gascón | ||
* | ||
* Copyright (C) 2022 ownCloud GmbH. | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2, | ||
* as published by the Free Software Foundation. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.owncloud.android.extensions | ||
|
||
import androidx.annotation.StringRes | ||
import com.owncloud.android.R | ||
import com.owncloud.android.domain.transfers.model.OCTransfer | ||
import com.owncloud.android.domain.transfers.model.TransferResult | ||
import com.owncloud.android.domain.transfers.model.TransferStatus | ||
|
||
@StringRes | ||
fun OCTransfer.statusToStringRes(): Int { | ||
return when (status) { | ||
// Really uploading, bind the progress bar to listen for progress updates | ||
TransferStatus.TRANSFER_IN_PROGRESS -> R.string.uploader_upload_in_progress_ticker | ||
TransferStatus.TRANSFER_SUCCEEDED -> R.string.uploads_view_upload_status_succeeded | ||
TransferStatus.TRANSFER_QUEUED -> R.string.uploads_view_upload_status_queued | ||
TransferStatus.TRANSFER_FAILED -> when (lastResult) { | ||
TransferResult.CREDENTIAL_ERROR -> R.string.uploads_view_upload_status_failed_credentials_error | ||
TransferResult.FOLDER_ERROR -> R.string.uploads_view_upload_status_failed_folder_error | ||
TransferResult.FILE_NOT_FOUND -> R.string.uploads_view_upload_status_failed_localfile_error | ||
TransferResult.FILE_ERROR -> R.string.uploads_view_upload_status_failed_file_error | ||
TransferResult.PRIVILEGES_ERROR -> R.string.uploads_view_upload_status_failed_permission_error | ||
TransferResult.NETWORK_CONNECTION -> R.string.uploads_view_upload_status_failed_connection_error | ||
TransferResult.DELAYED_FOR_WIFI -> R.string.uploads_view_upload_status_waiting_for_wifi | ||
TransferResult.CONFLICT_ERROR -> R.string.uploads_view_upload_status_conflict | ||
TransferResult.SERVICE_INTERRUPTED -> R.string.uploads_view_upload_status_service_interrupted | ||
TransferResult.SERVICE_UNAVAILABLE -> R.string.service_unavailable | ||
TransferResult.QUOTA_EXCEEDED -> R.string.failed_upload_quota_exceeded_text | ||
TransferResult.SSL_RECOVERABLE_PEER_UNVERIFIED -> R.string.ssl_certificate_not_trusted | ||
TransferResult.UNKNOWN -> R.string.uploads_view_upload_status_unknown_fail | ||
// Should not get here; cancelled uploads should be wiped out | ||
TransferResult.CANCELLED -> R.string.uploads_view_upload_status_cancelled | ||
// Should not get here; status should be UPLOAD_SUCCESS | ||
TransferResult.UPLOADED -> R.string.uploads_view_upload_status_succeeded | ||
// We don't know the specific forbidden error message because it is not being saved in transfers storage | ||
TransferResult.SPECIFIC_FORBIDDEN -> R.string.uploader_upload_forbidden | ||
// We don't know the specific unavailable service error message because it is not being saved in transfers storage | ||
TransferResult.SPECIFIC_SERVICE_UNAVAILABLE -> R.string.service_unavailable | ||
// We don't know the specific unsupported media type error message because it is not being saved in transfers storage | ||
TransferResult.SPECIFIC_UNSUPPORTED_MEDIA_TYPE -> R.string.uploads_view_unsupported_media_type | ||
// Should not get here; status should be not null | ||
null -> R.string.uploads_view_upload_status_unknown_fail | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters