mirror of
https://github.com/AllanWang/Frost-for-Facebook.git
synced 2024-11-10 04:52:38 +01:00
Document uri parse usage for ringtones
This commit is contained in:
parent
5094c9f259
commit
682227c17b
@ -97,6 +97,7 @@ fun NotificationCompat.Builder.setFrostAlert(enable: Boolean, ringtone: String):
|
||||
var defaults = 0
|
||||
if (Prefs.notificationVibrate) defaults = defaults or Notification.DEFAULT_VIBRATE
|
||||
if (Prefs.notificationSound) {
|
||||
// Ringtones have uris of format /content:/media/...; Uri.parse is okay
|
||||
if (ringtone.isNotBlank()) setSound(Uri.parse(ringtone))
|
||||
else defaults = defaults or Notification.DEFAULT_SOUND
|
||||
}
|
||||
|
@ -136,6 +136,7 @@ fun SettingsActivity.getNotificationPrefs(): KPrefAdapterBuilder.() -> Unit = {
|
||||
enabler = Prefs::notificationSound
|
||||
textGetter = {
|
||||
if (it.isBlank()) string(R.string.kau_default)
|
||||
// Ringtones have uris of format /content:/media/...; Uri.parse is okay
|
||||
else RingtoneManager.getRingtone(this@getNotificationPrefs, Uri.parse(it))
|
||||
?.getTitle(this@getNotificationPrefs)
|
||||
?: "---" //todo figure out why this happens
|
||||
@ -146,8 +147,10 @@ fun SettingsActivity.getNotificationPrefs(): KPrefAdapterBuilder.() -> Unit = {
|
||||
putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_SILENT, false)
|
||||
putExtra(RingtoneManager.EXTRA_RINGTONE_SHOW_DEFAULT, true)
|
||||
putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION)
|
||||
if (item.pref.isNotBlank())
|
||||
if (item.pref.isNotBlank()) {
|
||||
// Ringtones have uris of format /content:/media/...; Uri.parse is okay
|
||||
putExtra(RingtoneManager.EXTRA_RINGTONE_EXISTING_URI, Uri.parse(item.pref))
|
||||
}
|
||||
}
|
||||
startActivityForResult(intent, code)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user