Search in sources :

Example 1 with MenuHelper

use of com.android.internal.view.menu.MenuHelper in project platform_frameworks_base by android.

the class DecorView method showContextMenuForChildInternal.

private boolean showContextMenuForChildInternal(View originalView, float x, float y) {
    // Only allow one context menu at a time.
    if (mWindow.mContextMenuHelper != null) {
        mWindow.mContextMenuHelper.dismiss();
        mWindow.mContextMenuHelper = null;
    }
    // Reuse the context menu builder.
    final PhoneWindowMenuCallback callback = mWindow.mContextMenuCallback;
    if (mWindow.mContextMenu == null) {
        mWindow.mContextMenu = new ContextMenuBuilder(getContext());
        mWindow.mContextMenu.setCallback(callback);
    } else {
        mWindow.mContextMenu.clearAll();
    }
    final MenuHelper helper;
    final boolean isPopup = !Float.isNaN(x) && !Float.isNaN(y);
    if (isPopup) {
        helper = mWindow.mContextMenu.showPopup(getContext(), originalView, x, y);
    } else {
        helper = mWindow.mContextMenu.showDialog(originalView, originalView.getWindowToken());
    }
    if (helper != null) {
        // If it's a dialog, the callback needs to handle showing
        // sub-menus. Either way, the callback is required for propagating
        // selection to Context.onContextMenuItemSelected().
        callback.setShowDialogForSubmenu(!isPopup);
        helper.setPresenterCallback(callback);
    }
    mWindow.mContextMenuHelper = helper;
    return helper != null;
}
Also used : PhoneWindowMenuCallback(com.android.internal.policy.PhoneWindow.PhoneWindowMenuCallback) ContextMenuBuilder(com.android.internal.view.menu.ContextMenuBuilder) MenuHelper(com.android.internal.view.menu.MenuHelper)

Example 2 with MenuHelper

use of com.android.internal.view.menu.MenuHelper in project android_frameworks_base by ResurrectionRemix.

the class DecorView method showContextMenuForChildInternal.

private boolean showContextMenuForChildInternal(View originalView, float x, float y) {
    // Only allow one context menu at a time.
    if (mWindow.mContextMenuHelper != null) {
        mWindow.mContextMenuHelper.dismiss();
        mWindow.mContextMenuHelper = null;
    }
    // Reuse the context menu builder.
    final PhoneWindowMenuCallback callback = mWindow.mContextMenuCallback;
    if (mWindow.mContextMenu == null) {
        mWindow.mContextMenu = new ContextMenuBuilder(getContext());
        mWindow.mContextMenu.setCallback(callback);
    } else {
        mWindow.mContextMenu.clearAll();
    }
    final MenuHelper helper;
    final boolean isPopup = !Float.isNaN(x) && !Float.isNaN(y);
    if (isPopup) {
        helper = mWindow.mContextMenu.showPopup(getContext(), originalView, x, y);
    } else {
        helper = mWindow.mContextMenu.showDialog(originalView, originalView.getWindowToken());
    }
    if (helper != null) {
        // If it's a dialog, the callback needs to handle showing
        // sub-menus. Either way, the callback is required for propagating
        // selection to Context.onContextMenuItemSelected().
        callback.setShowDialogForSubmenu(!isPopup);
        helper.setPresenterCallback(callback);
    }
    mWindow.mContextMenuHelper = helper;
    return helper != null;
}
Also used : PhoneWindowMenuCallback(com.android.internal.policy.PhoneWindow.PhoneWindowMenuCallback) ContextMenuBuilder(com.android.internal.view.menu.ContextMenuBuilder) MenuHelper(com.android.internal.view.menu.MenuHelper)

Example 3 with MenuHelper

use of com.android.internal.view.menu.MenuHelper in project android_frameworks_base by AOSPA.

the class DecorView method showContextMenuForChildInternal.

private boolean showContextMenuForChildInternal(View originalView, float x, float y) {
    // Only allow one context menu at a time.
    if (mWindow.mContextMenuHelper != null) {
        mWindow.mContextMenuHelper.dismiss();
        mWindow.mContextMenuHelper = null;
    }
    // Reuse the context menu builder.
    final PhoneWindowMenuCallback callback = mWindow.mContextMenuCallback;
    if (mWindow.mContextMenu == null) {
        mWindow.mContextMenu = new ContextMenuBuilder(getContext());
        mWindow.mContextMenu.setCallback(callback);
    } else {
        mWindow.mContextMenu.clearAll();
    }
    final MenuHelper helper;
    final boolean isPopup = !Float.isNaN(x) && !Float.isNaN(y);
    if (isPopup) {
        helper = mWindow.mContextMenu.showPopup(getContext(), originalView, x, y);
    } else {
        helper = mWindow.mContextMenu.showDialog(originalView, originalView.getWindowToken());
    }
    if (helper != null) {
        // If it's a dialog, the callback needs to handle showing
        // sub-menus. Either way, the callback is required for propagating
        // selection to Context.onContextMenuItemSelected().
        callback.setShowDialogForSubmenu(!isPopup);
        helper.setPresenterCallback(callback);
    }
    mWindow.mContextMenuHelper = helper;
    return helper != null;
}
Also used : PhoneWindowMenuCallback(com.android.internal.policy.PhoneWindow.PhoneWindowMenuCallback) ContextMenuBuilder(com.android.internal.view.menu.ContextMenuBuilder) MenuHelper(com.android.internal.view.menu.MenuHelper)

