io.codetail.animation.ViewAnimationUtils Java Examples

The following examples show how to use io.codetail.animation.ViewAnimationUtils. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RadialTransformationActivity.java    From CircularReveal with MIT 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 #2
Source File: NavHeaderView.java    From SmartPack-Kernel-Manager with GNU General Public License v3.0 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 #3
Source File: UpdateDialogHandler.java    From Pocket-Plays-for-Twitch with GNU General Public License v3.0 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 #4
Source File: AnimationService.java    From Twire with GNU General Public License v3.0 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 #5
Source File: PlayerFragment.java    From android-material-motion with Apache License 2.0 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 #6
Source File: DonationActivity.java    From Pocket-Plays-for-Twitch with GNU General Public License v3.0 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 #7
Source File: AnimationService.java    From Pocket-Plays-for-Twitch with GNU General Public License v3.0 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 #8
Source File: HomeBaseActivity.java    From Expert-Android-Programming with MIT 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 #9
Source File: BrowseNearbyActivity.java    From Expert-Android-Programming with MIT 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 #10
Source File: HomeActivity.java    From Expert-Android-Programming with MIT 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 #11
Source File: AnimationUtil.java    From FileManager with Apache License 2.0 6 votes vote down vote up
/**
 * 默认从左上角往右下角开始拓展,MultipleRadius建议值为2,为什么为2呢,自己联系prj。。。
 *
 * @param view           展开动画的view
 * @param MultipleRadius 半径倍数
 * @param Duration       动画持续时间
 * @return 动画效果
 */
public static Animator getCircularReveal(View view, int MultipleRadius, int Duration) {

    int cx = (view.getLeft() + view.getRight()) / 2;
    int cy = (view.getTop() + view.getBottom()) / 2;

    int dx = Math.max(cx, view.getWidth() - cx);
    int dy = Math.max(cy, view.getHeight() - cy);
    float finalRadius = (float) Math.hypot(dx, dy);

    // Android native animator
    Animator animator =
            ViewAnimationUtils.createCircularReveal(view, 0, 0, 0, finalRadius * MultipleRadius);
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.setDuration(Duration);
    return animator;
}
 
Example #12
Source File: AnimationUtil.java    From FileManager with Apache License 2.0 6 votes vote down vote up
/**
 * @param view           展开动画的view
 * @param centerX        从具体某个点的X坐标开始扩散
 * @param centerY        从具体某个点的Y坐标开始扩散
 * @param MultipleRadius 半径倍数
 * @param Duration       动画时间
 * @return
 */
public static Animator getCircularReveal(View view, int centerX, int centerY, int MultipleRadius, int Duration) {

    int cx = (view.getLeft() + view.getRight()) / 2;
    int cy = (view.getTop() + view.getBottom()) / 2;

    int dx = Math.max(cx, view.getWidth() - cx);
    int dy = Math.max(cy, view.getHeight() - cy);
    float finalRadius = (float) Math.hypot(dx, dy);

    // Android native animator
    Animator animator =
            ViewAnimationUtils.createCircularReveal(view, centerX, centerY, 0, finalRadius * MultipleRadius);
    animator.setInterpolator(new AccelerateDecelerateInterpolator());
    animator.setDuration(Duration);
    return animator;
}
 
Example #13
Source File: MapSearchView.java    From droidkaigi2016 with Apache License 2.0 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 #14
Source File: MemoFragment.java    From MaterialCalendar with Apache License 2.0 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 #15
Source File: MemoFragment.java    From MaterialCalendar with Apache License 2.0 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 #16
Source File: OverlayLayout.java    From QuickLyric with GNU General Public License v3.0 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 #17
Source File: NavHeaderView.java    From KernelAdiutor with GNU General Public License v3.0 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 #18
Source File: MapSearchView.java    From droidkaigi2016 with Apache License 2.0 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 #19
Source File: MapSearchView.java    From droidkaigi2016 with Apache License 2.0 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 #20
Source File: StickerRecyclerView.java    From RecyclerView-Animation-Demo with Apache License 2.0 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 #21
Source File: ViewRevealer.java    From MaterialLife with GNU General Public License v2.0 6 votes vote down vote up
private void animateFor(View view, Point origin, int startRadius, int targetRadius, final AnimatorListenerAdapter animatorListenerAdapter) {
    SupportAnimator animator = ViewAnimationUtils.createCircularReveal(view, origin.x, origin.y, startRadius, targetRadius);
    animator.addListener(new SupportAnimator.AnimatorListener() {
        @Override
        public void onAnimationStart() {
            animatorListenerAdapter.onAnimationStart(null);
        }

        @Override
        public void onAnimationEnd() {
            animatorListenerAdapter.onAnimationEnd(null);
        }

        @Override
        public void onAnimationCancel() {
            animatorListenerAdapter.onAnimationCancel(null);
        }

        @Override
        public void onAnimationRepeat() {
            animatorListenerAdapter.onAnimationRepeat(null);
        }
    });
    animator.setDuration(ANIMATION_DURATION);
    animator.start();
}
 
