diff options
author | Iván Ávalos <avalos@disroot.org> | 2022-01-16 19:09:50 -0600 |
---|---|---|
committer | Iván Ávalos <avalos@disroot.org> | 2022-01-16 19:09:50 -0600 |
commit | a687da7982d6582067aa9b1b0fe567a9f29ee06f (patch) | |
tree | 405928ce470b21c06d3aa5b5e781ada4803af79d /androidApp | |
parent | ca01b8dc020bdd332286b84a2b9ecb17a286aae1 (diff) | |
download | etbsa-trackermap-mobile-a687da7982d6582067aa9b1b0fe567a9f29ee06f.tar.gz etbsa-trackermap-mobile-a687da7982d6582067aa9b1b0fe567a9f29ee06f.tar.bz2 etbsa-trackermap-mobile-a687da7982d6582067aa9b1b0fe567a9f29ee06f.zip |
Fixed unit category icon sizing in views
Diffstat (limited to 'androidApp')
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 = |