android.view.animation.Animation.getStartOffset()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(9.6k)|赞(0)|评价(0)|浏览(128)

本文整理了Java中android.view.animation.Animation.getStartOffset()方法的一些代码示例,展示了Animation.getStartOffset()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Animation.getStartOffset()方法的具体详情如下:
包路径:android.view.animation.Animation
类名称:Animation
方法名:getStartOffset

Animation.getStartOffset介绍

暂无

代码示例

代码示例来源:origin: square/assertj-android

public S hasStartOffset(long offset) {
 isNotNull();
 long actualOffset = actual.getStartOffset();
 assertThat(actualOffset) //
   .overridingErrorMessage("Expected start offset <%s> but was <%s>.", offset, actualOffset) //
   .isEqualTo(offset);
 return myself;
}

代码示例来源:origin: rey5137/material

private void animateOut(){
  ActionMenuView menuView = getMenuView();
  int count = menuView == null ? 0 : menuView.getChildCount();
  Animation slowestAnimation = null;
  mAnimations.clear();
  mAnimations.ensureCapacity(count);
  for(int i = 0; i < count; i++){
    View child = menuView.getChildAt(i);
    Animation anim = mAnimator.getOutAnimation(child, i);
    mAnimations.add(anim);
    if(anim != null)
      if(slowestAnimation == null || slowestAnimation.getStartOffset() + slowestAnimation.getDuration() < anim.getStartOffset() + anim.getDuration())
        slowestAnimation = anim;
  }
  if(slowestAnimation == null)
    mOutAnimationEndListener.onAnimationEnd(null);
  else {
    slowestAnimation.setAnimationListener(mOutAnimationEndListener);
    for(int i = 0; i < count; i++){
      Animation anim = mAnimations.get(i);
      if(anim != null)
        menuView.getChildAt(i).startAnimation(anim);
    }
  }
  mAnimations.clear();
}

代码示例来源:origin: robolectric/robolectric

private void start() {
 startTime = animation.getStartTime();
 startOffset = animation.getStartOffset();
 Choreographer choreographer = ShadowChoreographer.getInstance();
 if (animationRunner != null) {
  choreographer.removeCallbacks(Choreographer.CALLBACK_ANIMATION, animationRunner, null);
 }
 animationRunner = this;
 int startDelay;
 if (startTime == Animation.START_ON_FIRST_FRAME) {
  startDelay = (int) startOffset;
 } else {
  startDelay = (int) ((startTime + startOffset) - SystemClock.uptimeMillis());
 }
 choreographer.postCallbackDelayed(Choreographer.CALLBACK_ANIMATION, this, null, startDelay);
}

代码示例来源:origin: robolectric/robolectric

@Override
 public void run() {
  // Abort if start time has been messed with, as this simulation is only designed to handle
  // standard situations.
  if ((animation.getStartTime() == startTime && animation.getStartOffset() == startOffset) &&
    animation.getTransformation(startTime == Animation.START_ON_FIRST_FRAME ?
      SystemClock.uptimeMillis() : (startTime + startOffset + elapsedTime), new Transformation()) &&
      // We can't handle infinitely repeating animations in the current scheduling model,
      // so abort after one iteration.
      !(animation.getRepeatCount() == Animation.INFINITE && elapsedTime >= animation.getDuration())) {
   // Update startTime if it had a value of Animation.START_ON_FIRST_FRAME
   startTime = animation.getStartTime();
   elapsedTime += ShadowChoreographer.getFrameInterval() / TimeUtils.NANOS_PER_MS;
   ShadowChoreographer.getInstance().postCallback(Choreographer.CALLBACK_ANIMATION, this, null);
  } else {
   animationRunner = null;
  }
 }
}

代码示例来源:origin: com.squareup.assertj/assertj-android

public S hasStartOffset(long offset) {
 isNotNull();
 long actualOffset = actual.getStartOffset();
 assertThat(actualOffset) //
   .overridingErrorMessage("Expected start offset <%s> but was <%s>.", offset, actualOffset) //
   .isEqualTo(offset);
 return myself;
}

