add a null check to settings ringtone name
This commit is contained in:
parent
aa827fe2a3
commit
1f6fbda451
|
@ -58,10 +58,11 @@ class SettingsActivity : SimpleActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupReminderSound() {
|
private fun setupReminderSound() {
|
||||||
|
val noRingtone = resources.getString(R.string.no_ringtone_selected)
|
||||||
if (config.reminderSound.isEmpty()) {
|
if (config.reminderSound.isEmpty()) {
|
||||||
settings_reminder_sound.text = resources.getString(R.string.no_ringtone_selected)
|
settings_reminder_sound.text = noRingtone
|
||||||
} else {
|
} else {
|
||||||
settings_reminder_sound.text = RingtoneManager.getRingtone(this, Uri.parse(config.reminderSound)).getTitle(this)
|
settings_reminder_sound.text = RingtoneManager.getRingtone(this, Uri.parse(config.reminderSound))?.getTitle(this) ?: noRingtone
|
||||||
}
|
}
|
||||||
settings_reminder_sound_holder.setOnClickListener {
|
settings_reminder_sound_holder.setOnClickListener {
|
||||||
Intent(RingtoneManager.ACTION_RINGTONE_PICKER).apply {
|
Intent(RingtoneManager.ACTION_RINGTONE_PICKER).apply {
|
||||||
|
|
Loading…
Reference in New Issue