diff options
Diffstat (limited to 'androidApp/src/main/java/mx/trackermap/TrackerMap/android/details')
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 = |