Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ab9b0024 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Clean up DialogInterface lint warnings, docs, ws"

parents 72ad5bd8 a3843015
Loading
Loading
Loading
Loading
+60 −61
Original line number Diff line number Diff line
@@ -19,45 +19,43 @@ package android.content;
import android.view.KeyEvent;

/**
 * 
 * Interface that defines a dialog-type class that can be shown, dismissed, or
 * canceled, and may have buttons that can be clicked.
 */
public interface DialogInterface {
    /**
     * The identifier for the positive button.
     */
    public static final int BUTTON_POSITIVE = -1;
    /** The identifier for the positive button. */
    int BUTTON_POSITIVE = -1;

    /**
     * The identifier for the negative button. 
     */
    public static final int BUTTON_NEGATIVE = -2;
    /** The identifier for the negative button. */
    int BUTTON_NEGATIVE = -2;

    /**
     * The identifier for the neutral button. 
     */
    public static final int BUTTON_NEUTRAL = -3;
    /** The identifier for the neutral button. */
    int BUTTON_NEUTRAL = -3;

    /**
     * @deprecated Use {@link #BUTTON_POSITIVE}
     */
    /** @deprecated Use {@link #BUTTON_POSITIVE} */
    @Deprecated
    public static final int BUTTON1 = BUTTON_POSITIVE;
    int BUTTON1 = BUTTON_POSITIVE;

    /**
     * @deprecated Use {@link #BUTTON_NEGATIVE}
     */
    /** @deprecated Use {@link #BUTTON_NEGATIVE} */
    @Deprecated
    public static final int BUTTON2 = BUTTON_NEGATIVE;
    int BUTTON2 = BUTTON_NEGATIVE;

    /**
     * @deprecated Use {@link #BUTTON_NEUTRAL}
     */
    /** @deprecated Use {@link #BUTTON_NEUTRAL} */
    @Deprecated
    public static final int BUTTON3 = BUTTON_NEUTRAL;
    int BUTTON3 = BUTTON_NEUTRAL;

    public void cancel();
    /**
     * Cancels the dialog, invoking the {@link OnCancelListener}.
     * <p>
     * The {@link OnDismissListener} may also be called if cancellation
     * dismisses the dialog.
     */
    void cancel();

    public void dismiss();
    /**
     * Dismisses the dialog, invoking the {@link OnDismissListener}.
     */
    void dismiss();

    /**
     * Interface used to allow the creator of a dialog to run some code when the
@@ -71,10 +69,10 @@ public interface DialogInterface {
        /**
         * This method will be invoked when the dialog is canceled.
         *
         * @param dialog The dialog that was canceled will be passed into the
         *            method.
         * @param dialog the dialog that was canceled will be passed into the
         *               method
         */
        public void onCancel(DialogInterface dialog);
        void onCancel(DialogInterface dialog);
    }

    /**
@@ -85,10 +83,10 @@ public interface DialogInterface {
        /**
         * This method will be invoked when the dialog is dismissed.
         *
         * @param dialog The dialog that was dismissed will be passed into the
         *            method.
         * @param dialog the dialog that was dismissed will be passed into the
         *               method
         */
        public void onDismiss(DialogInterface dialog);
        void onDismiss(DialogInterface dialog);
    }

    /**
@@ -99,27 +97,26 @@ public interface DialogInterface {
        /**
         * This method will be invoked when the dialog is shown.
         *
         * @param dialog The dialog that was shown will be passed into the
         *            method.
         * @param dialog the dialog that was shown will be passed into the
         *               method
         */
        public void onShow(DialogInterface dialog);
        void onShow(DialogInterface dialog);
    }

    /**
     * Interface used to allow the creator of a dialog to run some code when an
     * item on the dialog is clicked..
     * item on the dialog is clicked.
     */
    interface OnClickListener {
        /**
         * This method will be invoked when a button in the 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.
         * @param dialog the dialog that received the click
         * @param which the button that was clicked (ex.
         *              {@link DialogInterface#BUTTON_POSITIVE}) or the position
         *              of the item clicked
         */
        /* TODO: Change to use BUTTON_POSITIVE after API council */
        public void onClick(DialogInterface dialog, int which);
        void onClick(DialogInterface dialog, int which);
    }

    /**
@@ -130,11 +127,12 @@ public interface DialogInterface {
        /**
         * This method will be invoked when an item in the 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 the dialog where the selection was made
         * @param which the position of the item in the list that was clicked
         * @param isChecked {@code true} if the click checked the item, else
         *                  {@code false}
         */
        public void onClick(DialogInterface dialog, int which, boolean isChecked);
        void onClick(DialogInterface dialog, int which, boolean isChecked);
    }

    /**
@@ -147,12 +145,13 @@ public interface DialogInterface {
         * 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 listener has consumed the event, false otherwise.
         */
        public boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event);
         * @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 {@code true} if the listener has consumed the event,
         *         {@code false} otherwise
         */
        boolean onKey(DialogInterface dialog, int keyCode, KeyEvent event);
    }
}