Example 4 with MenuHelper

use of com.android.internal.view.menu.MenuHelper in project android_frameworks_base by DirtyUnicorns.

the class DecorView method showContextMenuForChildInternal.

private boolean showContextMenuForChildInternal(View originalView, float x, float y) {
    // Only allow one context menu at a time.
    if (mWindow.mContextMenuHelper != null) {
        mWindow.mContextMenuHelper.dismiss();
        mWindow.mContextMenuHelper = null;
    }
    // Reuse the context menu builder.
    final PhoneWindowMenuCallback callback = mWindow.mContextMenuCallback;
    if (mWindow.mContextMenu == null) {
        mWindow.mContextMenu = new ContextMenuBuilder(getContext());
        mWindow.mContextMenu.setCallback(callback);
    } else {
        mWindow.mContextMenu.clearAll();
    }
    final MenuHelper helper;
    final boolean isPopup = !Float.isNaN(x) && !Float.isNaN(y);
    if (isPopup) {
        helper = mWindow.mContextMenu.showPopup(getContext(), originalView, x, y);
    } else {
        helper = mWindow.mContextMenu.showDialog(originalView, originalView.getWindowToken());
    }
    if (helper != null) {
        // If it's a dialog, the callback needs to handle showing
        // sub-menus. Either way, the callback is required for propagating
        // selection to Context.onContextMenuItemSelected().
        callback.setShowDialogForSubmenu(!isPopup);
        helper.setPresenterCallback(callback);
    }
    mWindow.mContextMenuHelper = helper;
    return helper != null;
}
Also used : PhoneWindowMenuCallback(com.android.internal.policy.PhoneWindow.PhoneWindowMenuCallback) ContextMenuBuilder(com.android.internal.view.menu.ContextMenuBuilder) MenuHelper(com.android.internal.view.menu.MenuHelper)

Example 5 with MenuHelper

use of com.android.internal.view.menu.MenuHelper in project android_frameworks_base by crdroidandroid.

the class DecorView method showContextMenuForChildInternal.

private boolean showContextMenuForChildInternal(View originalView, float x, float y) {
    // Only allow one context menu at a time.
    if (mWindow.mContextMenuHelper != null) {
        mWindow.mContextMenuHelper.dismiss();
        mWindow.mContextMenuHelper = null;
    }
    // Reuse the context menu builder.
    final PhoneWindowMenuCallback callback = mWindow.mContextMenuCallback;
    if (mWindow.mContextMenu == null) {
        mWindow.mContextMenu = new ContextMenuBuilder(getContext());
        mWindow.mContextMenu.setCallback(callback);
    } else {
        mWindow.mContextMenu.clearAll();
    }
    final MenuHelper helper;
    final boolean isPopup = !Float.isNaN(x) && !Float.isNaN(y);
    if (isPopup) {
        helper = mWindow.mContextMenu.showPopup(getContext(), originalView, x, y);
    } else {
        helper = mWindow.mContextMenu.showDialog(originalView, originalView.getWindowToken());
    }
    if (helper != null) {
        // If it's a dialog, the callback needs to handle showing
        // sub-menus. Either way, the callback is required for propagating
        // selection to Context.onContextMenuItemSelected().
        callback.setShowDialogForSubmenu(!isPopup);
        helper.setPresenterCallback(callback);
    }
    mWindow.mContextMenuHelper = helper;
    return helper != null;
}
Also used : PhoneWindowMenuCallback(com.android.internal.policy.PhoneWindow.PhoneWindowMenuCallback) ContextMenuBuilder(com.android.internal.view.menu.ContextMenuBuilder) MenuHelper(com.android.internal.view.menu.MenuHelper)

Aggregations

PhoneWindowMenuCallback (com.android.internal.policy.PhoneWindow.PhoneWindowMenuCallback)5 ContextMenuBuilder (com.android.internal.view.menu.ContextMenuBuilder)5 MenuHelper (com.android.internal.view.menu.MenuHelper)5