Skip to content

Commit 607e689

Browse files
tomaszrybakiewiczabhishek1508
authored andcommitted
Adjusted Navigation Camera padding when using NavigationView in the Landscape orientation, and the NavigationCamera is in the Following mode.
1 parent a3da3ba commit 607e689

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

libnavui-dropin/src/main/java/com/mapbox/navigation/dropin/camera/CameraLayoutObserver.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ internal class CameraLayoutObserver(
6161
}
6262

6363
private fun getLandscapePadding(): EdgeInsets {
64-
val left = mapView.width.toDouble() - binding.infoPanelLayout.right.toDouble()
65-
val right = mapView.width.toDouble() - binding.actionListLayout.left.toDouble()
6664
val bottom = mapView.height.toDouble() - binding.roadNameLayout.top.toDouble()
6765
return when (store.state.value.navigation) {
6866
is NavigationState.FreeDrive -> {
@@ -74,9 +72,9 @@ internal class CameraLayoutObserver(
7472
is NavigationState.Arrival -> {
7573
EdgeInsets(
7674
vPaddingLandscape,
77-
hPaddingLandscape + left,
75+
hPaddingLandscape + binding.infoPanelLayout.right.toDouble(),
7876
bottom,
79-
right - hPaddingLandscape
77+
hPaddingLandscape
8078
)
8179
}
8280
}

libnavui-dropin/src/test/java/com/mapbox/navigation/dropin/camera/CameraLayoutObserverTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class CameraLayoutObserverTest {
119119

120120
@Test
121121
@Config(qualifiers = "land")
122-
fun `landscape - should update left, bottom and right padding for all states except FreeDrive`() =
122+
fun `landscape - should update left and bottom padding for all states except FreeDrive`() =
123123
coroutineRule.runBlockingTest {
124124
sut.onAttached(mockk())
125125

@@ -134,7 +134,7 @@ class CameraLayoutObserverTest {
134134
assertEquals("$s|top", action.padding.top, PADDING_V_LAND, 0.001)
135135
assertNotEquals("$s|bottom", action.padding.bottom, PADDING_V_LAND, 0.001)
136136
assertNotEquals("$s|left", action.padding.left, PADDING_H_LAND, 0.001)
137-
assertNotEquals("$s|right", action.padding.right, PADDING_H_LAND, 0.001)
137+
assertEquals("$s|right", action.padding.right, PADDING_H_LAND, 0.001)
138138
}
139139
}
140140

0 commit comments

Comments
 (0)