mirror of
https://github.com/nextcloud/android.git
synced 2024-12-21 00:12:05 +03:00
fix
Signed-off-by: alperozturk <alper_ozturk@proton.me>
This commit is contained in:
parent
2ec38321b7
commit
de8d45646f
3 changed files with 8 additions and 13 deletions
|
@ -90,6 +90,7 @@ class FileUploadWorker(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private var currentUploadIndex: Int = 1
|
||||||
private var lastPercent = 0
|
private var lastPercent = 0
|
||||||
private val notificationManager = UploadNotificationManager(context, viewThemeUtils)
|
private val notificationManager = UploadNotificationManager(context, viewThemeUtils)
|
||||||
private val intents = FileUploaderIntents(context)
|
private val intents = FileUploaderIntents(context)
|
||||||
|
@ -167,7 +168,7 @@ class FileUploadWorker(
|
||||||
setWorkerState(user.get(), uploadsPerPage)
|
setWorkerState(user.get(), uploadsPerPage)
|
||||||
|
|
||||||
run uploads@{
|
run uploads@{
|
||||||
uploadsPerPage.forEachIndexed { currentUploadIndex, upload ->
|
uploadsPerPage.forEach { upload ->
|
||||||
if (isStopped) {
|
if (isStopped) {
|
||||||
return@uploads
|
return@uploads
|
||||||
}
|
}
|
||||||
|
@ -181,12 +182,16 @@ class FileUploadWorker(
|
||||||
uploadFileOperation,
|
uploadFileOperation,
|
||||||
cancelPendingIntent = intents.startIntent(uploadFileOperation),
|
cancelPendingIntent = intents.startIntent(uploadFileOperation),
|
||||||
startIntent = intents.notificationStartIntent(uploadFileOperation),
|
startIntent = intents.notificationStartIntent(uploadFileOperation),
|
||||||
currentUploadIndex = currentUploadIndex + 1,
|
currentUploadIndex = currentUploadIndex,
|
||||||
totalUploadSize = totalUploadSize
|
totalUploadSize = totalUploadSize
|
||||||
)
|
)
|
||||||
|
|
||||||
val result = upload(uploadFileOperation, user.get())
|
val result = upload(uploadFileOperation, user.get())
|
||||||
|
|
||||||
|
if (result.isSuccess) {
|
||||||
|
currentUploadIndex += 1
|
||||||
|
}
|
||||||
|
|
||||||
currentUploadFileOperation = null
|
currentUploadFileOperation = null
|
||||||
|
|
||||||
fileUploaderDelegate.sendBroadcastUploadFinished(
|
fileUploaderDelegate.sendBroadcastUploadFinished(
|
||||||
|
|
|
@ -32,16 +32,7 @@ class UploadNotificationManager(private val context: Context, viewThemeUtils: Vi
|
||||||
currentUploadIndex: Int,
|
currentUploadIndex: Int,
|
||||||
totalUploadSize: Int
|
totalUploadSize: Int
|
||||||
) {
|
) {
|
||||||
currentOperationTitle = if (totalUploadSize > 1) {
|
currentOperationTitle = "$currentUploadIndex / $totalUploadSize - ${uploadFileOperation.fileName}"
|
||||||
String.format(
|
|
||||||
context.getString(R.string.upload_notification_manager_start_text),
|
|
||||||
currentUploadIndex,
|
|
||||||
totalUploadSize,
|
|
||||||
uploadFileOperation.fileName
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
uploadFileOperation.fileName
|
|
||||||
}
|
|
||||||
|
|
||||||
val progressText = String.format(
|
val progressText = String.format(
|
||||||
context.getString(R.string.upload_notification_manager_upload_in_progress_text),
|
context.getString(R.string.upload_notification_manager_upload_in_progress_text),
|
||||||
|
|
|
@ -223,7 +223,6 @@
|
||||||
<string name="upload_chooser_title">Upload from…</string>
|
<string name="upload_chooser_title">Upload from…</string>
|
||||||
<string name="uploader_info_dirname">Folder name</string>
|
<string name="uploader_info_dirname">Folder name</string>
|
||||||
|
|
||||||
<string name="upload_notification_manager_start_text">%1$d / %2$d - %3$s</string>
|
|
||||||
<string name="upload_notification_manager_upload_in_progress_text" translatable="false">%1$d%%</string>
|
<string name="upload_notification_manager_upload_in_progress_text" translatable="false">%1$d%%</string>
|
||||||
|
|
||||||
<string name="uploader_upload_in_progress_ticker">Uploading…</string>
|
<string name="uploader_upload_in_progress_ticker">Uploading…</string>
|
||||||
|
|
Loading…
Reference in a new issue