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:com.example.mego.adas.directions.ui.DirectionsFragment.java

/**
 * method to hide edit text with animation
 *///from   www.j a v a  2  s .co  m
private void hideEditText(final LinearLayout view) {
    int cx = view.getRight() - 30;
    int cy = view.getBottom() - 60;
    int initialRadius = view.getWidth();
    Animator anim = null;
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, initialRadius, 0);
    }
    if (anim != null) {
        anim.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                view.setVisibility(View.INVISIBLE);
            }
        });
    }
    isEditTextVisible = false;
    if (anim != null) {
        anim.start();
    }
}

From source file:com.android.deskclock.timer.TimerFullScreenFragment.java

@Override
public void onResume() {
    Intent newIntent = null;//  ww  w. j ava 2 s. c o m

    if (getActivity() instanceof DeskClock) {
        DeskClock activity = (DeskClock) getActivity();
        activity.registerPageChangedListener(this);
        newIntent = activity.getIntent();
    }
    super.onResume();
    mPrefs.registerOnSharedPreferenceChangeListener(this);

    mAdapter = createAdapter(getActivity());
    mAdapter.onRestoreInstanceState(null);

    LayoutParams params;
    float dividerHeight = getResources().getDimension(R.dimen.timer_divider_height);
    if (getActivity() instanceof DeskClock) {
        // If this is a DeskClock fragment (i.e. not a FullScreenTimerAlert), add a footer to
        // the bottom of the list so that it can scroll underneath the bottom button bar.
        // StaggeredGridView doesn't support a footer view, but GridAdapter does, so this
        // can't happen until the Adapter itself is instantiated.
        View footerView = getActivity().getLayoutInflater().inflate(R.layout.blank_footer_view, mTimersList,
                false);
        params = footerView.getLayoutParams();
        params.height -= dividerHeight;
        footerView.setLayoutParams(params);
        mAdapter.setFooterView(footerView);
    }

    if (mPrefs.getBoolean(Timers.REFRESH_UI_WITH_LATEST_DATA, false)) {
        // Clear the flag indicating the adapter is out of sync with the database.
        mPrefs.edit().putBoolean(Timers.REFRESH_UI_WITH_LATEST_DATA, false).apply();
    }

    mTimersList.setAdapter(mAdapter);
    setTimerListPosition(mAdapter.getCount());

    mLastVisibleView = null; // Force a non animation setting of the view
    setPage();
    // View was hidden in onPause, make sure it is visible now.
    View v = getView();
    if (v != null) {
        getView().setVisibility(View.VISIBLE);
    }

    if (newIntent != null) {
        processIntent(newIntent);
    }

    mFab.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View view) {
            final Animator revealAnimator = getRevealAnimator(mFab, Color.WHITE);
            revealAnimator.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    updateAllTimesUpTimers();
                }
            });
            revealAnimator.start();
        }
    });
}

From source file:com.hannesdorfmann.search.SearchActivity.java

@OnClick({ R.id.scrim, R.id.searchback })
  protected void dismiss() {
      // translate the icon to match position in the launching activity
      searchBackContainer.animate().translationX(searchBackDistanceX).setDuration(600L)
              .setInterpolator(AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_slow_in))
              .setListener(new AnimatorListenerAdapter() {
                  @Override//  w ww .  ja  v a 2s  .c  o  m
                  public void onAnimationEnd(Animator animation) {
                      finishAfterTransition();
                  }
              }).start();
      // transform from back icon to search icon
      AnimatedVectorDrawable backToSearch = (AnimatedVectorDrawable) ContextCompat.getDrawable(this,
              R.drawable.avd_back_to_search);
      searchBack.setImageDrawable(backToSearch);
      // clear the background else the touch ripple moves with the translation which looks bad
      searchBack.setBackground(null);
      backToSearch.start();
      // fade out the other search chrome
      searchView.animate().alpha(0f).setStartDelay(0L).setDuration(120L)
              .setInterpolator(AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_linear_in))
              .setListener(null).start();
      searchBackground.animate().alpha(0f).setStartDelay(300L).setDuration(160L)
              .setInterpolator(AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_linear_in))
              .setListener(null).start();
      if (searchToolbar.getZ() != 0f) {
          searchToolbar.animate().z(0f).setDuration(600L)
                  .setInterpolator(
                          AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_linear_in))
                  .start();
      }

      // if we're showing search results, circular hide them
      if (resultsContainer.getHeight() > 0) {
          Animator closeResults = ViewAnimationUtils.createCircularReveal(resultsContainer, searchIconCenterX, 0,
                  (float) Math.hypot(searchIconCenterX, resultsContainer.getHeight()), 0f);
          closeResults.setDuration(500L);
          closeResults.setInterpolator(
                  AnimationUtils.loadInterpolator(SearchActivity.this, android.R.interpolator.fast_out_slow_in));
          closeResults.addListener(new AnimatorListenerAdapter() {
              @Override
              public void onAnimationEnd(Animator animation) {
                  resultsContainer.setVisibility(View.INVISIBLE);
              }
          });
          closeResults.start();
      }

      // fade out the scrim
      scrim.animate().alpha(0f).setDuration(400L)
              .setInterpolator(AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_linear_in))
              .setListener(null).start();
  }

