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 | abad322fd50b21fb102ddd539ace6fcc0f8ff2b4 (patch) | |
tree | b0becc8aa1559777ac198f4086c8866281640cfa /androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt | |
parent | a57288f84650227459eed2aa6572cd0447f3278e (diff) | |
download | etbsa-trackermap-mobile-abad322fd50b21fb102ddd539ace6fcc0f8ff2b4.tar.gz etbsa-trackermap-mobile-abad322fd50b21fb102ddd539ace6fcc0f8ff2b4.tar.bz2 etbsa-trackermap-mobile-abad322fd50b21fb102ddd539ace6fcc0f8ff2b4.zip |
Added icon for displayModeToggle according to displayMode
Diffstat (limited to 'androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt')
-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) |