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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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   Source Code and License 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;
}
 
Example 41
Project: KernelAdiutor   File: NavHeaderView.java   Source Code and License 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 42
Project: QuickLyric   File: OverlayLayout.java   Source Code and License 6 votes vote down vote up
@Override
public void onVisibilityChanged(View view, int visibility) {
    super.onVisibilityChanged(view, visibility);
    if (visibility == View.VISIBLE && this == view) {
        Lyrics lyrics = LyricsOverlayService.getLyrics();
        if (lyrics != null)
            ((OverlayContentLayout) findViewById(R.id.overlay_content)).update(lyrics, true);
        new ParseTask(findViewById(R.id.overlay_content), getContext(), false, true, true).execute();

        if (revealCenter != null && ViewCompat.isAttachedToWindow(getChildAt(0))) {
            int cx = revealCenter[0];
            int cy = revealCenter[1];
            int dx = Math.max(cx, getWidth() - cx);
            int dy = Math.max(cy, getHeight() - cy);
            float finalRadius = (float) Math.hypot(dx, dy);

            Animator animator = ViewAnimationUtils.createCircularReveal(getChildAt(0), cx, cy, 0, finalRadius);
            animator.setInterpolator(new AccelerateDecelerateInterpolator());
            animator.setDuration(300L);
            animator.start();
            revealCenter = null;
        }
    }
}
 
Example 43
Project: Material-Motion   File: DotsFragment.java   Source Code and License 5 votes vote down vote up
private Animator createRevealAnimator(FloatingActionButton dot, float offsetY){
    ViewCompat.setElevation(dot,0);
    dot.setVisibility(View.INVISIBLE);
    lastDot=dot;
    int cx=(int)(dot.getX()+dot.getHeight()/2);
    int cy=(int)(dot.getY()+dot.getHeight()/2+offsetY);
    int w = topPanel.getWidth();
    int h = topPanel.getHeight();
    final int endRadius = !isFolded?(int) Math.hypot(w, h):dot.getHeight()/2;
    final int startRadius=isFolded?(int) Math.hypot(w, h):dot.getHeight()/2;
    topPanel.setVisibility(View.VISIBLE);
    Animator animator= ViewAnimationUtils.createCircularReveal(topPanel,cx,cy,startRadius,endRadius);
    animator.setDuration(duration(R.integer.reveal_duration));
    return animator;
}
 
Example 44
Project: Material-Motion   File: DotsFragment.java   Source Code and License 5 votes vote down vote up
private Animator backgroundReveal(){
    root.setBackgroundColor(color);
    background.setBackgroundColor(color=colors.get(color));
    int cx=(int)(parent.getX()+parent.getWidth()/2);
    int cy=(int)(parent.getY()+parent.getHeight()/2);
    int w = background.getWidth();
    int h = background.getHeight();
    Animator animator= ViewAnimationUtils.createCircularReveal(background,cx,cy,parent.getHeight()/2,(int)Math.hypot(w, h));
    animator.setDuration(duration(R.integer.reveal_duration)*2);
    return animator;
}
 
