Merge pull request #7536 from osmandapp/ProfileSettings

Profile settings UI improvements
This commit is contained in:
max-klaus 2019-09-10 11:55:29 +03:00 committed by GitHub
commit c09635c0e0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 226 additions and 174 deletions

View file

@ -6,7 +6,8 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/list_background_color" android:background="?attr/list_background_color"
android:gravity="center_vertical" android:gravity="center_vertical"
android:minHeight="@dimen/bottom_sheet_list_item_height"> android:minHeight="@dimen/bottom_sheet_cancel_button_height_small"
android:orientation="horizontal">
<ImageView <ImageView
android:id="@android:id/icon" android:id="@android:id/icon"
@ -17,34 +18,33 @@
android:layout_marginRight="@dimen/content_padding" /> android:layout_marginRight="@dimen/content_padding" />
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="top"
android:layout_marginLeft="@dimen/content_padding" android:orientation="vertical"
android:layout_marginRight="@dimen/content_padding" android:paddingLeft="@dimen/content_padding"
android:layout_weight="1" android:paddingRight="@dimen/content_padding">
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@android:id/title" android:id="@android:id/title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:ellipsize="marquee" android:paddingTop="@dimen/list_header_settings_top_margin"
android:gravity="center_vertical"
android:singleLine="true" android:singleLine="true"
android:textColor="@color/preference_category_title" android:textColor="@color/preference_category_title"
android:textSize="@dimen/default_desc_text_size" android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_medium" osmand:typeface="@string/font_roboto_medium"
tools:text="@string/shared_string_other" /> tools:text="@string/plugin_settings" />
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@android:id/summary" android:id="@android:id/summary"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="4" android:paddingBottom="@dimen/list_header_settings_top_margin"
android:textColor="?android:textColorSecondary" android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size" android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_regular" /> osmand:typeface="@string/font_roboto_regular"
tools:text="@string/list_of_installed_plugins" />
</LinearLayout> </LinearLayout>

View file

@ -9,8 +9,7 @@
<LinearLayout <LinearLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground" android:background="?android:attr/selectableItemBackground">
android:minHeight="@dimen/bottom_sheet_list_item_height">
<ImageView <ImageView
android:id="@android:id/icon" android:id="@android:id/icon"
@ -18,38 +17,28 @@
android:layout_height="@dimen/standard_icon_size" android:layout_height="@dimen/standard_icon_size"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginLeft="@dimen/content_padding" android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding" /> android:layout_marginTop="@dimen/content_padding_small"
android:layout_marginRight="@dimen/content_padding"
android:layout_marginBottom="@dimen/content_padding_small" />
<LinearLayout <net.osmand.plus.widgets.TextViewEx
android:id="@android:id/title"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/content_padding" android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding" android:layout_marginRight="@dimen/content_padding"
android:layout_weight="1" android:layout_weight="1"
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
android:id="@android:id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:singleLine="true"
android:textColor="?android:textColorPrimary" android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size" android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular" /> osmand:typeface="@string/font_roboto_regular" />
<net.osmand.plus.widgets.TextViewEx <View
android:id="@android:id/summary" android:layout_width="1dp"
android:layout_width="match_parent" android:layout_height="match_parent"
android:layout_height="wrap_content" android:layout_marginTop="@dimen/context_menu_padding_margin_tiny"
android:maxLines="4" android:layout_marginBottom="@dimen/context_menu_padding_margin_tiny"
android:textColor="?android:textColorSecondary" android:background="?attr/divider_color_basic" />
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular" />
</LinearLayout>
<Switch <Switch
android:id="@android:id/switch_widget" android:id="@android:id/switch_widget"
@ -61,13 +50,6 @@
android:paddingLeft="@dimen/content_padding" android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding" /> android:paddingRight="@dimen/content_padding" />
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginTop="18dp"
android:layout_marginBottom="18dp"
android:background="?attr/divider_color_basic" />
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

View file

@ -2,7 +2,8 @@
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto" xmlns:osmand="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx <net.osmand.plus.widgets.TextViewEx
android:id="@android:id/title" android:id="@android:id/title"
@ -10,8 +11,11 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/content_padding" android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding" android:layout_marginRight="@dimen/content_padding"
android:paddingTop="@dimen/content_padding_small"
android:textColor="?android:textColorSecondary" android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size" android:textSize="@dimen/default_sub_text_size"
osmand:typeface="@string/font_roboto_regular" /> osmand:typeface="@string/font_roboto_regular" />
<include layout="@layout/card_top_divider" />
</LinearLayout> </LinearLayout>

View file

@ -46,7 +46,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="4" android:maxLines="4"
android:textColor="?android:textColorSecondary" android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size" android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_regular" /> osmand:typeface="@string/font_roboto_regular" />
</LinearLayout> </LinearLayout>
@ -56,8 +56,8 @@
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@null" android:background="@null"
android:clickable="true" android:clickable="false"
android:focusable="true" android:focusable="false"
android:paddingLeft="@dimen/content_padding" android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding" /> android:paddingRight="@dimen/content_padding" />

View file

@ -18,7 +18,9 @@
android:layout_height="@dimen/standard_icon_size" android:layout_height="@dimen/standard_icon_size"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginLeft="@dimen/content_padding" android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding" /> android:layout_marginTop="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/content_padding"
android:layout_marginBottom="@dimen/bottom_sheet_icon_margin" />
<LinearLayout <LinearLayout
android:layout_width="0dp" android:layout_width="0dp"
@ -46,7 +48,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:maxLines="4" android:maxLines="4"
android:textColor="?android:textColorSecondary" android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_list_text_size" android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_regular" /> osmand:typeface="@string/font_roboto_regular" />
</LinearLayout> </LinearLayout>

