fix renaming on Android 10
This commit is contained in:
parent
d4719b5df9
commit
e07a5da95c
|
@ -63,7 +63,7 @@ android {
|
|||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:e79c9bba93'
|
||||
implementation 'com.github.SimpleMobileTools:Simple-Commons:fbcf12e609'
|
||||
implementation 'org.greenrobot:eventbus:3.3.1'
|
||||
implementation 'com.github.Armen101:AudioRecordView:1.0.4'
|
||||
implementation 'androidx.documentfile:documentfile:1.0.1'
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
package com.simplemobiletools.voicerecorder.adapters
|
||||
|
||||
import android.content.ContentUris
|
||||
import android.content.Context
|
||||
import android.net.Uri
|
||||
import android.provider.MediaStore
|
||||
import android.provider.MediaStore.Audio.Media
|
||||
import android.view.*
|
||||
|
@ -16,7 +13,6 @@ import com.simplemobiletools.commons.extensions.*
|
|||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||
import com.simplemobiletools.commons.helpers.isQPlus
|
||||
import com.simplemobiletools.commons.helpers.isRPlus
|
||||
import com.simplemobiletools.commons.models.FileDirItem
|
||||
import com.simplemobiletools.commons.views.MyRecyclerView
|
||||
import com.simplemobiletools.voicerecorder.BuildConfig
|
||||
import com.simplemobiletools.voicerecorder.R
|
||||
|
@ -211,25 +207,6 @@ class RecordingsAdapter(
|
|||
}
|
||||
}
|
||||
|
||||
fun Context.getFileUrisFromFileDirItems2(fileDirItems: List<FileDirItem>): Pair<java.util.ArrayList<String>, java.util.ArrayList<Uri>> {
|
||||
val fileUris = java.util.ArrayList<Uri>()
|
||||
val successfulFilePaths = java.util.ArrayList<String>()
|
||||
val allIds = getMediaStoreIds(this)
|
||||
val filePaths = fileDirItems.map { it.path }
|
||||
filePaths.forEach { path ->
|
||||
for ((filePath, mediaStoreId) in allIds) {
|
||||
if (filePath.lowercase() == path.lowercase()) {
|
||||
val baseUri = getFileUri(filePath)
|
||||
val uri = ContentUris.withAppendedId(baseUri, mediaStoreId)
|
||||
fileUris.add(uri)
|
||||
successfulFilePaths.add(path)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return Pair(successfulFilePaths, fileUris)
|
||||
}
|
||||
|
||||
fun updateCurrentRecording(newId: Int) {
|
||||
val oldId = currRecordingId
|
||||
currRecordingId = newId
|
||||
|
|
|
@ -6,7 +6,7 @@ import androidx.appcompat.app.AlertDialog
|
|||
import com.simplemobiletools.commons.activities.BaseSimpleActivity
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||
import com.simplemobiletools.commons.helpers.isQPlus
|
||||
import com.simplemobiletools.commons.helpers.isRPlus
|
||||
import com.simplemobiletools.voicerecorder.R
|
||||
import com.simplemobiletools.voicerecorder.extensions.config
|
||||
import com.simplemobiletools.voicerecorder.helpers.getAudioFileContentUri
|
||||
|
@ -41,7 +41,7 @@ class RenameRecordingDialog(val activity: BaseSimpleActivity, val recording: Rec
|
|||
}
|
||||
|
||||
ensureBackgroundThread {
|
||||
if (isQPlus()) {
|
||||
if (isRPlus()) {
|
||||
updateMediaStoreTitle(recording, newTitle)
|
||||
} else {
|
||||
updateLegacyFilename(recording, newTitle)
|
||||
|
|
Loading…
Reference in New Issue