当前位置: 首页>>代码示例>>Java>>正文


Java Animator类代码示例

本文整理汇总了Java中com.nineoldandroids.animation.Animator的典型用法代码示例。如果您正苦于以下问题:Java Animator类的具体用法?Java Animator怎么用?Java Animator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Animator类属于com.nineoldandroids.animation包,在下文中一共展示了Animator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: display

import com.nineoldandroids.animation.Animator; //导入依赖的package包/类
private void display(@Nullable final View view) {
  final int sourceWidth = current == downloadDetails ? expandedWidth : contractedWidth;
  final int targetWidth = view    == downloadDetails ? expandedWidth : contractedWidth;

  if (current == view || current == null) {
    ViewGroup.LayoutParams layoutParams = getLayoutParams();
    layoutParams.width = targetWidth;
    setLayoutParams(layoutParams);
  } else {
    ViewUtil.fadeOut(current, TRANSITION_MS);
    Animator anim = getWidthAnimator(sourceWidth, targetWidth);
    anim.start();
  }

  if (view == null) {
    ViewUtil.fadeOut(this, TRANSITION_MS);
  } else {
    ViewUtil.fadeIn(this, TRANSITION_MS);
    ViewUtil.fadeIn(view, TRANSITION_MS);
  }

  current = view;
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:24,代码来源:TransferControlView.java

示例2: cancel

import com.nineoldandroids.animation.Animator; //导入依赖的package包/类
@Override
public void cancel() {
    if (mAnimatorMap.size() > 0) {
        HashMap<Animator, PropertyBundle> mAnimatorMapCopy =
                (HashMap<Animator, PropertyBundle>)mAnimatorMap.clone();
        Set<Animator> animatorSet = mAnimatorMapCopy.keySet();
        for (Animator runningAnim : animatorSet) {
            runningAnim.cancel();
        }
    }
    mPendingAnimations.clear();
    View v = mView.get();
    if (v != null) {
        v.removeCallbacks(mAnimationStarter);
    }
}
 
开发者ID:junchenChow,项目名称:exciting-app,代码行数:17,代码来源:ViewPropertyAnimatorHC.java

示例3: animatePropertyBy

import com.nineoldandroids.animation.Animator; //导入依赖的package包/类
private void animatePropertyBy(int constantName, float startValue, float byValue) {
    if (this.mAnimatorMap.size() > 0) {
        Animator animatorToCancel = null;
        for (Animator runningAnim : this.mAnimatorMap.keySet()) {
            PropertyBundle bundle = (PropertyBundle) this.mAnimatorMap.get(runningAnim);
            if (bundle.cancel(constantName) && bundle.mPropertyMask == 0) {
                animatorToCancel = runningAnim;
                break;
            }
        }
        if (animatorToCancel != null) {
            animatorToCancel.cancel();
        }
    }
    this.mPendingAnimations.add(new NameValuesHolder(constantName, startValue, byValue));
    View v = (View) this.mView.get();
    if (v != null) {
        v.removeCallbacks(this.mAnimationStarter);
        v.post(this.mAnimationStarter);
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:22,代码来源:ViewPropertyAnimatorHC.java

示例4: acceptConfirmationIn

import com.nineoldandroids.animation.Animator; //导入依赖的package包/类
private void acceptConfirmationIn( View v ) {
    if( !this.opem ) return;
    this.callback( this.confirmationInCallback );
    YoYo.with( Techniques.ZoomOut )
            .duration( 400 )
            .playOn( this.ivExamConfirmationInReject );

    YoYo.with( Techniques.ZoomIn )
            .duration( 400 )
            .withListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationStart(Animator animation) {
                    super.onAnimationStart(animation);
                    ivExamConfirmationInAccept.setImageResource( R.drawable.ic_sentiment_satisfied_green_500_18dp );
                }
            })
            .playOn( this.ivExamConfirmationInAccept )
            ;

    //Remover o evento
    this.ivExamConfirmationInReject.setOnClickListener( null );
    this.ivExamConfirmationInAccept.setOnClickListener( null );
}
 
开发者ID:tec-ustp,项目名称:SIIEScanner,代码行数:24,代码来源:ItemReaderContentExamConfirmationPresence.java

示例5: acceptConfirmationOut

import com.nineoldandroids.animation.Animator; //导入依赖的package包/类
private void acceptConfirmationOut( View v ) {
    if( !this.opem ) return;
    this.callback( this.confirmationOutCallback );
    YoYo.with( Techniques.ZoomOut )
            .duration( 400 )
            .playOn( this.ivExamConfirmationOutReject );

    YoYo.with( Techniques.ZoomIn )
            .duration( 400 )
            .withListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationStart(Animator animation) {
                    super.onAnimationStart(animation);
                    ivExamConfirmationOutAccept.setImageResource( R.drawable.ic_sentiment_very_dissatisfied_red_500_18dp );
                }
            })
            .playOn( this.ivExamConfirmationOutAccept )
    ;

    //Remover o evento
    this.ivExamConfirmationOutReject.setOnClickListener( null );
    this.ivExamConfirmationOutAccept.setOnClickListener( null );
}
 