Example 45
Project: JewelryUI   File: FabAnimatorPreL.java   Source Code and License 5 votes vote down vote up
@Override
final void revealOn(final View fab, final View transformView, final RevealCallback callback) {
    SupportAnimator animator = ViewAnimationUtils.createCircularReveal(
            transformView,
            getCenterX(fab),
            getCenterY(fab),
            fab.getWidth() / 2,
            (float) Math.hypot(transformView.getWidth(), transformView.getHeight()) / 2);
    transformView.setVisibility(View.VISIBLE);
    animator.setInterpolator(FAB_INTERPOLATOR);
    animator.addListener(new SupportAnimator.AnimatorListener() {
        @Override
        public void onAnimationStart() {
            callback.onRevealStart();
        }

        @Override
        public void onAnimationEnd() {
            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 46
Project: JewelryUI   File: RevealFrameLayout.java   Source Code and License 5 votes vote down vote up
/**
 * @hide
 */
@Override
public SupportAnimator startReverseAnimation() {
    if (mRevealInfo != null && mRevealInfo.hasTarget() && !mRunning) {
        return ViewAnimationUtils.createCircularReveal(mRevealInfo.getTarget(),
                mRevealInfo.centerX, mRevealInfo.centerY,
                mRevealInfo.endRadius, mRevealInfo.startRadius);
    }
    return null;
}
 
Example 47
Project: JewelryUI   File: RevealLinearLayout.java   Source Code and License 5 votes vote down vote up
/**
 * @hide
 */
@Override
public SupportAnimator startReverseAnimation() {
    if (mRevealInfo != null && mRevealInfo.hasTarget() && !mRunning) {
        return ViewAnimationUtils.createCircularReveal(mRevealInfo.getTarget(),
                mRevealInfo.centerX, mRevealInfo.centerY,
                mRevealInfo.endRadius, mRevealInfo.startRadius);
    }
    return null;
}
 
Example 48
Project: Expert-Android-Programming   File: HomeBaseActivity.java   Source Code and License 5 votes vote down vote up
private void exitReveal(final View myView, final int screenType) {
    menuShown = false;
    centerButton.animate().rotation(0).setInterpolator(new AccelerateInterpolator()).setDuration(50);

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

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

    // create the animation (the final radius is zero)
    Animator anim =
            ViewAnimationUtils.createCircularReveal(myView, 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);
            revealLay.setVisibility(View.INVISIBLE);
            openActivity(screenType);
        }
    });

    anim.setDuration(Constant.REVEAL_DURATION);
    // start the animation
    anim.start();

    setSelected(screenType);
}
 
Example 49
Project: MenuSet   File: MainActivity.java   Source Code and License 5 votes vote down vote up
private ScreenShotable replaceFragment(ScreenShotable screenShotable, int topPosition) {
    this.res = this.res == R.drawable.home_bg1 ? R.drawable.home_bg2 : R.drawable.home_bg1;
    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();
    MainContentFragment contentFragment = MainContentFragment.newInstance(this.res);
    fragmentManager.beginTransaction().replace(R.id.content_frame, contentFragment).commit();
    return contentFragment;
}
 
Example 50
Project: Schoolbook   File: LoginActivity.java   Source Code and License 5 votes vote down vote up
private void startReveal(final RelativeLayout view, boolean reverse){

        //Change statusbar color
        if(!reverse) WindowUtil.changeStatusBarColor(LoginActivity.this, "#E91E63"); //Need to put string because resource link doesn't work
        else WindowUtil.changeStatusBarColor(LoginActivity.this, "#1976D2");

        // Get the center for the clipping circle
        int cx = (view.getLeft() + view.getRight()) / 2;
        int cy = view.getBottom() - 60;

        // 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);

        view.setVisibility(View.VISIBLE);

        SupportAnimator animator =
                ViewAnimationUtils.createCircularReveal(view, cx, cy, 0, finalRadius);
        animator.setInterpolator(new AccelerateDecelerateInterpolator());
        animator.setDuration(500);
        if(reverse) {
            animator = animator.reverse();
            animator.addListener(new SupportAnimator.AnimatorListener() {
                @Override public void onAnimationEnd() { view.setVisibility(View.INVISIBLE); }
                @Override public void onAnimationCancel() {}
                @Override public void onAnimationRepeat() {}
                @Override public void onAnimationStart() {}
            });
        }
        animator.start();
    }
 
Example 51
Project: EgeYemekhaneMobil   File: AnimUtils.java   Source Code and License 5 votes vote down vote up
public static SupportAnimator revealFrom(int x, int y, View target, int duration, final AnimationListener callback) {
    int radius = Math.max(target.getWidth(), target.getHeight());

    SupportAnimator animator2 = ViewAnimationUtils.createCircularReveal(target, x, y, 0, radius);

    if (duration > 0)
        animator2.setDuration(duration);

    animator2.addListener(new SupportAnimator.AnimatorListener() {
        @Override
        public void onAnimationStart() {

        }

        @Override
        public void onAnimationEnd() {
            if (callback != null)
                callback.onAnimEnd();
        }

        @Override
        public void onAnimationCancel() {

        }

        @Override
        public void onAnimationRepeat() {

        }
    });
    animator2.setInterpolator(new AccelerateDecelerateInterpolator());
    target.setVisibility(View.VISIBLE);
    animator2.start();
    return animator2;
}
 
Example 52
Project: EgeYemekhaneMobil   File: AnimUtils.java   Source Code and License 5 votes vote down vote up
public static void collapseTo(int x, int y, final View target, int duration, final AnimationListener callback) {
    int radius = Math.max(target.getWidth(), target.getHeight());

    SupportAnimator animator2 = ViewAnimationUtils.createCircularReveal(target, x, y, radius, 0);

    if (duration > 0)
        animator2.setDuration(duration);
    target.setVisibility(View.VISIBLE);
    animator2.addListener(new SupportAnimator.AnimatorListener() {
        @Override
        public void onAnimationStart() {

        }

        @Override
        public void onAnimationEnd() {
            target.setVisibility(View.GONE);
            if (callback != null) callback.onAnimEnd();
        }

        @Override
        public void onAnimationCancel() {

        }

        @Override
        public void onAnimationRepeat() {

        }
    });
    animator2.setInterpolator(new AccelerateDecelerateInterpolator());
    animator2.start();
}
 
Example 53
Project: openlauncher   File: GroupPopupView.java   Source Code and License 5 votes vote down vote up
private void animateFolderOpen() {
    cellContainer.setAlpha(0);

    int finalRadius = Math.max(popupCard.getWidth(), popupCard.getHeight());
    int startRadius = Tool.dp2px(Setup.Companion.appSettings().getDesktopIconSize() / 2, getContext());

    folderAnimator = ViewAnimationUtils.createCircularReveal(popupCard, cx, cy, startRadius, finalRadius);
    folderAnimator.setStartDelay(0);
    folderAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
    folderAnimator.setDuration(folderAnimationTime);
    folderAnimator.start();
    Tool.visibleViews(100, 100, cellContainer);
}
 
Example 54
Project: TappyBLE   File: PrettyCommandSheetView.java   Source Code and License 5 votes vote down vote up
private void initiateCommandEntryFloof(final int x, final int y) { //, int finalTop, int finalLeft, int finalBottom, int finalRight){
    // get the center for the clipping circle
    Point centrePoint = new Point(x,y);
    commandDetailView.getX();

    int[] detailLoc = new int[2];
    commandDetailView.getLocationOnScreen(detailLoc);
    int width = commandDetailView.getMeasuredWidth();
    int height = commandDetailView.getMeasuredHeight();
    
    Rect rect = new Rect();
    commandDetailView.getGlobalVisibleRect(rect);
    Point corner1 = new Point(detailLoc[0],detailLoc[1]);
    Point corner2 = new Point(detailLoc[0],detailLoc[1] + height);
    Point corner3 = new Point(detailLoc[0] + width,detailLoc[1]);
    Point corner4 = new Point(detailLoc[0] + width,detailLoc[1] + height);
    int finalRadius = getMaxDistance(centrePoint,corner1,corner2,corner3,corner4);

    int rX = x - detailLoc[0];
    int rY = y - detailLoc[1];

    detailCircularFloofAnimation =
            ViewAnimationUtils.createCircularReveal(commandDetailView, rX, rY, 0, finalRadius);
    detailCircularFloofAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
    detailCircularFloofAnimation.setDuration(750);
    detailCircularFloofAnimation.start();
}
 
Example 55
Project: Face   File: MainActivity.java   Source Code and License 5 votes vote down vote up
private ScreenShotable replaceFragment(ScreenShotable screenShotable, int topPosition, String fragmentName)
    {
        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();

        if (fragmentName == FaceDetect) {
            getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, faceDetectFragment).commit();
            getSupportActionBar().setTitle(R.string.faceDetect);
            return faceDetectFragment;
        } else if (fragmentName == SimilarFace) {
            getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, similarFaceFragment).commit();
            getSupportActionBar().setTitle(R.string.similarFace);
            return similarFaceFragment;
        } else if (fragmentName == FunnyChartlet) {
            getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, funnyCharletFragment).commit();
            getSupportActionBar().setTitle(R.string.funnyChartlet);
            return funnyCharletFragment;
        }

        return null;
    }
 
Example 56
Project: MasterHelper   File: EuclidFragment.java   Source Code and License 5 votes vote down vote up
/**
 * This method creates and setups circle reveal animation on list item overlay view.
 *
 * @return - animator object that starts circle reveal animation.
 */
private SupportAnimator getAvatarRevealAnimator() {
    final LinearLayout mWrapperListItemReveal = (LinearLayout) mOverlayListItemView.findViewById(R.id.wrapper_list_item_reveal);

    int finalRadius = Math.max(mOverlayListItemView.getWidth(), mOverlayListItemView.getHeight());

    final SupportAnimator mRevealAnimator = ViewAnimationUtils.createCircularReveal(
            mWrapperListItemReveal,
            sScreenWidth / 2,
            sProfileImageHeight / 2,
            dpToPx(getCircleRadiusDp() * 2),
            finalRadius);
    mRevealAnimator.setDuration(getRevealAnimationDuration());
    mRevealAnimator.addListener(new SupportAnimator.AnimatorListener() {
        @Override
        public void onAnimationStart() {
            mWrapperListItemReveal.setVisibility(View.VISIBLE);
            mOverlayListItemView.setX(0);
        }

        @Override
        public void onAnimationEnd() {

        }

        @Override
        public void onAnimationCancel() {

        }

        @Override
        public void onAnimationRepeat() {

        }
    });
    return mRevealAnimator;
}
 
Example 57
Project: MasterHelper   File: EuclidActivity.java   Source Code and License 5 votes vote down vote up
/**
 * This method creates and setups circle reveal animation on list item overlay view.
 *
 * @return - animator object that starts circle reveal animation.
 */
private SupportAnimator getAvatarRevealAnimator() {
    final LinearLayout mWrapperListItemReveal = (LinearLayout) mOverlayListItemView.findViewById(R.id.wrapper_list_item_reveal);

    int finalRadius = Math.max(mOverlayListItemView.getWidth(), mOverlayListItemView.getHeight());

    final SupportAnimator mRevealAnimator = ViewAnimationUtils.createCircularReveal(
            mWrapperListItemReveal,
            sScreenWidth / 2,
            sProfileImageHeight / 2,
            dpToPx(getCircleRadiusDp() * 2),
            finalRadius);
    mRevealAnimator.setDuration(getRevealAnimationDuration());
    mRevealAnimator.addListener(new SupportAnimator.AnimatorListener() {
        @Override
        public void onAnimationStart() {
            mWrapperListItemReveal.setVisibility(View.VISIBLE);
            mOverlayListItemView.setX(0);
        }

        @Override
        public void onAnimationEnd() {

        }

        @Override
        public void onAnimationCancel() {

        }

        @Override
        public void onAnimationRepeat() {

        }
    });
    return mRevealAnimator;
}
 
Example 58
Project: CoolSwitch   File: CoolSwitchRevealAnimation.java   Source Code and License 5 votes vote down vote up
void startRevealAnimation(float initialRadius, float endRadius,
		final View invisibleView, View visibleView, int initialAlpha, int endAlpha,
		long backgroundAnimationDuration) {
	Point revealAnimationCenter = getRevealAnimationCenter();

	SupportAnimator anim = ViewAnimationUtils.createCircularReveal(enabledView,
			revealAnimationCenter.x, revealAnimationCenter.y, initialRadius, endRadius);
	anim.addListener(new CircularAnimatorListener(invisibleView, initialAlpha, endAlpha,
			backgroundAnimationDuration));

	visibleView.setVisibility(View.VISIBLE);
	anim.start();
}
 
Example 59
Project: Side-Menu.Android   File: MainActivity.java   Source Code and License 5 votes vote down vote up
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 60
Project: fab-toolbar   File: RevealFrameLayout.java   Source Code and License 5 votes vote down vote up
/**
 * @hide
 */
@Override
public SupportAnimator startReverseAnimation() {
    if(mRevealInfo != null && mRevealInfo.hasTarget() && !mRunning) {
        return ViewAnimationUtils.createCircularReveal(mRevealInfo.getTarget(),
                mRevealInfo.centerX, mRevealInfo.centerY,
                mRevealInfo.endRadius, mRevealInfo.startRadius);
    }
    return null;
}