mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-18 13:49:53 +01:00
Get rid of custom switch preference
This commit is contained in:
@@ -16,7 +16,7 @@ import androidx.lifecycle.LifecycleOwner;
|
|||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
import androidx.preference.ListPreference;
|
import androidx.preference.ListPreference;
|
||||||
import androidx.preference.PreferenceFragmentCompat;
|
import androidx.preference.PreferenceFragmentCompat;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.SwitchPreferenceCompat;
|
||||||
|
|
||||||
import static org.briarproject.briar.android.AppModule.getAndroidComponent;
|
import static org.briarproject.briar.android.AppModule.getAndroidComponent;
|
||||||
import static org.briarproject.briar.android.settings.SettingsActivity.enableAndPersist;
|
import static org.briarproject.briar.android.settings.SettingsActivity.enableAndPersist;
|
||||||
@@ -40,12 +40,12 @@ public class ConnectionsFragment extends PreferenceFragmentCompat {
|
|||||||
private SettingsViewModel viewModel;
|
private SettingsViewModel viewModel;
|
||||||
private ConnectionsManager connectionsManager;
|
private ConnectionsManager connectionsManager;
|
||||||
|
|
||||||
private SwitchPreference enableBluetooth;
|
private SwitchPreferenceCompat enableBluetooth;
|
||||||
private SwitchPreference enableWifi;
|
private SwitchPreferenceCompat enableWifi;
|
||||||
private SwitchPreference enableTor;
|
private SwitchPreferenceCompat enableTor;
|
||||||
private ListPreference torNetwork;
|
private ListPreference torNetwork;
|
||||||
private SwitchPreference torMobile;
|
private SwitchPreferenceCompat torMobile;
|
||||||
private SwitchPreference torOnlyWhenCharging;
|
private SwitchPreferenceCompat torOnlyWhenCharging;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttach(@NonNull Context context) {
|
public void onAttach(@NonNull Context context) {
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ import androidx.lifecycle.LifecycleOwner;
|
|||||||
import androidx.lifecycle.ViewModelProvider;
|
import androidx.lifecycle.ViewModelProvider;
|
||||||
import androidx.preference.ListPreference;
|
import androidx.preference.ListPreference;
|
||||||
import androidx.preference.PreferenceFragmentCompat;
|
import androidx.preference.PreferenceFragmentCompat;
|
||||||
import androidx.preference.SwitchPreference;
|
import androidx.preference.SwitchPreferenceCompat;
|
||||||
|
|
||||||
import static android.os.Build.VERSION.SDK_INT;
|
import static android.os.Build.VERSION.SDK_INT;
|
||||||
import static java.util.Objects.requireNonNull;
|
import static java.util.Objects.requireNonNull;
|
||||||
@@ -36,7 +36,7 @@ public class SecurityFragment extends PreferenceFragmentCompat {
|
|||||||
ViewModelProvider.Factory viewModelFactory;
|
ViewModelProvider.Factory viewModelFactory;
|
||||||
|
|
||||||
private SettingsViewModel viewModel;
|
private SettingsViewModel viewModel;
|
||||||
private SwitchPreference screenLock;
|
private SwitchPreferenceCompat screenLock;
|
||||||
private ListPreference screenLockTimeout;
|
private ListPreference screenLockTimeout;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -44,7 +44,6 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textColor="?android:attr/textColorPrimary"
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
android:textSize="@dimen/text_size_medium"
|
android:textSize="@dimen/text_size_medium"
|
||||||
android:widgetLayout="@layout/preference_switch_compat"
|
|
||||||
tools:checked="true"
|
tools:checked="true"
|
||||||
tools:text="@string/tor_enable_title" />
|
tools:text="@string/tor_enable_title" />
|
||||||
|
|
||||||
|
|||||||
@@ -1,11 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?><!-- Needed for SwitchPreference on Android 4 (API < 21)-->
|
|
||||||
<androidx.appcompat.widget.SwitchCompat xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
|
||||||
android:id="@android:id/switch_widget"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="@null"
|
|
||||||
android:clickable="false"
|
|
||||||
android:focusable="false"
|
|
||||||
android:focusableInTouchMode="false"
|
|
||||||
tools:targetApi="n" />
|
|
||||||
@@ -2,32 +2,29 @@
|
|||||||
<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">
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreferenceCompat
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:enabled="false"
|
android:enabled="false"
|
||||||
android:key="pref_key_bluetooth"
|
android:key="pref_key_bluetooth"
|
||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
android:title="@string/bluetooth_setting"
|
android:title="@string/bluetooth_setting"
|
||||||
android:widgetLayout="@layout/preference_switch_compat"
|
|
||||||
app:iconSpaceReserved="false" />
|
app:iconSpaceReserved="false" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreferenceCompat
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:enabled="false"
|
android:enabled="false"
|
||||||
android:key="pref_key_wifi"
|
android:key="pref_key_wifi"
|
||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
android:title="@string/wifi_setting"
|
android:title="@string/wifi_setting"
|
||||||
android:widgetLayout="@layout/preference_switch_compat"
|
|
||||||
app:iconSpaceReserved="false" />
|
app:iconSpaceReserved="false" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreferenceCompat
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:enabled="false"
|
android:enabled="false"
|
||||||
android:key="pref_key_tor_enable"
|
android:key="pref_key_tor_enable"
|
||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
android:summary="@string/tor_enable_summary"
|
android:summary="@string/tor_enable_summary"
|
||||||
android:title="@string/tor_enable_title"
|
android:title="@string/tor_enable_title"
|
||||||
android:widgetLayout="@layout/preference_switch_compat"
|
|
||||||
app:iconSpaceReserved="false" />
|
app:iconSpaceReserved="false" />
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
@@ -42,17 +39,16 @@
|
|||||||
android:title="@string/tor_network_setting"
|
android:title="@string/tor_network_setting"
|
||||||
app:iconSpaceReserved="false" />
|
app:iconSpaceReserved="false" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreferenceCompat
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:dependency="pref_key_tor_enable"
|
android:dependency="pref_key_tor_enable"
|
||||||
android:enabled="false"
|
android:enabled="false"
|
||||||
android:key="pref_key_tor_mobile_data"
|
android:key="pref_key_tor_mobile_data"
|
||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
android:title="@string/tor_mobile_data_title"
|
android:title="@string/tor_mobile_data_title"
|
||||||
android:widgetLayout="@layout/preference_switch_compat"
|
|
||||||
app:iconSpaceReserved="false" />
|
app:iconSpaceReserved="false" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreferenceCompat
|
||||||
android:defaultValue="false"
|
android:defaultValue="false"
|
||||||
android:dependency="pref_key_tor_enable"
|
android:dependency="pref_key_tor_enable"
|
||||||
android:enabled="false"
|
android:enabled="false"
|
||||||
@@ -60,7 +56,6 @@
|
|||||||
android:persistent="false"
|
android:persistent="false"
|
||||||
android:summary="@string/tor_only_when_charging_summary"
|
android:summary="@string/tor_only_when_charging_summary"
|
||||||
android:title="@string/tor_only_when_charging_title"
|
android:title="@string/tor_only_when_charging_title"
|
||||||
android:widgetLayout="@layout/preference_switch_compat"
|
|
||||||
app:iconSpaceReserved="false" />
|
app:iconSpaceReserved="false" />
|
||||||
|
|
||||||
</PreferenceScreen>
|
</PreferenceScreen>
|
||||||
|
|||||||
@@ -3,13 +3,12 @@
|
|||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools">
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreferenceCompat
|
||||||
android:enabled="false"
|
android:enabled="false"
|
||||||
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"
|
||||||
android:title="@string/pref_lock_title"
|
android:title="@string/pref_lock_title"
|
||||||
android:widgetLayout="@layout/preference_switch_compat"
|
|
||||||
app:iconSpaceReserved="false" />
|
app:iconSpaceReserved="false" />
|
||||||
|
|
||||||
<ListPreference
|
<ListPreference
|
||||||
|
|||||||
Reference in New Issue
Block a user