make use of the selected reminder audio stream

This commit is contained in:
tibbi 2018-07-04 14:32:08 +02:00
parent 11cbad20ba
commit 3f0c5b83fc
2 changed files with 3 additions and 4 deletions

View File

@ -296,7 +296,7 @@ class SettingsActivity : SimpleActivity() {
settings_reminder_sound.text = config.reminderSoundTitle
settings_reminder_sound_holder.setOnClickListener {
SelectAlarmSoundDialog(this, config.reminderSoundUri, AudioManager.STREAM_ALARM, GET_RINGTONE_URI, ALARM_SOUND_TYPE_NOTIFICATION, false,
SelectAlarmSoundDialog(this, config.reminderSoundUri, config.reminderAudioStream, GET_RINGTONE_URI, ALARM_SOUND_TYPE_NOTIFICATION, false,
onAlarmPicked = {
if (it != null) {
updateReminderSound(it)

View File

@ -11,7 +11,6 @@ import android.content.Intent
import android.content.res.Resources
import android.database.ContentObserver
import android.media.AudioAttributes
import android.media.AudioManager
import android.net.Uri
import android.os.Bundle
import android.provider.CalendarContract
@ -200,7 +199,7 @@ fun Context.getNotification(pendingIntent: PendingIntent, event: Event, content:
val audioAttributes = AudioAttributes.Builder()
.setUsage(AudioAttributes.USAGE_ALARM)
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
.setLegacyStreamType(AudioManager.STREAM_ALARM)
.setLegacyStreamType(config.reminderAudioStream)
.setFlags(AudioAttributes.FLAG_AUDIBILITY_ENFORCED)
.build()
@ -228,7 +227,7 @@ fun Context.getNotification(pendingIntent: PendingIntent, event: Event, content:
.setPriority(NotificationCompat.PRIORITY_MAX)
.setDefaults(Notification.DEFAULT_LIGHTS)
.setAutoCancel(true)
.setSound(Uri.parse(soundUri), AudioManager.STREAM_ALARM)
.setSound(Uri.parse(soundUri), config.reminderAudioStream)
.setChannelId(channelId)
.addAction(R.drawable.ic_snooze, getString(R.string.snooze), getSnoozePendingIntent(this, event))