mirror of
https://github.com/SimpleMobileTools/Simple-Clock.git
synced 2025-04-05 22:31:00 +02:00
handle another case of Alarm sound URI fetching
This commit is contained in:
parent
23cf40108b
commit
711c230ac1
@ -9,7 +9,6 @@ import android.content.ComponentName
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.media.RingtoneManager
|
import android.media.RingtoneManager
|
||||||
import android.net.Uri
|
|
||||||
import android.text.SpannableString
|
import android.text.SpannableString
|
||||||
import android.text.style.RelativeSizeSpan
|
import android.text.style.RelativeSizeSpan
|
||||||
import android.widget.Toast
|
import android.widget.Toast
|
||||||
@ -78,7 +77,11 @@ fun Context.getAlarms(): ArrayList<AlarmSound> {
|
|||||||
|
|
||||||
while (cursor.moveToNext()) {
|
while (cursor.moveToNext()) {
|
||||||
val title = cursor.getString(RingtoneManager.TITLE_COLUMN_INDEX)
|
val title = cursor.getString(RingtoneManager.TITLE_COLUMN_INDEX)
|
||||||
val uri = Uri.parse("${cursor.getString(RingtoneManager.URI_COLUMN_INDEX)}/${cursor.getString(RingtoneManager.ID_COLUMN_INDEX)}").toString()
|
var uri = cursor.getString(RingtoneManager.URI_COLUMN_INDEX)
|
||||||
|
val id = cursor.getString(RingtoneManager.ID_COLUMN_INDEX)
|
||||||
|
if (!uri.endsWith(id)) {
|
||||||
|
uri += "/$id"
|
||||||
|
}
|
||||||
val alarmSound = AlarmSound(title, uri)
|
val alarmSound = AlarmSound(title, uri)
|
||||||
alarms.add(alarmSound)
|
alarms.add(alarmSound)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user