mirror of
https://github.com/nextcloud/android.git
synced 2024-11-26 15:15:51 +03:00
Merge pull request #12941 from nextcloud/feature/inform-user-for-uploading-same-file-again
Inform user for uploading same file again
This commit is contained in:
commit
e21a023fca
3 changed files with 15 additions and 0 deletions
|
@ -21,6 +21,8 @@ import com.nextcloud.client.network.ConnectivityService
|
|||
import com.nextcloud.client.preferences.AppPreferences
|
||||
import com.nextcloud.model.WorkerState
|
||||
import com.nextcloud.model.WorkerStateLiveData
|
||||
import com.nextcloud.utils.extensions.showToast
|
||||
import com.owncloud.android.R
|
||||
import com.owncloud.android.datamodel.FileDataStorageManager
|
||||
import com.owncloud.android.datamodel.ThumbnailsCacheManager
|
||||
import com.owncloud.android.datamodel.UploadsStorageManager
|
||||
|
@ -263,6 +265,7 @@ class FileUploadWorker(
|
|||
uploadFileOperation.user, File(uploadFileOperation.storagePath), uploadFileOperation.remotePath, context
|
||||
)
|
||||
) {
|
||||
context.showToast(R.string.file_upload_worker_same_file_already_exists)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
|
@ -13,6 +13,9 @@ import android.content.Context
|
|||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.os.Build
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.widget.Toast
|
||||
import com.owncloud.android.datamodel.ReceiverFlag
|
||||
|
||||
@SuppressLint("UnspecifiedRegisterReceiverFlag")
|
||||
|
@ -23,3 +26,11 @@ fun Context.registerBroadcastReceiver(receiver: BroadcastReceiver?, filter: Inte
|
|||
registerReceiver(receiver, filter)
|
||||
}
|
||||
}
|
||||
|
||||
fun Context.showToast(message: String) {
|
||||
Handler(Looper.getMainLooper()).post {
|
||||
Toast.makeText(this, message, Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
|
||||
fun Context.showToast(messageId: Int) = showToast(getString(messageId))
|
||||
|
|
|
@ -127,6 +127,7 @@
|
|||
<string name="uploader_upload_files_behaviour_only_upload">Keep file in source folder</string>
|
||||
<string name="uploader_upload_files_behaviour_upload_and_delete_from_source">Delete file from source folder</string>
|
||||
<string name="file_list_seconds_ago">seconds ago</string>
|
||||
<string name="file_upload_worker_same_file_already_exists">Same file already exists, no conflict detected</string>
|
||||
<string name="file_list_live">LIVE</string>
|
||||
<string name="file_list_empty_headline">No files here</string>
|
||||
<string name="folder_list_empty_headline">No folders here</string>
|
||||
|
|
Loading…
Reference in a new issue