當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。