本文整理汇总了Java中com.nineoldandroids.animation.AnimatorSet.addListener方法的典型用法代码示例。如果您正苦于以下问题:Java AnimatorSet.addListener方法的具体用法?Java AnimatorSet.addListener怎么用?Java AnimatorSet.addListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.nineoldandroids.animation.AnimatorSet
的用法示例。
在下文中一共展示了AnimatorSet.addListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: undo
import com.nineoldandroids.animation.AnimatorSet; //导入方法依赖的package包/类
/**
* Performs the undo animation and restores the original state for given {@link android.view.View}.
*
* @param view the parent {@code View} which contains both primary and undo {@code View}s.
*/
public void undo(@NonNull final View view) {
int position = AdapterViewUtil.getPositionForView(getListViewWrapper(), view);
mUndoPositions.remove(position);
View primaryView = mCallback.getPrimaryView(view);
View undoView = mCallback.getUndoView(view);
primaryView.setVisibility(View.VISIBLE);
ObjectAnimator undoAlphaAnimator = ObjectAnimator.ofFloat(undoView, ALPHA, 1f, 0f);
ObjectAnimator primaryAlphaAnimator = ObjectAnimator.ofFloat(primaryView, ALPHA, 0f, 1f);
ObjectAnimator primaryXAnimator = ObjectAnimator.ofFloat(primaryView, TRANSLATION_X, primaryView.getWidth(), 0f);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(undoAlphaAnimator, primaryAlphaAnimator, primaryXAnimator);
animatorSet.addListener(new UndoAnimatorListener(undoView));
animatorSet.start();
mCallback.onUndo(view, position);
}
示例2: flingView
import com.nineoldandroids.animation.AnimatorSet; //导入方法依赖的package包/类
/**
* Flings given {@link android.view.View} out of sight.
*
* @param view the parent {@link android.view.View}.
* @param position the position of the item in the {@link android.widget.ListAdapter} corresponding to the {@code View}.
* @param flingToRight {@code true} if the {@code View} should be flinged to the right, {@code false} if it should be flinged to the left.
*/
private void flingView(@NonNull final View view, final int position, final boolean flingToRight) {
if (mViewWidth < 2) {
mViewWidth = mListViewWrapper.getListView().getWidth();
}
View swipeView = getSwipeView(view);
ObjectAnimator xAnimator = ObjectAnimator.ofFloat(swipeView, TRANSLATION_X, flingToRight ? mViewWidth : -mViewWidth);
ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(swipeView, ALPHA, 0);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(xAnimator, alphaAnimator);
animatorSet.setDuration(mAnimationTime);
animatorSet.addListener(new FlingAnimatorListener(view, position));
animatorSet.start();
}
示例3: startBlurImageAppearAnimator
import com.nineoldandroids.animation.AnimatorSet; //导入方法依赖的package包/类
private void startBlurImageAppearAnimator(){
if(!enableBlurBackground || mBlurImage == null) return;
AnimatorSet set = new AnimatorSet();
if(enableBackgroundZoom){
set.playTogether(
ObjectAnimator.ofFloat(mBlurImage, "alpha", 0.8f, 1f),
ObjectAnimator.ofFloat(mBlurImage, "scaleX", 1f, mZoomRatio),
ObjectAnimator.ofFloat(mBlurImage, "scaleY", 1f, mZoomRatio)
);
}
else{
set.playTogether(
ObjectAnimator.ofFloat(mBlurImage, "alpha", 0f, 1f)
);
}
set.addListener(mGlobalListener);
set.addListener(mGlobalAppearingAnimators);
set.setDuration(mBlurDuration);
set.start();
}
示例4: startBlurImageDisappearAnimator
import com.nineoldandroids.animation.AnimatorSet; //导入方法依赖的package包/类
private void startBlurImageDisappearAnimator(){
if(!enableBlurBackground || mBlurImage == null) return;
AnimatorSet set = new AnimatorSet();
if(enableBackgroundZoom)
set.playTogether(
ObjectAnimator.ofFloat(mBlurImage, "alpha", 1f, 0.8f),
ObjectAnimator.ofFloat(mBlurImage, "scaleX", mZoomRatio, 1f),
ObjectAnimator.ofFloat(mBlurImage, "scaleY", mZoomRatio, 1f)
);
else
set.playTogether(
ObjectAnimator.ofFloat(mBlurImage, "alpha", 1f, 0f)
);
set.addListener(mGlobalListener);
set.addListener(mGlobalDisappearAnimators);
set.setDuration(mBlurDuration);
set.start();
}
示例5: freeFall
import com.nineoldandroids.animation.AnimatorSet; //导入方法依赖的package包/类
/**
* 下落
*/
public void freeFall() {
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(this, "translationY", 0, mDistance);
ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(this, "scaleX", 1f, 0.7f);
objectAnimator.setDuration(ANIMATION_DURATION);
scaleYAnimator.setDuration(ANIMATION_DURATION);
scaleYAnimator.setInterpolator(new AccelerateInterpolator(mFactor));
objectAnimator.setInterpolator(new AccelerateInterpolator(mFactor));
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.setDuration(ANIMATION_DURATION);
animatorSet.playTogether(objectAnimator, scaleYAnimator);
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
pressView();
}
});
animatorSet.start();
}
示例6: dragCard
import com.nineoldandroids.animation.AnimatorSet; //导入方法依赖的package包/类
/**
* @param direction 方向
*/
public void dragCard(int direction) {
if (mIndex > baseGragAdapter.getCount()) {
return;
}
if (!animt_finish)
return;
animt_finish = false;
AnimatorSet animatorSet = baseLayoutManager.animForward(direction, mScale, card_margin, mAlpha, getTopView(), viewCollection);
animatorSet.start();
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
animt_finish = true;
mIndex++;
moveToBack();
}
});
if (cardListener != null)
cardListener.startSwip(mIndex);
}
示例7: upThrow
import com.nineoldandroids.animation.AnimatorSet; //导入方法依赖的package包/类
/**
* 上抛
*/
public void upThrow() {
ObjectAnimator objectAnimator = ObjectAnimator.ofFloat(this, "translationY", mDistance, 0);
ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(this, "scaleX", 0.7f, 1f);
objectAnimator.setDuration(ANIMATION_DURATION);
scaleYAnimator.setDuration(ANIMATION_DURATION);
scaleYAnimator.setInterpolator(new DecelerateInterpolator(mFactor));
objectAnimator.setInterpolator(new DecelerateInterpolator(mFactor));
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.setDuration(ANIMATION_DURATION);
animatorSet.playTogether(objectAnimator, scaleYAnimator);
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
freeFall();
}
});
animatorSet.start();
}
示例8: setOpenCloseAnimation
import com.nineoldandroids.animation.AnimatorSet; //导入方法依赖的package包/类
/**
* Creates Open / Close AnimatorSet
*/
private AnimatorSet setOpenCloseAnimation(boolean isCloseAnimation) {
List<Animator> textAnimations = new ArrayList<>();
List<Animator> imageAnimations = new ArrayList<>();
if (isCloseAnimation) {
for (int i = getItemCount() - 1; i >= 0; i--) {
fillOpenClosingAnimations(true, textAnimations, imageAnimations, i);
}
} else {
for (int i = 0; i < getItemCount(); i++) {
fillOpenClosingAnimations(false, textAnimations, imageAnimations, i);
}
}
AnimatorSet textCloseAnimatorSet = new AnimatorSet();
textCloseAnimatorSet.playSequentially(textAnimations);
AnimatorSet imageCloseAnimatorSet = new AnimatorSet();
imageCloseAnimatorSet.playSequentially(imageAnimations);
AnimatorSet animatorFullSet = new AnimatorSet();
animatorFullSet.playTogether(imageCloseAnimatorSet, textCloseAnimatorSet);
animatorFullSet.setDuration(mAnimationDurationMilis);
animatorFullSet.addListener(mCloseOpenAnimatorListener);
animatorFullSet.setStartDelay(0);
animatorFullSet.setInterpolator(new HesitateInterpolator());
return animatorFullSet;
}
示例9: nextAnimation
import com.nineoldandroids.animation.AnimatorSet; //导入方法依赖的package包/类
private void nextAnimation() {
AnimatorSet anim = new AnimatorSet();
if (scale) {
anim.playTogether(ObjectAnimator.ofFloat(this, "scaleX", 1.5f, 1f),
ObjectAnimator.ofFloat(this, "scaleY", 1.5f, 1f));
} else {
anim.playTogether(ObjectAnimator.ofFloat(this, "scaleX", 1, 1.5f),
ObjectAnimator.ofFloat(this, "scaleY", 1, 1.5f));
}
anim.setDuration(10987);
anim.addListener(this);
anim.start();
scale = !scale;
}
示例10: restoreCurrentViewTranslation
import com.nineoldandroids.animation.AnimatorSet; //导入方法依赖的package包/类
/**
* Animates the pending {@link android.view.View} back to its original position.
*/
private void restoreCurrentViewTranslation() {
if (mCurrentView == null) {
return;
}
ObjectAnimator xAnimator = ObjectAnimator.ofFloat(mSwipingView, TRANSLATION_X, 0);
ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(mSwipingView, ALPHA, 1);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(xAnimator, alphaAnimator);
animatorSet.setDuration(mAnimationTime);
animatorSet.addListener(new RestoreAnimatorListener(mCurrentView, mCurrentPosition));
animatorSet.start();
}
示例11: getView
import com.nineoldandroids.animation.AnimatorSet; //导入方法依赖的package包/类
@Override
@NonNull
public View getView(final int position, @Nullable final View convertView, @NonNull final ViewGroup parent) {
final View view = super.getView(position, convertView, parent);
if (mInsertQueue.getActiveIndexes().contains(position)) {
int widthMeasureSpec = View.MeasureSpec.makeMeasureSpec(ViewGroup.LayoutParams.MATCH_PARENT, View.MeasureSpec.AT_MOST);
int heightMeasureSpec = View.MeasureSpec.makeMeasureSpec(ViewGroup.LayoutParams.WRAP_CONTENT, View.MeasureSpec.UNSPECIFIED);
view.measure(widthMeasureSpec, heightMeasureSpec);
int originalHeight = view.getMeasuredHeight();
ValueAnimator heightAnimator = ValueAnimator.ofInt(1, originalHeight);
heightAnimator.addUpdateListener(new HeightUpdater(view));
Animator[] customAnimators = getAdditionalAnimators(view, parent);
Animator[] animators = new Animator[customAnimators.length + 1];
animators[0] = heightAnimator;
System.arraycopy(customAnimators, 0, animators, 1, customAnimators.length);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(animators);
ViewHelper.setAlpha(view, 0);
ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(view, ALPHA, 0, 1);
AnimatorSet allAnimatorsSet = new AnimatorSet();
allAnimatorsSet.playSequentially(animatorSet, alphaAnimator);
allAnimatorsSet.setDuration(mInsertionAnimationDurationMs);
allAnimatorsSet.addListener(new ExpandAnimationListener(position));
allAnimatorsSet.start();
}
return view;
}
示例12: animateDismiss
import com.nineoldandroids.animation.AnimatorSet; //导入方法依赖的package包/类
/**
* Animate dismissal of the items at given positions.
*/
public void animateDismiss(final Collection<Integer> positions) {
final List<Integer> positionsCopy = new ArrayList<Integer>(positions);
if (getAbsListView() == null) {
throw new IllegalStateException("Call setAbsListView() on this AnimateDismissAdapter before calling setAdapter()!");
}
List<View> views = getVisibleViewsForPositions(positionsCopy);
if (!views.isEmpty()) {
List<Animator> animators = new ArrayList<Animator>();
for (final View view : views) {
animators.add(createAnimatorForView(view));
}
AnimatorSet animatorSet = new AnimatorSet();
Animator[] animatorsArray = new Animator[animators.size()];
for (int i = 0; i < animatorsArray.length; i++) {
animatorsArray[i] = animators.get(i);
}
animatorSet.playTogether(animatorsArray);
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(final Animator animator) {
invokeCallback(positionsCopy);
}
});
animatorSet.start();
} else {
invokeCallback(positionsCopy);
}
}
示例13: openMenu
import com.nineoldandroids.animation.AnimatorSet; //导入方法依赖的package包/类
/**
* Show the menu;
*/
public void openMenu(int direction) {
setScaleDirection(direction);
isOpened = true;
AnimatorSet scaleDown_activity = buildScaleDownAnimation(viewActivity, mScaleValue, mScaleValue);
AnimatorSet scaleDown_shadow = buildScaleDownAnimation(imageViewShadow,
mScaleValue + shadowAdjustScaleX, mScaleValue + shadowAdjustScaleY);
AnimatorSet alpha_menu = buildMenuAnimation(scrollViewMenu, 1.0f);
scaleDown_shadow.addListener(animationListener);
scaleDown_activity.playTogether(scaleDown_shadow);
scaleDown_activity.playTogether(alpha_menu);
scaleDown_activity.start();
}
示例14: closeMenu
import com.nineoldandroids.animation.AnimatorSet; //导入方法依赖的package包/类
/**
* Close the menu;
*/
public void closeMenu() {
isOpened = false;
AnimatorSet scaleUp_activity = buildScaleUpAnimation(viewActivity, 1.0f, 1.0f);
AnimatorSet scaleUp_shadow = buildScaleUpAnimation(imageViewShadow, 1.0f, 1.0f);
AnimatorSet alpha_menu = buildMenuAnimation(scrollViewMenu, 0.0f);
scaleUp_activity.addListener(animationListener);
scaleUp_activity.playTogether(scaleUp_shadow);
scaleUp_activity.playTogether(alpha_menu);
scaleUp_activity.start();
}
示例15: remove
import com.nineoldandroids.animation.AnimatorSet; //导入方法依赖的package包/类
public void remove() {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) getLayoutParams();
setX(params.leftMargin);
setY(params.topMargin);
params.leftMargin = 0;
params.topMargin = 0;
setLayoutParams(params);
}
if (mToolTip.getAnimationType() == ToolTip.AnimationType.NONE) {
if (getParent() != null) {
((ViewManager) getParent()).removeView(this);
}
} else {
Collection<Animator> animators = new ArrayList<Animator>(5);
if (mToolTip.getAnimationType() == ToolTip.AnimationType.FROM_MASTER_VIEW) {
animators.add(ObjectAnimator.ofInt(this, TRANSLATION_Y_COMPAT, (int) getY(), mRelativeMasterViewY + mView.getHeight() / 2 - getHeight() / 2));
animators.add(ObjectAnimator.ofInt(this, TRANSLATION_X_COMPAT, (int) getX(), mRelativeMasterViewX + mView.getWidth() / 2 - mWidth / 2));
} else {
animators.add(ObjectAnimator.ofFloat(this, TRANSLATION_Y_COMPAT, getY(), 0));
}
animators.add(ObjectAnimator.ofFloat(this, SCALE_X_COMPAT, 1, 0));
animators.add(ObjectAnimator.ofFloat(this, SCALE_Y_COMPAT, 1, 0));
animators.add(ObjectAnimator.ofFloat(this, ALPHA_COMPAT, 1, 0));
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.playTogether(animators);
animatorSet.addListener(new DisappearanceAnimatorListener());
animatorSet.start();
}
}