View file

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:osmand="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/list_background_color"
android:gravity="center_vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?android:attr/selectableItemBackground">
<ImageView
android:id="@android:id/icon"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginTop="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/content_padding"
android:layout_marginBottom="@dimen/bottom_sheet_icon_margin" />
<LinearLayout
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:layout_weight="1"
android:orientation="vertical">
<net.osmand.plus.widgets.TextViewEx
android:id="@android:id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="marquee"
android:fadingEdge="horizontal"
android:singleLine="true"
android:textColor="?android:textColorPrimary"
android:textSize="@dimen/default_list_text_size"
osmand:typeface="@string/font_roboto_regular" />
<net.osmand.plus.widgets.TextViewEx
android:id="@android:id/summary"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:maxLines="4"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
osmand:typeface="@string/font_roboto_regular" />
</LinearLayout>
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:layout_marginTop="18dp"
android:layout_marginBottom="18dp"
android:background="?attr/divider_color_basic" />
<Switch
android:id="@android:id/switch_widget"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@null"
android:clickable="true"
android:focusable="true"
android:paddingLeft="@dimen/content_padding"
android:paddingRight="@dimen/content_padding" />
</LinearLayout>
</LinearLayout>

View file

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<View xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/divider_color_basic"
android:orientation="vertical" />

View file

@ -549,7 +549,8 @@
</style> </style>
<style name="OsmandPreferenceTheme" parent="@style/PreferenceThemeOverlay.v14.Material"> <style name="OsmandPreferenceTheme" parent="@style/PreferenceThemeOverlay.v14.Material">
<item name="android:layout">@layout/pref_screen</item> <item name="android:layout">@layout/preferences_screen</item>
<item name="iconSpaceReserved">true</item>
</style> </style>
<!-- Standard action bar override --> <!-- Standard action bar override -->

View file

@ -36,6 +36,10 @@
android:title="@string/configure_map" android:title="@string/configure_map"
tools:icon="@drawable/ic_action_layers_dark" /> tools:icon="@drawable/ic_action_layers_dark" />
<Preference
android:layout="@layout/list_item_divider"
android:selectable="false" />
<PreferenceCategory <PreferenceCategory
android:key="plugin_settings" android:key="plugin_settings"
android:layout="@layout/preference_category_with_descr" android:layout="@layout/preference_category_with_descr"

View file

@ -22,6 +22,10 @@
android:layout="@layout/preference_with_descr" android:layout="@layout/preference_with_descr"
android:title="@string/map_screen_orientation" /> android:title="@string/map_screen_orientation" />
<Preference
android:layout="@layout/simple_divider_item"
android:selectable="false" />
<PreferenceCategory <PreferenceCategory
android:key="units_and_formats" android:key="units_and_formats"
android:layout="@layout/preference_category_with_descr" android:layout="@layout/preference_category_with_descr"
@ -48,6 +52,10 @@
android:layout="@layout/preference_with_descr" android:layout="@layout/preference_with_descr"
android:title="@string/angular_measeurement" /> android:title="@string/angular_measeurement" />
<Preference
android:layout="@layout/simple_divider_item"
android:selectable="false" />
<PreferenceCategory <PreferenceCategory
android:key="other" android:key="other"
android:layout="@layout/preference_category_with_descr" android:layout="@layout/preference_category_with_descr"
@ -55,21 +63,21 @@
<net.osmand.plus.settings.preferences.SwitchPreferenceEx <net.osmand.plus.settings.preferences.SwitchPreferenceEx
android:key="use_kalman_filter_compass" android:key="use_kalman_filter_compass"
android:layout="@layout/preference_dialog_and_switch" android:layout="@layout/preference_with_descr_dialog_and_switch"
android:summaryOff="@string/shared_string_off" android:summaryOff="@string/shared_string_off"
android:summaryOn="@string/shared_string_on" android:summaryOn="@string/shared_string_on"
android:title="@string/use_kalman_filter_compass" /> android:title="@string/use_kalman_filter_compass" />
<net.osmand.plus.settings.preferences.SwitchPreferenceEx <net.osmand.plus.settings.preferences.SwitchPreferenceEx
android:key="use_magnetic_field_sensor_compass" android:key="use_magnetic_field_sensor_compass"
android:layout="@layout/preference_dialog_and_switch" android:layout="@layout/preference_with_descr_dialog_and_switch"
android:summaryOff="@string/shared_string_off" android:summaryOff="@string/shared_string_off"
android:summaryOn="@string/shared_string_on" android:summaryOn="@string/shared_string_on"
android:title="@string/use_magnetic_sensor" /> android:title="@string/use_magnetic_sensor" />
<net.osmand.plus.settings.preferences.SwitchPreferenceEx <net.osmand.plus.settings.preferences.SwitchPreferenceEx
android:key="map_empty_state_allowed" android:key="map_empty_state_allowed"
android:layout="@layout/preference_dialog_and_switch" android:layout="@layout/preference_with_descr_dialog_and_switch"
android:summaryOff="@string/shared_string_off" android:summaryOff="@string/shared_string_off"
android:summaryOn="@string/shared_string_on" android:summaryOn="@string/shared_string_on"
android:title="@string/tap_on_map_to_hide_interface" /> android:title="@string/tap_on_map_to_hide_interface" />
@ -83,7 +91,7 @@
<net.osmand.plus.settings.preferences.ListPreferenceEx <net.osmand.plus.settings.preferences.ListPreferenceEx
android:key="external_input_device" android:key="external_input_device"
android:layout="@layout/preference_dialog_and_switch" android:layout="@layout/preference_with_descr_dialog_and_switch"
android:title="@string/external_input_device" /> android:title="@string/external_input_device" />
</PreferenceScreen> </PreferenceScreen>

