Commit 2896700e authored by akwizgran's avatar akwizgran

Merge branch 'preference-switches' into 'master'

Replace CheckBoxPreference with the more standard SwitchPreference

See merge request briar/briar!891
parents 42031631 987baba3
...@@ -9,8 +9,8 @@ import android.content.pm.PackageManager; ...@@ -9,8 +9,8 @@ import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo; import android.content.pm.ResolveInfo;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.support.v14.preference.SwitchPreference;
import android.support.v7.app.AlertDialog; import android.support.v7.app.AlertDialog;
import android.support.v7.preference.CheckBoxPreference;
import android.support.v7.preference.ListPreference; import android.support.v7.preference.ListPreference;
import android.support.v7.preference.PreferenceFragmentCompat; import android.support.v7.preference.PreferenceFragmentCompat;
import android.text.TextUtils; import android.text.TextUtils;
...@@ -37,7 +37,7 @@ public class PanicPreferencesFragment extends PreferenceFragmentCompat ...@@ -37,7 +37,7 @@ public class PanicPreferencesFragment extends PreferenceFragmentCompat
Logger.getLogger(PanicPreferencesFragment.class.getName()); Logger.getLogger(PanicPreferencesFragment.class.getName());
private PackageManager pm; private PackageManager pm;
private CheckBoxPreference lockPref, purgePref, uninstallPref; private SwitchPreference lockPref, purgePref, uninstallPref;
private ListPreference panicAppPref; private ListPreference panicAppPref;
@Override @Override
...@@ -46,10 +46,10 @@ public class PanicPreferencesFragment extends PreferenceFragmentCompat ...@@ -46,10 +46,10 @@ public class PanicPreferencesFragment extends PreferenceFragmentCompat
pm = getActivity().getPackageManager(); pm = getActivity().getPackageManager();
lockPref = (CheckBoxPreference) findPreference(KEY_LOCK); lockPref = (SwitchPreference) findPreference(KEY_LOCK);
panicAppPref = (ListPreference) findPreference(KEY_PANIC_APP); panicAppPref = (ListPreference) findPreference(KEY_PANIC_APP);
purgePref = (CheckBoxPreference) findPreference(KEY_PURGE); purgePref = (SwitchPreference) findPreference(KEY_PURGE);
uninstallPref = (CheckBoxPreference) findPreference(KEY_UNINSTALL); uninstallPref = (SwitchPreference) findPreference(KEY_UNINSTALL);
// check for connect/disconnect intents from panic trigger apps // check for connect/disconnect intents from panic trigger apps
if (PanicResponder.checkForDisconnectIntent(getActivity())) { if (PanicResponder.checkForDisconnectIntent(getActivity())) {
......
...@@ -10,9 +10,9 @@ import android.media.RingtoneManager; ...@@ -10,9 +10,9 @@ import android.media.RingtoneManager;
import android.net.Uri; import android.net.Uri;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.StringRes; import android.support.annotation.StringRes;
import android.support.v14.preference.SwitchPreference;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.support.v4.text.TextUtilsCompat; import android.support.v4.text.TextUtilsCompat;
import android.support.v7.preference.CheckBoxPreference;
import android.support.v7.preference.ListPreference; import android.support.v7.preference.ListPreference;
import android.support.v7.preference.Preference; import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceFragmentCompat; import android.support.v7.preference.PreferenceFragmentCompat;
...@@ -122,15 +122,14 @@ public class SettingsFragment extends PreferenceFragmentCompat ...@@ -122,15 +122,14 @@ public class SettingsFragment extends PreferenceFragmentCompat
private ListPreference language; private ListPreference language;
private ListPreference enableBluetooth; private ListPreference enableBluetooth;
private ListPreference torNetwork; private ListPreference torNetwork;
private CheckBoxPreference torBlocked; private SwitchPreference torBlocked;
private CheckBoxPreference screenLock; private SwitchPreference screenLock;
private CheckBoxPreference notifyPrivateMessages; private SwitchPreference notifyPrivateMessages;
private CheckBoxPreference notifyGroupMessages; private SwitchPreference notifyGroupMessages;
private CheckBoxPreference notifyForumPosts; private SwitchPreference notifyForumPosts;
private CheckBoxPreference notifyBlogPosts; private SwitchPreference notifyBlogPosts;
private CheckBoxPreference notifyVibration; private SwitchPreference notifyVibration;
private CheckBoxPreference notifyLockscreen; private SwitchPreference notifyLockscreen;
private Preference notifySound; private Preference notifySound;
// Fields that are accessed from background threads must be volatile // Fields that are accessed from background threads must be volatile
...@@ -162,22 +161,22 @@ public class SettingsFragment extends PreferenceFragmentCompat ...@@ -162,22 +161,22 @@ public class SettingsFragment extends PreferenceFragmentCompat
(ListPreference) findPreference("pref_key_theme"); (ListPreference) findPreference("pref_key_theme");
enableBluetooth = (ListPreference) findPreference("pref_key_bluetooth"); enableBluetooth = (ListPreference) findPreference("pref_key_bluetooth");
torNetwork = (ListPreference) findPreference("pref_key_tor_network"); torNetwork = (ListPreference) findPreference("pref_key_tor_network");
torBlocked = (CheckBoxPreference) findPreference(TOR_LOCATION); torBlocked = (SwitchPreference) findPreference(TOR_LOCATION);
setBlockedCountries(); setBlockedCountries();
CheckBoxPreference notifySignIn = SwitchPreference notifySignIn =
(CheckBoxPreference) findPreference(NOTIFY_SIGN_IN); (SwitchPreference) findPreference(NOTIFY_SIGN_IN);
screenLock = (CheckBoxPreference) findPreference(PREF_SCREEN_LOCK); screenLock = (SwitchPreference) findPreference(PREF_SCREEN_LOCK);
notifyPrivateMessages = (CheckBoxPreference) findPreference( notifyPrivateMessages = (SwitchPreference) findPreference(
"pref_key_notify_private_messages"); "pref_key_notify_private_messages");
notifyGroupMessages = (CheckBoxPreference) findPreference( notifyGroupMessages = (SwitchPreference) findPreference(
"pref_key_notify_group_messages"); "pref_key_notify_group_messages");
notifyForumPosts = (CheckBoxPreference) findPreference( notifyForumPosts = (SwitchPreference) findPreference(
"pref_key_notify_forum_posts"); "pref_key_notify_forum_posts");
notifyBlogPosts = (CheckBoxPreference) findPreference( notifyBlogPosts = (SwitchPreference) findPreference(
"pref_key_notify_blog_posts"); "pref_key_notify_blog_posts");
notifyVibration = (CheckBoxPreference) findPreference( notifyVibration = (SwitchPreference) findPreference(
"pref_key_notify_vibration"); "pref_key_notify_vibration");
notifyLockscreen = (CheckBoxPreference) findPreference( notifyLockscreen = (SwitchPreference) findPreference(
"pref_key_notify_lock_screen"); "pref_key_notify_lock_screen");
notifySound = findPreference("pref_key_notify_sound"); notifySound = findPreference("pref_key_notify_sound");
...@@ -451,7 +450,7 @@ public class SettingsFragment extends PreferenceFragmentCompat ...@@ -451,7 +450,7 @@ public class SettingsFragment extends PreferenceFragmentCompat
} }
@TargetApi(26) @TargetApi(26)
private void setupNotificationPreference(CheckBoxPreference pref, private void setupNotificationPreference(SwitchPreference pref,
String channelId, @StringRes int summary) { String channelId, @StringRes int summary) {
pref.setWidgetLayoutResource(0); pref.setWidgetLayoutResource(0);
pref.setSummary(summary); pref.setSummary(summary);
......
...@@ -8,21 +8,21 @@ ...@@ -8,21 +8,21 @@
android:summary="@string/panic_app_setting_summary" android:summary="@string/panic_app_setting_summary"
android:title="@string/panic_app_setting_title"/> android:title="@string/panic_app_setting_title"/>
<CheckBoxPreference <SwitchPreference
android:defaultValue="true" android:defaultValue="true"
android:enabled="false" android:enabled="false"
android:key="pref_key_lock" android:key="pref_key_lock"
android:summary="@string/panic_setting_signout_summary" android:summary="@string/panic_setting_signout_summary"
android:title="@string/panic_setting_signout_title"/> android:title="@string/panic_setting_signout_title"/>
<CheckBoxPreference <SwitchPreference
android:defaultValue="false" android:defaultValue="false"
android:enabled="false" android:enabled="false"
android:key="pref_key_purge" android:key="pref_key_purge"
android:summary="@string/purge_setting_summary" android:summary="@string/purge_setting_summary"
android:title="@string/purge_setting_title"/> android:title="@string/purge_setting_title"/>
<CheckBoxPreference <SwitchPreference
android:defaultValue="false" android:defaultValue="false"
android:enabled="false" android:enabled="false"
android:key="pref_key_uninstall" android:key="pref_key_uninstall"
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
android:summary="%s" android:summary="%s"
android:title="@string/tor_network_setting"/> android:title="@string/tor_network_setting"/>
<CheckBoxPreference <SwitchPreference
android:defaultValue="true" android:defaultValue="true"
android:key="pref_key_tor_location" android:key="pref_key_tor_location"
android:persistent="false" android:persistent="false"
...@@ -56,7 +56,7 @@ ...@@ -56,7 +56,7 @@
android:layout="@layout/preferences_category" android:layout="@layout/preferences_category"
android:title="@string/security_settings_title"> android:title="@string/security_settings_title">
<CheckBoxPreference <SwitchPreference
android:key="pref_key_lock" android:key="pref_key_lock"
android:persistent="false" android:persistent="false"
android:summary="@string/pref_lock_summary" android:summary="@string/pref_lock_summary"
...@@ -94,41 +94,41 @@ ...@@ -94,41 +94,41 @@
android:layout="@layout/preferences_category" android:layout="@layout/preferences_category"
android:title="@string/notification_settings_title"> android:title="@string/notification_settings_title">
<CheckBoxPreference <SwitchPreference
android:defaultValue="true" android:defaultValue="true"
android:key="pref_key_notify_sign_in" android:key="pref_key_notify_sign_in"
android:summary="@string/notify_sign_in_summary" android:summary="@string/notify_sign_in_summary"
android:title="@string/notify_sign_in_title"/> android:title="@string/notify_sign_in_title"/>
<CheckBoxPreference <SwitchPreference
android:defaultValue="true" android:defaultValue="true"
android:key="pref_key_notify_private_messages" android:key="pref_key_notify_private_messages"
android:persistent="false" android:persistent="false"
android:summary="@string/notify_private_messages_setting_summary" android:summary="@string/notify_private_messages_setting_summary"
android:title="@string/notify_private_messages_setting_title"/> android:title="@string/notify_private_messages_setting_title"/>
<CheckBoxPreference <SwitchPreference
android:defaultValue="true" android:defaultValue="true"
android:key="pref_key_notify_group_messages" android:key="pref_key_notify_group_messages"
android:persistent="false" android:persistent="false"
android:summary="@string/notify_group_messages_setting_summary" android:summary="@string/notify_group_messages_setting_summary"
android:title="@string/notify_group_messages_setting_title"/> android:title="@string/notify_group_messages_setting_title"/>
<CheckBoxPreference <SwitchPreference
android:defaultValue="true" android:defaultValue="true"
android:key="pref_key_notify_forum_posts" android:key="pref_key_notify_forum_posts"
android:persistent="false" android:persistent="false"
android:summary="@string/notify_forum_posts_setting_summary" android:summary="@string/notify_forum_posts_setting_summary"
android:title="@string/notify_forum_posts_setting_title"/> android:title="@string/notify_forum_posts_setting_title"/>
<CheckBoxPreference <SwitchPreference
android:defaultValue="true" android:defaultValue="true"
android:key="pref_key_notify_blog_posts" android:key="pref_key_notify_blog_posts"
android:persistent="false" android:persistent="false"
android:summary="@string/notify_blog_posts_setting_summary" android:summary="@string/notify_blog_posts_setting_summary"
android:title="@string/notify_blog_posts_setting_title"/> android:title="@string/notify_blog_posts_setting_title"/>
<CheckBoxPreference <SwitchPreference
android:defaultValue="false" android:defaultValue="false"
android:key="pref_key_notify_lock_screen" android:key="pref_key_notify_lock_screen"
android:persistent="false" android:persistent="false"
...@@ -136,7 +136,7 @@ ...@@ -136,7 +136,7 @@
android:title="@string/notify_lock_screen_setting_title" android:title="@string/notify_lock_screen_setting_title"
android:visibility="gone"/> android:visibility="gone"/>
<CheckBoxPreference <SwitchPreference
android:defaultValue="true" android:defaultValue="true"
android:key="pref_key_notify_vibration" android:key="pref_key_notify_vibration"
android:persistent="false" android:persistent="false"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment