From 698d01109600eddf1855b0068a532b8aec4cfc4e Mon Sep 17 00:00:00 2001 From: bilgehan kalkan Date: Tue, 24 Dec 2019 15:07:01 +0300 Subject: [PATCH] Implement animateCornerRadiusWhenExpand flag to disable corner radius animations. Update README.md and build.gradle with new version number. --- libraries/dialogs/README.md | 13 +++++++------ libraries/dialogs/build.gradle | 4 ++-- .../com/trendyol/uicomponents/dialogs/Builder.kt | 6 ++---- .../trendyol/uicomponents/dialogs/DialogFragment.kt | 12 +++++++----- .../uicomponents/dialogs/DialogFragmentArguments.kt | 1 + 5 files changed, 19 insertions(+), 17 deletions(-) diff --git a/libraries/dialogs/README.md b/libraries/dialogs/README.md index 767a786d..852e00d2 100644 --- a/libraries/dialogs/README.md +++ b/libraries/dialogs/README.md @@ -1,7 +1,7 @@ -$dialogsVersion = dialogs-1.0.3 [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0) +$dialogsVersion = dialogs-1.0.5 [![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. @@ -31,11 +31,12 @@ You can call DialogFragment.findFragment(supportFragmentManager) method inorder Simple dialog to show information, error or text. -| Field | Type | Description | Default Value | -| ------------- |-------------|-------------| ------------- | -| `title` | String |Title of the dialog | "" | -| `showCloseButton` | Boolean | Close button visibility | false | -| `closeButtonListener` | (DialogFragment) -> Unit |Listener for close button. When clicked, dialog will dismiss and listener will be invoked with dialog. | { } | +| Field | Type | Description | Default Value | +| ------------- | ------------- | ------------- | ------------- | +| `title` | String |Title of the dialog | "" | +| `showCloseButton` | Boolean | Close button visibility | false | +| `animateCornerRadiusWhenExpand` | Boolean | Corner radius will be removed with an animation when set true. | false | +| `closeButtonListener` | (DialogFragment) -> Unit | Listener for close button. When clicked, dialog will dismiss and listener will be invoked with dialog. | { } | | `content` | CharSequence | Content of a dialog | "" | | `showContentAsHtml` | Boolean | If you provided `content` as Html and set this flag as true, content will be parsed as HTML. | false | | `contentImage` | Int | Drawable resource id of an visual, will be shown on top of `content` | 0 | diff --git a/libraries/dialogs/build.gradle b/libraries/dialogs/build.gradle index 760ee9f0..92a3c8bc 100644 --- a/libraries/dialogs/build.gradle +++ b/libraries/dialogs/build.gradle @@ -4,8 +4,8 @@ apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' apply plugin: 'com.github.dcendents.android-maven' -group="com.trendyol.ui-components" -version="1.0.4" +group = "com.trendyol.ui-components" +version = "1.0.5" android { compileSdkVersion 29 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 47fd28f8..26a6554b 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 @@ -8,6 +8,7 @@ open class Builder internal constructor() { var title: String = "" var showCloseButton: Boolean = false var closeButtonListener: ((DialogFragment) -> Unit)? = null + var animateCornerRadiusWhenExpand: Boolean = false } open class InfoDialogBuilder internal constructor() : Builder() { @@ -23,6 +24,7 @@ open class InfoDialogBuilder internal constructor() : Builder() { arguments = DialogFragmentArguments( title = it.title, showCloseButton = it.showCloseButton, + animateCornerRadiusWhenExpand = it.animateCornerRadiusWhenExpand, content = SpannableString(it.content), contentImage = it.contentImage, showContentAsHtml = it.showContentAsHtml @@ -33,10 +35,6 @@ open class InfoDialogBuilder internal constructor() : Builder() { } } -class ClickEvent() { - -} - open class AgreementDialogBuilder internal constructor() : InfoDialogBuilder() { var rightButtonText: String = "" 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 68f3292e..20f4c41a 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 @@ -14,11 +14,11 @@ import com.trendyol.uicomponents.dialogs.list.DialogListViewModel class DialogFragment internal constructor() : BaseBottomSheetDialog() { - private val dialogArguments by lazy(LazyThreadSafetyMode.NONE) - { requireNotNull(DialogFragmentArguments.fromBundle(requireArguments())) } + private val dialogArguments by lazy(LazyThreadSafetyMode.NONE) { + requireNotNull(DialogFragmentArguments.fromBundle(requireArguments())) + } - private val itemsAdapter by lazy(LazyThreadSafetyMode.NONE) - { + private val itemsAdapter by lazy(LazyThreadSafetyMode.NONE) { DialogListAdapter( dialogArguments.showItemsAsHtml, dialogArguments.selectedItemDrawable, @@ -38,7 +38,9 @@ class DialogFragment internal constructor() : BaseBottomSheetDialog