public class NacDialog
extends java.lang.Object
implements android.view.View.OnClickListener, android.view.View.OnLayoutChangeListener, android.content.DialogInterface.OnClickListener, android.content.DialogInterface.OnCancelListener
Modifier and Type | Class and Description |
---|---|
static interface |
NacDialog.OnBuildListener
Build listener.
|
static interface |
NacDialog.OnCancelListener
Cancel listener.
|
static interface |
NacDialog.OnDismissListener
Dismiss listener.
|
static interface |
NacDialog.OnHideListener
Hide listener.
|
static interface |
NacDialog.OnNeutralActionListener
Neutral action listener.
|
static interface |
NacDialog.OnShowListener
Show listener.
|
static class |
NacDialog.Scaler
Scaling structure.
|
Modifier and Type | Method and Description |
---|---|
void |
addOnCancelListener(NacDialog.OnCancelListener listener)
Add an OnCancelListener.
|
void |
addOnDismissListener(NacDialog.OnDismissListener listener)
Add an OnDismissListener.
|
void |
addOnHideListener(NacDialog.OnHideListener listener)
Add an OnHideListener.
|
void |
addOnNeutralActionListener(NacDialog.OnNeutralActionListener listener)
Add an OnNeutralActionListener.
|
void |
addOnShowListener(NacDialog.OnShowListener listener)
Add an OnShowListener.
|
android.app.AlertDialog.Builder |
build(android.content.Context context) |
android.app.AlertDialog.Builder |
build(android.content.Context context,
int id)
Build the dialog with given layout ID.
|
android.app.AlertDialog.Builder |
build(android.content.Context context,
android.view.View root)
Build the dialog with the given root view.
|
int |
calculateDialogHeight(int screenHeight)
Calculate the dialog width.
|
int |
calculateDialogWidth(int screenWidth)
Calculate the dialog width.
|
void |
callOnCancelListeners()
Call the OnCancelDialog listeners.
|
void |
callOnDismissListeners()
Call the OnDismissDialog listeners.
|
void |
callOnNeutralActionListeners()
Call the OnNeutralAction listeners.
|
void |
cancel()
Cancel the dialog and call the onCancelDialog listener.
|
void |
cancelDialog()
Cancel the dialog.
|
boolean |
canCloseDialog() |
protected void |
closeKeyboard()
Close the keyboard.
|
void |
dismiss()
Dismiss the dialog and call the onDismissDialog listener.
|
void |
dismissDialog()
Dismiss the dialog.
|
android.app.AlertDialog |
getAlertDialog() |
protected android.app.AlertDialog.Builder |
getBuilder() |
android.content.Context |
getContext() |
java.lang.Object |
getData() |
boolean |
getDataBoolean() |
float |
getDataFloat() |
int |
getDataInt() |
java.lang.String |
getDataString() |
java.lang.Object |
getId() |
int |
getLayoutId() |
android.view.View |
getRoot() |
android.view.Window |
getWindow() |
void |
hide()
Hide the dialog and call the onHideDialog listener.
|
void |
neutral()
Neutral action on the dialog and call the onActionDialog listener.
|
void |
neutralDismiss()
Dismiss the dialog neutrally (so as not to call the cancel/dismiss
listeners).
|
void |
onBuildDialog(android.content.Context context,
android.app.AlertDialog.Builder builder)
Called when the dialog is being built.
|
void |
onCancel(android.content.DialogInterface dialog) |
void |
onClick(android.content.DialogInterface dialog,
int which)
Handles click events on the Ok/Cancel buttons in the dialog.
|
void |
onClick(android.view.View view)
Handles clicks events for the Neutral button, so that the user can
choose whether it closes the dialog or not.
|
void |
onLayoutChange(android.view.View v,
int left,
int top,
int right,
int bottom,
int oldLeft,
int oldTop,
int oldRight,
int oldBottom)
Scale the dialog's width and height.
|
void |
saveData(java.lang.Object data)
Save data.
|
void |
scale(double width,
double height,
boolean wrapWidth,
boolean wrapHeight)
Scale the dialog size.
|
void |
setId(java.lang.Object id)
Set the unique identifier.
|
void |
setLayoutId(int id)
Set the layout.
|
void |
setNegativeButton(java.lang.String title)
Set the negative button which will call onCancelDialog when clicked.
|
void |
setNeutralButton(java.lang.String title)
Set the neutral button which will call onActionDialog when clicked.
|
void |
setOnBuildListener(NacDialog.OnBuildListener listener)
Set the onBuild listener.
|
void |
setPositiveButton(java.lang.String title)
Set the positive button which will call onDismissDialog when clicked.
|
void |
setupDialog()
Setup dialog colors and listeners.
|
void |
show()
Show the dialog.
|
protected void |
showKeyboard()
Show the keyboard.
|
boolean |
wasCanceledOrDismissed()
Check the status of whether the dialog was canceled or dismissed.
|
public void addOnCancelListener(NacDialog.OnCancelListener listener)
public void addOnDismissListener(NacDialog.OnDismissListener listener)
public void addOnHideListener(NacDialog.OnHideListener listener)
public void addOnNeutralActionListener(NacDialog.OnNeutralActionListener listener)
public void addOnShowListener(NacDialog.OnShowListener listener)
public android.app.AlertDialog.Builder build(android.content.Context context)
build(Context, int)
public android.app.AlertDialog.Builder build(android.content.Context context, int id)
context
- The context.id
- The layout ID.public android.app.AlertDialog.Builder build(android.content.Context context, android.view.View root)
context
- The context.root
- The view to attach to the dialog.public int calculateDialogHeight(int screenHeight)
screenHeight
- The height of the phone screen.public int calculateDialogWidth(int screenWidth)
screenWidth
- The width of the phone screen.public void callOnCancelListeners()
public void callOnDismissListeners()
public void callOnNeutralActionListeners()
public void cancel()
public void cancelDialog()
public boolean canCloseDialog()
protected void closeKeyboard()
public void dismiss()
public void dismissDialog()
public android.app.AlertDialog getAlertDialog()
protected android.app.AlertDialog.Builder getBuilder()
public android.content.Context getContext()
public java.lang.Object getData()
public boolean getDataBoolean()
public float getDataFloat()
public int getDataInt()
public java.lang.String getDataString()
public java.lang.Object getId()
public int getLayoutId()
public android.view.View getRoot()
public android.view.Window getWindow()
public void hide()
public void neutral()
public void neutralDismiss()
public void onBuildDialog(android.content.Context context, android.app.AlertDialog.Builder builder)
public void onClick(android.view.View view)
onClick
in interface android.view.View.OnClickListener
public void onClick(android.content.DialogInterface dialog, int which)
onClick
in interface android.content.DialogInterface.OnClickListener
public void onCancel(android.content.DialogInterface dialog)
onCancel
in interface android.content.DialogInterface.OnCancelListener
public void onLayoutChange(android.view.View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom)
onLayoutChange
in interface android.view.View.OnLayoutChangeListener
public void saveData(java.lang.Object data)
data
- Data to save.public void scale(double width, double height, boolean wrapWidth, boolean wrapHeight)
width
- Width. Value must be 0 <= w <= 1.height
- Height. Value must be 0 <= h <= 1.wrapWidth
- Wrap the width in the event that the dialog is
scaled too big.wrapHeight
- Wrap the height in the event that the dialog is
scaled too big.public void setId(java.lang.Object id)
public void setLayoutId(int id)
public void setNegativeButton(java.lang.String title)
public void setNeutralButton(java.lang.String title)
public void setOnBuildListener(NacDialog.OnBuildListener listener)
public void setPositiveButton(java.lang.String title)
public void setupDialog()
public void show()
protected void showKeyboard()
public boolean wasCanceledOrDismissed()