use of com.android.internal.view.menu.MenuView in project android_frameworks_base by ResurrectionRemix.
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;
}
}
use of com.android.internal.view.menu.MenuView in project android_frameworks_base by ResurrectionRemix.
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;
}
use of com.android.internal.view.menu.MenuView in project android_frameworks_base by ResurrectionRemix.
the class ActionMenuPresenter method updateMenuView.
@Override
public void updateMenuView(boolean cleared) {
final ViewGroup menuViewParent = (ViewGroup) ((View) mMenuView).getParent();
if (menuViewParent != null && ACTIONBAR_ANIMATIONS_ENABLED) {
setupItemAnimations();
}
super.updateMenuView(cleared);
((View) mMenuView).requestLayout();
if (mMenu != null) {
final ArrayList<MenuItemImpl> actionItems = mMenu.getActionItems();
final int count = actionItems.size();
for (int i = 0; i < count; i++) {
final ActionProvider provider = actionItems.get(i).getActionProvider();
if (provider != null) {
provider.setSubUiVisibilityListener(this);
}
}
}
final ArrayList<MenuItemImpl> nonActionItems = mMenu != null ? mMenu.getNonActionItems() : null;
boolean hasOverflow = false;
if (mReserveOverflow && nonActionItems != null) {
final int count = nonActionItems.size();
if (count == 1) {
hasOverflow = !nonActionItems.get(0).isActionViewExpanded();
} else {
hasOverflow = count > 0;
}
}
if (hasOverflow) {
if (mOverflowButton == null) {
mOverflowButton = new OverflowMenuButton(mSystemContext);
}
ViewGroup parent = (ViewGroup) mOverflowButton.getParent();
if (parent != mMenuView) {
if (parent != null) {
parent.removeView(mOverflowButton);
}
ActionMenuView menuView = (ActionMenuView) mMenuView;
menuView.addView(mOverflowButton, menuView.generateOverflowButtonLayoutParams());
}
} else if (mOverflowButton != null && mOverflowButton.getParent() == mMenuView) {
((ViewGroup) mMenuView).removeView(mOverflowButton);
}
((ActionMenuView) mMenuView).setOverflowReserved(mReserveOverflow);
}
use of com.android.internal.view.menu.MenuView in project android_frameworks_base by DirtyUnicorns.
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;
}
}
use of com.android.internal.view.menu.MenuView in project android_frameworks_base by crdroidandroid.
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;
}
}
Aggregations