Merge pull request #7579 from osmandapp/ProfileSettingsImprovements

Preferences fixes
This commit is contained in:
max-klaus 2019-09-23 09:06:08 +03:00 committed by GitHub
commit a74cd4fca6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 89 additions and 79 deletions

View file

@ -42,8 +42,8 @@
android:layout_marginBottom="@dimen/context_menu_padding_margin_tiny"
android:background="?attr/divider_color_basic" />
<Switch
android:id="@android:id/switch_widget"
<android.support.v7.widget.SwitchCompat
android:id="@+id/switchWidget"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@null"

View file

@ -53,8 +53,8 @@
</LinearLayout>
<Switch
android:id="@android:id/switch_widget"
<android.support.v7.widget.SwitchCompat
android:id="@+id/switchWidget"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@null"

View file

@ -32,8 +32,8 @@
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_medium" />
<Switch
android:id="@android:id/switch_widget"
<android.support.v7.widget.SwitchCompat
android:id="@+id/switchWidget"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@null"

View file

@ -61,8 +61,8 @@
android:layout_marginBottom="18dp"
android:background="?attr/divider_color_basic" />
<Switch
android:id="@android:id/switch_widget"
<android.support.v7.widget.SwitchCompat
android:id="@+id/switchWidget"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@null"

View file

@ -82,7 +82,7 @@
android:summaryOn="@string/shared_string_on"
android:title="@string/tap_on_map_to_hide_interface" />
<SwitchPreference
<SwitchPreferenceCompat
android:key="do_not_use_animations"
android:layout="@layout/preference_switch"
android:summaryOff="@string/shared_string_off"

View file

@ -40,7 +40,7 @@
android:summaryOn="@string/shared_string_on"
android:title="@string/analytics_pref_title" />
<SwitchPreference
<SwitchPreferenceCompat
android:icon="@drawable/ic_action_notification"
android:key="do_not_show_startup_messages"
android:layout="@layout/preference_switch"

View file

@ -5,7 +5,7 @@
android:key="proxy"
android:title="@string/proxy_pref_title">
<SwitchPreference
<SwitchPreferenceCompat
android:key="enable_proxy"
android:summaryOff="@string/shared_string_off"
android:summaryOn="@string/shared_string_on" />

View file

@ -2,7 +2,7 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<SwitchPreference
<SwitchPreferenceCompat
android:key="show_routing_alarms"
android:layout="@layout/preference_top_switch"
android:summaryOff="@string/shared_string_off"
@ -21,25 +21,25 @@
android:title="@string/screen_alerts_descr"
tools:icon="@drawable/ic_action_info_dark" />
<SwitchPreference
<SwitchPreferenceCompat
android:dependency="show_routing_alarms"
android:key="show_traffic_warnings"
android:layout="@layout/preference_switch"
android:title="@string/show_traffic_warnings" />
<SwitchPreference
<SwitchPreferenceCompat
android:dependency="show_routing_alarms"
android:key="show_pedestrian"
android:layout="@layout/preference_switch"
android:title="@string/show_pedestrian_warnings" />
<SwitchPreference
<SwitchPreferenceCompat
android:dependency="show_routing_alarms"
android:key="show_cameras"
android:layout="@layout/preference_switch"
android:title="@string/show_cameras" />
<SwitchPreference
<SwitchPreferenceCompat
android:dependency="show_routing_alarms"
android:key="show_tunnels"
android:layout="@layout/preference_switch"

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<SwitchPreference
<SwitchPreferenceCompat
android:key="turn_screen_on_enabled"
android:layout="@layout/preference_top_switch"
android:summaryOff="@string/shared_string_off"

View file

