Commit 7dd28459 authored by Michael Thiessen's avatar Michael Thiessen Committed by Commit Bot

Pass the InputEvent to the dialog action Click handler.

See bug for details.

Bug: 968332
Change-Id: Iae95aa03dbb5b8841e0daebcafa51ec183d87b2a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1636477Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Commit-Queue: Michael Thiessen <mthiesse@chromium.org>
Cr-Commit-Position: refs/heads/master@{#664742}
parent 5b75d433
......@@ -66,7 +66,7 @@ public class TouchlessContextMenuManager extends ContextMenuManager {
*/
public void showTouchlessContextMenu(
ModalDialogManager modalDialogManager, ContextMenuManager.Delegate delegate) {
ArrayList<PropertyModel> menuItems = new ArrayList();
ArrayList<PropertyModel> menuItems = new ArrayList<>();
for (@ContextMenuItemId int itemId = 0; itemId < ContextMenuItemId.NUM_ENTRIES; itemId++) {
if (!shouldShowItem(itemId, delegate)) continue;
......
......@@ -7,7 +7,8 @@ package org.chromium.chrome.browser.touchless.dialog;
import android.graphics.drawable.Drawable;
import android.support.annotation.IntDef;
import android.support.annotation.StringRes;
import android.view.View.OnClickListener;
import android.view.InputEvent;
import android.view.View;
import org.chromium.ui.modaldialog.ModalDialogProperties;
import org.chromium.ui.modelutil.PropertyKey;
......@@ -38,6 +39,18 @@ public class TouchlessDialogProperties {
int LOW = 2;
}
/**
* A click listener for dialog actions.
*/
public interface OnClickListener {
/**
* Called when a view has been clicked.
*
* @param event The input event that triggered the click.
*/
void onClick(InputEvent event);
}
/** Properties that determine how list items are displayed in the touchless dialog. */
public static class DialogListItemProperties {
/** The icon of the dialog. */
......@@ -53,7 +66,7 @@ public class TouchlessDialogProperties {
new WritableBooleanPropertyKey();
/** The action to be performed when the item is selected. */
public static final WritableObjectPropertyKey<OnClickListener> CLICK_LISTENER =
public static final WritableObjectPropertyKey<View.OnClickListener> CLICK_LISTENER =
new WritableObjectPropertyKey<>();
/** Whether this item has a focus change listener attached to its view. */
......@@ -94,7 +107,8 @@ public class TouchlessDialogProperties {
public static final WritableObjectPropertyKey<OnClickListener> CANCEL_ACTION =
new WritableObjectPropertyKey<>();
/** True if the action is handled externally to the dialog */
/** Do not use, this is in the process of being deleted. */
@Deprecated
public static final WritableBooleanPropertyKey IS_CANCEL_ACTION_EXTERNAL =
new WritableBooleanPropertyKey();
......@@ -102,19 +116,19 @@ public class TouchlessDialogProperties {
public static final WritableObjectPropertyKey<OnClickListener> ALT_ACTION =
new WritableObjectPropertyKey<>();
/** True if the action is handled externally to the dialog */
/** Do not use, this is in the process of being deleted. */
@Deprecated
public static final WritableBooleanPropertyKey IS_ALT_ACTION_EXTERNAL =
new WritableBooleanPropertyKey();
/** The priority for this set of properties. */
public static final WritableIntPropertyKey PRIORITY = new WritableIntPropertyKey();
public static final PropertyKey[] MINIMAL_DIALOG_KEYS = {ModalDialogProperties.TITLE,
ACTION_NAMES, CANCEL_ACTION, IS_CANCEL_ACTION_EXTERNAL, ALT_ACTION,
IS_ALT_ACTION_EXTERNAL, PRIORITY};
public static final PropertyKey[] MINIMAL_DIALOG_KEYS = {
ModalDialogProperties.TITLE, ACTION_NAMES, CANCEL_ACTION, ALT_ACTION, PRIORITY};
public static final PropertyKey[] ALL_DIALOG_KEYS = PropertyModel.concatKeys(
ModalDialogProperties.ALL_KEYS,
new PropertyKey[] {ACTION_NAMES, CANCEL_ACTION, IS_CANCEL_ACTION_EXTERNAL, ALT_ACTION,
IS_ALT_ACTION_EXTERNAL, PRIORITY, IS_FULLSCREEN, LIST_MODELS});
public static final PropertyKey[] ALL_DIALOG_KEYS =
PropertyModel.concatKeys(ModalDialogProperties.ALL_KEYS,
new PropertyKey[] {ACTION_NAMES, CANCEL_ACTION, ALT_ACTION, PRIORITY,
IS_FULLSCREEN, LIST_MODELS});
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment