List of usage examples for android.animation Animator start
public void start()
From source file:im.ene.lab.design.widget.vector.AnimatedVectorDrawable.java
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) @Override/*from ww w.j a va 2s . co m*/ public void start() { final ArrayList<Animator> animators = mAnimatedVectorState.mAnimators; final int size = animators.size(); for (int i = 0; i < size; i++) { final Animator animator = animators.get(i); if (!animator.isStarted()) { animator.start(); } } invalidateSelf(); }
From source file:com.wnafee.vector.compat.AnimatedVectorDrawable.java
public void startTarget(String targetId) { for (Map.Entry<Animator, String> set : mAnimatedVectorState.mTargetNameMap.entrySet()) { final Animator animator = set.getKey(); if (set.getValue().equals(targetId) && !animator.isStarted()) { animator.start(); }/*from www. j a v a 2s .co m*/ } invalidateSelf(); }
From source file:io.vit.vitio.Fragments.SubjectView.SubjectViewFragmentTrial.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) void circularRevealSchoolImage() { // previously invisible view // get the center for the clipping circle int cx = schoolImage.getMeasuredWidth() / 2; int cy = schoolImage.getMeasuredHeight() / 2; // get the final radius for the clipping circle int finalRadius = Math.max(schoolImage.getWidth(), schoolImage.getHeight()) / 2; // create the animator for this view (the start radius is zero) Animator anim = ViewAnimationUtils.createCircularReveal(schoolImage, cx, cy, 0, finalRadius); // make the view visible and start the animation schoolImage.setVisibility(View.VISIBLE); anim.start(); }
From source file:com.google.samples.apps.ourstreets.fragment.StreetViewFragment.java
@Override public void onBackPressed() { if (isRestored) { getFragmentManager().popBackStack(); } else {/*from w w w.j a v a 2s .co m*/ // Perform a circular conceal, then pop this fragment off the back stack. final FrameLayout view = ((FrameLayout) getView()); //noinspection ConstantConditions Animator circularConceal = ViewUtils.createCircularConceal(mRevealCenter, mRevealWidth, view, INTERPOLATOR); circularConceal.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { view.setVisibility(View.GONE); getFragmentManager().popBackStack(); } }); circularConceal.start(); } }
From source file:com.truizlop.fabreveallayout.FABRevealLayout.java
private void expandCircle() { Animator expandAnimator = circularExpandingView.expand(); ;/*from w ww.jav a 2 s. c o m*/ expandAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationEnd(Animator animation) { super.onAnimationEnd(animation); swapViews(); } }); expandAnimator.start(); }
From source file:shetye.prathamesh.notifyme.Utilities.java
public void showView(LinearLayout lview) { // get the center for the clipping circle int cx = (lview.getLeft() + lview.getRight()) / 2; int cy = (lview.getTop() + lview.getBottom()) / 2; // get the final radius for the clipping circle int finalRadius = Math.max(lview.getWidth(), lview.getHeight()); // create the animator for this view (the start radius is zero) Animator anim = ViewAnimationUtils.createCircularReveal(lview, cx, cy, 0, finalRadius); // make the view visible and start the animation lview.setVisibility(View.VISIBLE); anim.start(); }
From source file:android.support.graphics.drawable.AnimatedVectorDrawableCompat.java
@Override public void start() { if (mDelegateDrawable != null) { ((AnimatedVectorDrawable) mDelegateDrawable).start(); return;//from w w w . j a va 2 s . c om } // If any one of the animator has not ended, do nothing. if (isStarted()) { return; } // Otherwise, kick off every animator. final ArrayList<Animator> animators = mAnimatedVectorState.mAnimators; final int size = animators.size(); for (int i = 0; i < size; i++) { final Animator animator = animators.get(i); animator.start(); } invalidateSelf(); }
From source file:com.fastbootmobile.encore.app.ArtistActivity.java
@Override @TargetApi(Build.VERSION_CODES.LOLLIPOP) protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_artist); mHandler = new Handler(); FragmentManager fm = getSupportFragmentManager(); mActiveFragment = (ArtistFragment) fm.findFragmentByTag(TAG_FRAGMENT); if (savedInstanceState == null) { mHero = Utils.dequeueBitmap(BITMAP_ARTIST_HERO); mInitialIntent = getIntent().getExtras(); } else {//from w ww .j a v a 2 s. c om mHero = Utils.dequeueBitmap(BITMAP_ARTIST_HERO); mInitialIntent = savedInstanceState.getBundle(EXTRA_RESTORE_INTENT); } if (mActiveFragment == null) { mActiveFragment = new ArtistFragment(); fm.beginTransaction().add(R.id.container, mActiveFragment, TAG_FRAGMENT).commit(); } mActiveFragment.setArguments(mHero, mInitialIntent); // Remove the activity title as we don't want it here mToolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(mToolbar); final ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); actionBar.setTitle(""); } mIsEntering = true; if (Utils.hasLollipop()) { setEnterSharedElementCallback(new SharedElementCallback() { @Override public void onMapSharedElements(List<String> names, Map<String, View> sharedElements) { View fab = mActiveFragment.findViewById(R.id.fabPlay); fab.setVisibility(View.VISIBLE); // get the center for the clipping circle int cx = fab.getMeasuredWidth() / 2; int cy = fab.getMeasuredHeight() / 2; // get the final radius for the clipping circle final int finalRadius = fab.getWidth(); // create and start the animator for this view // (the start radius is zero) Animator anim; if (mIsEntering) { anim = ViewAnimationUtils.createCircularReveal(fab, cx, cy, 0, finalRadius); } else { anim = ViewAnimationUtils.createCircularReveal(fab, cx, cy, finalRadius, 0); } anim.setInterpolator(new DecelerateInterpolator()); anim.start(); fab.setTranslationX(-fab.getMeasuredWidth() / 4.0f); fab.setTranslationY(-fab.getMeasuredHeight() / 4.0f); fab.animate().translationX(0.0f).translationY(0.0f) .setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime)) .setInterpolator(new DecelerateInterpolator()).start(); final View artistName = mActiveFragment.findViewById(R.id.tvArtist); if (artistName != null) { cx = artistName.getMeasuredWidth() / 4; cy = artistName.getMeasuredHeight() / 2; final int duration = getResources().getInteger(android.R.integer.config_mediumAnimTime); final int radius = Utils.getEnclosingCircleRadius(artistName, cx, cy); if (mIsEntering) { artistName.setVisibility(View.INVISIBLE); Utils.animateCircleReveal(artistName, cx, cy, 0, radius, duration, 300); } else { artistName.setVisibility(View.VISIBLE); Utils.animateCircleReveal(artistName, cx, cy, radius, 0, duration, 0); } } } }); } getWindow().getDecorView() .setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); }
From source file:com.fastbootmobile.encore.utils.Utils.java
@TargetApi(Build.VERSION_CODES.LOLLIPOP) public static Animator animateCircleReveal(final View view, final int cx, final int cy, final int startRadius, final int endRadius, final long duration, final long startDelay) { Animator animator = ViewAnimationUtils.createCircularReveal(view, cx, cy, startRadius, endRadius) .setDuration(duration);//from www . j av a 2s .co m animator.setStartDelay(startDelay); animator.setInterpolator(new DecelerateInterpolator()); animator.addListener(new Animator.AnimatorListener() { @Override public void onAnimationStart(Animator animation) { view.setVisibility(View.VISIBLE); } @Override public void onAnimationEnd(Animator animation) { if (startRadius > endRadius) { view.setVisibility(View.INVISIBLE); } } @Override public void onAnimationCancel(Animator animation) { } @Override public void onAnimationRepeat(Animator animation) { } }); animator.start(); return animator; }
From source file:com.oceansky.yellow.app.ArtistActivity.java
@Override @TargetApi(Build.VERSION_CODES.LOLLIPOP) protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_artist); mHandler = new Handler(); FragmentManager fm = getSupportFragmentManager(); mActiveFragment = (ArtistFragment) fm.findFragmentByTag(TAG_FRAGMENT); if (savedInstanceState == null) { mHero = Utils.dequeueBitmap(BITMAP_ARTIST_HERO); mInitialIntent = getIntent().getExtras(); } else {/*from w w w . ja va2 s. c om*/ mHero = Utils.dequeueBitmap(BITMAP_ARTIST_HERO); mInitialIntent = savedInstanceState.getBundle(EXTRA_RESTORE_INTENT); } if (mActiveFragment == null) { mActiveFragment = new ArtistFragment(); fm.beginTransaction().add(R.id.container, mActiveFragment, TAG_FRAGMENT).commit(); } try { mActiveFragment.setArguments(mHero, mInitialIntent); } catch (IllegalStateException e) { Log.e(TAG, "Invalid artist!", e); } // Remove the activity title as we don't want it here mToolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(mToolbar); final ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setDisplayHomeAsUpEnabled(true); actionBar.setHomeButtonEnabled(true); actionBar.setTitle(""); } mIsEntering = true; if (Utils.hasLollipop()) { setEnterSharedElementCallback(new SharedElementCallback() { @Override public void onMapSharedElements(List<String> names, Map<String, View> sharedElements) { View fab = mActiveFragment.findViewById(R.id.fabPlay); fab.setVisibility(View.VISIBLE); // get the center for the clipping circle int cx = fab.getMeasuredWidth() / 2; int cy = fab.getMeasuredHeight() / 2; // get the final radius for the clipping circle final int finalRadius = fab.getWidth(); // create and start the animator for this view // (the start radius is zero) Animator anim; if (mIsEntering) { anim = ViewAnimationUtils.createCircularReveal(fab, cx, cy, 0, finalRadius); } else { anim = ViewAnimationUtils.createCircularReveal(fab, cx, cy, finalRadius, 0); } anim.setInterpolator(new DecelerateInterpolator()); anim.start(); fab.setTranslationX(-fab.getMeasuredWidth() / 4.0f); fab.setTranslationY(-fab.getMeasuredHeight() / 4.0f); fab.animate().translationX(0.0f).translationY(0.0f) .setDuration(getResources().getInteger(android.R.integer.config_shortAnimTime)) .setInterpolator(new DecelerateInterpolator()).start(); final View artistName = mActiveFragment.findViewById(R.id.tvArtist); if (artistName != null) { cx = artistName.getMeasuredWidth() / 4; cy = artistName.getMeasuredHeight() / 2; final int duration = getResources().getInteger(android.R.integer.config_mediumAnimTime); final int radius = Utils.getEnclosingCircleRadius(artistName, cx, cy); if (mIsEntering) { artistName.setVisibility(View.INVISIBLE); Utils.animateCircleReveal(artistName, cx, cy, 0, radius, duration, 300); } else { artistName.setVisibility(View.VISIBLE); Utils.animateCircleReveal(artistName, cx, cy, radius, 0, duration, 0); } } } }); } getWindow().getDecorView() .setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); }