aboutsummaryrefslogtreecommitdiff
path: root/androidApp/src
diff options
context:
space:
mode:
Diffstat (limited to 'androidApp/src')
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/units/UnitsActivity.kt22
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)