allow setting empty notification sound
This commit is contained in:
parent
efa9d542d7
commit
c4dc005a6c
|
@ -57,7 +57,11 @@ class SettingsActivity : SimpleActivity() {
|
|||
}
|
||||
|
||||
private fun setupReminderSound() {
|
||||
settings_reminder_sound.text = RingtoneManager.getRingtone(this, Uri.parse(config.reminderSound)).getTitle(this)
|
||||
if (config.reminderSound.isEmpty()) {
|
||||
settings_reminder_sound.text = resources.getString(R.string.no_ringtone_selected)
|
||||
} else {
|
||||
settings_reminder_sound.text = RingtoneManager.getRingtone(this, Uri.parse(config.reminderSound)).getTitle(this)
|
||||
}
|
||||
settings_reminder_sound_holder.setOnClickListener {
|
||||
Intent(RingtoneManager.ACTION_RINGTONE_PICKER).apply {
|
||||
putExtra(RingtoneManager.EXTRA_RINGTONE_TYPE, RingtoneManager.TYPE_NOTIFICATION)
|
||||
|
@ -147,11 +151,15 @@ class SettingsActivity : SimpleActivity() {
|
|||
custom_reminder_value.setText(value.toString())
|
||||
}
|
||||
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, intent: Intent?) {
|
||||
override fun onActivityResult(requestCode: Int, resultCode: Int, resultData: Intent?) {
|
||||
if (resultCode == Activity.RESULT_OK && requestCode == GET_RINGTONE_URI) {
|
||||
val uri = intent?.getParcelableExtra<Parcelable>(RingtoneManager.EXTRA_RINGTONE_PICKED_URI) ?: return
|
||||
settings_reminder_sound.text = RingtoneManager.getRingtone(this, uri as Uri).getTitle(this)
|
||||
config.reminderSound = uri.toString()
|
||||
val uri = resultData?.getParcelableExtra<Parcelable>(RingtoneManager.EXTRA_RINGTONE_PICKED_URI)
|
||||
if (uri == null) {
|
||||
config.reminderSound = ""
|
||||
} else {
|
||||
settings_reminder_sound.text = RingtoneManager.getRingtone(this, uri as Uri).getTitle(this)
|
||||
config.reminderSound = uri.toString()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
<string name="reminder_saved">Erinnerung gespeichert</string>
|
||||
<string name="notification_sound">Benachrichtigungs Ton</string>
|
||||
<string name="no_ringtone_picker">No app capable of setting ringtone found</string>
|
||||
<string name="no_ringtone_selected">None</string>
|
||||
|
||||
<plurals name="events_deleted">
|
||||
<item quantity="one">1 Termin gelöscht</item>
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
<string name="reminder_saved">Recordatorio guardado</string>
|
||||
<string name="notification_sound">Notification sound</string>
|
||||
<string name="no_ringtone_picker">No app capable of setting ringtone found</string>
|
||||
<string name="no_ringtone_selected">None</string>
|
||||
|
||||
<plurals name="events_deleted">
|
||||
<item quantity="one">1 evento borrado</item>
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
<string name="reminder_saved">Rappel sauvegardé</string>
|
||||
<string name="notification_sound">Son de notification</string>
|
||||
<string name="no_ringtone_picker">Aucune application capable de configurer la sonnerie trouvée</string>
|
||||
<string name="no_ringtone_selected">None</string>
|
||||
|
||||
<plurals name="events_deleted">
|
||||
<item quantity="one">1 événement supprimé</item>
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
<string name="reminder_saved">Reminder saved</string>
|
||||
<string name="notification_sound">Notification sound</string>
|
||||
<string name="no_ringtone_picker">No app capable of setting ringtone found</string>
|
||||
<string name="no_ringtone_selected">None</string>
|
||||
|
||||
<plurals name="events_deleted">
|
||||
<item quantity="one">1 इवेंट डिलीट किया गया</item>
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
<string name="reminder_saved">Emlékeztető elmentve</string>
|
||||
<string name="notification_sound">Notification sound</string>
|
||||
<string name="no_ringtone_picker">No app capable of setting ringtone found</string>
|
||||
<string name="no_ringtone_selected">None</string>
|
||||
|
||||
<plurals name="events_deleted">
|
||||
<item quantity="one">1 bejegyzés törölve</item>
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
<string name="reminder_saved">Reminder saved</string>
|
||||
<string name="notification_sound">Notification sound</string>
|
||||
<string name="no_ringtone_picker">No app capable of setting ringtone found</string>
|
||||
<string name="no_ringtone_selected">None</string>
|
||||
|
||||
<plurals name="events_deleted">
|
||||
<item quantity="one">1 evento eliminato</item>
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
<string name="reminder_saved">リマインダーを保存しました</string>
|
||||
<string name="notification_sound">Notification sound</string>
|
||||
<string name="no_ringtone_picker">No app capable of setting ringtone found</string>
|
||||
<string name="no_ringtone_selected">None</string>
|
||||
|
||||
<plurals name="events_deleted">
|
||||
<item quantity="one">1 イベントを削除しました</item>
|
||||
|
|
|
@ -58,7 +58,8 @@
|
|||
<string name="reminder_saved">Lembrete guardado</string>
|
||||
<string name="notification_sound">Som da notificação</string>
|
||||
<string name="no_ringtone_picker">Não foi encontrada qualquer aplicação capaz de definir o som</string>
|
||||
|
||||
<string name="no_ringtone_selected">None</string>
|
||||
|
||||
<plurals name="events_deleted">
|
||||
<item quantity="one">1 evento apagado</item>
|
||||
<item quantity="other">%1$d eventos apagados</item>
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
<string name="reminder_saved">Reminder saved</string>
|
||||
<string name="notification_sound">Notification sound</string>
|
||||
<string name="no_ringtone_picker">No app capable of setting ringtone found</string>
|
||||
<string name="no_ringtone_selected">None</string>
|
||||
|
||||
<plurals name="events_deleted">
|
||||
<item quantity="one">1 händelse borttagen</item>
|
||||
|
|
|
@ -58,6 +58,7 @@
|
|||
<string name="reminder_saved">Reminder saved</string>
|
||||
<string name="notification_sound">Notification sound</string>
|
||||
<string name="no_ringtone_picker">No app capable of setting ringtone found</string>
|
||||
<string name="no_ringtone_selected">None</string>
|
||||
|
||||
<plurals name="events_deleted">
|
||||
<item quantity="one">1 event deleted</item>
|
||||
|
|
Loading…
Reference in New Issue