diff --git a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/internal/navigation/MapboxNavigationNotification.kt b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/internal/navigation/MapboxNavigationNotification.kt
index a3c906f3135..54e819a1ed6 100644
--- a/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/internal/navigation/MapboxNavigationNotification.kt
+++ b/libandroid-navigation/src/main/java/com/mapbox/services/android/navigation/v5/internal/navigation/MapboxNavigationNotification.kt
@@ -294,11 +294,11 @@ internal class MapboxNavigationNotification : NavigationNotification {
}
collapsedNotificationRemoteViews?.setTextViewText(
R.id.notificationDistanceText,
- currentDistanceText
+ currentDistanceText.toString()
)
expandedNotificationRemoteViews?.setTextViewText(
R.id.notificationDistanceText,
- currentDistanceText
+ currentDistanceText.toString()
)
}
}
diff --git a/libandroid-navigation/src/main/res/drawable/ic_close.xml b/libandroid-navigation/src/main/res/drawable/ic_close.xml
index ede4b7108d5..2eaa9e2199d 100644
--- a/libandroid-navigation/src/main/res/drawable/ic_close.xml
+++ b/libandroid-navigation/src/main/res/drawable/ic_close.xml
@@ -1,9 +1,9 @@
+ android:width="14dp"
+ android:height="14dp"
+ android:viewportWidth="14"
+ android:viewportHeight="14">
+ android:fillColor="#FFFFFF"
+ android:pathData="M14,1.4l-1.4,-1.4l-5.6,5.6l-5.6,-5.6l-1.4,1.4l5.6,5.6l-5.6,5.6l1.4,1.4l5.6,-5.6l5.6,5.6l1.4,-1.4l-5.6,-5.6z" />
diff --git a/libandroid-navigation/src/main/res/layout/collapsed_navigation_notification_layout.xml b/libandroid-navigation/src/main/res/layout/collapsed_navigation_notification_layout.xml
index d44503987fb..809f1ad109a 100644
--- a/libandroid-navigation/src/main/res/layout/collapsed_navigation_notification_layout.xml
+++ b/libandroid-navigation/src/main/res/layout/collapsed_navigation_notification_layout.xml
@@ -2,9 +2,9 @@
+ android:layout_height="64dp"
+ tools:background="@color/mapboxNotificationBlue">
+ android:paddingBottom="8dp"
+ tools:background="@color/mapboxNotificationBlue">
@@ -26,8 +28,7 @@
android:layout_gravity="center"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
- android:src="@drawable/ic_close"
- android:tint="@android:color/white" />
+ android:src="@drawable/ic_close" />
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/libtrip-notification/src/main/java/com/mapbox/navigation/trip/notification/MapboxTripNotification.kt b/libtrip-notification/src/main/java/com/mapbox/navigation/trip/notification/MapboxTripNotification.kt
index c6458a0a1a0..2b3f2d8445e 100644
--- a/libtrip-notification/src/main/java/com/mapbox/navigation/trip/notification/MapboxTripNotification.kt
+++ b/libtrip-notification/src/main/java/com/mapbox/navigation/trip/notification/MapboxTripNotification.kt
@@ -128,6 +128,19 @@ class MapboxTripNotification constructor(
currentInstructionText = null
currentDistanceText = null
+ collapsedNotificationRemoteViews?.apply {
+ setTextViewText(R.id.notificationDistanceText, "")
+ setTextViewText(R.id.notificationArrivalText, "")
+ setTextViewText(R.id.notificationInstructionText, "")
+ }
+
+ expandedNotificationRemoteViews?.apply {
+ setTextViewText(R.id.notificationDistanceText, "")
+ setTextViewText(R.id.notificationArrivalText, "")
+ setTextViewText(R.id.notificationInstructionText, "")
+ setTextViewText(R.id.endNavigationBtnText, "")
+ }
+
unregisterReceiver()
try {
notificationActionButtonChannel.cancel()
@@ -256,6 +269,7 @@ class MapboxTripNotification constructor(
private fun setFreeDriveMode(isFreeDriveMode: Boolean) {
updateEtaContentVisibility(isFreeDriveMode)
+ updateInstructionTextVisibility(isFreeDriveMode)
updateFreeDriveTextVisibility(isFreeDriveMode)
updateManeuverImageResource(isFreeDriveMode)
updateEndNavigationBtnText(isFreeDriveMode)
@@ -273,6 +287,17 @@ class MapboxTripNotification constructor(
)
}
+ private fun updateInstructionTextVisibility(isFreeDriveMode: Boolean) {
+ collapsedNotificationRemoteViews?.setViewVisibility(
+ R.id.notificationInstructionText,
+ if (isFreeDriveMode) GONE else VISIBLE
+ )
+ expandedNotificationRemoteViews?.setViewVisibility(
+ R.id.notificationInstructionText,
+ if (isFreeDriveMode) GONE else VISIBLE
+ )
+ }
+
private fun updateFreeDriveTextVisibility(isFreeDriveMode: Boolean) {
collapsedNotificationRemoteViews?.setViewVisibility(
R.id.freeDriveText,
@@ -333,11 +358,11 @@ class MapboxTripNotification constructor(
}
collapsedNotificationRemoteViews?.setTextViewText(
R.id.notificationDistanceText,
- currentDistanceText
+ currentDistanceText.toString()
)
expandedNotificationRemoteViews?.setTextViewText(
R.id.notificationDistanceText,
- currentDistanceText
+ currentDistanceText.toString()
)
}
}
diff --git a/libtrip-notification/src/main/res/drawable/ic_close.xml b/libtrip-notification/src/main/res/drawable/ic_close.xml
index ede4b7108d5..2eaa9e2199d 100644
--- a/libtrip-notification/src/main/res/drawable/ic_close.xml
+++ b/libtrip-notification/src/main/res/drawable/ic_close.xml
@@ -1,9 +1,9 @@
+ android:width="14dp"
+ android:height="14dp"
+ android:viewportWidth="14"
+ android:viewportHeight="14">
+ android:fillColor="#FFFFFF"
+ android:pathData="M14,1.4l-1.4,-1.4l-5.6,5.6l-5.6,-5.6l-1.4,1.4l5.6,5.6l-5.6,5.6l1.4,1.4l5.6,-5.6l5.6,5.6l1.4,-1.4l-5.6,-5.6z" />
diff --git a/libtrip-notification/src/main/res/layout/collapsed_navigation_notification_layout.xml b/libtrip-notification/src/main/res/layout/collapsed_navigation_notification_layout.xml
index 12f34ab780d..d086b59266b 100644
--- a/libtrip-notification/src/main/res/layout/collapsed_navigation_notification_layout.xml
+++ b/libtrip-notification/src/main/res/layout/collapsed_navigation_notification_layout.xml
@@ -2,7 +2,6 @@
@@ -15,6 +14,7 @@
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:layout_marginStart="8dp"
+ android:layout_marginLeft="8dp"
android:layout_marginEnd="8dp"
android:layout_marginRight="8dp"
android:cropToPadding="true"
@@ -26,13 +26,13 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignTop="@id/maneuverImage"
- android:layout_marginTop="4dp"
android:layout_toEndOf="@id/maneuverImage"
android:layout_toRightOf="@id/maneuverImage"
android:orientation="horizontal">
+ android:src="@drawable/ic_close" />
End Navigation
Stop session
- Free Drive session
+ Free Drive Session
Navigation Notifications
Arrive at %s
%s ETA
diff --git a/libtrip-notification/src/main/res/values-v21/styles.xml b/libtrip-notification/src/main/res/values/styles.xml
similarity index 59%
rename from libtrip-notification/src/main/res/values-v21/styles.xml
rename to libtrip-notification/src/main/res/values/styles.xml
index 5b6742f1722..40ab08fc6a4 100644
--- a/libtrip-notification/src/main/res/values-v21/styles.xml
+++ b/libtrip-notification/src/main/res/values/styles.xml
@@ -1,6 +1,10 @@
-
-
-
+
+
+
+
\ No newline at end of file
diff --git a/libtrip-notification/src/test/java/com/mapbox/navigation/trip/notification/MapboxTripNotificationTest.kt b/libtrip-notification/src/test/java/com/mapbox/navigation/trip/notification/MapboxTripNotificationTest.kt
index aa1bdc65f97..0aa869d5cc3 100644
--- a/libtrip-notification/src/test/java/com/mapbox/navigation/trip/notification/MapboxTripNotificationTest.kt
+++ b/libtrip-notification/src/test/java/com/mapbox/navigation/trip/notification/MapboxTripNotificationTest.kt
@@ -196,19 +196,14 @@ class MapboxTripNotificationTest {
val routeProgress = mockk(relaxed = true)
val distance = 30f
val duration = 112L
+ val distanceText = distanceSpannable.toString()
mockLegProgress(routeProgress, distance, duration)
- val distanceSlot1 = slot()
- val distanceSlot2 = slot()
- every { collapsedViews.setTextViewText(any(), capture(distanceSlot1)) } just Runs
- every { expandedViews.setTextViewText(any(), capture(distanceSlot2)) } just Runs
mockUpdateNotificationAndroidInteractions()
notification.updateNotification(routeProgress)
- verify(exactly = 1) { collapsedViews.setTextViewText(any(), distanceSpannable) }
- verify(exactly = 1) { expandedViews.setTextViewText(any(), distanceSpannable) }
- assertEquals(distanceSpannable, distanceSlot1.captured)
- assertEquals(distanceSpannable, distanceSlot2.captured)
+ verify(exactly = 1) { collapsedViews.setTextViewText(any(), distanceText) }
+ verify(exactly = 1) { expandedViews.setTextViewText(any(), distanceText) }
}
@Test