Search in sources :

Example 6 with ActionMenuView

use of android.support.v7.widget.ActionMenuView in project material by rey5137.

the class ToolbarManager method animateIn.

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);
    }
}
Also used : TranslateAnimation(android.view.animation.TranslateAnimation) Animation(android.view.animation.Animation) ActionMenuView(android.support.v7.widget.ActionMenuView) View(android.view.View) ActionMenuView(android.support.v7.widget.ActionMenuView)

Example 7 with ActionMenuView

use of android.support.v7.widget.ActionMenuView in project material by rey5137.

the class ToolbarManager method onGlobalLayout.

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;
    }
}
Also used : ToolbarRippleDrawable(com.rey.material.drawable.ToolbarRippleDrawable) ActionMenuView(android.support.v7.widget.ActionMenuView) View(android.view.View) ActionMenuView(android.support.v7.widget.ActionMenuView)

Example 8 with ActionMenuView

use of android.support.v7.widget.ActionMenuView in project Carbon by ZieIony.

the class Toolbar method ensureMenuView.

private void ensureMenuView() {
    if (mMenuView == null) {
        mMenuView = new ActionMenuView(getContext());
        mMenuView.setPopupTheme(mPopupTheme);
        mMenuView.setOnMenuItemClickListener(mMenuViewItemClickListener);
        mMenuView.setMenuCallbacks(mActionMenuPresenterCallback, mMenuBuilderCallback);
        final LayoutParams lp = generateDefaultLayoutParams();
        lp.gravity = GravityCompat.END | (mButtonGravity & Gravity.VERTICAL_GRAVITY_MASK);
        mMenuView.setLayoutParams(lp);
        addSystemView(mMenuView);
    }
}
Also used : ActionMenuView(android.support.v7.widget.ActionMenuView)

Example 9 with ActionMenuView

use of android.support.v7.widget.ActionMenuView in project actor-platform by actorapp.

the class ActorToolbar method doColorizing.

public static void doColorizing(View v, final ColorFilter colorFilter, int toolbarIconsColor) {
    if (v instanceof ImageButton) {
        ((ImageButton) v).getDrawable().setAlpha(255);
        ((ImageButton) v).getDrawable().setColorFilter(colorFilter);
    }
    if (v instanceof ImageView && !(v instanceof AvatarView)) {
        ((ImageView) v).getDrawable().setAlpha(255);
        ((ImageView) v).getDrawable().setColorFilter(colorFilter);
    }
    if (v instanceof AutoCompleteTextView) {
        ((AutoCompleteTextView) v).setTextColor(toolbarIconsColor);
    }
    if (v instanceof TextView) {
        ((TextView) v).setTextColor(toolbarIconsColor);
    }
    if (v instanceof EditText) {
        ((EditText) v).setTextColor(toolbarIconsColor);
    }
    if (v instanceof ViewGroup) {
        for (int lli = 0; lli < ((ViewGroup) v).getChildCount(); lli++) {
            doColorizing(((ViewGroup) v).getChildAt(lli), colorFilter, toolbarIconsColor);
        }
    }
    if (v instanceof ActionMenuView) {
        for (int j = 0; j < ((ActionMenuView) v).getChildCount(); j++) {
            //Step 2: Changing the color of any ActionMenuViews - icons that
            //are not back button, nor text, nor overflow menu icon.
            final View innerView = ((ActionMenuView) v).getChildAt(j);
            if (innerView instanceof ActionMenuItemView) {
                int drawablesCount = ((ActionMenuItemView) innerView).getCompoundDrawables().length;
                for (int k = 0; k < drawablesCount; k++) {
                    if (((ActionMenuItemView) innerView).getCompoundDrawables()[k] != null) {
                        final int finalK = k;
                        //Important to set the color filter in seperate thread,
                        //by adding it to the message queue
                        //Won't work otherwise.
                        //Works fine for my case but needs more testing
                        ((ActionMenuItemView) innerView).getCompoundDrawables()[finalK].setColorFilter(colorFilter);
                    //                              innerView.post(new Runnable() {
                    //                                  @Override
                    //                                  public void run() {
                    //                                      ((ActionMenuItemView) innerView).getCompoundDrawables()[finalK].setColorFilter(colorFilter);
                    //                                  }
                    //                              });
                    }
                }
            }
        }
    }
}
Also used : EditText(android.widget.EditText) ImageButton(android.widget.ImageButton) AvatarView(im.actor.sdk.view.avatar.AvatarView) ViewGroup(android.view.ViewGroup) AutoCompleteTextView(android.widget.AutoCompleteTextView) TextView(android.widget.TextView) ImageView(android.widget.ImageView) ActionMenuView(android.support.v7.widget.ActionMenuView) ImageView(android.widget.ImageView) AutoCompleteTextView(android.widget.AutoCompleteTextView) ActionMenuView(android.support.v7.widget.ActionMenuView) TextView(android.widget.TextView) ActionMenuItemView(android.support.v7.view.menu.ActionMenuItemView) AvatarView(im.actor.sdk.view.avatar.AvatarView) View(android.view.View) ActionMenuItemView(android.support.v7.view.menu.ActionMenuItemView) AutoCompleteTextView(android.widget.AutoCompleteTextView)

Aggregations

View (android.view.View)7 ActionMenuView (android.support.v7.widget.ActionMenuView)6 ViewGroup (android.view.ViewGroup)4 ActionMenuPresenter (android.support.v7.internal.view.menu.ActionMenuPresenter)2 ActionMenuView (android.support.v7.internal.view.menu.ActionMenuView)2 MenuBuilder (android.support.v7.internal.view.menu.MenuBuilder)2 Animation (android.view.animation.Animation)2 TranslateAnimation (android.view.animation.TranslateAnimation)2 TextView (android.widget.TextView)2 NavigationView (android.support.design.widget.NavigationView)1 ActionMenuChildView (android.support.v7.internal.view.menu.ActionMenuView.ActionMenuChildView)1 SubMenuBuilder (android.support.v7.internal.view.menu.SubMenuBuilder)1 ActionMenuItemView (android.support.v7.view.menu.ActionMenuItemView)1 AutoCompleteTextView (android.widget.AutoCompleteTextView)1 EditText (android.widget.EditText)1 ImageButton (android.widget.ImageButton)1 ImageView (android.widget.ImageView)1 BindView (butterknife.BindView)1 ToolbarRippleDrawable (com.rey.material.drawable.ToolbarRippleDrawable)1 AvatarView (im.actor.sdk.view.avatar.AvatarView)1