@ -2,7 +2,7 @@
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<SwitchPreference
<SwitchPreferenceCompat
android:key="speak_routing_alarms"
android:layout="@layout/preference_top_switch"
android:summaryOff="@string/shared_string_off"
@ -16,19 +16,19 @@
android:title="@string/voice_announces_info"
tools:icon="@drawable/ic_action_info_dark" />
<SwitchPreference
<SwitchPreferenceCompat
android:dependency="speak_routing_alarms"
android:key="speak_street_names"
android:layout="@layout/preference_switch"
android:title="@string/speak_street_names" />
<SwitchPreference
<SwitchPreferenceCompat
android:dependency="speak_routing_alarms"
android:key="speak_traffic_warnings"
android:layout="@layout/preference_switch"
android:title="@string/speak_traffic_warnings" />
<SwitchPreference
<SwitchPreferenceCompat
android:dependency="speak_routing_alarms"
android:key="speak_pedestrian"
android:layout="@layout/preference_switch"
@ -38,7 +38,7 @@
android:layout="@layout/simple_divider_item"
android:selectable="false" />
<SwitchPreference
<SwitchPreferenceCompat
android:dependency="speak_routing_alarms"
android:key="speak_speed_limit"
android:layout="@layout/preference_switch"
@ -54,31 +54,31 @@
android:layout="@layout/simple_divider_item"
android:selectable="false" />
<SwitchPreference
<SwitchPreferenceCompat
android:dependency="speak_routing_alarms"
android:key="speak_cameras"
android:layout="@layout/preference_switch"
android:title="@string/speak_cameras" />
<SwitchPreference
<SwitchPreferenceCompat
android:dependency="speak_routing_alarms"
android:key="speak_tunnels"
android:layout="@layout/preference_switch"
android:title="@string/show_tunnels" />
<SwitchPreference
<SwitchPreferenceCompat
android:dependency="speak_routing_alarms"
android:key="announce_wpt"
android:layout="@layout/preference_switch"
android:title="@string/shared_string_gpx_waypoints" />
<SwitchPreference
<SwitchPreferenceCompat
android:dependency="speak_routing_alarms"
android:key="announce_nearby_favorites"
android:layout="@layout/preference_switch"
android:title="@string/speak_favorites" />
<SwitchPreference
<SwitchPreferenceCompat
android:dependency="speak_routing_alarms"
android:key="announce_nearby_poi"
android:layout="@layout/preference_switch"

View file

