Added gravity options for title, text, and buttons. Also added a simpler `rtl` option, for changing alignment to RTL

This commit is contained in:
Farzad Abdolhosseini 2016-12-18 12:47:47 +03:30
parent abd499e12c
commit 8dabf4ce5b
1 changed files with 37 additions and 0 deletions

View File

@ -4,6 +4,7 @@ import android.content.DialogInterface;
import android.view.View;
import com.afollestad.materialdialogs.DialogAction;
import com.afollestad.materialdialogs.GravityEnum;
import com.afollestad.materialdialogs.MaterialDialog;
import com.afollestad.materialdialogs.simplelist.MaterialSimpleListAdapter;
import com.afollestad.materialdialogs.simplelist.MaterialSimpleListItem;
@ -91,6 +92,42 @@ public class DialogAndroid extends ReactContextBaseJavaModule {
builder.progressIndeterminateStyle(
options.getBoolean("progressIndeterminateStyle"));
break;
case "buttonsGravity":
String bg = options.getString("buttonsGravity");
if( bg.equals("start") )
builder.buttonsGravity(GravityEnum.START);
else if( bg.equals("end") )
builder.buttonsGravity(GravityEnum.END);
else
builder.buttonsGravity(GravityEnum.CENTER);
break;
case "itemsGravity":
String ig = options.getString("itemsGravity");
if( ig.equals("start") )
builder.itemsGravity(GravityEnum.START);
else if( ig.equals("end") )
builder.itemsGravity(GravityEnum.END);
else
builder.itemsGravity(GravityEnum.CENTER);
break;
case "titleGravity":
String tg = options.getString("titleGravity");
if( tg.equals("start") )
builder.titleGravity(GravityEnum.START);
else if( tg.equals("end") )
builder.titleGravity(GravityEnum.END);
else
builder.titleGravity(GravityEnum.CENTER);
break;
case "rtl":
if( options.getBoolean("rtl") ) {
builder.titleGravity(GravityEnum.END);
builder.itemsGravity(GravityEnum.END);
builder.contentGravity(GravityEnum.END);
builder.buttonsGravity(GravityEnum.START);
builder.btnStackedGravity(GravityEnum.START);
}
break;
case "progress":
ReadableMap progress = options.getMap("progress");
boolean indeterminate = progress.hasKey("indeterminate") &&