From 327568690d098095c402faed352dcc59c7299116 Mon Sep 17 00:00:00 2001 From: Ilya Fomenko Date: Wed, 6 May 2026 12:52:45 +0500 Subject: [PATCH] STDEV-24906 --- .../dialogs/AlertBottomSheetDialogFragment.kt | 31 +++++++++++++++++-- .../dialogs/BaseBottomSheetDialogFragment.kt | 25 +++++++++++++-- .../ui_kit/dialogs/base/DialogShowListener.kt | 4 ++- .../res/layout/bottom_sheet_alert_layout.xml | 12 +++++++ 4 files changed, 66 insertions(+), 6 deletions(-) diff --git a/src/main/java/ru/evotor/ui_kit/dialogs/AlertBottomSheetDialogFragment.kt b/src/main/java/ru/evotor/ui_kit/dialogs/AlertBottomSheetDialogFragment.kt index e603648..7742231 100644 --- a/src/main/java/ru/evotor/ui_kit/dialogs/AlertBottomSheetDialogFragment.kt +++ b/src/main/java/ru/evotor/ui_kit/dialogs/AlertBottomSheetDialogFragment.kt @@ -14,7 +14,6 @@ import androidx.fragment.app.FragmentManager import gone import ru.evotor.ui_kit.R import ru.evotor.ui_kit.databinding.BottomSheetAlertLayoutBinding -import ru.evotor.ui_kit.dialogs.base.StackTraceUtils import visible @@ -45,10 +44,19 @@ class AlertBottomSheetDialogFragment : BaseBottomSheetDialogFragment : BottomSheetDialo title = arguments?.getTitle() ?: "[NO_TITLE]", titleArgs = arguments?.getTitleArgs() ?: emptyArray(), message = arguments?.getMessage() ?: "[NO_MESSAGE]", - messageArgs = arguments?.getMessageArgs() ?: emptyArray() + messageArgs = arguments?.getMessageArgs() ?: emptyArray(), + details = arguments?.getDetails() ?: "[NO_DETAILS]", + detailsArgs = arguments?.getDetailsArgs() ?: emptyArray() ) return super.onCreateDialog(savedInstanceState).apply { window?.setBackgroundDrawable(ColorDrawable(context.getColor(R.color.dialog_transparent_background))) @@ -91,6 +92,20 @@ abstract class BaseBottomSheetDialogFragment : BottomSheetDialo return getStringArray(MESSAGE_ARGS_KEY) } + protected fun Bundle.getDetails(): String? { + val detailsRes = getInt(DETAILS_RES_KEY, 0) + return if (detailsRes == 0) { + getString(DETAILS_KEY, null) + } else { + context?.getString(detailsRes) + } + } + + protected fun Bundle.getDetailsArgs(): Array? { + if (!containsKey(DETAILS_ARGS_KEY)) return null + return getStringArray(DETAILS_ARGS_KEY) + } + companion object { var dialogShowListener: DialogShowListener? = null @@ -110,6 +125,12 @@ abstract class BaseBottomSheetDialogFragment : BottomSheetDialo protected val MESSAGE_RES_KEY = "ru.evotor.ui_kit.dialogs.BaseBottomSheetDialogFragment.message_res_key" @JvmStatic protected val MESSAGE_ARGS_KEY = "ru.evotor.ui_kit.dialogs.BaseBottomSheetDialogFragment.message_args_key" + @JvmStatic + protected val DETAILS_KEY = "ru.evotor.ui_kit.dialogs.BaseBottomSheetDialogFragment.details_key" + @JvmStatic + protected val DETAILS_RES_KEY = "ru.evotor.ui_kit.dialogs.BaseBottomSheetDialogFragment.details_res_key" + @JvmStatic + protected val DETAILS_ARGS_KEY = "ru.evotor.ui_kit.dialogs.BaseBottomSheetDialogFragment.details_args_key" } } \ No newline at end of file diff --git a/src/main/java/ru/evotor/ui_kit/dialogs/base/DialogShowListener.kt b/src/main/java/ru/evotor/ui_kit/dialogs/base/DialogShowListener.kt index 802396b..be2fea5 100644 --- a/src/main/java/ru/evotor/ui_kit/dialogs/base/DialogShowListener.kt +++ b/src/main/java/ru/evotor/ui_kit/dialogs/base/DialogShowListener.kt @@ -10,6 +10,8 @@ interface DialogShowListener { title: String, titleArgs: Array, message: String, - messageArgs: Array + messageArgs: Array, + details: String, + detailsArgs: Array ) } \ No newline at end of file diff --git a/src/main/res/layout/bottom_sheet_alert_layout.xml b/src/main/res/layout/bottom_sheet_alert_layout.xml index 0bd9d6c..a081ef7 100644 --- a/src/main/res/layout/bottom_sheet_alert_layout.xml +++ b/src/main/res/layout/bottom_sheet_alert_layout.xml @@ -43,6 +43,18 @@ android:gravity="start" tools:text="Dialog message" /> + +