aboutsummaryrefslogtreecommitdiff
path: root/androidApp/src
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-01-16 19:10:38 -0600
committerIván Ávalos <avalos@disroot.org>2022-01-16 19:10:38 -0600
commit8eda4b6bb96db95e4099a3f8d2fad7996dd36c47 (patch)
treee0205e346e55fbf53326e980b1b6e83aaca9634e /androidApp/src
parente45a4293270083ffde4c8624eaa00c73bded45bc (diff)
parent3eb11df687c48110327e2fb1381e43cfd001c20a (diff)
downloadetbsa-trackermap-mobile-8eda4b6bb96db95e4099a3f8d2fad7996dd36c47.tar.gz
etbsa-trackermap-mobile-8eda4b6bb96db95e4099a3f8d2fad7996dd36c47.tar.bz2
etbsa-trackermap-mobile-8eda4b6bb96db95e4099a3f8d2fad7996dd36c47.zip
Merge branch 'main' of https://git.sr.ht/~avalos/trackermap-mobile
Diffstat (limited to 'androidApp/src')
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/commands/UnitCommandsFragment.kt19
-rw-r--r--androidApp/src/main/java/mx/trackermap/TrackerMap/android/details/information/UnitInformationFragment.kt19
2 files changed, 26 insertions, 12 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 5fc9d7c..61a4e37 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
@@ -2,6 +2,7 @@ package mx.trackermap.TrackerMap.android.details.commands
import android.os.Bundle
import android.util.Log
+import android.util.TypedValue
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -64,12 +65,18 @@ class UnitCommandsFragment: Fragment() {
binding.nameDetail.text = deviceName
context?.let {
- binding.nameDetail.setCompoundDrawablesRelativeWithIntrinsicBounds(
- ResourcesCompat.getDrawable(
- it.resources,
- MarkerTransformations.categoryToResourceId(deviceCategory),
- it.theme
- ), null, null, null
+ val metrics = it.resources.displayMetrics
+ val icon = ResourcesCompat.getDrawable(
+ it.resources,
+ MarkerTransformations.categoryToResourceId(deviceCategory),
+ it.theme
+ )
+ icon?.setBounds(0, 0,
+ TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 40f, metrics).toInt(),
+ TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 40f, metrics).toInt()
+ )
+ binding.nameDetail.setCompoundDrawables(
+ icon, null, null, null
)
}
binding.nameDetail.compoundDrawablePadding =
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 e448b0b..568bd6b 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
@@ -4,6 +4,7 @@ import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.util.Log
+import android.util.TypedValue
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@@ -70,12 +71,18 @@ class UnitInformationFragment : Fragment() {
unitInformationViewModel.fetchUnit(id ?: 0)
binding.nameDetail.text = name
context?.let {
- binding.nameDetail.setCompoundDrawablesRelativeWithIntrinsicBounds(
- ResourcesCompat.getDrawable(
- it.resources,
- MarkerTransformations.categoryToResourceId(category),
- it.theme
- ), null, null, null
+ val metrics = it.resources.displayMetrics
+ val icon = ResourcesCompat.getDrawable(
+ it.resources,
+ MarkerTransformations.categoryToResourceId(category),
+ it.theme
+ )
+ icon?.setBounds(0, 0,
+ TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 40f, metrics).toInt(),
+ TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 40f, metrics).toInt()
+ )
+ binding.nameDetail.setCompoundDrawables(
+ icon, null, null, null
)
}
binding.nameDetail.compoundDrawablePadding =