Search in sources :

Example 1 with ClipRevealFrame

use of com.yalantis.starwarsdemo.widget.ClipRevealFrame in project StarWars.Android by Yalantis.

the class SideFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    mRootView = inflater.cloneInContext(new ContextThemeWrapper(getContext(), getTheme())).inflate(R.layout.fragment_side, container, false);
    final Bundle args = getArguments();
    if (args != null) {
        mRootView.addOnLayoutChangeListener(new View.OnLayoutChangeListener() {

            @Override
            public void onLayoutChange(View v, int left, int top, int right, int bottom, int oldLeft, int oldTop, int oldRight, int oldBottom) {
                v.removeOnLayoutChangeListener(this);
                int cx = args.getInt("cx");
                int cy = args.getInt("cy");
                // get the hypothenuse so the mRadius is from one corner to the other
                float radius = (float) Math.hypot(right, bottom);
                // http://developer.android.com/guide/topics/graphics/hardware-accel.html
                if (Build.VERSION.SDK_INT >= 18) {
                    Animator reveal = createCheckoutRevealAnimator((ClipRevealFrame) v, cx, cy, 28f, radius);
                    reveal.start();
                } else {
                    removeOldSideFragment();
                }
            }
        });
    }
    ButterKnife.bind(this, mRootView);
    return mRootView;
}
Also used : Animator(android.animation.Animator) ObjectAnimator(android.animation.ObjectAnimator) ContextThemeWrapper(android.support.v7.view.ContextThemeWrapper) Bundle(android.os.Bundle) ClipRevealFrame(com.yalantis.starwarsdemo.widget.ClipRevealFrame) ImageView(android.widget.ImageView) View(android.view.View) RecyclerView(android.support.v7.widget.RecyclerView)

Aggregations

Animator (android.animation.Animator)1 ObjectAnimator (android.animation.ObjectAnimator)1 Bundle (android.os.Bundle)1 ContextThemeWrapper (android.support.v7.view.ContextThemeWrapper)1 RecyclerView (android.support.v7.widget.RecyclerView)1 View (android.view.View)1 ImageView (android.widget.ImageView)1 ClipRevealFrame (com.yalantis.starwarsdemo.widget.ClipRevealFrame)1