diff options
author | Iván Ávalos <avalos@disroot.org> | 2022-01-13 01:01:54 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2022-01-13 01:01:54 -0600 |
commit | 74aa997702a4315b574c5ee49cf0404ed8df7d0d (patch) | |
tree | df1db221d2b43e6b85d755316812bbdec34e27fe /androidApp/src/main | |
parent | 537b1553b53f79e1b0ab437ddc00b4a1fe34daa7 (diff) | |
download | etbsa-trackermap-mobile-74aa997702a4315b574c5ee49cf0404ed8df7d0d.tar.gz etbsa-trackermap-mobile-74aa997702a4315b574c5ee49cf0404ed8df7d0d.tar.bz2 etbsa-trackermap-mobile-74aa997702a4315b574c5ee49cf0404ed8df7d0d.zip |
Implemented ProgressBar for UnitInformationFragment
Diffstat (limited to 'androidApp/src/main')
5 files changed, 26 insertions, 37 deletions
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/information/UnitInformationFragment.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/information/UnitInformationFragment.kt index f5a1e13..dd8e202 100644 --- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/information/UnitInformationFragment.kt +++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/information/UnitInformationFragment.kt @@ -53,6 +53,7 @@ class UnitInformationFragment : Fragment() { private fun setupObservers() { unitInformationViewModel.unit.observe(viewLifecycleOwner) { unitInformation -> Log.d("UnitInformationFragment", "Unit Information Fetched - $unitInformation") + binding.reportLoading.visibility = View.GONE unitInformation?.let { displayInformation(it) } @@ -62,6 +63,7 @@ class UnitInformationFragment : Fragment() { private fun fetchInformation() { val id = arguments?.getInt(UnitDetailsAdapter.DEVICE_ID_ARG) unitInformationViewModel.fetchUnit(id ?: 0) + binding.reportLoading.visibility = View.VISIBLE } private fun displayInformation(unit: UnitInformation) { diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/DevicesAdapter.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/DevicesAdapter.kt index e1ccd0a..d42a8aa 100644 --- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/DevicesAdapter.kt +++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/DevicesAdapter.kt @@ -1,24 +1,10 @@ package mx.trackermap.TrackerMap.android.devices -import android.graphics.Color -import android.util.Size -import android.util.TypedValue -import android.view.Gravity import android.view.LayoutInflater -import android.view.View import android.view.ViewGroup -import android.widget.GridLayout -import android.widget.ImageView -import android.widget.LinearLayout -import android.widget.TextView -import androidx.core.content.ContextCompat import androidx.recyclerview.widget.RecyclerView -import com.mousebird.maply.ImageLoaderInterpreter -import mx.trackermap.TrackerMap.android.R import mx.trackermap.TrackerMap.android.databinding.UnitItemBinding -import mx.trackermap.TrackerMap.utils.Formatter import mx.trackermap.TrackerMap.client.models.UnitInformation -import mx.trackermap.TrackerMap.utils.SpeedUnit enum class Action { CLICK, DETAILS, REPORTS, COMMANDS @@ -46,7 +32,6 @@ class DevicesAdapter( engineStopIcon = engineStopIcon, gridLayout = gridLayout, detailsButton = detailsButton, - reportsButton = reportsButton, commandsButton = commandsButton, unitCard = unitCard, swipeLayout = swipeLayout diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/UnitRenderData.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/UnitRenderData.kt index f9b7a27..39ef472 100644 --- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/UnitRenderData.kt +++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/devices/UnitRenderData.kt @@ -25,9 +25,9 @@ class UnitRenderData { val statusIcon: ImageView, val engineStopIcon: ImageView, val gridLayout: GridLayout, - val detailsButton: Button, - val reportsButton: Button, - val commandsButton: Button, + val detailsButton: Button? = null, + val reportsButton: Button? = null, + val commandsButton: Button? = null, val unitCard: CardView? = null, val swipeLayout: SwipeLayout? = null ) @@ -175,15 +175,15 @@ class UnitRenderData { swipeLayout?.close() callback(unit, Action.CLICK) } - detailsButton.setOnClickListener { + detailsButton?.setOnClickListener { swipeLayout?.close() callback(unit, Action.DETAILS) } - reportsButton.setOnClickListener { + reportsButton?.setOnClickListener { swipeLayout?.close() callback(unit, Action.REPORTS) } - commandsButton.setOnClickListener { + commandsButton?.setOnClickListener { swipeLayout?.close() callback(unit, Action.COMMANDS) } diff --git a/androidApp/src/main/res/layout/unit_details_information.xml b/androidApp/src/main/res/layout/unit_details_information.xml index 24f792c..422b77e 100644 --- a/androidApp/src/main/res/layout/unit_details_information.xml +++ b/androidApp/src/main/res/layout/unit_details_information.xml @@ -1,19 +1,30 @@ <?xml version="1.0" encoding="utf-8"?> -<LinearLayout +<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" - android:layout_height="match_parent" - android:orientation="vertical" - android:scrollbars="vertical"> + android:layout_height="match_parent"> + + <ProgressBar + android:id="@+id/reportLoading" + android:layout_width="wrap_content" + android:layout_height="wrap_content" + android:layout_margin="@dimen/margin" + app:layout_constraintBottom_toBottomOf="parent" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" /> <com.google.android.material.card.MaterialCardView - android:layout_width="match_parent" + android:layout_width="0dp" android:layout_height="wrap_content" app:cardCornerRadius="@dimen/card_border_radius" app:cardElevation="@dimen/card_elevation" app:cardUseCompatPadding="true" + app:layout_constraintEnd_toEndOf="parent" + app:layout_constraintStart_toStartOf="parent" + app:layout_constraintTop_toTopOf="parent" app:contentPadding="@dimen/card_padding"> <LinearLayout @@ -30,8 +41,9 @@ android:textColor="@color/colorPrimaryDark" android:layout_marginBottom="@dimen/padding" tools:text="1AAUTO" /> + </LinearLayout> </com.google.android.material.card.MaterialCardView> -</LinearLayout>
\ No newline at end of file +</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file diff --git a/androidApp/src/main/res/layout/unit_item.xml b/androidApp/src/main/res/layout/unit_item.xml index d46e7a1..e827940 100644 --- a/androidApp/src/main/res/layout/unit_item.xml +++ b/androidApp/src/main/res/layout/unit_item.xml @@ -32,16 +32,6 @@ style="?android:borderlessButtonStyle"/> <com.google.android.material.button.MaterialButton - android:id="@+id/reportsButton" - android:layout_width="wrap_content" - android:layout_height="match_parent" - android:layout_weight="1" - android:text="@string/unit_reports" - android:textColor="@color/colorAccent" - android:textSize="@dimen/card_action_text" - style="?android:borderlessButtonStyle"/> - - <com.google.android.material.button.MaterialButton android:id="@+id/commandsButton" android:layout_width="wrap_content" android:layout_height="match_parent" |