Example #22
Source File: AnimHelper.java    From FastAccess with GNU General Public License v3.0 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 #23
Source File: MemoFragment.java    From MaterialCalendar with Apache License 2.0 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
Source File: MemoFragment.java    From MaterialCalendar with Apache License 2.0 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 #25
Source File: MapSearchView.java    From droidkaigi2016 with Apache License 2.0 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 #26
Source File: RevealLinearLayout.java    From PersistentSearchView with Apache License 2.0 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 #27
Source File: RevealFrameLayout.java    From material-sheet-fab with MIT 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 #28
Source File: AwesomeSplash.java    From AwesomeSplash with MIT License 5 votes vote down vote up
public void startCircularReveal() {

        // get the final radius for the clipping circle
        int finalRadius = Math.max(mRlReveal.getWidth(), mRlReveal.getHeight()) + mRlReveal.getHeight() / 2;
        //bottom or top
        int y = UIUtil.getRevealDirection(mRlReveal, mConfigSplash.getRevealFlagY());
        //left or right
        int x = UIUtil.getRevealDirection(mRlReveal, mConfigSplash.getRevealFlagX());

        mRlReveal.setBackgroundColor(getResources().getColor(mConfigSplash.getBackgroundColor()));
        SupportAnimator animator = ViewAnimationUtils.createCircularReveal(mRlReveal, x, y, 0, finalRadius);
        animator.setInterpolator(new AccelerateDecelerateInterpolator());
        animator.setDuration(mConfigSplash.getAnimCircularRevealDuration());
        animator.addListener(new SupportAnimator.AnimatorListener() {
            @Override
            public void onAnimationStart() {
            }

            @Override
            public void onAnimationCancel() {
            }

            @Override
            public void onAnimationRepeat() {
            }

            @Override
            public void onAnimationEnd() {

                if (pathOrLogo == Flags.WITH_PATH) {
                    mPathLogo.start();
                } else {
                    startLogoAnimation();
                }
            }
        });
        animator.start();
        hasAnimationStarted = true;
    }
 
Example #29
Source File: MainActivity.java    From Jide-Note with MIT License 5 votes vote down vote up
/**
     * 切换Fragment
     * @param screenShotable
     * 一个实现了 ScreenShotable 接口的 Fragment 对象
     * @param topPosition
     * @return
     */
    private ScreenShotable replaceFragment(Resourceble slideMenuItem,ScreenShotable screenShotable, int topPosition) {
        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();

        switch (slideMenuItem.getName()){

            case RECORD:
                recordFragment = ContentFragment.newInstance(ContentFragment.RECORD);
                getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, recordFragment).commit();
                return recordFragment;
//            case LIST:
//                listFragment = ListFragment.newInstance();
//                getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, listFragment).commit();
//                return listFragment;
            case REMIND:
                remindFragment = ContentFragment.newInstance(ContentFragment.REMIND);
                getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, remindFragment).commit();
                return remindFragment;
            case ARCHIVE:
                archiveFragment = ContentFragment.newInstance(ContentFragment.ARCHIVE);
                getSupportFragmentManager().beginTransaction().replace(R.id.content_frame,archiveFragment).commit();
                return archiveFragment;
            case RECYCLE:
                recycleFragment = ContentFragment.newInstance(ContentFragment.RECYCLE);
                getSupportFragmentManager().beginTransaction().replace(R.id.content_frame,recycleFragment).commit();
                return recycleFragment;

            default:
                break;

        }
        return recordFragment;
    }
 
Example #30
Source File: RevealFrameLayout.java    From PersistentSearchView with Apache License 2.0 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;
}