Java 类android.animation.AnimatorListenerAdapter 实例源码

项目:ArcLayout-master    文件:DemoLikeTumblrActivity.java   
private Animator createHideItemAnimator(final View item) {
  final float dx = centerItem.getX() - item.getX();
  final float dy = centerItem.getY() - item.getY();

  Animator anim = ObjectAnimator.ofPropertyValuesHolder(
      item,
      AnimatorUtils.scaleX(1f, 0f),
      AnimatorUtils.scaleY(1f, 0f),
      AnimatorUtils.translationX(0f, dx),
      AnimatorUtils.translationY(0f, dy)
  );

  anim.setInterpolator(new DecelerateInterpolator());
  anim.addListener(new AnimatorListenerAdapter() {
    @Override
    public void onAnimationEnd(Animator animation) {
      super.onAnimationEnd(animation);
      item.setTranslationX(0f);
      item.setTranslationY(0f);
    }
  });
  anim.setDuration(50);
  return anim;
}
项目:android_ui    文件:SearchView.java   
/**
 */
@Override
void hideProgressBar(SearchView searchView) {
    final CircularProgressBar progressBar = searchView.mProgressBar;
    final ViewPropertyAnimator progressBarAnimator = progressBar.animate();
    progressBarAnimator.setListener(null);
    progressBarAnimator.cancel();
    progressBarAnimator
            .alpha(0.0f)
            .setDuration(UiConfig.ANIMATION_DURATION_SHORT)
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    progressBar.setVisibility(View.INVISIBLE);
                }
            })
            .start();
    final View icon = searchView.mButtonIcon;
    final ViewPropertyAnimator iconAnimator = icon.animate();
    iconAnimator.setListener(null);
    iconAnimator.cancel();
    icon.setVisibility(View.VISIBLE);
    icon.setScaleX(0.5f);
    icon.setScaleY(0.5f);
    icon.setAlpha(0.0f);
    iconAnimator
            .scaleX(1.0f)
            .scaleY(1.0f)
            .alpha(1.0f)
            .setDuration(UiConfig.ANIMATION_DURATION_SHORT)
            .setInterpolator(iconInterpolator)
            .setListener(null)
            .start();
}
项目:SmartRefreshLayout    文件:SmartRefreshLayout.java   
@Override
public RefreshKernel startTwoLevel(boolean open) {
    if (open) {
        AnimatorListenerAdapter listener = new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                SmartRefreshLayout.this.notifyStateChanged(RefreshState.TwoLevel);
            }
        };
        ValueAnimator animator = SmartRefreshLayout.this.animSpinner(SmartRefreshLayout.this.getMeasuredHeight());
        if (animator != null && animator == SmartRefreshLayout.this.reboundAnimator) {
            animator.setDuration(SmartRefreshLayout.this.mFloorDuration);
            animator.addListener(listener);
        } else {
            listener.onAnimationEnd(null);
        }
    } else {
        if (animSpinner(0) == null) {
            SmartRefreshLayout.this.notifyStateChanged(RefreshState.None);
        }
    }
    return this;
}
项目:SmartRefresh    文件:FunGameHeader.java   
private void doStart(long delay) {
    ObjectAnimator topMaskAnimator = ObjectAnimator.ofFloat(topMaskView, "translationY", topMaskView.getTranslationY(), -halfHitBlockHeight);
    ObjectAnimator bottomMaskAnimator = ObjectAnimator.ofFloat(bottomMaskView, "translationY", bottomMaskView.getTranslationY(), halfHitBlockHeight);
    ObjectAnimator maskShadowAnimator = ObjectAnimator.ofFloat(maskReLayout, "alpha", maskReLayout.getAlpha(), 0);

    AnimatorSet animatorSet = new AnimatorSet();
    animatorSet.play(topMaskAnimator).with(bottomMaskAnimator).with(maskShadowAnimator);
    animatorSet.setDuration(800);
    animatorSet.setStartDelay(delay);
    animatorSet.start();

    animatorSet.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            topMaskView.setVisibility(View.GONE);
            bottomMaskView.setVisibility(View.GONE);
            maskReLayout.setVisibility(View.GONE);
            onGameStart();
        }
    });
}
项目:GitHub    文件:ReadEPubActivity.java   
private void toolbarAnimateHide() {
    if (mIsActionBarVisible) {
        mCommonToolbar.animate()
                .translationY(-mCommonToolbar.getHeight())
                .setInterpolator(new LinearInterpolator())
                .setDuration(180)
                .setListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        toolbarSetElevation(0);
                        hideStatusBar();
                        if (mTocListPopupWindow != null && mTocListPopupWindow.isShowing()) {
                            mTocListPopupWindow.dismiss();
                        }
                    }
                });
        mIsActionBarVisible = false;
    }
}
项目:GitHub    文件:DragDropTouchListener.java   
private void reset() {
    //Animate mobile view back to original position
    final View view = getViewByPosition(mobileViewCurrentPos);
    if (view != null && mobileView != null) {
        float y = getViewRawCoords(view)[1];
        mobileView.animate().y(y).setDuration(MOVE_DURATION).setListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                view.setVisibility(View.VISIBLE);
                if (mobileView != null) {
                    ViewGroup parent = (ViewGroup) mobileView.getParent();
                    parent.removeView(mobileView);
                    mobileView = null;
                }

            }
        });

    }

    dragging = false;
    mobileViewStartY = -1;
    mobileViewCurrentPos = -1;

}
项目:JKApp    文件:PullLoadMoreRecyclerView.java   
public void loadMore() {
    if (mPullLoadMoreListener != null && hasMore) {
        mFooterView.animate()
                .translationY(0)
                .setDuration(300)
                .setInterpolator(new AccelerateDecelerateInterpolator())
                .setListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationStart(Animator animation) {
                        mprogressBar.setVisibility(View.VISIBLE);
                        loadMoreText.setText(mContext.getString(R.string.load_more_text));
                        mFooterView.setVisibility(View.VISIBLE);
                    }
                })
                .start();
        invalidate();
        mPullLoadMoreListener.onLoadMore();

    }
}
项目:AndroidOpen    文件:RevealActivity.java   
private void animateRevealHide(final View viewRoot) {
    int cx = (viewRoot.getLeft() + viewRoot.getRight()) / 2;
    int cy = (viewRoot.getTop() + viewRoot.getBottom()) / 2;
    int initialRadius = viewRoot.getWidth();

    Animator anim = ViewAnimationUtils.createCircularReveal(viewRoot, cx, cy, initialRadius, 0);
    anim.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            viewRoot.setVisibility(View.INVISIBLE);
        }
    });
    anim.setDuration(getResources().getInteger(R.integer.anim_duration_medium));
    anim.start();
}
项目:Phial    文件:ShareView.java   
private void showSharePicker() {
    final boolean hasSubView = presentView != null;
    if (hasSubView) {
        final View focusedChild = ShareView.this.getFocusedChild();
        UiUtils.hideKeyBoard(focusedChild);

        final Animator appearAnimator = animatorFactory.createDisappearAnimator(presentView);
        appearAnimator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                removeSubViews();
                sharePickerView.setVisibility(VISIBLE);
            }
        });
        appearAnimator.start();
    }
    shareContext = null;
}
项目:GitHub    文件:AuthRefreshRecyclerFragment.java   
@Override public void showContent() {

    if (adapter.getItemCount() == 0) {
      if (isRestoringViewState()) {
        emptyView.setVisibility(View.VISIBLE);
      } else {
        ObjectAnimator anim = ObjectAnimator.ofFloat(emptyView, "alpha", 0f, 1f).setDuration(300);
        anim.setStartDelay(250);
        anim.addListener(new AnimatorListenerAdapter() {

          @Override public void onAnimationStart(Animator animation) {
            emptyView.setVisibility(View.VISIBLE);
          }
        });
        anim.start();
      }
    } else {
      emptyView.setVisibility(View.GONE);
    }

    super.showContent();
  }
项目:FlickLauncher    文件:PagedView.java   
private void animateDragViewToOriginalPosition() {
    if (mDragView != null) {
        Animator anim = new LauncherViewPropertyAnimator(mDragView)
                .translationX(0)
                .translationY(0)
                .scaleX(1)
                .scaleY(1)
                .setDuration(REORDERING_DROP_REPOSITION_DURATION);
        anim.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                onPostReorderingAnimationCompleted();
            }
        });
        anim.start();
    }
}
项目:CircularRevealCompat    文件:SecondActivity.java   
private void unRevealActivity(final View revealView, int endCenterX, int endCenterY) {
    int startCenterX = revealView.getWidth() / 2;
    int startCenterY = revealView.getHeight() / 2;
    float startRadius = Math.max(revealView.getWidth(), revealView.getHeight()) * 1.1f;
    float finalRadius = 0;
    Animator circularReveal = ViewAnimationCompatUtils.createCircularReveal(revealView, startCenterX, startCenterY, startRadius, endCenterX, endCenterY, finalRadius);
    circularReveal.setDuration(500);
    circularReveal.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            revealView.setVisibility(View.INVISIBLE);
            finish();
        }
    });
    circularReveal.start();
}
项目:HoldingButton    文件:HoldingDrawable.java   
private ValueAnimator createExpandValueAnimator() {
    ValueAnimator animator = ValueAnimator.ofFloat(0f, 1f);
    animator.setDuration(DEFAULT_ANIMATION_DURATION_EXPAND);
    animator.setInterpolator(new AccelerateInterpolator());
    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            mExpandedScaleFactor[0] = (float) valueAnimator.getAnimatedValue();
            invalidateSelf();
        }
    });
    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            notifyExpanded();
        }
    });
    return animator;
}
项目:LaunchEnr    文件:PagedView.java   
private void animateDragViewToOriginalPosition() {
    if (mDragView != null) {
        Animator anim = LauncherAnimUtils.ofPropertyValuesHolder(mDragView,
                new PropertyListBuilder()
                        .scale(1)
                        .translationX(0)
                        .translationY(0)
                        .build())
                .setDuration(REORDERING_DROP_REPOSITION_DURATION);
        anim.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                onPostReorderingAnimationCompleted();
            }
        });
        anim.start();
    }
}
项目:LaunchEnr    文件:SwipeHelper.java   
private void snapChild(final View animView, final float targetLeft, float velocity) {
    final boolean canBeDismissed = mCallback.canChildBeDismissed(animView);
    AnimatorUpdateListener updateListener = new AnimatorUpdateListener() {
        public void onAnimationUpdate(ValueAnimator animation) {
            onTranslationUpdate(animView, (float) animation.getAnimatedValue(), canBeDismissed);
        }
    };

    Animator anim = getViewTranslationAnimator(animView, targetLeft, updateListener);
    if (anim == null) {
        return;
    }
    int duration = SNAP_ANIM_LEN;
    anim.setDuration(duration);
    anim.addListener(new AnimatorListenerAdapter() {
        public void onAnimationEnd(Animator animator) {
            mSnappingChild = false;
            updateSwipeProgressFromOffset(animView, canBeDismissed);
            mCallback.onChildSnappedBack(animView, targetLeft);
        }
    });
    prepareSnapBackAnimation(animView, anim);
    mSnappingChild = true;
    anim.start();
}
项目:AndroidSkinAnimator    文件:TranslationHideAnimator.java   
@Override
public SkinAnimator apply(@NonNull final View view, @Nullable final Action action) {
    animator = ObjectAnimator.ofPropertyValuesHolder(view,
            PropertyValuesHolder.ofFloat("alpha", 1, 0),
            PropertyValuesHolder.ofFloat("translationX", view.getLeft(), view.getRight()));
    animator.setDuration(3 * PRE_DURATION);
    animator.setInterpolator(new AnticipateInterpolator());
    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            resetView(view);
            if (action != null) {
                action.action();
            }
        }
    });
    return this;
}
项目:LaunchEnr    文件:WidgetsBottomSheet.java   
private void open(boolean animate) {
    if (mIsOpen || mOpenCloseAnimator.isRunning()) {
        return;
    }
    mIsOpen = true;
    setLightNavBar(true);
    if (animate) {
        mOpenCloseAnimator.setValues(new PropertyListBuilder()
                .translationY(mTranslationYOpen).build());
        mOpenCloseAnimator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                mVerticalPullDetector.finishedScrolling();
            }
        });
        mOpenCloseAnimator.setInterpolator(mFastOutSlowInInterpolator);
        mOpenCloseAnimator.start();
    } else {
        setTranslationY(mTranslationYOpen);
    }
}
项目:app_secompufscar    文件:MainActivity.java   
private void fadeOut() {
    contentView.setAlpha(0f);
    contentView.setVisibility(View.VISIBLE);

    contentView.animate()
            .alpha(1f)
            .setDuration(getResources().getInteger(
                    android.R.integer.config_longAnimTime))
            .setListener(null);

    loadingView.animate()
            .alpha(0f)
            .setDuration(getResources().getInteger(
                    android.R.integer.config_longAnimTime))
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    loadingView.setVisibility(View.GONE);
                }
            });
}
项目:Bigbang    文件:ShareCard.java   
public void hide() {
    post(new Runnable() {
        @Override
        public void run() {
            ObjectAnimator objectAnimator = ObjectAnimator.ofInt(ShareCard.this, "height", 0);
            objectAnimator.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    super.onAnimationEnd(animation);
                    setVisibility(GONE);
                    if (mListener != null) {
                        mListener.onClick(ShareCard.this);
                    }
                }
            });
            objectAnimator.setDuration(500);
            objectAnimator.setInterpolator(new AnticipateInterpolator());
            objectAnimator.setRepeatCount(0);
            objectAnimator.start();
        }
    });
}
项目:chromium-for-android-56-debug-video    文件:ToolbarPhone.java   
private ObjectAnimator createExitTabSwitcherAnimation(
        final boolean animateNormalToolbar) {
    ObjectAnimator exitAnimation =
            ObjectAnimator.ofFloat(this, mTabSwitcherModePercentProperty, 0.f);
    exitAnimation.setDuration(animateNormalToolbar
            ? TAB_SWITCHER_MODE_EXIT_NORMAL_ANIMATION_DURATION_MS
            : TAB_SWITCHER_MODE_EXIT_FADE_ANIMATION_DURATION_MS);
    exitAnimation.setInterpolator(new LinearInterpolator());
    exitAnimation.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            updateViewsForTabSwitcherMode();
        }
    });

    return exitAnimation;
}
项目:boohee_v5.6    文件:PullToZoomScrollView.java   
private void reset() {
    if (this.mAnimator == null || !this.mAnimator.isRunning()) {
        this.mAnimator = ObjectAnimator.ofInt(this, "t", new int[]{((int) (-this.distance)) /
                4, 0});
        this.mAnimator.setDuration(150);
        this.mAnimator.addListener(new AnimatorListenerAdapter() {
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                PullToZoomScrollView.this.isPreparePull = false;
                if (PullToZoomScrollView.this.distance / aj.hA > ((float)
                        PullToZoomScrollView.this.DEFAULT_PULL_HEIGHT)) {
                    if (PullToZoomScrollView.this.onPullToZoomListener != null) {
                        PullToZoomScrollView.this.onPullToZoomListener.onPull();
                    }
                } else if (PullToZoomScrollView.this.onPullToZoomListener != null) {
                    PullToZoomScrollView.this.onPullToZoomListener.onCancelPull();
                }
            }
        });
        this.mAnimator.start();
    }
}
项目:LiteReader    文件:RevealUtil.java   
/**
 * Conceal the view from the given centerX and centerY.
 *
 * @param view        the target view.
 * @param duration    animation duration.
 * @param centerX     the pivotX
 * @param centerY     the pivotY
 * @param startRadius the radius of the end of the animation, which is generally the maximum of the view's height and width.
 * @param endRadius   the radius of the beginning of the animation, which is generally zero.
 */
private static void conceal(final View view, final int duration, final int centerX, final int centerY, final float startRadius, final float endRadius) {
    versionCheck(new Runnable() {
        @Override
        public void run() {
            Animator animator = ViewAnimationUtils.createCircularReveal(view, centerX, centerY, startRadius, endRadius);
            animator.setDuration(duration);
            animator.addListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    view.setVisibility(View.GONE);
                }
            });
            animator.start();
        }
    }, REVEAL_WARNING);
}
项目:ChromeLikeTabSwitcher    文件:PhoneTabSwitcherLayout.java   
/**
 * Creates and returns an animation listener, which allows to zoom in the currently selected
 * tab, when a peek animation has been ended.
 *
 * @param selectedItem
 *         The item, which corresponds to the currently selected tab, as an instance of the
 *         class {@link AbstractItem}. The item may not be null
 * @param peekAnimation
 *         The peek animation as an instance of the class {@link PeekAnimation}. The peek
 *         animation may not be null
 * @return The listener, which has been created, as an instance of the type {@link
 * AnimatorListener}. The listener may not be null
 */
@NonNull
private AnimatorListener createZoomOutAnimationListener(
        @NonNull final AbstractItem selectedItem, @NonNull final PeekAnimation peekAnimation) {
    return new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(final Animator animation) {
            super.onAnimationEnd(animation);
            getModel().removeListener(PhoneTabSwitcherLayout.this);
            getModel().hideSwitcher();
            long totalDuration =
                    peekAnimation.getDuration() != -1 ? peekAnimation.getDuration() :
                            peekAnimationDuration;
            long duration = totalDuration / 3;
            Interpolator interpolator =
                    peekAnimation.getInterpolator() != null ? peekAnimation.getInterpolator() :
                            new AccelerateDecelerateInterpolator();
            animateHideSwitcher(selectedItem, duration, interpolator, duration,
                    createZoomInAnimationListener(selectedItem));
        }

    };
}
项目:BookReader-master    文件:ReadEPubActivity.java   
private void toolbarAnimateHide() {
    if (mIsActionBarVisible) {
        mCommonToolbar.animate()
                .translationY(-mCommonToolbar.getHeight())
                .setInterpolator(new LinearInterpolator())
                .setDuration(180)
                .setListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        toolbarSetElevation(0);
                        hideStatusBar();
                        if (mTocListPopupWindow != null && mTocListPopupWindow.isShowing()) {
                            mTocListPopupWindow.dismiss();
                        }
                    }
                });
        mIsActionBarVisible = false;
    }
}
项目:SnakeViewMaker    文件:SnakeViewMaker.java   
private void releaseView() {
    final Interpolator interpolator = new OvershootInterpolator();
    final int duration = 700;
    for (int i = 0; i < mChildCount; i++) {
        final View child_i = mChildren.get(i);
        final int delay = mDragDelay * (mChildCount - 1 - i);
        child_i.postDelayed(new Runnable() {
            @Override
            public void run() {
                child_i.animate()
                        .translationX(mTargetLocation[0])
                        .translationY(mTargetLocation[1])
                        .setDuration(duration)
                        .setInterpolator(interpolator)
                        .start();
            }
        }, delay);
    }
    mChildren.get(0).animate().setListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            // when all animators finish, release the shield view
            mShieldView.setVisibility(View.GONE);
        }
    });
}
项目:pokequest    文件:HomeActivity.java   
@UiThread
private void onLoadPokemonFinish() {
    mBtnPokeDict.setEnabled(true);
    mBtnPokeQuiz.setEnabled(true);
    mTvIntro.postDelayed(() -> mTvIntro.animate()
        .scaleX(1.f)
        .scaleY(1.f)
        .alpha(1.0f)
        .setDuration(500)
        .setListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                super.onAnimationEnd(animation);
                mBtnPokeDict.animate()
                    .alpha(1.0f)
                    .setDuration(1000)
                    .start();
                mBtnPokeQuiz.animate()
                    .alpha(1.0f)
                    .setDuration(1000)
                    .start();
            }
        }).start(), 500);
}
项目:NeoTerm    文件:PhoneTabSwitcherLayout.java   
/**
 * Creates and returns an animation listener, which allows to zoom in the currently selected
 * tab, when a peek animation has been ended.
 *
 * @param selectedTabItem
 *         The tab item, which corresponds to the currently selected tab, as an instance of the
 *         class {@link TabItem}. The tab item may not be null
 * @param peekAnimation
 *         The peek animation as an instance of the class {@link PeekAnimation}. The peek
 *         animation may not be null
 * @return The listener, which has been created, as an instance of the type {@link
 * AnimatorListener}. The listener may not be null
 */
@NonNull
private AnimatorListener createZoomOutAnimationListener(@NonNull final TabItem selectedTabItem,
                                                        @NonNull final PeekAnimation peekAnimation) {
    return new AnimatorListenerAdapter() {

        @Override
        public void onAnimationEnd(final Animator animation) {
            super.onAnimationEnd(animation);
            getModel().removeListener(PhoneTabSwitcherLayout.this);
            getModel().hideSwitcher();
            long totalDuration =
                    peekAnimation.getDuration() != -1 ? peekAnimation.getDuration() :
                            peekAnimationDuration;
            long duration = totalDuration / 3;
            Interpolator interpolator =
                    peekAnimation.getInterpolator() != null ? peekAnimation.getInterpolator() :
                            new AccelerateDecelerateInterpolator();
            animateHideSwitcher(selectedTabItem, duration, interpolator, duration,
                    createZoomInAnimationListener(selectedTabItem));
        }

    };
}
项目:ClassifyView    文件:BagDrawable.java   
public void startMergeAnimation() {
    if(mCancelAnimator != null&&mCancelAnimator.isRunning()){
        mCancelAnimator.cancel();
    }
    if(mStarAnimator == null) {
        mStarAnimator = ObjectAnimator.ofInt(this, mOutlineProperty, 0);
        mStarAnimator.setDuration(mAnimationDuration);
        mStarAnimator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationStart(Animator animation) {
                inMerge = true;
            }
        });
    }else if(mStarAnimator.isRunning()){
        mStarAnimator.cancel();
    }
    mStarAnimator.start();
}
项目:TYT    文件:DynamicGridView.java   
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private ObjectAnimator createBaseWobble(final View v) {

    if (!isPreLollipop())
        v.setLayerType(LAYER_TYPE_SOFTWARE, null);

    ObjectAnimator animator = new ObjectAnimator();
    animator.setDuration(180);
    animator.setRepeatMode(ValueAnimator.REVERSE);
    animator.setRepeatCount(ValueAnimator.INFINITE);
    animator.setPropertyName("rotation");
    animator.setTarget(v);
    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            v.setLayerType(LAYER_TYPE_NONE, null);
        }
    });
    return animator;
}
项目:buildAPKsSamples    文件:InsertingCells.java   
public void addRow(View view) {
    mButton.setEnabled(false);

    mItemNum++;
    ListItemObject obj = mValues[mItemNum % mValues.length];
    final ListItemObject newObj = new ListItemObject(obj.getTitle(), obj.getImgResource(),
            mCellHeight);

    boolean shouldAnimateInNewImage = mListView.shouldAnimateInNewImage();
    if (!shouldAnimateInNewImage) {
        mListView.addRow(newObj);
        return;
    }

    mListView.setEnabled(false);
    ObjectAnimator animator = mRoundView.getScalingAnimator();
    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationRepeat(Animator animation) {
            mListView.addRow(newObj);
        }
    });
    animator.start();
}
项目:AndroidShareElement    文件:ShareElementActivity.java   
@Override
public void onBackPressed() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        finishAfterTransition();
    } else {
        mShareElement.convert(mImageView)
                .setDuration(ANIMATOR_DURATION)
                .setInterpolator(new LinearInterpolator())
                .setListener(new AnimatorListenerAdapter() {
                    @Override
                    public void onAnimationEnd(Animator animation) {
                        finish();
                        overridePendingTransition(0, 0);
                    }
                })
                .startExitAnimator();
    }
}
项目:ArcLayout-master    文件:DemoLikePathActivity.java   
@SuppressWarnings("NewApi")
private void hideMenu() {

  List<Animator> animList = new ArrayList<>();

  for (int i = arcLayout.getChildCount() - 1; i >= 0; i--) {
    animList.add(createHideItemAnimator(arcLayout.getChildAt(i)));
  }

  AnimatorSet animSet = new AnimatorSet();
  animSet.setDuration(400);
  animSet.setInterpolator(new AnticipateInterpolator());
  animSet.playTogether(animList);
  animSet.addListener(new AnimatorListenerAdapter() {
    @Override
    public void onAnimationEnd(Animator animation) {
      super.onAnimationEnd(animation);
      menuLayout.setVisibility(View.INVISIBLE);
    }
  });
  animSet.start();

}
项目:AcademApp    文件:MaterialIn.java   
public static void startAnimators(final View view, int startOffsetX, int startOffsetY, long delay) {
    if (view.getVisibility() == View.VISIBLE && view.getAlpha() != 0f) {
        view.clearAnimation();
        view.animate().cancel();
        final Resources res = view.getResources();
        final float endAlpha = view.getAlpha();
        final float endTranslateX = view.getTranslationX();
        final float endTranslateY = view.getTranslationY();
        view.setAlpha(0);
        final Animator fade = ObjectAnimator.ofFloat(view, View.ALPHA, endAlpha);
        fade.setDuration(res.getInteger(R.integer.material_in_fade_anim_duration));
        fade.setInterpolator(new AccelerateInterpolator());
        fade.setStartDelay(delay);
        fade.start();
        ViewPropertyAnimator slide = view.animate();
        if (startOffsetY != 0) {
            view.setTranslationY(startOffsetY);
            slide.translationY(endTranslateY);
        } else {
            view.setTranslationX(startOffsetX);
            slide.translationX(endTranslateX);
        }
        slide.setInterpolator(new DecelerateInterpolator(2));
        slide.setDuration(res.getInteger(R.integer.material_in_slide_anim_duration));
        slide.setStartDelay(delay);
        slide.setListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationCancel(Animator animation) {
                if (fade.isStarted()) {
                    fade.cancel();
                }
                view.setAlpha(endAlpha);
                view.setTranslationX(endTranslateX);
                view.setTranslationY(endTranslateY);
            }
        });
        slide.start();
    }
}
项目:AndroidSkinAnimator    文件:TranslationAlphaHideAnimator.java   
@Override
public SkinAnimator apply(@NonNull final View view, @Nullable final Action action) {
    int offset = -view.getWidth() / 2;
    animator = ObjectAnimator.ofPropertyValuesHolder(view,
            PropertyValuesHolder.ofFloat("alpha", 1, 0),
            PropertyValuesHolder.ofFloat("translationX", 0, - offset, -offset, offset, offset, 0),
            PropertyValuesHolder.ofFloat("rotation", 0, -30, -30, 30, 30, 0),
            PropertyValuesHolder.ofFloat("translationY", 0, 3 * view.getHeight())
    );
    animator.setDuration(5 * PRE_DURATION);
    animator.setInterpolator(new LinearInterpolator());
    animator.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);
            resetView(view);
            if (action != null) {
                action.action();
            }
        }
    });
    return this;
}
项目:magellan    文件:CircularRevealTransition.java   
@Override
public void animate(
    View from, View to, NavigationType navType, Direction direction, final Callback callback) {
  int[] clickedViewCenter = getCenterClickedView((ViewGroup) from);
  int circularRevealCenterX = clickedViewCenter[0];
  int circularRevealCenterY = clickedViewCenter[1];
  float finalRadius = (float) Math.hypot(to.getWidth(), to.getHeight());

  if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
    Animator anim =
        ViewAnimationUtils.createCircularReveal(to, circularRevealCenterX,
            circularRevealCenterY, 0, finalRadius);
    anim.addListener(new AnimatorListenerAdapter() {
      @Override
      public void onAnimationEnd(Animator animation) {
        callback.onAnimationEnd();
      }
    });
    anim.start();
  } else {
    callback.onAnimationEnd();
  }
}
项目:InstaFlickr    文件:FeedContextMenuManager.java   
private void performDismissAnimation() {
    contextMenuView.setPivotX(contextMenuView.getWidth() / 2);
    contextMenuView.setPivotY(contextMenuView.getHeight());
    contextMenuView.animate()
            .scaleX(0.1f).scaleY(0.1f)
            .setDuration(150)
            .setInterpolator(new AccelerateInterpolator())
            .setStartDelay(100)
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    if (contextMenuView != null) {
                        contextMenuView.dismiss();
                    }
                    isContextMenuDismissing = false;
                }
            });
}
项目:DataBindingDemos    文件:DatabindingUtils.java   
@BindingAdapter({"android:visibility"})
public static void visibility(final View view, final int newVisibility) {

    final boolean makeVisible = newVisibility == View.VISIBLE;

    if (makeVisible) {
        view.setVisibility(newVisibility);
    }

    view.animate()
            .alpha(makeVisible ? 1.0f : 0.0f)
            .setDuration(500)
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    super.onAnimationEnd(animation);
                    if (!makeVisible) {
                        view.setVisibility(newVisibility);
                    }
                }
            });
}
项目:utils-android    文件:AnimUtils.java   
/**
 * Анимация прозрачного перехода между двумя view
 *
 * @param inView   view, которая будет показана после завершения анимации
 * @param outView  view, которая будет исчезать
 * @param duration длительность анимации
 */
