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

View File

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

View File

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