Update recipient preference style

// FREEBIE
This commit is contained in:
Moxie Marlinspike 2017-08-22 14:00:09 -07:00
parent 64ad9ec9dd
commit 6bfe05323e
3 changed files with 20 additions and 12 deletions

View File

@ -1,15 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
android:key="pref_key_recipient_mute"
android:title="@string/recipient_preferences__mute_conversation"
android:summary="@string/recipient_preferences__disable_notifications_for_this_conversation"
android:defaultValue="false"
android:disableDependentsState="true"
android:persistent="false" />
<org.thoughtcrime.securesms.preferences.AdvancedRingtonePreference
<org.thoughtcrime.securesms.preferences.SignalRingtonePreference
android:dependency="pref_key_recipient_mute"
android:key="pref_key_recipient_ringtone"
android:title="@string/recipient_preferences__notification_sound"
@ -18,18 +18,18 @@
android:showDefault="true"
android:persistent="false"/>
<ListPreference android:dependency="pref_key_recipient_mute"
android:key="pref_key_recipient_vibrate"
android:title="@string/recipient_preferences__vibrate"
android:entries="@array/recipient_vibrate_entries"
android:entryValues="@array/recipient_vibrate_values"
android:defaultValue="0"
android:persistent="false"/>
<org.thoughtcrime.securesms.preferences.SignalListPreference
android:dependency="pref_key_recipient_mute"
android:key="pref_key_recipient_vibrate"
android:title="@string/recipient_preferences__vibrate"
android:entries="@array/recipient_vibrate_entries"
android:entryValues="@array/recipient_vibrate_values"
android:defaultValue="0"
android:persistent="false"/>
<org.thoughtcrime.securesms.preferences.ColorPreference
android:key="pref_key_recipient_color"
android:title="@string/recipient_preferences__color"
android:summary="@string/recipient_preferences__color_for_this_contact"
android:defaultValue="@android:color/black"
android:negativeButtonText="@null"
android:positiveButtonText="@null"

View File

@ -2,7 +2,9 @@ package org.thoughtcrime.securesms.preferences;
import android.content.Context;
import android.net.Uri;
import android.os.Build;
import android.preference.RingtonePreference;
import android.support.annotation.RequiresApi;
import android.util.AttributeSet;
@ -20,9 +22,15 @@ public class AdvancedRingtonePreference extends RingtonePreference {
super(context);
}
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public AdvancedRingtonePreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
super(context, attrs, defStyleAttr, defStyleRes);
}
@Override
protected Uri onRestoreRingtone() {
return currentRingtone;
if (currentRingtone == null) return super.onRestoreRingtone();
else return currentRingtone;
}
public void setCurrentRingtone(Uri uri) {

View File

@ -11,7 +11,7 @@ import android.widget.TextView;
import org.thoughtcrime.securesms.R;
public class SignalRingtonePreference extends RingtonePreference {
public class SignalRingtonePreference extends AdvancedRingtonePreference {
private TextView rightSummary;
private CharSequence summary;