public static void crossfade(final View inView, final View outView, final long duration) {
    inView.setAlpha(0f);
    inView.setVisibility(View.VISIBLE);

    inView.animate().alpha(1f).setDuration(duration).setListener(null);

    outView.animate()
            .alpha(0f)
            .setDuration(duration)
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    outView.setVisibility(View.GONE);
                }
            });
}
项目:chromium-for-android-56-debug-video    文件:FindResultBar.java   
/** Dismisses this results bar by removing it from the view hierarchy. */
public void dismiss() {
    mDismissing = true;
    mFindInPageBridge = null;
    if (mVisibilityAnimation != null && mVisibilityAnimation.isRunning()) {
        mVisibilityAnimation.cancel();
    }

    mVisibilityAnimation = ObjectAnimator.ofFloat(this, TRANSLATION_X,
            MathUtils.flipSignIf(mBarTouchWidth, LocalizationUtils.isLayoutRtl()));
    mVisibilityAnimation.setDuration(VISIBILITY_ANIMATION_DURATION_MS);
    mVisibilityAnimation.setInterpolator(BakedBezierInterpolator.FADE_OUT_CURVE);
    mTab.getWindowAndroid().startAnimationOverContent(mVisibilityAnimation);
    mVisibilityAnimation.addListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            super.onAnimationEnd(animation);

            if (getParent() != null) ((ViewGroup) getParent()).removeView(FindResultBar.this);
        }
    });
}
项目:Material-Motion    文件:PlayerFragment.java   
private void runIconScale(int delay, @DrawableRes int drawable, int color){
    soundPlay.animate()
            .scaleY(0)
            .scaleX(0)
            .setDuration(duration(R.integer.short_delay))
            .setStartDelay(delay)
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    super.onAnimationEnd(animation);
                    trackTitle.setTextColor(color);
                    soundPlay.setImageDrawable(ContextCompat.getDrawable(getContext(),drawable));
                    soundPlay.animate()
                            .scaleX(1)
                            .scaleY(1)
                            .setDuration(duration(R.integer.scale_duration))
                            .setListener(null).start();
                }
            }).start();
}