@@ -5,10 +5,9 @@ An Android library to create fully material designed bottom dialogs similar to t
55
66## Releases:
77
8- #### Current release: 2.0.9 .
8+ #### Current release: 2.1.0 .
99
10- - Now with buttons coloring support (again) via code.
11- - Now with AndroidX support.
10+ - This library is now based on Kotlin and AndroidX.
1211
1312You can see all the library releases [ here] ( https://github.com/marcoscgdev/DialogSheet/releases ) .
1413
@@ -19,7 +18,7 @@ You can see all the library releases [here](https://github.com/marcoscgdev/Dialo
1918
2019<kbd ><img src =" https://raw.githubusercontent.com/marcoscgdev/DialogSheet/master/screenshots/sc_3.png " width =" 620 " ></kbd >
2120
22- Download the sample apk [ here] ( https://github.com/marcoscgdev/DialogSheet/releases/download/2.0.9 /app-debug.apk ) .
21+ Download the sample apk [ here] ( https://github.com/marcoscgdev/DialogSheet/releases/download/2.1.0 /app-debug.apk ) .
2322
2423---
2524
@@ -41,61 +40,46 @@ allprojects {
4140Now add the dependency to your app build.gradle file:
4241
4342```
44- implementation 'com.github.marcoscgdev:DialogSheet:2.0.9 '
43+ implementation 'com.github.marcoscgdev:DialogSheet:2.1.0 '
4544```
4645
47- ### Creating the dialog with Java
46+ ### Creating the dialog
4847
4948Here is a complete snippet of it usage:
5049
5150``` java
52- new DialogSheet (this )
51+ val dialogSheet = DialogSheet(this )
5352 .setTitle(R . string. app_name)
5453 .setMessage(R . string. lorem)
5554 .setColoredNavigationBar(true )
5655 .setTitleTextSize(20 ) // In SP
5756 .setCancelable(false )
58- .setPositiveButton(android. R . string. ok, new DialogSheet .OnPositiveClickListener () {
59- @Override
60- public void onClick (View v ) {
57+ .setPositiveButton(android. R . string. ok, object: DialogSheet . OnPositiveClickListener {
58+ override fun onClick(v: View ? ) {
6159 // Your action
6260 }
6361 })
64- .setNegativeButton(android. R . string. cancel, new DialogSheet .OnNegativeClickListener () {
65- @Override
66- public void onClick (View v ) {
62+ .setNegativeButton(android. R . string. cancel, object: DialogSheet . OnPositiveClickListener {
63+ override fun onClick(v: View ? ) {
6764 // Your action
6865 }
6966 })
7067 .setNeutralButton(" Neutral" , null )
68+ .setRoundedCorners(false ) // Default value is true
7169 .setBackgroundColor(Color . BLACK ) // Your custom background color
7270 .setButtonsColorRes(R . color. colorAccent) // You can use dialogSheetAccent style attribute instead
73- .show();
71+ .setNeutralButtonColor(Color . WHITE )
72+ .show()
7473```
7574
76- ### Creating the dialog with Kotlin
75+ ### Creating the dialog using the new style
7776
78- Here is a complete snippet of it usage:
77+ Simply add a new boolean-type argument to the dialog constructor.
7978
8079``` java
81- val dialogSheet: DialogSheet = DialogSheet(this @MainActivity )
82- .setTitle(R . string. app_name)
83- .setMessage(R . string. lorem)
84- .setColoredNavigationBar(true )
85- .setTitleTextSize(20 ) // In SP
86- .setCancelable(false )
87- .setPositiveButton(android. R . string. ok) {
88- // Your action
89- }
90- .setNegativeButton(android. R . string. cancel) {
91- // Your action
92- }
93- .setNeutralButton(" Neutral" ) {
94- // Your action
95- }
96- .setRoundedCorners(false ) // Default value is true
97- .setBackgroundColor(Color . BLACK ) // Your custom background color
98- .setButtonsColorRes(R . color. colorAccent) // You can use dialogSheetAccent style attribute instead
80+ val dialogSheet = DialogSheet(this , true )
81+ ...
82+ ...
9983 .show()
10084```
10185
@@ -107,6 +91,12 @@ You can do it programmatically
10791.setButtonsColorRes(R . color. colorPrimary)
10892```
10993
94+ ``` java
95+ .setPositiveButtonColorRes(R . color. colorPrimary)
96+ .setNegativeButtonColorRes(R . color. colorNegative)
97+ .setNeutralButtonColorRes(R . color. colorNeutral)
98+ ```
99+
110100Or by adding this atribute to your main app theme
111101
112102``` xml
0 commit comments