aboutsummaryrefslogtreecommitdiff
path: root/androidApp
diff options
context:
space:
mode:
Diffstat (limited to 'androidApp')
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/commands/UnitCommandsFragment.kt3
-rw-r--r--androidApp/src/main/res/drawable/icon_radio_checked.xml10
-rw-r--r--androidApp/src/main/res/drawable/icon_radio_unchecked.xml10
-rw-r--r--androidApp/src/main/res/drawable/indicator_check_mark_light.xml28
-rw-r--r--androidApp/src/main/res/layout/simple_list_item_checked.xml29
-rw-r--r--androidApp/src/main/res/layout/unit_details_commands.xml22
-rw-r--r--androidApp/src/main/res/values/strings.xml2
7 files changed, 96 insertions, 8 deletions
diff --git a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/commands/UnitCommandsFragment.kt b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/commands/UnitCommandsFragment.kt
index bb462ef..b0aab3e 100644
--- a/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/commands/UnitCommandsFragment.kt
+++ b/androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/commands/UnitCommandsFragment.kt
@@ -8,6 +8,7 @@ import android.view.ViewGroup
import android.widget.ArrayAdapter
import androidx.fragment.app.Fragment
import kotlinx.coroutines.DelicateCoroutinesApi
+import mx.trackermap.TrackerMap.android.R
import mx.trackermap.TrackerMap.android.databinding.UnitDetailsCommandsBinding
import mx.trackermap.TrackerMap.android.details.UnitDetailsAdapter
import org.koin.androidx.viewmodel.ext.android.viewModel
@@ -44,7 +45,7 @@ class UnitCommandsFragment: Fragment() {
unitCommandsViewModel.commands.observe(viewLifecycleOwner) { commands ->
Log.d("UnitCommandsFragment", "Device commands - $commands")
val context = activity!!.applicationContext
- val adapter = ArrayAdapter<String>(context, android.R.layout.simple_list_item_1)
+ val adapter = ArrayAdapter<String>(context, R.layout.simple_list_item_checked)
adapter.addAll(commands.map { it.description })
binding.commandsList.adapter = adapter
}
diff --git a/androidApp/src/main/res/drawable/icon_radio_checked.xml b/androidApp/src/main/res/drawable/icon_radio_checked.xml
new file mode 100644
index 0000000..bdf69f9
--- /dev/null
+++ b/androidApp/src/main/res/drawable/icon_radio_checked.xml
@@ -0,0 +1,10 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24"
+ android:tint="?android:attr/colorControlNormal">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M12,7c-2.76,0 -5,2.24 -5,5s2.24,5 5,5 5,-2.24 5,-5 -2.24,-5 -5,-5zM12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z"/>
+</vector>
diff --git a/androidApp/src/main/res/drawable/icon_radio_unchecked.xml b/androidApp/src/main/res/drawable/icon_radio_unchecked.xml
new file mode 100644
index 0000000..2dd0d69
--- /dev/null
+++ b/androidApp/src/main/res/drawable/icon_radio_unchecked.xml
@@ -0,0 +1,10 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24"
+ android:tint="?android:attr/colorControlNormal">
+ <path
+ android:fillColor="@android:color/white"
+ android:pathData="M12,2C6.48,2 2,6.48 2,12s4.48,10 10,10 10,-4.48 10,-10S17.52,2 12,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z"/>
+</vector>
diff --git a/androidApp/src/main/res/drawable/indicator_check_mark_light.xml b/androidApp/src/main/res/drawable/indicator_check_mark_light.xml
new file mode 100644
index 0000000..8647888
--- /dev/null
+++ b/androidApp/src/main/res/drawable/indicator_check_mark_light.xml
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2008 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <item android:state_checked="true"
+ android:drawable="@drawable/icon_radio_checked" />
+
+ <item android:state_checked="false"
+ android:drawable="@drawable/icon_radio_unchecked" />
+
+ <item
+ android:drawable="@drawable/icon_radio_unchecked" />
+
+</selector>
diff --git a/androidApp/src/main/res/layout/simple_list_item_checked.xml b/androidApp/src/main/res/layout/simple_list_item_checked.xml
new file mode 100644
index 0000000..3efbcc4
--- /dev/null
+++ b/androidApp/src/main/res/layout/simple_list_item_checked.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright (C) 2006-2008 Google Inc.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+-->
+
+<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
+ android:id="@android:id/text1"
+ android:layout_width="match_parent"
+ android:layout_height="?android:attr/listPreferredItemHeightSmall"
+ android:textAppearance="?android:attr/textAppearanceListItem"
+ android:gravity="center_vertical"
+ android:checkMark="@drawable/indicator_check_mark_light"
+ android:paddingStart="?android:attr/listPreferredItemPaddingStart"
+ android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
+ />
diff --git a/androidApp/src/main/res/layout/unit_details_commands.xml b/androidApp/src/main/res/layout/unit_details_commands.xml
index e98b113..6e1d7b2 100644
--- a/androidApp/src/main/res/layout/unit_details_commands.xml
+++ b/androidApp/src/main/res/layout/unit_details_commands.xml
@@ -5,16 +5,26 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
- <ListView
- android:id="@+id/commandsList"
+ <com.google.android.material.card.MaterialCardView
+ android:id="@+id/commandsCard"
android:layout_width="0dp"
android:layout_height="0dp"
- android:choiceMode="singleChoice"
- android:listSelector="@color/darkBackground"
+ app:cardCornerRadius="@dimen/card_border_radius"
+ app:cardElevation="@dimen/card_elevation"
+ app:cardUseCompatPadding="true"
app:layout_constraintBottom_toTopOf="@id/sendCommandButton"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toTopOf="parent" />
+ app:layout_constraintTop_toTopOf="parent">
+
+ <ListView
+ android:id="@+id/commandsList"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:choiceMode="singleChoice"
+ android:listSelector="@color/darkBackground" />
+
+ </com.google.android.material.card.MaterialCardView>
<com.google.android.material.button.MaterialButton
android:id="@+id/sendCommandButton"
@@ -25,6 +35,6 @@
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
- app:layout_constraintTop_toBottomOf="@id/commandsList" />
+ app:layout_constraintTop_toBottomOf="@id/commandsCard" />
</androidx.constraintlayout.widget.ConstraintLayout> \ No newline at end of file
diff --git a/androidApp/src/main/res/values/strings.xml b/androidApp/src/main/res/values/strings.xml
index c59bb9f..7867873 100644
--- a/androidApp/src/main/res/values/strings.xml
+++ b/androidApp/src/main/res/values/strings.xml
@@ -2,7 +2,7 @@
<resources>
<string name="app_name">TrackerMap</string>
- <!-- Non translatables -->
+ <!-- Non translatable -->
<string name="maps_url_template" translatable="false">
https://www.google.com/maps/place/%1$f,%2$f?z=19
</string>