mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-23 18:15:22 +00:00
enable silent per recipient ringtone preference
Closes #4957 // FREEBIE
This commit is contained in:
parent
143fb1fe21
commit
1aa2d546d2
@ -14,7 +14,7 @@
|
|||||||
android:key="pref_key_recipient_ringtone"
|
android:key="pref_key_recipient_ringtone"
|
||||||
android:title="@string/recipient_preferences__notification_sound"
|
android:title="@string/recipient_preferences__notification_sound"
|
||||||
android:ringtoneType="notification"
|
android:ringtoneType="notification"
|
||||||
android:showSilent="false"
|
android:showSilent="true"
|
||||||
android:showDefault="true"
|
android:showDefault="true"
|
||||||
android:persistent="false"/>
|
android:persistent="false"/>
|
||||||
|
|
||||||
|
@ -21,7 +21,6 @@ import android.support.v4.app.Fragment;
|
|||||||
import android.support.v4.preference.PreferenceFragment;
|
import android.support.v4.preference.PreferenceFragment;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
import android.text.TextUtils;
|
|
||||||
import android.view.MenuItem;
|
import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
@ -264,15 +263,21 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
|
|||||||
|
|
||||||
mutePreference.setChecked(recipients.isMuted());
|
mutePreference.setChecked(recipients.isMuted());
|
||||||
|
|
||||||
if (recipients.getRingtone() != null) {
|
final Uri toneUri = recipients.getRingtone();
|
||||||
Ringtone tone = RingtoneManager.getRingtone(getActivity(), 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) {
|
if (tone != null) {
|
||||||
ringtonePreference.setSummary(tone.getTitle(getActivity()));
|
ringtonePreference.setSummary(tone.getTitle(getActivity()));
|
||||||
ringtonePreference.setCurrentRingtone(recipients.getRingtone());
|
ringtonePreference.setCurrentRingtone(toneUri);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
ringtonePreference.setSummary(R.string.preferences__default);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (recipients.getVibrate() == VibrateState.DEFAULT) {
|
if (recipients.getVibrate() == VibrateState.DEFAULT) {
|
||||||
@ -336,7 +341,7 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
|
|||||||
|
|
||||||
final Uri uri;
|
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;
|
uri = null;
|
||||||
} else {
|
} else {
|
||||||
uri = Uri.parse(value);
|
uri = Uri.parse(value);
|
||||||
|
Loading…
Reference in New Issue
Block a user