Common android components, helper functions, adaptors, dialogs, logs and extentions functions that is required for almost every application at startup.
- Dialogs
- Adaptors
- Extensions
- Preference
- Input Validator
- Information Dialog
- Warning Dialog
- Error Dialog
- Delete Dialog
- Wait Dialog
- How to use
- Calling From Java
infoDialog(
this, // context
"Information", // title
"Some informational message", // message
true // cancelable on back press or touch anywhere on the screen
).show()
infoDialog(
this, // context
"Information", // title
"Some informational message", // message
true // cancelable on back press or touch anywhere on the screen
).setPositiveButton("OK") { dialog, _ ->
// Ok button action
dialog.dismiss()
}.setNegativeButton("Close") { dialog, _ ->
// close button action
dialog.dismiss()
}.show()
warningDialog(
this, // context
"Warning", // title
"Some warning message", // message
true // cancelable on back press or touch anywhere on the screen
).show()
warningDialog(
this, // context
"Warning", // title
"Some warning message", // message
true // cancelable on back press or touch anywhere on the screen
).setPositiveButton("OK") { dialog, _ ->
// Ok button action
dialog.dismiss()
}.setNegativeButton("Close") { dialog, _ ->
// close button action
dialog.dismiss()
}.show()
errorDialog(
this, // context
"Error", // title
"Some error message", // message
true // cancelable on back press or touch anywhere on the screen
).show()
errorDialog(
this, // context
"Error", // title
"Some error message", // message
true // cancelable on back press or touch anywhere on the screen
).setPositiveButton("OK") { dialog, _ ->
// Ok button action
dialog.dismiss()
}.setNegativeButton("Close") { dialog, _ ->
// close button action
dialog.dismiss()
}.show()
confirmDelete(
this, // context
"Confirm Delete", // title
"Some confirmation message", // message
true // cancelable on back press or touch anywhere on the screen
).setPositiveButton("Delete") { dialog, _ ->
// Ok button action
dialog.dismiss()
}.setNegativeButton("Close") { dialog, _ ->
// close button action
dialog.dismiss()
}.show()
.getButton(AlertDialog.BUTTON_POSITIVE)
.setTextColor(ContextCompat.getColor(this, android.R.color.holo_red_light))
waitDialog(
this, // context
"Loading, Please wait...", // message
true // cancelable on back press or touch anywhere on the screen
).show()
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.ArbazMateen.Commons:dialogs:0.1.2'
}
Dialog.infoDialog(
this,
"Some informational message"
).setPositiveButton("", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// positive button action
dialog.dismiss();
}
}).setNegativeButton("Close", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
// negative button action
dialog.dismiss();
}
}).show();