mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-27 12:05:22 +00:00
Track previously selected per-recipient ringtone value.
Fixes #3397 Closes #3477
This commit is contained in:
parent
3a9ceb8371
commit
140cbe9f25
@ -9,7 +9,8 @@
|
||||
android:disableDependentsState="true"
|
||||
android:persistent="false" />
|
||||
|
||||
<RingtonePreference android:dependency="pref_key_recipient_mute"
|
||||
<org.thoughtcrime.securesms.preferences.AdvancedRingtonePreference
|
||||
android:dependency="pref_key_recipient_mute"
|
||||
android:key="pref_key_recipient_ringtone"
|
||||
android:title="@string/recipient_preferences__ringtone"
|
||||
android:ringtoneType="notification"
|
||||
|
@ -12,7 +12,6 @@ import android.os.Handler;
|
||||
import android.preference.CheckBoxPreference;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.RingtonePreference;
|
||||
import android.provider.Settings;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.Fragment;
|
||||
@ -31,6 +30,7 @@ import org.thoughtcrime.securesms.components.AvatarImageView;
|
||||
import org.thoughtcrime.securesms.crypto.MasterSecret;
|
||||
import org.thoughtcrime.securesms.database.DatabaseFactory;
|
||||
import org.thoughtcrime.securesms.database.RecipientPreferenceDatabase.VibrateState;
|
||||
import org.thoughtcrime.securesms.preferences.AdvancedRingtonePreference;
|
||||
import org.thoughtcrime.securesms.preferences.ColorPreference;
|
||||
import org.thoughtcrime.securesms.recipients.RecipientFactory;
|
||||
import org.thoughtcrime.securesms.recipients.Recipients;
|
||||
@ -184,11 +184,11 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
|
||||
}
|
||||
|
||||
private void setSummaries(Recipients recipients) {
|
||||
CheckBoxPreference mutePreference = (CheckBoxPreference) this.findPreference(PREFERENCE_MUTED);
|
||||
RingtonePreference ringtonePreference = (RingtonePreference) this.findPreference(PREFERENCE_TONE);
|
||||
ListPreference vibratePreference = (ListPreference) this.findPreference(PREFERENCE_VIBRATE);
|
||||
ColorPreference colorPreference = (ColorPreference) this.findPreference(PREFERENCE_COLOR);
|
||||
Preference blockPreference = this.findPreference(PREFERENCE_BLOCK);
|
||||
CheckBoxPreference mutePreference = (CheckBoxPreference) this.findPreference(PREFERENCE_MUTED);
|
||||
AdvancedRingtonePreference ringtonePreference = (AdvancedRingtonePreference) this.findPreference(PREFERENCE_TONE);
|
||||
ListPreference vibratePreference = (ListPreference) this.findPreference(PREFERENCE_VIBRATE);
|
||||
ColorPreference colorPreference = (ColorPreference) this.findPreference(PREFERENCE_COLOR);
|
||||
Preference blockPreference = this.findPreference(PREFERENCE_BLOCK);
|
||||
|
||||
mutePreference.setChecked(recipients.isMuted());
|
||||
|
||||
@ -197,6 +197,7 @@ public class RecipientPreferenceActivity extends PassphraseRequiredActionBarActi
|
||||
|
||||
if (tone != null) {
|
||||
ringtonePreference.setSummary(tone.getTitle(getActivity()));
|
||||
ringtonePreference.setCurrentRingtone(recipients.getRingtone());
|
||||
}
|
||||
} else {
|
||||
ringtonePreference.setSummary(R.string.preferences__default);
|
||||
|
@ -0,0 +1,31 @@
|
||||
package org.thoughtcrime.securesms.preferences;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.preference.RingtonePreference;
|
||||
import android.util.AttributeSet;
|
||||
|
||||
|
||||
public class AdvancedRingtonePreference extends RingtonePreference {
|
||||
|
||||
private Uri currentRingtone;
|
||||
|
||||
public AdvancedRingtonePreference(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
}
|
||||
public AdvancedRingtonePreference(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
}
|
||||
public AdvancedRingtonePreference(Context context) {
|
||||
super(context);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Uri onRestoreRingtone() {
|
||||
return currentRingtone;
|
||||
}
|
||||
|
||||
public void setCurrentRingtone(Uri uri) {
|
||||
currentRingtone = uri;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user