Skip to content

How to use

John Lee edited this page May 3, 2020 · 4 revisions

Basic Dialog

Setter Ex) 1 Ex) 2 Default value Description
.setTitle(String title) .setTitle("Hello") - null Unnecessary
.setTitle(String title, boolean isBold) .setTitle("Hello", false) - null, true Unnecessary
.setContent(String message) .setContent("This is Simple Dialog :)") - null Message cannot be empty
.setContent(String message, Integer paddingLeftDp) .setContent("This is Simple Dialog :)", 3) - null, null Message cannot be empty
.setPermanentCheck(String preferenceName, String preferenceKey) .setPermanentCheck(Pref.PREFERENCE_NAME, Pref.KEY_FIRST_WELCOME) - null, null Unnecessary
.setBtnPermanentCheckText(String message) .setBtnPermanentCheckText("Don't ask again") - "Don't show again" setPermanentCheck needs to be set
.setBtnPermanentCheckText(String message, boolean isBold) .setBtnPermanentCheckText("Don't ask again", true) - "Don't show again", false setPermanentCheck needs to be set
.setBtnPermanentCheckTextSizeDp(int textSizeDp) .setBtnPermanentCheckTextSizeDp(11) - 13 setPermanentCheck needs to be set
.setBtnConfirmText(String message) .setBtnConfirmText("Confirm") .setBtnConfirmText( getString(R.string.text_confirm) ) "Confirm" Unnecessary (Automatically will be set)
.setBtnConfirmText(String message, boolean isBold) .setBtnConfirmText("Confirm", false) .setBtnConfirmText( getString(R.string.text_confirm), false ) "Confirm", true Unnecessary (Automatically will be set)
.setBtnConfirmTextSizeDp(int textSizeInDp) .setBtnConfirmTextSizeDp(15) - 14 Unnecessary
.setBtnConfirmTextColor(Integer color) .setBtnConfirmTextColor(R.color.btnConfirmColor) - R.color.colorPrimary Unnecessary
.setBtnConfirmTextColor(String color) .setBtnConfirmTextColor("#333333") - R.color.colorPrimary Unnecessary
.onConfirm(BtnCallback callback) .onConfirm(new SimpleDialog.BtnCallback() { @Override public void onClick(@NonNull SimpleDialog dialog, @NonNull SimpleDialog.BtnAction which) { // Do something } }) - null Unnecessary (will be dismissed)
.onConfirm(BtnCallbackWithPermanentCheck callback) .onConfirm(new SimpleDialog.BtnCallbackWithPermanentCheck() { @Override public void onClick(@NonNull SimpleDialog dialog, @NonNull SimpleDialog.BtnAction which, boolean isPermanentChecked) { if( isPermanentChecked ) // Do something } }) - null Unnecessary (If you don't want to show again if checkbox is checked, simply use showIfPermanentValueIsFalse() instead of just show())
.setBtnCancelText(String message) .setBtnCancelText("Cancel") .setBtnCancelText( getString(R.string.text_cancel) ) null Unnecessary
.setBtnCancelText(String message, boolean isBold) .setBtnCancelText("Cancel", false) .setBtnCancelText( getString(R.string.text_cancel), false ) null, true Unnecessary
.setBtnCancelTextSizeDp(int textSizeInDp) .setBtnCancelTextSizeDp(15) - 14 Unnecessary
.setBtnCancelTextColor(Integer color) .setBtnCancelTextColor(R.color.btnCancelColor) - R.color.colorPrimary Unnecessary
.setBtnCancelTextColor(String color) .setBtnCancelTextColor("#333333") - R.color.colorPrimary Unnecessary
.onCancel(BtnCallback callback) .onCancel(new SimpleDialog.BtnCallback() { @Override public void onClick(@NonNull SimpleDialog dialog, @NonNull SimpleDialog.BtnAction which) { // Do something } }) - null Unnecessary (will be dismissed)

Loading Dialog

  • .setTitle is unavailable when you use Progress Dialog
  • .showProgress must be set as true
  • CancelButton is default
Setter Ex) 1 Ex) 2 Default value Description
.setContent(String message) .setContent("This is Simple Dialog :)") - null Message cannot be empty
.setContent(String message, Integer paddingLeftDp) .setContent("This is Simple Dialog :)", 3) - null, null Message cannot be empty
.showProgress(boolean showProgress) .showProgress(true) - false Must be set as true, if you want to show Progress Dialog
.setProgressGIF(Object customProgressGIF) .setProgressGIF(R.raw.simple_dialog_progress_default) - null Unnecessary ( Use GIF file in raw directory )
.setBtnCancelText(String message) .setBtnCancelText("Cancel") .setBtnCancelText( getString(R.string.text_cancel) ) null Unnecessary
.setBtnCancelText(String message, boolean isBold) .setBtnCancelText("Cancel", false) .setBtnCancelText( getString(R.string.text_cancel), false ) null, true Unnecessary
.setBtnCancelTextSizeDp(int textSizeInDp) .setBtnCancelTextSizeDp(15) - 14 Unnecessary
.setBtnCancelTextColor(Integer color) .setBtnCancelTextColor(R.color.btnCancelColor) - R.color.colorPrimary Unnecessary
.setBtnCancelTextColor(String color) .setBtnCancelTextColor("#333333") - R.color.colorPrimary Unnecessary
.onCancel(BtnCallback callback) .onCancel(new SimpleDialog.BtnCallback() { @Override public void onClick(@NonNull SimpleDialog dialog, @NonNull SimpleDialog.BtnAction which) { // Do something } }) - null Unnecessary (will be dismissed)

Selection Dialog

  • default value for paddingLeftDp is 14
Setter Ex) 1 Ex) 2 Default value Description
.setContentList(List contentList, @Nullable Int paddingLeftDp) .setContentList( listOf("AAAA", "BBB", "CC") ) - null contentList cannot be empty
.onSelect(SelectionCallback callback) .onSelect(new SelectionCallback { @Override public void onSelect(String option) { // Do something } }) - null See what user have selected

Guide Dialog

  • Image is not neccessary
Setter Ex) 1 Ex) 2 Default value Description
.setTitle(String title) .setTitle("Hello") - null Unnecessary
.setTitle(String title, boolean isBold) .setTitle("Hello", false) - null, true Unnecessary
.setContent(String message) .setContent("This is Simple Dialog :)") - null Message cannot be empty
.setContent(String message, Integer paddingLeftDp) .setContent("This is Simple Dialog :)", 3) - null, null Message cannot be empty
.setGuideImage(int imageId) .setGuideImage(R.drawable.image_guide_pinch) - null Unnecessary
.setGuideImage(int imageId, Integer paddingDp) .setGuideImage(R.drawable.image_guide_pinch, 10) - null, 18 Unnecessary
.setGuideImageSizeDp(Integer width, Integer height) .setGuideImageSizeDp(150, 150) - null, null Unnecessary ( android:scaleType="fitCenter" )
.setPermanentCheck(String preferenceName, String preferenceKey) .setPermanentCheck(Pref.PREFERENCE_NAME, Pref.KEY_FIRST_WELCOME) - null, null Unnecessary
.setBtnPermanentCheckText(String message) .setBtnPermanentCheckText("Don't ask again") - "Don't show again" setPermanentCheck needs to be set
.setBtnPermanentCheckText(String message, boolean isBold) .setBtnPermanentCheckText("Don't ask again", true) - "Don't show again", false setPermanentCheck needs to be set
.setBtnPermanentCheckTextSizeDp(int textSizeDp) .setBtnPermanentCheckTextSizeDp(11) - 13 setPermanentCheck needs to be set
.setBtnConfirmText(String message) .setBtnConfirmText("Confirm") .setBtnConfirmText( getString(R.string.text_confirm) ) "Confirm" Unnecessary (Automatically will be set)
.setBtnConfirmText(String message, boolean isBold) .setBtnConfirmText("Confirm", false) .setBtnConfirmText( getString(R.string.text_confirm), false ) "Confirm", true Unnecessary (Automatically will be set)
.setBtnConfirmTextSizeDp(int textSizeInDp) .setBtnConfirmTextSizeDp(15) - 14 Unnecessary
.setBtnConfirmTextColor(Integer color) .setBtnConfirmTextColor(R.color.btnConfirmColor) - R.color.colorPrimary Unnecessary
.setBtnConfirmTextColor(String color) .setBtnConfirmTextColor("#333333") - R.color.colorPrimary Unnecessary
.onConfirm(BtnCallback callback) .onConfirm(new SimpleDialog.BtnCallback() { @Override public void onClick(@NonNull SimpleDialog dialog, @NonNull SimpleDialog.BtnAction which) { // Do something } }) - null Unnecessary (will be dismissed)
.onConfirm(BtnCallbackWithPermanentCheck callback) .onConfirm(new SimpleDialog.BtnCallbackWithPermanentCheck() { @Override public void onClick(@NonNull SimpleDialog dialog, @NonNull SimpleDialog.BtnAction which, boolean isPermanentChecked) { if( isPermanentChecked ) // Do something } }) - null Unnecessary (If you don't want to show again if checkbox is checked, simply use showIfPermanentValueIsFalse() instead of just show())

Custom Dialog

  • CustomView is already in ScrollView (If your customView is long enough, it will automatically scroll)
  • PermanentCheckButton cannot be used with CancelButton
  • .setContent, .showProgress are unavailable when you want Custom Dialog
Setter Ex) 1 Ex) 2 Default value Description
.setTitle(String title) .setTitle("Hello") - null Unnecessary
.setTitle(String title, boolean isBold) .setTitle("Hello", false) - null, true Unnecessary
.setCustomView(int layoutRes) .setCustomView(R.layout.brouding_simple_dialog_test_layout_custom) - null Unnecessary
.setCustomView(View view) .setCustomView( (View)myCustomView ) - null Unnecessary
.setPermanentCheck(String preferenceName, String preferenceKey) .setPermanentCheck(Pref.PREFERENCE_NAME, Pref.KEY_FIRST_WELCOME) - null, null Unnecessary
.setBtnPermanentCheckText(String message) .setBtnPermanentCheckText("Don't ask again") - "Don't show again" setPermanentCheck needs to be set
.setBtnPermanentCheckText(String message, boolean isBold) .setBtnPermanentCheckText("Don't ask again", true) - "Don't show again", false setPermanentCheck needs to be set
.setBtnPermanentCheckTextSizeDp(int textSizeDp) .setBtnPermanentCheckTextSizeDp(11) - 13 setPermanentCheck needs to be set
.setBtnConfirmText(String message) .setBtnConfirmText("Confirm") .setBtnConfirmText( getString(R.string.text_confirm) ) "Confirm" Unnecessary (Automatically will be set)
.setBtnConfirmText(String message, boolean isBold) .setBtnConfirmText("Confirm", false) .setBtnConfirmText( getString(R.string.text_confirm), false ) "Confirm", true Unnecessary (Automatically will be set)
.setBtnConfirmTextSizeDp(int textSizeInDp) .setBtnConfirmTextSizeDp(15) - 14 Unnecessary
.setBtnConfirmTextColor(Integer color) .setBtnConfirmTextColor(R.color.btnConfirmColor) - R.color.colorPrimary Unnecessary
.setBtnConfirmTextColor(String color) .setBtnConfirmTextColor("#333333") - R.color.colorPrimary Unnecessary
.onConfirm(BtnCallback callback) .onConfirm(new SimpleDialog.BtnCallback() { @Override public void onClick(@NonNull SimpleDialog dialog, @NonNull SimpleDialog.BtnAction which) { // Do something } }) - null Unnecessary (will be dismissed)
.onConfirm(BtnCallbackWithPermanentCheck callback) .onConfirm(new SimpleDialog.BtnCallbackWithPermanentCheck() { @Override public void onClick(@NonNull SimpleDialog dialog, @NonNull SimpleDialog.BtnAction which, boolean isPermanentChecked) { if( isPermanentChecked ) // Do something } }) - null Unnecessary (If you don't want to show again if checkbox is checked, simply use showIfPermanentValueIsFalse() instead of just show())
.setBtnCancelText(String message) .setBtnCancelText("Cancel") .setBtnCancelText( getString(R.string.text_cancel) ) null Unnecessary
.setBtnCancelText(String message, boolean isBold) .setBtnCancelText("Cancel", false) .setBtnCancelText( getString(R.string.text_cancel), false ) null, true Unnecessary
.setBtnCancelTextSizeDp(int textSizeInDp) .setBtnCancelTextSizeDp(15) - 14 Unnecessary
.setBtnCancelTextColor(Integer color) .setBtnCancelTextColor(R.color.btnCancelColor) - R.color.colorPrimary Unnecessary
.setBtnCancelTextColor(String color) .setBtnCancelTextColor("#333333") - R.color.colorPrimary Unnecessary
.onCancel(BtnCallback callback) .onCancel(new SimpleDialog.BtnCallback() { @Override public void onClick(@NonNull SimpleDialog dialog, @NonNull SimpleDialog.BtnAction which) { // Do something } }) - null Unnecessary (will be dismissed)

Commons

  • All dialogs can use these
Setter Ex) 1 Ex) 2 Default value Description
.setTag(Object tag) .setTag(Const.NETWORK_ERROR) - null Unnecessary
.setCancelable(boolean isCancelable) .setCancelable(true) - false Unnecessary
.setCancelableOnTouchOutside(boolean isCancelableOnTouchOutside) .setCancelableOnTouchOutside(true) - false Unnecessary
.onDialogCancel(OnDismissListener listener) .onDialogCancel(new DialogInterface.OnCancelListener() { @Override public void onCancel(DialogInterface dialog) { // Do something } }) - null Unnecessary
.onDialogShow(OnShowListener listener) .onDialogShow(new DialogInterface.OnShowListener() { @Override public void onShow(DialogInterface dialog) { // Do something } }) - null Unnecessary
.onDialogDismiss(OnDismissListener listener) .onDialogDismiss(new DialogInterface.OnDismissListener() { @Override public void onDimiss(DialogInterface dialog) { // Do something } }) - null Unnecessary
Clone this wiki locally