From e07a5da95c2ff767f30c91666f0e52a3ce1e3ac6 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 2 Jul 2022 15:11:18 +0200 Subject: [PATCH] fix renaming on Android 10 --- app/build.gradle | 2 +- .../adapters/RecordingsAdapter.kt | 23 ------------------- .../dialogs/RenameRecordingDialog.kt | 4 ++-- 3 files changed, 3 insertions(+), 26 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 1d7f540..4d96e67 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -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' diff --git a/app/src/main/kotlin/com/simplemobiletools/voicerecorder/adapters/RecordingsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/voicerecorder/adapters/RecordingsAdapter.kt index 3e018ef..493b293 100644 --- a/app/src/main/kotlin/com/simplemobiletools/voicerecorder/adapters/RecordingsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/voicerecorder/adapters/RecordingsAdapter.kt @@ -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): Pair, java.util.ArrayList> { - val fileUris = java.util.ArrayList() - val successfulFilePaths = java.util.ArrayList() - 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 diff --git a/app/src/main/kotlin/com/simplemobiletools/voicerecorder/dialogs/RenameRecordingDialog.kt b/app/src/main/kotlin/com/simplemobiletools/voicerecorder/dialogs/RenameRecordingDialog.kt index e31841d..3baaf3b 100644 --- a/app/src/main/kotlin/com/simplemobiletools/voicerecorder/dialogs/RenameRecordingDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/voicerecorder/dialogs/RenameRecordingDialog.kt @@ -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)