From 29fc632a7cf2682dfe40646fb176b19ed926805f Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Wed, 30 May 2018 14:20:50 +0200 Subject: [PATCH] Change layout for progress --- .../router/RouteCalculationProgress.java | 16 ++++++------- OsmAnd/res/layout-land/map_hud_bottom.xml | 23 +++++++++++-------- OsmAnd/res/layout/map_hud_bottom.xml | 22 ++++++++++-------- 3 files changed, 33 insertions(+), 28 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/router/RouteCalculationProgress.java b/OsmAnd-java/src/net/osmand/router/RouteCalculationProgress.java index 8a930f148c..b34c2fd5bb 100644 --- a/OsmAnd-java/src/net/osmand/router/RouteCalculationProgress.java +++ b/OsmAnd-java/src/net/osmand/router/RouteCalculationProgress.java @@ -21,25 +21,25 @@ public class RouteCalculationProgress { public boolean isCancelled; public boolean requestPrivateAccessRouting; - private static final float INITIAL_PROGRSS = 0.05f; + private static final float INITIAL_PROGRESS = 0.05f; private static final float FIRST_ITERATION = 0.72f; public float getLinearProgress() { float p = Math.max(distanceFromBegin, distanceFromEnd); - float all = totalEstimatedDistance * 1.25f; + float all = totalEstimatedDistance * 1.35f; float pr = 0; if (all > 0) { - pr = p * p / (all * all); + pr = Math.min(p * p / (all * all), 1); } - float progress = INITIAL_PROGRSS; + float progress = INITIAL_PROGRESS; if (totalIterations > 1) { - if (iteration <= 0) { - progress = pr * FIRST_ITERATION + INITIAL_PROGRSS; + if (iteration < 1) { + progress = pr * FIRST_ITERATION + INITIAL_PROGRESS; } else { - progress = (INITIAL_PROGRSS + FIRST_ITERATION) + pr * (1 - FIRST_ITERATION - INITIAL_PROGRSS); + progress = (INITIAL_PROGRESS + FIRST_ITERATION) + pr * (1 - FIRST_ITERATION - INITIAL_PROGRESS); } } else { - progress = INITIAL_PROGRSS + pr * (1 - INITIAL_PROGRSS); + progress = INITIAL_PROGRESS + pr * (1 - INITIAL_PROGRESS); } return Math.min(progress * 100f, 99); } diff --git a/OsmAnd/res/layout-land/map_hud_bottom.xml b/OsmAnd/res/layout-land/map_hud_bottom.xml index 31ebf31aaa..135b403225 100644 --- a/OsmAnd/res/layout-land/map_hud_bottom.xml +++ b/OsmAnd/res/layout-land/map_hud_bottom.xml @@ -192,6 +192,19 @@ android:contentDescription="@string/shared_string_hide" android:src="@drawable/headliner_close"/> + + + @@ -242,16 +255,6 @@ - + + -