From 9cdf91c10b43330277ec43a6261724b48a103814 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9s=20Miguel=20Rubio?= Date: Mon, 10 Jun 2024 10:55:49 +0200 Subject: [PATCH] fix: [ANDROAPP-6210] Manually instantiate resourceManager on BreakTheGlassBottomDialog (#3671) Signed-off-by: andresmr --- .../utils/customviews/BreakTheGlassBottomDialog.kt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/org/dhis2/utils/customviews/BreakTheGlassBottomDialog.kt b/app/src/main/java/org/dhis2/utils/customviews/BreakTheGlassBottomDialog.kt index 02d18c824b..7f68d77e86 100644 --- a/app/src/main/java/org/dhis2/utils/customviews/BreakTheGlassBottomDialog.kt +++ b/app/src/main/java/org/dhis2/utils/customviews/BreakTheGlassBottomDialog.kt @@ -1,5 +1,6 @@ package org.dhis2.utils.customviews +import android.content.Context import android.os.Bundle import android.view.LayoutInflater import android.view.View @@ -15,13 +16,11 @@ import org.dhis2.commons.resources.ColorType import org.dhis2.commons.resources.ColorUtils import org.dhis2.commons.resources.ResourceManager import org.dhis2.databinding.BreakTheGlassBottomDialogBindingImpl -import javax.inject.Inject class BreakTheGlassBottomDialog : BottomSheetDialogFragment() { private lateinit var programUid: String - @Inject lateinit var resourceManager: ResourceManager val colorUtils: ColorUtils = ColorUtils() @@ -42,11 +41,19 @@ class BreakTheGlassBottomDialog : BottomSheetDialogFragment() { isCancelable = false } + override fun onAttach(context: Context) { + super.onAttach(context) + resourceManager = ResourceManager( + context, + colorUtils, + ) + } + override fun onCreateView( inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?, - ): View? { + ): View { return BreakTheGlassBottomDialogBindingImpl.inflate(inflater, container, false).apply { message.text = resourceManager.formatWithEnrollmentLabel( programUid,