diff options
Diffstat (limited to 'androidApp/src/main/java/mx/trackermap')
3 files changed, 10 insertions, 9 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) |