Merge pull request #6597 from osmandapp/RouteInfoDetails
Add addressLookupRequest and improve ui
This commit is contained in:
commit
10bcd8f8e3
24 changed files with 248 additions and 308 deletions
|
@ -113,102 +113,96 @@ public class RouteStatistics {
|
||||||
public abstract String getColorName(E attribute);
|
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) {
|
public RouteSurfaceStatisticComputer(List<RouteSegmentResult> route) {
|
||||||
super(route, StatisticType.SURFACE);
|
super(route, StatisticType.SURFACE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getAttribute(RouteSegmentResult segment) {
|
public RoadSurface getAttribute(RouteSegmentResult segment) {
|
||||||
String segmentSurface = segment.getSurface();
|
String segmentSurface = segment.getSurface();
|
||||||
if (segmentSurface == null) {
|
if (segmentSurface == null) {
|
||||||
return RoadSurface.UNDEFINED.name().toLowerCase();
|
return RoadSurface.UNDEFINED;
|
||||||
}
|
}
|
||||||
for (RoadSurface roadSurface : RoadSurface.values()) {
|
for (RoadSurface roadSurface : RoadSurface.values()) {
|
||||||
if (roadSurface.contains(segmentSurface)) {
|
if (roadSurface.contains(segmentSurface)) {
|
||||||
return roadSurface.name().toLowerCase();
|
return roadSurface;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return RoadSurface.UNDEFINED.name().toLowerCase();
|
return RoadSurface.UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getColorAttrName(String attribute) {
|
public String getColorAttrName(RoadSurface attribute) {
|
||||||
RoadSurface roadSurface = RoadSurface.valueOf(attribute.toUpperCase());
|
return attribute.getColorAttrName();
|
||||||
return roadSurface.getColorAttrName();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getColorName(String attribute) {
|
public String getColorName(RoadSurface attribute) {
|
||||||
RoadSurface roadSurface = RoadSurface.valueOf(attribute.toUpperCase());
|
return attribute.getColorName();
|
||||||
return roadSurface.getColorName();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class RouteSmoothnessStatisticComputer extends RouteStatisticComputer<String> {
|
private static class RouteSmoothnessStatisticComputer extends RouteStatisticComputer<RoadSmoothness> {
|
||||||
|
|
||||||
public RouteSmoothnessStatisticComputer(List<RouteSegmentResult> route) {
|
public RouteSmoothnessStatisticComputer(List<RouteSegmentResult> route) {
|
||||||
super(route, StatisticType.SMOOTHNESS);
|
super(route, StatisticType.SMOOTHNESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getAttribute(RouteSegmentResult segment) {
|
public RoadSmoothness getAttribute(RouteSegmentResult segment) {
|
||||||
String segmentSmoothness = segment.getSmoothness();
|
String segmentSmoothness = segment.getSmoothness();
|
||||||
if (segmentSmoothness == null) {
|
if (segmentSmoothness == null) {
|
||||||
return RoadSmoothness.UNDEFINED.name().toLowerCase();
|
return RoadSmoothness.UNDEFINED;
|
||||||
}
|
}
|
||||||
for (RoadSmoothness roadSmoothness : RoadSmoothness.values()) {
|
for (RoadSmoothness roadSmoothness : RoadSmoothness.values()) {
|
||||||
if (roadSmoothness.contains(segmentSmoothness)) {
|
if (roadSmoothness.contains(segmentSmoothness)) {
|
||||||
return roadSmoothness.name().toLowerCase();
|
return roadSmoothness;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return RoadSmoothness.UNDEFINED.name().toLowerCase();
|
return RoadSmoothness.UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getColorAttrName(String attribute) {
|
public String getColorAttrName(RoadSmoothness attribute) {
|
||||||
RoadSmoothness roadSmoothness = RoadSmoothness.valueOf(attribute.toUpperCase());
|
return attribute.getColorAttrName();
|
||||||
return roadSmoothness.getColorAttrName();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getColorName(String attribute) {
|
public String getColorName(RoadSmoothness attribute) {
|
||||||
RoadSmoothness roadSmoothness = RoadSmoothness.valueOf(attribute.toUpperCase());
|
return attribute.getColorName();
|
||||||
return roadSmoothness.getColorName();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static class RouteClassStatisticComputer extends RouteStatisticComputer<String> {
|
private static class RouteClassStatisticComputer extends RouteStatisticComputer<RoadClass> {
|
||||||
|
|
||||||
public RouteClassStatisticComputer(List<RouteSegmentResult> route) {
|
public RouteClassStatisticComputer(List<RouteSegmentResult> route) {
|
||||||
super(route, StatisticType.CLASS);
|
super(route, StatisticType.CLASS);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getAttribute(RouteSegmentResult segment) {
|
public RoadClass getAttribute(RouteSegmentResult segment) {
|
||||||
String segmentClass = segment.getHighway();
|
String segmentClass = segment.getHighway();
|
||||||
if (segmentClass == null) {
|
if (segmentClass == null) {
|
||||||
return RoadClass.UNDEFINED.name().toLowerCase();
|
return RoadClass.UNDEFINED;
|
||||||
}
|
}
|
||||||
for (RoadClass roadClass : RoadClass.values()) {
|
for (RoadClass roadClass : RoadClass.values()) {
|
||||||
if (roadClass.contains(segmentClass)) {
|
if (roadClass.contains(segmentClass)) {
|
||||||
return roadClass.name().toLowerCase();
|
return roadClass;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return RoadClass.UNDEFINED.name().toLowerCase();
|
return RoadClass.UNDEFINED;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getColorAttrName(String attribute) {
|
public String getColorAttrName(RoadClass attribute) {
|
||||||
RoadClass roadClass = RoadClass.valueOf(attribute.toUpperCase());
|
return attribute.getColorAttrName();
|
||||||
return roadClass.getColorAttrName();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getColorName(String attribute) {
|
public String getColorName(RoadClass attribute) {
|
||||||
RoadClass roadClass = RoadClass.valueOf(attribute.toUpperCase());
|
return attribute.getColorName();
|
||||||
return roadClass.getColorName();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -516,13 +510,11 @@ public class RouteStatistics {
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum RoadSurface {
|
public enum RoadSurface {
|
||||||
UNDEFINED(null, "#e8e8e8", "undefined"),
|
|
||||||
PAVED(null, "#a7cdf8", "paved"),
|
|
||||||
UNPAVED(null, "#cc9900", "unpaved"),
|
|
||||||
ASPHALT(null, "#6f687e", "asphalt"),
|
ASPHALT(null, "#6f687e", "asphalt"),
|
||||||
CONCRETE(null, "#a7cdf8", "concrete"),
|
CONCRETE(null, "#a7cdf8", "concrete"),
|
||||||
|
UNPAVED(null, "#cc9900", "unpaved"),
|
||||||
|
PAVED(null, "#a7cdf8", "paved"),
|
||||||
COMPACTED(null, "#cbcbe8", "compacted"),
|
COMPACTED(null, "#cbcbe8", "compacted"),
|
||||||
GRAVEL(null, "#cbcbe8", "gravel"),
|
|
||||||
FINE_GRAVEL(null, "#cbcbe8", "fine_gravel"),
|
FINE_GRAVEL(null, "#cbcbe8", "fine_gravel"),
|
||||||
PAVING_STONES(null, "#a7cdf8", "paving_stones"),
|
PAVING_STONES(null, "#a7cdf8", "paving_stones"),
|
||||||
SETT(null, "#a7cdf8", "sett"),
|
SETT(null, "#a7cdf8", "sett"),
|
||||||
|
@ -530,15 +522,17 @@ public class RouteStatistics {
|
||||||
PEBBLESTONE("#a7cdf8", "pebblestone"),
|
PEBBLESTONE("#a7cdf8", "pebblestone"),
|
||||||
STONE(null, "#a7cdf8", "stone"),
|
STONE(null, "#a7cdf8", "stone"),
|
||||||
METAL(null, "#a7cdf8", "metal"),
|
METAL(null, "#a7cdf8", "metal"),
|
||||||
GROUND(null, "#cc9900", "ground", "mud"),
|
|
||||||
WOOD(null, "#a7cdf8", "wood"),
|
|
||||||
GRASS_PAVER(null, "#a7bef8", "grass_paver"),
|
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"),
|
GRASS(null, "#1fbe1f", "grass"),
|
||||||
SAND(null, "#ffd700", "sand"),
|
SAND(null, "#ffd700", "sand"),
|
||||||
SALT(null, "#7eded8", "salt"),
|
SALT(null, "#7eded8", "salt"),
|
||||||
SNOW(null, "#9feeef", "snow"),
|
SNOW(null, "#9feeef", "snow"),
|
||||||
ICE(null, "#9feeef", "ice"),
|
ICE(null, "#9feeef", "ice"),
|
||||||
CLAY(null, "#cc9900", "clay");
|
UNDEFINED(null, "#e8e8e8", "undefined");
|
||||||
|
|
||||||
final Set<String> surfaces = new TreeSet<>();
|
final Set<String> surfaces = new TreeSet<>();
|
||||||
final String colorAttrName;
|
final String colorAttrName;
|
||||||
|
@ -564,7 +558,6 @@ public class RouteStatistics {
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum RoadSmoothness {
|
public enum RoadSmoothness {
|
||||||
UNDEFINED("redColor", null, "undefined"),
|
|
||||||
EXCELLENT("orangeColor", null, "excellent"),
|
EXCELLENT("orangeColor", null, "excellent"),
|
||||||
GOOD("brownColor", null, "good"),
|
GOOD("brownColor", null, "good"),
|
||||||
INTERMEDIATE("darkyellowColor", null, "intermediate"),
|
INTERMEDIATE("darkyellowColor", null, "intermediate"),
|
||||||
|
@ -572,7 +565,8 @@ public class RouteStatistics {
|
||||||
VERY_BAD("lightgreenColor", null, "very_bad"),
|
VERY_BAD("lightgreenColor", null, "very_bad"),
|
||||||
HORRIBLE("greenColor", null, "horrible"),
|
HORRIBLE("greenColor", null, "horrible"),
|
||||||
VERY_HORRIBLE("lightblueColor", null, "very_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 Set<String> surfaces = new TreeSet<>();
|
||||||
final String colorAttrName;
|
final String colorAttrName;
|
||||||
|
|
|
@ -123,8 +123,9 @@
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
android:minHeight="@dimen/route_info_list_item_height"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -235,8 +236,9 @@
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
android:minHeight="@dimen/route_info_list_item_height"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
@ -349,8 +351,9 @@
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
|
android:minHeight="@dimen/route_info_list_item_height"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="?attr/bg_color"
|
android:background="?attr/route_info_bg"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
|
@ -22,6 +22,7 @@
|
||||||
android:maxLines="1"
|
android:maxLines="1"
|
||||||
android:paddingLeft="@dimen/content_padding"
|
android:paddingLeft="@dimen/content_padding"
|
||||||
android:paddingRight="@dimen/content_padding"
|
android:paddingRight="@dimen/content_padding"
|
||||||
|
android:textColor="?android:attr/textColorPrimary"
|
||||||
android:textSize="@dimen/text_button_text_size"
|
android:textSize="@dimen/text_button_text_size"
|
||||||
osmand:typeface="@string/font_roboto_medium"
|
osmand:typeface="@string/font_roboto_medium"
|
||||||
tools:ignore="UnusedAttribute"
|
tools:ignore="UnusedAttribute"
|
||||||
|
|
|
@ -4,12 +4,12 @@
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/route_info_bg"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?attr/bg_color"
|
|
||||||
android:baselineAligned="false"
|
android:baselineAligned="false"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingTop="8dp"
|
android:paddingTop="8dp"
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
android:textColor="?attr/routeParameterTitleColor"
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
android:textSize="@dimen/default_list_text_size"
|
android:textSize="@dimen/default_list_text_size"
|
||||||
osmand:typeface="@string/font_roboto_medium"
|
osmand:typeface="@string/font_roboto_medium"
|
||||||
tools:text="26 km" />
|
tools:text="26 km" />
|
||||||
|
@ -83,7 +83,7 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:background="@null"
|
android:background="@null"
|
||||||
android:textColor="?attr/routeParameterTitleColor"
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
android:textSize="@dimen/default_list_text_size"
|
android:textSize="@dimen/default_list_text_size"
|
||||||
osmand:typeface="@string/font_roboto_medium"
|
osmand:typeface="@string/font_roboto_medium"
|
||||||
tools:text="20 min" />
|
tools:text="20 min" />
|
||||||
|
@ -106,7 +106,6 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?attr/bg_color"
|
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<com.github.mikephil.charting.charts.LineChart
|
<com.github.mikephil.charting.charts.LineChart
|
||||||
|
@ -120,7 +119,6 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?attr/bg_color"
|
|
||||||
android:baselineAligned="false"
|
android:baselineAligned="false"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingBottom="4dp">
|
android:paddingBottom="4dp">
|
||||||
|
@ -216,7 +214,6 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?attr/bg_color"
|
|
||||||
android:baselineAligned="false"
|
android:baselineAligned="false"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingTop="4dp"
|
android:paddingTop="4dp"
|
||||||
|
@ -257,7 +254,6 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?attr/bg_color"
|
|
||||||
android:baselineAligned="false"
|
android:baselineAligned="false"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingTop="4dp"
|
android:paddingTop="4dp"
|
||||||
|
|
|
@ -2,20 +2,8 @@
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:id="@+id/dividerControlButtons"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="1dp"
|
|
||||||
android:focusable="false" />
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="48dp"
|
android:layout_height="48dp"
|
||||||
android:baselineAligned="false"
|
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
|
@ -86,5 +74,3 @@
|
||||||
</FrameLayout>
|
</FrameLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
|
|
@ -11,12 +11,14 @@
|
||||||
android:id="@+id/dividerToDropDown"
|
android:id="@+id/dividerToDropDown"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
|
android:background="?attr/dashboard_divider"
|
||||||
android:focusable="false" />
|
android:focusable="false" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/RouteInfoControls"
|
android:id="@+id/RouteInfoControls"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:background="?attr/route_info_bg"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
|
|
@ -188,7 +188,7 @@
|
||||||
<include
|
<include
|
||||||
layout="@layout/route_info_menu_control_buttons"
|
layout="@layout/route_info_menu_control_buttons"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="@dimen/route_info_list_item_height"
|
||||||
android:layout_gravity="bottom" />
|
android:layout_gravity="bottom" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -20,16 +20,18 @@
|
||||||
android:id="@+id/top_divider"
|
android:id="@+id/top_divider"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
|
android:background="?attr/dashboard_divider"
|
||||||
android:focusable="false" />
|
android:focusable="false" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/routes_info_container"
|
android:id="@+id/routes_info_container"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
|
android:background="?attr/route_info_bg"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingLeft="@dimen/route_info_buttons_padding_top_bottom"
|
android:paddingLeft="@dimen/route_info_buttons_padding_top_bottom"
|
||||||
android:paddingRight="@dimen/route_info_buttons_padding_top_bottom"
|
android:paddingTop="@dimen/content_padding"
|
||||||
android:paddingTop="@dimen/content_padding">
|
android:paddingRight="@dimen/route_info_buttons_padding_top_bottom">
|
||||||
|
|
||||||
<net.osmand.plus.widgets.FlowLayout
|
<net.osmand.plus.widgets.FlowLayout
|
||||||
android:id="@+id/routes_badges"
|
android:id="@+id/routes_badges"
|
||||||
|
@ -49,6 +51,7 @@
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:paddingBottom="6dp"
|
android:paddingBottom="6dp"
|
||||||
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
android:textSize="@dimen/default_desc_text_size"
|
android:textSize="@dimen/default_desc_text_size"
|
||||||
osmand:typeface="@string/font_roboto_regular"
|
osmand:typeface="@string/font_roboto_regular"
|
||||||
tools:text="@string/route_from" />
|
tools:text="@string/route_from" />
|
||||||
|
@ -57,6 +60,7 @@
|
||||||
android:id="@+id/way_line"
|
android:id="@+id/way_line"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:textColor="?android:attr/textColorSecondary"
|
||||||
android:textSize="@dimen/default_desc_text_size"
|
android:textSize="@dimen/default_desc_text_size"
|
||||||
osmand:typeface="@string/font_roboto_regular"
|
osmand:typeface="@string/font_roboto_regular"
|
||||||
tools:text="@string/route_from" />
|
tools:text="@string/route_from" />
|
||||||
|
|
|
@ -64,6 +64,7 @@ import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.data.TransportRoute;
|
import net.osmand.data.TransportRoute;
|
||||||
import net.osmand.data.TransportStop;
|
import net.osmand.data.TransportStop;
|
||||||
|
import net.osmand.plus.GeocodingLookupService;
|
||||||
import net.osmand.plus.GpxSelectionHelper;
|
import net.osmand.plus.GpxSelectionHelper;
|
||||||
import net.osmand.plus.GpxSelectionHelper.GpxDisplayGroup;
|
import net.osmand.plus.GpxSelectionHelper.GpxDisplayGroup;
|
||||||
import net.osmand.plus.LockableScrollView;
|
import net.osmand.plus.LockableScrollView;
|
||||||
|
@ -105,6 +106,7 @@ import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.lang.ref.WeakReference;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
@ -149,6 +151,8 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
||||||
private int zoomButtonsHeight;
|
private int zoomButtonsHeight;
|
||||||
|
|
||||||
private int routeId;
|
private int routeId;
|
||||||
|
private String destinationStreetStr = "";
|
||||||
|
private boolean paused;
|
||||||
|
|
||||||
private OsmandApplication app;
|
private OsmandApplication app;
|
||||||
private RoutingHelper routingHelper;
|
private RoutingHelper routingHelper;
|
||||||
|
@ -172,6 +176,15 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
||||||
if (args != null) {
|
if (args != null) {
|
||||||
routeId = args.getInt(ROUTE_ID_KEY);
|
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 toolbar = (Toolbar) view.findViewById(R.id.toolbar);
|
||||||
toolbar.setNavigationIcon(app.getUIUtilities().getThemedIcon(R.drawable.ic_arrow_back));
|
toolbar.setNavigationIcon(app.getUIUtilities().getThemedIcon(R.drawable.ic_arrow_back));
|
||||||
|
@ -182,41 +195,15 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
||||||
dismiss();
|
dismiss();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
toolbar.setBackgroundColor(ContextCompat.getColor(app, nightMode ? R.color.bg_color_dark : R.color.bg_color_light));
|
||||||
|
|
||||||
buildMenuButtons();
|
buildMenuButtons();
|
||||||
|
updateCards();
|
||||||
|
|
||||||
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();
|
|
||||||
if (routes != null && routes.size() > routeId) {
|
|
||||||
TransportRoutePlanner.TransportRouteResult routeResult = routingHelper.getTransportRoutingHelper().getRoutes().get(routeId);
|
|
||||||
PublicTransportCard card = new PublicTransportCard(mapActivity, routeResult, routeId);
|
|
||||||
menuCards.add(card);
|
|
||||||
cardsContainer.addView(card.build(mapActivity));
|
|
||||||
buildRowDivider(cardsContainer, false);
|
|
||||||
buildTransportRouteRow(cardsContainer, routeResult, null, true);
|
|
||||||
buildRowDivider(cardsContainer, false);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
makeGpx();
|
|
||||||
createRouteStatisticCards(cardsContainer);
|
|
||||||
createRouteDirections(cardsContainer);
|
|
||||||
}
|
|
||||||
processScreenHeight(container);
|
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);
|
minHalfY = viewHeight - (int) (viewHeight * .75f);
|
||||||
|
|
||||||
mainView = view.findViewById(R.id.main_view);
|
|
||||||
nightMode = app.getDaynightHelper().isNightModeForMapControls();
|
|
||||||
|
|
||||||
// Zoom buttons
|
// Zoom buttons
|
||||||
zoomButtonsView = view.findViewById(R.id.map_hud_controls);
|
zoomButtonsView = view.findViewById(R.id.map_hud_controls);
|
||||||
ImageButton zoomInButtonView = (ImageButton) view.findViewById(R.id.map_zoom_in_button);
|
ImageButton zoomInButtonView = (ImageButton) view.findViewById(R.id.map_zoom_in_button);
|
||||||
|
@ -427,6 +414,30 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateCards() {
|
||||||
|
MapActivity mapActivity = getMapActivity();
|
||||||
|
if (mapActivity != null) {
|
||||||
|
LinearLayout cardsContainer = (LinearLayout) view.findViewById(R.id.route_menu_cards_container);
|
||||||
|
cardsContainer.removeAllViews();
|
||||||
|
if (routeId != -1) {
|
||||||
|
List<TransportRoutePlanner.TransportRouteResult> routes = routingHelper.getTransportRoutingHelper().getRoutes();
|
||||||
|
if (routes != null && routes.size() > routeId) {
|
||||||
|
TransportRoutePlanner.TransportRouteResult routeResult = routingHelper.getTransportRoutingHelper().getRoutes().get(routeId);
|
||||||
|
PublicTransportCard card = new PublicTransportCard(mapActivity, routeResult, routeId);
|
||||||
|
menuCards.add(card);
|
||||||
|
cardsContainer.addView(card.build(mapActivity));
|
||||||
|
buildRowDivider(cardsContainer, false);
|
||||||
|
buildTransportRouteRow(cardsContainer, routeResult, null, true);
|
||||||
|
buildRowDivider(cardsContainer, false);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
makeGpx();
|
||||||
|
createRouteStatisticCards(cardsContainer);
|
||||||
|
createRouteDirections(cardsContainer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void createRouteDirections(LinearLayout cardsContainer) {
|
private void createRouteDirections(LinearLayout cardsContainer) {
|
||||||
TextViewEx routeDirectionsTitle = new TextViewEx(app);
|
TextViewEx routeDirectionsTitle = new TextViewEx(app);
|
||||||
AndroidUtils.setTextPrimaryColor(app, routeDirectionsTitle, nightMode);
|
AndroidUtils.setTextPrimaryColor(app, routeDirectionsTitle, nightMode);
|
||||||
|
@ -573,7 +584,7 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
||||||
ImageView routeLine = new ImageView(view.getContext());
|
ImageView routeLine = new ImageView(view.getContext());
|
||||||
FrameLayout.LayoutParams routeLineParams = new FrameLayout.LayoutParams(dpToPx(8f), ViewGroup.LayoutParams.MATCH_PARENT);
|
FrameLayout.LayoutParams routeLineParams = new FrameLayout.LayoutParams(dpToPx(8f), ViewGroup.LayoutParams.MATCH_PARENT);
|
||||||
routeLineParams.gravity = Gravity.START;
|
routeLineParams.gravity = Gravity.START;
|
||||||
routeLineParams.setMargins(dpToPx(24), dpToPx(14), dpToPx(22), dpToPx(28));
|
routeLineParams.setMargins(dpToPx(24), dpToPx(14), dpToPx(22), dpToPx(36));
|
||||||
routeLine.setLayoutParams(routeLineParams);
|
routeLine.setLayoutParams(routeLineParams);
|
||||||
int bgColor = transportStopRoute.getColor(app, nightMode);
|
int bgColor = transportStopRoute.getColor(app, nightMode);
|
||||||
routeLine.setBackgroundColor(bgColor);
|
routeLine.setBackgroundColor(bgColor);
|
||||||
|
@ -590,7 +601,7 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
||||||
String timeText = OsmAndFormatter.getFormattedTime(startTime, false);
|
String timeText = OsmAndFormatter.getFormattedTime(startTime, false);
|
||||||
|
|
||||||
SpannableString secondaryText = new SpannableString(getString(R.string.sit_on_the_stop) + ":");
|
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());
|
SpannableString title = new SpannableString(startStop.getName());
|
||||||
title.setSpan(new CustomTypefaceSpan(typeface), 0, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
title.setSpan(new CustomTypefaceSpan(typeface), 0, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
@ -604,12 +615,12 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
||||||
}
|
}
|
||||||
SpannableStringBuilder spannable = new SpannableStringBuilder("~");
|
SpannableStringBuilder spannable = new SpannableStringBuilder("~");
|
||||||
int startIndex = spannable.length();
|
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.append(OsmAndFormatter.getFormattedDuration(segment.getArrivalTime(), app));
|
||||||
spannable.setSpan(new CustomTypefaceSpan(typeface), startIndex, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
spannable.setSpan(new CustomTypefaceSpan(typeface), startIndex, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
startIndex = spannable.length();
|
startIndex = spannable.length();
|
||||||
spannable.append(" • ");
|
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();
|
startIndex = spannable.length();
|
||||||
if (stops.size() > 2) {
|
if (stops.size() > 2) {
|
||||||
spannable.append(String.valueOf(stops.size())).append(" ").append(getString(R.string.transport_stops));
|
spannable.append(String.valueOf(stops.size())).append(" ").append(getString(R.string.transport_stops));
|
||||||
|
@ -631,7 +642,7 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
||||||
secondaryText.setSpan(new CustomTypefaceSpan(typeface), 0, secondaryText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
secondaryText.setSpan(new CustomTypefaceSpan(typeface), 0, secondaryText.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
int spaceIndex = secondaryText.toString().indexOf(" ");
|
int spaceIndex = secondaryText.toString().indexOf(" ");
|
||||||
if (spaceIndex != -1) {
|
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 = new SpannableString(endStop.getName());
|
||||||
title.setSpan(new CustomTypefaceSpan(typeface), 0, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
title.setSpan(new CustomTypefaceSpan(typeface), 0, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
|
@ -681,7 +692,7 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
||||||
int startIndex = spannable.length();
|
int startIndex = spannable.length();
|
||||||
spannable.append(OsmAndFormatter.getFormattedDuration((int) walkTime, app)).append(" ");
|
spannable.append(OsmAndFormatter.getFormattedDuration((int) walkTime, app)).append(" ");
|
||||||
spannable.setSpan(new CustomTypefaceSpan(typeface), startIndex, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
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));
|
spannable.append(getString(R.string.on_foot)).append(" ").append(", ").append(OsmAndFormatter.getFormattedDistance((float) segment.walkDist, app));
|
||||||
|
|
||||||
buildWalkRow(parent, spannable, listener, null);
|
buildWalkRow(parent, spannable, listener, null);
|
||||||
|
@ -722,12 +733,12 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
||||||
Typeface typeface = FontCache.getRobotoMedium(app);
|
Typeface typeface = FontCache.getRobotoMedium(app);
|
||||||
SpannableStringBuilder title = new SpannableStringBuilder("~");
|
SpannableStringBuilder title = new SpannableStringBuilder("~");
|
||||||
int startIndex = title.length();
|
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.append(OsmAndFormatter.getFormattedDuration((int) walkTime, app)).append(" ");
|
||||||
title.setSpan(new CustomTypefaceSpan(typeface), startIndex, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
title.setSpan(new CustomTypefaceSpan(typeface), startIndex, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
startIndex = title.length();
|
startIndex = title.length();
|
||||||
title.append(getString(R.string.on_foot)).append(", ").append(OsmAndFormatter.getFormattedDistance((float) finishWalkDist, app));
|
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;
|
return title;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -759,13 +770,13 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
||||||
|
|
||||||
long walkTime = (long) getWalkTime(segment.walkDist, walkSpeed);
|
long walkTime = (long) getWalkTime(segment.walkDist, walkSpeed);
|
||||||
SpannableStringBuilder title = new SpannableStringBuilder(Algorithms.capitalizeFirstLetter(getString(R.string.on_foot)));
|
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();
|
int startIndex = title.length();
|
||||||
title.append(" ").append(OsmAndFormatter.getFormattedDuration((int) walkTime, app));
|
title.append(" ").append(OsmAndFormatter.getFormattedDuration((int) walkTime, app));
|
||||||
title.setSpan(new CustomTypefaceSpan(FontCache.getRobotoMedium(app)), startIndex, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
title.setSpan(new CustomTypefaceSpan(FontCache.getRobotoMedium(app)), startIndex, title.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
startIndex = title.length();
|
startIndex = title.length();
|
||||||
title.append(", ").append(OsmAndFormatter.getFormattedDistance((float) segment.walkDist, app));
|
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);
|
buildWalkRow(infoContainer, title, listener, imagesContainer);
|
||||||
buildRowDivider(infoContainer, true);
|
buildRowDivider(infoContainer, true);
|
||||||
|
@ -797,13 +808,13 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
||||||
long walkTime = (long) getWalkTime(segment.walkDist, walkSpeed);
|
long walkTime = (long) getWalkTime(segment.walkDist, walkSpeed);
|
||||||
|
|
||||||
SpannableStringBuilder spannable = new SpannableStringBuilder("~");
|
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();
|
int startIndex = spannable.length();
|
||||||
spannable.append(OsmAndFormatter.getFormattedDuration((int) walkTime, app)).append(" ");
|
spannable.append(OsmAndFormatter.getFormattedDuration((int) walkTime, app)).append(" ");
|
||||||
spannable.setSpan(new CustomTypefaceSpan(typeface), startIndex, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
spannable.setSpan(new CustomTypefaceSpan(typeface), startIndex, spannable.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
|
||||||
startIndex = spannable.length();
|
startIndex = spannable.length();
|
||||||
spannable.append(getString(R.string.on_foot)).append(", ").append(OsmAndFormatter.getFormattedDistance((float) segment.walkDist, app));
|
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);
|
buildWalkRow(infoContainer, spannable, listener, imagesContainer);
|
||||||
buildRowDivider(infoContainer, true);
|
buildRowDivider(infoContainer, true);
|
||||||
|
@ -817,32 +828,13 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
||||||
|
|
||||||
SpannableString secondaryText = new SpannableString(getString(R.string.route_descr_destination) + ":");
|
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 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();
|
buildDestinationRow(infoContainer, timeStr, title, secondaryText, destination.point, listener, imagesContainer);
|
||||||
String loc = getPointName(destination);
|
|
||||||
if (!loc.equals(name)) {
|
|
||||||
locationStr.append(loc);
|
|
||||||
}
|
|
||||||
buildDestinationRow(infoContainer, timeStr, title, secondaryText, locationStr, listener, imagesContainer);
|
|
||||||
|
|
||||||
((ViewGroup) view).addView(baseItemView);
|
((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() {
|
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);
|
return ContextCompat.getColor(app, !nightMode ? R.color.ctx_menu_bottom_view_url_color_light : R.color.ctx_menu_bottom_view_url_color_dark);
|
||||||
}
|
}
|
||||||
|
@ -873,7 +865,7 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
||||||
ll.addView(llText);
|
ll.addView(llText);
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(secondaryText)) {
|
if (!TextUtils.isEmpty(secondaryText)) {
|
||||||
buildDescriptionView(secondaryText, llText, 8);
|
buildDescriptionView(secondaryText, llText, 8, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTitleView(title, llText);
|
buildTitleView(title, llText);
|
||||||
|
@ -968,7 +960,7 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
||||||
ll.addView(llText);
|
ll.addView(llText);
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(secondaryText)) {
|
if (!TextUtils.isEmpty(secondaryText)) {
|
||||||
buildDescriptionView(secondaryText, llText, 8);
|
buildDescriptionView(secondaryText, llText, 8, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTitleView(title, llText);
|
buildTitleView(title, llText);
|
||||||
|
@ -1050,7 +1042,7 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
||||||
ll.addView(llText);
|
ll.addView(llText);
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(secondaryText)) {
|
if (!TextUtils.isEmpty(secondaryText)) {
|
||||||
buildDescriptionView(secondaryText, llText, 8);
|
buildDescriptionView(secondaryText, llText, 8, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
buildTitleView(title, llText);
|
buildTitleView(title, llText);
|
||||||
|
@ -1076,6 +1068,23 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
||||||
((LinearLayout) view).addView(baseItemView);
|
((LinearLayout) view).addView(baseItemView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
protected void updateDestinationStreetName(LatLon latLon) {
|
||||||
|
final WeakReference<ShowRouteInfoDialogFragment> fragmentRef = new WeakReference<>(ShowRouteInfoDialogFragment.this);
|
||||||
|
GeocodingLookupService.AddressLookupRequest addressLookupRequest = new GeocodingLookupService.AddressLookupRequest(latLon, new GeocodingLookupService.OnAddressLookupResult() {
|
||||||
|
@Override
|
||||||
|
public void geocodingDone(String address) {
|
||||||
|
ShowRouteInfoDialogFragment fragment = fragmentRef.get();
|
||||||
|
if (!TextUtils.isEmpty(address) && fragment != null && !fragment.paused) {
|
||||||
|
fragment.destinationStreetStr = address;
|
||||||
|
fragment.updateCards();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, null);
|
||||||
|
|
||||||
|
app.getGeocodingLookupService().lookupAddress(addressLookupRequest);
|
||||||
|
}
|
||||||
|
|
||||||
public void buildWalkRow(final View view, final Spannable title, View.OnClickListener onClickListener, LinearLayout imagesContainer) {
|
public void buildWalkRow(final View view, final Spannable title, View.OnClickListener onClickListener, LinearLayout imagesContainer) {
|
||||||
FrameLayout baseItemView = new FrameLayout(view.getContext());
|
FrameLayout baseItemView = new FrameLayout(view.getContext());
|
||||||
FrameLayout.LayoutParams baseViewLayoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
FrameLayout.LayoutParams baseViewLayoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
||||||
|
@ -1186,7 +1195,7 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void buildDestinationRow(final View view, String timeText, final Spannable title, Spannable secondaryText,
|
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 baseItemView = new FrameLayout(view.getContext());
|
||||||
FrameLayout.LayoutParams baseViewLayoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
FrameLayout.LayoutParams baseViewLayoutParams = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
|
||||||
baseItemView.setLayoutParams(baseViewLayoutParams);
|
baseItemView.setLayoutParams(baseViewLayoutParams);
|
||||||
|
@ -1224,11 +1233,17 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
||||||
LinearLayout llText = buildTextContainerView();
|
LinearLayout llText = buildTextContainerView();
|
||||||
ll.addView(llText);
|
ll.addView(llText);
|
||||||
|
|
||||||
buildDescriptionView(secondaryText, llText, 8);
|
buildDescriptionView(secondaryText, llText, 8, 0);
|
||||||
buildTitleView(title, llText);
|
buildTitleView(title, llText);
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(locationText)) {
|
if (location != null) {
|
||||||
buildDescriptionView(locationText, llText, 4);
|
if (!TextUtils.isEmpty(destinationStreetStr)) {
|
||||||
|
if (!title.toString().equals(destinationStreetStr)) {
|
||||||
|
buildDescriptionView(new SpannableString(destinationStreetStr), llText, 4, 4);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
updateDestinationStreetName(location);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!TextUtils.isEmpty(timeText)) {
|
if (!TextUtils.isEmpty(timeText)) {
|
||||||
|
@ -1333,10 +1348,10 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
||||||
container.addView(titleView);
|
container.addView(titleView);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildDescriptionView(Spannable description, LinearLayout container, int paddingTop) {
|
private void buildDescriptionView(Spannable description, LinearLayout container, int paddingTop, int paddingBottom) {
|
||||||
TextViewEx textViewDescription = new TextViewEx(view.getContext());
|
TextViewEx textViewDescription = new TextViewEx(view.getContext());
|
||||||
LinearLayout.LayoutParams descriptionParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
LinearLayout.LayoutParams descriptionParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||||
descriptionParams.setMargins(0, dpToPx(paddingTop), 0, 0);
|
descriptionParams.setMargins(0, dpToPx(paddingTop), 0, dpToPx(paddingBottom));
|
||||||
textViewDescription.setLayoutParams(descriptionParams);
|
textViewDescription.setLayoutParams(descriptionParams);
|
||||||
textViewDescription.setTypeface(FontCache.getRobotoRegular(view.getContext()));
|
textViewDescription.setTypeface(FontCache.getRobotoRegular(view.getContext()));
|
||||||
textViewDescription.setTextSize(14);
|
textViewDescription.setTextSize(14);
|
||||||
|
@ -1609,6 +1624,7 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
||||||
icon.setImageDrawable(drawable);
|
icon.setImageDrawable(drawable);
|
||||||
|
|
||||||
label.setText(model.getDescriptionRoutePart());
|
label.setText(model.getDescriptionRoutePart());
|
||||||
|
AndroidUtils.setTextPrimaryColor(app, label, nightMode);
|
||||||
if (model.distance > 0) {
|
if (model.distance > 0) {
|
||||||
distanceLabel.setText(OsmAndFormatter.getFormattedDistance(model.distance, app));
|
distanceLabel.setText(OsmAndFormatter.getFormattedDistance(model.distance, app));
|
||||||
timeLabel.setText(getTimeDescription(model));
|
timeLabel.setText(getTimeDescription(model));
|
||||||
|
@ -1862,7 +1878,7 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
||||||
@Override
|
@Override
|
||||||
public void onResume() {
|
public void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
paused = false;
|
||||||
ViewParent parent = view.getParent();
|
ViewParent parent = view.getParent();
|
||||||
if (parent != null && containerLayoutListener != null) {
|
if (parent != null && containerLayoutListener != null) {
|
||||||
((View) parent).addOnLayoutChangeListener(containerLayoutListener);
|
((View) parent).addOnLayoutChangeListener(containerLayoutListener);
|
||||||
|
@ -1880,6 +1896,7 @@ public class ShowRouteInfoDialogFragment extends BaseOsmAndFragment {
|
||||||
@Override
|
@Override
|
||||||
public void onPause() {
|
public void onPause() {
|
||||||
super.onPause();
|
super.onPause();
|
||||||
|
paused = true;
|
||||||
if (view != null) {
|
if (view != null) {
|
||||||
ViewParent parent = view.getParent();
|
ViewParent parent = view.getParent();
|
||||||
if (parent != null && containerLayoutListener != null) {
|
if (parent != null && containerLayoutListener != null) {
|
||||||
|
|
|
@ -174,7 +174,9 @@ public abstract class MenuBottomSheetDialogFragment extends BottomSheetDialogFra
|
||||||
|
|
||||||
protected void setupHeightAndBackground(final View mainView) {
|
protected void setupHeightAndBackground(final View mainView) {
|
||||||
final Activity activity = getActivity();
|
final Activity activity = getActivity();
|
||||||
|
if (activity == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
final int screenHeight = AndroidUtils.getScreenHeight(activity);
|
final int screenHeight = AndroidUtils.getScreenHeight(activity);
|
||||||
final int statusBarHeight = AndroidUtils.getStatusBarHeight(activity);
|
final int statusBarHeight = AndroidUtils.getStatusBarHeight(activity);
|
||||||
final int contentHeight = getContentHeight(screenHeight - statusBarHeight - AndroidUtils.getNavBarHeight(activity));
|
final int contentHeight = getContentHeight(screenHeight - statusBarHeight - AndroidUtils.getNavBarHeight(activity));
|
||||||
|
|
|
@ -1216,7 +1216,8 @@ public class GpxUiHelper {
|
||||||
return values;
|
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) {
|
if (android.os.Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
||||||
chart.setHardwareAccelerationEnabled(false);
|
chart.setHardwareAccelerationEnabled(false);
|
||||||
} else {
|
} else {
|
||||||
|
@ -1253,6 +1254,9 @@ public class GpxUiHelper {
|
||||||
yr.setDrawGridLines(false);
|
yr.setDrawGridLines(false);
|
||||||
yr.setAxisMinimum(0f);
|
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);
|
chart.setFitBars(true);
|
||||||
|
|
||||||
Legend l = chart.getLegend();
|
Legend l = chart.getLegend();
|
||||||
|
|
|
@ -1357,7 +1357,6 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
args.putString(AddPointBottomSheetDialog.POINT_TYPE_KEY, pointType.name());
|
args.putString(AddPointBottomSheetDialog.POINT_TYPE_KEY, pointType.name());
|
||||||
AddPointBottomSheetDialog fragment = new AddPointBottomSheetDialog();
|
AddPointBottomSheetDialog fragment = new AddPointBottomSheetDialog();
|
||||||
fragment.setArguments(args);
|
fragment.setArguments(args);
|
||||||
fragment.setUsedOnMap(false);
|
|
||||||
fragment.show(mapActivity.getSupportFragmentManager(), AddPointBottomSheetDialog.TAG);
|
fragment.show(mapActivity.getSupportFragmentManager(), AddPointBottomSheetDialog.TAG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -932,8 +932,6 @@ public class MapRouteInfoMenuFragment extends BaseOsmAndFragment {
|
||||||
R.drawable.route_info_trans_gradient_light, R.drawable.route_info_trans_gradient_dark);
|
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,
|
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);
|
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);
|
int color = ContextCompat.getColor(ctx, nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
||||||
|
|
||||||
|
|
|
@ -546,7 +546,7 @@ public class ShowAlongTheRouteBottomSheet extends MenuBottomSheetDialogFragment
|
||||||
@Override
|
@Override
|
||||||
protected void onPostExecute(Void aVoid) {
|
protected void onPostExecute(Void aVoid) {
|
||||||
ShowAlongTheRouteBottomSheet fragment = fragmentRef.get();
|
ShowAlongTheRouteBottomSheet fragment = fragmentRef.get();
|
||||||
if (fragment != null) {
|
if (fragment != null && fragment.isAdded()) {
|
||||||
fragment.updateAdapter();
|
fragment.updateAdapter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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, 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(
|
((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));
|
ContextCompat.getColor(mapActivity, nightMode ? R.color.active_buttons_and_links_dark : R.color.route_info_cancel_button_color_light));
|
||||||
|
|
||||||
|
@ -593,11 +590,13 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateTitle() {
|
private void updateTitle() {
|
||||||
|
if (isAdded()) {
|
||||||
final TextViewEx title = (TextViewEx) view.findViewById(R.id.title);
|
final TextViewEx title = (TextViewEx) view.findViewById(R.id.title);
|
||||||
int pointsSize = app.getTargetPointsHelper().getAllPoints().size();
|
int pointsSize = app.getTargetPointsHelper().getAllPoints().size();
|
||||||
String text = getString(R.string.shared_string_waypoints) + ": " + (pointsSize != 0 ? pointsSize : 1);
|
String text = getString(R.string.shared_string_waypoints) + ": " + (pointsSize != 0 ? pointsSize : 1);
|
||||||
title.setText(text);
|
title.setText(text);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void applyPointsChanges() {
|
private void applyPointsChanges() {
|
||||||
app.runInUIThread(new Runnable() {
|
app.runInUIThread(new Runnable() {
|
||||||
|
|
|
@ -46,7 +46,6 @@ public abstract class BaseCard {
|
||||||
public void update() {
|
public void update() {
|
||||||
if (view != null) {
|
if (view != null) {
|
||||||
updateContent();
|
updateContent();
|
||||||
applyDayNightMode();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -83,8 +82,6 @@ public abstract class BaseCard {
|
||||||
return app;
|
return app;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract void applyDayNightMode();
|
|
||||||
|
|
||||||
@ColorInt
|
@ColorInt
|
||||||
protected int getResolvedColor(@ColorRes int colorId) {
|
protected int getResolvedColor(@ColorRes int colorId) {
|
||||||
return ContextCompat.getColor(app, colorId);
|
return ContextCompat.getColor(app, colorId);
|
||||||
|
|
|
@ -9,8 +9,6 @@ import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
|
||||||
import net.osmand.data.PointDescription;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.search.SearchHistoryFragment;
|
import net.osmand.plus.activities.search.SearchHistoryFragment;
|
||||||
|
@ -128,8 +126,4 @@ public class HistoryCard extends BaseCard {
|
||||||
|
|
||||||
((TextView) view.findViewById(R.id.gpx_card_title)).setText(R.string.shared_string_history);
|
((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;
|
package net.osmand.plus.routepreparationmenu.cards;
|
||||||
|
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.v7.widget.AppCompatImageView;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.TargetPointsHelper;
|
import net.osmand.plus.TargetPointsHelper;
|
||||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
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) {
|
private void openAddPointDialog(MapActivity mapActivity, boolean home) {
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putString(AddPointBottomSheetDialog.POINT_TYPE_KEY, home ? PointType.HOME.name() : PointType.WORK.name());
|
args.putString(AddPointBottomSheetDialog.POINT_TYPE_KEY, home ? PointType.HOME.name() : PointType.WORK.name());
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
package net.osmand.plus.routepreparationmenu.cards;
|
package net.osmand.plus.routepreparationmenu.cards;
|
||||||
|
|
||||||
import android.graphics.drawable.Drawable;
|
|
||||||
import android.support.v7.widget.AppCompatImageView;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.TargetPointsHelper;
|
import net.osmand.plus.TargetPointsHelper;
|
||||||
|
@ -26,7 +23,7 @@ public class PreviousRouteCard extends BaseCard {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateContent() {
|
protected void updateContent() {
|
||||||
final TargetPointsHelper targetPointsHelper = mapActivity.getMyApplication().getTargetPointsHelper();
|
final TargetPointsHelper targetPointsHelper = app.getTargetPointsHelper();
|
||||||
TextView startTitle = (TextView) view.findViewById(R.id.start_title);
|
TextView startTitle = (TextView) view.findViewById(R.id.start_title);
|
||||||
TextView destinationTitle = (TextView) view.findViewById(R.id.destination_title);
|
TextView destinationTitle = (TextView) view.findViewById(R.id.destination_title);
|
||||||
|
|
||||||
|
@ -74,8 +71,4 @@ public class PreviousRouteCard extends BaseCard {
|
||||||
}
|
}
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void applyDayNightMode() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,8 +52,6 @@ public class PublicTransportCard extends BaseCard {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateContent() {
|
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();
|
List<TransportRouteResultSegment> segments = routeResult.getSegments();
|
||||||
createRouteBadges(segments);
|
createRouteBadges(segments);
|
||||||
|
|
||||||
|
@ -71,26 +69,6 @@ public class PublicTransportCard extends BaseCard {
|
||||||
ShowRouteInfoDialogFragment.showInstance(mapActivity, routeId);
|
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);
|
FrameLayout detailsButton = (FrameLayout) view.findViewById(R.id.details_button);
|
||||||
TextView detailsButtonDescr = (TextView) view.findViewById(R.id.details_button_descr);
|
TextView detailsButtonDescr = (TextView) view.findViewById(R.id.details_button_descr);
|
||||||
|
|
||||||
|
@ -117,10 +95,17 @@ public class PublicTransportCard extends BaseCard {
|
||||||
} else {
|
} else {
|
||||||
showButton.setVisibility(View.GONE);
|
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);
|
public int getRouteId() {
|
||||||
AndroidUtils.setBackground(app, view.findViewById(R.id.top_divider), nightMode, R.color.divider_light, R.color.divider_dark);
|
return routeId;
|
||||||
AndroidUtils.setBackground(app, view.findViewById(R.id.routes_info_container), nightMode, R.color.route_info_bg_light, R.color.route_info_bg_dark);
|
}
|
||||||
|
|
||||||
|
public void setSecondButtonVisible(boolean secondButtonVisible) {
|
||||||
|
this.secondButtonVisible = secondButtonVisible;
|
||||||
}
|
}
|
||||||
|
|
||||||
private SpannableString getFirstLineDescrSpan() {
|
private SpannableString getFirstLineDescrSpan() {
|
||||||
|
|
|
@ -22,17 +22,19 @@ import net.osmand.plus.helpers.GpxUiHelper;
|
||||||
import net.osmand.router.RouteStatistics;
|
import net.osmand.router.RouteStatistics;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
public class RouteInfoCard extends BaseCard {
|
public class RouteInfoCard extends BaseCard {
|
||||||
|
|
||||||
private MapActivity mapActivity;
|
|
||||||
private RouteStatistics.Statistics routeStatistics;
|
private RouteStatistics.Statistics routeStatistics;
|
||||||
private GPXUtilities.GPXTrackAnalysis analysis;
|
private GPXUtilities.GPXTrackAnalysis analysis;
|
||||||
|
|
||||||
public RouteInfoCard(MapActivity mapActivity, RouteStatistics.Statistics routeStatistics, GPXUtilities.GPXTrackAnalysis analysis) {
|
public RouteInfoCard(MapActivity mapActivity, RouteStatistics.Statistics routeStatistics, GPXUtilities.GPXTrackAnalysis analysis) {
|
||||||
super(mapActivity);
|
super(mapActivity);
|
||||||
this.mapActivity = mapActivity;
|
|
||||||
this.routeStatistics = routeStatistics;
|
this.routeStatistics = routeStatistics;
|
||||||
this.analysis = analysis;
|
this.analysis = analysis;
|
||||||
}
|
}
|
||||||
|
@ -44,28 +46,22 @@ public class RouteInfoCard extends BaseCard {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateContent() {
|
protected void updateContent() {
|
||||||
updateTitle();
|
updateHeader();
|
||||||
final HorizontalBarChart chart = (HorizontalBarChart) view.findViewById(R.id.chart);
|
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);
|
BarData barData = GpxUiHelper.buildStatisticChart(app, chart, routeStatistics, analysis, true, nightMode);
|
||||||
chart.setData(barData);
|
chart.setData(barData);
|
||||||
LinearLayout container = view.findViewById(R.id.route_items);
|
LinearLayout container = view.findViewById(R.id.route_items);
|
||||||
attachLegend(container, routeStatistics);
|
attachLegend(container, routeStatistics);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
private void updateHeader() {
|
||||||
protected void applyDayNightMode() {
|
TextView title = (TextView) view.findViewById(R.id.info_type_title);
|
||||||
view.setBackgroundColor(ContextCompat.getColor(mapActivity, nightMode ? R.color.route_info_bg_dark : R.color.route_info_bg_light));
|
|
||||||
TextView details = (TextView) view.findViewById(R.id.info_type_details);
|
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();
|
String name = getInfoType();
|
||||||
title.setText(name);
|
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() {
|
private String getInfoType() {
|
||||||
|
@ -88,7 +84,7 @@ public class RouteInfoCard extends BaseCard {
|
||||||
RouteStatistics.RouteSegmentAttribute<E> segment = partition.get(key);
|
RouteStatistics.RouteSegmentAttribute<E> segment = partition.get(key);
|
||||||
int color = GpxUiHelper.getColorFromRouteSegmentAttribute(app, segment, nightMode);
|
int color = GpxUiHelper.getColorFromRouteSegmentAttribute(app, segment, nightMode);
|
||||||
Drawable circle = app.getUIUtilities().getPaintedIcon(R.drawable.ic_action_circle, color);
|
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);
|
TextView legend = new TextView(app);
|
||||||
AndroidUtils.setTextPrimaryColor(app, legend, nightMode);
|
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.ChartTouchListener;
|
||||||
import com.github.mikephil.charting.listener.OnChartGestureListener;
|
import com.github.mikephil.charting.listener.OnChartGestureListener;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
|
||||||
import net.osmand.GPXUtilities;
|
import net.osmand.GPXUtilities;
|
||||||
import net.osmand.GPXUtilities.GPXFile;
|
import net.osmand.GPXUtilities.GPXFile;
|
||||||
import net.osmand.plus.GpxSelectionHelper;
|
import net.osmand.plus.GpxSelectionHelper;
|
||||||
|
@ -32,7 +31,6 @@ import java.util.List;
|
||||||
|
|
||||||
public class RouteStatisticCard extends BaseCard {
|
public class RouteStatisticCard extends BaseCard {
|
||||||
|
|
||||||
private MapActivity mapActivity;
|
|
||||||
private GPXFile gpx;
|
private GPXFile gpx;
|
||||||
private GpxSelectionHelper.GpxDisplayItem gpxItem;
|
private GpxSelectionHelper.GpxDisplayItem gpxItem;
|
||||||
private GpxUiHelper.OrderedLineDataSet slopeDataSet;
|
private GpxUiHelper.OrderedLineDataSet slopeDataSet;
|
||||||
|
@ -41,7 +39,6 @@ public class RouteStatisticCard extends BaseCard {
|
||||||
|
|
||||||
public RouteStatisticCard(MapActivity mapActivity, GPXFile gpx, View.OnTouchListener onTouchListener) {
|
public RouteStatisticCard(MapActivity mapActivity, GPXFile gpx, View.OnTouchListener onTouchListener) {
|
||||||
super(mapActivity);
|
super(mapActivity);
|
||||||
this.mapActivity = mapActivity;
|
|
||||||
this.gpx = gpx;
|
this.gpx = gpx;
|
||||||
this.onTouchListener = onTouchListener;
|
this.onTouchListener = onTouchListener;
|
||||||
makeGpxDisplayItem();
|
makeGpxDisplayItem();
|
||||||
|
@ -54,11 +51,8 @@ public class RouteStatisticCard extends BaseCard {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void updateContent() {
|
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();
|
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.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));
|
((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 hours = time / (60 * 60);
|
||||||
int minutes = (time / 60) % 60;
|
int minutes = (time / 60) % 60;
|
||||||
TextView distanceTv = (TextView) view.findViewById(R.id.distance);
|
TextView distanceTv = (TextView) view.findViewById(R.id.distance);
|
||||||
AndroidUtils.setTextSecondaryColor(app, distanceTv, nightMode);
|
|
||||||
String text = OsmAndFormatter.getFormattedDistance(dist, app);
|
String text = OsmAndFormatter.getFormattedDistance(dist, app);
|
||||||
SpannableStringBuilder distanceStr = new SpannableStringBuilder(text);
|
SpannableStringBuilder distanceStr = new SpannableStringBuilder(text);
|
||||||
int spaceIndex = text.indexOf(" ");
|
int spaceIndex = text.indexOf(" ");
|
||||||
if (spaceIndex != -1) {
|
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);
|
distanceTv.setText(distanceStr);
|
||||||
SpannableStringBuilder timeStr = new SpannableStringBuilder();
|
SpannableStringBuilder timeStr = new SpannableStringBuilder();
|
||||||
|
@ -85,10 +78,9 @@ public class RouteStatisticCard extends BaseCard {
|
||||||
}
|
}
|
||||||
spaceIndex = timeStr.toString().lastIndexOf(" ");
|
spaceIndex = timeStr.toString().lastIndexOf(" ");
|
||||||
if (spaceIndex != -1) {
|
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);
|
TextView timeTv = (TextView) view.findViewById(R.id.time);
|
||||||
AndroidUtils.setTextSecondaryColor(app, timeTv, nightMode);
|
|
||||||
timeTv.setText(timeStr);
|
timeTv.setText(timeStr);
|
||||||
|
|
||||||
TextView arriveTimeTv = (TextView) view.findViewById(R.id.time_desc);
|
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));
|
((ImageView) view.findViewById(R.id.ascent_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_altitude_ascent));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void applyDayNightMode() {
|
|
||||||
}
|
|
||||||
|
|
||||||
public GpxUiHelper.OrderedLineDataSet getSlopeDataSet() {
|
public GpxUiHelper.OrderedLineDataSet getSlopeDataSet() {
|
||||||
return slopeDataSet;
|
return slopeDataSet;
|
||||||
}
|
}
|
||||||
|
@ -141,7 +129,7 @@ public class RouteStatisticCard extends BaseCard {
|
||||||
|
|
||||||
private void buildHeader(GPXUtilities.GPXTrackAnalysis analysis) {
|
private void buildHeader(GPXUtilities.GPXTrackAnalysis analysis) {
|
||||||
final LineChart mChart = (LineChart) view.findViewById(R.id.chart);
|
final LineChart mChart = (LineChart) view.findViewById(R.id.chart);
|
||||||
GpxUiHelper.setupGPXChart(app, mChart, 4);
|
GpxUiHelper.setupGPXChart(mChart, 4, 24f, 16f, !nightMode, true);
|
||||||
mChart.setOnTouchListener(onTouchListener);
|
mChart.setOnTouchListener(onTouchListener);
|
||||||
|
|
||||||
if (analysis.hasElevationData) {
|
if (analysis.hasElevationData) {
|
||||||
|
|
|
@ -19,14 +19,11 @@ import net.osmand.plus.R;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
import net.osmand.plus.activities.ShowRouteInfoDialogFragment;
|
import net.osmand.plus.activities.ShowRouteInfoDialogFragment;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper;
|
import net.osmand.plus.helpers.GpxUiHelper;
|
||||||
import net.osmand.plus.routing.RouteDirectionInfo;
|
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import static net.osmand.plus.routepreparationmenu.MapRouteInfoMenu.directionInfo;
|
|
||||||
|
|
||||||
public class SimpleRouteCard extends BaseCard {
|
public class SimpleRouteCard extends BaseCard {
|
||||||
|
|
||||||
private MapActivity mapActivity;
|
private MapActivity mapActivity;
|
||||||
|
@ -47,8 +44,6 @@ public class SimpleRouteCard extends BaseCard {
|
||||||
protected void updateContent() {
|
protected void updateContent() {
|
||||||
RoutingHelper routingHelper = mapActivity.getRoutingHelper();
|
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.dividerToDropDown).setVisibility(View.VISIBLE);
|
||||||
view.findViewById(R.id.route_info_details_card).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);
|
view.setBackgroundColor(ContextCompat.getColor(mapActivity, nightMode ? R.color.route_info_bg_dark : R.color.route_info_bg_light));
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void applyDayNightMode() {
|
|
||||||
FrameLayout detailsButton = view.findViewById(R.id.details_button);
|
FrameLayout detailsButton = view.findViewById(R.id.details_button);
|
||||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||||
AndroidUtils.setBackground(app, detailsButton, nightMode, R.drawable.btn_border_light, R.drawable.btn_border_dark);
|
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);
|
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);
|
((TextView) view.findViewById(R.id.details_button_descr)).setTextColor(color);
|
||||||
|
|
||||||
|
buildHeader(view);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void buildHeader(View headerView) {
|
private void buildHeader(View headerView) {
|
||||||
|
|
|
@ -137,8 +137,4 @@ public class TracksCard extends BaseCard {
|
||||||
((TextView) view.findViewById(R.id.gpx_card_title)).setText(
|
((TextView) view.findViewById(R.id.gpx_card_title)).setText(
|
||||||
String.format("%s — %d", app.getString(R.string.tracks_on_map), list.size()));
|
String.format("%s — %d", app.getString(R.string.tracks_on_map), list.size()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void applyDayNightMode() {
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue