aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-01-13 01:13:44 -0600
committerIván Ávalos <avalos@disroot.org>2022-01-13 01:13:44 -0600
commit561f3e19b6fbcfcca3fd568dde8793d9fbfd0aa5 (patch)
tree7d444b4f20a4033f4052da303f143393a836be7b
parent0e510cb187d61f4c0baf378a2dd4059ce9698ffa (diff)
downloadetbsa-trackermap-mobile-561f3e19b6fbcfcca3fd568dde8793d9fbfd0aa5.tar.gz
etbsa-trackermap-mobile-561f3e19b6fbcfcca3fd568dde8793d9fbfd0aa5.tar.bz2
etbsa-trackermap-mobile-561f3e19b6fbcfcca3fd568dde8793d9fbfd0aa5.zip
Enable user input on DetailsActivity only for details and commands tabs
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/DetailsActivity.kt14
1 files changed, 13 insertions, 1 deletions
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/DetailsActivity.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/DetailsActivity.kt
index 504cac8..0b0313b 100644
--- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/DetailsActivity.kt
+++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/DetailsActivity.kt
@@ -3,6 +3,7 @@ package mx.trackermap.TrackerMap.android.details
import android.os.Bundle
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
+import com.google.android.material.tabs.TabLayout
import com.google.android.material.tabs.TabLayoutMediator
import mx.trackermap.TrackerMap.android.R
import mx.trackermap.TrackerMap.android.databinding.DetailsActivityBinding
@@ -57,6 +58,17 @@ class DetailsActivity : AppCompatActivity() {
else -> 2
}, false
)
- binding.detailsPager.isUserInputEnabled = false
+ binding.detailsTabs.addOnTabSelectedListener(object: TabLayout.OnTabSelectedListener {
+ override fun onTabSelected(tab: TabLayout.Tab?) {
+ binding.detailsPager.isUserInputEnabled =
+ when (tab?.position) {
+ 0 -> true
+ 1 -> false
+ else -> true
+ }
+ }
+ override fun onTabUnselected(tab: TabLayout.Tab?) {}
+ override fun onTabReselected(tab: TabLayout.Tab?) {}
+ })
}
} \ No newline at end of file