[Restore] Fixed wrong file name in RestoreActivity
This commit is contained in:
parent
f4f4db4d47
commit
94925722ac
3 changed files with 6 additions and 8 deletions
|
@ -1,5 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name" translatable="false">Retro Music-Debug</string>
|
||||
|
||||
<bool name="md3_available">true</bool>
|
||||
<bool name="allowBackup">false</bool>
|
||||
</resources>
|
|
@ -67,17 +67,13 @@ class RestoreActivity : AppCompatActivity() {
|
|||
return uri.lastPathSegment
|
||||
}
|
||||
"content" -> {
|
||||
val proj = arrayOf(MediaStore.Images.Media.TITLE)
|
||||
val proj = arrayOf(MediaStore.Files.FileColumns.DISPLAY_NAME)
|
||||
contentResolver.query(
|
||||
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.Q) {
|
||||
MediaStore.Audio.Media.getContentUri(MediaStore.VOLUME_EXTERNAL)
|
||||
} else {
|
||||
MediaStore.Audio.Media.EXTERNAL_CONTENT_URI
|
||||
}, proj, null, null, null
|
||||
uri, proj, null, null, null
|
||||
)?.use { cursor ->
|
||||
if (cursor.count != 0) {
|
||||
val columnIndex: Int =
|
||||
cursor.getColumnIndexOrThrow(MediaStore.Images.Media.TITLE)
|
||||
cursor.getColumnIndexOrThrow(MediaStore.Files.FileColumns.DISPLAY_NAME)
|
||||
cursor.moveToFirst()
|
||||
return cursor.getString(columnIndex)
|
||||
}
|
||||
|
|
|
@ -459,7 +459,7 @@ object MusicPlayerRemote : KoinComponent {
|
|||
songFile = File(path)
|
||||
}
|
||||
if (songFile == null && uri.path != null) {
|
||||
songFile = File(uri.path)
|
||||
songFile = File(uri.path!!)
|
||||
}
|
||||
if (songFile != null) {
|
||||
songs = songRepository.songsByFilePath(songFile.absolutePath)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue