Java Code Examples for io.codetail.animation.ViewAnimationUtils

The following are top voted examples for showing how to use io.codetail.animation.ViewAnimationUtils. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: Closet   File: BasicSearchBarFragment.java   View source code 7 votes vote down vote up
/**
 * 点击搜索
 */
protected void reactionToClickSearchAction() {
    mShowSearchToolbar = true;

    View childView = mRevealFrameLayout.getChildAt(0);
    childView.setVisibility(View.VISIBLE);
    childView.bringToFront();

    int centerX = childView.getRight();
    int centerY = childView.getBottom() / 2;
    Animator circularReveal = ViewAnimationUtils.createCircularReveal(childView, centerX, centerY, 0, childView.getWidth());
    circularReveal.setDuration(300).setInterpolator(new LinearInterpolator());
    circularReveal.start();

    circularReveal.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);

            reactionToCover(true);

            mEdSearch.requestFocus();
            KeyboardUtils.showSoftInput(mEdSearch, getContext());
        }
    });
}
 
Example 2
Project: FragmentCapsulation   File: BasicSearchBarFragment.java   View source code 7 votes vote down vote up
/**
 * 点击搜索
 */
protected void reactionToClickSearchAction() {
    mShowSearchToolbar = true;

    View childView = mRevealFrameLayout.getChildAt(0);
    childView.setVisibility(View.VISIBLE);
    childView.bringToFront();

    int centerX = childView.getRight();
    int centerY = childView.getBottom() / 2;
    Animator circularReveal = ViewAnimationUtils.createCircularReveal(childView, centerX, centerY, 0, childView.getWidth());
    circularReveal.setDuration(300).setInterpolator(new LinearInterpolator());
    circularReveal.start();

    circularReveal.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);

            reactionToCover(true);

            mEdSearch.requestFocus();
            KeyboardUtils.showSoftInput(mEdSearch, getContext());
        }
    });
}
 
Example 3
Project: Material-Motion   File: PlayerFragment.java   View source code 6 votes vote down vote up
private void setUpReveal(){
    int w = panel.getWidth();
    int h = panel.getHeight();
    final int endRadius = (int) Math.hypot(w, h);
    final int cx = (int)(actionButton.getX()+actionButton.getWidth()/2);
    final int cy = (int)(actionButton.getY()+actionButton.getHeight()/2-background.getTop());

    final float deltaX=cx-(playPause.getLeft()+playPause.getWidth()/2);
    final float deltaY=(cy-getResources().getDimension(R.dimen.play_pause_size)/2)-(playPause.getTop());
    playPause.setTranslationX(deltaX);
    playPause.setTranslationY(deltaY);
    revealAnimator = ViewAnimationUtils.createCircularReveal(panel, cx, cy, actionButton.getHeight(), endRadius);
    revealAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationStart(Animator animation) {
            panel.setVisibility(View.VISIBLE);
            actionButton.setVisibility(View.INVISIBLE);
            fadeInOutViews(0,duration(R.integer.fade_in_duration));
        }
    });
    revealAnimator.setDuration(duration(R.integer.conceal_duration)/2);
    revealAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
}
 
Example 4
Project: Closet   File: BasicSearchBarFragment.java   View source code 6 votes vote down vote up
/**
 * 搜索栏的回退逻辑
 *
 * @return
 */
private boolean reactionToSearchBack() {
    if (mShowSearchToolbar) {
        mShowSearchToolbar = false;
        KeyboardUtils.hideSoftInput(mEdSearch, getContext());

        View childView = mRevealFrameLayout.getChildAt(0);
        childView.bringToFront();

        int centerX = childView.getLeft();
        int centerY = childView.getBottom() / 2;
        Animator circularReveal = ViewAnimationUtils.createCircularReveal(childView, centerX, centerY, 0, childView.getWidth());
        circularReveal.setDuration(300).setInterpolator(new DecelerateInterpolator());

        circularReveal.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                reactionToCover(false);
            }
        });
        circularReveal.start();

        if (mEdSearch != null) {
            mEdSearch.setText("");
            mSearchWord = "";
            fetchSearchData(mSearchWord);
        }

        return true;
    }
    return false;
}
 
Example 5
Project: JewelryUI   File: FabAnimatorPreL.java   View source code 6 votes vote down vote up
@Override
final void revealOff(final View fab, final View transformView, final RevealCallback callback) {
    SupportAnimator animator = ViewAnimationUtils.createCircularReveal(
            transformView,
            getCenterX(fab),
            getCenterY(fab),
            (float) Math.hypot(transformView.getWidth(), transformView.getHeight()) / 2,
            fab.getWidth() / 2);
    animator.setInterpolator(REVEAL_INTERPOLATOR);
    animator.addListener(new SupportAnimator.AnimatorListener() {
        @Override
        public void onAnimationStart() {
            callback.onRevealStart();
        }

        @Override
        public void onAnimationEnd() {
            transformView.setVisibility(View.INVISIBLE);
            callback.onRevealEnd();
        }

        @Override
        public void onAnimationCancel() {
            //
        }

        @Override
        public void onAnimationRepeat() {
            //
        }
    });
    if (transformView.getVisibility() == View.VISIBLE) {
        animator.setDuration((int) getRevealAnimationDuration());
        animator.start();
        transformView.setEnabled(true);
    }
}
 
Example 6
Project: MTweaks-KernelAdiutorMOD   File: NavHeaderView.java   View source code 6 votes vote down vote up
public void animateBg() {
    mImage.setVisibility(INVISIBLE);

    int cx = mImage.getWidth();
    int cy = mImage.getHeight();

    SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mImage, cx, cy, 0, Math.max(cx, cy));
    animator.addListener(new SupportAnimator.SimpleAnimatorListener() {
        @Override
        public void onAnimationStart() {
            super.onAnimationStart();
            mImage.setVisibility(VISIBLE);
        }
    });
    animator.setStartDelay(500);
    animator.start();
}
 
Example 7
Project: KernelAdiutor-Mod   File: NavHeaderView.java   View source code 6 votes vote down vote up
public void animateBg() {
    mImage.setVisibility(INVISIBLE);

    int cx = mImage.getWidth();
    int cy = mImage.getHeight();

    SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mImage, cx, cy, 0, Math.max(cx, cy));
    animator.addListener(new SupportAnimator.SimpleAnimatorListener() {
        @Override
        public void onAnimationStart() {
            super.onAnimationStart();
            mImage.setVisibility(VISIBLE);
        }
    });
    animator.setStartDelay(500);
    animator.start();
}
 
Example 8
Project: FragmentCapsulation   File: BasicSearchBarFragment.java   View source code 6 votes vote down vote up
/**
 * 搜索栏的回退逻辑
 *
 * @return
 */
private boolean reactionToSearchBack() {
    if (mShowSearchToolbar) {
        mShowSearchToolbar = false;
        KeyboardUtils.hideSoftInput(mEdSearch, getContext());

        View childView = mRevealFrameLayout.getChildAt(0);
        childView.bringToFront();

        int centerX = childView.getLeft();
        int centerY = childView.getBottom() / 2;
        Animator circularReveal = ViewAnimationUtils.createCircularReveal(childView, centerX, centerY, 0, childView.getWidth());
        circularReveal.setDuration(300).setInterpolator(new DecelerateInterpolator());

        circularReveal.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                reactionToCover(false);
            }
        });
        circularReveal.start();

        if (mEdSearch != null) {
            mEdSearch.setText("");
            mSearchWord = "";
            fetchSearchData(mSearchWord);
        }

        return true;
    }
    return false;
}
 
Example 9
Project: Pocket-Plays-for-Twitch   File: DonationActivity.java   View source code 6 votes vote down vote up
private void playInitAnimation() {
	DisplayMetrics dm = getResources().getDisplayMetrics();
	// Get the center for the FAB
	int cx = dm.widthPixels / 2;
	int cy = 0;

	float finalRadius = dm.heightPixels;

	revealTransition = ViewAnimationUtils.createCircularReveal(mainContentLayout, cx, cy, 0, finalRadius);
	revealTransition.setInterpolator(new AccelerateDecelerateInterpolator());
	revealTransition.setDuration(800);
	revealTransition.addListener(new SupportAnimator.AnimatorListener() {
		@Override
		public void onAnimationStart() {
			mainContentLayout.setVisibility(View.VISIBLE);
		}
		public void onAnimationEnd() {}
		public void onAnimationCancel() {}
		public void onAnimationRepeat() {}
	});
	revealTransition.start();
}
 
Example 10
Project: Pocket-Plays-for-Twitch   File: UpdateDialogHandler.java   View source code 6 votes vote down vote up
private void circularDismissView(final View view) {
	final int DURATION = 600;

	// Get the center for the FAB
	int cx = (int) view.getX() + view.getMeasuredHeight() / 2;
	int cy = (int) view.getY() + view.getMeasuredWidth() / 2;

	// get the final radius for the clipping circle
	int dx = Math.max(cx, view.getWidth() - cx);
	int dy = Math.max(cy, view.getHeight() - cy);
	float finalRadius = (float) Math.hypot(dx, dy);

	final SupportAnimator dismissAnimation = ViewAnimationUtils.createCircularReveal(view, cx, cy, 0, finalRadius).reverse();
	dismissAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
	dismissAnimation.setDuration(DURATION);
	dismissAnimation.start();
	new Handler().postDelayed(new Runnable() {
		@Override
		public void run() {
			mSuperContainer.setVisibility(View.GONE);
		}
	}, DURATION);
}
 
Example 11
Project: Pocket-Plays-for-Twitch   File: AnimationService.java   View source code 6 votes vote down vote up
public static void setActivityToolbarCircularRevealAnimation(final Toolbar aDecorativeToolbar) {
	aDecorativeToolbar.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 CIRCULAR_REVEAL_DURATION = 700;
			int cx = (aDecorativeToolbar.getLeft() + aDecorativeToolbar.getRight()) / 2;
			int cy = 0;

			// get the final radius for the clipping circle
			int finalRadius = Math.max(aDecorativeToolbar.getWidth(), aDecorativeToolbar.getHeight());

			SupportAnimator animator = ViewAnimationUtils.createCircularReveal(aDecorativeToolbar, cx, cy, 0, finalRadius);

			animator.setInterpolator(new AccelerateDecelerateInterpolator());
			animator.setDuration(CIRCULAR_REVEAL_DURATION);
			animator.start();
		}
	});
}
 
Example 12
Project: Expert-Android-Programming   File: HomeBaseActivity.java   View source code 6 votes vote down vote up
private void enterReveal(View myView) {

        menuShown = true;
        centerButton.animate().rotation(45).setInterpolator(new AccelerateInterpolator()).setDuration(50);

        // get the center for the clipping circle
        int cx = myView.getMeasuredWidth() / 2;
        int cy = myView.getMeasuredHeight();

        // get the final radius for the clipping circle
        int finalRadius = Math.max(myView.getWidth(), myView.getHeight());

        // create the animator for this view (the start radius is zero)
        Animator anim =
                ViewAnimationUtils.createCircularReveal(myView, cx, cy, 0, finalRadius);

        // make the view visible and start the animation
        myView.setVisibility(View.VISIBLE);
        anim.setDuration(Constant.REVEAL_DURATION);
        anim.start();

        removeSelected();
    }
 
Example 13
Project: Expert-Android-Programming   File: BrowseNearbyActivity.java   View source code 6 votes vote down vote up
private void exitReveal(final View icon, final View toolbar) {

        // get the center for the clipping circle
        int cx = getRelativeLeft(icon) + icon.getMeasuredWidth() / 2;
        int cy = getRelativeTop(icon);

        // get the initial radius for the clipping circle
        int initialRadius = Math.max(toolbar.getWidth(), toolbar.getHeight());

        // create the animation (the final radius is zero)
        Animator anim =
                ViewAnimationUtils.createCircularReveal(toolbar, cx, cy, initialRadius, 0);

        // make the view invisible when the animation is done
        anim.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                toolbar.setVisibility(View.INVISIBLE);
            }
        });

        anim.setDuration(Constant.SEARCH_REVEAL_DURATION);
        // start the animation
        anim.start();
    }
 
Example 14
Project: Expert-Android-Programming   File: HomeActivity.java   View source code 6 votes vote down vote up
private void exitReveal(final View icon, final View toolbar) {

        // get the center for the clipping circle
        int cx = getRelativeLeft(icon) + icon.getMeasuredWidth() / 2;
        int cy = getRelativeTop(icon);

        // get the initial radius for the clipping circle
        int initialRadius = Math.max(toolbar.getWidth(), toolbar.getHeight());

        // create the animation (the final radius is zero)
        Animator anim =
                ViewAnimationUtils.createCircularReveal(toolbar, cx, cy, initialRadius, 0);

        // make the view invisible when the animation is done
        anim.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                toolbar.setVisibility(View.INVISIBLE);
            }
        });

        anim.setDuration(Constant.SEARCH_REVEAL_DURATION);
        // start the animation
        anim.start();
    }
 
Example 15
Project: faveo-helpdesk-android-app   File: TicketDetailActivity.java   View source code 6 votes vote down vote up
void enterReveal(String type) {
    fab.setVisibility(View.GONE);
    final View myView = findViewById(R.id.reveal);
    int finalRadius = Math.max(myView.getWidth(), myView.getHeight());
    SupportAnimator anim =
            ViewAnimationUtils.createCircularReveal(myView, cx, cy, 0, finalRadius);
    if (type.equals("Reply")) {
        myView.setVisibility(View.VISIBLE);
        myView.findViewById(R.id.section_reply).setVisibility(View.VISIBLE);
        myView.findViewById(R.id.section_internal_note).setVisibility(View.GONE);
        overlay.setVisibility(View.VISIBLE);
    } else {
        myView.setVisibility(View.VISIBLE);
        myView.findViewById(R.id.section_reply).setVisibility(View.GONE);
        myView.findViewById(R.id.section_internal_note).setVisibility(View.VISIBLE);
        overlay.setVisibility(View.VISIBLE);
    }

    anim.start();
}
 
Example 16
Project: CircleReveal   File: RadialTransformationActivity.java   View source code 6 votes vote down vote up
@Override public boolean onSingleTapUp(MotionEvent e) {
  View nextView = getNext();
  nextView.bringToFront();
  nextView.setVisibility(View.VISIBLE);

  final float finalRadius =
      (float) Math.hypot(nextView.getWidth() / 2f, nextView.getHeight() / 2f) + hypo(
          nextView, e);

  Animator revealAnimator =
      ViewAnimationUtils.createCircularReveal(nextView, (int) e.getX(), (int) e.getY(), 0,
          finalRadius, View.LAYER_TYPE_HARDWARE);

  revealAnimator.setDuration(MainActivity.SLOW_DURATION);
  revealAnimator.setInterpolator(new FastOutLinearInInterpolator());
  revealAnimator.start();

  return true;
}
 
Example 17
Project: Revealator   File: RevealatorHelper.java   View source code 6 votes vote down vote up
/**
 * Helps to unreveal a view.
 *
 * @param viewToUnreveal       View to unreveal.
 * @param duration             Duration.
 * @param animationEndCallBack Callback fired on animation end.
 */
static void unrevealView(final View viewToUnreveal, final int duration, final Runnable animationEndCallBack) {
    // - Determine circle location and size.
    int viewCenterX = (viewToUnreveal.getLeft() + viewToUnreveal.getRight()) / 2;
    int viewCenterY = (viewToUnreveal.getTop() + viewToUnreveal.getBottom()) / 2;
    int viewDiameterX = Math.max(viewCenterX, viewToUnreveal.getWidth() - viewCenterX);
    int viewDiameterY = Math.max(viewCenterY, viewToUnreveal.getHeight() - viewCenterY);
    float finalRadius = (float) Math.hypot(viewDiameterX, viewDiameterY);

    // - Prepare animation.
    final Animator circularRevealAnimator =
            ViewAnimationUtils.createCircularReveal(viewToUnreveal, viewCenterX, viewCenterY, finalRadius, 0);
    circularRevealAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    circularRevealAnimator.setDuration(duration);
    circularRevealAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            viewToUnreveal.setVisibility(View.INVISIBLE);
            animationEndCallBack.run();
        }
    });

    // Let's reveal !
    circularRevealAnimator.start();
}
 
Example 18
Project: droidkaigi2016   File: MapSearchView.java   View source code 6 votes vote down vote up
private void revealOn() {
    if (binding.mapListContainer.getVisibility() == VISIBLE) return;

    View container = binding.mapListContainer;
    Animator animator = ViewAnimationUtils.createCircularReveal(
            container,
            getRevealCenterX(container),
            container.getTop(),
            0,
            (float) Math.hypot(container.getWidth(), container.getHeight()));
    animator.setInterpolator(INTERPOLATOR);
    animator.setDuration(getResources().getInteger(R.integer.view_reveal_mills));
    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationStart(Animator animation) {
            binding.mapListContainer.setVisibility(VISIBLE);
            if (onVisibilityChangeListener != null) {
                onVisibilityChangeListener.onChange();
            }
        }
    });

    animator.start();
}
 
Example 19
Project: droidkaigi2016   File: MapSearchView.java   View source code 6 votes vote down vote up
public void revealOff() {
    if (binding.mapListContainer.getVisibility() != VISIBLE) return;

    View container = binding.mapListContainer;
    Animator animator = ViewAnimationUtils.createCircularReveal(
            container,
            getRevealCenterX(container),
            container.getTop(),
            (float) Math.hypot(container.getWidth(), container.getHeight()),
            0);
    animator.setInterpolator(INTERPOLATOR);
    animator.setDuration(getResources().getInteger(R.integer.view_reveal_mills));
    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            binding.mapListContainer.setVisibility(INVISIBLE);
            if (onVisibilityChangeListener != null) {
                onVisibilityChangeListener.onChange();
            }
        }
    });

    animator.start();
}
 
Example 20
Project: Rocket.Chat-android   File: FabMenuLayout.java   View source code 6 votes vote down vote up
private void createReveal(int cx, int cy, float initialRadius, float finalRadius) {
    mMenuAnimator = ViewAnimationUtils.createCircularReveal(mMenu, cx, cy, initialRadius, finalRadius);
    mMenuAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    mMenuAnimator.setDuration(500);
    mMenuAnimator.addListener(new SupportAnimator.AnimatorListener() {
        @Override
        public void onAnimationStart() {
            mMenu.setVisibility(View.VISIBLE);
        }

        @Override
        public void onAnimationEnd() {
        }

        @Override
        public void onAnimationCancel() {
        }

        @Override
        public void onAnimationRepeat() {
        }
    });
    mMenuAnimator.start();
}
 
Example 21
Project: MaterialCalendar   File: MemoFragment.java   View source code 6 votes vote down vote up
void appearBluePair() {
    mBluePair.setVisibility(View.VISIBLE);

    float finalRadius = Math.max(mBluePair.getWidth(), mBluePair.getHeight()) * 1.5f;

    SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mBluePair, endBlueX, endBlueY, mBlue.getWidth() / 2f,
            finalRadius);
    animator.setDuration(500);
    animator.setInterpolator(ACCELERATE);
    animator.addListener(new SimpleListener() {
        @Override
        public void onAnimationEnd() {
            raise();
        }
    });
    animator.start();
}
 
Example 22
Project: MaterialCalendar   File: MemoFragment.java   View source code 6 votes vote down vote up
void appearRed() {
    mRed.setVisibility(View.VISIBLE);

    int cx = mRed.getWidth() / 2;
    int cy = mRed.getHeight() / 2;

    SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mRed, cx, cy, 0, mRed.getWidth() / 2);
    animator.addListener(new SimpleListener() {
        @Override
        public void onAnimationEnd() {
            upRed();
        }
    });
    animator.setInterpolator(ACCELERATE);
    animator.start();
}
 
Example 23
Project: MaterialCalendar   File: MemoFragment.java   View source code 6 votes vote down vote up
void disappearRed() {

        int cx = mRed.getWidth() / 2;
        int cy = mRed.getHeight() / 2;

        SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mRed, cx, cy, mRed.getWidth() / 2, 0);
        animator.addListener(new SimpleListener() {
            @Override
            public void onAnimationEnd() {
                mRed.setVisibility(View.INVISIBLE);
                ViewHelper.setX(mRed, startRedX);
                ViewHelper.setY(mRed, startRedY);
                release();
            }
        });
        animator.setInterpolator(DECELERATE);
        animator.start();
    }
 
Example 24
Project: MaterialCalendar   File: MemoFragment.java   View source code 6 votes vote down vote up
void disappearBluePair() {
    float finalRadius = Math.max(mBluePair.getWidth(), mBluePair.getHeight()) * 1.5f;

    SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mBluePair, endBlueX, endBlueY,
            finalRadius, mBlue.getWidth() / 2f);
    animator.setDuration(500);
    animator.addListener(new SimpleListener() {
        @Override
        public void onAnimationEnd() {
            mBluePair.setVisibility(View.INVISIBLE);
            returnBlue();
        }
    });
    animator.setInterpolator(DECELERATE);
    animator.start();
}
 
Example 25
Project: FastAccess   File: AnimHelper.java   View source code 6 votes vote down vote up
@UiThread private static void reveal(final View mRevealView, final boolean show, View from) {
    Rect rect = ViewHelper.getLayoutPosition(from);
    int x = (int) rect.exactCenterX();
    int y = (int) rect.exactCenterY();
    Animator animator = ViewAnimationUtils.createCircularReveal(mRevealView, x, y, 0, Math.max(rect.width(), rect.height()));
    animator.setDuration(400L);
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    mRevealView.setVisibility(View.VISIBLE);
    if (!show) {
        animator.addListener(new AnimatorListenerAdapter() {
            @Override public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                mRevealView.setVisibility(View.GONE);
                animation.removeListener(this);
            }
        });
        animator.start();
    }
}
 
Example 26
Project: ArcAnimator   File: TransitionLoopFragment.java   View source code 6 votes vote down vote up
void appearBluePair() {
    mBluePair.setVisibility(View.VISIBLE);

    float finalRadius = Math.max(mBluePair.getWidth(), mBluePair.getHeight()) * 1.5f;

    SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mBluePair, endBlueX, endBlueY, mBlue.getWidth() / 2f,
            finalRadius);
    animator.setDuration(500);
    animator.setInterpolator(ACCELERATE);
    animator.addListener(new SimpleListener() {
        @Override
        public void onAnimationEnd() {
            raise();
        }
    });
    animator.start();
}
 
Example 27
Project: ArcAnimator   File: TransitionLoopFragment.java   View source code 6 votes vote down vote up
void appearRed() {
    mRed.setVisibility(View.VISIBLE);

    int cx = mRed.getWidth() / 2;
    int cy = mRed.getHeight() / 2;

    SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mRed, cx, cy, 0, mRed.getWidth() / 2);
    animator.addListener(new SimpleListener() {
        @Override
        public void onAnimationEnd() {
            upRed();
        }
    });
    animator.setInterpolator(ACCELERATE);
    animator.start();
}
 
Example 28
Project: ArcAnimator   File: TransitionLoopFragment.java   View source code 6 votes vote down vote up
void disappearRed() {

        int cx = mRed.getWidth() / 2;
        int cy = mRed.getHeight() / 2;

        SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mRed, cx, cy, mRed.getWidth() / 2, 0);
        animator.addListener(new SimpleListener() {
            @Override
            public void onAnimationEnd() {
                mRed.setVisibility(View.INVISIBLE);
                mRed.setX(startRedX);
                mRed.setY(startRedY);
                release();
            }
        });
        animator.setInterpolator(DECELERATE);
        animator.start();
    }
 
Example 29
Project: ArcAnimator   File: TransitionLoopFragment.java   View source code 6 votes vote down vote up
void disappearBluePair() {
    float finalRadius = Math.max(mBluePair.getWidth(), mBluePair.getHeight()) * 1.5f;

    SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mBluePair, endBlueX, endBlueY,
            finalRadius, mBlue.getWidth() / 2f);
    animator.setDuration(500);
    animator.addListener(new SimpleListener() {
        @Override
        public void onAnimationEnd() {
            mBluePair.setVisibility(View.INVISIBLE);
            returnBlue();
        }
    });
    animator.setInterpolator(DECELERATE);
    animator.start();
}
 
Example 30
Project: RecyclerView-Animation-Demo   File: StickerRecyclerView.java   View source code 6 votes vote down vote up
@Override
public void onBindViewHolder(final ViewHolder holder, final int position) {

    final StickerItem stickerItem = items.get(position);
    ImageLoader.getInstance().displayImage(stickerItem.getThumbnail2(), holder.chartlet
            , Utils.getInst().buildDefaultOptions());
    holder.download.setText("下载");
    holder.download.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(final View v) {

                final View myView = holder.card;
                int cx = (myView.getLeft() + myView.getRight()) / 2;
                int cy = (myView.getTop() + myView.getBottom()) / 2;
                float finalRadius = hypo(myView.getWidth(), myView.getHeight());
                mAnimator = ViewAnimationUtils.createCircularReveal(myView, cx, cy, 0, finalRadius);
                mAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
                mAnimator.setDuration(1000);
                mAnimator.start();

        }
    });
}
 
Example 31
Project: droidkaigi2016   File: MapSearchView.java   View source code 6 votes vote down vote up
private void revealOn() {
    if (binding.mapListContainer.getVisibility() == VISIBLE) return;

    View container = binding.mapListContainer;
    Animator animator = ViewAnimationUtils.createCircularReveal(
            container,
            getRevealCenterX(container),
            container.getTop(),
            0,
            (float) Math.hypot(container.getWidth(), container.getHeight()));
    animator.setInterpolator(INTERPOLATOR);
    animator.setDuration(getResources().getInteger(R.integer.view_reveal_mills));
    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationStart(Animator animation) {
            binding.mapListContainer.setVisibility(VISIBLE);
            if (onVisibilityChangeListener != null) {
                onVisibilityChangeListener.onChange();
            }
        }
    });

    animator.start();
}
 
Example 32
Project: droidkaigi2016   File: MapSearchView.java   View source code 6 votes vote down vote up
public void revealOff() {
    if (binding.mapListContainer.getVisibility() != VISIBLE) return;

    View container = binding.mapListContainer;
    Animator animator = ViewAnimationUtils.createCircularReveal(
            container,
            getRevealCenterX(container),
            container.getTop(),
            (float) Math.hypot(container.getWidth(), container.getHeight()),
            0);
    animator.setInterpolator(INTERPOLATOR);
    animator.setDuration(getResources().getInteger(R.integer.view_reveal_mills));
    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            binding.mapListContainer.setVisibility(INVISIBLE);
            if (onVisibilityChangeListener != null) {
                onVisibilityChangeListener.onChange();
            }
        }
    });

    animator.start();
}
 
Example 33
Project: Side-Menu   File: MainActivity.java   View source code 6 votes vote down vote up
/**
 * 切换item点击,CIrcularReveal视图效果
 * @param screenShotable
 * @param topPosition
 * @return
 */
private ScreenShotable replaceFragment(ScreenShotable screenShotable, int topPosition) {
    this.res = this.res == R.drawable.content_music ? R.drawable.content_films : R.drawable.content_music;
    View view = findViewById(R.id.content_frame);
    int finalRadius = Math.max(view.getWidth(), view.getHeight());
    SupportAnimator animator = ViewAnimationUtils.createCircularReveal(view, 0, topPosition, 0, finalRadius);
    animator.setInterpolator(new AccelerateInterpolator());
    animator.setDuration(ViewAnimator.CIRCULAR_REVEAL_ANIMATION_DURATION);

    //设置背景!
    findViewById(R.id.content_overlay).setBackgroundDrawable(new BitmapDrawable(getResources(), screenShotable.getBitmap()));
    animator.start();
    ContentFragment contentFragment = ContentFragment.newInstance(this.res);
    getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, contentFragment).commit();
    return contentFragment;
}
 
Example 34
Project: ArcAnimator-master   File: TransitionLoopFragment.java   View source code 6 votes vote down vote up
void appearRed()
{
    mRed.setVisibility(View.VISIBLE);

    int cx = mRed.getWidth() / 2;
    int cy = mRed.getHeight() / 2;

    SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mRed, cx, cy, 0, mRed.getWidth() / 2);
    animator.addListener(new SimpleListener()
    {
        @Override
        public void onAnimationEnd()
        {
            upRed();
        }
    });
    animator.setInterpolator(ACCELERATE);
    animator.start();
}
 
Example 35
Project: ArcAnimator-master   File: TransitionLoopFragment.java   View source code 6 votes vote down vote up
void disappearRed()
{

    int cx = mRed.getWidth() / 2;
    int cy = mRed.getHeight() / 2;

    SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mRed, cx, cy, mRed.getWidth() / 2, 0);
    animator.addListener(new SimpleListener()
    {
        @Override
        public void onAnimationEnd()
        {
            mRed.setVisibility(View.INVISIBLE);
            ViewHelper.setX(mRed, startRedX);
            ViewHelper.setY(mRed, startRedY);
            release();
        }
    });
    animator.setInterpolator(DECELERATE);
    animator.start();
}
 
Example 36
Project: ArcAnimator-master   File: TransitionLoopFragment.java   View source code 6 votes vote down vote up
void disappearBluePair()
{
    float finalRadius = Math.max(mBluePair.getWidth(), mBluePair.getHeight()) * 1.5f;

    SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mBluePair, endBlueX, endBlueY,
            finalRadius, mBlue.getWidth() / 2f);
    animator.setDuration(500);
    animator.addListener(new SimpleListener()
    {
        @Override
        public void onAnimationEnd()
        {
            mBluePair.setVisibility(View.INVISIBLE);
            returnBlue();
        }
    });
    animator.setInterpolator(DECELERATE);
    animator.start();
}
 
Example 37
Project: ArcAnimator-master   File: MainActivity.java   View source code 6 votes vote down vote up
void appearRed()
{
    mRed.setVisibility(View.VISIBLE);

    int cx = mRed.getWidth() / 2;
    int cy = mRed.getHeight() / 2;

    SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mRed, cx, cy, 0, mRed.getWidth() / 2);
    animator.addListener(new SimpleListener()
    {
        @Override
        public void onAnimationEnd()
        {
            upRed();
        }
    });
    animator.setInterpolator(ACCELERATE);
    animator.start();
}
 
Example 38
Project: ArcAnimator-master   File: MainActivity.java   View source code 6 votes vote down vote up
void disappearRed()
{

    int cx = mRed.getWidth() / 2;
    int cy = mRed.getHeight() / 2;

    SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mRed, cx, cy, mRed.getWidth() / 2, 0);
    animator.addListener(new SimpleListener()
    {
        @Override
        public void onAnimationEnd()
        {
            mRed.setVisibility(View.INVISIBLE);
            ViewHelper.setX(mRed, startRedX);
            ViewHelper.setY(mRed, startRedY);
            release();
        }
    });
    animator.setInterpolator(DECELERATE);
    animator.start();
}
 
Example 39
Project: ArcAnimator-master   File: MainActivity.java   View source code 6 votes vote down vote up
void disappearBluePair()
{
    float finalRadius = Math.max(mBluePair.getWidth(), mBluePair.getHeight()) * 1.5f;

    SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mBluePair, endBlueX, endBlueY,
            finalRadius, mBlue.getWidth() / 2f);
    animator.setDuration(300);
    animator.addListener(new SimpleListener()
    {
        @Override
        public void onAnimationEnd()
        {
            mBluePair.setVisibility(View.INVISIBLE);
            returnBlue();
        }
    });
    animator.setInterpolator(DECELERATE);
    animator.start();
}
 
Example 40
Project: homerplayer   File: FragmentPlayback.java   View source code 6 votes vote down vote up
private Animator createAnimation(View v, float x, float y, boolean reveal) {
    Rect viewRect = ViewUtils.getRelativeRect(commonParent, v);
    float startX = viewRect.left + x;
    float startY = viewRect.top + y;

    // Compute final radius
    float dx = Math.max(startX, commonParent.getWidth() - startX);
    float dy = Math.max(startY, commonParent.getHeight() - startY);
    float finalRadius = (float) Math.hypot(dx, dy);

    float initialRadius = reveal ? 0f : finalRadius;
    if (!reveal)
        finalRadius = 0f;

    final int durationResId = reveal
            ? R.integer.ff_rewind_overlay_show_animation_time_ms
            : R.integer.ff_rewind_overlay_hide_animation_time_ms;
    Animator animator = ViewAnimationUtils.createCircularReveal(
            rewindOverlay, Math.round(startX), Math.round(startY), initialRadius, finalRadius);
    animator.setDuration(getResources().getInteger(durationResId));
    animator.setInterpolator(new AccelerateDecelerateInterpolator());

    return animator;
}