@ -16,7 +16,6 @@ import android.support.annotation.Nullable;
import android.support.annotation.StringRes;
import android.support.annotation.XmlRes;
import android.support.design.widget.AppBarLayout;
import android.support.v14.preference.SwitchPreference;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.content.ContextCompat;
@ -26,9 +25,11 @@ import android.support.v7.preference.Preference;
import android.support.v7.preference.Preference.OnPreferenceChangeListener;
import android.support.v7.preference.Preference.OnPreferenceClickListener;
import android.support.v7.preference.PreferenceFragmentCompat;
import android.support.v7.preference.PreferenceGroup;
import android.support.v7.preference.PreferenceGroupAdapter;
import android.support.v7.preference.PreferenceScreen;
import android.support.v7.preference.PreferenceViewHolder;
import android.support.v7.preference.SwitchPreferenceCompat;
import android.support.v7.view.ContextThemeWrapper;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
@ -199,6 +200,12 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
}
}
@SuppressLint("RestrictedApi")
protected void updatePreference(Preference preference) {
PreferenceGroupAdapter adapter = (PreferenceGroupAdapter) getListView().getAdapter();
adapter.onPreferenceChange(preference);
}
private void createToolbar(LayoutInflater inflater, View view) {
AppBarLayout appBarLayout = (AppBarLayout) view.findViewById(R.id.appbar);
@ -299,19 +306,21 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
if (getSelectedAppMode() != null) {
int resId = getPreferencesResId();
if (resId != -1) {
addPreferencesFromResource(getPreferencesResId());
addPreferencesFromResource(resId);
setupPreferences();
registerPreferences();
registerPreferences(getPreferenceScreen());
}
}
}
private void registerPreferences() {
PreferenceScreen screen = getPreferenceScreen();
if (screen != null) {
for (int i = 0; i < screen.getPreferenceCount(); i++) {
Preference preference = screen.getPreference(i);
private void registerPreferences(PreferenceGroup preferenceGroup) {
if (preferenceGroup != null) {
for (int i = 0; i < preferenceGroup.getPreferenceCount(); i++) {
Preference preference = preferenceGroup.getPreference(i);
registerPreference(preference);
if (preference instanceof PreferenceGroup) {
registerPreferences((PreferenceGroup) preference);
}
}
}
}
@ -483,12 +492,12 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
return app.getSettings();
}
public SwitchPreference createSwitchPreference(OsmandSettings.OsmandPreference<Boolean> b, int title, int summary, int layoutId) {
public SwitchPreferenceCompat createSwitchPreference(OsmandSettings.OsmandPreference<Boolean> b, int title, int summary, int layoutId) {
return createSwitchPreference(b, getString(title), getString(summary), layoutId);
}
public SwitchPreference createSwitchPreference(OsmandSettings.OsmandPreference<Boolean> b, String title, String summary, int layoutId) {
SwitchPreference p = new SwitchPreference(getContext());
public SwitchPreferenceCompat createSwitchPreference(OsmandSettings.OsmandPreference<Boolean> b, String title, String summary, int layoutId) {
SwitchPreferenceCompat p = new SwitchPreferenceCompat(getContext());
p.setTitle(title);
p.setKey(b.getId());
p.setSummary(summary);

View file

@ -9,13 +9,13 @@ import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.support.annotation.ColorRes;
import android.support.v14.preference.SwitchPreference;
import android.support.v4.app.FragmentManager;
import android.support.v4.content.ContextCompat;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceCategory;
import android.support.v7.preference.PreferenceGroup;
import android.support.v7.preference.PreferenceGroupAdapter;
import android.support.v7.preference.SwitchPreferenceCompat;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
@ -42,6 +42,8 @@ public class ConfigureProfileFragment extends BaseSettingsFragment {
public static final String TAG = "ConfigureProfileFragment";
private static final String PLUGIN_SETTINGS = "plugin_settings";
@Override
protected int getPreferencesResId() {
return R.xml.configure_profile;
@ -111,7 +113,7 @@ public class ConfigureProfileFragment extends BaseSettingsFragment {
Preference pref = ((PreferenceGroupAdapter) getListView().getAdapter()).getItem(position);
if (pref != null && pref.getParent() != null) {
PreferenceGroup preferenceGroup = pref.getParent();
return preferenceGroup.hasKey() && preferenceGroup.getKey().equals("plugin_settings");
return preferenceGroup.hasKey() && preferenceGroup.getKey().equals(PLUGIN_SETTINGS);
}
return false;
}
@ -126,7 +128,7 @@ public class ConfigureProfileFragment extends BaseSettingsFragment {
setupNavigationSettingsPref();
setupConfigureMapPref();
PreferenceCategory pluginSettings = (PreferenceCategory) findPreference("plugin_settings");
PreferenceCategory pluginSettings = (PreferenceCategory) findPreference(PLUGIN_SETTINGS);
pluginSettings.setIconSpaceReserved(false);
setupConnectedAppsPref(pluginSettings);
@ -163,11 +165,11 @@ public class ConfigureProfileFragment extends BaseSettingsFragment {
}
List<ConnectedApp> connectedApps = app.getAidlApi().getConnectedApps();
for (ConnectedApp connectedApp : connectedApps) {
SwitchPreference preference = new SwitchPreference(app);
SwitchPreferenceCompat preference = new SwitchPreferenceCompat(app);
preference.setPersistent(false);
preference.setKey(connectedApp.getPack());
preference.setTitle(connectedApp.getName());
preference.setIcon(connectedApp.getIcon());
preference.setTitle(connectedApp.getName());
preference.setChecked(connectedApp.isEnabled());
preference.setLayoutResource(R.layout.preference_switch);
@ -186,10 +188,10 @@ public class ConfigureProfileFragment extends BaseSettingsFragment {
preference.setPersistent(false);
preference.setKey(plugin.getId());
preference.setTitle(plugin.getName());
preference.setIcon(getPluginIcon(plugin));
preference.setChecked(plugin.isActive());
preference.setLayoutResource(R.layout.preference_dialog_and_switch);
preference.setIcon(getPluginIcon(plugin));
preference.setIntent(getPluginIntent(plugin));
preference.setLayoutResource(R.layout.preference_dialog_and_switch);
preferenceCategory.addPreference(preference);
}
@ -221,7 +223,7 @@ public class ConfigureProfileFragment extends BaseSettingsFragment {
if (newValue instanceof Boolean) {
if ((plugin.isActive() || !plugin.needsInstallation())) {
if (OsmandPlugin.enablePlugin(getActivity(), app, plugin, (Boolean) newValue)) {
updateAllSettings();
preference.setIcon(getPluginIcon(plugin));
return true;
}
} else if (plugin.needsInstallation() && preference.getIntent() != null) {

View file

@ -178,14 +178,19 @@ public class CoordinatesFormatFragment extends BaseSettingsFragment {
int newFormat = getCoordinatesFormatForKey(key);
if (newFormat != -1) {
FragmentManager fragmentManager = getFragmentManager();
if (fragmentManager != null) {
ChangeGeneralProfilesPrefBottomSheet.showInstance(fragmentManager, settings.COORDINATES_FORMAT.getId(), newFormat, this, false);
return false;
if (settings.COORDINATES_FORMAT.isSetForMode(getSelectedAppMode())) {
settings.COORDINATES_FORMAT.set(newFormat);
updateSelectedFormatPrefs(key);
return true;
} else {
FragmentManager fragmentManager = getFragmentManager();
if (fragmentManager != null) {
ChangeGeneralProfilesPrefBottomSheet.showInstance(fragmentManager, settings.COORDINATES_FORMAT.getId(), newFormat, this, false);
}
}
}
return super.onPreferenceChange(preference, newValue);
return false;
}
private void updateSelectedFormatPrefs(String key) {

View file

@ -47,10 +47,6 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment {
@Override
protected void setupPreferences() {
Preference appearanceCategory = findPreference("appearance_category");
Preference unitsAndFormats = findPreference("units_and_formats");
Preference other = findPreference("other");
setupAppThemePref();
setupRotateMapPref();
setupMapScreenOrientationPref();

View file

@ -2,9 +2,9 @@ package net.osmand.plus.settings;
import android.app.Activity;
import android.content.Context;
import android.support.v14.preference.SwitchPreference;
import android.support.v4.app.FragmentManager;
import android.support.v7.preference.Preference;
import android.support.v7.preference.SwitchPreferenceCompat;
import android.util.Pair;
import net.osmand.plus.ApplicationMode;
@ -157,7 +157,7 @@ public class GlobalSettingsFragment extends BaseSettingsFragment implements Send
private void setupSendAnonymousDataPref() {
boolean enabled = settings.SEND_ANONYMOUS_MAP_DOWNLOADS_DATA.get() || settings.SEND_ANONYMOUS_APP_USAGE_DATA.get();
SwitchPreference sendAnonymousData = (SwitchPreference) findPreference(SEND_ANONYMOUS_DATA_PREF_ID);
SwitchPreferenceCompat sendAnonymousData = (SwitchPreferenceCompat) findPreference(SEND_ANONYMOUS_DATA_PREF_ID);
sendAnonymousData.setChecked(enabled);
}

View file

@ -1,7 +1,7 @@
package net.osmand.plus.settings;
import android.support.v14.preference.SwitchPreference;
import android.support.v7.preference.Preference;
import android.support.v7.preference.SwitchPreferenceCompat;
import net.osmand.plus.R;
@ -27,10 +27,9 @@ public class NavigationFragment extends BaseSettingsFragment {
@Override
protected void setupPreferences() {
Preference routeParameters = findPreference("route_parameters");
SwitchPreference showRoutingAlarms = (SwitchPreference) findPreference(settings.SHOW_ROUTING_ALARMS.getId());
SwitchPreference speakRoutingAlarms = (SwitchPreference) findPreference(settings.SPEAK_ROUTING_ALARMS.getId());
SwitchPreference turnScreenOn = (SwitchPreference) findPreference(settings.TURN_SCREEN_ON_ENABLED.getId());
SwitchPreferenceCompat showRoutingAlarms = (SwitchPreferenceCompat) findPreference(settings.SHOW_ROUTING_ALARMS.getId());
SwitchPreferenceCompat speakRoutingAlarms = (SwitchPreferenceCompat) findPreference(settings.SPEAK_ROUTING_ALARMS.getId());
SwitchPreferenceCompat turnScreenOn = (SwitchPreferenceCompat) findPreference(settings.TURN_SCREEN_ON_ENABLED.getId());
routeParameters.setIcon(getContentIcon(R.drawable.ic_action_route_distance));
showRoutingAlarms.setIcon(getContentIcon(R.drawable.ic_action_alert));

View file

@ -2,7 +2,6 @@ package net.osmand.plus.settings;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.v14.preference.SwitchPreference;
import android.support.v4.content.ContextCompat;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceScreen;
@ -104,7 +103,8 @@ public class RouteParametersFragment extends BaseSettingsFragment {
}
private void setupTimeConditionalRoutingPref() {
SwitchPreference timeConditionalRouting = createSwitchPreferenceEx(settings.ENABLE_TIME_CONDITIONAL_ROUTING.getId(), R.string.temporary_conditional_routing, R.layout.preference_with_descr_dialog_and_switch);
SwitchPreferenceEx timeConditionalRouting = createSwitchPreferenceEx(settings.ENABLE_TIME_CONDITIONAL_ROUTING.getId(),
R.string.temporary_conditional_routing, R.layout.preference_with_descr_dialog_and_switch);
timeConditionalRouting.setIcon(getRoutingPrefIcon(settings.ENABLE_TIME_CONDITIONAL_ROUTING.getId()));
timeConditionalRouting.setSummaryOn(R.string.shared_string_enable);
timeConditionalRouting.setSummaryOff(R.string.shared_string_disable);

View file

@ -3,11 +3,10 @@ package net.osmand.plus.settings;
import android.annotation.SuppressLint;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.v14.preference.SwitchPreference;
import android.support.v4.content.ContextCompat;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceGroupAdapter;
import android.support.v7.preference.PreferenceViewHolder;
import android.support.v7.preference.SwitchPreferenceCompat;
import android.widget.ImageView;
import net.osmand.plus.R;
@ -37,10 +36,10 @@ public class ScreenAlertsFragment extends BaseSettingsFragment {
@Override
protected void setupPreferences() {
Preference showRoutingAlarmsInfo = findPreference(SHOW_ROUTING_ALARMS_INFO);
SwitchPreference showTrafficWarnings = (SwitchPreference) findPreference(settings.SHOW_TRAFFIC_WARNINGS.getId());
SwitchPreference showPedestrian = (SwitchPreference) findPreference(settings.SHOW_PEDESTRIAN.getId());
SwitchPreference showCameras = (SwitchPreference) findPreference(settings.SHOW_CAMERAS.getId());
SwitchPreference showTunnels = (SwitchPreference) findPreference(settings.SHOW_TUNNELS.getId());
SwitchPreferenceCompat showTrafficWarnings = (SwitchPreferenceCompat) findPreference(settings.SHOW_TRAFFIC_WARNINGS.getId());
SwitchPreferenceCompat showPedestrian = (SwitchPreferenceCompat) findPreference(settings.SHOW_PEDESTRIAN.getId());
SwitchPreferenceCompat showCameras = (SwitchPreferenceCompat) findPreference(settings.SHOW_CAMERAS.getId());
SwitchPreferenceCompat showTunnels = (SwitchPreferenceCompat) findPreference(settings.SHOW_TUNNELS.getId());
showRoutingAlarmsInfo.setIcon(getContentIcon(R.drawable.ic_action_info_dark));
showTrafficWarnings.setIcon(getIcon(R.drawable.list_warnings_traffic_calming));
@ -57,7 +56,7 @@ public class ScreenAlertsFragment extends BaseSettingsFragment {
String key = preference.getKey();
if (settings.SHOW_ROUTING_ALARMS.getId().equals(key)) {
boolean checked = ((SwitchPreference) preference).isChecked();
boolean checked = ((SwitchPreferenceCompat) preference).isChecked();
int color = checked ? getActiveProfileColor() : ContextCompat.getColor(app, R.color.preference_top_switch_off);
holder.itemView.setBackgroundColor(color);
@ -80,7 +79,7 @@ public class ScreenAlertsFragment extends BaseSettingsFragment {
public boolean onPreferenceClick(Preference preference) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
Preference routeParametersImage = findPreference(SCREEN_ALERTS_IMAGE);
((PreferenceGroupAdapter) getListView().getAdapter()).onPreferenceChange(routeParametersImage);
updatePreference(routeParametersImage);
}
return super.onPreferenceClick(preference);

View file

@ -1,10 +1,10 @@
package net.osmand.plus.settings;
import android.graphics.drawable.ColorDrawable;
import android.support.v14.preference.SwitchPreference;
import android.support.v4.content.ContextCompat;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceViewHolder;
import android.support.v7.preference.SwitchPreferenceCompat;
import net.osmand.AndroidUtils;
import net.osmand.plus.R;
@ -44,7 +44,7 @@ public class TurnScreenOnFragment extends BaseSettingsFragment {
super.onBindPreferenceViewHolder(preference, holder);
if (settings.TURN_SCREEN_ON_ENABLED.getId().equals(preference.getKey())) {
boolean checked = ((SwitchPreference) preference).isChecked();
boolean checked = ((SwitchPreferenceCompat) preference).isChecked();
int color = checked ? getActiveProfileColor() : ContextCompat.getColor(app, R.color.preference_top_switch_off);
AndroidUtils.setBackground(holder.itemView, new ColorDrawable(color));

View file

@ -6,11 +6,11 @@ import android.content.DialogInterface;
import android.content.Intent;
import android.graphics.drawable.ColorDrawable;
import android.media.AudioManager;
import android.support.v14.preference.SwitchPreference;
import android.support.v4.content.ContextCompat;
import android.support.v7.app.AlertDialog;
import android.support.v7.preference.Preference;
import android.support.v7.preference.PreferenceViewHolder;
import android.support.v7.preference.SwitchPreferenceCompat;
import net.osmand.AndroidUtils;
import net.osmand.plus.ApplicationMode;
@ -67,7 +67,7 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment {
super.onBindPreferenceViewHolder(preference, holder);
if (settings.SPEAK_ROUTING_ALARMS.getId().equals(preference.getKey())) {
boolean checked = ((SwitchPreference) preference).isChecked();
boolean checked = ((SwitchPreferenceCompat) preference).isChecked();
int color = checked ? getActiveProfileColor() : ContextCompat.getColor(app, R.color.preference_top_switch_off);
AndroidUtils.setBackground(holder.itemView, new ColorDrawable(color));
@ -196,7 +196,7 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment {
@Override
public void onClick(DialogInterface dialog, int which) {
settings.SPEAK_SPEED_CAMERA.set(true);
SwitchPreference speakSpeedCamera = (SwitchPreference) findPreference(settings.SPEAK_SPEED_CAMERA.getId());
SwitchPreferenceCompat speakSpeedCamera = (SwitchPreferenceCompat) findPreference(settings.SPEAK_SPEED_CAMERA.getId());
if (speakSpeedCamera != null) {
speakSpeedCamera.setChecked(true);
}

View file

@ -1,10 +1,10 @@
package net.osmand.plus.settings.preferences;
import android.content.Context;
import android.support.v14.preference.SwitchPreference;
import android.support.v7.preference.SwitchPreferenceCompat;
import android.util.AttributeSet;
public class SwitchPreferenceEx extends SwitchPreference {
public class SwitchPreferenceEx extends SwitchPreferenceCompat {
private String description;