diff options
author | Iván Ávalos <avalos@disroot.org> | 2021-12-16 03:21:32 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2021-12-16 03:21:32 -0600 |
commit | 323e94c3a3852c63ebe00e8448f3611b59b39b97 (patch) | |
tree | 734309bb1e131b4aaea46013c81addcf44715872 /androidApp/src/main/java/mx/trackermap/TrackerMap/android/units | |
parent | f05e413fc925be4ac225c05b49bc0b8930af9e10 (diff) | |
download | etbsa-trackermap-mobile-323e94c3a3852c63ebe00e8448f3611b59b39b97.tar.gz etbsa-trackermap-mobile-323e94c3a3852c63ebe00e8448f3611b59b39b97.tar.bz2 etbsa-trackermap-mobile-323e94c3a3852c63ebe00e8448f3611b59b39b97.zip |
Added icon for displayModeToggle according to displayMode
Diffstat (limited to 'androidApp/src/main/java/mx/trackermap/TrackerMap/android/units')
-rw-r--r-- | androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt | 11 |
1 files changed, 11 insertions, 0 deletions
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 2be6da3..ea40d91 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 @@ -5,12 +5,14 @@ import android.util.Log import androidx.appcompat.app.AppCompatActivity import androidx.core.widget.doAfterTextChanged import androidx.fragment.app.commit +import kotlinx.coroutines.DelicateCoroutinesApi import mx.trackermap.TrackerMap.android.R import mx.trackermap.TrackerMap.android.databinding.UnitsActivityBinding import mx.trackermap.TrackerMap.android.devices.DevicesFragment import mx.trackermap.TrackerMap.android.map.MapFragment import org.koin.androidx.viewmodel.ext.android.viewModel +@DelicateCoroutinesApi class UnitsActivity : AppCompatActivity() { private var _binding: UnitsActivityBinding? = null @@ -54,10 +56,19 @@ class UnitsActivity : AppCompatActivity() { private fun setupObservers() { unitsViewModel.unitsDisplayMode.observe(this) { displayMode -> + binding.displayModeToggle.setImageResource( + when (displayMode) { + UnitsViewModel.UnitsDisplayMode.LIST -> R.drawable.ic_baseline_map_24 + UnitsViewModel.UnitsDisplayMode.MAP -> R.drawable.ic_baseline_list_24 + else -> R.drawable.ic_baseline_map_24 + } + ) + val newFragment = when (displayMode) { UnitsViewModel.UnitsDisplayMode.LIST -> DevicesFragment() UnitsViewModel.UnitsDisplayMode.MAP -> MapFragment() + else -> DevicesFragment() } supportFragmentManager.commit { replace(R.id.displayContainer, newFragment) |