Example usage for android.animation Animator start

List of usage examples for android.animation Animator start

Introduction

In this page you can find the example usage for android.animation Animator start.

Prototype

public void start() 

Source Link

Document

Starts this animation.

Usage

From source file:zjut.com.laowuguanli.activity.MainActivity.java

private void showDT() {
    Animator showAnimatorA = new AlphaInAnimation(0, 1).getHideAnimators(mLinearLayoutDateTime);
    Animator showAnimatorS = new SlideInLeftAnimation(this).getShowAnimator(mLinearLayoutDateTime);
    showAnimatorA.setDuration(DURATION);
    showAnimatorS.setDuration(DURATION);
    showAnimatorA.setInterpolator(mInterpolator);
    showAnimatorS.setInterpolator(mInterpolator);
    showAnimatorA.start();
    showAnimatorS.start();//  ww w.  j a  va  2  s.c  o m
}

From source file:zjut.com.laowuguanli.activity.MainActivity.java

private void hideDT() {
    Animator hideAnimatorA = new AlphaInAnimation(1, 0).getHideAnimators(mLinearLayoutDateTime);
    Animator hideAnimatorS = new SlideInLeftAnimation(this).getHideAnimator(mLinearLayoutDateTime);

    hideAnimatorA.setDuration(DURATION);
    hideAnimatorS.setDuration(DURATION);
    hideAnimatorA.setInterpolator(mInterpolator);
    hideAnimatorS.setInterpolator(mInterpolator);
    hideAnimatorA.start();
    hideAnimatorS.start();/*from www  . j a va 2 s  .c o  m*/
}

From source file:io.github.douglasjunior.androidSimpleTooltip.SimpleTooltip.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private synchronized void startFloatingAnimation() {
    final String property = mGravity == Gravity.TOP || mGravity == Gravity.BOTTOM ? "translationY"
            : "translationX";

    final ObjectAnimator anim1 = ObjectAnimator.ofFloat(mContentLayout, property, -mAnimationPadding,
            mAnimationPadding);//  w  ww.java 2  s. c  o  m
    anim1.setDuration(mAnimationDuration);
    anim1.setInterpolator(new AccelerateDecelerateInterpolator());

    final ObjectAnimator anim2 = ObjectAnimator.ofFloat(mContentLayout, property, mAnimationPadding,
            -mAnimationPadding);
    anim2.setDuration(mAnimationDuration);
    anim2.setInterpolator(new AccelerateDecelerateInterpolator());

    AnimatorSet set = new AnimatorSet();
    set.playSequentially(anim1, anim2);
    set.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            if (isShowing()) {
                animation.start();
            }
        }
    });
    mAnimator = set;
    mAnimator.start();
}

From source file:com.google.samples.apps.iosched.ui.SearchActivity.java

/**
 * On Lollipop+ perform a circular animation (a contracting circular mask) when hiding the
 * search panel.//from   ww w  .  j av a 2s .c o m
 */
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void doExitAnim() {
    final View searchPanel = findViewById(R.id.search_panel);
    // Center the animation on the top right of the panel i.e. near to the search button which
    // launched this screen. The starting radius therefore is the diagonal distance from the top
    // right to the bottom left
    int revealRadius = (int) Math
            .sqrt(Math.pow(searchPanel.getWidth(), 2) + Math.pow(searchPanel.getHeight(), 2));
    // Animating the radius to 0 produces the contracting effect
    Animator shrink = ViewAnimationUtils.createCircularReveal(searchPanel, searchPanel.getRight(),
            searchPanel.getTop(), revealRadius, 0f);
    shrink.setDuration(200L);
    shrink.setInterpolator(
            AnimationUtils.loadInterpolator(SearchActivity.this, android.R.interpolator.fast_out_slow_in));
    shrink.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            searchPanel.setVisibility(View.INVISIBLE);
            ActivityCompat.finishAfterTransition(SearchActivity.this);
        }
    });
    shrink.start();

    // We also animate out the translucent background at the same time.
    findViewById(R.id.scrim).animate().alpha(0f).setDuration(200L).setInterpolator(
            AnimationUtils.loadInterpolator(SearchActivity.this, android.R.interpolator.fast_out_slow_in))
            .start();
}

