Skip to content

Commit

Permalink
Merge pull request #17 from Trendyol/feature/dialogs-optional-corner-…
Browse files Browse the repository at this point in the history
…radius

Dialogs - Make Radius Animation Optional
  • Loading branch information
bilgehankalkan authored Dec 24, 2019
2 parents c849237 + 698d011 commit 2a77307
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 17 deletions.
13 changes: 7 additions & 6 deletions libraries/dialogs/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

<img src="https://raw.githubusercontent.com/Trendyol/android-ui-components/master/images/dialogs-1.png" width="240"/> <img src="https://raw.githubusercontent.com/Trendyol/android-ui-components/master/images/dialogs-2.png" width="240"/> <img src="https://raw.githubusercontent.com/Trendyol/android-ui-components/master/images/dialogs-3.png" width="240"/> <img src="https://raw.githubusercontent.com/Trendyol/android-ui-components/master/images/dialogs-4.png" width="240"/>

$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.
Expand Down Expand Up @@ -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 |
Expand Down
4 changes: 2 additions & 2 deletions libraries/dialogs/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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
Expand All @@ -33,10 +35,6 @@ open class InfoDialogBuilder internal constructor() : Builder() {
}
}

class ClickEvent() {

}

open class AgreementDialogBuilder internal constructor() : InfoDialogBuilder() {

var rightButtonText: String = ""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ import com.trendyol.uicomponents.dialogs.list.DialogListViewModel

class DialogFragment internal constructor() : BaseBottomSheetDialog<FragmentDialogBinding>() {

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,
Expand All @@ -38,7 +38,9 @@ class DialogFragment internal constructor() : BaseBottomSheetDialog<FragmentDial
override fun getLayoutResId(): Int = R.layout.fragment_dialog

override fun setUpView() {
animateCornerRadiusWithStateChanged()
if (dialogArguments.animateCornerRadiusWhenExpand) {
animateCornerRadiusWithStateChanged()
}

with(binding) {
imageClose.setOnClickListener {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import kotlinx.android.parcel.Parcelize
class DialogFragmentArguments(
val title: String? = null,
val showCloseButton: Boolean? = null,
val animateCornerRadiusWhenExpand: Boolean = true,
val content: CharSequence? = null,
val showContentAsHtml: Boolean = false,
@DrawableRes val contentImage: Int? = null,
Expand Down

0 comments on commit 2a77307

Please sign in to comment.