aboutsummaryrefslogtreecommitdiff
path: root/androidApp
diff options
context:
space:
mode:
authorIván Ávalos <avalos@disroot.org>2022-01-16 19:09:50 -0600
committerIván Ávalos <avalos@disroot.org>2022-01-16 19:09:50 -0600
commit3eb11df687c48110327e2fb1381e43cfd001c20a (patch)
tree405928ce470b21c06d3aa5b5e781ada4803af79d /androidApp
parent62bd831586fee041a830366c97b07d2cdb52a1b6 (diff)
downloadetbsa-trackermap-mobile-3eb11df687c48110327e2fb1381e43cfd001c20a.tar.gz
etbsa-trackermap-mobile-3eb11df687c48110327e2fb1381e43cfd001c20a.tar.bz2
etbsa-trackermap-mobile-3eb11df687c48110327e2fb1381e43cfd001c20a.zip
Fixed unit category icon sizing in views
Diffstat (limited to 'androidApp')
-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 =