Search in sources :

Example 1 with ToolbarRippleDrawable

use of com.rey.material.drawable.ToolbarRippleDrawable in project material by rey5137.

the class RippleManager method onClick.

@Override
public void onClick(View v) {
    Drawable background = v.getBackground();
    long delay = 0;
    if (background != null) {
        if (background instanceof RippleDrawable)
            delay = ((RippleDrawable) background).getClickDelayTime();
        else if (background instanceof ToolbarRippleDrawable)
            delay = ((ToolbarRippleDrawable) background).getClickDelayTime();
    }
    if (delay > 0 && v.getHandler() != null && !mClickScheduled) {
        mClickScheduled = true;
        v.getHandler().postDelayed(new ClickRunnable(v), delay);
    } else
        dispatchClickEvent(v);
}
Also used : ToolbarRippleDrawable(com.rey.material.drawable.ToolbarRippleDrawable) RippleDrawable(com.rey.material.drawable.RippleDrawable) ToolbarRippleDrawable(com.rey.material.drawable.ToolbarRippleDrawable) Drawable(android.graphics.drawable.Drawable) RippleDrawable(com.rey.material.drawable.RippleDrawable) ToolbarRippleDrawable(com.rey.material.drawable.ToolbarRippleDrawable)

Example 2 with ToolbarRippleDrawable

use of com.rey.material.drawable.ToolbarRippleDrawable 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)

Aggregations

ToolbarRippleDrawable (com.rey.material.drawable.ToolbarRippleDrawable)2 Drawable (android.graphics.drawable.Drawable)1 ActionMenuView (android.support.v7.widget.ActionMenuView)1 View (android.view.View)1 RippleDrawable (com.rey.material.drawable.RippleDrawable)1