Change layout for progress

This commit is contained in:
Victor Shcherb 2018-05-30 14:20:50 +02:00
parent ee207c7598
commit 29fc632a7c
3 changed files with 33 additions and 28 deletions

View file

@ -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);
}

View file

@ -193,6 +193,19 @@
android:src="@drawable/headliner_close"/>
</LinearLayout>
<ProgressBar
android:id="@+id/map_horizontal_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_gravity="bottom"
android:layout_height="wrap_content"
android:max="100"
android:minHeight="0dp"
android:visibility="gone"
tools:progress="60"
tools:visibility="visible" />
</FrameLayout>
<!-- RIGHT BUTTONS -->
@ -242,16 +255,6 @@
</LinearLayout>
<ProgressBar
android:id="@+id/map_horizontal_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="100"
android:minHeight="0dp"
android:visibility="gone"
tools:progress="60"
tools:visibility="visible" />
<include
layout="@layout/move_marker_bottom_sheet"

View file

@ -231,18 +231,20 @@
tools:src="@drawable/ic_action_test_light"/>
</LinearLayout>
</LinearLayout>
<ProgressBar
android:id="@+id/map_horizontal_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:max="100"
android:minHeight="0dp"
android:visibility="gone"
tools:progress="60"
tools:visibility="visible" />
</FrameLayout>
<ProgressBar
android:id="@+id/map_horizontal_progress"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:max="100"
android:minHeight="0dp"
android:visibility="gone"
tools:progress="60"
tools:visibility="visible" />
<FrameLayout
android:layout_width="match_parent"