diff --git a/OsmAnd/res/layout/preference_dialog_and_switch.xml b/OsmAnd/res/layout/preference_dialog_and_switch.xml index 55be0d08ca..949a0bc554 100644 --- a/OsmAnd/res/layout/preference_dialog_and_switch.xml +++ b/OsmAnd/res/layout/preference_dialog_and_switch.xml @@ -9,8 +9,7 @@ + android:background="?android:attr/selectableItemBackground"> + android:layout_marginTop="@dimen/content_padding_small" + android:layout_marginRight="@dimen/content_padding" + android:layout_marginBottom="@dimen/content_padding_small" /> - + android:textColor="?android:textColorPrimary" + android:textSize="@dimen/default_list_text_size" + osmand:typeface="@string/font_roboto_regular" /> - - - - - + - - \ No newline at end of file diff --git a/OsmAnd/res/layout/preference_switch.xml b/OsmAnd/res/layout/preference_switch.xml index 1fbdbf6b13..c50dedeba4 100644 --- a/OsmAnd/res/layout/preference_switch.xml +++ b/OsmAnd/res/layout/preference_switch.xml @@ -56,8 +56,8 @@ android:layout_width="wrap_content" android:layout_height="match_parent" android:background="@null" - android:clickable="true" - android:focusable="true" + android:clickable="false" + android:focusable="false" android:paddingLeft="@dimen/content_padding" android:paddingRight="@dimen/content_padding" /> diff --git a/OsmAnd/res/layout/preference_with_descr_dialog_and_switch.xml b/OsmAnd/res/layout/preference_with_descr_dialog_and_switch.xml new file mode 100644 index 0000000000..b5a378bcee --- /dev/null +++ b/OsmAnd/res/layout/preference_with_descr_dialog_and_switch.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/xml/general_profile_settings.xml b/OsmAnd/res/xml/general_profile_settings.xml index 60153c1f09..94de9c787c 100644 --- a/OsmAnd/res/xml/general_profile_settings.xml +++ b/OsmAnd/res/xml/general_profile_settings.xml @@ -63,21 +63,21 @@ @@ -91,7 +91,7 @@ \ No newline at end of file diff --git a/OsmAnd/res/xml/global_settings.xml b/OsmAnd/res/xml/global_settings.xml index 8d7aa73d41..153ff8b51e 100644 --- a/OsmAnd/res/xml/global_settings.xml +++ b/OsmAnd/res/xml/global_settings.xml @@ -17,7 +17,8 @@ diff --git a/OsmAnd/src/net/osmand/plus/search/QuickSearchListAdapter.java b/OsmAnd/src/net/osmand/plus/search/QuickSearchListAdapter.java index a2ff06fceb..016cae3dfd 100644 --- a/OsmAnd/src/net/osmand/plus/search/QuickSearchListAdapter.java +++ b/OsmAnd/src/net/osmand/plus/search/QuickSearchListAdapter.java @@ -5,6 +5,7 @@ import android.content.Context; import android.graphics.drawable.Drawable; import android.support.annotation.NonNull; import android.support.v4.view.ViewCompat; +import android.support.v7.view.ContextThemeWrapper; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -45,6 +46,7 @@ public class QuickSearchListAdapter extends ArrayAdapter { private OsmandApplication app; private Activity activity; private AccessibilityAssistant accessibilityAssistant; + private LayoutInflater inflater; private boolean useMapCenter; @@ -70,6 +72,11 @@ public class QuickSearchListAdapter extends ArrayAdapter { super(app, R.layout.search_list_item); this.app = app; 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); dp1 = AndroidUtils.dpToPx(app, 1f); updateLocationViewCache = app.getUIUtilities().getUpdateLocationViewCache(); @@ -192,7 +199,6 @@ public class QuickSearchListAdapter extends ArrayAdapter { LinearLayout view; if (type == QuickSearchListItemType.SEARCH_MORE) { if (convertView == null) { - LayoutInflater inflater = (LayoutInflater) app.getSystemService(Context.LAYOUT_INFLATER_SERVICE); view = (LinearLayout) inflater.inflate(R.layout.search_more_list_item, null); } else { view = (LinearLayout) convertView; @@ -257,10 +263,7 @@ public class QuickSearchListAdapter extends ArrayAdapter { } } else if (type == QuickSearchListItemType.BUTTON) { if (convertView == null) { - LayoutInflater inflater = (LayoutInflater) app - .getSystemService(Context.LAYOUT_INFLATER_SERVICE); - view = (LinearLayout) inflater.inflate( - R.layout.search_custom_list_item, null); + view = (LinearLayout) inflater.inflate(R.layout.search_custom_list_item, null); } else { view = (LinearLayout) convertView; } @@ -272,10 +275,7 @@ public class QuickSearchListAdapter extends ArrayAdapter { } } else if (type == QuickSearchListItemType.SELECT_ALL) { if (convertView == null) { - LayoutInflater inflater = (LayoutInflater) app - .getSystemService(Context.LAYOUT_INFLATER_SERVICE); - view = (LinearLayout) inflater.inflate( - R.layout.select_all_list_item, null); + view = (LinearLayout) inflater.inflate(R.layout.select_all_list_item, null); } else { view = (LinearLayout) convertView; } @@ -291,10 +291,7 @@ public class QuickSearchListAdapter extends ArrayAdapter { }); } else if (type == QuickSearchListItemType.HEADER) { if (convertView == null) { - LayoutInflater inflater = (LayoutInflater) app - .getSystemService(Context.LAYOUT_INFLATER_SERVICE); - view = (LinearLayout) inflater.inflate( - R.layout.search_header_list_item, null); + view = (LinearLayout) inflater.inflate(R.layout.search_header_list_item, null); } else { view = (LinearLayout) convertView; } @@ -307,30 +304,21 @@ public class QuickSearchListAdapter extends ArrayAdapter { } } else if (type == QuickSearchListItemType.TOP_SHADOW) { if (convertView == null) { - LayoutInflater inflater = (LayoutInflater) app - .getSystemService(Context.LAYOUT_INFLATER_SERVICE); - view = (LinearLayout) inflater.inflate( - R.layout.list_shadow_header, null); + view = (LinearLayout) inflater.inflate(R.layout.list_shadow_header, null); } else { view = (LinearLayout) convertView; } return view; } else if (type == QuickSearchListItemType.BOTTOM_SHADOW) { if (convertView == null) { - LayoutInflater inflater = (LayoutInflater) app - .getSystemService(Context.LAYOUT_INFLATER_SERVICE); - view = (LinearLayout) inflater.inflate( - R.layout.list_shadow_footer, null); + view = (LinearLayout) inflater.inflate(R.layout.list_shadow_footer, null); } else { view = (LinearLayout) convertView; } return view; } else { if (convertView == null) { - LayoutInflater inflater = (LayoutInflater) app - .getSystemService(Context.LAYOUT_INFLATER_SERVICE); - view = (LinearLayout) inflater.inflate( - R.layout.search_list_item, null); + view = (LinearLayout) inflater.inflate(R.layout.search_list_item, null); } else { view = (LinearLayout) convertView; } diff --git a/OsmAnd/src/net/osmand/plus/settings/RouteParametersFragment.java b/OsmAnd/src/net/osmand/plus/settings/RouteParametersFragment.java index ed07ef37b2..551c40e924 100644 --- a/OsmAnd/src/net/osmand/plus/settings/RouteParametersFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/RouteParametersFragment.java @@ -67,7 +67,7 @@ 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_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.setSummaryOn(R.string.shared_string_enable); timeConditionalRouting.setSummaryOff(R.string.shared_string_disable); @@ -81,7 +81,7 @@ public class RouteParametersFragment extends BaseSettingsFragment { } 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.setDescription(getString(R.string.fast_route_mode_descr)); fastRoute.setSummaryOn(R.string.shared_string_enable); @@ -151,6 +151,7 @@ public class RouteParametersFragment extends BaseSettingsFragment { preferRouting.setTitle(R.string.prefer_in_routing_title); preferRouting.setSummary(R.string.prefer_in_routing_descr); preferRouting.setLayoutResource(R.layout.preference_with_descr); + preferRouting.setIconSpaceReserved(true); screen.addPreference(preferRouting); } if (reliefFactorParameters.size() > 0) { @@ -174,6 +175,7 @@ public class RouteParametersFragment extends BaseSettingsFragment { reliefFactorRouting.setPersistent(false); reliefFactorRouting.setValue(selectedParameterId); reliefFactorRouting.setDescription(R.string.relief_smoothness_factor_descr); + reliefFactorRouting.setIconSpaceReserved(true); screen.addPreference(reliefFactorRouting); } @@ -184,11 +186,12 @@ public class RouteParametersFragment extends BaseSettingsFragment { if (p.getType() == GeneralRouter.RoutingParameterType.BOOLEAN) { 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.setIcon(getRoutingPrefIcon(p.getId())); switchPreferenceEx.setSummaryOn(R.string.shared_string_enable); switchPreferenceEx.setSummaryOff(R.string.shared_string_disable); + switchPreferenceEx.setIconSpaceReserved(true); screen.addPreference(switchPreferenceEx); } else { @@ -203,6 +206,7 @@ public class RouteParametersFragment extends BaseSettingsFragment { ListPreferenceEx listPreferenceEx = (ListPreferenceEx) createListPreferenceEx(pref.getId(), p.getPossibleValueDescriptions(), svlss, title, R.layout.preference_with_descr); listPreferenceEx.setDescription(description); listPreferenceEx.setIcon(getRoutingPrefIcon(p.getId())); + listPreferenceEx.setIconSpaceReserved(true); screen.addPreference(listPreferenceEx); } diff --git a/OsmAnd/src/net/osmand/plus/settings/VoiceAnnouncesFragment.java b/OsmAnd/src/net/osmand/plus/settings/VoiceAnnouncesFragment.java index 869df72d98..91e88eb214 100644 --- a/OsmAnd/src/net/osmand/plus/settings/VoiceAnnouncesFragment.java +++ b/OsmAnd/src/net/osmand/plus/settings/VoiceAnnouncesFragment.java @@ -159,6 +159,7 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment { //AudioManager.USE_DEFAULT_STREAM_TYPE}; ListPreferenceEx audioStreamGuidance = createListPreferenceEx(settings.AUDIO_STREAM_GUIDANCE.getId(), streamTypes, streamIntTypes, R.string.choose_audio_stream, R.layout.preference_with_descr); + audioStreamGuidance.setIconSpaceReserved(true); getPreferenceScreen().addPreference(audioStreamGuidance); @@ -167,6 +168,7 @@ public class VoiceAnnouncesFragment extends BaseSettingsFragment { private void setupInterruptMusicPref() { Preference interruptMusicPref = createSwitchPreference(settings.INTERRUPT_MUSIC, R.string.interrupt_music, R.string.interrupt_music_descr, R.layout.preference_switch); + interruptMusicPref.setIconSpaceReserved(true); getPreferenceScreen().addPreference(interruptMusicPref); interruptMusicPref.setDependency(settings.SPEAK_ROUTING_ALARMS.getId());