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