代码示例来源:origin: stackoverflow.com

Animation a = //initialize here
 a.setStartOffset(2000);
 a.setAnimationListener(new Animation.AnimationListener() {
   @Override
   public void onAnimationStart(Animation animation) {
   }
   @Override
   public void onAnimationEnd(Animation animation) {
     a.setStartOffset(a.getStartOffset() == 2000 ? 4000 : 2000);
     a.start();
   }
   @Override
   public void onAnimationRepeat(Animation animation) {
   }
 });
 a.start();

代码示例来源:origin: org.robolectric/shadows-core

private void start() {
 startTime = animation.getStartTime();
 startOffset = animation.getStartOffset();
 Choreographer choreographer = ShadowChoreographer.getInstance();
 if (animationRunner != null) {
  choreographer.removeCallbacks(Choreographer.CALLBACK_ANIMATION, animationRunner, null);
 }
 animationRunner = this;
 int startDelay;
 if (startTime == Animation.START_ON_FIRST_FRAME) {
  startDelay = (int) startOffset;
 } else {
  startDelay = (int) ((startTime + startOffset) - SystemClock.uptimeMillis());
 }
 choreographer.postCallbackDelayed(Choreographer.CALLBACK_ANIMATION, this, null, startDelay);
}

代码示例来源:origin: org.robolectric/shadows-core-v23

private void start() {
 startTime = animation.getStartTime();
 startOffset = animation.getStartOffset();
 Choreographer choreographer = ShadowChoreographer.getInstance();
 if (animationRunner != null) {
  choreographer.removeCallbacks(Choreographer.CALLBACK_ANIMATION, animationRunner, null);
 }
 animationRunner = this;
 int startDelay;
 if (startTime == Animation.START_ON_FIRST_FRAME) {
  startDelay = (int) startOffset;
 } else {
  startDelay = (int) ((startTime + startOffset) - SystemClock.uptimeMillis());
 }
 choreographer.postCallbackDelayed(Choreographer.CALLBACK_ANIMATION, this, null, startDelay);
}

代码示例来源:origin: org.robolectric/shadows-framework

private void start() {
 startTime = animation.getStartTime();
 startOffset = animation.getStartOffset();
 Choreographer choreographer = ShadowChoreographer.getInstance();
 if (animationRunner != null) {
  choreographer.removeCallbacks(Choreographer.CALLBACK_ANIMATION, animationRunner, null);
 }
 animationRunner = this;
 int startDelay;
 if (startTime == Animation.START_ON_FIRST_FRAME) {
  startDelay = (int) startOffset;
 } else {
  startDelay = (int) ((startTime + startOffset) - SystemClock.uptimeMillis());
 }
 choreographer.postCallbackDelayed(Choreographer.CALLBACK_ANIMATION, this, null, startDelay);
}

代码示例来源:origin: org.robolectric/framework

private void start() {
 startTime = animation.getStartTime();
 startOffset = animation.getStartOffset();
 Choreographer choreographer = ShadowChoreographer.getInstance();
 if (animationRunner != null) {
  choreographer.removeCallbacks(Choreographer.CALLBACK_ANIMATION, animationRunner, null);
 }
 animationRunner = this;
 int startDelay;
 if (startTime == Animation.START_ON_FIRST_FRAME) {
  startDelay = (int) startOffset;
 } else {
  startDelay = (int) ((startTime + startOffset) - SystemClock.uptimeMillis());
 }
 choreographer.postCallbackDelayed(Choreographer.CALLBACK_ANIMATION, this, null, startDelay);
}

代码示例来源:origin: org.robolectric/shadows-framework

