improve toolbar buttons ui
This commit is contained in:
parent
9adc040304
commit
c2fcbcb038
9 changed files with 324 additions and 335 deletions
|
@ -9,6 +9,7 @@
|
||||||
android:endColor="@color/activity_background_dark"
|
android:endColor="@color/activity_background_dark"
|
||||||
android:centerX="0.2"
|
android:centerX="0.2"
|
||||||
android:type="linear" />
|
android:type="linear" />
|
||||||
|
<corners android:radius="4dp" />
|
||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
</selector>
|
</selector>
|
|
@ -9,6 +9,7 @@
|
||||||
android:endColor="@color/card_and_list_background_light"
|
android:endColor="@color/card_and_list_background_light"
|
||||||
android:centerX="0.2"
|
android:centerX="0.2"
|
||||||
android:type="linear" />
|
android:type="linear" />
|
||||||
|
<corners android:radius="4dp" />
|
||||||
</shape>
|
</shape>
|
||||||
</item>
|
</item>
|
||||||
</selector>
|
</selector>
|
|
@ -222,6 +222,8 @@
|
||||||
android:layout_marginBottom="3dp"
|
android:layout_marginBottom="3dp"
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
android:gravity="left"
|
android:gravity="left"
|
||||||
|
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" />
|
||||||
|
|
||||||
|
@ -416,6 +418,7 @@
|
||||||
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
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||||
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="wrap_content"
|
android:layout_width="100dp"
|
||||||
android:layout_height="@dimen/route_info_settings_buttons_height"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
@ -3,44 +3,37 @@
|
||||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||||
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="wrap_content"
|
android:layout_width="100dp"
|
||||||
android:layout_height="@dimen/route_info_settings_buttons_height"
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="horizontal"
|
||||||
tools:background="@drawable/btn_border_trans_dark">
|
tools:background="@drawable/btn_border_trans_dark">
|
||||||
|
|
||||||
<View
|
|
||||||
android:id="@+id/options_divider_start"
|
|
||||||
android:layout_width="1dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_marginBottom="@dimen/list_item_button_padding"
|
|
||||||
android:layout_marginTop="@dimen/list_item_button_padding"
|
|
||||||
android:visibility="gone"/>
|
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:id="@+id/removable_option"
|
android:id="@+id/removable_option"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:visibility="visible">
|
android:visibility="visible">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/route_removable_option_container"
|
android:id="@+id/route_removable_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|center_vertical">
|
||||||
|
|
||||||
<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="wrap_content"
|
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"
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:paddingBottom="3dp"
|
android:paddingBottom="3dp"
|
||||||
android:paddingEnd="4dp"
|
|
||||||
android:paddingLeft="3dp"
|
|
||||||
android:paddingRight="4dp"
|
|
||||||
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/text_button_text_size"
|
||||||
|
@ -55,8 +48,10 @@
|
||||||
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_marginLeft="2dp"
|
android:layout_marginEnd="4dp"
|
||||||
android:layout_marginRight="2dp"
|
android:layout_marginLeft="3dp"
|
||||||
|
android:layout_marginRight="4dp"
|
||||||
|
android:layout_marginStart="3dp"
|
||||||
android:background="@color/recording_color" />
|
android:background="@color/recording_color" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
@ -64,19 +59,22 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="end|center_vertical"
|
android:layout_gravity="end|center_vertical"
|
||||||
|
android:layout_marginLeft="1dp"
|
||||||
|
android:layout_marginRight="1dp"
|
||||||
android:paddingBottom="3dp"
|
android:paddingBottom="3dp"
|
||||||
android:paddingLeft="@dimen/route_info_icon_vertical_padding"
|
android:paddingLeft="@dimen/route_info_icon_vertical_padding"
|
||||||
android:paddingRight="@dimen/route_info_icon_vertical_padding"
|
android:paddingRight="@dimen/route_info_icon_vertical_padding"
|
||||||
android:paddingTop="3dp"
|
android:paddingTop="3dp"
|
||||||
tools:src="@drawable/ic_action_remove_dark" />
|
tools:src="@drawable/ic_action_remove_dark" />
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:id="@+id/options_divider_end"
|
||||||
|
android:layout_width="1dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:layout_gravity="end"
|
||||||
|
android:layout_marginBottom="@dimen/list_item_button_padding"
|
||||||
|
android:layout_marginTop="@dimen/list_item_button_padding" />
|
||||||
|
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
<View
|
|
||||||
android:id="@+id/options_divider_end"
|
|
||||||
android:layout_width="1dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_marginBottom="@dimen/list_item_button_padding"
|
|
||||||
android:layout_marginTop="@dimen/list_item_button_padding" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -40,6 +40,7 @@ import android.view.Gravity;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewParent;
|
import android.view.ViewParent;
|
||||||
import android.view.inputmethod.InputMethodManager;
|
import android.view.inputmethod.InputMethodManager;
|
||||||
|
import android.widget.FrameLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
|
@ -310,6 +311,15 @@ public class AndroidUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void setForeground(Context ctx, View view, boolean night, int lightResId, int darkResId) {
|
||||||
|
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.M) {
|
||||||
|
view.setForeground(ctx.getResources().getDrawable(night ? darkResId : lightResId,
|
||||||
|
ctx.getTheme()));
|
||||||
|
} else if (view instanceof FrameLayout) {
|
||||||
|
((FrameLayout) view).setForeground(ctx.getResources().getDrawable(night ? darkResId : lightResId));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static void setDashButtonBackground(Context ctx, View view, boolean night) {
|
public static void setDashButtonBackground(Context ctx, View view, boolean night) {
|
||||||
setBackground(ctx, view, night, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
setBackground(ctx, view, night, R.drawable.dashboard_button_light, R.drawable.dashboard_button_dark);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import android.graphics.PointF;
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
|
import android.support.annotation.DrawableRes;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
@ -28,7 +29,6 @@ import android.widget.LinearLayout;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
import android.widget.Spinner;
|
import android.widget.Spinner;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
|
||||||
|
|
||||||
import com.github.mikephil.charting.charts.LineChart;
|
import com.github.mikephil.charting.charts.LineChart;
|
||||||
import com.github.mikephil.charting.data.LineData;
|
import com.github.mikephil.charting.data.LineData;
|
||||||
|
@ -60,14 +60,15 @@ import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.SettingsBaseActivity;
|
import net.osmand.plus.activities.SettingsBaseActivity;
|
||||||
import net.osmand.plus.activities.ShowRouteInfoDialogFragment;
|
import net.osmand.plus.activities.ShowRouteInfoDialogFragment;
|
||||||
import net.osmand.plus.activities.actions.AppModeDialog;
|
import net.osmand.plus.activities.actions.AppModeDialog;
|
||||||
import net.osmand.plus.dashboard.DashboardOnMap;
|
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
import net.osmand.plus.helpers.AvoidSpecificRoads;
|
import net.osmand.plus.helpers.AvoidSpecificRoads;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper;
|
import net.osmand.plus.helpers.GpxUiHelper;
|
||||||
import net.osmand.plus.helpers.MapMarkerDialogHelper;
|
import net.osmand.plus.helpers.MapMarkerDialogHelper;
|
||||||
|
import net.osmand.plus.helpers.WaypointHelper;
|
||||||
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
||||||
import net.osmand.plus.mapcontextmenu.other.FavouritesBottomSheetMenuFragment;
|
import net.osmand.plus.mapcontextmenu.other.FavouritesBottomSheetMenuFragment;
|
||||||
import net.osmand.plus.mapmarkers.MapMarkerSelectionFragment;
|
import net.osmand.plus.mapmarkers.MapMarkerSelectionFragment;
|
||||||
|
import net.osmand.plus.poi.PoiUIFilter;
|
||||||
import net.osmand.plus.routing.RouteDirectionInfo;
|
import net.osmand.plus.routing.RouteDirectionInfo;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.routing.RoutingHelper.IRouteInformationListener;
|
import net.osmand.plus.routing.RoutingHelper.IRouteInformationListener;
|
||||||
|
@ -477,7 +478,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
gpx = GPXUtilities.makeGpxFromRoute(routingHelper.getRoute());
|
gpx = GPXUtilities.makeGpxFromRoute(routingHelper.getRoute());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateOptionsButtons(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();
|
||||||
|
|
||||||
|
@ -531,6 +532,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
scrollView.setHorizontalScrollBarEnabled(false);
|
scrollView.setHorizontalScrollBarEnabled(false);
|
||||||
|
|
||||||
final ApplicationMode applicationMode = routingHelper.getAppMode();
|
final ApplicationMode applicationMode = routingHelper.getAppMode();
|
||||||
|
int margin = app.getResources().getDimensionPixelSize(R.dimen.text_margin_small);
|
||||||
|
|
||||||
final RoutingOptionsHelper.RouteMenuAppModes mode = routingOptionsHelper.modes.get(applicationMode);
|
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);
|
||||||
|
@ -538,82 +540,102 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
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 newLp = new LinearLayout.LayoutParams(AndroidUtils.dpToPx(app, 100), ViewGroup.LayoutParams.MATCH_PARENT);
|
||||||
|
|
||||||
|
lp.setMargins(margin, 0, margin, 0);
|
||||||
|
|
||||||
for (final RoutingOptionsHelper.LocalRoutingParameter parameter : mode.parameters) {
|
for (final RoutingOptionsHelper.LocalRoutingParameter parameter : mode.parameters) {
|
||||||
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 ImageView imageView = (ImageView) item.findViewById(R.id.route_option_image_view);
|
|
||||||
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, app.getResources().getDimensionPixelSize(R.dimen.route_info_settings_buttons_height));
|
|
||||||
int margin = app.getResources().getDimensionPixelSize(R.dimen.text_margin_small);
|
|
||||||
lp.setMargins(margin, 0, margin, 0);
|
|
||||||
|
|
||||||
AndroidUtils.setBackground(app, item, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
|
|
||||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
|
||||||
AndroidUtils.setBackground(app, item.findViewById(R.id.route_option_container), nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (parameter instanceof RoutingOptionsHelper.MuteSoundRoutingParameter) {
|
if (parameter instanceof RoutingOptionsHelper.MuteSoundRoutingParameter) {
|
||||||
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);
|
String text = null;
|
||||||
final 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);
|
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)));
|
||||||
if (Build.VERSION.SDK_INT >= 21) {
|
|
||||||
itemDrawable = AndroidUtils.createPressedStateListDrawable(itemDrawable, activeItemDrawable);
|
|
||||||
}
|
}
|
||||||
imageView.setImageDrawable(app.getRoutingHelper().getVoiceRouter().isMute() ? itemDrawable : activeItemDrawable);
|
View item = createToolbarOptionView(!app.getRoutingHelper().getVoiceRouter().isMute(), text, R.drawable.ic_action_volume_up, new View.OnClickListener() {
|
||||||
|
|
||||||
if (mode.parameters.size() > 2) {
|
|
||||||
textView.setVisibility(View.GONE);
|
|
||||||
} else {
|
|
||||||
textView.setVisibility(View.VISIBLE);
|
|
||||||
textView.setTextColor(app.getRoutingHelper().getVoiceRouter().isMute() ? colorDisabled : colorActive);
|
|
||||||
String text = app.getString(R.string.sound_is, (app.getText(app.getRoutingHelper().getVoiceRouter().isMute() ? R.string.shared_string_off : R.string.shared_string_on)));
|
|
||||||
textView.setText(text);
|
|
||||||
}
|
|
||||||
item.setOnClickListener(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);
|
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);
|
||||||
|
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);
|
||||||
if (Build.VERSION.SDK_INT >= 21) {
|
if (Build.VERSION.SDK_INT >= 21) {
|
||||||
itemDrawable = AndroidUtils.createPressedStateListDrawable(itemDrawable, activeItemDrawable);
|
itemDrawable = AndroidUtils.createPressedStateListDrawable(itemDrawable, activeItemDrawable);
|
||||||
}
|
}
|
||||||
imageView.setImageDrawable(app.getRoutingHelper().getVoiceRouter().isMute() ? 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() ? R.string.shared_string_off : R.string.shared_string_on)));
|
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)));
|
||||||
textView.setText(text);
|
((TextView) v.findViewById(R.id.route_option_title)).setText(text);
|
||||||
textView.setTextColor(app.getRoutingHelper().getVoiceRouter().isMute() && mode.parameters.size() <= 2 ? colorDisabled : colorActive);
|
((TextView) v.findViewById(R.id.route_option_title)).setTextColor(app.getRoutingHelper().getVoiceRouter().isMute() && mode.parameters.size() <= 2 ? colorDisabled : colorActive);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
optionsContainer.addView(item, lp);
|
if (mode.parameters.size() > 2) {
|
||||||
|
optionsContainer.addView(item, lp);
|
||||||
} else if (parameter instanceof RoutingOptionsHelper.ShowAlongTheRouteItem) {
|
} else {
|
||||||
Drawable itemDrawable = app.getUIUtilities().getIcon(R.drawable.ic_action_snap_to_road, nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light);
|
optionsContainer.addView(item, newLp);
|
||||||
if (Build.VERSION.SDK_INT >= 21) {
|
|
||||||
Drawable activeItemDrawable = app.getUIUtilities().getIcon(R.drawable.ic_action_snap_to_road, nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
|
||||||
itemDrawable = AndroidUtils.createPressedStateListDrawable(itemDrawable, activeItemDrawable);
|
|
||||||
}
|
}
|
||||||
imageView.setImageDrawable(itemDrawable);
|
} else if (parameter instanceof RoutingOptionsHelper.ShowAlongTheRouteItem) {
|
||||||
textView.setText(R.string.show_along_the_route);
|
final Set<PoiUIFilter> poiFilters = app.getPoiFilters().getSelectedPoiFilters();
|
||||||
item.setOnClickListener(new View.OnClickListener() {
|
final boolean traffic = app.getSettings().SHOW_TRAFFIC_WARNINGS.getModeValue(applicationMode);
|
||||||
@Override
|
final boolean fav = app.getSettings().SHOW_NEARBY_FAVORITES.getModeValue(applicationMode);
|
||||||
public void onClick(View v) {
|
if (!poiFilters.isEmpty()) {
|
||||||
Toast.makeText(app, app.getText(R.string.show_along_the_route), Toast.LENGTH_LONG).show();
|
final LinearLayout item = createToolbarOptionView(false, null, -1, null);
|
||||||
|
item.findViewById(R.id.route_option_container).setVisibility(View.GONE);
|
||||||
|
Iterator<PoiUIFilter> it = poiFilters.iterator();
|
||||||
|
while (it.hasNext()) {
|
||||||
|
final PoiUIFilter poiUIFilter = it.next();
|
||||||
|
final LinearLayout container = createToolbarSubOptionView(true, poiUIFilter.getName(), R.drawable.ic_action_remove_dark, !it.hasNext(), new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
app.getPoiFilters().removeSelectedPoiFilter(poiUIFilter);
|
||||||
|
if (!app.getPoiFilters().isShowingAnyPoi()) {
|
||||||
|
mode.parameters.remove(parameter);
|
||||||
|
}
|
||||||
|
mapActivity.getMapView().refreshMap();
|
||||||
|
updateOptionsButtons(mainView);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
item.addView(container, newLp);
|
||||||
}
|
}
|
||||||
});
|
optionsContainer.addView(item, lp);
|
||||||
optionsContainer.addView(item, lp);
|
}
|
||||||
|
if (traffic) {
|
||||||
|
final LinearLayout item = createToolbarOptionView(false, null, -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);
|
||||||
|
final LinearLayout container = createToolbarSubOptionView(true, app.getString(R.string.way_alarms), R.drawable.ic_action_remove_dark, true, new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
app.getWaypointHelper().enableWaypointType(WaypointHelper.ALARMS, false);
|
||||||
|
updateOptionsButtons(mainView);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
item.addView(container,newLp);
|
||||||
|
optionsContainer.addView(item, lp);
|
||||||
|
}
|
||||||
|
if (fav) {
|
||||||
|
final LinearLayout item = createToolbarOptionView(false, null, -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);
|
||||||
|
final LinearLayout container = createToolbarSubOptionView(true, app.getString(R.string.favourites), R.drawable.ic_action_remove_dark, true, new View.OnClickListener() {
|
||||||
|
@Override
|
||||||
|
public void onClick(View v) {
|
||||||
|
app.getWaypointHelper().enableWaypointType(WaypointHelper.FAVORITES, false);
|
||||||
|
updateOptionsButtons(mainView);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
item.addView(container,newLp);
|
||||||
|
optionsContainer.addView(item, lp);
|
||||||
|
}
|
||||||
} else if (parameter instanceof RoutingOptionsHelper.AvoidRoadsTypesRoutingParameter) {
|
} else if (parameter instanceof RoutingOptionsHelper.AvoidRoadsTypesRoutingParameter) {
|
||||||
|
final LinearLayout item = createToolbarOptionView(false, null, -1, null);
|
||||||
|
item.findViewById(R.id.route_option_container).setVisibility(View.GONE);
|
||||||
|
|
||||||
List<GeneralRouter.RoutingParameter> avoidParameters = routingOptionsHelper.getAvoidRoutingPrefsForAppMode(applicationMode);
|
List<GeneralRouter.RoutingParameter> avoidParameters = routingOptionsHelper.getAvoidRoutingPrefsForAppMode(applicationMode);
|
||||||
List<GeneralRouter.RoutingParameter> avoidedParameters = new ArrayList<GeneralRouter.RoutingParameter>();
|
final List<GeneralRouter.RoutingParameter> avoidedParameters = new ArrayList<GeneralRouter.RoutingParameter>();
|
||||||
|
|
||||||
String[] propertyNames = new String[avoidParameters.size()];
|
|
||||||
for (int i = 0; i < avoidParameters.size(); i++) {
|
for (int i = 0; i < avoidParameters.size(); i++) {
|
||||||
GeneralRouter.RoutingParameter p = avoidParameters.get(i);
|
GeneralRouter.RoutingParameter p = avoidParameters.get(i);
|
||||||
propertyNames[i] = SettingsBaseActivity.getRoutingStringPropertyName(app, p.getId(), p.getName());
|
|
||||||
OsmandSettings.CommonPreference<Boolean> preference = settings.getCustomRoutingBooleanProperty(p.getId(), p.getDefaultBoolean());
|
OsmandSettings.CommonPreference<Boolean> preference = settings.getCustomRoutingBooleanProperty(p.getId(), p.getDefaultBoolean());
|
||||||
if (preference != null && preference.get()) {
|
if (preference != null && preference.get()) {
|
||||||
avoidedParameters.add(p);
|
avoidedParameters.add(p);
|
||||||
|
@ -622,170 +644,71 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
if (avoidedParameters.isEmpty()) {
|
if (avoidedParameters.isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
for (int i = 0; i < avoidedParameters.size(); i++) {
|
||||||
Drawable itemDrawable = app.getUIUtilities().getIcon(R.drawable.ic_action_road_works_dark, nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light);
|
final GeneralRouter.RoutingParameter routingParameter = avoidedParameters.get(i);
|
||||||
if (Build.VERSION.SDK_INT >= 21) {
|
final LinearLayout container = createToolbarSubOptionView(false, SettingsBaseActivity.getRoutingStringPropertyName(app, routingParameter.getId(), routingParameter.getName()), R.drawable.ic_action_remove_dark, i == avoidedParameters.size() - 1, new View.OnClickListener() {
|
||||||
Drawable activeItemDrawable = app.getUIUtilities().getIcon(R.drawable.ic_action_road_works_dark, nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
|
||||||
itemDrawable = AndroidUtils.createPressedStateListDrawable(itemDrawable, activeItemDrawable);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (avoidedParameters.size() > 2) {
|
|
||||||
imageView.setImageDrawable(itemDrawable);
|
|
||||||
textView.setText(R.string.impassable_road);
|
|
||||||
|
|
||||||
item.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
routingOptionsHelper.addNewRouteMenuParameter(applicationMode, parameter);
|
OsmandSettings.CommonPreference<Boolean> preference = settings.getCustomRoutingBooleanProperty(routingParameter.getId(), routingParameter.getDefaultBoolean());
|
||||||
List<GeneralRouter.RoutingParameter> avoidParameters = routingOptionsHelper.getAvoidRoutingPrefsForAppMode(applicationMode);
|
preference.set(false);
|
||||||
String[] vals = new String[avoidParameters.size()];
|
avoidedParameters.remove(routingParameter);
|
||||||
OsmandSettings.OsmandPreference[] bls = new OsmandSettings.OsmandPreference[avoidParameters.size()];
|
if (avoidedParameters.isEmpty()) {
|
||||||
for (int i = 0; i < avoidParameters.size(); i++) {
|
mode.parameters.remove(parameter);
|
||||||
GeneralRouter.RoutingParameter p = avoidParameters.get(i);
|
|
||||||
vals[i] = SettingsBaseActivity.getRoutingStringPropertyName(app, p.getId(), p.getName());
|
|
||||||
bls[i] = settings.getCustomRoutingBooleanProperty(p.getId(), p.getDefaultBoolean());
|
|
||||||
}
|
}
|
||||||
RouteOptionsBottomSheet.showBooleanSettings(vals, bls, app.getString(R.string.impassable_road), mapActivity);
|
if (mode.parameters.size() > 2) {
|
||||||
}
|
item.removeView(v);
|
||||||
});
|
} else {
|
||||||
} else {
|
|
||||||
item.findViewById(R.id.route_option_container).setVisibility(View.GONE);
|
|
||||||
for (int i = 0; i < avoidedParameters.size(); i++) {
|
|
||||||
final GeneralRouter.RoutingParameter routingParameter = avoidedParameters.get(i);
|
|
||||||
final LinearLayout container = (LinearLayout) mapActivity.getLayoutInflater().inflate(R.layout.route_options_container, null);
|
|
||||||
final TextView routeOptionTV = (TextView) container.findViewById(R.id.route_removable_option_title);
|
|
||||||
final ImageView routeOptionImageView = (ImageView) container.findViewById(R.id.removable_option_icon);
|
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
|
||||||
AndroidUtils.setBackground(app, container, nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
|
|
||||||
} else {
|
|
||||||
AndroidUtils.setBackground(app, container, nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i == avoidedParameters.size() - 1) {
|
|
||||||
container.findViewById(R.id.options_divider_end).setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
AndroidUtils.setBackground(app, container.findViewById(R.id.options_divider_end), nightMode,
|
|
||||||
R.color.divider_light, R.color.divider_dark);
|
|
||||||
AndroidUtils.setBackground(app, container.findViewById(R.id.options_divider_start), nightMode,
|
|
||||||
R.color.divider_light, R.color.divider_dark);
|
|
||||||
|
|
||||||
Drawable active = app.getUIUtilities().getIcon(R.drawable.ic_action_remove_dark, nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
|
||||||
routeOptionImageView.setImageDrawable(active);
|
|
||||||
|
|
||||||
AndroidUtils.setBackground(app, routeOptionImageView, nightMode, R.drawable.route_info_trans_gradient_light, R.drawable.route_info_trans_gradient_dark);
|
|
||||||
routeOptionTV.setText(SettingsBaseActivity.getRoutingStringPropertyName(app, routingParameter.getId(), routingParameter.getName()));
|
|
||||||
|
|
||||||
container.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
OsmandSettings.CommonPreference<Boolean> preference = settings.getCustomRoutingBooleanProperty(routingParameter.getId(), routingParameter.getDefaultBoolean());
|
|
||||||
preference.set(false);
|
|
||||||
Toast.makeText(app, SettingsBaseActivity.getRoutingStringPropertyName(app, routingParameter.getId(), routingParameter.getName()), Toast.LENGTH_LONG).show();
|
|
||||||
updateOptionsButtons(mainView);
|
updateOptionsButtons(mainView);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
item.addView(container);
|
});
|
||||||
}
|
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);
|
||||||
|
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();
|
||||||
|
|
||||||
if (impassableRoads.isEmpty()) {
|
if (impassableRoads.isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Iterator<RouteDataObject> it = impassableRoads.values().iterator();
|
||||||
Drawable itemDrawable = app.getUIUtilities().getIcon(R.drawable.ic_action_road_works_dark, nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light);
|
while (it.hasNext()) {
|
||||||
if (Build.VERSION.SDK_INT >= 21) {
|
final RouteDataObject routeDataObject = it.next();
|
||||||
Drawable activeItemDrawable = app.getUIUtilities().getIcon(R.drawable.ic_action_road_works_dark, nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
final LinearLayout container = createToolbarSubOptionView(false, getText(routeDataObject), R.drawable.ic_action_remove_dark, !it.hasNext(), new View.OnClickListener() {
|
||||||
itemDrawable = AndroidUtils.createPressedStateListDrawable(itemDrawable, activeItemDrawable);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (impassableRoads.size() > 2) {
|
|
||||||
|
|
||||||
imageView.setImageDrawable(itemDrawable);
|
|
||||||
textView.setText(R.string.impassable_road);
|
|
||||||
item.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
mapActivity.getDashboard().setDashboardVisibility(false, DashboardOnMap.DashboardType.ROUTE_PREFERENCES);
|
app.getAvoidSpecificRoads().removeImpassableRoad(routeDataObject);
|
||||||
mapActivity.getMapLayers().getMapControlsLayer().getMapRouteInfoMenu().hide();
|
if (routingHelper.isRouteCalculated() || routingHelper.isRouteBeingCalculated()) {
|
||||||
app.getAvoidSpecificRoads().showDialog(mapActivity);
|
routingHelper.recalculateRouteDueToSettingsChange();
|
||||||
}
|
}
|
||||||
});
|
if (app.getAvoidSpecificRoads().getImpassableRoads().isEmpty()) {
|
||||||
|
mode.parameters.remove(parameter);
|
||||||
imageView.setImageDrawable(itemDrawable);
|
}
|
||||||
textView.setText(R.string.impassable_road);
|
mapActivity.getMapView().refreshMap();
|
||||||
} else {
|
if (mode.parameters.size() > 2) {
|
||||||
item.findViewById(R.id.route_option_container).setVisibility(View.GONE);
|
item.removeView(v);
|
||||||
Iterator<Map.Entry<LatLon, RouteDataObject>> it = impassableRoads.entrySet().iterator();
|
} else {
|
||||||
while (it.hasNext()) {
|
|
||||||
Map.Entry<LatLon, RouteDataObject> pair = it.next();
|
|
||||||
|
|
||||||
final LatLon latLon = pair.getKey();
|
|
||||||
final RouteDataObject routeDataObject = pair.getValue();
|
|
||||||
final LinearLayout container = (LinearLayout) mapActivity.getLayoutInflater().inflate(R.layout.route_options_container, null);
|
|
||||||
final TextView routeOptionTV = (TextView) container.findViewById(R.id.route_removable_option_title);
|
|
||||||
final ImageView routeOptionImageView = (ImageView) container.findViewById(R.id.removable_option_icon);
|
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
|
||||||
AndroidUtils.setBackground(app, container, nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
|
|
||||||
} else {
|
|
||||||
AndroidUtils.setBackground(app, container, nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!it.hasNext()) {
|
|
||||||
container.findViewById(R.id.options_divider_end).setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
AndroidUtils.setBackground(app, container.findViewById(R.id.options_divider_end), nightMode,
|
|
||||||
R.color.divider_light, R.color.divider_dark);
|
|
||||||
AndroidUtils.setBackground(app, container.findViewById(R.id.options_divider_start), nightMode,
|
|
||||||
R.color.divider_light, R.color.divider_dark);
|
|
||||||
|
|
||||||
Drawable active = app.getUIUtilities().getIcon(R.drawable.ic_action_remove_dark, nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
|
||||||
routeOptionImageView.setImageDrawable(active);
|
|
||||||
|
|
||||||
AndroidUtils.setBackground(app, routeOptionImageView, nightMode, R.drawable.route_info_trans_gradient_light, R.drawable.route_info_trans_gradient_dark);
|
|
||||||
routeOptionTV.setText(getText(routeDataObject));
|
|
||||||
|
|
||||||
container.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
app.getAvoidSpecificRoads().removeImpassableRoad(routeDataObject);
|
|
||||||
Toast.makeText(app, getText(routeDataObject), Toast.LENGTH_LONG).show();
|
|
||||||
updateOptionsButtons(mainView);
|
updateOptionsButtons(mainView);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
item.addView(container);
|
});
|
||||||
}
|
item.addView(container,newLp);
|
||||||
}
|
}
|
||||||
optionsContainer.addView(item, lp);
|
optionsContainer.addView(item, lp);
|
||||||
} else if (parameter instanceof RoutingOptionsHelper.LocalRoutingParameterGroup) {
|
} else if (parameter instanceof RoutingOptionsHelper.LocalRoutingParameterGroup) {
|
||||||
|
String text = null;
|
||||||
Drawable itemDrawable = app.getUIUtilities().getIcon(R.drawable.mx_amenity_fuel, nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light);
|
|
||||||
if (Build.VERSION.SDK_INT >= 21) {
|
|
||||||
Drawable activeItemDrawable = app.getUIUtilities().getIcon(R.drawable.mx_amenity_fuel, nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
|
||||||
itemDrawable = AndroidUtils.createPressedStateListDrawable(itemDrawable, activeItemDrawable);
|
|
||||||
}
|
|
||||||
|
|
||||||
imageView.setImageDrawable(itemDrawable);
|
|
||||||
RoutingOptionsHelper.LocalRoutingParameter selected = ((RoutingOptionsHelper.LocalRoutingParameterGroup) parameter).getSelected(settings);
|
RoutingOptionsHelper.LocalRoutingParameter selected = ((RoutingOptionsHelper.LocalRoutingParameterGroup) parameter).getSelected(settings);
|
||||||
if (selected != null) {
|
if (selected != null) {
|
||||||
textView.setText(((RoutingOptionsHelper.LocalRoutingParameterGroup) parameter).getText(mapActivity));
|
text = ((RoutingOptionsHelper.LocalRoutingParameterGroup) parameter).getText(mapActivity);
|
||||||
}
|
}
|
||||||
|
View item = createToolbarOptionView(false, text, R.drawable.mx_amenity_fuel, new View.OnClickListener() {
|
||||||
item.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
routingOptionsHelper.showDialog((RoutingOptionsHelper.LocalRoutingParameterGroup) parameter, mapActivity, new RoutingOptionsHelper.OnClickListener() {
|
routingOptionsHelper.showLocalRoutingParameterGroupDialog((RoutingOptionsHelper.LocalRoutingParameterGroup) parameter, mapActivity, new RoutingOptionsHelper.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(String text) {
|
public void onClick() {
|
||||||
Toast.makeText(app, text, Toast.LENGTH_LONG).show();
|
|
||||||
updateOptionsButtons(mainView);
|
updateOptionsButtons(mainView);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -793,39 +716,106 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
});
|
});
|
||||||
optionsContainer.addView(item, lp);
|
optionsContainer.addView(item, lp);
|
||||||
} else {
|
} else {
|
||||||
|
String text;
|
||||||
|
boolean active;
|
||||||
if (parameter.routingParameter != null) {
|
if (parameter.routingParameter != null) {
|
||||||
boolean checked;
|
|
||||||
if (parameter.routingParameter.getId().equals("short_way")) {
|
if (parameter.routingParameter.getId().equals("short_way")) {
|
||||||
// if short route settings - it should be inverse of fast_route_mode
|
// if short route settings - it should be inverse of fast_route_mode
|
||||||
checked = !settings.FAST_ROUTE_MODE.getModeValue(routingHelper.getAppMode());
|
active = !settings.FAST_ROUTE_MODE.getModeValue(routingHelper.getAppMode());
|
||||||
} else {
|
} else {
|
||||||
checked = parameter.isSelected(settings);
|
active = parameter.isSelected(settings);
|
||||||
}
|
}
|
||||||
textView.setTextColor(checked ? colorActive : colorDisabled);
|
text = parameter.getText(mapActivity);
|
||||||
textView.setText(parameter.getText(mapActivity));
|
View item = createToolbarOptionView(active, text, R.drawable.mx_amenity_fuel, new View.OnClickListener() {
|
||||||
}
|
@Override
|
||||||
Drawable itemDrawable = app.getUIUtilities().getIcon(R.drawable.mx_amenity_fuel, nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light);
|
public void onClick(View v) {
|
||||||
if (Build.VERSION.SDK_INT >= 21) {
|
if (parameter.routingParameter != null) {
|
||||||
Drawable activeItemDrawable = app.getUIUtilities().getIcon(R.drawable.mx_amenity_fuel, nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
boolean selected = parameter.isSelected(settings);
|
||||||
itemDrawable = AndroidUtils.createPressedStateListDrawable(itemDrawable, activeItemDrawable);
|
routingOptionsHelper.applyRoutingParameter(parameter, !selected);
|
||||||
}
|
((TextView) v.findViewById(R.id.route_option_title)).setTextColor(parameter.isSelected(settings) ? colorActive : colorDisabled);
|
||||||
imageView.setImageDrawable(itemDrawable);
|
}
|
||||||
item.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
if (parameter.routingParameter != null) {
|
|
||||||
boolean selected = parameter.isSelected(settings);
|
|
||||||
routingOptionsHelper.applyRoutingParameter(parameter, !selected);
|
|
||||||
textView.setTextColor(parameter.isSelected(settings) ? colorActive : colorDisabled);
|
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
LinearLayout.LayoutParams newLp2 = new LinearLayout.LayoutParams(AndroidUtils.dpToPx(app, 100), ViewGroup.LayoutParams.MATCH_PARENT);
|
||||||
optionsContainer.addView(item, lp);
|
newLp2.setMargins(margin, 0, margin, 0);
|
||||||
|
optionsContainer.addView(item, newLp2);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
optionsContainer.setPadding(optionsContainer.getPaddingLeft(), optionsContainer.getPaddingTop(), options.getWidth(), optionsContainer.getPaddingBottom());
|
optionsContainer.setPadding(optionsContainer.getPaddingLeft(), optionsContainer.getPaddingTop(), options.getWidth(), optionsContainer.getPaddingBottom());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private LinearLayout createToolbarOptionView(boolean active, String title, @DrawableRes int iconId, View.OnClickListener listener) {
|
||||||
|
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 ImageView imageView = (ImageView) item.findViewById(R.id.route_option_image_view);
|
||||||
|
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);
|
||||||
|
|
||||||
|
AndroidUtils.setBackground(app, item, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
|
||||||
|
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
AndroidUtils.setBackground(app, item.findViewById(R.id.route_option_container), nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
|
||||||
|
}
|
||||||
|
|
||||||
|
Drawable itemDrawable = null;
|
||||||
|
Drawable activeItemDrawable = null;
|
||||||
|
if (iconId != -1) {
|
||||||
|
itemDrawable = app.getUIUtilities().getIcon(iconId, 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);
|
||||||
|
if (Build.VERSION.SDK_INT >= 21) {
|
||||||
|
itemDrawable = AndroidUtils.createPressedStateListDrawable(itemDrawable, activeItemDrawable);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (title == null) {
|
||||||
|
textView.setVisibility(View.GONE);
|
||||||
|
if (activeItemDrawable != null) {
|
||||||
|
imageView.setImageDrawable(activeItemDrawable);
|
||||||
|
} else {
|
||||||
|
imageView.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
textView.setVisibility(View.VISIBLE);
|
||||||
|
textView.setTextColor(active ? colorActive : colorDisabled);
|
||||||
|
textView.setText(title);
|
||||||
|
if (itemDrawable != null) {
|
||||||
|
imageView.setImageDrawable(itemDrawable);
|
||||||
|
} else {
|
||||||
|
imageView.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
item.setOnClickListener(listener);
|
||||||
|
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
private LinearLayout createToolbarSubOptionView(boolean hideTextLine, String title, @DrawableRes int iconId, boolean lastItem, View.OnClickListener listener) {
|
||||||
|
final LinearLayout container = (LinearLayout) mapActivity.getLayoutInflater().inflate(R.layout.route_options_container, null);
|
||||||
|
final TextView routeOptionTV = (TextView) container.findViewById(R.id.route_removable_option_title);
|
||||||
|
final ImageView routeOptionImageView = (ImageView) container.findViewById(R.id.removable_option_icon);
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
AndroidUtils.setForeground(app, container, nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
|
||||||
|
} else {
|
||||||
|
AndroidUtils.setForeground(app, container, nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
|
||||||
|
}
|
||||||
|
AndroidUtils.setBackground(app, container.findViewById(R.id.options_divider_end), nightMode, R.color.divider_light, R.color.divider_dark);
|
||||||
|
AndroidUtils.setBackground(app, routeOptionImageView, nightMode, R.drawable.route_info_trans_gradient_light, R.drawable.route_info_trans_gradient_dark);
|
||||||
|
|
||||||
|
if (lastItem) {
|
||||||
|
container.findViewById(R.id.options_divider_end).setVisibility(View.GONE);
|
||||||
|
}else {
|
||||||
|
container.findViewById(R.id.options_divider_end).setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
|
if (hideTextLine) {
|
||||||
|
container.findViewById(R.id.title_divider).setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
routeOptionTV.setText(title);
|
||||||
|
routeOptionImageView.setImageDrawable(app.getUIUtilities().getIcon(iconId, nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light));
|
||||||
|
container.setOnClickListener(listener);
|
||||||
|
|
||||||
|
return container;
|
||||||
|
}
|
||||||
|
|
||||||
private String getText(@Nullable RouteDataObject obj) {
|
private String getText(@Nullable RouteDataObject obj) {
|
||||||
if (obj != null) {
|
if (obj != null) {
|
||||||
String locale = app.getSettings().MAP_PREFERRED_LOCALE.get();
|
String locale = app.getSettings().MAP_PREFERRED_LOCALE.get();
|
||||||
|
|
|
@ -3,13 +3,9 @@ package net.osmand.plus.routepreparationmenu;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
import android.util.TypedValue;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.ArrayAdapter;
|
|
||||||
import android.widget.ImageView;
|
import android.widget.ImageView;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
@ -17,8 +13,6 @@ import android.widget.Toast;
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.CallbackWithObject;
|
import net.osmand.CallbackWithObject;
|
||||||
import net.osmand.plus.ApplicationMode;
|
import net.osmand.plus.ApplicationMode;
|
||||||
import net.osmand.plus.ContextMenuAdapter;
|
|
||||||
import net.osmand.plus.ContextMenuItem;
|
|
||||||
import net.osmand.plus.GPXUtilities;
|
import net.osmand.plus.GPXUtilities;
|
||||||
import net.osmand.plus.OsmAndLocationProvider;
|
import net.osmand.plus.OsmAndLocationProvider;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
@ -77,12 +71,13 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment {
|
||||||
routingHelper = app.getRoutingHelper();
|
routingHelper = app.getRoutingHelper();
|
||||||
routingOptionsHelper = app.getRoutingOptionsHelper();
|
routingOptionsHelper = app.getRoutingOptionsHelper();
|
||||||
mapActivity = getMapActivity();
|
mapActivity = getMapActivity();
|
||||||
controlsLayer = mapActivity.getMapLayers().getMapControlsLayer();
|
|
||||||
applicationMode = routingHelper.getAppMode();
|
applicationMode = routingHelper.getAppMode();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void createMenuItems(Bundle savedInstanceState) {
|
public void createMenuItems(Bundle savedInstanceState) {
|
||||||
|
controlsLayer = mapActivity.getMapLayers().getMapControlsLayer();
|
||||||
|
|
||||||
items.add(new TitleItem(app.getString(R.string.shared_string_settings), nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light));
|
items.add(new TitleItem(app.getString(R.string.shared_string_settings), nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light));
|
||||||
|
|
||||||
List<LocalRoutingParameter> list = new ArrayList<>();
|
List<LocalRoutingParameter> list = new ArrayList<>();
|
||||||
|
@ -121,7 +116,7 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment {
|
||||||
|
|
||||||
} else if (optionsItem instanceof ShowAlongTheRouteItem) {
|
} else if (optionsItem instanceof ShowAlongTheRouteItem) {
|
||||||
BaseBottomSheetItem showAlongTheRouteItem = new SimpleBottomSheetItem.Builder()
|
BaseBottomSheetItem showAlongTheRouteItem = new SimpleBottomSheetItem.Builder()
|
||||||
.setIcon(getContentIcon(R.drawable.ic_action_snap_to_road))
|
.setIcon(getContentIcon(R.drawable.ic_action_show_along_route))
|
||||||
.setTitle(getString(R.string.show_along_the_route))
|
.setTitle(getString(R.string.show_along_the_route))
|
||||||
.setLayoutId(R.layout.bottom_sheet_item_simple)
|
.setLayoutId(R.layout.bottom_sheet_item_simple)
|
||||||
.setOnClickListener(new View.OnClickListener() {
|
.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -187,7 +182,6 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment {
|
||||||
})
|
})
|
||||||
.create();
|
.create();
|
||||||
items.add(avoidRoadsRoutingParameter);
|
items.add(avoidRoadsRoutingParameter);
|
||||||
|
|
||||||
} else if (optionsItem instanceof GpxLocalRoutingParameter) {
|
} else if (optionsItem instanceof GpxLocalRoutingParameter) {
|
||||||
View v = mapActivity.getLayoutInflater().inflate(R.layout.plan_route_gpx, null);
|
View v = mapActivity.getLayoutInflater().inflate(R.layout.plan_route_gpx, null);
|
||||||
AndroidUtils.setListItemBackground(mapActivity, v, nightMode);
|
AndroidUtils.setListItemBackground(mapActivity, v, nightMode);
|
||||||
|
@ -210,7 +204,6 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment {
|
||||||
})
|
})
|
||||||
.create();
|
.create();
|
||||||
items.add(gpxLocalRoutingParameter);
|
items.add(gpxLocalRoutingParameter);
|
||||||
|
|
||||||
} else if (optionsItem instanceof OtherSettingsRoutingParameter) {
|
} else if (optionsItem instanceof OtherSettingsRoutingParameter) {
|
||||||
BaseBottomSheetItem otherSettingsRoutingParameter = new SimpleBottomSheetItem.Builder()
|
BaseBottomSheetItem otherSettingsRoutingParameter = new SimpleBottomSheetItem.Builder()
|
||||||
.setIcon(getContentIcon(R.drawable.map_action_settings))
|
.setIcon(getContentIcon(R.drawable.map_action_settings))
|
||||||
|
@ -280,7 +273,7 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment {
|
||||||
final LocalRoutingParameter parameter = (LocalRoutingParameter) optionsItem;
|
final LocalRoutingParameter parameter = (LocalRoutingParameter) optionsItem;
|
||||||
final BottomSheetItemWithCompoundButton[] item = new BottomSheetItemWithCompoundButton[1];
|
final BottomSheetItemWithCompoundButton[] item = new BottomSheetItemWithCompoundButton[1];
|
||||||
BottomSheetItemWithCompoundButton.Builder builder = new BottomSheetItemWithCompoundButton.Builder();
|
BottomSheetItemWithCompoundButton.Builder builder = new BottomSheetItemWithCompoundButton.Builder();
|
||||||
builder.setIcon(getContentIcon(R.drawable.mx_amenity_fuel));
|
builder.setIcon(getContentIcon(R.drawable.ic_action_fuel));
|
||||||
if (parameter.routingParameter != null) {
|
if (parameter.routingParameter != null) {
|
||||||
builder.setTitle(parameter.getText(mapActivity));
|
builder.setTitle(parameter.getText(mapActivity));
|
||||||
}
|
}
|
||||||
|
@ -296,73 +289,15 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
routingOptionsHelper.addNewRouteMenuParameter(applicationMode, parameter);
|
routingOptionsHelper.addNewRouteMenuParameter(applicationMode, parameter);
|
||||||
|
routingOptionsHelper.showLocalRoutingParameterGroupDialog(group, mapActivity, new RoutingOptionsHelper.OnClickListener() {
|
||||||
final ContextMenuAdapter adapter = new ContextMenuAdapter();
|
|
||||||
int i = 0;
|
|
||||||
int selectedIndex = -1;
|
|
||||||
for (LocalRoutingParameter p : group.getRoutingParameters()) {
|
|
||||||
adapter.addItem(ContextMenuItem.createBuilder(p.getText(mapActivity))
|
|
||||||
.setSelected(false).createItem());
|
|
||||||
if (p.isSelected(settings)) {
|
|
||||||
selectedIndex = i;
|
|
||||||
}
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
if (selectedIndex == -1) {
|
|
||||||
selectedIndex = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(mapActivity);
|
|
||||||
final int layout = R.layout.list_menu_item_native_singlechoice;
|
|
||||||
|
|
||||||
final ArrayAdapter<String> listAdapter = new ArrayAdapter<String>(mapActivity, layout, R.id.text1,
|
|
||||||
adapter.getItemNames()) {
|
|
||||||
@NonNull
|
|
||||||
@Override
|
@Override
|
||||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
public void onClick() {
|
||||||
// User super class to create the View
|
LocalRoutingParameter selected = group.getSelected(settings);
|
||||||
View v = convertView;
|
if (selected != null) {
|
||||||
if (v == null) {
|
item[0].setDescription(selected.getText(mapActivity));
|
||||||
v = mapActivity.getLayoutInflater().inflate(layout, null);
|
|
||||||
}
|
}
|
||||||
final ContextMenuItem item = adapter.getItem(position);
|
|
||||||
TextView tv = (TextView) v.findViewById(R.id.text1);
|
|
||||||
tv.setText(item.getTitle());
|
|
||||||
tv.setTextSize(TypedValue.COMPLEX_UNIT_SP, 16f);
|
|
||||||
|
|
||||||
return v;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
final int[] selectedPosition = {selectedIndex};
|
|
||||||
builder.setSingleChoiceItems(listAdapter, selectedIndex, new DialogInterface.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int position) {
|
|
||||||
selectedPosition[0] = position;
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
builder.setTitle(group.getText(mapActivity))
|
|
||||||
.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
|
||||||
int position = selectedPosition[0];
|
|
||||||
if (position >= 0 && position < group.getRoutingParameters().size()) {
|
|
||||||
for (int i = 0; i < group.getRoutingParameters().size(); i++) {
|
|
||||||
LocalRoutingParameter rp = group.getRoutingParameters().get(i);
|
|
||||||
rp.setSelected(settings, i == position);
|
|
||||||
}
|
|
||||||
mapActivity.getRoutingHelper().recalculateRouteDueToSettingsChange();
|
|
||||||
LocalRoutingParameter selected = group.getSelected(settings);
|
|
||||||
if (selected != null) {
|
|
||||||
item[0].setDescription(selected.getText(mapActivity));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})
|
|
||||||
.setNegativeButton(R.string.shared_string_cancel, null);
|
|
||||||
|
|
||||||
builder.create().show();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -31,7 +31,6 @@ import net.osmand.plus.dashboard.DashboardOnMap;
|
||||||
import net.osmand.plus.download.DownloadActivity;
|
import net.osmand.plus.download.DownloadActivity;
|
||||||
import net.osmand.plus.download.DownloadActivityType;
|
import net.osmand.plus.download.DownloadActivityType;
|
||||||
import net.osmand.plus.helpers.FileNameTranslationHelper;
|
import net.osmand.plus.helpers.FileNameTranslationHelper;
|
||||||
import net.osmand.plus.mapcontextmenu.TransportStopRouteAdapter;
|
|
||||||
import net.osmand.plus.routing.RouteProvider;
|
import net.osmand.plus.routing.RouteProvider;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
import net.osmand.plus.voice.JSMediaCommandPlayerImpl;
|
import net.osmand.plus.voice.JSMediaCommandPlayerImpl;
|
||||||
|
@ -277,16 +276,15 @@ public class RoutingOptionsHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface OnClickListener {
|
public interface OnClickListener {
|
||||||
void onClick(String text);
|
void onClick();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showDialog(final LocalRoutingParameterGroup group, final MapActivity mapActivity, final OnClickListener listener) {
|
public void showLocalRoutingParameterGroupDialog(final LocalRoutingParameterGroup group, final MapActivity mapActivity, final OnClickListener listener) {
|
||||||
final ContextMenuAdapter adapter = new ContextMenuAdapter();
|
final ContextMenuAdapter adapter = new ContextMenuAdapter();
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int selectedIndex = -1;
|
int selectedIndex = -1;
|
||||||
for (LocalRoutingParameter p : group.getRoutingParameters()) {
|
for (LocalRoutingParameter p : group.getRoutingParameters()) {
|
||||||
adapter.addItem(ContextMenuItem.createBuilder(p.getText(mapActivity))
|
adapter.addItem(ContextMenuItem.createBuilder(p.getText(mapActivity)).setSelected(false).createItem());
|
||||||
.setSelected(false).createItem());
|
|
||||||
if (p.isSelected(settings)) {
|
if (p.isSelected(settings)) {
|
||||||
selectedIndex = i;
|
selectedIndex = i;
|
||||||
}
|
}
|
||||||
|
@ -295,12 +293,10 @@ public class RoutingOptionsHelper {
|
||||||
if (selectedIndex == -1) {
|
if (selectedIndex == -1) {
|
||||||
selectedIndex = 0;
|
selectedIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
AlertDialog.Builder builder = new AlertDialog.Builder(mapActivity);
|
AlertDialog.Builder builder = new AlertDialog.Builder(mapActivity);
|
||||||
final int layout = R.layout.list_menu_item_native_singlechoice;
|
final int layout = R.layout.list_menu_item_native_singlechoice;
|
||||||
|
|
||||||
final ArrayAdapter<String> listAdapter = new ArrayAdapter<String>(mapActivity, layout, R.id.text1,
|
final ArrayAdapter<String> listAdapter = new ArrayAdapter<String>(mapActivity, layout, R.id.text1, adapter.getItemNames()) {
|
||||||
adapter.getItemNames()) {
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
public View getView(final int position, View convertView, ViewGroup parent) {
|
public View getView(final int position, View convertView, ViewGroup parent) {
|
||||||
|
@ -327,7 +323,6 @@ public class RoutingOptionsHelper {
|
||||||
});
|
});
|
||||||
builder.setTitle(group.getText(mapActivity))
|
builder.setTitle(group.getText(mapActivity))
|
||||||
.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
|
.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
int position = selectedPosition[0];
|
int position = selectedPosition[0];
|
||||||
|
@ -337,15 +332,13 @@ public class RoutingOptionsHelper {
|
||||||
rp.setSelected(settings, i == position);
|
rp.setSelected(settings, i == position);
|
||||||
}
|
}
|
||||||
mapActivity.getRoutingHelper().recalculateRouteDueToSettingsChange();
|
mapActivity.getRoutingHelper().recalculateRouteDueToSettingsChange();
|
||||||
LocalRoutingParameter selected = group.getSelected(settings);
|
if (listener != null) {
|
||||||
if (selected != null&&listener != null) {
|
listener.onClick();
|
||||||
listener.onClick(selected.getText(mapActivity));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNegativeButton(R.string.shared_string_cancel, null);
|
.setNegativeButton(R.string.shared_string_cancel, null);
|
||||||
|
|
||||||
builder.create().show();
|
builder.create().show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -507,6 +500,13 @@ public class RoutingOptionsHelper {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
if (routingParameter != null) {
|
||||||
|
return routingParameter.getId();
|
||||||
|
}
|
||||||
|
return KEY;
|
||||||
|
}
|
||||||
|
|
||||||
public LocalRoutingParameter(ApplicationMode am) {
|
public LocalRoutingParameter(ApplicationMode am) {
|
||||||
this.am = am;
|
this.am = am;
|
||||||
}
|
}
|
||||||
|
@ -548,6 +548,13 @@ public class RoutingOptionsHelper {
|
||||||
private String groupName;
|
private String groupName;
|
||||||
private List<LocalRoutingParameter> routingParameters = new ArrayList<>();
|
private List<LocalRoutingParameter> routingParameters = new ArrayList<>();
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
if (groupName != null) {
|
||||||
|
return groupName;
|
||||||
|
}
|
||||||
|
return KEY;
|
||||||
|
}
|
||||||
|
|
||||||
public LocalRoutingParameterGroup(ApplicationMode am, String groupName) {
|
public LocalRoutingParameterGroup(ApplicationMode am, String groupName) {
|
||||||
super(am);
|
super(am);
|
||||||
this.groupName = groupName;
|
this.groupName = groupName;
|
||||||
|
@ -596,6 +603,10 @@ public class RoutingOptionsHelper {
|
||||||
|
|
||||||
public static final String KEY = "MuteSoundRoutingParameter";
|
public static final String KEY = "MuteSoundRoutingParameter";
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return KEY;
|
||||||
|
}
|
||||||
|
|
||||||
public MuteSoundRoutingParameter() {
|
public MuteSoundRoutingParameter() {
|
||||||
super(null);
|
super(null);
|
||||||
}
|
}
|
||||||
|
@ -605,6 +616,10 @@ public class RoutingOptionsHelper {
|
||||||
|
|
||||||
public static final String KEY = "DividerItem";
|
public static final String KEY = "DividerItem";
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return KEY;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean canAddToRouteMenu() {
|
public boolean canAddToRouteMenu() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -618,6 +633,10 @@ public class RoutingOptionsHelper {
|
||||||
|
|
||||||
public static final String KEY = "RouteSimulationItem";
|
public static final String KEY = "RouteSimulationItem";
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return KEY;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean canAddToRouteMenu() {
|
public boolean canAddToRouteMenu() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -631,6 +650,10 @@ public class RoutingOptionsHelper {
|
||||||
|
|
||||||
public static final String KEY = "ShowAlongTheRouteItem";
|
public static final String KEY = "ShowAlongTheRouteItem";
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return KEY;
|
||||||
|
}
|
||||||
|
|
||||||
public ShowAlongTheRouteItem() {
|
public ShowAlongTheRouteItem() {
|
||||||
super(null);
|
super(null);
|
||||||
}
|
}
|
||||||
|
@ -640,6 +663,10 @@ public class RoutingOptionsHelper {
|
||||||
|
|
||||||
public static final String KEY = "AvoidRoadsRoutingParameter";
|
public static final String KEY = "AvoidRoadsRoutingParameter";
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return KEY;
|
||||||
|
}
|
||||||
|
|
||||||
public AvoidRoadsRoutingParameter() {
|
public AvoidRoadsRoutingParameter() {
|
||||||
super(null);
|
super(null);
|
||||||
}
|
}
|
||||||
|
@ -650,6 +677,10 @@ public class RoutingOptionsHelper {
|
||||||
|
|
||||||
public static final String KEY = "AvoidRoadsTypesRoutingParameter";
|
public static final String KEY = "AvoidRoadsTypesRoutingParameter";
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return KEY;
|
||||||
|
}
|
||||||
|
|
||||||
public AvoidRoadsTypesRoutingParameter() {
|
public AvoidRoadsTypesRoutingParameter() {
|
||||||
super(null);
|
super(null);
|
||||||
}
|
}
|
||||||
|
@ -660,6 +691,10 @@ public class RoutingOptionsHelper {
|
||||||
|
|
||||||
public static final String KEY = "GpxLocalRoutingParameter";
|
public static final String KEY = "GpxLocalRoutingParameter";
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return KEY;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean canAddToRouteMenu() {
|
public boolean canAddToRouteMenu() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -673,6 +708,10 @@ public class RoutingOptionsHelper {
|
||||||
|
|
||||||
public static final String KEY = "OtherSettingsRoutingParameter";
|
public static final String KEY = "OtherSettingsRoutingParameter";
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return KEY;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean canAddToRouteMenu() {
|
public boolean canAddToRouteMenu() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -686,6 +725,10 @@ public class RoutingOptionsHelper {
|
||||||
|
|
||||||
public static final String KEY = "OtherLocalRoutingParameter";
|
public static final String KEY = "OtherLocalRoutingParameter";
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return KEY;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean canAddToRouteMenu() {
|
public boolean canAddToRouteMenu() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -721,6 +764,10 @@ public class RoutingOptionsHelper {
|
||||||
|
|
||||||
public static final String KEY = "InterruptMusicRoutingParameter";
|
public static final String KEY = "InterruptMusicRoutingParameter";
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return KEY;
|
||||||
|
}
|
||||||
|
|
||||||
public InterruptMusicRoutingParameter() {
|
public InterruptMusicRoutingParameter() {
|
||||||
super(null);
|
super(null);
|
||||||
}
|
}
|
||||||
|
@ -730,6 +777,10 @@ public class RoutingOptionsHelper {
|
||||||
|
|
||||||
public static final String KEY = "VoiceGuidanceRoutingParameter";
|
public static final String KEY = "VoiceGuidanceRoutingParameter";
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return KEY;
|
||||||
|
}
|
||||||
|
|
||||||
public VoiceGuidanceRoutingParameter() {
|
public VoiceGuidanceRoutingParameter() {
|
||||||
super(null);
|
super(null);
|
||||||
}
|
}
|
||||||
|
@ -748,7 +799,7 @@ public class RoutingOptionsHelper {
|
||||||
|
|
||||||
public boolean containsParameter(LocalRoutingParameter parameter) {
|
public boolean containsParameter(LocalRoutingParameter parameter) {
|
||||||
for (LocalRoutingParameter p : parameters) {
|
for (LocalRoutingParameter p : parameters) {
|
||||||
if (p.getClass().equals(parameter.getClass())) {
|
if (p.getId().equals(parameter.getId())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue