aboutsummaryrefslogtreecommitdiff
path: root/androidApp/src/main/java/mx
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-01-15 20:22:57 -0600
committerIván Ávalos <avalos@disroot.org>2022-01-15 20:22:57 -0600
commit96050de8752321bc194c0611b2098ab8612b4b55 (patch)
tree3422808c473704d1db342b9dbf2b56c4a5bf3493 /androidApp/src/main/java/mx
parent0c5d42b212fcd19776d08b6df6a077629be963c3 (diff)
downloadetbsa-trackermap-mobile-96050de8752321bc194c0611b2098ab8612b4b55.tar.gz
etbsa-trackermap-mobile-96050de8752321bc194c0611b2098ab8612b4b55.tar.bz2
etbsa-trackermap-mobile-96050de8752321bc194c0611b2098ab8612b4b55.zip
Added tooltips to UnitsActivity buttons
Diffstat (limited to 'androidApp/src/main/java/mx')
-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)