Fix toolbar buttons ui
This commit is contained in:
parent
edb3cabd8c
commit
5e741b6faf
8 changed files with 115 additions and 91 deletions
Binary file not shown.
Before Width: | Height: | Size: 1.5 KiB After Width: | Height: | Size: 1.5 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.8 KiB After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
@ -221,9 +221,9 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginBottom="3dp"
|
android:layout_marginBottom="3dp"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
|
android:ellipsize="end"
|
||||||
android:gravity="left"
|
android:gravity="left"
|
||||||
android:singleLine="true"
|
android:singleLine="true"
|
||||||
android:ellipsize="end"
|
|
||||||
android:text="@string/intermediate_destinations"
|
android:text="@string/intermediate_destinations"
|
||||||
android:textSize="@dimen/default_sub_text_size" />
|
android:textSize="@dimen/default_sub_text_size" />
|
||||||
|
|
||||||
|
@ -418,7 +418,6 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="start"
|
android:layout_gravity="start"
|
||||||
android:paddingBottom="@dimen/bottom_sheet_content_margin_small"
|
android:paddingBottom="@dimen/bottom_sheet_content_margin_small"
|
||||||
android:paddingLeft="@dimen/bottom_sheet_content_margin_small"
|
|
||||||
android:paddingTop="@dimen/bottom_sheet_content_margin_small">
|
android:paddingTop="@dimen/bottom_sheet_content_margin_small">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -426,30 +425,52 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:gravity="start"
|
android:gravity="start"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal"
|
||||||
|
android:paddingEnd="70dp"
|
||||||
|
android:paddingLeft="5dp"
|
||||||
|
android:paddingRight="70dp"
|
||||||
|
android:paddingStart="5dp">
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</HorizontalScrollView>
|
</HorizontalScrollView>
|
||||||
|
|
||||||
<net.osmand.plus.widgets.TextViewEx
|
<LinearLayout
|
||||||
android:id="@+id/map_options_route_button"
|
android:id="@+id/map_options_route_button"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="end"
|
android:layout_gravity="end"
|
||||||
android:background="?attr/selectableItemBackground"
|
android:orientation="horizontal"
|
||||||
android:drawablePadding="@dimen/content_padding_small"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:gravity="center"
|
|
||||||
android:letterSpacing="@dimen/text_button_letter_spacing"
|
|
||||||
android:maxLines="1"
|
|
||||||
android:paddingLeft="@dimen/route_info_buttons_padding_top_bottom"
|
android:paddingLeft="@dimen/route_info_buttons_padding_top_bottom"
|
||||||
android:paddingRight="@dimen/route_info_buttons_padding_top_bottom"
|
android:paddingStart="@dimen/route_info_buttons_padding_top_bottom">
|
||||||
android:text="@string/shared_string_options"
|
|
||||||
android:textSize="@dimen/text_button_text_size"
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
osmand:typeface="@string/font_roboto_medium"
|
android:id="@+id/map_options_route_button_title"
|
||||||
tools:ignore="UnusedAttribute"
|
android:layout_width="wrap_content"
|
||||||
tools:textColor="?attr/wikivoyage_active_color" />
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
android:ellipsize="end"
|
||||||
|
android:gravity="center"
|
||||||
|
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||||
|
android:maxLines="1"
|
||||||
|
android:text="@string/shared_string_options"
|
||||||
|
android:textSize="@dimen/text_button_text_size"
|
||||||
|
osmand:typeface="@string/font_roboto_medium"
|
||||||
|
tools:ignore="UnusedAttribute"
|
||||||
|
tools:textColor="?attr/wikivoyage_active_color" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/map_options_route_button_icon"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:paddingEnd="@dimen/route_info_buttons_padding_top_bottom"
|
||||||
|
android:paddingLeft="@dimen/content_padding_small"
|
||||||
|
android:paddingRight="@dimen/route_info_buttons_padding_top_bottom"
|
||||||
|
android:paddingStart="@dimen/content_padding_small"
|
||||||
|
tools:src="@drawable/ic_action_edit_dark"
|
||||||
|
tools:tint="@color/recording_color" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/progress_bar"
|
android:id="@+id/progress_bar"
|
||||||
|
|
|
@ -4,14 +4,14 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/route_option_button"
|
android:id="@+id/route_option_button"
|
||||||
android:layout_width="100dp"
|
android:layout_width="100dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="32dp"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/route_option_container"
|
android:id="@+id/route_option_container"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:gravity="center"
|
android:gravity="start"
|
||||||
android:visibility="visible"
|
android:visibility="visible"
|
||||||
tools:background="@drawable/btn_border_trans_dark">
|
tools:background="@drawable/btn_border_trans_dark">
|
||||||
|
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
android:paddingStart="3dp"
|
android:paddingStart="3dp"
|
||||||
android:paddingTop="3dp"
|
android:paddingTop="3dp"
|
||||||
android:text="@string/routing_attr_avoid_motorway_name"
|
android:text="@string/routing_attr_avoid_motorway_name"
|
||||||
android:textSize="@dimen/text_button_text_size"
|
android:textSize="@dimen/default_sub_text_size"
|
||||||
osmand:typeface="@string/font_roboto_medium"
|
osmand:typeface="@string/font_roboto_medium"
|
||||||
tools:ignore="UnusedAttribute"
|
tools:ignore="UnusedAttribute"
|
||||||
tools:textColor="?attr/wikivoyage_active_color" />
|
tools:textColor="?attr/wikivoyage_active_color" />
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/route_option_button"
|
android:id="@+id/route_option_button"
|
||||||
android:layout_width="100dp"
|
android:layout_width="100dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="32dp"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
tools:background="@drawable/btn_border_trans_dark">
|
tools:background="@drawable/btn_border_trans_dark">
|
||||||
|
|
||||||
|
@ -18,17 +18,15 @@
|
||||||
android:id="@+id/route_removable_option_container"
|
android:id="@+id/route_removable_option_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:gravity="start|center_vertical">
|
android:gravity="start|center_vertical"
|
||||||
|
android:paddingLeft="8dp"
|
||||||
|
android:paddingRight="8dp">
|
||||||
|
|
||||||
<net.osmand.plus.widgets.TextViewEx
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
android:id="@+id/route_removable_option_title"
|
android:id="@+id/route_removable_option_title"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:layout_marginEnd="4dp"
|
|
||||||
android:layout_marginLeft="3dp"
|
|
||||||
android:layout_marginRight="4dp"
|
|
||||||
android:layout_marginStart="3dp"
|
|
||||||
android:ellipsize="end"
|
android:ellipsize="end"
|
||||||
android:gravity="center"
|
android:gravity="center"
|
||||||
android:letterSpacing="@dimen/text_button_letter_spacing"
|
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||||
|
@ -36,7 +34,7 @@
|
||||||
android:paddingBottom="3dp"
|
android:paddingBottom="3dp"
|
||||||
android:paddingTop="3dp"
|
android:paddingTop="3dp"
|
||||||
android:text="@string/routing_attr_avoid_motorway_name"
|
android:text="@string/routing_attr_avoid_motorway_name"
|
||||||
android:textSize="@dimen/text_button_text_size"
|
android:textSize="@dimen/default_sub_text_size"
|
||||||
osmand:typeface="@string/font_roboto_medium"
|
osmand:typeface="@string/font_roboto_medium"
|
||||||
tools:ignore="UnusedAttribute"
|
tools:ignore="UnusedAttribute"
|
||||||
tools:textColor="?attr/wikivoyage_active_color" />
|
tools:textColor="?attr/wikivoyage_active_color" />
|
||||||
|
@ -48,11 +46,9 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_marginEnd="4dp"
|
android:layout_marginLeft="8dp"
|
||||||
android:layout_marginLeft="3dp"
|
android:layout_marginRight="8dp"
|
||||||
android:layout_marginRight="4dp"
|
android:background="@color/description_font_and_bottom_sheet_icons" />
|
||||||
android:layout_marginStart="3dp"
|
|
||||||
android:background="@color/recording_color" />
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/removable_option_icon"
|
android:id="@+id/removable_option_icon"
|
||||||
|
@ -70,10 +66,8 @@
|
||||||
<View
|
<View
|
||||||
android:id="@+id/options_divider_end"
|
android:id="@+id/options_divider_end"
|
||||||
android:layout_width="1dp"
|
android:layout_width="1dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="16dp"
|
||||||
android:layout_gravity="end"
|
android:layout_gravity="end|center_vertical" />
|
||||||
android:layout_marginBottom="@dimen/list_item_button_padding"
|
|
||||||
android:layout_marginTop="@dimen/list_item_button_padding" />
|
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
|
|
|
@ -481,6 +481,11 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
private void updateOptionsButtons(final View main) {
|
private void updateOptionsButtons(final View main) {
|
||||||
final boolean nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
final boolean nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||||
final OsmandSettings settings = app.getSettings();
|
final OsmandSettings settings = app.getSettings();
|
||||||
|
final int colorActive = ContextCompat.getColor(app, nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
||||||
|
final int colorDisabled = ContextCompat.getColor(app, R.color.description_font_and_bottom_sheet_icons);
|
||||||
|
final ApplicationMode applicationMode = routingHelper.getAppMode();
|
||||||
|
final RoutingOptionsHelper.RouteMenuAppModes mode = routingOptionsHelper.modes.get(applicationMode);
|
||||||
|
int margin = AndroidUtils.dpToPx(app, 3);
|
||||||
|
|
||||||
View startButton = main.findViewById(R.id.start_button);
|
View startButton = main.findViewById(R.id.start_button);
|
||||||
if (isRouteCalculated()) {
|
if (isRouteCalculated()) {
|
||||||
|
@ -510,77 +515,77 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
TextView options = (TextView) main.findViewById(R.id.map_options_route_button);
|
LinearLayout optionsButton = (LinearLayout) main.findViewById(R.id.map_options_route_button);
|
||||||
|
TextView optionsTitle = (TextView) main.findViewById(R.id.map_options_route_button_title);
|
||||||
|
ImageView optionsIcon = (ImageView) main.findViewById(R.id.map_options_route_button_icon);
|
||||||
Drawable drawable = app.getUIUtilities().getIcon(R.drawable.map_action_settings, nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light);
|
Drawable drawable = app.getUIUtilities().getIcon(R.drawable.map_action_settings, nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light);
|
||||||
if (Build.VERSION.SDK_INT >= 21) {
|
if (Build.VERSION.SDK_INT >= 21) {
|
||||||
Drawable active = app.getUIUtilities().getIcon(R.drawable.map_action_settings, nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
Drawable active = app.getUIUtilities().getIcon(R.drawable.map_action_settings, nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
||||||
drawable = AndroidUtils.createPressedStateListDrawable(drawable, active);
|
drawable = AndroidUtils.createPressedStateListDrawable(drawable, active);
|
||||||
}
|
}
|
||||||
options.setCompoundDrawablesWithIntrinsicBounds(null, null, drawable, null);
|
optionsIcon.setImageDrawable(drawable);
|
||||||
options.setOnClickListener(new View.OnClickListener() {
|
optionsButton.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
clickRouteParams();
|
clickRouteParams();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
AndroidUtils.setBackground(app, optionsButton, nightMode, R.drawable.route_info_trans_gradient_light, R.drawable.route_info_trans_gradient_dark);
|
||||||
AndroidUtils.setBackground(app, mainView.findViewById(R.id.map_options_route_button), nightMode,
|
|
||||||
R.drawable.route_info_trans_gradient_light, R.drawable.route_info_trans_gradient_dark);
|
|
||||||
|
|
||||||
HorizontalScrollView scrollView = mainView.findViewById(R.id.route_options_scroll_container);
|
HorizontalScrollView scrollView = mainView.findViewById(R.id.route_options_scroll_container);
|
||||||
scrollView.setVerticalScrollBarEnabled(false);
|
scrollView.setVerticalScrollBarEnabled(false);
|
||||||
scrollView.setHorizontalScrollBarEnabled(false);
|
scrollView.setHorizontalScrollBarEnabled(false);
|
||||||
|
|
||||||
final ApplicationMode applicationMode = routingHelper.getAppMode();
|
|
||||||
int margin = app.getResources().getDimensionPixelSize(R.dimen.text_margin_small);
|
|
||||||
|
|
||||||
final RoutingOptionsHelper.RouteMenuAppModes mode = routingOptionsHelper.modes.get(applicationMode);
|
|
||||||
LinearLayout optionsContainer = (LinearLayout) main.findViewById(R.id.route_options_container);
|
LinearLayout optionsContainer = (LinearLayout) main.findViewById(R.id.route_options_container);
|
||||||
optionsContainer.removeAllViews();
|
optionsContainer.removeAllViews();
|
||||||
if (mode == null) {
|
if (mode == null) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final int colorActive = ContextCompat.getColor(app, nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
|
||||||
final int colorDisabled = ContextCompat.getColor(app, R.color.description_font_and_bottom_sheet_icons);
|
|
||||||
|
|
||||||
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
||||||
LinearLayout.LayoutParams newLp = new LinearLayout.LayoutParams(AndroidUtils.dpToPx(app, 100), ViewGroup.LayoutParams.MATCH_PARENT);
|
LinearLayout.LayoutParams newLp = new LinearLayout.LayoutParams(AndroidUtils.dpToPx(app, 100), ViewGroup.LayoutParams.MATCH_PARENT);
|
||||||
|
|
||||||
lp.setMargins(margin, 0, margin, 0);
|
lp.setMargins(margin, 0, margin, 0);
|
||||||
|
|
||||||
|
if (mode.parameters.size() > 2) {
|
||||||
|
optionsTitle.setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
|
optionsTitle.setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
|
||||||
for (final RoutingOptionsHelper.LocalRoutingParameter parameter : mode.parameters) {
|
for (final RoutingOptionsHelper.LocalRoutingParameter parameter : mode.parameters) {
|
||||||
if (parameter instanceof RoutingOptionsHelper.MuteSoundRoutingParameter) {
|
if (parameter instanceof RoutingOptionsHelper.MuteSoundRoutingParameter) {
|
||||||
String text = null;
|
String text = null;
|
||||||
|
boolean active = !app.getRoutingHelper().getVoiceRouter().isMute();
|
||||||
if (mode.parameters.size() <= 2) {
|
if (mode.parameters.size() <= 2) {
|
||||||
text = app.getString(R.string.sound_is, (app.getText(app.getRoutingHelper().getVoiceRouter().isMute() ? R.string.shared_string_off : R.string.shared_string_on)));
|
text = app.getString(active ? R.string.shared_string_on : R.string.shared_string_off);
|
||||||
}
|
}
|
||||||
View item = createToolbarOptionView(!app.getRoutingHelper().getVoiceRouter().isMute(), text, R.drawable.ic_action_volume_up, new View.OnClickListener() {
|
View item = createToolbarOptionView(active, text, R.drawable.ic_action_volume_up, R.drawable.ic_action_volume_mute, new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
routingOptionsHelper.switchSound();
|
routingOptionsHelper.switchSound();
|
||||||
Drawable itemDrawable = app.getUIUtilities().getIcon(R.drawable.ic_action_volume_up, nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light);
|
boolean active = !app.getRoutingHelper().getVoiceRouter().isMute();
|
||||||
Drawable activeItemDrawable = app.getUIUtilities().getIcon(R.drawable.ic_action_volume_up, nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
String text = app.getString(active ? R.string.shared_string_on : R.string.shared_string_off);
|
||||||
|
|
||||||
|
Drawable itemDrawable = app.getUIUtilities().getIcon(active ? R.drawable.ic_action_volume_up : R.drawable.ic_action_volume_mute, nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light);
|
||||||
|
Drawable activeItemDrawable = app.getUIUtilities().getIcon(active ? R.drawable.ic_action_volume_up : R.drawable.ic_action_volume_mute, nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= 21) {
|
if (Build.VERSION.SDK_INT >= 21) {
|
||||||
itemDrawable = AndroidUtils.createPressedStateListDrawable(itemDrawable, activeItemDrawable);
|
itemDrawable = AndroidUtils.createPressedStateListDrawable(itemDrawable, activeItemDrawable);
|
||||||
}
|
}
|
||||||
((ImageView) v.findViewById(R.id.route_option_image_view)).setImageDrawable(app.getRoutingHelper().getVoiceRouter().isMute() ? itemDrawable : activeItemDrawable);
|
|
||||||
|
|
||||||
String text = app.getString(R.string.sound_is, (app.getText(app.getRoutingHelper().getVoiceRouter().isMute() && mode.parameters.size() <= 2 ? R.string.shared_string_off : R.string.shared_string_on)));
|
((ImageView) v.findViewById(R.id.route_option_image_view)).setImageDrawable(active ? activeItemDrawable : itemDrawable);
|
||||||
((TextView) v.findViewById(R.id.route_option_title)).setText(text);
|
((TextView) v.findViewById(R.id.route_option_title)).setText(text);
|
||||||
((TextView) v.findViewById(R.id.route_option_title)).setTextColor(app.getRoutingHelper().getVoiceRouter().isMute() && mode.parameters.size() <= 2 ? colorDisabled : colorActive);
|
((TextView) v.findViewById(R.id.route_option_title)).setTextColor(active ? colorActive : colorDisabled);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (mode.parameters.size() > 2) {
|
optionsContainer.addView(item, lp);
|
||||||
optionsContainer.addView(item, lp);
|
|
||||||
} else {
|
|
||||||
optionsContainer.addView(item, newLp);
|
|
||||||
}
|
|
||||||
} else if (parameter instanceof RoutingOptionsHelper.ShowAlongTheRouteItem) {
|
} else if (parameter instanceof RoutingOptionsHelper.ShowAlongTheRouteItem) {
|
||||||
final Set<PoiUIFilter> poiFilters = app.getPoiFilters().getSelectedPoiFilters();
|
final Set<PoiUIFilter> poiFilters = app.getPoiFilters().getSelectedPoiFilters();
|
||||||
final boolean traffic = app.getSettings().SHOW_TRAFFIC_WARNINGS.getModeValue(applicationMode);
|
final boolean traffic = app.getSettings().SHOW_TRAFFIC_WARNINGS.getModeValue(applicationMode);
|
||||||
final boolean fav = app.getSettings().SHOW_NEARBY_FAVORITES.getModeValue(applicationMode);
|
final boolean fav = app.getSettings().SHOW_NEARBY_FAVORITES.getModeValue(applicationMode);
|
||||||
if (!poiFilters.isEmpty()) {
|
if (!poiFilters.isEmpty()) {
|
||||||
final LinearLayout item = createToolbarOptionView(false, null, -1, null);
|
final LinearLayout item = createToolbarOptionView(false, null, -1, -1, null);
|
||||||
item.findViewById(R.id.route_option_container).setVisibility(View.GONE);
|
item.findViewById(R.id.route_option_container).setVisibility(View.GONE);
|
||||||
Iterator<PoiUIFilter> it = poiFilters.iterator();
|
Iterator<PoiUIFilter> it = poiFilters.iterator();
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
|
@ -589,9 +594,6 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
app.getPoiFilters().removeSelectedPoiFilter(poiUIFilter);
|
app.getPoiFilters().removeSelectedPoiFilter(poiUIFilter);
|
||||||
if (!app.getPoiFilters().isShowingAnyPoi()) {
|
|
||||||
mode.parameters.remove(parameter);
|
|
||||||
}
|
|
||||||
mapActivity.getMapView().refreshMap();
|
mapActivity.getMapView().refreshMap();
|
||||||
updateOptionsButtons(mainView);
|
updateOptionsButtons(mainView);
|
||||||
}
|
}
|
||||||
|
@ -601,8 +603,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
optionsContainer.addView(item, lp);
|
optionsContainer.addView(item, lp);
|
||||||
}
|
}
|
||||||
if (traffic) {
|
if (traffic) {
|
||||||
final LinearLayout item = createToolbarOptionView(false, null, -1, null);
|
final LinearLayout item = createToolbarOptionView(false, null, -1, -1, null);
|
||||||
AndroidUtils.setBackground(app, item, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
|
|
||||||
item.findViewById(R.id.route_option_container).setVisibility(View.GONE);
|
item.findViewById(R.id.route_option_container).setVisibility(View.GONE);
|
||||||
final LinearLayout container = createToolbarSubOptionView(true, app.getString(R.string.way_alarms), R.drawable.ic_action_remove_dark, true, new View.OnClickListener() {
|
final LinearLayout container = createToolbarSubOptionView(true, app.getString(R.string.way_alarms), R.drawable.ic_action_remove_dark, true, new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -611,12 +612,12 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
updateOptionsButtons(mainView);
|
updateOptionsButtons(mainView);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
item.addView(container,newLp);
|
AndroidUtils.setBackground(app, container, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
|
||||||
|
item.addView(container, newLp);
|
||||||
optionsContainer.addView(item, lp);
|
optionsContainer.addView(item, lp);
|
||||||
}
|
}
|
||||||
if (fav) {
|
if (fav) {
|
||||||
final LinearLayout item = createToolbarOptionView(false, null, -1, null);
|
final LinearLayout item = createToolbarOptionView(false, null, -1, -1, null);
|
||||||
AndroidUtils.setBackground(app, item, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
|
|
||||||
item.findViewById(R.id.route_option_container).setVisibility(View.GONE);
|
item.findViewById(R.id.route_option_container).setVisibility(View.GONE);
|
||||||
final LinearLayout container = createToolbarSubOptionView(true, app.getString(R.string.favourites), R.drawable.ic_action_remove_dark, true, new View.OnClickListener() {
|
final LinearLayout container = createToolbarSubOptionView(true, app.getString(R.string.favourites), R.drawable.ic_action_remove_dark, true, new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -625,11 +626,12 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
updateOptionsButtons(mainView);
|
updateOptionsButtons(mainView);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
item.addView(container,newLp);
|
AndroidUtils.setBackground(app, container, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
|
||||||
|
item.addView(container, newLp);
|
||||||
optionsContainer.addView(item, lp);
|
optionsContainer.addView(item, lp);
|
||||||
}
|
}
|
||||||
} else if (parameter instanceof RoutingOptionsHelper.AvoidRoadsTypesRoutingParameter) {
|
} else if (parameter instanceof RoutingOptionsHelper.AvoidRoadsTypesRoutingParameter) {
|
||||||
final LinearLayout item = createToolbarOptionView(false, null, -1, null);
|
final LinearLayout item = createToolbarOptionView(false, null, -1, -1, null);
|
||||||
item.findViewById(R.id.route_option_container).setVisibility(View.GONE);
|
item.findViewById(R.id.route_option_container).setVisibility(View.GONE);
|
||||||
|
|
||||||
List<GeneralRouter.RoutingParameter> avoidParameters = routingOptionsHelper.getAvoidRoutingPrefsForAppMode(applicationMode);
|
List<GeneralRouter.RoutingParameter> avoidParameters = routingOptionsHelper.getAvoidRoutingPrefsForAppMode(applicationMode);
|
||||||
|
@ -662,11 +664,11 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
item.addView(container,newLp);
|
item.addView(container, newLp);
|
||||||
}
|
}
|
||||||
optionsContainer.addView(item, lp);
|
optionsContainer.addView(item, lp);
|
||||||
} else if (parameter instanceof RoutingOptionsHelper.AvoidRoadsRoutingParameter) {
|
} else if (parameter instanceof RoutingOptionsHelper.AvoidRoadsRoutingParameter) {
|
||||||
final LinearLayout item = createToolbarOptionView(false, null, -1, null);
|
final LinearLayout item = createToolbarOptionView(false, null, -1, -1, null);
|
||||||
item.findViewById(R.id.route_option_container).setVisibility(View.GONE);
|
item.findViewById(R.id.route_option_container).setVisibility(View.GONE);
|
||||||
AvoidSpecificRoads avoidSpecificRoads = app.getAvoidSpecificRoads();
|
AvoidSpecificRoads avoidSpecificRoads = app.getAvoidSpecificRoads();
|
||||||
Map<LatLon, RouteDataObject> impassableRoads = avoidSpecificRoads.getImpassableRoads();
|
Map<LatLon, RouteDataObject> impassableRoads = avoidSpecificRoads.getImpassableRoads();
|
||||||
|
@ -679,7 +681,9 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
final LinearLayout container = createToolbarSubOptionView(false, getText(routeDataObject), R.drawable.ic_action_remove_dark, !it.hasNext(), new View.OnClickListener() {
|
final LinearLayout container = createToolbarSubOptionView(false, getText(routeDataObject), R.drawable.ic_action_remove_dark, !it.hasNext(), new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
app.getAvoidSpecificRoads().removeImpassableRoad(routeDataObject);
|
if (routeDataObject != null) {
|
||||||
|
app.getAvoidSpecificRoads().removeImpassableRoad(routeDataObject);
|
||||||
|
}
|
||||||
if (routingHelper.isRouteCalculated() || routingHelper.isRouteBeingCalculated()) {
|
if (routingHelper.isRouteCalculated() || routingHelper.isRouteBeingCalculated()) {
|
||||||
routingHelper.recalculateRouteDueToSettingsChange();
|
routingHelper.recalculateRouteDueToSettingsChange();
|
||||||
}
|
}
|
||||||
|
@ -694,19 +698,20 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
item.addView(container,newLp);
|
item.addView(container, newLp);
|
||||||
}
|
}
|
||||||
optionsContainer.addView(item, lp);
|
optionsContainer.addView(item, lp);
|
||||||
} else if (parameter instanceof RoutingOptionsHelper.LocalRoutingParameterGroup) {
|
} else if (parameter instanceof RoutingOptionsHelper.LocalRoutingParameterGroup) {
|
||||||
|
final RoutingOptionsHelper.LocalRoutingParameterGroup group = (RoutingOptionsHelper.LocalRoutingParameterGroup) parameter;
|
||||||
String text = null;
|
String text = null;
|
||||||
RoutingOptionsHelper.LocalRoutingParameter selected = ((RoutingOptionsHelper.LocalRoutingParameterGroup) parameter).getSelected(settings);
|
RoutingOptionsHelper.LocalRoutingParameter selected = group.getSelected(settings);
|
||||||
if (selected != null) {
|
if (selected != null) {
|
||||||
text = ((RoutingOptionsHelper.LocalRoutingParameterGroup) parameter).getText(mapActivity);
|
text = group.getText(mapActivity);
|
||||||
}
|
}
|
||||||
View item = createToolbarOptionView(false, text, R.drawable.mx_amenity_fuel, new View.OnClickListener() {
|
View item = createToolbarOptionView(false, text, R.drawable.mx_amenity_fuel, R.drawable.mx_amenity_fuel, new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
routingOptionsHelper.showLocalRoutingParameterGroupDialog((RoutingOptionsHelper.LocalRoutingParameterGroup) parameter, mapActivity, new RoutingOptionsHelper.OnClickListener() {
|
routingOptionsHelper.showLocalRoutingParameterGroupDialog(group, mapActivity, new RoutingOptionsHelper.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick() {
|
public void onClick() {
|
||||||
updateOptionsButtons(mainView);
|
updateOptionsButtons(mainView);
|
||||||
|
@ -726,7 +731,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
active = parameter.isSelected(settings);
|
active = parameter.isSelected(settings);
|
||||||
}
|
}
|
||||||
text = parameter.getText(mapActivity);
|
text = parameter.getText(mapActivity);
|
||||||
View item = createToolbarOptionView(active, text, R.drawable.mx_amenity_fuel, new View.OnClickListener() {
|
View item = createToolbarOptionView(active, text, R.drawable.mx_amenity_fuel, R.drawable.mx_amenity_fuel, new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
if (parameter.routingParameter != null) {
|
if (parameter.routingParameter != null) {
|
||||||
|
@ -742,10 +747,14 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
optionsContainer.setPadding(optionsContainer.getPaddingLeft(), optionsContainer.getPaddingTop(), options.getWidth(), optionsContainer.getPaddingBottom());
|
int rightPadding = AndroidUtils.dpToPx(app, 70);
|
||||||
|
if (optionsTitle.getVisibility() == View.VISIBLE) {
|
||||||
|
rightPadding += AndroidUtils.getTextWidth(app.getResources().getDimensionPixelSize(R.dimen.text_button_text_size), app.getString(R.string.shared_string_options));
|
||||||
|
}
|
||||||
|
optionsContainer.setPadding(optionsContainer.getPaddingLeft(), optionsContainer.getPaddingTop(), rightPadding, optionsContainer.getPaddingBottom());
|
||||||
}
|
}
|
||||||
|
|
||||||
private LinearLayout createToolbarOptionView(boolean active, String title, @DrawableRes int iconId, View.OnClickListener listener) {
|
private LinearLayout createToolbarOptionView(boolean active, String title, @DrawableRes int activeIconId, @DrawableRes int disabledIconId, View.OnClickListener listener) {
|
||||||
final LinearLayout item = (LinearLayout) mapActivity.getLayoutInflater().inflate(R.layout.route_option_btn, null);
|
final LinearLayout item = (LinearLayout) mapActivity.getLayoutInflater().inflate(R.layout.route_option_btn, null);
|
||||||
final TextView textView = (TextView) item.findViewById(R.id.route_option_title);
|
final TextView textView = (TextView) item.findViewById(R.id.route_option_title);
|
||||||
final ImageView imageView = (ImageView) item.findViewById(R.id.route_option_image_view);
|
final ImageView imageView = (ImageView) item.findViewById(R.id.route_option_image_view);
|
||||||
|
@ -759,17 +768,17 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
|
|
||||||
Drawable itemDrawable = null;
|
Drawable itemDrawable = null;
|
||||||
Drawable activeItemDrawable = null;
|
Drawable activeItemDrawable = null;
|
||||||
if (iconId != -1) {
|
if (activeIconId != -1 && disabledIconId != -1) {
|
||||||
itemDrawable = app.getUIUtilities().getIcon(iconId, nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light);
|
itemDrawable = app.getUIUtilities().getIcon(active ? activeIconId : disabledIconId, nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light);
|
||||||
activeItemDrawable = app.getUIUtilities().getIcon(iconId, nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
activeItemDrawable = app.getUIUtilities().getIcon(active ? activeIconId : disabledIconId, nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
||||||
if (Build.VERSION.SDK_INT >= 21) {
|
if (Build.VERSION.SDK_INT >= 21) {
|
||||||
itemDrawable = AndroidUtils.createPressedStateListDrawable(itemDrawable, activeItemDrawable);
|
itemDrawable = AndroidUtils.createPressedStateListDrawable(itemDrawable, activeItemDrawable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (title == null) {
|
if (title == null) {
|
||||||
textView.setVisibility(View.GONE);
|
textView.setVisibility(View.GONE);
|
||||||
if (activeItemDrawable != null) {
|
if (activeItemDrawable != null && itemDrawable != null) {
|
||||||
imageView.setImageDrawable(activeItemDrawable);
|
imageView.setImageDrawable(active ? activeItemDrawable : itemDrawable);
|
||||||
} else {
|
} else {
|
||||||
imageView.setVisibility(View.GONE);
|
imageView.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
@ -777,8 +786,8 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
textView.setVisibility(View.VISIBLE);
|
textView.setVisibility(View.VISIBLE);
|
||||||
textView.setTextColor(active ? colorActive : colorDisabled);
|
textView.setTextColor(active ? colorActive : colorDisabled);
|
||||||
textView.setText(title);
|
textView.setText(title);
|
||||||
if (itemDrawable != null) {
|
if (activeItemDrawable != null && itemDrawable != null) {
|
||||||
imageView.setImageDrawable(itemDrawable);
|
imageView.setImageDrawable(active ? activeItemDrawable : itemDrawable);
|
||||||
} else {
|
} else {
|
||||||
imageView.setVisibility(View.GONE);
|
imageView.setVisibility(View.GONE);
|
||||||
}
|
}
|
||||||
|
@ -803,7 +812,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
|
|
||||||
if (lastItem) {
|
if (lastItem) {
|
||||||
container.findViewById(R.id.options_divider_end).setVisibility(View.GONE);
|
container.findViewById(R.id.options_divider_end).setVisibility(View.GONE);
|
||||||
}else {
|
} else {
|
||||||
container.findViewById(R.id.options_divider_end).setVisibility(View.VISIBLE);
|
container.findViewById(R.id.options_divider_end).setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
if (hideTextLine) {
|
if (hideTextLine) {
|
||||||
|
|
|
@ -818,7 +818,7 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
|
||||||
((TextView) mainView.findViewById(R.id.from_button_description)).setTextColor(color);
|
((TextView) mainView.findViewById(R.id.from_button_description)).setTextColor(color);
|
||||||
((TextView) mainView.findViewById(R.id.via_button_description)).setTextColor(color);
|
((TextView) mainView.findViewById(R.id.via_button_description)).setTextColor(color);
|
||||||
((TextView) mainView.findViewById(R.id.to_button_description)).setTextColor(color);
|
((TextView) mainView.findViewById(R.id.to_button_description)).setTextColor(color);
|
||||||
((TextView) mainView.findViewById(R.id.map_options_route_button)).setTextColor(color);
|
((TextView) mainView.findViewById(R.id.map_options_route_button_title)).setTextColor(color);
|
||||||
|
|
||||||
((TextView) view.findViewById(R.id.cancel_button_descr)).setTextColor(
|
((TextView) view.findViewById(R.id.cancel_button_descr)).setTextColor(
|
||||||
ContextCompat.getColor(getMapActivity(), nightMode ? R.color.active_buttons_and_links_dark : R.color.route_info_cancel_button_color_light));
|
ContextCompat.getColor(getMapActivity(), nightMode ? R.color.active_buttons_and_links_dark : R.color.route_info_cancel_button_color_light));
|
||||||
|
|
Loading…
Reference in a new issue