Skip to content

Commit

Permalink
Add CustomDialog to README.md
Browse files Browse the repository at this point in the history
 - Move title attributes from InfoDialog to Builder and change CustomDialog implementation
  • Loading branch information
goksuturker committed Jan 25, 2022
1 parent c7c57b9 commit 70eb181
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 6 deletions.
Binary file added images/dialogs-6.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 26 additions & 2 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="280"/> <img src="https://raw.githubusercontent.com/Trendyol/android-ui-components/master/images/dialogs-2.png" width="280"/> <img src="https://raw.githubusercontent.com/Trendyol/android-ui-components/master/images/dialogs-3.png" width="280"/> <img src="https://raw.githubusercontent.com/Trendyol/android-ui-components/master/images/dialogs-4.png" width="280"/> <img src="https://raw.githubusercontent.com/Trendyol/android-ui-components/master/images/dialogs-5.png" width="280"/>
<img src="https://raw.githubusercontent.com/Trendyol/android-ui-components/master/images/dialogs-1.png" width="280"/> <img src="https://raw.githubusercontent.com/Trendyol/android-ui-components/master/images/dialogs-2.png" width="280"/> <img src="https://raw.githubusercontent.com/Trendyol/android-ui-components/master/images/dialogs-3.png" width="280"/> <img src="https://raw.githubusercontent.com/Trendyol/android-ui-components/master/images/dialogs-4.png" width="280"/> <img src="https://raw.githubusercontent.com/Trendyol/android-ui-components/master/images/dialogs-5.png" width="280"/> <img src="https://raw.githubusercontent.com/Trendyol/android-ui-components/master/images/dialogs-6.png" width="280"/>

$dialogsVersion = dialogs-1.2.8 [![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
$dialogsVersion = dialogs-1.2.9 [![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 @@ -167,6 +167,30 @@ infoListDialog {
}
```

* Custom Dialog

CustomDialog is a dialog that has a fixed header and its content can take a custom view.

| Field | Type | Description | Default Value |
| ------------- |-------------|-------------| ------------- |
| `view` | View | The custom view that will create the body of the dialog. | null |

Sample usage:
```kotlin
val customView = ExampleCustomView(context)
customDialog {
title = SpannableStringBuilder().color(Color.RED) { append("Custom Dialog Sample") }
showCloseButton = true
animateCornerRadiusWhenExpand = false
cornerRadius = 0F
closeButtonListener = infoDialogClosed
titleBackgroundColor = R.color.colorAccent
titleTextColor = R.color.colorPrimary
titleTextPosition = TextPosition.CENTER
view = customView
}
```

## TODOs
* Implement ListDialog.
* ~~Implement SelectionDialog~~
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import androidx.annotation.DrawableRes
open class Builder internal constructor() {

var title: CharSequence = ""
var titleBackgroundColor: Int? = null
var titleTextColor: Int? = null
var titleTextPosition: TextPosition? = null
var showCloseButton: Boolean = false
var closeButtonListener: ((DialogFragment) -> Unit)? = null
var animateCornerRadiusWhenExpand: Boolean = false
Expand All @@ -21,9 +24,6 @@ open class InfoDialogBuilder internal constructor() : Builder() {
@DrawableRes
var contentImage: Int? = null
var showContentAsHtml: Boolean = false
var titleBackgroundColor: Int? = null
var titleTextColor: Int? = null
var titleTextPosition: TextPosition? = null
var contentTextPosition: TextPosition? = null
var webViewContent: WebViewContent? = null
var webViewBuilder: (WebView.() -> Unit)? = null
Expand Down Expand Up @@ -149,7 +149,7 @@ class InfoListDialogBuilder internal constructor() : InfoDialogBuilder() {
}
}

class CustomDialogBuilder internal constructor() : InfoDialogBuilder() {
class CustomDialogBuilder internal constructor() : Builder() {

var view: View? = null

Expand Down

0 comments on commit 70eb181

Please sign in to comment.