Java Code Examples for androidx.appcompat.widget.ActionMenuView#getChildAt()

The following examples show how to use androidx.appcompat.widget.ActionMenuView#getChildAt() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ToolbarManager.java    From material with Apache License 2.0 6 votes vote down vote up
private void onGlobalLayout() {
    if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN)
        mToolbar.getViewTreeObserver().removeOnGlobalLayoutListener(mOnGlobalLayoutListener);
    else
        mToolbar.getViewTreeObserver().removeGlobalOnLayoutListener(mOnGlobalLayoutListener);

    ActionMenuView menuView = getMenuView();
    for(int i = 0, count = menuView == null ? 0 : menuView.getChildCount(); i < count; i++){
        View child = menuView.getChildAt(i);
        if(mRippleStyle != 0){
            if(child.getBackground() == null || !(child.getBackground() instanceof ToolbarRippleDrawable))
                ViewUtil.setBackground(child, getBackground());
        }
    }

    if(mGroupChanged){
        animateIn();
        mGroupChanged = false;
    }
}
 
Example 2
Source File: ToolbarManager.java    From material with Apache License 2.0 5 votes vote down vote up
private void animateIn(){
    ActionMenuView menuView = getMenuView();

    for(int i = 0, count = menuView == null ? 0 : menuView.getChildCount(); i < count; i++){
        View child = menuView.getChildAt(i);
        Animation anim = mAnimator.getInAnimation(child, i);
        if(anim != null)
            child.startAnimation(anim);
    }
}