aboutsummaryrefslogtreecommitdiff
path: root/androidApp/src/main/java
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
commit9dd1ca6b987af2fb6838311a65cfdd69b07d117d (patch)
tree3422808c473704d1db342b9dbf2b56c4a5bf3493 /androidApp/src/main/java
parent081d26c8c44cd81f53795ad34eeddca022850d16 (diff)
downloadetbsa-trackermap-mobile-9dd1ca6b987af2fb6838311a65cfdd69b07d117d.tar.gz
etbsa-trackermap-mobile-9dd1ca6b987af2fb6838311a65cfdd69b07d117d.tar.bz2
etbsa-trackermap-mobile-9dd1ca6b987af2fb6838311a65cfdd69b07d117d.zip
Added tooltips to UnitsActivity buttons
Diffstat (limited to 'androidApp/src/main/java')
-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)