From source file:com.alburivan.slickform.tooltip.SimpleTooltip.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void startAnimation() {
    final String property = mGravity == Gravity.TOP || mGravity == Gravity.BOTTOM ? "translationY"
            : "translationX";

    final ObjectAnimator anim1 = ObjectAnimator.ofFloat(mContentLayout, property, -mAnimationPadding,
            mAnimationPadding);//  w ww. j a  v  a2  s.  c  om
    anim1.setDuration(mAnimationDuration);
    anim1.setInterpolator(new AccelerateDecelerateInterpolator());

    final ObjectAnimator anim2 = ObjectAnimator.ofFloat(mContentLayout, property, mAnimationPadding,
            -mAnimationPadding);
    anim2.setDuration(mAnimationDuration);
    anim2.setInterpolator(new AccelerateDecelerateInterpolator());

    mAnimator = new AnimatorSet();
    mAnimator.playSequentially(anim1, anim2);
    mAnimator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            if (!dismissed && isShowing()) {
                animation.start();
            }
        }
    });
    mAnimator.start();
}

From source file:io.plaidapp.ui.SearchActivity.java

@OnClick(R.id.fab)
protected void save() {
    // show the save confirmation bubble
    fab.setVisibility(View.INVISIBLE);
    confirmSaveContainer.setVisibility(View.VISIBLE);
    resultsScrim.setVisibility(View.VISIBLE);

    // expand it once it's been measured and show a scrim over the search results
    confirmSaveContainer.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
        @Override//from www  .  jav a 2s .  c  om
        public boolean onPreDraw() {
            // expand the confirmation
            confirmSaveContainer.getViewTreeObserver().removeOnPreDrawListener(this);
            Animator reveal = ViewAnimationUtils.createCircularReveal(confirmSaveContainer,
                    confirmSaveContainer.getWidth() / 2, confirmSaveContainer.getHeight() / 2,
                    fab.getWidth() / 2, confirmSaveContainer.getWidth() / 2);
            reveal.setDuration(250L);
            reveal.setInterpolator(AnimationUtils.loadInterpolator(SearchActivity.this,
                    android.R.interpolator.fast_out_slow_in));
            reveal.start();

            // show the scrim
            int centerX = (fab.getLeft() + fab.getRight()) / 2;
            int centerY = (fab.getTop() + fab.getBottom()) / 2;
            Animator revealScrim = ViewAnimationUtils.createCircularReveal(resultsScrim, centerX, centerY, 0,
                    (float) Math.hypot(centerX, centerY));
            revealScrim.setDuration(400L);
            revealScrim.setInterpolator(AnimationUtils.loadInterpolator(SearchActivity.this,
                    android.R.interpolator.linear_out_slow_in));
            revealScrim.start();
            ObjectAnimator fadeInScrim = ObjectAnimator.ofArgb(resultsScrim, ViewUtils.BACKGROUND_COLOR,
                    Color.TRANSPARENT, ContextCompat.getColor(SearchActivity.this, R.color.scrim));
            fadeInScrim.setDuration(800L);
            fadeInScrim.setInterpolator(AnimationUtils.loadInterpolator(SearchActivity.this,
                    android.R.interpolator.linear_out_slow_in));
            fadeInScrim.start();

            // ease in the checkboxes
            saveDribbble.setAlpha(0.6f);
            saveDribbble.setTranslationY(saveDribbble.getHeight() * 0.4f);
            saveDribbble.animate().alpha(1f).translationY(0f).setDuration(200L).setInterpolator(AnimationUtils
                    .loadInterpolator(SearchActivity.this, android.R.interpolator.linear_out_slow_in));
            saveDesignerNews.setAlpha(0.6f);
            saveDesignerNews.setTranslationY(saveDesignerNews.getHeight() * 0.5f);
            saveDesignerNews.animate().alpha(1f).translationY(0f).setDuration(200L)
                    .setInterpolator(AnimationUtils.loadInterpolator(SearchActivity.this,
                            android.R.interpolator.linear_out_slow_in));
            return false;
        }
    });
}

From source file:com.google.android.apps.santatracker.launch.TvStartupActivity.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void playCircularRevealTransition(View srcView) {

    showColorMask(true);/*from  ww w.  j  av  a2 s .  co  m*/
    View mask = findViewById(R.id.content_mask);
    srcView.getGlobalVisibleRect(mSrcRect);
    Animator anim = ViewAnimationUtils.createCircularReveal(mask, mSrcRect.centerX(), mSrcRect.centerY(), 0.f,
            mask.getWidth());
    anim.start();
}

From source file:de.janniskilian.xkcdreader.presentation.components.showcomics.ShowComicsActivity.java