开发者ID:tec-ustp,项目名称:SIIEScanner,代码行数:24,代码来源:ItemReaderContentExamConfirmationPresence.java

示例6: fillOpenClosingAnimations

import com.nineoldandroids.animation.Animator; //导入依赖的package包/类
/**
 * Filling arrays of animations to build Set of Closing / Opening animations
 */
private void fillOpenClosingAnimations(boolean isCloseAnimation, List<Animator> textAnimations, List<Animator> imageAnimations, int wrapperPosition) {
    AnimatorSet textAnimatorSet = new AnimatorSet();
    Animator textAppearance = isCloseAnimation ?
            AnimatorUtils.alfaDisappear(mTextWrapper.getChildAt(wrapperPosition))
            : AnimatorUtils.alfaAppear(mTextWrapper.getChildAt(wrapperPosition));

    Animator textTranslation = isCloseAnimation ?
            AnimatorUtils.translationRight(mTextWrapper.getChildAt(wrapperPosition), mContext.getResources().getDimension(R.dimen.text_right_translation))
            : AnimatorUtils.translationLeft(mTextWrapper.getChildAt(wrapperPosition), mContext.getResources().getDimension(R.dimen.text_right_translation));

    textAnimatorSet.playTogether(textAppearance, textTranslation);
    textAnimations.add(textAnimatorSet);

    Animator imageRotation = isCloseAnimation ?
            wrapperPosition == 0 ? AnimatorUtils.rotationCloseToRight(mMenuWrapper.getChildAt(wrapperPosition)) : AnimatorUtils.rotationCloseVertical(mMenuWrapper.getChildAt(wrapperPosition))
            : wrapperPosition == 0 ? AnimatorUtils.rotationOpenFromRight(mMenuWrapper.getChildAt(wrapperPosition)) : AnimatorUtils.rotationOpenVertical(mMenuWrapper.getChildAt(wrapperPosition));
    imageAnimations.add(imageRotation);
}
 
开发者ID:zongkaili,项目名称:MenuSet,代码行数:22,代码来源:MenuAdapter.java

示例7: getWidthAnimator

import com.nineoldandroids.animation.Animator; //导入依赖的package包/类
private Animator getWidthAnimator(final int from, final int to) {
  final ValueAnimator anim = ValueAnimator.ofInt(from, to);
  anim.addUpdateListener(new AnimatorUpdateListener() {
    @Override
    public void onAnimationUpdate(ValueAnimator animation) {
      final int val = (Integer)animation.getAnimatedValue();
      final ViewGroup.LayoutParams layoutParams = getLayoutParams();
      layoutParams.width = val;
      setLayoutParams(layoutParams);
    }
  });
  anim.setInterpolator(new FastOutSlowInInterpolator());
  anim.setDuration(TRANSITION_MS);
  return anim;
}
 
开发者ID:XecureIT,项目名称:PeSanKita-android,代码行数:16,代码来源:TransferControlView.java

示例8: generateDismissAnimate

import com.nineoldandroids.animation.Animator; //导入依赖的package包/类
/**
 * Create dismiss animation
 *
 * @param view      affected view
 * @param swap      If will change state. If is "false" returns to the original position
 * @param swapRight If swap is true, this parameter tells if move is to the right or left
 * @param position  Position of list
 */
private void generateDismissAnimate(final View view, final boolean swap, final boolean swapRight, final int position) {
    int moveTo = 0;
    if (opened.get(position)) {
        if (!swap) {
            moveTo = openedRight.get(position) ? (int) (viewWidth - rightOffset) : (int) (-viewWidth + leftOffset);
        }
    } else {
        if (swap) {
            moveTo = swapRight ? (int) (viewWidth - rightOffset) : (int) (-viewWidth + leftOffset);
        }
    }

    int alpha = 1;
    if (swap) {
        ++dismissAnimationRefCount;
        alpha = 0;
    }

    animate(view)
            .translationX(moveTo)
            .alpha(alpha)
            .setDuration(animationTime)
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    if (swap) {
                        closeOpenedItems();
                        performDismiss(view, position, true);
                    }
                    resetCell();
                }
            });

}
 
开发者ID:NewCasino,项目名称:browser,代码行数:43,代码来源:SwipeListViewTouchListener.java

示例9: generateRevealAnimate

import com.nineoldandroids.animation.Animator; //导入依赖的package包/类
/**
 * Create reveal animation
 *
 * @param view      affected view
 * @param swap      If will change state. If "false" returns to the original position
 * @param swapRight If swap is true, this parameter tells if movement is toward right or left
 * @param position  list position
 */
