Change layout for progress
This commit is contained in:
parent
dc14885f1f
commit
61993a1452
3 changed files with 33 additions and 28 deletions
|
@ -21,25 +21,25 @@ public class RouteCalculationProgress {
|
||||||
public boolean isCancelled;
|
public boolean isCancelled;
|
||||||
public boolean requestPrivateAccessRouting;
|
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;
|
private static final float FIRST_ITERATION = 0.72f;
|
||||||
|
|
||||||
public float getLinearProgress() {
|
public float getLinearProgress() {
|
||||||
float p = Math.max(distanceFromBegin, distanceFromEnd);
|
float p = Math.max(distanceFromBegin, distanceFromEnd);
|
||||||
float all = totalEstimatedDistance * 1.25f;
|
float all = totalEstimatedDistance * 1.35f;
|
||||||
float pr = 0;
|
float pr = 0;
|
||||||
if (all > 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 (totalIterations > 1) {
|
||||||
if (iteration <= 0) {
|
if (iteration < 1) {
|
||||||
progress = pr * FIRST_ITERATION + INITIAL_PROGRSS;
|
progress = pr * FIRST_ITERATION + INITIAL_PROGRESS;
|
||||||
} else {
|
} else {
|
||||||
progress = (INITIAL_PROGRSS + FIRST_ITERATION) + pr * (1 - FIRST_ITERATION - INITIAL_PROGRSS);
|
progress = (INITIAL_PROGRESS + FIRST_ITERATION) + pr * (1 - FIRST_ITERATION - INITIAL_PROGRESS);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
progress = INITIAL_PROGRSS + pr * (1 - INITIAL_PROGRSS);
|
progress = INITIAL_PROGRESS + pr * (1 - INITIAL_PROGRESS);
|
||||||
}
|
}
|
||||||
return Math.min(progress * 100f, 99);
|
return Math.min(progress * 100f, 99);
|
||||||
}
|
}
|
||||||
|
|
|
@ -193,6 +193,19 @@
|
||||||
android:src="@drawable/headliner_close"/>
|
android:src="@drawable/headliner_close"/>
|
||||||
</LinearLayout>
|
</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>
|
</FrameLayout>
|
||||||
|
|
||||||
<!-- RIGHT BUTTONS -->
|
<!-- RIGHT BUTTONS -->
|
||||||
|
@ -242,16 +255,6 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</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
|
<include
|
||||||
layout="@layout/move_marker_bottom_sheet"
|
layout="@layout/move_marker_bottom_sheet"
|
||||||
|
|
|
@ -231,18 +231,20 @@
|
||||||
tools:src="@drawable/ic_action_test_light"/>
|
tools:src="@drawable/ic_action_test_light"/>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
<ProgressBar
|
<ProgressBar
|
||||||
android:id="@+id/map_horizontal_progress"
|
android:id="@+id/map_horizontal_progress"
|
||||||
style="?android:attr/progressBarStyleHorizontal"
|
style="?android:attr/progressBarStyleHorizontal"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
android:max="100"
|
android:max="100"
|
||||||
android:minHeight="0dp"
|
android:minHeight="0dp"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:progress="60"
|
tools:progress="60"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
</FrameLayout>
|
||||||
|
|
||||||
|
|
||||||
<FrameLayout
|
<FrameLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
Loading…
Reference in a new issue