diff options
author | Iván Ávalos <avalos@disroot.org> | 2022-01-15 20:23:10 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2022-01-15 20:23:10 -0600 |
commit | 51d42034f00cc640ff94c06333e2354c8e440a3f (patch) | |
tree | 089128c953ff731b7b2b6db1670d6b96ba8b958c /androidApp/src/main/java | |
parent | f7d5ddf4ee3dade43e627c57b9024e11330de02e (diff) | |
parent | 9dd1ca6b987af2fb6838311a65cfdd69b07d117d (diff) | |
download | etbsa-trackermap-mobile-51d42034f00cc640ff94c06333e2354c8e440a3f.tar.gz etbsa-trackermap-mobile-51d42034f00cc640ff94c06333e2354c8e440a3f.tar.bz2 etbsa-trackermap-mobile-51d42034f00cc640ff94c06333e2354c8e440a3f.zip |
Merge branch 'main' of https://git.sr.ht/~avalos/trackermap-mobile
Diffstat (limited to 'androidApp/src/main/java')
-rw-r--r-- | androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt | 22 |
1 files changed, 18 insertions, 4 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 94e8a57..bf5f1d8 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 @@ -8,6 +8,7 @@ import android.view.View import android.view.inputmethod.InputMethodManager import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.widget.PopupMenu +import androidx.appcompat.widget.TooltipCompat import androidx.core.widget.doAfterTextChanged import androidx.fragment.app.commit import kotlinx.coroutines.DelicateCoroutinesApi @@ -38,6 +39,7 @@ class UnitsActivity : AppCompatActivity() { _binding = UnitsActivityBinding.inflate(layoutInflater) setContentView(binding.root) + setupViews() setupEvents() } @@ -58,6 +60,11 @@ class UnitsActivity : AppCompatActivity() { _binding = null } + private fun setupViews() { + TooltipCompat.setTooltipText(binding.userButton, getString(R.string.open_profile)) + TooltipCompat.setTooltipText(binding.mapLayerToggle, getString(R.string.switch_layer)) + } + private fun setupEvents() { binding.userButton.setOnClickListener { val intent = Intent(applicationContext, UserInformationActivity::class.java) @@ -110,29 +117,36 @@ class UnitsActivity : AppCompatActivity() { when (displayMode) { UnitsViewModel.UnitsDisplayMode.LIST -> R.drawable.icon_map UnitsViewModel.UnitsDisplayMode.MAP -> R.drawable.icon_list - else -> R.drawable.icon_map + else -> R.drawable.icon_list } ) 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 + else -> R.string.toggle_list } ) + TooltipCompat.setTooltipText(binding.displayModeToggle, + getString(when (displayMode) { + UnitsViewModel.UnitsDisplayMode.LIST -> R.string.toggle_map + UnitsViewModel.UnitsDisplayMode.MAP -> R.string.toggle_list + else -> R.string.toggle_list + }) + ) binding.mapLayerToggle.visibility = when (displayMode) { UnitsViewModel.UnitsDisplayMode.LIST -> View.GONE UnitsViewModel.UnitsDisplayMode.MAP -> View.VISIBLE - else -> View.GONE + else -> View.VISIBLE } val newFragment = when (displayMode) { UnitsViewModel.UnitsDisplayMode.LIST -> devicesFragment UnitsViewModel.UnitsDisplayMode.MAP -> mapFragment - else -> devicesFragment + else -> mapFragment } supportFragmentManager.commit { replace(R.id.displayContainer, newFragment) |