diff --git a/app/src/main/java/com/aws/amazonlocation/ui/main/MainActivity.kt b/app/src/main/java/com/aws/amazonlocation/ui/main/MainActivity.kt
index b937fab7..0cdc8306 100644
--- a/app/src/main/java/com/aws/amazonlocation/ui/main/MainActivity.kt
+++ b/app/src/main/java/com/aws/amazonlocation/ui/main/MainActivity.kt
@@ -309,6 +309,10 @@ class MainActivity : BaseActivity(), CrashListener {
mBinding.bottomNavigationMain.selectedItemId = R.id.menu_geofence
}
+ fun getBottomNavHeight(): Int {
+ return mBinding.bottomNavigationMain.height
+ }
+
private fun initObserver() {
lifecycleScope.launchWhenStarted {
mSignInViewModel.mSignInResponse.collect { handleResult ->
diff --git a/app/src/main/java/com/aws/amazonlocation/ui/main/geofence/GeofenceUtils.kt b/app/src/main/java/com/aws/amazonlocation/ui/main/geofence/GeofenceUtils.kt
index 6e6a3fa0..81cc5ebf 100644
--- a/app/src/main/java/com/aws/amazonlocation/ui/main/geofence/GeofenceUtils.kt
+++ b/app/src/main/java/com/aws/amazonlocation/ui/main/geofence/GeofenceUtils.kt
@@ -38,14 +38,14 @@ import com.google.android.material.bottomsheet.BottomSheetBehavior
import com.mapbox.mapboxsdk.geometry.LatLng
import com.mapbox.mapboxsdk.maps.MapboxMap
import com.mapbox.mapboxsdk.plugins.annotation.OnSymbolDragListener
+import java.text.DecimalFormat
+import java.util.regex.Pattern
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.delay
import kotlinx.coroutines.flow.launchIn
import kotlinx.coroutines.flow.onEach
import kotlinx.coroutines.launch
-import java.text.DecimalFormat
-import java.util.regex.Pattern
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
@@ -566,7 +566,27 @@ class GeofenceUtils {
mBottomSheetGeofenceListBehavior?.isHideable = false
mBottomSheetGeofenceListBehavior?.isDraggable = true
mBottomSheetGeofenceListBehavior?.isFitToContents = false
- mBottomSheetGeofenceListBehavior?.halfExpandedRatio = 0.58f
+ mBindingGeofenceList?.clGeofenceList?.post {
+ val clEmptyGeofenceListInnerHeight =
+ mBindingGeofenceList?.clEmptyGeofenceListInner?.height ?: 0
+ val clEmptyGeofenceListHeight =
+ mBindingGeofenceList?.clGeofenceListMain?.height ?: 0
+ val clGeofenceListHeight =
+ mBindingGeofenceList?.clGeofenceList?.height ?: 0
+
+ val topLogoMargin = clEmptyGeofenceListHeight - clGeofenceListHeight
+ val screenHeight = (mActivity as MainActivity).resources.displayMetrics.heightPixels
+ val isTablet = (mActivity as MainActivity).isTablet
+ val bottomNavHeight = if (isTablet) (mActivity as MainActivity).getBottomNavHeight().toFloat() else 0f
+ val topLogoHeight = if (isTablet) 0f else topLogoMargin.toFloat()
+
+ val halfExpandedRatio = if (screenHeight.toFloat() != 0.toFloat()) {
+ ((clEmptyGeofenceListInnerHeight.toFloat() + bottomNavHeight + topLogoHeight)) / screenHeight
+ } else {
+ 0.55f
+ }
+ mBottomSheetGeofenceListBehavior?.halfExpandedRatio = halfExpandedRatio
+ }
mBindingGeofenceList?.clGeofenceList?.context?.let {
if ((mActivity as MainActivity).isTablet) {
mBottomSheetGeofenceListBehavior?.peekHeight = it.resources.getDimensionPixelSize(R.dimen.dp_150)
diff --git a/app/src/main/java/com/aws/amazonlocation/ui/main/tracking/TrackingUtils.kt b/app/src/main/java/com/aws/amazonlocation/ui/main/tracking/TrackingUtils.kt
index 0cf358eb..ecdc1516 100644
--- a/app/src/main/java/com/aws/amazonlocation/ui/main/tracking/TrackingUtils.kt
+++ b/app/src/main/java/com/aws/amazonlocation/ui/main/tracking/TrackingUtils.kt
@@ -121,7 +121,27 @@ class TrackingUtils(
TrackingEnum.ENABLE_TRACKING -> {
mBottomSheetTrackingBehavior?.isDraggable = true
mBottomSheetTrackingBehavior?.isFitToContents = false
- mBottomSheetTrackingBehavior?.halfExpandedRatio = 0.58f
+ mBindingTracking?.clTracking?.post {
+ val clEnableTrackingInnerHeight =
+ mBindingTracking?.clEnableTrackingInner?.height ?: 0
+ val clPersistentBottomSheetHeight =
+ mBindingTracking?.clPersistentBottomSheet?.height ?: 0
+ val clTrackingHeight =
+ mBindingTracking?.clTracking?.height ?: 0
+
+ val topLogoMargin = clPersistentBottomSheetHeight - clTrackingHeight
+ val screenHeight = (mActivity as MainActivity).resources.displayMetrics.heightPixels
+ val isTablet = (mActivity as MainActivity).isTablet
+ val bottomNavHeight = if (isTablet) (mActivity as MainActivity).getBottomNavHeight().toFloat() else 0f
+ val topLogoHeight = if (isTablet) 0f else topLogoMargin.toFloat()
+
+ val halfExpandedRatio = if (screenHeight.toFloat() != 0.toFloat()) {
+ ((clEnableTrackingInnerHeight.toFloat() + bottomNavHeight + topLogoHeight)) / screenHeight
+ } else {
+ 0.55f
+ }
+ mBottomSheetTrackingBehavior?.halfExpandedRatio = halfExpandedRatio
+ }
mBindingTracking?.clEnableTracking?.context?.let {
if ((activity as MainActivity).isTablet) {
mBottomSheetTrackingBehavior?.peekHeight = it.resources.getDimensionPixelSize(R.dimen.dp_150)
@@ -162,11 +182,19 @@ class TrackingUtils(
trackingHistoryData.clear()
getCurrentDateData()
+ val clTracking = mBindingTracking?.clTracking?.height ?: 0
+ val clPersistentBottomSheetHeight = mBindingTracking?.clPersistentBottomSheet?.height ?: 0
+ val clTrackingInnerHeight = mBindingTracking?.clTrackingInner?.height ?: 0
+ val totalHeight = (clPersistentBottomSheetHeight - clTracking) + clTrackingInnerHeight
+ mBottomSheetTrackingBehavior?.peekHeight = totalHeight
+
mBottomSheetTrackingBehavior?.isDraggable = true
if ((activity as MainActivity).isTablet) {
- mBottomSheetTrackingBehavior?.peekHeight = clTracking.context.resources.getDimensionPixelSize(R.dimen.dp_150)
+ mBottomSheetTrackingBehavior?.peekHeight =
+ totalHeight
} else {
- mBottomSheetTrackingBehavior?.peekHeight = clTracking.context.resources.getDimensionPixelSize(R.dimen.dp_127)
+ mBottomSheetTrackingBehavior?.peekHeight =
+ totalHeight
}
mBottomSheetTrackingBehavior?.state = BottomSheetBehavior.STATE_HALF_EXPANDED
}
diff --git a/app/src/main/res/layout-sw600dp-land/bottom_sheet_tracking.xml b/app/src/main/res/layout-sw600dp-land/bottom_sheet_tracking.xml
index ae31eb74..87aefc90 100644
--- a/app/src/main/res/layout-sw600dp-land/bottom_sheet_tracking.xml
+++ b/app/src/main/res/layout-sw600dp-land/bottom_sheet_tracking.xml
@@ -24,94 +24,102 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
-
+ app:layout_constraintTop_toTopOf="parent">
-
-
-
+
-
+ android:textSize="@dimen/sp_20"
+ app:layout_constraintEnd_toStartOf="@+id/card_start_tracking"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/view_tracking" />
-
-
+ android:layout_marginStart="@dimen/dp_16"
+ android:layout_marginEnd="@dimen/dp_14"
+ android:gravity="start"
+ android:text="@string/label_not_tracking_your_activity"
+ android:textColor="@color/color_hint_text"
+ android:textDirection="locale"
+ android:textSize="@dimen/sp_13"
+ app:layout_constraintEnd_toStartOf="@+id/card_start_tracking"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/tv_tracking_history" />
+
+
+
+
+
+
+
+
+ app:layout_constraintTop_toBottomOf="@id/cl_tracking_inner">
-
-
-
+ app:layout_constraintTop_toTopOf="parent">
-
+ android:layout_height="@dimen/dp_5"
+ android:layout_gravity="bottom|center"
+ android:layout_marginTop="@dimen/dp_10"
+ android:background="@drawable/bottom_sheet_view"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
-
+
-
+
-
+
-
+
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/tv_add_geofence_empty" />
-
+
-
+
+
+
+
+
+
+
+
+
-
-
-
-
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/btn_enable_tracking" />
+
diff --git a/app/src/main/res/layout-sw600dp/bottom_sheet_geofence_list.xml b/app/src/main/res/layout-sw600dp/bottom_sheet_geofence_list.xml
index 08ca6c87..f1c6bc7b 100644
--- a/app/src/main/res/layout-sw600dp/bottom_sheet_geofence_list.xml
+++ b/app/src/main/res/layout-sw600dp/bottom_sheet_geofence_list.xml
@@ -18,7 +18,6 @@
android:background="@drawable/bottom_sheet_top_corner_curved_geofence"
android:clickable="true"
android:focusable="true"
- android:layout_marginTop="@dimen/dp_20"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@@ -251,149 +250,158 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent">
-
-
-
-
-
-
-
-
-
+ app:layout_constraintTop_toTopOf="parent">
-
+
-
+
-
+
+
+
-
-
-
-
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/sheet_geofence_list_card_geo_fence" />
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/tv_add_geofence_empty_geofence_list" />
-
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout-sw600dp/bottom_sheet_tracking.xml b/app/src/main/res/layout-sw600dp/bottom_sheet_tracking.xml
index 1fb257ec..f3e48f76 100644
--- a/app/src/main/res/layout-sw600dp/bottom_sheet_tracking.xml
+++ b/app/src/main/res/layout-sw600dp/bottom_sheet_tracking.xml
@@ -24,94 +24,103 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
-
+ app:layout_constraintTop_toTopOf="parent">
-
-
-
+
-
+ android:textSize="@dimen/sp_20"
+ app:layout_constraintEnd_toStartOf="@+id/card_start_tracking"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/view_tracking" />
-
-
+ android:layout_marginStart="@dimen/dp_16"
+ android:layout_marginEnd="@dimen/dp_14"
+ android:gravity="start"
+ android:text="@string/label_not_tracking_your_activity"
+ android:textColor="@color/color_hint_text"
+ android:textDirection="locale"
+ android:textSize="@dimen/sp_13"
+ app:layout_constraintEnd_toStartOf="@+id/card_start_tracking"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/tv_tracking_history" />
+
+
+
+
+
+
+
+
+ app:layout_constraintTop_toBottomOf="@id/cl_tracking_inner">
-
-
-
+ app:layout_constraintTop_toTopOf="parent">
-
-
-
+ android:layout_height="@dimen/dp_5"
+ android:layout_gravity="bottom|center"
+ android:layout_marginTop="@dimen/dp_10"
+ android:background="@drawable/bottom_sheet_view"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
-
+
-
+
-
+
+
+
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/tv_add_geofence_empty" />
-
+
-
+
+
+
+
+
+
+
+
+
-
-
-
-
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/btn_enable_tracking" />
+
diff --git a/app/src/main/res/layout-sw720dp-land/bottom_sheet_tracking.xml b/app/src/main/res/layout-sw720dp-land/bottom_sheet_tracking.xml
index cd83aff8..87aefc90 100644
--- a/app/src/main/res/layout-sw720dp-land/bottom_sheet_tracking.xml
+++ b/app/src/main/res/layout-sw720dp-land/bottom_sheet_tracking.xml
@@ -24,93 +24,102 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
-
+ app:layout_constraintTop_toTopOf="parent">
-
-
-
+
-
+ android:textSize="@dimen/sp_20"
+ app:layout_constraintEnd_toStartOf="@+id/card_start_tracking"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/view_tracking" />
-
-
+ android:layout_marginStart="@dimen/dp_16"
+ android:layout_marginEnd="@dimen/dp_14"
+ android:gravity="start"
+ android:text="@string/label_not_tracking_your_activity"
+ android:textColor="@color/color_hint_text"
+ android:textDirection="locale"
+ android:textSize="@dimen/sp_13"
+ app:layout_constraintEnd_toStartOf="@+id/card_start_tracking"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/tv_tracking_history" />
+
+
+
+
+
+
+
+
+ app:layout_constraintTop_toBottomOf="@id/cl_tracking_inner">
-
-
-
+ app:layout_constraintTop_toTopOf="parent">
-
+ android:layout_height="@dimen/dp_5"
+ android:layout_gravity="bottom|center"
+ android:layout_marginTop="@dimen/dp_10"
+ android:background="@drawable/bottom_sheet_view"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
-
+
-
+
-
+
-
+
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/tv_add_geofence_empty" />
-
+
-
+
+
+
+
+
+
+
+
+
-
-
-
-
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/btn_enable_tracking" />
+
diff --git a/app/src/main/res/layout-sw720dp/bottom_sheet_geofence_list.xml b/app/src/main/res/layout-sw720dp/bottom_sheet_geofence_list.xml
index 171d11f9..01a47244 100644
--- a/app/src/main/res/layout-sw720dp/bottom_sheet_geofence_list.xml
+++ b/app/src/main/res/layout-sw720dp/bottom_sheet_geofence_list.xml
@@ -18,7 +18,6 @@
android:background="@drawable/bottom_sheet_top_corner_curved_geofence"
android:clickable="true"
android:focusable="true"
- android:layout_marginTop="@dimen/dp_20"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@@ -250,148 +249,157 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toTopOf="parent">
-
-
-
-
-
-
-
-
-
+ app:layout_constraintTop_toTopOf="parent">
-
+
-
+
-
+
+
+
-
-
-
-
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/sheet_geofence_list_card_geo_fence" />
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/tv_add_geofence_empty_geofence_list" />
-
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/src/main/res/layout-sw720dp/bottom_sheet_tracking.xml b/app/src/main/res/layout-sw720dp/bottom_sheet_tracking.xml
index cd83aff8..87aefc90 100644
--- a/app/src/main/res/layout-sw720dp/bottom_sheet_tracking.xml
+++ b/app/src/main/res/layout-sw720dp/bottom_sheet_tracking.xml
@@ -24,93 +24,102 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
-
+ app:layout_constraintTop_toTopOf="parent">
-
-
-
+
-
+ android:textSize="@dimen/sp_20"
+ app:layout_constraintEnd_toStartOf="@+id/card_start_tracking"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/view_tracking" />
-
-
+ android:layout_marginStart="@dimen/dp_16"
+ android:layout_marginEnd="@dimen/dp_14"
+ android:gravity="start"
+ android:text="@string/label_not_tracking_your_activity"
+ android:textColor="@color/color_hint_text"
+ android:textDirection="locale"
+ android:textSize="@dimen/sp_13"
+ app:layout_constraintEnd_toStartOf="@+id/card_start_tracking"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/tv_tracking_history" />
+
+
+
+
+
+
+
+
+ app:layout_constraintTop_toBottomOf="@id/cl_tracking_inner">
-
-
-
+ app:layout_constraintTop_toTopOf="parent">
-
+ android:layout_height="@dimen/dp_5"
+ android:layout_gravity="bottom|center"
+ android:layout_marginTop="@dimen/dp_10"
+ android:background="@drawable/bottom_sheet_view"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
-
+
-
+
-
+
-
+
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/tv_add_geofence_empty" />
-
+
-
+
+
+
+
+
+
+
+
+
-
-
-
-
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/btn_enable_tracking" />
+
diff --git a/app/src/main/res/layout/bottom_sheet_geofence_list.xml b/app/src/main/res/layout/bottom_sheet_geofence_list.xml
index 07d45d60..fd19f294 100644
--- a/app/src/main/res/layout/bottom_sheet_geofence_list.xml
+++ b/app/src/main/res/layout/bottom_sheet_geofence_list.xml
@@ -270,147 +270,158 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/img_amazon_logo_geofence_list">
-
-
-
-
-
-
-
-
-
+ app:layout_constraintTop_toTopOf="parent">
-
+
-
+
-
+
+
+
+
+
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/tv_add_geofence_empty_geofence_list" />
-
+
+
+
-
+
+
+
+
+
+
+
+
+
-
-
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/btn_add_geofence" />
-
+
diff --git a/app/src/main/res/layout/bottom_sheet_tracking.xml b/app/src/main/res/layout/bottom_sheet_tracking.xml
index b414df84..73df6af4 100644
--- a/app/src/main/res/layout/bottom_sheet_tracking.xml
+++ b/app/src/main/res/layout/bottom_sheet_tracking.xml
@@ -45,92 +45,102 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/img_amazon_logo_tracking_sheet">
-
+ app:layout_constraintTop_toTopOf="parent">
-
-
-
+
-
+ android:layout_width="@dimen/dp_0"
+ android:layout_height="wrap_content"
+ android:layout_marginStart="@dimen/dp_16"
+ android:layout_marginTop="@dimen/dp_20"
+ android:gravity="start"
+ android:text="@string/label_tracking_history"
+ android:textColor="@color/color_medium_black"
+ android:textDirection="locale"
+ android:textSize="@dimen/sp_20"
+ app:layout_constraintEnd_toStartOf="@+id/card_start_tracking"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/view_tracking" />
-
-
+ android:layout_marginStart="@dimen/dp_16"
+ android:layout_marginEnd="@dimen/dp_14"
+ android:gravity="start"
+ android:text="@string/label_not_tracking_your_activity"
+ android:textColor="@color/color_hint_text"
+ android:textDirection="locale"
+ android:textSize="@dimen/sp_13"
+ app:layout_constraintEnd_toStartOf="@+id/card_start_tracking"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@+id/tv_tracking_history" />
+
+
+
+
+
+
+
+
+ app:layout_constraintTop_toBottomOf="@id/cl_tracking_inner">
-
-
-
+ app:layout_constraintTop_toTopOf="parent">
-
+ android:layout_height="@dimen/dp_5"
+ android:layout_gravity="bottom|center"
+ android:layout_marginTop="@dimen/dp_10"
+ android:background="@drawable/bottom_sheet_view"
+ app:layout_constraintEnd_toEndOf="parent"
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toTopOf="parent" />
-
+
-
+
-
+
-
+
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/tv_add_geofence_empty" />
-
+
-
+
+
+
+
+
+
+
+
+
-
-
-
-
+ app:layout_constraintStart_toStartOf="parent"
+ app:layout_constraintTop_toBottomOf="@id/btn_enable_tracking" />
+