private void generateRevealAnimate(final View view, final boolean swap, final boolean swapRight, final int position) {
    int moveTo = 0;
    if (opened.get(position)) {
        if (!swap) {
            moveTo = openedRight.get(position) ? (int) (viewWidth - rightOffset) : (int) (-viewWidth + leftOffset);
        }
    } else {
        if (swap) {
            moveTo = swapRight ? (int) (viewWidth - rightOffset) : (int) (-viewWidth + leftOffset);
        }
    }

    animate(view)
            .translationX(moveTo)
            .setDuration(animationTime)
            .setListener(new AnimatorListenerAdapter() {
                @Override
                public void onAnimationEnd(Animator animation) {
                    swipeListView.resetScrolling();
                    if (swap) {
                        boolean aux = !opened.get(position);
                        opened.set(position, aux);
                        if (aux) {
                            swipeListView.onOpened(position, swapRight);
                            openedRight.set(position, swapRight);
                        } else {
                            swipeListView.onClosed(position, openedRight.get(position));
                        }
                    }
                    resetCell();
                }
            });
}
 
开发者ID:NewCasino,项目名称:browser,代码行数:42,代码来源:SwipeListViewTouchListener.java

示例10: performDismiss

import com.nineoldandroids.animation.Animator; //导入依赖的package包/类
/**
 * Perform dismiss action
 *
 * @param dismissView     View
 * @param dismissPosition Position of list
 */
protected void performDismiss(final View dismissView, final int dismissPosition, boolean doPendingDismiss) {
    final ViewGroup.LayoutParams lp = dismissView.getLayoutParams();
    final int originalHeight = dismissView.getHeight();

    ValueAnimator animator = ValueAnimator.ofInt(originalHeight, 1).setDuration(animationTime);

    if (doPendingDismiss) {
        animator.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                --dismissAnimationRefCount;
                if (dismissAnimationRefCount == 0) {
                    removePendingDismisses(originalHeight);
                }
            }
        });
    }

    animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
        @Override
        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            lp.height = (Integer) valueAnimator.getAnimatedValue();
            dismissView.setLayoutParams(lp);
        }
    });

    pendingDismisses.add(new PendingDismissData(dismissPosition, dismissView));
    animator.start();
}
 
开发者ID:NewCasino,项目名称:browser,代码行数:36,代码来源:SwipeListViewTouchListener.java

示例11: getRevealFinishListener

import com.nineoldandroids.animation.Animator; //导入依赖的package包/类
private static Animator.AnimatorListener getRevealFinishListener(RevealAnimator target) {
    if (SDK_INT >= 18) {
        return new RevealAnimator.RevealFinishedJellyBeanMr2(target);
    } else if (SDK_INT >= 14) {
        return new RevealAnimator.RevealFinishedIceCreamSandwich(target);
    } else {
        return new RevealAnimator.RevealFinishedGingerbread(target);
    }
}
 
开发者ID:SimonCherryGZ,项目名称:JewelryUI,代码行数:10,代码来源:ViewAnimationUtils.java

示例12: onAnimationEnd

import com.nineoldandroids.animation.Animator; //导入依赖的package包/类
@Override
public void onAnimationEnd(Animator animation) {
    toggleIsAnimationRun();
    if (mOnItemLongClickListenerCalled != null) {
        mOnItemLongClickListenerCalled.onLongClick(mClickedView);
    } else if (mOnItemClickListenerCalled != null) {
        mOnItemClickListenerCalled.onClick(mClickedView);
    }
}
 
开发者ID:zongkaili,项目名称:MenuSet,代码行数:10,代码来源:MenuAdapter.java

示例13: setDuration

import com.nineoldandroids.animation.Animator; //导入依赖的package包/类
@Override
public void setDuration(int duration) {
    Animator a = mAnimator.get();
    if (a != null) {
        a.setDuration(duration);
    }
}
 
开发者ID:SimonCherryGZ,项目名称:JewelryUI,代码行数:8,代码来源:SupportAnimatorPreL.java

示例14: setInterpolator

import com.nineoldandroids.animation.Animator; //导入依赖的package包/类
@Override
public void setInterpolator(Interpolator value) {
    Animator a = mAnimator.get();
    if (a != null) {
        a.setInterpolator(value);
    }
}
 
开发者ID:SimonCherryGZ,项目名称:JewelryUI,代码行数:8,代码来源:SupportAnimatorPreL.java

示例15: cancel

import com.nineoldandroids.animation.Animator; //导入依赖的package包/类
@Override
public void cancel() {
    Animator a = mAnimator.get();
    if (a != null) {
        a.cancel();
    }
}
 
开发者ID:SimonCherryGZ,项目名称:JewelryUI,代码行数:8,代码来源:SupportAnimatorPreL.java


注:本文中的com.nineoldandroids.animation.Animator类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。