@Override
public void endSearchMode(boolean animate) {
    Utils.hideKeyboard(this);

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        if (animate) {
            // If the device has rotated, we need to calculate a new center for the animation.
            if (searchButtonCenter == null) {
                final View actionMenuView = searchToolbar.getChildAt(2);
                final ViewGroup actionMenuViewGroup = (ViewGroup) actionMenuView;
                final View button = actionMenuViewGroup.getChildAt(0);
                System.out.println(button.getClass());

                searchButtonCenter = new Point(
                        (int) (button.getX() + actionMenuView.getX() - button.getWidth() / 2),
                        (int) (button.getY() + actionMenuView.getY() + button.getHeight() / 2));
            }//from   w ww.j av a2 s. co m

            final Animator animator = ViewAnimationUtils.createCircularReveal(searchToolbar,
                    searchButtonCenter.x, searchButtonCenter.y, searchToolbar.getWidth(), 0);
            animator.setDuration(revealStatusBarDuration);
            animator.addListener(new EndSearchModeAnimationListener(searchToolbar));
            toolbar.setVisibility(View.VISIBLE);
            animator.start();
        } else {
            searchToolbar.setVisibility(View.INVISIBLE);
        }

        setSupportActionBar(toolbar);
    } else {
        toolbar.setBackgroundColor(ContextCompat.getColor(this, R.color.primary));

        final ActionBar actionBar = getSupportActionBar();
        if (actionBar != null) {
            actionBar.setHomeButtonEnabled(false);
            actionBar.setDisplayHomeAsUpEnabled(false);
            actionBar.setCustomView(R.layout.toolbar_search);
            actionBar.setDisplayShowCustomEnabled(false);
            actionBar.setDisplayShowTitleEnabled(true);
        }
    }

    viewPager.setVisibility(View.VISIBLE);
    if (animate) {
        searchResults.animate().alpha(0).setDuration(crossfadeViewPagerSearchDuration)
                .setListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        searchResults.setVisibility(View.GONE);
                    }
                });

        viewPager.animate().alpha(1).setDuration(crossfadeViewPagerSearchDuration).setListener(null);
    } else {
        viewPager.setAlpha(1);
        searchResults.setAlpha(0);
        searchResults.setVisibility(View.GONE);
    }

    searchInputSub.unsubscribe();
    searchInputLengthSub.unsubscribe();
    invalidateOptionsMenu();
}

From source file:com.cryart.sabbathschool.viewmodel.SSQuarterliesViewModel.java

public void onMenuClick() {
    final View view = ssQuarterliesActivityBinding.ssLanguageMenu.ssLanguageMenu;
    final int state = view.getVisibility() == View.VISIBLE ? View.INVISIBLE : View.VISIBLE;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        int centerX = view.getRight();
        int centerY = 0;
        int startRadius = (state == View.VISIBLE) ? 0 : view.getHeight();
        int endRadius = (state == View.VISIBLE) ? view.getHeight() : 0;

        Animator anim = ViewAnimationUtils.createCircularReveal(view, centerX, centerY, startRadius, endRadius);

        if (state == View.VISIBLE) {
            view.setVisibility(state);//from   w ww  .ja v a 2 s .  c  o  m
            ssQuarterliesActivityBinding.ssLanguageMenuOverlay.setVisibility(state);

        } else {
            anim.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    super.onAnimationEnd(animation);
                    view.setVisibility(state);
                    ssQuarterliesActivityBinding.ssLanguageMenuOverlay.setVisibility(state);
                }
            });
        }
        anim.start();
    } else {
        view.setVisibility(state);
        ssQuarterliesActivityBinding.ssLanguageMenuOverlay.setVisibility(state);
    }
}

From source file:com.example.mego.adas.directions.ui.DirectionsFragment.java

/**
 * method used to show the reveal effect to the edit text
 *//*w ww  .  j  av  a  2s.c om*/
private void revealEditText(LinearLayout view) {
    int centerX = view.getRight() - 30;
    int centerY = view.getBottom() - 60;
    int finalRadius = Math.max(view.getWidth(), view.getHeight());

    //work with api 21 or above
    Animator animator = null;
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        animator = ViewAnimationUtils.createCircularReveal(view, centerX, centerY, 0, finalRadius);
    }
    view.setVisibility(View.VISIBLE);

    isEditTextVisible = true;
    if (animator != null) {
        animator.start();
    }
}