Search in sources :

Example 1 with MenuView

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

the class PhoneWindow method initializePanelContent.

/**
     * Initializes the panel associated with the panel feature state. You must
     * at the very least set PanelFeatureState.panel to the View implementing
     * its contents. The default implementation gets the panel from the menu.
     *
     * @param st The panel state being initialized.
     * @return Whether the initialization was successful.
     */
protected boolean initializePanelContent(PanelFeatureState st) {
    if (st.createdPanelView != null) {
        st.shownPanelView = st.createdPanelView;
        return true;
    }
    if (st.menu == null) {
        return false;
    }
    if (mPanelMenuPresenterCallback == null) {
        mPanelMenuPresenterCallback = new PanelMenuPresenterCallback();
    }
    MenuView menuView = st.isInListMode() ? st.getListMenuView(getContext(), mPanelMenuPresenterCallback) : st.getIconMenuView(getContext(), mPanelMenuPresenterCallback);
    st.shownPanelView = (View) menuView;
    if (st.shownPanelView != null) {
        // Use the menu View's default animations if it has any
        final int defaultAnimations = menuView.getWindowAnimations();
        if (defaultAnimations != 0) {
            st.windowAnimations = defaultAnimations;
        }
        return true;
    } else {
        return false;
    }
}
Also used : MenuView(com.android.internal.view.menu.MenuView)

Example 2 with MenuView

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

the class ActionMenuPresenter method getMenuView.

@Override
public MenuView getMenuView(ViewGroup root) {
    MenuView oldMenuView = mMenuView;
    MenuView result = super.getMenuView(root);
    if (oldMenuView != result) {
        ((ActionMenuView) result).setPresenter(this);
        if (oldMenuView != null) {
            ((View) oldMenuView).removeOnAttachStateChangeListener(mAttachStateChangeListener);
        }
        ((View) result).addOnAttachStateChangeListener(mAttachStateChangeListener);
    }
    return result;
}
Also used : MenuView(com.android.internal.view.menu.MenuView) MenuView(com.android.internal.view.menu.MenuView) View(android.view.View) ActionMenuItemView(com.android.internal.view.menu.ActionMenuItemView)

Example 3 with MenuView

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

the class ActionMenuPresenter method computeMenuItemAnimationInfo.

/**
     * Store layout information about current items in the menu. This is stored for
     * both pre- and post-layout phases and compared in runItemAnimations() to determine
     * the animations that need to be run on any item changes.
     *
     * @param preLayout Whether this is being called in the pre-layout phase. This is passed
     * into the MenuItemLayoutInfo structure to store the appropriate position values.
     */
private void computeMenuItemAnimationInfo(boolean preLayout) {
    final ViewGroup menuView = (ViewGroup) mMenuView;
    final int count = menuView.getChildCount();
    SparseArray items = preLayout ? mPreLayoutItems : mPostLayoutItems;
    for (int i = 0; i < count; ++i) {
        View child = menuView.getChildAt(i);
        final int id = child.getId();
        if (id > 0 && child.getWidth() != 0 && child.getHeight() != 0) {
            MenuItemLayoutInfo info = new MenuItemLayoutInfo(child, preLayout);
            items.put(id, info);
        }
    }
}
Also used : SparseArray(android.util.SparseArray) ViewGroup(android.view.ViewGroup) MenuView(com.android.internal.view.menu.MenuView) View(android.view.View) ActionMenuItemView(com.android.internal.view.menu.ActionMenuItemView)

Example 4 with MenuView

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

the class ActionMenuPresenter method getMenuView.

@Override
public MenuView getMenuView(ViewGroup root) {
    MenuView oldMenuView = mMenuView;
    MenuView result = super.getMenuView(root);
    if (oldMenuView != result) {
        ((ActionMenuView) result).setPresenter(this);
        if (oldMenuView != null) {
            ((View) oldMenuView).removeOnAttachStateChangeListener(mAttachStateChangeListener);
        }
        ((View) result).addOnAttachStateChangeListener(mAttachStateChangeListener);
    }
    return result;
}
Also used : MenuView(com.android.internal.view.menu.MenuView) MenuView(com.android.internal.view.menu.MenuView) View(android.view.View) ActionMenuItemView(com.android.internal.view.menu.ActionMenuItemView)

Example 5 with MenuView

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

the class ActionMenuPresenter method computeMenuItemAnimationInfo.

/**
     * Store layout information about current items in the menu. This is stored for
     * both pre- and post-layout phases and compared in runItemAnimations() to determine
     * the animations that need to be run on any item changes.
     *
     * @param preLayout Whether this is being called in the pre-layout phase. This is passed
     * into the MenuItemLayoutInfo structure to store the appropriate position values.
     */
private void computeMenuItemAnimationInfo(boolean preLayout) {
    final ViewGroup menuView = (ViewGroup) mMenuView;
    final int count = menuView.getChildCount();
    SparseArray items = preLayout ? mPreLayoutItems : mPostLayoutItems;
    for (int i = 0; i < count; ++i) {
        View child = menuView.getChildAt(i);
        final int id = child.getId();
        if (id > 0 && child.getWidth() != 0 && child.getHeight() != 0) {
            MenuItemLayoutInfo info = new MenuItemLayoutInfo(child, preLayout);
            items.put(id, info);
        }
    }
}
Also used : SparseArray(android.util.SparseArray) ViewGroup(android.view.ViewGroup) MenuView(com.android.internal.view.menu.MenuView) View(android.view.View) ActionMenuItemView(com.android.internal.view.menu.ActionMenuItemView)

Aggregations

MenuView (com.android.internal.view.menu.MenuView)21 View (android.view.View)15 ActionMenuItemView (com.android.internal.view.menu.ActionMenuItemView)15 ViewGroup (android.view.ViewGroup)10 SparseArray (android.util.SparseArray)5 ActionProvider (android.view.ActionProvider)5 MenuItemImpl (com.android.internal.view.menu.MenuItemImpl)5