Add addressLookupRequest and fix night mode colors and fix statistic legends sorting
This commit is contained in:
parent
3fe0d010f9
commit
241233315c
19 changed files with 187 additions and 271 deletions
|
@ -113,102 +113,96 @@ public class RouteStatistics {
|
|||
public abstract String getColorName(E attribute);
|
||||
}
|
||||
|
||||
private static class RouteSurfaceStatisticComputer extends RouteStatisticComputer<String> {
|
||||
private static class RouteSurfaceStatisticComputer extends RouteStatisticComputer<RoadSurface> {
|
||||
|
||||
public RouteSurfaceStatisticComputer(List<RouteSegmentResult> route) {
|
||||
super(route, StatisticType.SURFACE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAttribute(RouteSegmentResult segment) {
|
||||
public RoadSurface getAttribute(RouteSegmentResult segment) {
|
||||
String segmentSurface = segment.getSurface();
|
||||
if (segmentSurface == null) {
|
||||
return RoadSurface.UNDEFINED.name().toLowerCase();
|
||||
return RoadSurface.UNDEFINED;
|
||||
}
|
||||
for (RoadSurface roadSurface : RoadSurface.values()) {
|
||||
if (roadSurface.contains(segmentSurface)) {
|
||||
return roadSurface.name().toLowerCase();
|
||||
return roadSurface;
|
||||
}
|
||||
}
|
||||
return RoadSurface.UNDEFINED.name().toLowerCase();
|
||||
return RoadSurface.UNDEFINED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColorAttrName(String attribute) {
|
||||
RoadSurface roadSurface = RoadSurface.valueOf(attribute.toUpperCase());
|
||||
return roadSurface.getColorAttrName();
|
||||
public String getColorAttrName(RoadSurface attribute) {
|
||||
return attribute.getColorAttrName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColorName(String attribute) {
|
||||
RoadSurface roadSurface = RoadSurface.valueOf(attribute.toUpperCase());
|
||||
return roadSurface.getColorName();
|
||||
public String getColorName(RoadSurface attribute) {
|
||||
return attribute.getColorName();
|
||||
}
|
||||
}
|
||||
|
||||
private static class RouteSmoothnessStatisticComputer extends RouteStatisticComputer<String> {
|
||||
private static class RouteSmoothnessStatisticComputer extends RouteStatisticComputer<RoadSmoothness> {
|
||||
|
||||
public RouteSmoothnessStatisticComputer(List<RouteSegmentResult> route) {
|
||||
super(route, StatisticType.SMOOTHNESS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAttribute(RouteSegmentResult segment) {
|
||||
public RoadSmoothness getAttribute(RouteSegmentResult segment) {
|
||||
String segmentSmoothness = segment.getSmoothness();
|
||||
if (segmentSmoothness == null) {
|
||||
return RoadSmoothness.UNDEFINED.name().toLowerCase();
|
||||
return RoadSmoothness.UNDEFINED;
|
||||
}
|
||||
for (RoadSmoothness roadSmoothness : RoadSmoothness.values()) {
|
||||
if (roadSmoothness.contains(segmentSmoothness)) {
|
||||
return roadSmoothness.name().toLowerCase();
|
||||
return roadSmoothness;
|
||||
}
|
||||
}
|
||||
return RoadSmoothness.UNDEFINED.name().toLowerCase();
|
||||
return RoadSmoothness.UNDEFINED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColorAttrName(String attribute) {
|
||||
RoadSmoothness roadSmoothness = RoadSmoothness.valueOf(attribute.toUpperCase());
|
||||
return roadSmoothness.getColorAttrName();
|
||||
public String getColorAttrName(RoadSmoothness attribute) {
|
||||
return attribute.getColorAttrName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColorName(String attribute) {
|
||||
RoadSmoothness roadSmoothness = RoadSmoothness.valueOf(attribute.toUpperCase());
|
||||
return roadSmoothness.getColorName();
|
||||
public String getColorName(RoadSmoothness attribute) {
|
||||
return attribute.getColorName();
|
||||
}
|
||||
}
|
||||
|
||||
private static class RouteClassStatisticComputer extends RouteStatisticComputer<String> {
|
||||
private static class RouteClassStatisticComputer extends RouteStatisticComputer<RoadClass> {
|
||||
|
||||
public RouteClassStatisticComputer(List<RouteSegmentResult> route) {
|
||||
super(route, StatisticType.CLASS);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAttribute(RouteSegmentResult segment) {
|
||||
public RoadClass getAttribute(RouteSegmentResult segment) {
|
||||
String segmentClass = segment.getHighway();
|
||||
if (segmentClass == null) {
|
||||
return RoadClass.UNDEFINED.name().toLowerCase();
|
||||
return RoadClass.UNDEFINED;
|
||||
}
|
||||
for (RoadClass roadClass : RoadClass.values()) {
|
||||
if (roadClass.contains(segmentClass)) {
|
||||
return roadClass.name().toLowerCase();
|
||||
return roadClass;
|
||||
}
|
||||
}
|
||||
return RoadClass.UNDEFINED.name().toLowerCase();
|
||||
return RoadClass.UNDEFINED;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColorAttrName(String attribute) {
|
||||
RoadClass roadClass = RoadClass.valueOf(attribute.toUpperCase());
|
||||
return roadClass.getColorAttrName();
|
||||
public String getColorAttrName(RoadClass attribute) {
|
||||
return attribute.getColorAttrName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColorName(String attribute) {
|
||||
RoadClass roadClass = RoadClass.valueOf(attribute.toUpperCase());
|
||||
return roadClass.getColorName();
|
||||
public String getColorName(RoadClass attribute) {
|
||||
return attribute.getColorName();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -516,13 +510,11 @@ public class RouteStatistics {
|
|||
}
|
||||
|
||||
public enum RoadSurface {
|
||||
UNDEFINED(null, "#e8e8e8", "undefined"),
|
||||
PAVED(null, "#a7cdf8", "paved"),
|
||||
UNPAVED(null, "#cc9900", "unpaved"),
|
||||
ASPHALT(null, "#6f687e", "asphalt"),
|
||||
CONCRETE(null, "#a7cdf8", "concrete"),
|
||||
UNPAVED(null, "#cc9900", "unpaved"),
|
||||
PAVED(null, "#a7cdf8", "paved"),
|
||||
COMPACTED(null, "#cbcbe8", "compacted"),
|
||||
GRAVEL(null, "#cbcbe8", "gravel"),
|
||||
FINE_GRAVEL(null, "#cbcbe8", "fine_gravel"),
|
||||
PAVING_STONES(null, "#a7cdf8", "paving_stones"),
|
||||
SETT(null, "#a7cdf8", "sett"),
|
||||
|
@ -530,15 +522,17 @@ public class RouteStatistics {
|
|||
PEBBLESTONE("#a7cdf8", "pebblestone"),
|
||||
STONE(null, "#a7cdf8", "stone"),
|
||||
METAL(null, "#a7cdf8", "metal"),
|
||||
GROUND(null, "#cc9900", "ground", "mud"),
|
||||
WOOD(null, "#a7cdf8", "wood"),
|
||||
GRASS_PAVER(null, "#a7bef8", "grass_paver"),
|
||||
WOOD(null, "#a7cdf8", "wood"),
|
||||
GRAVEL(null, "#cbcbe8", "gravel"),
|
||||
GROUND(null, "#cc9900", "ground", "mud"),
|
||||
CLAY(null, "#cc9900", "clay"),
|
||||
GRASS(null, "#1fbe1f", "grass"),
|
||||
SAND(null, "#ffd700", "sand"),
|
||||
SALT(null, "#7eded8", "salt"),
|
||||
SNOW(null, "#9feeef", "snow"),
|
||||
ICE(null, "#9feeef", "ice"),
|
||||
CLAY(null, "#cc9900", "clay");
|
||||
UNDEFINED(null, "#e8e8e8", "undefined");
|
||||
|
||||
final Set<String> surfaces = new TreeSet<>();
|
||||
final String colorAttrName;
|
||||
|
@ -564,7 +558,6 @@ public class RouteStatistics {
|
|||
}
|
||||
|
||||
public enum RoadSmoothness {
|
||||
UNDEFINED("redColor", null, "undefined"),
|
||||
EXCELLENT("orangeColor", null, "excellent"),
|
||||
GOOD("brownColor", null, "good"),
|
||||
INTERMEDIATE("darkyellowColor", null, "intermediate"),
|
||||
|
@ -572,7 +565,8 @@ public class RouteStatistics {
|
|||
VERY_BAD("lightgreenColor", null, "very_bad"),
|
||||
HORRIBLE("greenColor", null, "horrible"),
|
||||
VERY_HORRIBLE("lightblueColor", null, "very_horrible"),
|
||||
IMPASSABLE("blueColor", null, "impassable");
|
||||
IMPASSABLE("blueColor", null, "impassable"),
|
||||
UNDEFINED("redColor", null, "undefined");
|
||||
|
||||
final Set<String> surfaces = new TreeSet<>();
|
||||
final String colorAttrName;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/bg_color"
|
||||
android:background="?attr/route_info_bg"
|
||||
android:orientation="vertical">
|
||||
|
||||
<FrameLayout
|
||||
|
@ -22,6 +22,7 @@
|
|||
android:maxLines="1"
|
||||
android:paddingLeft="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/content_padding"
|
||||
android:textColor="?android:attr/textColorPrimary"
|
||||
android:textSize="@dimen/text_button_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:ignore="UnusedAttribute"
|
||||
|
|
|
@ -4,12 +4,12 @@
|
|||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/route_info_bg"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/bg_color"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="8dp"
|
||||
|
@ -40,7 +40,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:textColor="?attr/routeParameterTitleColor"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:text="26 km" />
|
||||
|
@ -83,7 +83,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@null"
|
||||
android:textColor="?attr/routeParameterTitleColor"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:text="20 min" />
|
||||
|
@ -106,7 +106,6 @@
|
|||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/bg_color"
|
||||
android:orientation="vertical">
|
||||
|
||||
<com.github.mikephil.charting.charts.LineChart
|
||||
|
@ -120,7 +119,6 @@
|
|||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/bg_color"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal"
|
||||
android:paddingBottom="4dp">
|
||||
|
@ -216,7 +214,6 @@
|
|||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/bg_color"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="4dp"
|
||||
|
@ -257,7 +254,6 @@
|
|||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/bg_color"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal"
|
||||
android:paddingTop="4dp"
|
||||
|
|
|
@ -3,88 +3,74 @@
|
|||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
android:layout_height="48dp"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<View
|
||||
android:id="@+id/dividerControlButtons"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:focusable="false" />
|
||||
<FrameLayout
|
||||
android:id="@+id/cancel_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="48dp"
|
||||
android:baselineAligned="false"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/cancel_button"
|
||||
android:layout_width="0dp"
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/cancel_button_descr"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||
android:maxLines="1"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:text="@string/shared_string_cancel"
|
||||
android:textSize="@dimen/text_button_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:ignore="UnusedAttribute" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/cancel_button_descr"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||
android:maxLines="1"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:text="@string/shared_string_cancel"
|
||||
android:textSize="@dimen/text_button_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:ignore="UnusedAttribute" />
|
||||
</FrameLayout>
|
||||
|
||||
</FrameLayout>
|
||||
<FrameLayout
|
||||
android:id="@+id/start_button"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/start_button"
|
||||
android:layout_width="0dp"
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_bar_button"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_weight="1">
|
||||
android:layout_gravity="bottom"
|
||||
android:max="100"
|
||||
android:visibility="gone"
|
||||
tools:progress="60"
|
||||
tools:progressDrawable="?attr/size_progress_bar" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress_bar_button"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="bottom"
|
||||
android:max="100"
|
||||
android:visibility="gone"
|
||||
tools:progress="60"
|
||||
tools:progressDrawable="?attr/size_progress_bar" />
|
||||
<net.osmand.plus.widgets.ImageViewExProgress
|
||||
android:id="@+id/start_icon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="@dimen/route_info_icon_padding_left"
|
||||
android:scaleType="fitStart"
|
||||
tools:src="@drawable/ic_action_start_navigation" />
|
||||
|
||||
<net.osmand.plus.widgets.ImageViewExProgress
|
||||
android:id="@+id/start_icon"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:padding="@dimen/route_info_icon_padding_left"
|
||||
android:scaleType="fitStart"
|
||||
tools:src="@drawable/ic_action_start_navigation" />
|
||||
<net.osmand.plus.widgets.TextViewExProgress
|
||||
android:id="@+id/start_button_descr"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||
android:maxLines="1"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:text="@string/shared_string_control_start"
|
||||
android:textSize="@dimen/text_button_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:ignore="UnusedAttribute" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewExProgress
|
||||
android:id="@+id/start_button_descr"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:letterSpacing="@dimen/text_button_letter_spacing"
|
||||
android:maxLines="1"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:text="@string/shared_string_control_start"
|
||||
android:textSize="@dimen/text_button_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:ignore="UnusedAttribute" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
|
||||
</LinearLayout>
|
|
@ -11,12 +11,14 @@
|
|||
android:id="@+id/dividerToDropDown"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"
|
||||
android:focusable="false" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/RouteInfoControls"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?attr/route_info_bg"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
|
|
|
@ -20,16 +20,18 @@
|
|||
android:id="@+id/top_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:background="?attr/dashboard_divider"
|
||||
android:focusable="false" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/routes_info_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/route_info_bg"
|
||||
android:orientation="vertical"
|
||||
android:paddingLeft="@dimen/route_info_buttons_padding_top_bottom"
|
||||
android:paddingRight="@dimen/route_info_buttons_padding_top_bottom"
|
||||
android:paddingTop="@dimen/content_padding">
|
||||
android:paddingTop="@dimen/content_padding"
|
||||
android:paddingRight="@dimen/route_info_buttons_padding_top_bottom">
|
||||
|
||||
<net.osmand.plus.widgets.FlowLayout
|
||||
android:id="@+id/routes_badges"
|
||||
|
@ -49,6 +51,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="6dp"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular"
|
||||
tools:text="@string/route_from" />
|
||||
|
@ -57,6 +60,7 @@
|
|||
android:id="@+id/way_line"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textColor="?android:attr/textColorSecondary"
|
||||
android:textSize="@dimen/default_desc_text_size"
|
||||
osmand:typeface="@string/font_roboto_regular"
|
||||
tools:text="@string/route_from" />
|
||||
|
|
|
@ -64,6 +64,7 @@ import net.osmand.data.LatLon;
|
|||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.TransportRoute;
|
||||
import net.osmand.data.TransportStop;
|
||||
import net.osmand.plus.GeocodingLookupService;
|
||||
import net.osmand.plus.GpxSelectionHelper;
|
||||
import net.osmand.plus.GpxSelectionHelper.GpxDisplayGroup;
|
||||
import net.osmand.plus.LockableScrollView;
|
||||
|
@ -172,6 +173,15 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
|||
if (args != null) {
|
||||
routeId = args.getInt(ROUTE_ID_KEY);
|
||||
}
|
||||
portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
||||
topShadowMargin = AndroidUtils.dpToPx(mapActivity, 9f);
|
||||
|
||||
shadowHeight = AndroidUtils.dpToPx(mapActivity, SHADOW_HEIGHT_TOP_DP);
|
||||
topScreenPosY = addStatusBarHeightIfNeeded(-shadowHeight);
|
||||
|
||||
mainView = view.findViewById(R.id.main_view);
|
||||
nightMode = app.getDaynightHelper().isNightModeForMapControls();
|
||||
currentMenuState = getInitialMenuState();
|
||||
|
||||
Toolbar toolbar = (Toolbar) view.findViewById(R.id.toolbar);
|
||||
toolbar.setNavigationIcon(app.getUIUtilities().getThemedIcon(R.drawable.ic_arrow_back));
|
||||
|
@ -182,12 +192,11 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
|||
dismiss();
|
||||
}
|
||||
});
|
||||
toolbar.setBackgroundColor(ContextCompat.getColor(app, nightMode ? R.color.bg_color_dark : R.color.bg_color_light));
|
||||
|
||||
buildMenuButtons();
|
||||
|
||||
currentMenuState = getInitialMenuState();
|
||||
LinearLayout cardsContainer = (LinearLayout) view.findViewById(R.id.route_menu_cards_container);
|
||||
AndroidUtils.setBackground(app, cardsContainer, nightMode, R.color.route_info_bg_light, R.color.route_info_bg_dark);
|
||||
|
||||
if (routeId != -1) {
|
||||
List<TransportRoutePlanner.TransportRouteResult> routes = routingHelper.getTransportRoutingHelper().getRoutes();
|
||||
|
@ -207,16 +216,8 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
|||
}
|
||||
processScreenHeight(container);
|
||||
|
||||
portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
||||
topShadowMargin = AndroidUtils.dpToPx(mapActivity, 9f);
|
||||
|
||||
shadowHeight = AndroidUtils.dpToPx(mapActivity, SHADOW_HEIGHT_TOP_DP);
|
||||
topScreenPosY = addStatusBarHeightIfNeeded(-shadowHeight);
|
||||
minHalfY = viewHeight - (int) (viewHeight * .75f);
|
||||
|
||||
mainView = view.findViewById(R.id.main_view);
|
||||
nightMode = app.getDaynightHelper().isNightModeForMapControls();
|
||||
|
||||
// Zoom buttons
|
||||
zoomButtonsView = view.findViewById(R.id.map_hud_controls);
|
||||
ImageButton zoomInButtonView = (ImageButton) view.findViewById(R.id.map_zoom_in_button);
|
||||
|
@ -467,7 +468,7 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
|||
|
||||
private void createRouteStatisticCards(LinearLayout cardsContainer) {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if(mapActivity==null){
|
||||
if (mapActivity == null) {
|
||||
return;
|
||||
}
|
||||
if (gpx.hasAltitude) {
|
||||
|
@ -590,7 +591,7 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
|||
String timeText = OsmAndFormatter.getFormattedTime(startTime, false);
|
||||
|
||||
SpannableString secondaryText = new SpannableString(getString(R.string.sit_on_the_stop) + ":");
|
||||
secondaryText.setSpan(new ForegroundColorSpan(ContextCompat.getColor(app, R.color.primary_text_light)), 0, secondaryText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
secondaryText.setSpan(new ForegroundColorSpan(ContextCompat.getColor(app, nightMode ? R.color.primary_text_dark : R.color.primary_text_light)), 0, secondaryText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
|
||||
SpannableString title = new SpannableString(startStop.getName());
|
||||
title.setSpan(new CustomTypefaceSpan(typeface), 0, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
|
@ -604,12 +605,12 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
|||
}
|
||||
SpannableStringBuilder spannable = new SpannableStringBuilder("~");
|
||||
int startIndex = spannable.length();
|
||||
spannable.setSpan(new ForegroundColorSpan(ContextCompat.getColor(app, R.color.secondary_text_light)), 0, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
spannable.setSpan(new ForegroundColorSpan(ContextCompat.getColor(app, nightMode ? R.color.secondary_text_dark : R.color.secondary_text_light)), 0, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
spannable.append(OsmAndFormatter.getFormattedDuration(segment.getArrivalTime(), app));
|
||||
spannable.setSpan(new CustomTypefaceSpan(typeface), startIndex, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
startIndex = spannable.length();
|
||||
spannable.append(" • ");
|
||||
spannable.setSpan(new ForegroundColorSpan(ContextCompat.getColor(app, R.color.secondary_text_light)), startIndex, startIndex + 2, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
spannable.setSpan(new ForegroundColorSpan(ContextCompat.getColor(app, nightMode ? R.color.secondary_text_dark : R.color.secondary_text_light)), startIndex, startIndex + 2, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
startIndex = spannable.length();
|
||||
if (stops.size() > 2) {
|
||||
spannable.append(String.valueOf(stops.size())).append(" ").append(getString(R.string.transport_stops));
|
||||
|
@ -631,7 +632,7 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
|||
secondaryText.setSpan(new CustomTypefaceSpan(typeface), 0, secondaryText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
int spaceIndex = secondaryText.toString().indexOf(" ");
|
||||
if (spaceIndex != -1) {
|
||||
secondaryText.setSpan(new ForegroundColorSpan(ContextCompat.getColor(app, R.color.primary_text_light)), 0, spaceIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
secondaryText.setSpan(new ForegroundColorSpan(ContextCompat.getColor(app, nightMode ? R.color.primary_text_dark : R.color.primary_text_light)), 0, spaceIndex, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
}
|
||||
title = new SpannableString(endStop.getName());
|
||||
title.setSpan(new CustomTypefaceSpan(typeface), 0, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
|
@ -681,7 +682,7 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
|||
int startIndex = spannable.length();
|
||||
spannable.append(OsmAndFormatter.getFormattedDuration((int) walkTime, app)).append(" ");
|
||||
spannable.setSpan(new CustomTypefaceSpan(typeface), startIndex, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
spannable.setSpan(new ForegroundColorSpan(ContextCompat.getColor(app, R.color.primary_text_light)), startIndex, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
spannable.setSpan(new ForegroundColorSpan(ContextCompat.getColor(app, nightMode ? R.color.primary_text_dark : R.color.primary_text_light)), startIndex, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
spannable.append(getString(R.string.on_foot)).append(" ").append(", ").append(OsmAndFormatter.getFormattedDistance((float) segment.walkDist, app));
|
||||
|
||||
buildWalkRow(parent, spannable, listener, null);
|
||||
|
@ -722,12 +723,12 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
|||
Typeface typeface = FontCache.getRobotoMedium(app);
|
||||
SpannableStringBuilder title = new SpannableStringBuilder("~");
|
||||
int startIndex = title.length();
|
||||
title.setSpan(new ForegroundColorSpan(ContextCompat.getColor(app, R.color.secondary_text_light)), 0, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
title.setSpan(new ForegroundColorSpan(ContextCompat.getColor(app, nightMode ? R.color.secondary_text_dark : R.color.secondary_text_light)), 0, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
title.append(OsmAndFormatter.getFormattedDuration((int) walkTime, app)).append(" ");
|
||||
title.setSpan(new CustomTypefaceSpan(typeface), startIndex, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
startIndex = title.length();
|
||||
title.append(getString(R.string.on_foot)).append(", ").append(OsmAndFormatter.getFormattedDistance((float) finishWalkDist, app));
|
||||
title.setSpan(new ForegroundColorSpan(ContextCompat.getColor(app, R.color.secondary_text_light)), startIndex, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
title.setSpan(new ForegroundColorSpan(ContextCompat.getColor(app, nightMode ? R.color.secondary_text_dark : R.color.secondary_text_light)), startIndex, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
return title;
|
||||
}
|
||||
|
||||
|
@ -759,13 +760,13 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
|||
|
||||
long walkTime = (long) getWalkTime(segment.walkDist, walkSpeed);
|
||||
SpannableStringBuilder title = new SpannableStringBuilder(Algorithms.capitalizeFirstLetter(getString(R.string.on_foot)));
|
||||
title.setSpan(new ForegroundColorSpan(ContextCompat.getColor(app, R.color.secondary_text_light)), 0, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
title.setSpan(new ForegroundColorSpan(ContextCompat.getColor(app, nightMode ? R.color.secondary_text_dark : R.color.secondary_text_light)), 0, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
int startIndex = title.length();
|
||||
title.append(" ").append(OsmAndFormatter.getFormattedDuration((int) walkTime, app));
|
||||
title.setSpan(new CustomTypefaceSpan(FontCache.getRobotoMedium(app)), startIndex, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
startIndex = title.length();
|
||||
title.append(", ").append(OsmAndFormatter.getFormattedDistance((float) segment.walkDist, app));
|
||||
title.setSpan(new ForegroundColorSpan(ContextCompat.getColor(app, R.color.secondary_text_light)), startIndex, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
title.setSpan(new ForegroundColorSpan(ContextCompat.getColor(app, nightMode ? R.color.secondary_text_dark : R.color.secondary_text_light)), startIndex, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
|
||||
buildWalkRow(infoContainer, title, listener, imagesContainer);
|
||||
buildRowDivider(infoContainer, true);
|
||||
|
@ -797,13 +798,13 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
|||
long walkTime = (long) getWalkTime(segment.walkDist, walkSpeed);
|
||||
|
||||
SpannableStringBuilder spannable = new SpannableStringBuilder("~");
|
||||
spannable.setSpan(new ForegroundColorSpan(ContextCompat.getColor(app, R.color.secondary_text_light)), 0, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
spannable.setSpan(new ForegroundColorSpan(ContextCompat.getColor(app, nightMode ? R.color.secondary_text_dark : R.color.secondary_text_light)), 0, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
int startIndex = spannable.length();
|
||||
spannable.append(OsmAndFormatter.getFormattedDuration((int) walkTime, app)).append(" ");
|
||||
spannable.setSpan(new CustomTypefaceSpan(typeface), startIndex, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
startIndex = spannable.length();
|
||||
spannable.append(getString(R.string.on_foot)).append(", ").append(OsmAndFormatter.getFormattedDistance((float) segment.walkDist, app));
|
||||
spannable.setSpan(new ForegroundColorSpan(ContextCompat.getColor(app, R.color.secondary_text_light)), startIndex, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
spannable.setSpan(new ForegroundColorSpan(ContextCompat.getColor(app, nightMode ? R.color.secondary_text_dark : R.color.secondary_text_light)), startIndex, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
|
||||
buildWalkRow(infoContainer, spannable, listener, imagesContainer);
|
||||
buildRowDivider(infoContainer, true);
|
||||
|
@ -817,32 +818,13 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
|||
|
||||
SpannableString secondaryText = new SpannableString(getString(R.string.route_descr_destination) + ":");
|
||||
secondaryText.setSpan(new CustomTypefaceSpan(typeface), 0, secondaryText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
secondaryText.setSpan(new ForegroundColorSpan(ContextCompat.getColor(app, R.color.primary_text_light)), 0, secondaryText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
secondaryText.setSpan(new ForegroundColorSpan(ContextCompat.getColor(app, nightMode ? R.color.primary_text_dark : R.color.primary_text_light)), 0, secondaryText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||
|
||||
SpannableStringBuilder locationStr = new SpannableStringBuilder();
|
||||
String loc = getPointName(destination);
|
||||
if (!loc.equals(name)) {
|
||||
locationStr.append(loc);
|
||||
}
|
||||
buildDestinationRow(infoContainer, timeStr, title, secondaryText, locationStr, listener, imagesContainer);
|
||||
buildDestinationRow(infoContainer, timeStr, title, secondaryText, destination.point, listener, imagesContainer);
|
||||
|
||||
((ViewGroup) view).addView(baseItemView);
|
||||
}
|
||||
|
||||
private String getPointName(TargetPointsHelper.TargetPoint targetPoint) {
|
||||
String name = "";
|
||||
if (targetPoint != null) {
|
||||
PointDescription description = targetPoint.getOriginalPointDescription();
|
||||
if (description != null && !Algorithms.isEmpty(description.getName()) &&
|
||||
!description.getName().equals(getString(R.string.no_address_found))) {
|
||||
name = description.getName();
|
||||
} else {
|
||||
name = PointDescription.getLocationName(app, targetPoint.point.getLatitude(), targetPoint.point.getLongitude(), true).replace('\n', ' ');
|
||||
}
|
||||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
private int getActiveColor() {
|
||||
return ContextCompat.getColor(app, !nightMode ? R.color.ctx_menu_bottom_view_url_color_light : R.color.ctx_menu_bottom_view_url_color_dark);
|
||||
}
|
||||
|
@ -1076,6 +1058,21 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
|||
((LinearLayout) view).addView(baseItemView);
|
||||
}
|
||||
|
||||
|
||||
protected void acquireStreetName(LatLon latLon, final String currentAddress, final TextView locationTv, final LinearLayout container) {
|
||||
GeocodingLookupService.AddressLookupRequest addressLookupRequest = new GeocodingLookupService.AddressLookupRequest(latLon, new GeocodingLookupService.OnAddressLookupResult() {
|
||||
@Override
|
||||
public void geocodingDone(String address) {
|
||||
if (!TextUtils.isEmpty(address) && !address.equals(currentAddress)) {
|
||||
locationTv.setText(address);
|
||||
container.setMinimumHeight(dpToPx(80));
|
||||
}
|
||||
}
|
||||
}, null);
|
||||
|
||||
app.getGeocodingLookupService().lookupAddress(addressLookupRequest);
|
||||
}
|
||||
|
||||
public void buildWalkRow(final View view, final Spannable title, View.OnClickListener onClickListener, LinearLayout imagesContainer) {
|
||||
FrameLayout baseItemView = new FrameLayout(view.getContext());
|
||||
FrameLayout.LayoutParams baseViewLayoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
|
@ -1186,7 +1183,7 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
|||
}
|
||||
|
||||
public void buildDestinationRow(final View view, String timeText, final Spannable title, Spannable secondaryText,
|
||||
Spannable locationText, View.OnClickListener onClickListener, LinearLayout imagesContainer) {
|
||||
LatLon location, View.OnClickListener onClickListener, LinearLayout imagesContainer) {
|
||||
FrameLayout baseItemView = new FrameLayout(view.getContext());
|
||||
FrameLayout.LayoutParams baseViewLayoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
baseItemView.setLayoutParams(baseViewLayoutParams);
|
||||
|
@ -1227,8 +1224,9 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
|||
buildDescriptionView(secondaryText, llText, 8);
|
||||
buildTitleView(title, llText);
|
||||
|
||||
if (!TextUtils.isEmpty(locationText)) {
|
||||
buildDescriptionView(locationText, llText, 4);
|
||||
if (location != null) {
|
||||
TextView locDescr = (TextView) buildDescriptionView(null, llText, 4);
|
||||
acquireStreetName(location, title.toString(), locDescr, llText);
|
||||
}
|
||||
|
||||
if (!TextUtils.isEmpty(timeText)) {
|
||||
|
@ -1333,7 +1331,7 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
|||
container.addView(titleView);
|
||||
}
|
||||
|
||||
private void buildDescriptionView(Spannable description, LinearLayout container, int paddingTop) {
|
||||
private View buildDescriptionView(Spannable description, LinearLayout container, int paddingTop) {
|
||||
TextViewEx textViewDescription = new TextViewEx(view.getContext());
|
||||
LinearLayout.LayoutParams descriptionParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
descriptionParams.setMargins(0, dpToPx(paddingTop), 0, 0);
|
||||
|
@ -1343,6 +1341,7 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
|||
AndroidUtils.setTextSecondaryColor(app, textViewDescription, nightMode);
|
||||
textViewDescription.setText(description);
|
||||
container.addView(textViewDescription);
|
||||
return textViewDescription;
|
||||
}
|
||||
|
||||
private LinearLayout buildTextContainerView() {
|
||||
|
|
|
@ -1198,7 +1198,8 @@ public class GpxUiHelper {
|
|||
return values;
|
||||
}
|
||||
|
||||
public static void setupHorizontalGPXChart(HorizontalBarChart chart, int yLabelsCount, float topOffset, float bottomOffset, boolean useGesturesAndScale) {
|
||||
public static void setupHorizontalGPXChart(OsmandApplication app, HorizontalBarChart chart, int yLabelsCount,
|
||||
float topOffset, float bottomOffset, boolean useGesturesAndScale, boolean nightMode) {
|
||||
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
||||
chart.setHardwareAccelerationEnabled(false);
|
||||
} else {
|
||||
|
@ -1235,6 +1236,9 @@ public class GpxUiHelper {
|
|||
yr.setDrawGridLines(false);
|
||||
yr.setAxisMinimum(0f);
|
||||
|
||||
yl.setTextColor(ContextCompat.getColor(app, nightMode ? R.color.primary_text_dark : R.color.primary_text_light));
|
||||
yr.setTextColor(ContextCompat.getColor(app, nightMode ? R.color.primary_text_dark : R.color.primary_text_light));
|
||||
|
||||
chart.setFitBars(true);
|
||||
|
||||
Legend l = chart.getLegend();
|
||||
|
|
|
@ -932,8 +932,6 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
|
|||
R.drawable.route_info_trans_gradient_light, R.drawable.route_info_trans_gradient_dark);
|
||||
AndroidUtils.setBackground(ctx, view.findViewById(R.id.app_modes_fold_container), nightMode,
|
||||
R.drawable.route_info_trans_gradient_left_light, R.drawable.route_info_trans_gradient_left_dark);
|
||||
AndroidUtils.setBackground(ctx, view.findViewById(R.id.dividerControlButtons), nightMode,
|
||||
R.color.divider_light, R.color.divider_dark);
|
||||
|
||||
int color = ContextCompat.getColor(ctx, nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
||||
|
||||
|
|
|
@ -428,9 +428,6 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS
|
|||
AndroidUtils.setBackground(app, clearButtonDescr, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark);
|
||||
}
|
||||
|
||||
AndroidUtils.setBackground(app, view.findViewById(R.id.dividerControlButtons), nightMode,
|
||||
R.color.divider_light, R.color.divider_dark);
|
||||
|
||||
((TextView) view.findViewById(R.id.cancel_button_descr)).setTextColor(
|
||||
ContextCompat.getColor(mapActivity, nightMode ? R.color.active_buttons_and_links_dark : R.color.route_info_cancel_button_color_light));
|
||||
|
||||
|
|
|
@ -46,7 +46,6 @@ public abstract class BaseCard {
|
|||
public void update() {
|
||||
if (view != null) {
|
||||
updateContent();
|
||||
applyDayNightMode();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -83,8 +82,6 @@ public abstract class BaseCard {
|
|||
return app;
|
||||
}
|
||||
|
||||
protected abstract void applyDayNightMode();
|
||||
|
||||
@ColorInt
|
||||
protected int getResolvedColor(@ColorRes int colorId) {
|
||||
return ContextCompat.getColor(app, colorId);
|
||||
|
|
|
@ -9,8 +9,6 @@ import android.widget.ImageView;
|
|||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.helpers.SearchHistoryHelper.HistoryEntry;
|
||||
|
@ -124,8 +122,4 @@ public class HistoryCard extends BaseCard {
|
|||
|
||||
((TextView) view.findViewById(R.id.gpx_card_title)).setText(R.string.shared_string_history);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyDayNightMode() {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,9 @@
|
|||
package net.osmand.plus.routepreparationmenu.cards;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.AppCompatImageView;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.TargetPointsHelper;
|
||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||
|
@ -77,10 +74,6 @@ public class HomeWorkCard extends BaseCard {
|
|||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyDayNightMode() {
|
||||
}
|
||||
|
||||
private void openAddPointDialog(MapActivity mapActivity, boolean home) {
|
||||
Bundle args = new Bundle();
|
||||
args.putString(AddPointBottomSheetDialog.POINT_TYPE_KEY, home ? PointType.HOME.name() : PointType.WORK.name());
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
package net.osmand.plus.routepreparationmenu.cards;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.support.v7.widget.AppCompatImageView;
|
||||
import android.view.View;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.TargetPointsHelper;
|
||||
|
@ -26,7 +23,7 @@ public class PreviousRouteCard extends BaseCard {
|
|||
|
||||
@Override
|
||||
protected void updateContent() {
|
||||
final TargetPointsHelper targetPointsHelper = mapActivity.getMyApplication().getTargetPointsHelper();
|
||||
final TargetPointsHelper targetPointsHelper = app.getTargetPointsHelper();
|
||||
TextView startTitle = (TextView) view.findViewById(R.id.start_title);
|
||||
TextView destinationTitle = (TextView) view.findViewById(R.id.destination_title);
|
||||
|
||||
|
@ -74,8 +71,4 @@ public class PreviousRouteCard extends BaseCard {
|
|||
}
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyDayNightMode() {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -52,8 +52,6 @@ public class PublicTransportCard extends BaseCard {
|
|||
|
||||
@Override
|
||||
protected void updateContent() {
|
||||
view.setBackgroundColor(ContextCompat.getColor(app, nightMode ? R.color.route_info_bg_dark : R.color.route_info_bg_light));
|
||||
|
||||
List<TransportRouteResultSegment> segments = routeResult.getSegments();
|
||||
createRouteBadges(segments);
|
||||
|
||||
|
@ -71,26 +69,6 @@ public class PublicTransportCard extends BaseCard {
|
|||
ShowRouteInfoDialogFragment.showInstance(mapActivity, routeId);
|
||||
}
|
||||
});
|
||||
view.findViewById(R.id.bottom_shadow).setVisibility(showBottomShadow ? View.VISIBLE : View.GONE);
|
||||
view.findViewById(R.id.card_divider).setVisibility(showTopShadow ? View.VISIBLE : View.GONE);
|
||||
view.findViewById(R.id.top_divider).setVisibility(!showTopShadow ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
public int getRouteId() {
|
||||
return routeId;
|
||||
}
|
||||
|
||||
public void setSecondButtonVisible(boolean secondButtonVisible) {
|
||||
this.secondButtonVisible = secondButtonVisible;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyDayNightMode() {
|
||||
TextView fromLine = (TextView) view.findViewById(R.id.from_line);
|
||||
TextView wayLine = (TextView) view.findViewById(R.id.way_line);
|
||||
AndroidUtils.setTextSecondaryColor(app, fromLine, nightMode);
|
||||
AndroidUtils.setTextSecondaryColor(app, wayLine, nightMode);
|
||||
|
||||
FrameLayout detailsButton = (FrameLayout) view.findViewById(R.id.details_button);
|
||||
TextView detailsButtonDescr = (TextView) view.findViewById(R.id.details_button_descr);
|
||||
|
||||
|
@ -117,10 +95,17 @@ public class PublicTransportCard extends BaseCard {
|
|||
} else {
|
||||
showButton.setVisibility(View.GONE);
|
||||
}
|
||||
view.findViewById(R.id.bottom_shadow).setVisibility(showBottomShadow ? View.VISIBLE : View.GONE);
|
||||
view.findViewById(R.id.card_divider).setVisibility(showTopShadow ? View.VISIBLE : View.GONE);
|
||||
view.findViewById(R.id.top_divider).setVisibility(!showTopShadow ? View.VISIBLE : View.GONE);
|
||||
}
|
||||
|
||||
AndroidUtils.setBackground(app, view, nightMode, R.color.activity_background_light, R.color.activity_background_dark);
|
||||
AndroidUtils.setBackground(app, view.findViewById(R.id.top_divider), nightMode, R.color.divider_light, R.color.divider_dark);
|
||||
AndroidUtils.setBackground(app, view.findViewById(R.id.routes_info_container), nightMode, R.color.route_info_bg_light, R.color.route_info_bg_dark);
|
||||
public int getRouteId() {
|
||||
return routeId;
|
||||
}
|
||||
|
||||
public void setSecondButtonVisible(boolean secondButtonVisible) {
|
||||
this.secondButtonVisible = secondButtonVisible;
|
||||
}
|
||||
|
||||
private SpannableString getFirstLineDescrSpan() {
|
||||
|
|
|
@ -22,17 +22,19 @@ import net.osmand.plus.helpers.GpxUiHelper;
|
|||
import net.osmand.router.RouteStatistics;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public class RouteInfoCard extends BaseCard {
|
||||
|
||||
private MapActivity mapActivity;
|
||||
private RouteStatistics.Statistics routeStatistics;
|
||||
private GPXUtilities.GPXTrackAnalysis analysis;
|
||||
|
||||
public RouteInfoCard(MapActivity mapActivity, RouteStatistics.Statistics routeStatistics, GPXUtilities.GPXTrackAnalysis analysis) {
|
||||
super(mapActivity);
|
||||
this.mapActivity = mapActivity;
|
||||
this.routeStatistics = routeStatistics;
|
||||
this.analysis = analysis;
|
||||
}
|
||||
|
@ -44,28 +46,22 @@ public class RouteInfoCard extends BaseCard {
|
|||
|
||||
@Override
|
||||
protected void updateContent() {
|
||||
updateTitle();
|
||||
updateHeader();
|
||||
final HorizontalBarChart chart = (HorizontalBarChart) view.findViewById(R.id.chart);
|
||||
GpxUiHelper.setupHorizontalGPXChart(chart, 5, 10, 10, true);
|
||||
GpxUiHelper.setupHorizontalGPXChart(app, chart, 5, 10, 10, true, nightMode);
|
||||
BarData barData = GpxUiHelper.buildStatisticChart(app, chart, routeStatistics, analysis, true, nightMode);
|
||||
chart.setData(barData);
|
||||
LinearLayout container = view.findViewById(R.id.route_items);
|
||||
attachLegend(container, routeStatistics);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyDayNightMode() {
|
||||
view.setBackgroundColor(ContextCompat.getColor(mapActivity, nightMode ? R.color.route_info_bg_dark : R.color.route_info_bg_light));
|
||||
private void updateHeader() {
|
||||
TextView title = (TextView) view.findViewById(R.id.info_type_title);
|
||||
TextView details = (TextView) view.findViewById(R.id.info_type_details);
|
||||
details.setTextColor(ContextCompat.getColor(app, nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light));
|
||||
TextView title = (TextView) view.findViewById(R.id.info_type_title);
|
||||
AndroidUtils.setTextPrimaryColor(app, title, nightMode);
|
||||
}
|
||||
|
||||
private void updateTitle() {
|
||||
TextView title = (TextView) view.findViewById(R.id.info_type_title);
|
||||
String name = getInfoType();
|
||||
title.setText(name);
|
||||
details.setTextColor(ContextCompat.getColor(app, nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light));
|
||||
AndroidUtils.setTextPrimaryColor(app, title, nightMode);
|
||||
}
|
||||
|
||||
private String getInfoType() {
|
||||
|
@ -88,7 +84,7 @@ public class RouteInfoCard extends BaseCard {
|
|||
RouteStatistics.RouteSegmentAttribute<E> segment = partition.get(key);
|
||||
int color = GpxUiHelper.getColorFromRouteSegmentAttribute(app, segment, nightMode);
|
||||
Drawable circle = app.getUIUtilities().getPaintedIcon(R.drawable.ic_action_circle, color);
|
||||
Spannable text = getSpanLegend(key.toString(), segment);
|
||||
Spannable text = getSpanLegend(key.toString().toLowerCase(), segment);
|
||||
|
||||
TextView legend = new TextView(app);
|
||||
AndroidUtils.setTextPrimaryColor(app, legend, nightMode);
|
||||
|
|
|
@ -16,7 +16,6 @@ import com.github.mikephil.charting.interfaces.datasets.ILineDataSet;
|
|||
import com.github.mikephil.charting.listener.ChartTouchListener;
|
||||
import com.github.mikephil.charting.listener.OnChartGestureListener;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.GPXUtilities;
|
||||
import net.osmand.GPXUtilities.GPXFile;
|
||||
import net.osmand.plus.GpxSelectionHelper;
|
||||
|
@ -32,7 +31,6 @@ import java.util.List;
|
|||
|
||||
public class RouteStatisticCard extends BaseCard {
|
||||
|
||||
private MapActivity mapActivity;
|
||||
private GPXFile gpx;
|
||||
private GpxSelectionHelper.GpxDisplayItem gpxItem;
|
||||
private GpxUiHelper.OrderedLineDataSet slopeDataSet;
|
||||
|
@ -41,7 +39,6 @@ public class RouteStatisticCard extends BaseCard {
|
|||
|
||||
public RouteStatisticCard(MapActivity mapActivity, GPXFile gpx, View.OnTouchListener onTouchListener) {
|
||||
super(mapActivity);
|
||||
this.mapActivity = mapActivity;
|
||||
this.gpx = gpx;
|
||||
this.onTouchListener = onTouchListener;
|
||||
makeGpxDisplayItem();
|
||||
|
@ -54,11 +51,8 @@ public class RouteStatisticCard extends BaseCard {
|
|||
|
||||
@Override
|
||||
protected void updateContent() {
|
||||
RoutingHelper routingHelper = mapActivity.getRoutingHelper();
|
||||
|
||||
view.setBackgroundColor(ContextCompat.getColor(mapActivity, nightMode ? R.color.route_info_bg_dark : R.color.route_info_bg_light));
|
||||
|
||||
OsmandApplication app = getMyApplication();
|
||||
RoutingHelper routingHelper = app.getRoutingHelper();
|
||||
|
||||
((ImageView) view.findViewById(R.id.distance_icon)).setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_route_distance));
|
||||
((ImageView) view.findViewById(R.id.time_icon)).setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_time_span));
|
||||
|
@ -68,12 +62,11 @@ public class RouteStatisticCard extends BaseCard {
|
|||
int hours = time / (60 * 60);
|
||||
int minutes = (time / 60) % 60;
|
||||
TextView distanceTv = (TextView) view.findViewById(R.id.distance);
|
||||
AndroidUtils.setTextSecondaryColor(app, distanceTv, nightMode);
|
||||
String text = OsmAndFormatter.getFormattedDistance(dist, app);
|
||||
SpannableStringBuilder distanceStr = new SpannableStringBuilder(text);
|
||||
int spaceIndex = text.indexOf(" ");
|
||||
if (spaceIndex != -1) {
|
||||
distanceStr.setSpan(new ForegroundColorSpan(ContextCompat.getColor(app, R.color.primary_text_light)), 0, spaceIndex, 0);
|
||||
distanceStr.setSpan(new ForegroundColorSpan(ContextCompat.getColor(app, nightMode ? R.color.primary_text_dark : R.color.primary_text_light)), 0, spaceIndex, 0);
|
||||
}
|
||||
distanceTv.setText(distanceStr);
|
||||
SpannableStringBuilder timeStr = new SpannableStringBuilder();
|
||||
|
@ -85,10 +78,9 @@ public class RouteStatisticCard extends BaseCard {
|
|||
}
|
||||
spaceIndex = timeStr.toString().lastIndexOf(" ");
|
||||
if (spaceIndex != -1) {
|
||||
timeStr.setSpan(new ForegroundColorSpan(ContextCompat.getColor(app, R.color.primary_text_light)), 0, spaceIndex, 0);
|
||||
timeStr.setSpan(new ForegroundColorSpan(ContextCompat.getColor(app, nightMode ? R.color.primary_text_dark : R.color.primary_text_light)), 0, spaceIndex, 0);
|
||||
}
|
||||
TextView timeTv = (TextView) view.findViewById(R.id.time);
|
||||
AndroidUtils.setTextSecondaryColor(app, timeTv, nightMode);
|
||||
timeTv.setText(timeStr);
|
||||
|
||||
TextView arriveTimeTv = (TextView) view.findViewById(R.id.time_desc);
|
||||
|
@ -116,10 +108,6 @@ public class RouteStatisticCard extends BaseCard {
|
|||
((ImageView) view.findViewById(R.id.ascent_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_altitude_ascent));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyDayNightMode() {
|
||||
}
|
||||
|
||||
public GpxUiHelper.OrderedLineDataSet getSlopeDataSet() {
|
||||
return slopeDataSet;
|
||||
}
|
||||
|
|
|
@ -19,14 +19,11 @@ import net.osmand.plus.R;
|
|||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.ShowRouteInfoDialogFragment;
|
||||
import net.osmand.plus.helpers.GpxUiHelper;
|
||||
import net.osmand.plus.routing.RouteDirectionInfo;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static net.osmand.plus.routepreparationmenu.MapRouteInfoMenu.directionInfo;
|
||||
|
||||
public class SimpleRouteCard extends BaseCard {
|
||||
|
||||
private MapActivity mapActivity;
|
||||
|
@ -47,8 +44,6 @@ public class SimpleRouteCard extends BaseCard {
|
|||
protected void updateContent() {
|
||||
RoutingHelper routingHelper = mapActivity.getRoutingHelper();
|
||||
|
||||
view.setBackgroundColor(ContextCompat.getColor(mapActivity, nightMode ? R.color.route_info_bg_dark : R.color.route_info_bg_light));
|
||||
|
||||
view.findViewById(R.id.dividerToDropDown).setVisibility(View.VISIBLE);
|
||||
view.findViewById(R.id.route_info_details_card).setVisibility(View.VISIBLE);
|
||||
|
||||
|
@ -103,11 +98,7 @@ public class SimpleRouteCard extends BaseCard {
|
|||
}
|
||||
});
|
||||
|
||||
buildHeader(view);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyDayNightMode() {
|
||||
view.setBackgroundColor(ContextCompat.getColor(mapActivity, nightMode ? R.color.route_info_bg_dark : R.color.route_info_bg_light));
|
||||
FrameLayout detailsButton = view.findViewById(R.id.details_button);
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||
AndroidUtils.setBackground(app, detailsButton, nightMode, R.drawable.btn_border_light, R.drawable.btn_border_dark);
|
||||
|
@ -122,6 +113,8 @@ public class SimpleRouteCard extends BaseCard {
|
|||
AndroidUtils.setBackground(app, view.findViewById(R.id.RouteInfoControls), nightMode, R.color.route_info_bg_light, R.color.route_info_bg_dark);
|
||||
|
||||
((TextView) view.findViewById(R.id.details_button_descr)).setTextColor(color);
|
||||
|
||||
buildHeader(view);
|
||||
}
|
||||
|
||||
private void buildHeader(View headerView) {
|
||||
|
|
|
@ -137,8 +137,4 @@ public class TracksCard extends BaseCard {
|
|||
((TextView) view.findViewById(R.id.gpx_card_title)).setText(
|
||||
String.format("%s — %d", app.getString(R.string.tracks_on_map), list.size()));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyDayNightMode() {
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue