mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 01:07:47 +00:00
Slim down some preference screens
// FREEBIE
This commit is contained in:
parent
438a78ed30
commit
2dceef50b7
15
res/layout/preference_right_summary_widget.xml
Normal file
15
res/layout/preference_right_summary_widget.xml
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<TextView android:id="@+id/right_summary"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="right|center_vertical"
|
||||||
|
android:gravity="right|center_vertical"
|
||||||
|
android:textSize="16sp"
|
||||||
|
android:textColor="@color/signal_primary_dark"/>
|
||||||
|
|
||||||
|
</FrameLayout>
|
@ -1199,6 +1199,8 @@
|
|||||||
<string name="preferences_chats__chats">Chats</string>
|
<string name="preferences_chats__chats">Chats</string>
|
||||||
<string name="preferences_notifications__message_notifications">Message notifications</string>
|
<string name="preferences_notifications__message_notifications">Message notifications</string>
|
||||||
<string name="preferences_notifications__events">Events</string>
|
<string name="preferences_notifications__events">Events</string>
|
||||||
|
<string name="preferences_notifications__in_chat_sounds">In-chat sounds</string>
|
||||||
|
<string name="preferences_notifications__show">Show</string>
|
||||||
<string name="preferences_chats__show_invitation_prompts">Show invitation prompts</string>
|
<string name="preferences_chats__show_invitation_prompts">Show invitation prompts</string>
|
||||||
<string name="preferences_chats__display_invitation_prompts_for_contacts_without_signal">Display invitation prompts for contacts without Signal</string>
|
<string name="preferences_chats__display_invitation_prompts_for_contacts_without_signal">Display invitation prompts for contacts without Signal</string>
|
||||||
<string name="preferences_chats__message_text_size">Message font size</string>
|
<string name="preferences_chats__message_text_size">Message font size</string>
|
||||||
|
@ -13,7 +13,8 @@
|
|||||||
android:summary="@string/preferences__change_your_passphrase"
|
android:summary="@string/preferences__change_your_passphrase"
|
||||||
android:dependency="pref_enable_passphrase_temporary"/>
|
android:dependency="pref_enable_passphrase_temporary"/>
|
||||||
|
|
||||||
<CheckBoxPreference android:defaultValue="false"
|
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
|
||||||
|
android:defaultValue="false"
|
||||||
android:key="pref_timeout_passphrase"
|
android:key="pref_timeout_passphrase"
|
||||||
android:title="@string/preferences__inactivity_timeout_passphrase"
|
android:title="@string/preferences__inactivity_timeout_passphrase"
|
||||||
android:summary="@string/preferences__auto_lock_signal_after_a_specified_time_interval_of_inactivity"
|
android:summary="@string/preferences__auto_lock_signal_after_a_specified_time_interval_of_inactivity"
|
||||||
|
@ -1,14 +1,16 @@
|
|||||||
<?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">
|
||||||
<ListPreference android:key="pref_theme"
|
<org.thoughtcrime.securesms.preferences.SignalListPreference
|
||||||
|
android:key="pref_theme"
|
||||||
android:title="@string/preferences__theme"
|
android:title="@string/preferences__theme"
|
||||||
android:entries="@array/pref_theme_entries"
|
android:entries="@array/pref_theme_entries"
|
||||||
android:entryValues="@array/pref_theme_values"
|
android:entryValues="@array/pref_theme_values"
|
||||||
android:defaultValue="light">
|
android:defaultValue="light">
|
||||||
</ListPreference>
|
</org.thoughtcrime.securesms.preferences.SignalListPreference>
|
||||||
|
|
||||||
<ListPreference android:key="pref_language"
|
<org.thoughtcrime.securesms.preferences.SignalListPreference
|
||||||
|
android:key="pref_language"
|
||||||
android:title="@string/preferences__language"
|
android:title="@string/preferences__language"
|
||||||
android:entries="@array/language_entries"
|
android:entries="@array/language_entries"
|
||||||
android:entryValues="@array/language_values"
|
android:entryValues="@array/language_values"
|
||||||
|
@ -30,12 +30,13 @@
|
|||||||
<PreferenceCategory android:layout="@layout/preference_divider"/>
|
<PreferenceCategory android:layout="@layout/preference_divider"/>
|
||||||
|
|
||||||
<PreferenceCategory android:title="@string/preferences_chats__chats">
|
<PreferenceCategory android:title="@string/preferences_chats__chats">
|
||||||
<ListPreference android:key="pref_message_body_text_size"
|
<org.thoughtcrime.securesms.preferences.SignalListPreference
|
||||||
|
android:key="pref_message_body_text_size"
|
||||||
android:title="@string/preferences_chats__message_text_size"
|
android:title="@string/preferences_chats__message_text_size"
|
||||||
android:entries="@array/pref_message_font_size_entries"
|
android:entries="@array/pref_message_font_size_entries"
|
||||||
android:entryValues="@array/pref_message_font_size_values"
|
android:entryValues="@array/pref_message_font_size_values"
|
||||||
android:defaultValue="16">
|
android:defaultValue="16">
|
||||||
</ListPreference>
|
</org.thoughtcrime.securesms.preferences.SignalListPreference>
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
|
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
|
@ -7,10 +7,10 @@
|
|||||||
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
|
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
|
||||||
android:key="pref_key_enable_notifications"
|
android:key="pref_key_enable_notifications"
|
||||||
android:title="@string/preferences__notifications"
|
android:title="@string/preferences__notifications"
|
||||||
android:summary="@string/preferences__enable_message_notifications"
|
|
||||||
android:defaultValue="true" />
|
android:defaultValue="true" />
|
||||||
|
|
||||||
<RingtonePreference android:dependency="pref_key_enable_notifications"
|
<org.thoughtcrime.securesms.preferences.SignalRingtonePreference
|
||||||
|
android:dependency="pref_key_enable_notifications"
|
||||||
android:key="pref_key_ringtone"
|
android:key="pref_key_ringtone"
|
||||||
android:title="@string/preferences__sound"
|
android:title="@string/preferences__sound"
|
||||||
android:ringtoneType="notification"
|
android:ringtoneType="notification"
|
||||||
@ -20,8 +20,7 @@
|
|||||||
android:dependency="pref_key_enable_notifications"
|
android:dependency="pref_key_enable_notifications"
|
||||||
android:key="pref_key_vibrate"
|
android:key="pref_key_vibrate"
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:title="@string/preferences__vibrate"
|
android:title="@string/preferences__vibrate"/>
|
||||||
android:summary="@string/preferences__also_vibrate_when_notified" />
|
|
||||||
|
|
||||||
<org.thoughtcrime.securesms.preferences.LEDColorListPreference
|
<org.thoughtcrime.securesms.preferences.LEDColorListPreference
|
||||||
android:key="pref_led_color"
|
android:key="pref_led_color"
|
||||||
@ -41,12 +40,11 @@
|
|||||||
|
|
||||||
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
|
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
|
||||||
android:key="pref_key_inthread_notifications"
|
android:key="pref_key_inthread_notifications"
|
||||||
android:title="@string/preferences__in_conversation_notifications"
|
android:title="@string/preferences_notifications__in_chat_sounds"
|
||||||
android:summary="@string/preferences__play_inthread_notifications"
|
|
||||||
android:dependency="pref_key_enable_notifications"
|
android:dependency="pref_key_enable_notifications"
|
||||||
android:defaultValue="true" />
|
android:defaultValue="true" />
|
||||||
|
|
||||||
<ListPreference
|
<org.thoughtcrime.securesms.preferences.SignalListPreference
|
||||||
android:key="pref_repeat_alerts"
|
android:key="pref_repeat_alerts"
|
||||||
android:defaultValue="0"
|
android:defaultValue="0"
|
||||||
android:title="@string/preferences__repeat_alerts"
|
android:title="@string/preferences__repeat_alerts"
|
||||||
@ -54,8 +52,9 @@
|
|||||||
android:entries="@array/pref_repeat_alerts_entries"
|
android:entries="@array/pref_repeat_alerts_entries"
|
||||||
android:entryValues="@array/pref_repeat_alerts_values" />
|
android:entryValues="@array/pref_repeat_alerts_values" />
|
||||||
|
|
||||||
<ListPreference android:key="pref_notification_privacy"
|
<org.thoughtcrime.securesms.preferences.SignalListPreference
|
||||||
android:title="@string/preferences_notifications__display_in_notifications"
|
android:key="pref_notification_privacy"
|
||||||
|
android:title="@string/preferences_notifications__show"
|
||||||
android:dependency="pref_key_enable_notifications"
|
android:dependency="pref_key_enable_notifications"
|
||||||
android:defaultValue="all"
|
android:defaultValue="all"
|
||||||
android:entries="@array/pref_notification_privacy_entries"
|
android:entries="@array/pref_notification_privacy_entries"
|
||||||
@ -68,7 +67,6 @@
|
|||||||
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
|
<org.thoughtcrime.securesms.components.SwitchPreferenceCompat
|
||||||
android:key="pref_enable_new_contacts_notifications"
|
android:key="pref_enable_new_contacts_notifications"
|
||||||
android:title="@string/preferences_events__contact_joined_signal"
|
android:title="@string/preferences_events__contact_joined_signal"
|
||||||
android:summary="@string/preferences__show_a_notification_for_new_signal_contacts"
|
|
||||||
android:defaultValue="true" />
|
android:defaultValue="true" />
|
||||||
</PreferenceCategory>
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ import org.thoughtcrime.securesms.util.TextSecurePreferences;
|
|||||||
* @author Moxie Marlinspike
|
* @author Moxie Marlinspike
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class LedBlinkPatternListPreference extends ListPreference implements OnSeekBarChangeListener {
|
public class LedBlinkPatternListPreference extends SignalListPreference implements OnSeekBarChangeListener {
|
||||||
|
|
||||||
private Context context;
|
private Context context;
|
||||||
private SeekBar seekBarOn;
|
private SeekBar seekBarOn;
|
||||||
|
@ -0,0 +1,65 @@
|
|||||||
|
package org.thoughtcrime.securesms.preferences;
|
||||||
|
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.preference.ListPreference;
|
||||||
|
import android.support.annotation.RequiresApi;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.util.TypedValue;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.R;
|
||||||
|
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||||
|
|
||||||
|
public class SignalListPreference extends ListPreference {
|
||||||
|
|
||||||
|
private TextView rightSummary;
|
||||||
|
private CharSequence summary;
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||||
|
public SignalListPreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||||
|
super(context, attrs, defStyleAttr, defStyleRes);
|
||||||
|
initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||||
|
public SignalListPreference(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||||
|
super(context, attrs, defStyleAttr);
|
||||||
|
initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
public SignalListPreference(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
public SignalListPreference(Context context) {
|
||||||
|
super(context);
|
||||||
|
initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initialize() {
|
||||||
|
setWidgetLayoutResource(R.layout.preference_right_summary_widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onBindView(View view) {
|
||||||
|
super.onBindView(view);
|
||||||
|
|
||||||
|
this.rightSummary = (TextView)view.findViewById(R.id.right_summary);
|
||||||
|
setSummary(this.summary);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSummary(CharSequence summary) {
|
||||||
|
super.setSummary(null);
|
||||||
|
|
||||||
|
this.summary = summary;
|
||||||
|
|
||||||
|
if (this.rightSummary != null) {
|
||||||
|
this.rightSummary.setText(summary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,63 @@
|
|||||||
|
package org.thoughtcrime.securesms.preferences;
|
||||||
|
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import android.os.Build;
|
||||||
|
import android.preference.RingtonePreference;
|
||||||
|
import android.support.annotation.RequiresApi;
|
||||||
|
import android.util.AttributeSet;
|
||||||
|
import android.view.View;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import org.thoughtcrime.securesms.R;
|
||||||
|
|
||||||
|
public class SignalRingtonePreference extends RingtonePreference {
|
||||||
|
|
||||||
|
private TextView rightSummary;
|
||||||
|
private CharSequence summary;
|
||||||
|
|
||||||
|
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
|
||||||
|
public SignalRingtonePreference(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) {
|
||||||
|
super(context, attrs, defStyleAttr, defStyleRes);
|
||||||
|
initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
public SignalRingtonePreference(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||||
|
super(context, attrs, defStyleAttr);
|
||||||
|
initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
public SignalRingtonePreference(Context context, AttributeSet attrs) {
|
||||||
|
super(context, attrs);
|
||||||
|
initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
public SignalRingtonePreference(Context context) {
|
||||||
|
super(context);
|
||||||
|
initialize();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void initialize() {
|
||||||
|
setWidgetLayoutResource(R.layout.preference_right_summary_widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void onBindView(View view) {
|
||||||
|
super.onBindView(view);
|
||||||
|
|
||||||
|
this.rightSummary = (TextView)view.findViewById(R.id.right_summary);
|
||||||
|
setSummary(summary);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setSummary(CharSequence summary) {
|
||||||
|
this.summary = summary;
|
||||||
|
|
||||||
|
super.setSummary(null);
|
||||||
|
|
||||||
|
if (rightSummary != null) {
|
||||||
|
rightSummary.setText(summary);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user