From source file:com.pitchedapps.primenumbercalculator.Calculator.java

License:asdf

void exitReveal(View view) {
    // previously visible view
    final View myView = view;

    // 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, x, y, initialRadius, 0).setDuration(600);

    // make the view invisible when the animation is done
    anim.addListener(new AnimatorListenerAdapter() {
        @Override//  w w  w  .j  ava  2s .  co m
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            myView.setVisibility(View.INVISIBLE);
        }
    });

    // start the animation
    anim.start();
}

From source file:babbq.com.searchplace.SearchActivity.java

@OnClick({ R.id.scrim, R.id.searchback })
protected void dismiss() {
    // translate the icon to match position in the launching activity
    searchBackContainer.animate().translationX(searchBackDistanceX).setDuration(600L)
            .setInterpolator(AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_slow_in))
            .setListener(new AnimatorListenerAdapter() {

                @Override/* w w  w  .  ja  va2s  .  c o  m*/
                public void onAnimationEnd(Animator animation) {
                    finishAfterTransition();
                }
            }).start();
    // transform from back icon to search icon
    AnimatedVectorDrawable backToSearch = (AnimatedVectorDrawable) ContextCompat.getDrawable(this,
            R.drawable.avd_back_to_search);
    searchBack.setImageDrawable(backToSearch);
    // clear the background else the touch ripple moves with the translation which looks bad
    searchBack.setBackground(null);
    backToSearch.start();
    // fade out the other search chrome
    searchView.animate().alpha(0f).setStartDelay(0L).setDuration(120L)
            .setInterpolator(AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_linear_in))
            .setListener(null).start();
    searchBackground.animate().alpha(0f).setStartDelay(300L).setDuration(160L)
            .setInterpolator(AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_linear_in))
            .setListener(null).start();
    if (searchToolbar.getZ() != 0f) {
        searchToolbar.animate().z(0f).setDuration(600L)
                .setInterpolator(
                        AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_linear_in))
                .start();
    }

    // if we're showing search results, circular hide them
    if (resultsContainer.getHeight() > 0) {
        Animator closeResults = ViewAnimationUtils.createCircularReveal(resultsContainer, searchIconCenterX, 0,
                (float) Math.hypot(searchIconCenterX, resultsContainer.getHeight()), 0f);
        closeResults.setDuration(500L);
        closeResults.setInterpolator(
                AnimationUtils.loadInterpolator(SearchActivity.this, android.R.interpolator.fast_out_slow_in));
        closeResults.addListener(new AnimatorListenerAdapter() {

            @Override
            public void onAnimationEnd(Animator animation) {
                resultsContainer.setVisibility(View.INVISIBLE);
            }
        });
        closeResults.start();
    }

    // fade out the scrim
    scrim.animate().alpha(0f).setDuration(400L)
            .setInterpolator(AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_linear_in))
            .setListener(null).start();
}

From source file:org.huxizhijian.hhcomicviewer.ui.entry.ComicDetailsActivity.java

@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void animateRevealShow(View viewRoot) {
    //???// www  . j av a2s .c  o  m
    int cx = (viewRoot.getLeft() + viewRoot.getRight()) / 2;
    int cy = (viewRoot.getTop() + viewRoot.getBottom()) / 2;
    //?
    int finalRadius = Math.max(viewRoot.getWidth(), viewRoot.getHeight());

    Animator anim = ViewAnimationUtils.createCircularReveal(viewRoot, cx, cy, 0, finalRadius);
    viewRoot.setVisibility(View.VISIBLE); //??
    anim.setDuration(getResources().getInteger(R.integer.anim_duration_medium));//
    anim.setInterpolator(new AccelerateInterpolator());//? ??
    anim.start();
}

