diff options
author | Iván Ávalos <avalos@disroot.org> | 2021-12-30 18:13:49 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2021-12-30 18:13:49 -0600 |
commit | 512e01c0ca36b336b3dc6437c6fb326614d020d0 (patch) | |
tree | 9c999cde5cfda6048896b544e6486df8901c7a26 /androidApp/src/main/java/mx/trackermap/TrackerMap/android | |
parent | 10e78b9e0311485982711857826ffa79e0d869f4 (diff) | |
download | etbsa-trackermap-mobile-512e01c0ca36b336b3dc6437c6fb326614d020d0.tar.gz etbsa-trackermap-mobile-512e01c0ca36b336b3dc6437c6fb326614d020d0.tar.bz2 etbsa-trackermap-mobile-512e01c0ca36b336b3dc6437c6fb326614d020d0.zip |
Accessibility fixes and removed bindings from MapFragment
Diffstat (limited to 'androidApp/src/main/java/mx/trackermap/TrackerMap/android')
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) |