View file

@ -15,17 +15,21 @@
android:layout="@layout/preference_with_descr" android:layout="@layout/preference_with_descr"
android:title="@string/preferred_locale" /> android:title="@string/preferred_locale" />
<!-- <Preference--> <Preference
<!-- android:icon="@drawable/ic_action_folder"--> android:key="external_storage_dir"
<!-- android:key="external_storage_dir"--> android:layout="@layout/preference_with_descr"
<!-- android:layout="@layout/preference_with_descr"--> android:persistent="false"
<!-- android:persistent="false"--> android:title="@string/application_dir"
<!-- android:title="@string/application_dir" />--> tools:icon="@drawable/ic_action_folder" />
<Preference
android:layout="@layout/simple_divider_item"
android:selectable="false" />
<PreferenceCategory <PreferenceCategory
android:key="privacy_and_security" android:key="privacy_and_security"
android:layout="@layout/preference_category_with_descr" android:layout="@layout/preference_category_with_descr"
android:title="@string/application_profiles" /> android:title="@string/settings_privacy_and_security" />
<net.osmand.plus.settings.preferences.SwitchPreferenceEx <net.osmand.plus.settings.preferences.SwitchPreferenceEx
android:icon="@drawable/ic_action_privacy_and_security" android:icon="@drawable/ic_action_privacy_and_security"

View file

@ -12,6 +12,10 @@
app:fragment="net.osmand.plus.settings.GlobalSettingsFragment" app:fragment="net.osmand.plus.settings.GlobalSettingsFragment"
tools:icon="@drawable/ic_action_settings" /> tools:icon="@drawable/ic_action_settings" />
<Preference
android:layout="@layout/list_item_divider"
android:selectable="false" />
<PreferenceCategory <PreferenceCategory
android:key="application_profiles" android:key="application_profiles"
android:layout="@layout/preference_category_with_descr" android:layout="@layout/preference_category_with_descr"
@ -33,4 +37,8 @@
android:title="@string/manage_profiles" android:title="@string/manage_profiles"
tools:icon="@drawable/ic_action_manage_profiles" /> tools:icon="@drawable/ic_action_manage_profiles" />
<Preference
android:layout="@layout/card_bottom_divider"
android:selectable="false" />
</PreferenceScreen> </PreferenceScreen>

View file

@ -34,6 +34,10 @@
android:layout="@layout/preference_switch" android:layout="@layout/preference_switch"
android:title="@string/speak_pedestrian" /> android:title="@string/speak_pedestrian" />
<Preference
android:layout="@layout/simple_divider_item"
android:selectable="false" />
<SwitchPreference <SwitchPreference
android:dependency="speak_routing_alarms" android:dependency="speak_routing_alarms"
android:key="speak_speed_limit" android:key="speak_speed_limit"
@ -46,6 +50,10 @@
android:layout="@layout/preference_with_descr" android:layout="@layout/preference_with_descr"
android:title="@string/speed_limit_exceed" /> android:title="@string/speed_limit_exceed" />
<Preference
android:layout="@layout/simple_divider_item"
android:selectable="false" />
<SwitchPreference <SwitchPreference
android:dependency="speak_routing_alarms" android:dependency="speak_routing_alarms"
android:key="speak_cameras" android:key="speak_cameras"
@ -76,6 +84,10 @@
android:layout="@layout/preference_switch" android:layout="@layout/preference_switch"
android:title="@string/speak_poi" /> android:title="@string/speak_poi" />
<Preference
android:layout="@layout/simple_divider_item"
android:selectable="false" />
<net.osmand.plus.settings.preferences.ListPreferenceEx <net.osmand.plus.settings.preferences.ListPreferenceEx
android:dependency="speak_routing_alarms" android:dependency="speak_routing_alarms"
android:key="keep_informing" android:key="keep_informing"
@ -88,6 +100,10 @@
android:layout="@layout/preference_with_descr" android:layout="@layout/preference_with_descr"
android:title="@string/arrival_distance" /> android:title="@string/arrival_distance" />
<Preference
android:layout="@layout/simple_divider_item"
android:selectable="false" />
<PreferenceCategory <PreferenceCategory
android:key="language_and_output" android:key="language_and_output"
android:layout="@layout/preference_category_with_descr" android:layout="@layout/preference_category_with_descr"

View file

@ -1944,7 +1944,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
Fragment fragment = Fragment.instantiate(this, fragmentName); Fragment fragment = Fragment.instantiate(this, fragmentName);
getSupportFragmentManager().beginTransaction() getSupportFragmentManager().beginTransaction()
.add(R.id.fragmentContainer, fragment, fragmentName) .replace(R.id.fragmentContainer, fragment, fragmentName)
.addToBackStack(fragmentName) .addToBackStack(fragmentName)
.commitAllowingStateLoss(); .commitAllowingStateLoss();

View file

