diff --git a/res/xml/recipient_preferences.xml b/res/xml/recipient_preferences.xml index 3c5beb89cf..b706c1ecc8 100644 --- a/res/xml/recipient_preferences.xml +++ b/res/xml/recipient_preferences.xml @@ -14,7 +14,7 @@ android:key="pref_key_recipient_ringtone" android:title="@string/recipient_preferences__notification_sound" android:ringtoneType="notification" - android:showSilent="false" + android:showSilent="true" android:showDefault="true" android:persistent="false"/> diff --git a/src/org/thoughtcrime/securesms/RecipientPreferenceActivity.java b/src/org/thoughtcrime/securesms/RecipientPreferenceActivity.java index da6479e2d8..4e4d3e0afa 100644 --- a/src/org/thoughtcrime/securesms/RecipientPreferenceActivity.java +++ b/src/org/thoughtcrime/securesms/RecipientPreferenceActivity.java @@ -21,7 +21,6 @@ import android.support.v4.app.Fragment; import android.support.v4.preference.PreferenceFragment; import android.support.v7.app.AlertDialog; import android.support.v7.widget.Toolbar; -import android.text.TextUtils; import android.view.MenuItem; import android.view.View; import android.widget.TextView; @@ -264,15 +263,21 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi mutePreference.setChecked(recipients.isMuted()); - if (recipients.getRingtone() != null) { - Ringtone tone = RingtoneManager.getRingtone(getActivity(), recipients.getRingtone()); + final Uri toneUri = recipients.getRingtone(); + + if (toneUri == null) { + ringtonePreference.setSummary(R.string.preferences__default); + ringtonePreference.setCurrentRingtone(Settings.System.DEFAULT_NOTIFICATION_URI); + } else if (toneUri.toString().isEmpty()) { + ringtonePreference.setSummary(R.string.preferences__silent); + ringtonePreference.setCurrentRingtone(null); + } else { + Ringtone tone = RingtoneManager.getRingtone(getActivity(), toneUri); if (tone != null) { ringtonePreference.setSummary(tone.getTitle(getActivity())); - ringtonePreference.setCurrentRingtone(recipients.getRingtone()); + ringtonePreference.setCurrentRingtone(toneUri); } - } else { - ringtonePreference.setSummary(R.string.preferences__default); } if (recipients.getVibrate() == VibrateState.DEFAULT) { @@ -336,7 +341,7 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi final Uri uri; - if (TextUtils.isEmpty(value) || Settings.System.DEFAULT_NOTIFICATION_URI.toString().equals(value)) { + if (Settings.System.DEFAULT_NOTIFICATION_URI.toString().equals(value)) { uri = null; } else { uri = Uri.parse(value);