@Override
 public void run() {
  // Abort if start time has been messed with, as this simulation is only designed to handle
  // standard situations.
  if ((animation.getStartTime() == startTime && animation.getStartOffset() == startOffset) &&
    animation.getTransformation(startTime == Animation.START_ON_FIRST_FRAME ?
      SystemClock.uptimeMillis() : (startTime + startOffset + elapsedTime), new Transformation()) &&
      // We can't handle infinitely repeating animations in the current scheduling model,
      // so abort after one iteration.
      !(animation.getRepeatCount() == Animation.INFINITE && elapsedTime >= animation.getDuration())) {
   // Update startTime if it had a value of Animation.START_ON_FIRST_FRAME
   startTime = animation.getStartTime();
   elapsedTime += ShadowChoreographer.getFrameInterval() / TimeUtils.NANOS_PER_MS;
   ShadowChoreographer.getInstance().postCallback(Choreographer.CALLBACK_ANIMATION, this, null);
  } else {
   animationRunner = null;
  }
 }
}

代码示例来源:origin: org.robolectric/shadows-core

@Override
 public void run() {
  // Abort if start time has been messed with, as this simulation is only designed to handle
  // standard situations.
  if ((animation.getStartTime() == startTime && animation.getStartOffset() == startOffset) &&
    animation.getTransformation(startTime == Animation.START_ON_FIRST_FRAME ?
      SystemClock.uptimeMillis() : (startTime + startOffset + elapsedTime), new Transformation()) &&
      // We can't handle infinitely repeating animations in the current scheduling model,
      // so abort after one iteration.
      !(animation.getRepeatCount() == Animation.INFINITE && elapsedTime >= animation.getDuration())) {
   // Update startTime if it had a value of Animation.START_ON_FIRST_FRAME
   startTime = animation.getStartTime();
   elapsedTime += ShadowChoreographer.getFrameInterval() / TimeUtils.NANOS_PER_MS;
   ShadowChoreographer.getInstance().postCallback(Choreographer.CALLBACK_ANIMATION, this, null);
  } else {
   animationRunner = null;
  }
 }
}

代码示例来源:origin: org.robolectric/shadows-core-v23

@Override
 public void run() {
  // Abort if start time has been messed with, as this simulation is only designed to handle
  // standard situations.
  if ((animation.getStartTime() == startTime && animation.getStartOffset() == startOffset) &&
    animation.getTransformation(startTime == Animation.START_ON_FIRST_FRAME ?
      SystemClock.uptimeMillis() : (startTime + startOffset + elapsedTime), new Transformation()) &&
      // We can't handle infinitely repeating animations in the current scheduling model,
      // so abort after one iteration.
      !(animation.getRepeatCount() == Animation.INFINITE && elapsedTime >= animation.getDuration())) {
   // Update startTime if it had a value of Animation.START_ON_FIRST_FRAME
   startTime = animation.getStartTime();
   elapsedTime += ShadowChoreographer.getFrameInterval() / TimeUtils.NANOS_PER_MS;
   ShadowChoreographer.getInstance().postCallback(Choreographer.CALLBACK_ANIMATION, this, null);
  } else {
   animationRunner = null;
  }
 }
}

代码示例来源:origin: org.robolectric/framework

@Override
 public void run() {
  // Abort if start time has been messed with, as this simulation is only designed to handle
  // standard situations.
  if ((animation.getStartTime() == startTime && animation.getStartOffset() == startOffset) &&
    animation.getTransformation(startTime == Animation.START_ON_FIRST_FRAME ?
      SystemClock.uptimeMillis() : (startTime + startOffset + elapsedTime), new Transformation()) &&
      // We can't handle infinitely repeating animations in the current scheduling model,
      // so abort after one iteration.
      !(animation.getRepeatCount() == Animation.INFINITE && elapsedTime >= animation.getDuration())) {
   // Update startTime if it had a value of Animation.START_ON_FIRST_FRAME
   startTime = animation.getStartTime();
   elapsedTime += ShadowChoreographer.getFrameInterval() / TimeUtils.NANOS_PER_MS;
   ShadowChoreographer.getInstance().postCallback(Choreographer.CALLBACK_ANIMATION, this, null);
  } else {
   animationRunner = null;
  }
 }
}

相关文章

微信公众号

最新文章

更多