diff --git a/android/res/drawable/ic_altitude_difference.xml b/android/res/drawable/ic_altitude_difference.xml new file mode 100644 index 0000000000..5b22b1e992 --- /dev/null +++ b/android/res/drawable/ic_altitude_difference.xml @@ -0,0 +1,4 @@ + + + diff --git a/android/res/layout-land/altitude_chart_panel.xml b/android/res/layout-land/altitude_chart_panel.xml index d3815807a2..ae1edcc9c5 100644 --- a/android/res/layout-land/altitude_chart_panel.xml +++ b/android/res/layout-land/altitude_chart_panel.xml @@ -18,7 +18,7 @@ diff --git a/android/res/layout-land/routing_details.xml b/android/res/layout-land/routing_details.xml new file mode 100644 index 0000000000..854bd8ef20 --- /dev/null +++ b/android/res/layout-land/routing_details.xml @@ -0,0 +1,40 @@ + + + + + + + + + diff --git a/android/res/layout-w1020dp-land/routing_details.xml b/android/res/layout-w1020dp-land/routing_details.xml index 1acab6e410..db70d1d53b 100644 --- a/android/res/layout-w1020dp-land/routing_details.xml +++ b/android/res/layout-w1020dp-land/routing_details.xml @@ -1,43 +1,53 @@ - + + + + + - - - - - - - - - \ No newline at end of file + android:layout_alignParentRight="true" + android:layout_alignParentEnd="true" + android:textAppearance="@style/MwmTextAppearance.Body3" + android:fontFamily="@string/robotoMedium" + android:textColor="?colorAccent" + android:visibility="gone" + tools:text="43 m" + tools:targetApi="jelly_bean" + tools:visibility="visible"/> + diff --git a/android/res/layout/routing_details.xml b/android/res/layout/routing_details.xml index ea7452bd03..5ab46239c3 100644 --- a/android/res/layout/routing_details.xml +++ b/android/res/layout/routing_details.xml @@ -1,28 +1,42 @@ - + - + android:orientation="horizontal"> - + android:id="@+id/time" + style="@style/MwmWidget.TextView.PlanDetail.Number.Time" + tools:text="33 min"/> - + style="@style/MwmWidget.TextView.PlanDetail.Number.Secondary" + android:layout_marginLeft="6dp" + android:layout_marginRight="6dp" + android:layout_marginTop="2dp" + android:text="•" + tools:ignore="HardcodedText"/> - \ No newline at end of file + android:id="@+id/distance" + style="@style/MwmWidget.TextView.PlanDetail.Number" + tools:text="1024 km"/> + + + diff --git a/android/src/com/mapswithme/maps/Framework.java b/android/src/com/mapswithme/maps/Framework.java index 48a6fdf74c..7efc022db2 100644 --- a/android/src/com/mapswithme/maps/Framework.java +++ b/android/src/com/mapswithme/maps/Framework.java @@ -84,13 +84,14 @@ public class Framework * @return Bitmap if there's pedestrian or bicycle route and null otherwise. */ @Nullable - public static Bitmap GenerateRouteAltitudeChart(int width, int height) + public static Bitmap generateRouteAltitudeChart(int width, int height, + @NonNull RouteAltitudeLimits limits) { if (width <= 0 || height <= 0) return null; - RouteAltitudeLimits routeAltitudeLimits = new RouteAltitudeLimits(); - final int[] altitudeChartBits = Framework.nativeGenerateRouteAltitudeChartBits(width, height, routeAltitudeLimits); + final int[] altitudeChartBits = Framework.nativeGenerateRouteAltitudeChartBits(width, height, + limits); if (altitudeChartBits == null) return null; diff --git a/android/src/com/mapswithme/maps/routing/RoutingPlanController.java b/android/src/com/mapswithme/maps/routing/RoutingPlanController.java index 5399525fbb..34fccf6810 100644 --- a/android/src/com/mapswithme/maps/routing/RoutingPlanController.java +++ b/android/src/com/mapswithme/maps/routing/RoutingPlanController.java @@ -5,6 +5,7 @@ import android.animation.ValueAnimator; import android.app.Activity; import android.graphics.Bitmap; import android.graphics.Rect; +import android.graphics.drawable.Drawable; import android.location.Location; import android.os.Bundle; import android.support.annotation.DrawableRes; @@ -12,6 +13,7 @@ import android.support.annotation.IdRes; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.support.annotation.StringRes; +import android.support.v4.content.ContextCompat; import android.support.v4.view.PagerAdapter; import android.support.v4.view.ViewPager; import android.view.View; @@ -38,11 +40,14 @@ import com.mapswithme.maps.widget.RotateDrawable; import com.mapswithme.maps.widget.RoutingToolbarButton; import com.mapswithme.maps.widget.ToolbarController; import com.mapswithme.maps.widget.WheelProgressView; +import com.mapswithme.util.Graphics; import com.mapswithme.util.UiUtils; import com.mapswithme.util.Utils; import com.mapswithme.util.statistics.AlohaHelper; import com.mapswithme.util.statistics.Statistics; +import java.util.Locale; + public class RoutingPlanController extends ToolbarController implements SlotFrame.SlotClickListener { static final int ANIM_TOGGLE = MwmApplication.get().getResources().getInteger(R.integer.anim_slots_toggle); @@ -451,24 +456,40 @@ public class RoutingPlanController extends ToolbarController implements SlotFram public void showRouteAltitudeChart() { ImageView altitudeChart = (ImageView) mFrame.findViewById(R.id.altitude_chart); - showRouteAltitudeChartInternal(altitudeChart); + TextView altitudeDifference = (TextView) mAltitudeChartFrame.findViewById(R.id.altitude_difference); + showRouteAltitudeChartInternal(altitudeChart, altitudeDifference); } - void showRouteAltitudeChartInternal(@NonNull ImageView altitudeChart) + void showRouteAltitudeChartInternal(@NonNull ImageView altitudeChart, + @NonNull TextView altitudeDifference) { if (isVehicleRouterType()) { UiUtils.hide(altitudeChart); + UiUtils.hide(altitudeDifference); return; } int chartWidth = UiUtils.dimen(mActivity, R.dimen.altitude_chart_image_width); int chartHeight = UiUtils.dimen(mActivity, R.dimen.altitude_chart_image_height); - Bitmap bm = Framework.GenerateRouteAltitudeChart(chartWidth, chartHeight); + Framework.RouteAltitudeLimits limits = new Framework.RouteAltitudeLimits(); + Bitmap bm = Framework.generateRouteAltitudeChart(chartWidth, chartHeight, limits); if (bm != null) { altitudeChart.setImageBitmap(bm); UiUtils.show(altitudeChart); + String meter = altitudeDifference.getResources().getString(R.string.meter); + String foot = altitudeDifference.getResources().getString(R.string.foot); + altitudeDifference.setText(String.format(Locale.getDefault(), "%d %s", + limits.maxRouteAltitude - limits.minRouteAltitude, + limits.isMetricUnits ? meter : foot)); + Drawable icon = ContextCompat.getDrawable(altitudeDifference.getContext(), + R.drawable.ic_altitude_difference); + int colorAccent = ContextCompat.getColor(altitudeDifference.getContext(), + UiUtils.getStyledResourceId(altitudeDifference.getContext(), R.attr.colorAccent)); + altitudeDifference.setCompoundDrawablesWithIntrinsicBounds(Graphics.tint(icon,colorAccent), + null, null, null); + UiUtils.show(altitudeDifference); } } diff --git a/android/src/com/mapswithme/maps/routing/RoutingPlanInplaceController.java b/android/src/com/mapswithme/maps/routing/RoutingPlanInplaceController.java index 389352d99c..6d63834e87 100644 --- a/android/src/com/mapswithme/maps/routing/RoutingPlanInplaceController.java +++ b/android/src/com/mapswithme/maps/routing/RoutingPlanInplaceController.java @@ -6,6 +6,7 @@ import android.os.Bundle; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.widget.ImageView; +import android.widget.TextView; import com.mapswithme.maps.MwmActivity; import com.mapswithme.maps.R; @@ -74,7 +75,8 @@ public class RoutingPlanInplaceController extends RoutingPlanController public void showRouteAltitudeChart() { ImageView altitudeChart = (ImageView) mActivity.findViewById(R.id.altitude_chart); - showRouteAltitudeChartInternal(altitudeChart); + TextView altitudeDifference = (TextView) mActivity.findViewById(R.id.altitude_difference); + showRouteAltitudeChartInternal(altitudeChart, altitudeDifference); } private void animateFrame(final boolean show, final @Nullable Runnable completion)