@@ -163,6 +163,12 @@ else if( tg.equals("end") )
163
163
builder .btnStackedGravity (GravityEnum .START );
164
164
}
165
165
break ;
166
+ case "checkBoxPrompt" :
167
+ ReadableMap checkBoxPrompt = options .getMap ("checkBoxPrompt" );
168
+ boolean initiallyChecked = checkBoxPrompt .hasKey ("initiallyChecked" ) &&
169
+ checkBoxPrompt .getBoolean ("initiallyChecked" );
170
+ builder .checkBoxPrompt (checkBoxPrompt .getString ("text" ), initiallyChecked , null );
171
+ break ;
166
172
case "progress" :
167
173
ReadableMap progress = options .getMap ("progress" );
168
174
boolean indeterminate = progress .hasKey ("indeterminate" ) &&
@@ -275,7 +281,8 @@ public boolean onSelection(MaterialDialog materialDialog, View view, int i,
275
281
if (!mCallbackConsumed ) {
276
282
mCallbackConsumed = true ;
277
283
charSequence = charSequence == null ? "" : charSequence ;
278
- callback .invoke ("itemsCallbackSingleChoice" , i , charSequence .toString ());
284
+ boolean isPromptCheckBoxChecked = materialDialog .isPromptCheckBoxChecked ();
285
+ callback .invoke ("itemsCallbackSingleChoice" , i , charSequence .toString (), isPromptCheckBoxChecked );
279
286
}
280
287
return true ;
281
288
}
@@ -407,7 +414,18 @@ public void run() {
407
414
MaterialDialog simple ;
408
415
@ ReactMethod
409
416
public void list (ReadableMap options , final Callback callback ) {
410
- final MaterialSimpleListAdapter simpleListAdapter = new MaterialSimpleListAdapter (getCurrentActivity ());
417
+ final MaterialSimpleListAdapter simpleListAdapter = new MaterialSimpleListAdapter (new MaterialSimpleListAdapter .Callback () {
418
+ @ Override
419
+ public void onMaterialListItemSelected (int index , MaterialSimpleListItem item ) {
420
+ if (!mCallbackConsumed ) {
421
+ mCallbackConsumed = true ;
422
+ callback .invoke (index , item .getContent ());
423
+ }
424
+ if (simple != null ) {
425
+ simple .dismiss ();
426
+ }
427
+ }
428
+ });
411
429
412
430
ReadableArray arr = options .getArray ("items" );
413
431
for (int i = 0 ; i < arr .size (); i ++){
@@ -418,18 +436,7 @@ public void list(ReadableMap options, final Callback callback) {
418
436
419
437
final MaterialDialog .Builder adapter = new MaterialDialog .Builder (getCurrentActivity ())
420
438
.title (options .hasKey ("title" ) ? options .getString ("title" ) : "" )
421
- .adapter (simpleListAdapter , new MaterialDialog .ListCallback () {
422
- @ Override
423
- public void onSelection (MaterialDialog dialog , View itemView , int which , CharSequence text ) {
424
- if (!mCallbackConsumed ) {
425
- mCallbackConsumed = true ;
426
- callback .invoke (which , text );
427
- }
428
- if (simple != null ) {
429
- simple .dismiss ();
430
- }
431
- }
432
- })
439
+ .adapter (simpleListAdapter , null )
433
440
.autoDismiss (true );
434
441
435
442
UiThreadUtil .runOnUiThread (new Runnable () {
0 commit comments