show "No sound" at silent ringtones

This commit is contained in:
tibbi 2021-02-14 17:58:30 +01:00
parent c6a2f2c14b
commit 43e8dd3303
2 changed files with 13 additions and 5 deletions

View File

@ -499,8 +499,12 @@ class EditContactActivity : ContactActivity() {
val ringtone = contact!!.ringtone val ringtone = contact!!.ringtone
if (ringtone != null && ringtone.isNotEmpty()) { if (ringtone != null && ringtone.isNotEmpty()) {
if (ringtone == SILENT) {
contact_ringtone.text = getString(R.string.no_sound)
} else {
val contactRingtone = RingtoneManager.getRingtone(this, Uri.parse(ringtone)) val contactRingtone = RingtoneManager.getRingtone(this, Uri.parse(ringtone))
contact_ringtone.text = contactRingtone.getTitle(this) contact_ringtone.text = contactRingtone.getTitle(this)
}
} else { } else {
val default = getDefaultAlarmSound(RingtoneManager.TYPE_RINGTONE) val default = getDefaultAlarmSound(RingtoneManager.TYPE_RINGTONE)
contact_ringtone.text = default.title contact_ringtone.text = default.title

View File

@ -576,9 +576,13 @@ class ViewContactActivity : ContactActivity() {
val ringtone = contact!!.ringtone val ringtone = contact!!.ringtone
if (ringtone != null && ringtone.isNotEmpty()) { if (ringtone != null && ringtone.isNotEmpty()) {
if (ringtone == SILENT) {
contact_ringtone.text = getString(R.string.no_sound)
} else {
val contactRingtone = RingtoneManager.getRingtone(this, Uri.parse(ringtone)) val contactRingtone = RingtoneManager.getRingtone(this, Uri.parse(ringtone))
val ringtoneTitle = contactRingtone.getTitle(this) val ringtoneTitle = contactRingtone.getTitle(this)
contact_ringtone.text = ringtoneTitle contact_ringtone.text = ringtoneTitle
}
} else { } else {
val default = getDefaultAlarmSound(RingtoneManager.TYPE_RINGTONE) val default = getDefaultAlarmSound(RingtoneManager.TYPE_RINGTONE)
contact_ringtone.text = default.title contact_ringtone.text = default.title