From source file:com.taobao.weex.ui.action.GraphicActionAnimation.java

private void startAnimation(@NonNull WXSDKInstance instance, @Nullable WXComponent component) {
    if (component != null) {
        if (mAnimationBean != null) {
            component.setNeedLayoutOnAnimation(mAnimationBean.needLayout);
        }//from  ww  w  .ja v  a2s  .com
        if (component.getHostView() == null) {
            WXAnimationModule.AnimationHolder holder = new WXAnimationModule.AnimationHolder(mAnimationBean,
                    callback);
            component.postAnimation(holder);
        } else {
            try {
                Animator animator = createAnimator(component.getHostView(),
                        instance.getInstanceViewPortWidth());
                if (animator != null) {
                    Animator.AnimatorListener animatorCallback = createAnimatorListener(instance, callback);
                    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR2
                            && component.isLayerTypeEnabled()) {
                        component.getHostView().setLayerType(View.LAYER_TYPE_HARDWARE, null);
                    }
                    Interpolator interpolator = createTimeInterpolator();
                    if (animatorCallback != null) {
                        animator.addListener(animatorCallback);
                    }
                    if (interpolator != null) {
                        animator.setInterpolator(interpolator);
                    }
                    component.getHostView().setCameraDistance(mAnimationBean.styles.getCameraDistance());
                    animator.setDuration(mAnimationBean.duration);
                    animator.start();
                }
            } catch (RuntimeException e) {
                WXLogUtils.e(TAG, WXLogUtils.getStackTrace(e));
            }
        }
    }
}

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

private void expandImageAndFinish() {
    if (imageView.getOffset() != 0f) {
        Animator expandImage = ObjectAnimator.ofFloat(imageView, ParallaxScrimageView.OFFSET, 0f);
        expandImage.setDuration(80);/* ww  w . ja va 2  s  . c  o  m*/
        expandImage.setInterpolator(
                AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_slow_in));
        expandImage.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                finishAfterTransition();
            }
        });
        expandImage.start();
    } else {
        finishAfterTransition();
    }
}

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

/**
 * Animate in the title, description and author  can't do this in a content transition as they
 * are within the ListView so do it manually.  Also handle the FAB tanslation here so that it
 * plays nicely with #calculateFabPosition
 *//*from   w ww .  j a  v a  2 s .  c om*/
private void enterAnimation(boolean isOrientationChange) {
    Interpolator interp = AnimationUtils.loadInterpolator(this, android.R.interpolator.fast_out_slow_in);
    int offset = title.getHeight();
    viewEnterAnimation(title, offset, interp);
    if (description.getVisibility() == View.VISIBLE) {
        offset *= 1.5f;
        viewEnterAnimation(description, offset, interp);
    }
    // animate the fab without touching the alpha as this is handled in the content transition
    offset *= 1.5f;
    float fabTransY = fab.getTranslationY();
    fab.setTranslationY(fabTransY + offset);
    fab.animate().translationY(fabTransY).setDuration(600).setInterpolator(interp).start();
    offset *= 1.5f;
    viewEnterAnimation(shotActions, offset, interp);
    offset *= 1.5f;
    viewEnterAnimation(playerName, offset, interp);
    viewEnterAnimation(playerAvatar, offset, interp);
    viewEnterAnimation(shotTimeAgo, offset, interp);
    back.animate().alpha(1f).setDuration(600).setInterpolator(interp).start();

    if (isOrientationChange) {
        // we rely on the window enter content transition to show the fab. This isn't run on
        // orientation changes so manually show it.
        Animator showFab = ObjectAnimator.ofPropertyValuesHolder(fab,
                PropertyValuesHolder.ofFloat(View.ALPHA, 0f, 1f),
                PropertyValuesHolder.ofFloat(View.SCALE_X, 0f, 1f),
                PropertyValuesHolder.ofFloat(View.SCALE_Y, 0f, 1f));
        showFab.setStartDelay(300L);
        showFab.setDuration(300L);
        showFab.setInterpolator(
                AnimationUtils.loadInterpolator(this, android.R.interpolator.linear_out_slow_in));
        showFab.start();
    }
}

From source file:com.mishiranu.dashchan.ui.navigator.NavigatorActivity.java

private void startListAnimator(Animator animator) {
    clearListAnimator();
    currentListAnimator = animator;
    animator.start();
}