From 0650761584d66991fe5dd5114939ab14ec70feb0 Mon Sep 17 00:00:00 2001 From: Isidro Henoch Date: Sun, 2 Jan 2022 16:14:50 -0600 Subject: Disables tab layout swipe gestures on the details activity --- .../TrackerMap/android/details/DetailsActivity.kt | 19 ++++++++++++------- androidApp/src/main/res/layout/details_activity.xml | 14 +++++++------- .../src/main/res/layout/unit_details_reports.xml | 19 ++++++++++--------- 3 files changed, 29 insertions(+), 23 deletions(-) (limited to 'androidApp/src') 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 12ab79e..07a7b05 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 @@ -7,13 +7,15 @@ import com.google.android.material.tabs.TabLayoutMediator import mx.trackermap.TrackerMap.android.databinding.DetailsActivityBinding import mx.trackermap.TrackerMap.android.devices.Action -class DetailsActivity: AppCompatActivity() { +class DetailsActivity : AppCompatActivity() { + private var _binding: DetailsActivityBinding? = null private val binding get() = _binding!! private lateinit var adapter: UnitDetailsAdapter private var deviceId: Int = 0 companion object { + val DEVICE_ID_EXTRA = "device_id" val ACTION_EXTRA = "action" } @@ -42,16 +44,19 @@ class DetailsActivity: AppCompatActivity() { adapter = UnitDetailsAdapter(this, deviceId) binding.detailsPager.adapter = adapter TabLayoutMediator(binding.detailsTabs, binding.detailsPager) { tab, position -> - tab.text = when(position) { + tab.text = when (position) { 0 -> "Details" 1 -> "Reports" else -> "Commands" } }.attach() - binding.detailsPager.setCurrentItem(when(initialSection) { - Action.DETAILS -> 0 - Action.REPORTS -> 1 - else -> 2 - }, false) + binding.detailsPager.setCurrentItem( + when (initialSection) { + Action.DETAILS -> 0 + Action.REPORTS -> 1 + else -> 2 + }, false + ) + binding.detailsPager.isUserInputEnabled = false } } \ No newline at end of file diff --git a/androidApp/src/main/res/layout/details_activity.xml b/androidApp/src/main/res/layout/details_activity.xml index 00ebdbf..f79ea69 100644 --- a/androidApp/src/main/res/layout/details_activity.xml +++ b/androidApp/src/main/res/layout/details_activity.xml @@ -1,25 +1,25 @@ + android:layout_height="match_parent"> + app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toBottomOf="@id/detailsTabs" /> \ No newline at end of file diff --git a/androidApp/src/main/res/layout/unit_details_reports.xml b/androidApp/src/main/res/layout/unit_details_reports.xml index e39f279..cf3c7b2 100644 --- a/androidApp/src/main/res/layout/unit_details_reports.xml +++ b/androidApp/src/main/res/layout/unit_details_reports.xml @@ -9,31 +9,32 @@ android:id="@+id/reportMap" android:layout_width="0dp" android:layout_height="0dp" + android:layout_margin="@dimen/margin" + android:background="@color/darkBackground" + android:visibility="gone" app:layout_constraintBottom_toTopOf="@id/periodSection" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintStart_toStartOf="parent" - app:layout_constraintTop_toTopOf="parent" - android:layout_margin="@dimen/margin" - android:visibility="gone" - android:background="@color/darkBackground"/> + app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintTop_toTopOf="parent"> + + android:stretchColumns="*"> -- cgit v1.2.3