From 6ae7456d59d0de04467e3ca711f5775cb4c1deb0 Mon Sep 17 00:00:00 2001 From: "erol.aksoy" Date: Mon, 27 Jun 2022 18:09:08 +0300 Subject: [PATCH 1/5] Add onDismissListener to dialogs --- .../com/trendyol/uicomponents/dialogs/DialogFragment.kt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libraries/dialogs/src/main/java/com/trendyol/uicomponents/dialogs/DialogFragment.kt b/libraries/dialogs/src/main/java/com/trendyol/uicomponents/dialogs/DialogFragment.kt index 83a98ad7..7f699975 100644 --- a/libraries/dialogs/src/main/java/com/trendyol/uicomponents/dialogs/DialogFragment.kt +++ b/libraries/dialogs/src/main/java/com/trendyol/uicomponents/dialogs/DialogFragment.kt @@ -1,5 +1,6 @@ package com.trendyol.uicomponents.dialogs +import android.content.DialogInterface import android.graphics.Outline import android.os.Bundle import android.text.SpannableString @@ -29,6 +30,7 @@ class DialogFragment internal constructor() : BaseBottomSheetDialog() { var rightButtonClickListener: ((DialogFragment) -> Unit)? = null var onItemSelectedListener: ((DialogFragment, Int) -> Unit)? = null var onItemReselectedListener: ((DialogFragment, Int) -> Unit)? = null + var onDismissListener: ((DialogFragment) -> Unit)? = null internal lateinit var binding: FragmentDialogBinding private val dialogArguments by lazy(LazyThreadSafetyMode.NONE) { @@ -232,6 +234,11 @@ class DialogFragment internal constructor() : BaseBottomSheetDialog() { } } + override fun onDismiss(dialog: DialogInterface) { + onDismissListener?.invoke(this@DialogFragment) + super.onDismiss(dialog) + } + companion object { const val TAG: String = "TRENDYOL_BOTTOM_SHEET_DIALOG" From b7b360bf8b11ddc947d261049a0ae7ab047f1b04 Mon Sep 17 00:00:00 2001 From: "erol.aksoy" Date: Tue, 28 Jun 2022 08:41:57 +0300 Subject: [PATCH 2/5] Update README.md --- libraries/dialogs/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/libraries/dialogs/README.md b/libraries/dialogs/README.md index d3fb718d..b3784fc8 100644 --- a/libraries/dialogs/README.md +++ b/libraries/dialogs/README.md @@ -97,6 +97,7 @@ All **Info Dialog** arguments plus these arguments will be applicable to show se | `items` | List> | Item list that will be listed on dialog. | null | | `showItemsAsHtml` | Boolean | Item texts will be parsed as Html if this flag setted as true. | false | | `onItemSelectedListener` | (DialogFragment, Int) -> Unit | Listener to notify selected index. | null | +| `onDismissListener` | (DialogFragment) -> Unit | Listener to notify when dialog is dismiss. | null | | `enableSearch` | Boolean | Enables search function in given `items` | false | | `showClearSearchButton` | Boolean | Shows clean button on the right of the search input line. | false | | `searchHint` | String | Hint to show on search input line. | "" | From 29571e2f319f15054373ac7946e887384515a45c Mon Sep 17 00:00:00 2001 From: "erol.aksoy" Date: Tue, 28 Jun 2022 09:07:39 +0300 Subject: [PATCH 3/5] Increase dialogs version --- buildSrc/src/main/kotlin/ComponentVersions.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/kotlin/ComponentVersions.kt b/buildSrc/src/main/kotlin/ComponentVersions.kt index 5b47fcef..47a45954 100644 --- a/buildSrc/src/main/kotlin/ComponentVersions.kt +++ b/buildSrc/src/main/kotlin/ComponentVersions.kt @@ -5,7 +5,7 @@ object ComponentVersions { const val ratingBarVersion = "1.0.2" const val imageSliderVersion = "1.0.8" const val phoneNumberVersion = "1.0.2" - const val dialogsVersion = "1.3.1" + const val dialogsVersion = "1.3.2" const val cardInputViewVersion = "1.2.1" const val quantityPickerViewVersion = "1.2.5" const val timelineViewVersion = "1.0.0" From b5f4fb9562b598d20c084189a244890d7fea3aae Mon Sep 17 00:00:00 2001 From: "erol.aksoy" Date: Tue, 28 Jun 2022 09:39:20 +0300 Subject: [PATCH 4/5] Add dismissListener to builder --- .../main/java/com/trendyol/uicomponents/dialogs/Builder.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libraries/dialogs/src/main/java/com/trendyol/uicomponents/dialogs/Builder.kt b/libraries/dialogs/src/main/java/com/trendyol/uicomponents/dialogs/Builder.kt index 51278c11..14e42e52 100644 --- a/libraries/dialogs/src/main/java/com/trendyol/uicomponents/dialogs/Builder.kt +++ b/libraries/dialogs/src/main/java/com/trendyol/uicomponents/dialogs/Builder.kt @@ -13,6 +13,7 @@ open class Builder internal constructor() { var showCloseButton: Boolean = false var closeButtonListener: ((DialogFragment) -> Unit)? = null var animateCornerRadiusWhenExpand: Boolean = false + var onDialogDismissListener: ((DialogFragment) -> Unit)? = null var cornerRadius: Float? = null } @@ -50,6 +51,7 @@ open class InfoDialogBuilder internal constructor() : Builder() { webViewBuilder = it.webViewBuilder, ).toBundle() this.closeButtonListener = it.closeButtonListener ?: { } + this.onDismissListener = it.onDialogDismissListener ?: {} } } } @@ -81,6 +83,7 @@ open class AgreementDialogBuilder internal constructor() : InfoDialogBuilder() { closeButtonListener = it.closeButtonListener rightButtonClickListener = it.rightButtonClickListener leftButtonClickListener = it.leftButtonClickListener + this.onDismissListener = it.onDialogDismissListener ?: {} } } } @@ -125,6 +128,7 @@ class SelectionDialogBuilder internal constructor() : InfoDialogBuilder() { closeButtonListener = it.closeButtonListener onItemSelectedListener = it.onItemSelectedListener onItemReselectedListener = it.onItemReselectedListener + this.onDismissListener = it.onDialogDismissListener ?: {} } } @@ -153,6 +157,7 @@ class InfoListDialogBuilder internal constructor() : InfoDialogBuilder() { itemDividers = it.itemDividers ).toBundle() closeButtonListener = it.closeButtonListener + this.onDismissListener = it.onDialogDismissListener ?: {} } } From 8ac70ed8430b52ab2f4f597afbf3a6cabcdacc7f Mon Sep 17 00:00:00 2001 From: "erol.aksoy" Date: Tue, 28 Jun 2022 16:32:08 +0300 Subject: [PATCH 5/5] Update dialog version --- buildSrc/src/main/kotlin/ComponentVersions.kt | 2 +- libraries/dialogs/README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/buildSrc/src/main/kotlin/ComponentVersions.kt b/buildSrc/src/main/kotlin/ComponentVersions.kt index 47a45954..7efc2a78 100644 --- a/buildSrc/src/main/kotlin/ComponentVersions.kt +++ b/buildSrc/src/main/kotlin/ComponentVersions.kt @@ -5,7 +5,7 @@ object ComponentVersions { const val ratingBarVersion = "1.0.2" const val imageSliderVersion = "1.0.8" const val phoneNumberVersion = "1.0.2" - const val dialogsVersion = "1.3.2" + const val dialogsVersion = "1.4.0" const val cardInputViewVersion = "1.2.1" const val quantityPickerViewVersion = "1.2.5" const val timelineViewVersion = "1.0.0" diff --git a/libraries/dialogs/README.md b/libraries/dialogs/README.md index b3784fc8..0defd866 100644 --- a/libraries/dialogs/README.md +++ b/libraries/dialogs/README.md @@ -1,7 +1,7 @@ -$dialogsVersion = dialogs-1.3.1 [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) +$dialogsVersion = dialogs-1.4.0 [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) ## Dialogs Dialogs is a bunch of BottomSheetDialogs to use in app to show user an information, agreement or list.