@ -5,6 +5,7 @@ import android.content.Context;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.v4.view.ViewCompat; import android.support.v4.view.ViewCompat;
import android.support.v7.view.ContextThemeWrapper;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
@ -45,6 +46,7 @@ public class QuickSearchListAdapter extends ArrayAdapter<QuickSearchListItem> {
private OsmandApplication app; private OsmandApplication app;
private Activity activity; private Activity activity;
private AccessibilityAssistant accessibilityAssistant; private AccessibilityAssistant accessibilityAssistant;
private LayoutInflater inflater;
private boolean useMapCenter; private boolean useMapCenter;
@ -70,6 +72,11 @@ public class QuickSearchListAdapter extends ArrayAdapter<QuickSearchListItem> {
super(app, R.layout.search_list_item); super(app, R.layout.search_list_item);
this.app = app; this.app = app;
this.activity = activity; this.activity = activity;
int themeRes = !app.getSettings().isLightContent() ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
Context themedContext = new ContextThemeWrapper(activity, themeRes);
this.inflater = activity.getLayoutInflater().cloneInContext(themedContext);
dp56 = AndroidUtils.dpToPx(app, 56f); dp56 = AndroidUtils.dpToPx(app, 56f);
dp1 = AndroidUtils.dpToPx(app, 1f); dp1 = AndroidUtils.dpToPx(app, 1f);
updateLocationViewCache = app.getUIUtilities().getUpdateLocationViewCache(); updateLocationViewCache = app.getUIUtilities().getUpdateLocationViewCache();
@ -192,7 +199,6 @@ public class QuickSearchListAdapter extends ArrayAdapter<QuickSearchListItem> {
LinearLayout view; LinearLayout view;
if (type == QuickSearchListItemType.SEARCH_MORE) { if (type == QuickSearchListItemType.SEARCH_MORE) {
if (convertView == null) { if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) app.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = (LinearLayout) inflater.inflate(R.layout.search_more_list_item, null); view = (LinearLayout) inflater.inflate(R.layout.search_more_list_item, null);
} else { } else {
view = (LinearLayout) convertView; view = (LinearLayout) convertView;
@ -257,10 +263,7 @@ public class QuickSearchListAdapter extends ArrayAdapter<QuickSearchListItem> {
} }
} else if (type == QuickSearchListItemType.BUTTON) { } else if (type == QuickSearchListItemType.BUTTON) {
if (convertView == null) { if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) app view = (LinearLayout) inflater.inflate(R.layout.search_custom_list_item, null);
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = (LinearLayout) inflater.inflate(
R.layout.search_custom_list_item, null);
} else { } else {
view = (LinearLayout) convertView; view = (LinearLayout) convertView;
} }
@ -272,10 +275,7 @@ public class QuickSearchListAdapter extends ArrayAdapter<QuickSearchListItem> {
} }
} else if (type == QuickSearchListItemType.SELECT_ALL) { } else if (type == QuickSearchListItemType.SELECT_ALL) {
if (convertView == null) { if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) app view = (LinearLayout) inflater.inflate(R.layout.select_all_list_item, null);
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = (LinearLayout) inflater.inflate(
R.layout.select_all_list_item, null);
} else { } else {
view = (LinearLayout) convertView; view = (LinearLayout) convertView;
} }
@ -291,10 +291,7 @@ public class QuickSearchListAdapter extends ArrayAdapter<QuickSearchListItem> {
}); });
} else if (type == QuickSearchListItemType.HEADER) { } else if (type == QuickSearchListItemType.HEADER) {
if (convertView == null) { if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) app view = (LinearLayout) inflater.inflate(R.layout.search_header_list_item, null);
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = (LinearLayout) inflater.inflate(
R.layout.search_header_list_item, null);
} else { } else {
view = (LinearLayout) convertView; view = (LinearLayout) convertView;
} }
@ -307,30 +304,21 @@ public class QuickSearchListAdapter extends ArrayAdapter<QuickSearchListItem> {
} }
} else if (type == QuickSearchListItemType.TOP_SHADOW) { } else if (type == QuickSearchListItemType.TOP_SHADOW) {
if (convertView == null) { if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) app view = (LinearLayout) inflater.inflate(R.layout.list_shadow_header, null);
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = (LinearLayout) inflater.inflate(
R.layout.list_shadow_header, null);
} else { } else {
view = (LinearLayout) convertView; view = (LinearLayout) convertView;
} }
return view; return view;
} else if (type == QuickSearchListItemType.BOTTOM_SHADOW) { } else if (type == QuickSearchListItemType.BOTTOM_SHADOW) {
if (convertView == null) { if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) app view = (LinearLayout) inflater.inflate(R.layout.list_shadow_footer, null);
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = (LinearLayout) inflater.inflate(
R.layout.list_shadow_footer, null);
} else { } else {
view = (LinearLayout) convertView; view = (LinearLayout) convertView;
} }
return view; return view;
} else { } else {
if (convertView == null) { if (convertView == null) {
LayoutInflater inflater = (LayoutInflater) app view = (LinearLayout) inflater.inflate(R.layout.search_list_item, null);
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
view = (LinearLayout) inflater.inflate(
R.layout.search_list_item, null);
} else { } else {
view = (LinearLayout) convertView; view = (LinearLayout) convertView;
} }

View file

@ -58,7 +58,6 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
protected OsmandApplication app; protected OsmandApplication app;
protected OsmandSettings settings; protected OsmandSettings settings;
protected UiUtilities iconsCache; protected UiUtilities iconsCache;
protected List<ApplicationMode> modes = new ArrayList<ApplicationMode>();
private boolean nightMode; private boolean nightMode;
private boolean wasDrawerDisabled; private boolean wasDrawerDisabled;
@ -67,28 +66,43 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
app = requireMyApplication(); app = requireMyApplication();
settings = app.getSettings(); settings = app.getSettings();
nightMode = !settings.isLightContent();
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
modes.clear(); }
modes.addAll(ApplicationMode.values(app));
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
getPreferenceManager().setPreferenceDataStore(settings.getDataStore());
} }
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = super.onCreateView(inflater, container, savedInstanceState); nightMode = !settings.isLightContent();
View view = super.onCreateView(inflater, container, savedInstanceState);
if (view != null) { if (view != null) {
AndroidUtils.addStatusBarPadding21v(getContext(), view); AndroidUtils.addStatusBarPadding21v(getContext(), view);
createToolbar(inflater, view); createToolbar(inflater, view);
setDivider(null); setDivider(null);
updateAllSettings();
} }
return view; return view;
} }
@Override
public RecyclerView onCreateRecyclerView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
Context themedContext = new ContextThemeWrapper(getActivity(), themeRes);
LayoutInflater themedInflater = inflater.cloneInContext(themedContext);
return super.onCreateRecyclerView(themedInflater, parent, savedInstanceState);
}
@Override @Override
public void onResume() { public void onResume() {
super.onResume(); super.onResume();
MapActivity mapActivity = getMapActivity(); MapActivity mapActivity = getMapActivity();
if (mapActivity != null) { if (mapActivity != null) {
wasDrawerDisabled = mapActivity.isDrawerDisabled(); wasDrawerDisabled = mapActivity.isDrawerDisabled();
@ -114,7 +128,7 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
if (toolbarRes != -1) { if (toolbarRes != -1) {
Context activityContext = getActivity(); Context activityContext = getActivity();
final int themeRes = nightMode ? darkTheme : lightTheme; final int themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
final Context themedContext = new ContextThemeWrapper(activityContext, themeRes); final Context themedContext = new ContextThemeWrapper(activityContext, themeRes);
LayoutInflater themedInflater = LayoutInflater.from(themedContext); LayoutInflater themedInflater = LayoutInflater.from(themedContext);
@ -176,27 +190,6 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
view.setBackgroundColor(ContextCompat.getColor(app, getBackgroundColor())); view.setBackgroundColor(ContextCompat.getColor(app, getBackgroundColor()));
} }
int darkTheme = R.style.OsmandDarkTheme;
int lightTheme = R.style.OsmandLightTheme;
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
getPreferenceManager().setPreferenceDataStore(settings.getDataStore());
updatePreferencesScreen();
}
@Override
public RecyclerView onCreateRecyclerView(LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
Context activityContext = getActivity();
final int themeRes = nightMode ? darkTheme : lightTheme;
final Context themedContext = new ContextThemeWrapper(activityContext, themeRes);
LayoutInflater themedInflater = LayoutInflater.from(themedContext);
return super.onCreateRecyclerView(themedInflater, parent, savedInstanceState);
}
protected abstract void setupPreferences(); protected abstract void setupPreferences();
private void updatePreferencesScreen() { private void updatePreferencesScreen() {
@ -253,7 +246,7 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
singleSelectDialogBuilder.setAdapter(modeNames, new DialogInterface.OnClickListener() { singleSelectDialogBuilder.setAdapter(modeNames, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
ApplicationMode selectedAppMode = modes.get(which); ApplicationMode selectedAppMode = ApplicationMode.values(app).get(which);
requireSettings().APPLICATION_MODE.set(selectedAppMode); requireSettings().APPLICATION_MODE.set(selectedAppMode);
updateAllSettings(); updateAllSettings();
} }
@ -278,7 +271,10 @@ public abstract class BaseSettingsFragment extends PreferenceFragmentCompat impl
public void updateAllSettings() { public void updateAllSettings() {
getListView().getRecycledViewPool().clear(); getListView().getRecycledViewPool().clear();
PreferenceScreen screen = getPreferenceScreen();
if (screen != null) {
getPreferenceScreen().removeAll(); getPreferenceScreen().removeAll();
}
updatePreferencesScreen(); updatePreferencesScreen();
updateToolbar(getView()); updateToolbar(getView());
} }

View file

@ -52,6 +52,7 @@ public class ConfigureProfileFragment extends BaseSettingsFragment {
protected void setupPreferences() { protected void setupPreferences() {
Preference generalSettings = findPreference("general_settings"); Preference generalSettings = findPreference("general_settings");
Preference pluginSettings = findPreference("plugin_settings"); Preference pluginSettings = findPreference("plugin_settings");
pluginSettings.setIconSpaceReserved(false);
generalSettings.setIcon(getContentIcon(R.drawable.ic_action_settings)); generalSettings.setIcon(getContentIcon(R.drawable.ic_action_settings));
@ -125,7 +126,7 @@ public class ConfigureProfileFragment extends BaseSettingsFragment {
private Drawable getPluginIcon(OsmandPlugin plugin) { private Drawable getPluginIcon(OsmandPlugin plugin) {
int iconResId = plugin.getLogoResourceId(); int iconResId = plugin.getLogoResourceId();
return plugin.isActive() ? getActiveIcon(iconResId) : getContentIcon(iconResId); return plugin.isActive() ? getActiveIcon(iconResId) : getIcon(iconResId, isNightMode() ? R.color.icon_color_secondary_dark : R.color.icon_color_secondary_light);
} }
private Intent getPluginIntent(OsmandPlugin plugin) { private Intent getPluginIntent(OsmandPlugin plugin) {

View file

@ -52,10 +52,6 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment {
Preference unitsAndFormats = findPreference("units_and_formats"); Preference unitsAndFormats = findPreference("units_and_formats");
Preference other = findPreference("other"); Preference other = findPreference("other");
appearanceCategory.setIconSpaceReserved(true);
unitsAndFormats.setIconSpaceReserved(true);
other.setIconSpaceReserved(true);
setupAppThemePref(); setupAppThemePref();
setupRotateMapPref(); setupRotateMapPref();
setupMapScreenOrientationPref(); setupMapScreenOrientationPref();
@ -68,7 +64,6 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment {
setupKalmanFilterPref(); setupKalmanFilterPref();
setupMagneticFieldSensorPref(); setupMagneticFieldSensorPref();
setupMapEmptyStateAllowedPref(); setupMapEmptyStateAllowedPref();
setupDoNotUseAnimationsPref();
setupExternalInputDevicePref(); setupExternalInputDevicePref();
} }
@ -175,31 +170,22 @@ public class GeneralProfileSettingsFragment extends BaseSettingsFragment {
SwitchPreferenceEx kalmanFilterPref = (SwitchPreferenceEx) findPreference(settings.USE_KALMAN_FILTER_FOR_COMPASS.getId()); SwitchPreferenceEx kalmanFilterPref = (SwitchPreferenceEx) findPreference(settings.USE_KALMAN_FILTER_FOR_COMPASS.getId());
kalmanFilterPref.setTitle(getString(R.string.use_kalman_filter_compass)); kalmanFilterPref.setTitle(getString(R.string.use_kalman_filter_compass));
kalmanFilterPref.setDescription(getString(R.string.use_kalman_filter_compass_descr)); kalmanFilterPref.setDescription(getString(R.string.use_kalman_filter_compass_descr));
kalmanFilterPref.setIconSpaceReserved(true);
} }
private void setupMagneticFieldSensorPref() { private void setupMagneticFieldSensorPref() {
SwitchPreferenceEx useMagneticSensorPref = (SwitchPreferenceEx) findPreference(settings.USE_MAGNETIC_FIELD_SENSOR_COMPASS.getId()); SwitchPreferenceEx useMagneticSensorPref = (SwitchPreferenceEx) findPreference(settings.USE_MAGNETIC_FIELD_SENSOR_COMPASS.getId());
useMagneticSensorPref.setTitle(getString(R.string.use_magnetic_sensor)); useMagneticSensorPref.setTitle(getString(R.string.use_magnetic_sensor));
useMagneticSensorPref.setDescription(getString(R.string.use_magnetic_sensor_descr)); useMagneticSensorPref.setDescription(getString(R.string.use_magnetic_sensor_descr));
useMagneticSensorPref.setIconSpaceReserved(true);
} }
private void setupMapEmptyStateAllowedPref() { private void setupMapEmptyStateAllowedPref() {
SwitchPreferenceEx mapEmptyStateAllowedPref = (SwitchPreferenceEx) findPreference(settings.MAP_EMPTY_STATE_ALLOWED.getId()); SwitchPreferenceEx mapEmptyStateAllowedPref = (SwitchPreferenceEx) findPreference(settings.MAP_EMPTY_STATE_ALLOWED.getId());
mapEmptyStateAllowedPref.setTitle(getString(R.string.tap_on_map_to_hide_interface)); mapEmptyStateAllowedPref.setTitle(getString(R.string.tap_on_map_to_hide_interface));
mapEmptyStateAllowedPref.setDescription(getString(R.string.tap_on_map_to_hide_interface_descr)); mapEmptyStateAllowedPref.setDescription(getString(R.string.tap_on_map_to_hide_interface_descr));
mapEmptyStateAllowedPref.setIconSpaceReserved(true);
}
private void setupDoNotUseAnimationsPref() {
SwitchPreference doNotUseAnimations = (SwitchPreference) findPreference(settings.DO_NOT_USE_ANIMATIONS.getId());
doNotUseAnimations.setIconSpaceReserved(true);
} }
private void setupExternalInputDevicePref() { private void setupExternalInputDevicePref() {
ListPreferenceEx externalInputDevice = (ListPreferenceEx) findPreference(settings.EXTERNAL_INPUT_DEVICE.getId()); ListPreferenceEx externalInputDevice = (ListPreferenceEx) findPreference(settings.EXTERNAL_INPUT_DEVICE.getId());
externalInputDevice.setIconSpaceReserved(true);
externalInputDevice.setEntries(new String[]{ externalInputDevice.setEntries(new String[]{
getString(R.string.sett_no_ext_input), getString(R.string.sett_no_ext_input),
getString(R.string.sett_generic_ext_input), getString(R.string.sett_generic_ext_input),

View file

@ -9,6 +9,7 @@ import android.util.Pair;
import net.osmand.plus.ApplicationMode; import net.osmand.plus.ApplicationMode;
import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandApplication;
import net.osmand.plus.OsmandSettings;
import net.osmand.plus.R; import net.osmand.plus.R;
import net.osmand.plus.activities.SettingsGeneralActivity; import net.osmand.plus.activities.SettingsGeneralActivity;
import net.osmand.plus.dialogs.SendAnalyticsBottomSheetDialogFragment; import net.osmand.plus.dialogs.SendAnalyticsBottomSheetDialogFragment;
@ -41,7 +42,7 @@ public class GlobalSettingsFragment extends BaseSettingsFragment implements Send
protected void setupPreferences() { protected void setupPreferences() {
setupDefaultAppModePref(); setupDefaultAppModePref();
setupPreferredLocalePref(); setupPreferredLocalePref();
// setupExternalStorageDirPref(); setupExternalStorageDirPref();
setupSendAnonymousDataPref(); setupSendAnonymousDataPref();
setupEnableProxyPref(); setupEnableProxyPref();
@ -147,6 +148,12 @@ public class GlobalSettingsFragment extends BaseSettingsFragment implements Send
} }
} }
private void setupExternalStorageDirPref() {
Preference externalStorageDir = (Preference) findPreference(OsmandSettings.EXTERNAL_STORAGE_DIR);
externalStorageDir.setIcon(getContentIcon(R.drawable.ic_action_folder));
}
private void setupSendAnonymousDataPref() { private void setupSendAnonymousDataPref() {
boolean enabled = settings.SEND_ANONYMOUS_MAP_DOWNLOADS_DATA.get() || settings.SEND_ANONYMOUS_APP_USAGE_DATA.get(); boolean enabled = settings.SEND_ANONYMOUS_MAP_DOWNLOADS_DATA.get() || settings.SEND_ANONYMOUS_APP_USAGE_DATA.get();

View file

@ -45,9 +45,6 @@ public class MainSettingsFragment extends BaseSettingsFragment {
Preference globalSettings = findPreference("global_settings"); Preference globalSettings = findPreference("global_settings");
globalSettings.setIcon(getContentIcon(R.drawable.ic_action_settings)); globalSettings.setIcon(getContentIcon(R.drawable.ic_action_settings));
PreferenceCategory applicationProfiles = (PreferenceCategory) findPreference("application_profiles");
applicationProfiles.setIconSpaceReserved(true);
setupConfigureProfilePref(); setupConfigureProfilePref();
setupManageProfilesPref(); setupManageProfilesPref();
} }

View file

@ -29,8 +29,6 @@ public class NavigationFragment extends BaseSettingsFragment {
Preference routeParameters = findPreference("route_parameters"); Preference routeParameters = findPreference("route_parameters");
SwitchPreference showRoutingAlarms = (SwitchPreference) findPreference(settings.SHOW_ROUTING_ALARMS.getId()); SwitchPreference showRoutingAlarms = (SwitchPreference) findPreference(settings.SHOW_ROUTING_ALARMS.getId());
SwitchPreference speakRoutingAlarms = (SwitchPreference) findPreference(settings.SPEAK_ROUTING_ALARMS.getId()); SwitchPreference speakRoutingAlarms = (SwitchPreference) findPreference(settings.SPEAK_ROUTING_ALARMS.getId());
Preference mapDuringNavigation = findPreference("map_during_navigation");
mapDuringNavigation.setIconSpaceReserved(true);
SwitchPreference turnScreenOn = (SwitchPreference) findPreference(settings.TURN_SCREEN_ON_ENABLED.getId()); SwitchPreference turnScreenOn = (SwitchPreference) findPreference(settings.TURN_SCREEN_ON_ENABLED.getId());

View file

@ -43,7 +43,6 @@ public class ProxySettingsFragment extends BaseSettingsFragment {
hostPref.setPersistent(false); hostPref.setPersistent(false);
hostPref.setSummary(settings.PROXY_HOST.get()); hostPref.setSummary(settings.PROXY_HOST.get());
hostPref.setDescription(R.string.proxy_host_descr); hostPref.setDescription(R.string.proxy_host_descr);
hostPref.setIconSpaceReserved(true);
} }
private void setupProxyPortPref() { private void setupProxyPortPref() {
@ -51,7 +50,6 @@ public class ProxySettingsFragment extends BaseSettingsFragment {
portPref.setPersistent(false); portPref.setPersistent(false);
portPref.setSummary(String.valueOf(settings.PROXY_PORT.get())); portPref.setSummary(String.valueOf(settings.PROXY_PORT.get()));
portPref.setDescription(R.string.proxy_port_descr); portPref.setDescription(R.string.proxy_port_descr);
portPref.setIconSpaceReserved(true);
} }
@Override @Override

View file

@ -67,7 +67,7 @@ public class RouteParametersFragment extends BaseSettingsFragment {
} }
private void setupTimeConditionalRoutingPref() { private void setupTimeConditionalRoutingPref() {
SwitchPreference timeConditionalRouting = createSwitchPreferenceEx(settings.ENABLE_TIME_CONDITIONAL_ROUTING.getId(), R.string.temporary_conditional_routing, R.layout.preference_dialog_and_switch); SwitchPreference 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.setIcon(getRoutingPrefIcon(settings.ENABLE_TIME_CONDITIONAL_ROUTING.getId()));
timeConditionalRouting.setSummaryOn(R.string.shared_string_enable); timeConditionalRouting.setSummaryOn(R.string.shared_string_enable);
timeConditionalRouting.setSummaryOff(R.string.shared_string_disable); timeConditionalRouting.setSummaryOff(R.string.shared_string_disable);
@ -81,7 +81,7 @@ public class RouteParametersFragment extends BaseSettingsFragment {
} }
PreferenceScreen screen = getPreferenceScreen(); PreferenceScreen screen = getPreferenceScreen();
SwitchPreferenceEx fastRoute = createSwitchPreferenceEx(app.getSettings().FAST_ROUTE_MODE.getId(), R.string.fast_route_mode, R.layout.preference_dialog_and_switch); SwitchPreferenceEx fastRoute = createSwitchPreferenceEx(app.getSettings().FAST_ROUTE_MODE.getId(), R.string.fast_route_mode, R.layout.preference_with_descr_dialog_and_switch);
fastRoute.setIcon(getRoutingPrefIcon(app.getSettings().FAST_ROUTE_MODE.getId())); fastRoute.setIcon(getRoutingPrefIcon(app.getSettings().FAST_ROUTE_MODE.getId()));
fastRoute.setDescription(getString(R.string.fast_route_mode_descr)); fastRoute.setDescription(getString(R.string.fast_route_mode_descr));
fastRoute.setSummaryOn(R.string.shared_string_enable); fastRoute.setSummaryOn(R.string.shared_string_enable);
@ -142,7 +142,6 @@ public class RouteParametersFragment extends BaseSettingsFragment {
avoidRouting.setEntries(entries); avoidRouting.setEntries(entries);
avoidRouting.setEntryValues(prefsIds); avoidRouting.setEntryValues(prefsIds);
avoidRouting.setValues(enabledPrefsIds); avoidRouting.setValues(enabledPrefsIds);
avoidRouting.setIconSpaceReserved(true);
screen.addPreference(avoidRouting); screen.addPreference(avoidRouting);
} }
@ -187,7 +186,7 @@ public class RouteParametersFragment extends BaseSettingsFragment {
if (p.getType() == GeneralRouter.RoutingParameterType.BOOLEAN) { if (p.getType() == GeneralRouter.RoutingParameterType.BOOLEAN) {
OsmandSettings.OsmandPreference pref = settings.getCustomRoutingBooleanProperty(p.getId(), p.getDefaultBoolean()); OsmandSettings.OsmandPreference pref = settings.getCustomRoutingBooleanProperty(p.getId(), p.getDefaultBoolean());
SwitchPreferenceEx switchPreferenceEx = (SwitchPreferenceEx) createSwitchPreferenceEx(pref.getId(), title, description, R.layout.preference_dialog_and_switch); SwitchPreferenceEx switchPreferenceEx = (SwitchPreferenceEx) createSwitchPreferenceEx(pref.getId(), title, description, R.layout.preference_with_descr_dialog_and_switch);
switchPreferenceEx.setDescription(description); switchPreferenceEx.setDescription(description);
switchPreferenceEx.setIcon(getRoutingPrefIcon(p.getId())); switchPreferenceEx.setIcon(getRoutingPrefIcon(p.getId()));
switchPreferenceEx.setSummaryOn(R.string.shared_string_enable); switchPreferenceEx.setSummaryOn(R.string.shared_string_enable);

View file

@ -46,33 +46,9 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment {
Preference voiceAnnouncesInfo = findPreference("voice_announces_info"); Preference voiceAnnouncesInfo = findPreference("voice_announces_info");
voiceAnnouncesInfo.setIcon(getContentIcon(R.drawable.ic_action_info_dark)); voiceAnnouncesInfo.setIcon(getContentIcon(R.drawable.ic_action_info_dark));
Preference languageAndOutput = findPreference("language_and_output");
SwitchPreference speakStreetNames = (SwitchPreference) findPreference(settings.SPEAK_STREET_NAMES.getId());
SwitchPreference speakTrafficWarnings = (SwitchPreference) findPreference(settings.SPEAK_TRAFFIC_WARNINGS.getId());
SwitchPreference speakPedestrian = (SwitchPreference) findPreference(settings.SPEAK_PEDESTRIAN.getId());
SwitchPreference speakSpeedLimit = (SwitchPreference) findPreference(settings.SPEAK_SPEED_LIMIT.getId());
speakStreetNames.setIconSpaceReserved(true);
speakTrafficWarnings.setIconSpaceReserved(true);
speakPedestrian.setIconSpaceReserved(true);
speakSpeedLimit.setIconSpaceReserved(true);
languageAndOutput.setIconSpaceReserved(true);
setupSpeedLimitExceedPref(); setupSpeedLimitExceedPref();
SwitchPreference speakSpeedCamera = (SwitchPreference) findPreference(settings.SPEAK_SPEED_CAMERA.getId());
SwitchPreference speakTunnels = (SwitchPreference) findPreference(settings.SPEAK_TUNNELS.getId());
SwitchPreference announceWpt = (SwitchPreference) findPreference(settings.ANNOUNCE_WPT.getId());
SwitchPreference announceNearbyFavorites = (SwitchPreference) findPreference(settings.ANNOUNCE_NEARBY_FAVORITES.getId());
SwitchPreference announceNearbyPoi = (SwitchPreference) findPreference(settings.ANNOUNCE_NEARBY_POI.getId());
speakSpeedCamera.setIconSpaceReserved(true);
speakTunnels.setIconSpaceReserved(true);
announceWpt.setIconSpaceReserved(true);
announceNearbyFavorites.setIconSpaceReserved(true);
announceNearbyPoi.setIconSpaceReserved(true);
setupKeepInformingPref(); setupKeepInformingPref();
setupArrivalAnnouncementPref(); setupArrivalAnnouncementPref();
setupVoiceProviderPref(); setupVoiceProviderPref();
@ -111,7 +87,6 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment {
ListPreferenceEx voiceProvider = (ListPreferenceEx) findPreference(settings.SPEED_LIMIT_EXCEED.getId()); ListPreferenceEx voiceProvider = (ListPreferenceEx) findPreference(settings.SPEED_LIMIT_EXCEED.getId());
voiceProvider.setEntries(speedLimitNames); voiceProvider.setEntries(speedLimitNames);
voiceProvider.setEntryValues(speedLimitValues); voiceProvider.setEntryValues(speedLimitValues);
voiceProvider.setIconSpaceReserved(true);
} }
private void setupKeepInformingPref() { private void setupKeepInformingPref() {
@ -125,7 +100,6 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment {
ListPreferenceEx keepInforming = (ListPreferenceEx) findPreference(settings.KEEP_INFORMING.getId()); ListPreferenceEx keepInforming = (ListPreferenceEx) findPreference(settings.KEEP_INFORMING.getId());
keepInforming.setEntries(keepInformingNames); keepInforming.setEntries(keepInformingNames);
keepInforming.setEntryValues(keepInformingValues); keepInforming.setEntryValues(keepInformingValues);
keepInforming.setIconSpaceReserved(true);
} }
private void setupArrivalAnnouncementPref() { private void setupArrivalAnnouncementPref() {
@ -140,7 +114,6 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment {
ListPreferenceEx arrivalDistanceFactor = (ListPreferenceEx) findPreference(settings.ARRIVAL_DISTANCE_FACTOR.getId()); ListPreferenceEx arrivalDistanceFactor = (ListPreferenceEx) findPreference(settings.ARRIVAL_DISTANCE_FACTOR.getId());
arrivalDistanceFactor.setEntries(arrivalNames); arrivalDistanceFactor.setEntries(arrivalNames);
arrivalDistanceFactor.setEntryValues(arrivalValues); arrivalDistanceFactor.setEntryValues(arrivalValues);
arrivalDistanceFactor.setIconSpaceReserved(true);
} }
private void setupVoiceProviderPref() { private void setupVoiceProviderPref() {