/* DialogInterface*/
public interfaceDialogInterface {
/**
* The identifier for the positive button.
*/
/*
* 确定按钮的识别标记
*/
public static final int BUTTON_POSITIVE= -1;
/**
* The identifier for the negative button.
*/
/*
* 取消按钮的识别标记
*/
public static final int BUTTON_NEGATIVE= -2;
/**
* The identifier for the neutral button.
*/
/*
* 中立按钮的识别标记
*/
public static final int BUTTON_NEUTRAL= -3;
/**
* @deprecated Use {@link#BUTTON_POSITIVE}
*/
@Deprecated
// 不推荐使用,跟上面三个识别标记一样
public static final int BUTTON1 = BUTTON_POSITIVE;
/**
* @deprecated Use {@link#BUTTON_NEGATIVE}
*/
@Deprecated
public static final int BUTTON2 = BUTTON_NEGATIVE;
/**
* @deprecated Use {@link#BUTTON_NEUTRAL}
*/
@Deprecated
public static final int BUTTON3 = BUTTON_NEUTRAL;
public void cancel();
public void dismiss();
/**
* Interface used to allow the creator of adialog to run some code when the
* dialog is canceled.
* <p>
* This will only be called when the dialog iscanceled, if the creator
* needs to know when it is dismissed ingeneral, use
* {@linkDialogInterface.OnDismissListener}.
*/
/*
* 这个接口用于当对话框取消的时候对话框的构造器运行一些代码这个接口只会在对话框被取消的时候调用,如果构造器需要知道什么时候被解除掉的,
* 使用DialogInterface.OnDismissListener接口
*/
interface OnCancelListener{
/**
* This method will be invoked when the dialogis canceled.
*
* @param dialog
* The dialog that was canceled will be passed into the
* method.
*/
/*
* 这个方法在对话框被取消的时候被调用,是取消之后立即执行
*
* @param dialog
*/
public voidonCancel(DialogInterface dialog);
}
/**
* Interface used to allow the creator of adialog to run some code when the
* dialog is dismissed.
*/
/*
* 这个接口用于当对话框被解除的时候对话框的构造器运行一些代码,解除之后立即执行
*/
interfaceOnDismissListener {
/**
* This method will be invoked when the dialogis dismissed.
*
* @param dialog
* The dialog that was dismissed will be passed into the
* method.
*/
/*
* 这个方法在对话框被解除的时候被调用,是解除之后立即执行
*
* @param dialog
*/
public voidonDismiss(DialogInterface dialog);
}
/**
* Interface used to allow the creator of adialog to run some code when the
* dialog is shown.
*/
/*
* 这个接口用于当对话框被显示的时候对话框的构造器运行一些代码,显示之后立即执行
*/
interface OnShowListener {
/**
* This method will be invoked when the dialogis shown.
*
* @param dialog
* The dialog that was shown will be passed into the method.
*/
/*
* 这个方法在对话框被显示的时候被调用,显示之后立即执行
*
* @param dialog
*/
public void onShow(DialogInterfacedialog);
}
/**
* Interface used to allow the creator of adialog to run some code when an
* item on the dialog is clicked..
*/
/*
* 这个接口用于当对话框里的一个item被点击的时候对话框的构造器运行一些代码,点击之后立即执行
*/
interface OnClickListener{
/**
* This method will be invoked when a button inthe dialog is clicked.
*
* @param dialog
* The dialog that received the click.
* @param which
* The button that was clicked (e.g.
* {@link DialogInterface#BUTTON1}) or the position of the
* item clicked.
*/
/* TODO: Change to use BUTTON_POSITIVE after API council */
/*
* 这个方法在对话框里的按钮被点击的时候被调用,点击之后立即执行
*
* @param dialog
*
* @param which 被点击的那个按钮或者被点击的item的位置,使用BUTTON_POSITIVE等来识别点击的是哪个按钮
*/
public void onClick(DialogInterfacedialog, intwhich);
}
/**
* Interface used to allow the creator of adialog to run some code when an
* item in a multi-choice dialog isclicked.
*/
/*
* 这个接口用于当多选对话框里的一个item被点击的时候对话框的构造器运行一些代码,点击之后立即执行多选对话框是那种打钩的方框,可以多个都打钩
*/
interfaceOnMultiChoiceClickListener {
/**
* This method will be invoked when an item inthe dialog is clicked.
*
* @param dialog
* The dialog where the selection was made.
* @param which
* The position of the item in the list that was clicked.
* @param isChecked
* True if the click checked the item, else false.
*/
/*
* @param dialog
*
* @param which 被点击的那个item的位置
*
* @param isChecked 表示是打钩还是取消,两个状态
*/
public void onClick(DialogInterfacedialog, intwhich, booleanisChecked);
}
/**
* Interface definition for a callback to beinvoked when a key event is
* dispatched to this dialog. The callback willbe invoked before the key
* event is given to the dialog.
*/
/*
* 这个接口定义用于当按键事件被分发到这个对话框的时候回调这个方法。这个回调将在按键事件分发到这个对话框之前执行
*/
interface OnKeyListener {
/**
* Called when a key is dispatched to a dialog.This allows listeners to
* get a chance to respond before the dialog.
*
* @param dialog
* The dialog the key has been dispatched to.
* @param keyCode
* The code for the physical key that was pressed
* @param event
* The KeyEvent object containing full information about the
* event.
* @return True if the listenerhas consumed the event, false otherwise.
*/
/*
* 当按键事件分发到这个对话框的时候调用。
*
* @param dialog
*
* @param keyCode 这个按键编码用于物理按键被按下时
*
* @param event 这个按键事件对象包含了事件的所有信息
*
* @return 当监听器消耗的这次事件将返回true,否则返回false
*/
public boolean onKey(DialogInterfacedialog, intkeyCode, KeyEvent event);
}
}