diff options
7 files changed, 40 insertions, 11 deletions
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/DevicesFragment.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/DevicesFragment.kt index 933316a..eb8dcbc 100644 --- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/DevicesFragment.kt +++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/DevicesFragment.kt @@ -28,6 +28,7 @@ class DevicesFragment : Fragment() { container: ViewGroup?, savedInstanceState: Bundle? ): View { + super.onCreateView(inflater, container, savedInstanceState) _binding = DevicesFragmentBinding.inflate(inflater, container, false) return binding.root } diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt index f0ec769..289cc2d 100644 --- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt +++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/map/MapFragment.kt @@ -19,8 +19,6 @@ import java.io.File @DelicateCoroutinesApi class MapFragment: GlobeMapFragment() { - private var _binding: MapFragmentBinding? = null - private val binding get() = _binding!! private val unitsViewModel: UnitsViewModel by viewModel() @@ -64,11 +62,6 @@ class MapFragment: GlobeMapFragment() { mapControl.animatePositionGeo(longitude, latitude, zoom, 1.0) } - override fun onDestroyView() { - super.onDestroyView() - _binding = null - } - override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) @@ -133,7 +126,7 @@ class MapFragment: GlobeMapFragment() { val latitude = position.latitude!! * Math.PI / 180 val longitude = position.longitude!! * Math.PI / 180 val zoom = 0.000008 - mapControl.animatePositionGeo(longitude, latitude, zoom, 1.0) + mapControl.setPositionGeo(longitude, latitude, zoom) } } } diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt index 452ece7..ff8929e 100644 --- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt +++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt @@ -66,12 +66,19 @@ class UnitsActivity : AppCompatActivity() { else -> R.drawable.ic_baseline_map_24 } ) + binding.displayModeToggle.contentDescription = getString( + when (displayMode) { + UnitsViewModel.UnitsDisplayMode.LIST -> R.string.toggle_map + UnitsViewModel.UnitsDisplayMode.MAP -> R.string.toggle_list + else -> R.string.toggle_map + } + ) val newFragment = when (displayMode) { UnitsViewModel.UnitsDisplayMode.LIST -> devicesFragment UnitsViewModel.UnitsDisplayMode.MAP -> mapFragment - else -> DevicesFragment() + else -> devicesFragment } supportFragmentManager.commit { replace(R.id.displayContainer, newFragment) diff --git a/androidApp/src/main/res/drawable/ic_baseline_menu_24.xml b/androidApp/src/main/res/drawable/ic_baseline_menu_24.xml new file mode 100644 index 0000000..4350ba9 --- /dev/null +++ b/androidApp/src/main/res/drawable/ic_baseline_menu_24.xml @@ -0,0 +1,10 @@ +<vector xmlns:android="http://schemas.android.com/apk/res/android" + android:width="24dp" + android:height="24dp" + android:viewportWidth="24" + android:viewportHeight="24" + android:tint="?attr/colorControlNormal"> + <path + android:fillColor="@android:color/white" + android:pathData="M3,18h18v-2L3,16v2zM3,13h18v-2L3,11v2zM3,6v2h18L21,6L3,6z"/> +</vector> diff --git a/androidApp/src/main/res/layout/units_activity.xml b/androidApp/src/main/res/layout/units_activity.xml index f0d80ab..bff3789 100644 --- a/androidApp/src/main/res/layout/units_activity.xml +++ b/androidApp/src/main/res/layout/units_activity.xml @@ -1,6 +1,7 @@ <?xml version="1.0" encoding="utf-8"?> <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" + xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto"> @@ -26,7 +27,9 @@ app:fabSize="mini" android:layout_marginStart="@dimen/fab_margin" android:layout_marginTop="@dimen/fab_margin" - app:elevation="@dimen/fab_elevation"/> + app:elevation="@dimen/fab_elevation" + android:src="@drawable/ic_baseline_menu_24" + android:contentDescription="@string/open_drawer"/> <com.google.android.material.card.MaterialCardView android:layout_width="0dp" @@ -64,6 +67,7 @@ app:fabSize="mini" android:layout_marginEnd="@dimen/fab_margin" android:layout_marginTop="@dimen/fab_margin" - app:elevation="@dimen/fab_elevation"/> + app:elevation="@dimen/fab_elevation" + tools:ignore="ContentDescription" /> </androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/androidApp/src/main/res/values-es-rMX/strings.xml b/androidApp/src/main/res/values-es-rMX/strings.xml index 0da9947..69ca1a8 100644 --- a/androidApp/src/main/res/values-es-rMX/strings.xml +++ b/androidApp/src/main/res/values-es-rMX/strings.xml @@ -7,6 +7,11 @@ <string name="login_password">Contraseña</string> <string name="login_login">Iniciar sesión</string> + <!-- UnitsActivity --> + <string name="toggle_list">Cambiar a lista de dispositivos</string> + <string name="toggle_map">Cambiar a mapa</string> + <string name="open_drawer">Abrir menú lateral</string> + <!-- Unit Item --> <string name="unit_status_on">Estatus encendido</string> <string name="unit_status_off">Estatus apagado</string> @@ -23,4 +28,7 @@ <string name="unit_reports">Reportes</string> <string name="unit_commands">Comandos</string> <string name="units_search">Escribe para buscar</string> + + <string name="key">Key</string> + <string name="value">Value</string> </resources>
\ No newline at end of file diff --git a/androidApp/src/main/res/values/strings.xml b/androidApp/src/main/res/values/strings.xml index 5692688..d68c68c 100644 --- a/androidApp/src/main/res/values/strings.xml +++ b/androidApp/src/main/res/values/strings.xml @@ -7,6 +7,11 @@ <string name="login_password">Password</string> <string name="login_login">Login</string> + <!-- UnitsActivity --> + <string name="toggle_list">Switch to device list</string> + <string name="toggle_map">Switch to map</string> + <string name="open_drawer">Open drawer menu</string> + <!-- Unit Item --> <string name="unit_status_on">Status on</string> <string name="unit_status_off">Status off</string> @@ -23,6 +28,7 @@ <string name="unit_reports">Reports</string> <string name="unit_commands">Commands</string> <string name="units_search">Type to search</string> + <string name="key">Key</string> <string name="value">Value</string> </resources>
\ No newline at end of file |