Skip to content
Snippets Groups Projects
Commit 2896700e authored by akwizgran's avatar akwizgran
Browse files

Merge branch 'preference-switches' into 'master'

Replace CheckBoxPreference with the more standard SwitchPreference

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