Android Library that shows simple and customizable flat designed dialogs with no title.
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add the dependency
dependencies {
compile 'com.github.EunsilJo:CustomDialog:1.0.3'
}
new CustomDialog.Builder(activity)
.content("The verification e-mail sent. Please check.")
.neutralText("OK")
.onNeutral(new CustomDialog.DialogButtonCallback(){...})
.action(CustomDialog.DialogAction.NEUTRAL)
.cancelable(false)
.build()
.show();
new CustomDialog.Builder(activity)
.content("Are you sure you want to sign out?")
.positiveText("Sign Out")
.onPositive(new CustomDialog.DialogButtonCallback(){...})
.negativeText("Cancel")
.onNegative(new CustomDialog.DialogButtonCallback(){...})
.cancelable(false)
.build()
.show();
You can change color of buttons.
.positiveDrawable(R.color.colorAccent)
.negativeColor(Color.parseColor("#212121"))
new CustomInputDialog.Builder(activity)
.hint("Please enter your review.")
.maxLines(2)
.maxLength(50)
.showLength(true)
.inputCallback(new CustomInputDialog.DialogInputCallback(){...})
.inputColor(CustomDialog.DialogColor.PRIMARYDARK)
.neutralText("OK")
.action(CustomDialog.DialogAction.NEUTRAL)
.cancelable(true)
.build()
.show();
You can set text of prefill.
.prefill("www.instagram.com/")
.showLength(false)
new CustomSelectDialog.Builder(activity)
.items(Arrays.asList("Apple", "Banana", "Cherry", "Durian", "Melon", "Orange"))
.selectedItems(new ArrayList<>(Arrays.asList(1, 2, 5))
.choice(SelectButtonAdapter.CHOICE_MODE.MULTIPLE)
.type(CustomSelectDialog.DialogSelectType.LIST)
.multiChoiceListCallback(new CustomSelectDialog.DialogMultiChoiceListCallback(){...})
.selectColor(CustomDialog.DialogColor.PRIMARY)
.action(CustomDialog.DialogAction.NEUTRAL)
.cancelable(true)
.build()
.show();
You can show select list with button style.
.type(CustomSelectDialog.DialogSelectType.BUTTON)
You can set single choice list.
.selectedItem(1)
.choice(SelectButtonAdapter.CHOICE_MODE.SINGLE)
new CustomDatePickerDialog.Builder(activity)
.year(2017)
.monthOfYear(9)
.dayOfMonth(27)
.showYear(true)
.showMonth(true)
.showDay(true)
.datePickerCallback(new CustomDatePickerDialog.DialogDatePickerCallback(){...})
.dividerColor(CustomDialog.DialogColor.PRIMARY)
.cancelable(true)
.build()
.show();
You can show/hide year, month and day.
.showDay(false)
new CustomTimePickerDialog.Builder(activity)
.hour(18)
.minute(23)
.timePickerCallback(new CustomTimePickerDialog.DialogTimePickerCallback(){...})
.cancelable(true)
.build()
.show();
You can show/hide AM/PM.
.is24HourView(true)
new CustomStartEndPickerDialog.Builder(activity)
.startHour(11)
.startMinute(20)
.endHour(13)
.endMinute(20)
.startEndPickerCallback(CustomStartEndPickerDialog.DialogStartEndPickerCallback(){...})
.cancelable(true)
.build()
.show();
You can pick start and end time.
new CustomMultiPickerDialog.Builder(activity)
.number1(2)
.minMaxValue1(1, 1000)
.number2(2)
.minMaxValue2(0, maxValue2)
.displayValues2(new String[]{"Apple", "Banana", "Cherry", "Durian", "Melon", "Orange"})
.multiPickerCallback(CustomMultiPickerDialog.DialogMultiPickerCallback(){...})
.cancelable(true)
.build()
.show();
You can pick two items.
public interface DialogDatePickerCallback {
void onDateChanged(@NonNull CustomDatePickerDialog dialog, DatePicker view, int year, int monthOfYear, int dayOfMonth);
...
}
- onDateChanged : The callback used to indicate the user changed the date.
Please check the demo app to see examples.