android.view.ViewPropertyAnimator.cancel()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(165)

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

ViewPropertyAnimator.cancel介绍

暂无

代码示例

代码示例来源:origin: commonsguy/cw-omnibus

@Override
public void cancel() {
  android.view.ViewPropertyAnimator n = mNative.get();
  if (n != null) {
    n.cancel();
  }
}

代码示例来源:origin: alexvasilkov/GestureViews

@Override
public void onSuccess() {
  holder.progress.animate().cancel();
  holder.progress.animate().alpha(0f);
}

代码示例来源:origin: scwang90/SmartRefreshLayout

@Override
protected void onDetachedFromWindow() {
  super.onDetachedFromWindow();
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
    final View arrowView = mArrowView;
    final View progressView = mProgressView;
    arrowView.animate().cancel();
    progressView.animate().cancel();
  }
  final Drawable drawable = mProgressView.getDrawable();
  if (drawable instanceof Animatable) {
    if (((Animatable) drawable).isRunning()) {
      ((Animatable) drawable).stop();
    }
  }
}

代码示例来源:origin: nickbutcher/plaid

@Override
public void endAnimation(RecyclerView.ViewHolder holder) {
  holder.itemView.animate().cancel();
  if (pendingAdds.remove(holder)) {
    dispatchAddFinished(holder);
    clearAnimatedValues(holder.itemView);
  }
  super.endAnimation(holder);
}

代码示例来源:origin: TeamNewPipe/NewPipe

public static void animateRotation(final View view, long duration, int targetRotation) {
  if (DEBUG) {
    Log.d(TAG, "animateRotation: duration = [" + duration + "], from " + view.getRotation() + " to → " + targetRotation + " in: " + view);
  }
  view.animate().setListener(null).cancel();
  view.animate().rotation(targetRotation).setDuration(duration).setInterpolator(new FastOutSlowInInterpolator())
      .setListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationCancel(Animator animation) {
          view.setRotation(targetRotation);
        }
        @Override
        public void onAnimationEnd(Animator animation) {
          view.setRotation(targetRotation);
        }
      }).start();
}

代码示例来源:origin: niorgai/StatusBarCompat

@Override
  public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
    if (Math.abs(verticalOffset) > appBarLayout.getHeight() - collapsingToolbarLayout.getScrimVisibleHeightTrigger()) {
      if (statusView.getAlpha() == 0) {
        statusView.animate().cancel();
        statusView.animate().alpha(1f).setDuration(collapsingToolbarLayout.getScrimAnimationDuration()).start();
      }
    } else {
      if (statusView.getAlpha() == 1) {
        statusView.animate().cancel();
        statusView.animate().alpha(0f).setDuration(collapsingToolbarLayout.getScrimAnimationDuration()).start();
      }
    }
  }
});

代码示例来源:origin: alexvasilkov/GestureViews

@Override
public void onRecycleViewHolder(@NonNull ViewHolder holder) {
  super.onRecycleViewHolder(holder);
  DemoGlideHelper.clear(holder.image);
  holder.progress.animate().cancel();
  holder.progress.setAlpha(0f);
  holder.image.setImageDrawable(null);
}

代码示例来源:origin: xinghongfei/LookLook

@Override
public void endAnimation(RecyclerView.ViewHolder holder) {
  holder.itemView.animate().cancel();
  if (pendingAdds.remove(holder)) {
    dispatchAddFinished(holder);
    clearAnimatedValues(holder.itemView);
  }
  super.endAnimation(holder);
}

代码示例来源:origin: TeamNewPipe/NewPipe

view.animate().setListener(null).cancel();
  view.setVisibility(View.VISIBLE);
  view.setAlpha(1f);
} else if ((view.getVisibility() == View.GONE || view.getVisibility() == View.INVISIBLE) && !enterOrExit) {
  if (DEBUG) Log.d(TAG, "animateView() view was already gone > view = [" + view + "]");
  view.animate().setListener(null).cancel();
  view.setVisibility(View.GONE);
  view.setAlpha(0f);
view.animate().setListener(null).cancel();
view.setVisibility(View.VISIBLE);

代码示例来源:origin: TeamNewPipe/NewPipe

private void animateOverlayAndFinishService() {
  final int targetTranslationY = (int) (closeOverlayButton.getRootView().getHeight() - closeOverlayButton.getY());
  closeOverlayButton.animate().setListener(null).cancel();
  closeOverlayButton.animate()
      .setInterpolator(new AnticipateInterpolator())
      .translationY(targetTranslationY)
      .setDuration(400)
      .setListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationCancel(Animator animation) {
          end();
        }
        @Override
        public void onAnimationEnd(Animator animation) {
          end();
        }
        private void end() {
          windowManager.removeView(closeOverlayView);
          stopForeground(true);
          stopSelf();
        }
      }).start();
}

代码示例来源:origin: TeamNewPipe/NewPipe

(translationPercent > 0.0f ? translationPercent : .06f));
contentRootLayoutHiding.animate().setListener(null).cancel();
contentRootLayoutHiding.setAlpha(0f);
contentRootLayoutHiding.setTranslationY(translationY);
    .start();
uploaderRootLayout.animate().setListener(null).cancel();
uploaderRootLayout.setAlpha(0f);
uploaderRootLayout.setTranslationY(translationY);
  relatedStreamRootLayout.animate().setListener(null).cancel();
  relatedStreamRootLayout.setAlpha(0f);
  relatedStreamRootLayout.setTranslationY(translationY);

代码示例来源:origin: prolificinteractive/material-calendarview

private void doChange(final long now, final CalendarDay currentMonth, boolean animate) {
 title.animate().cancel();
 doTranslation(title, 0);

代码示例来源:origin: fython/MaterialStepperView

if (mPointAnimator != null) mPointAnimator.cancel();
mPointAnimator = mPointFrame.animate().alpha(0F).setDuration(mAnimationDuration);
mPointAnimator.start();
mErrorIconView.setScaleX(0.6F);
mErrorIconView.setScaleY(0.6F);
if (mErrorIconAnimator != null) mErrorIconAnimator.cancel();
mErrorIconAnimator = mErrorIconView.animate().scaleX(1F).scaleY(1F)
    .alpha(1F).setDuration(mAnimationDuration).setInterpolator(new OvershootInterpolator());
mPointFrame.setScaleX(0.6F);
mPointFrame.setScaleY(0.6F);
if (mPointAnimator != null) mPointAnimator.cancel();
mPointAnimator = mPointFrame.animate().scaleX(1F).scaleY(1F).alpha(1F).setDuration(mAnimationDuration);
mPointAnimator.start();
if (mErrorIconAnimator != null) mErrorIconAnimator.cancel();
mErrorIconAnimator = mErrorIconView.animate().alpha(0F).setDuration(mAnimationDuration);
mErrorIconAnimator.start();

代码示例来源:origin: com.nineoldandroids/library

@Override
public void cancel() {
  android.view.ViewPropertyAnimator n = mNative.get();
  if (n != null) {
    n.cancel();
  }
}

代码示例来源:origin: eneim/toro

@Override public void pause() {
 playerView.setUseController(false);
 if (onPauseAnimator != null) onPauseAnimator.cancel();
 onPauseAnimator = overLay.animate().alpha(1.0f).setListener(new AnimatorListenerAdapter() {
  @Override public void onAnimationCancel(Animator animation) {
   animation.end();
  }
 }).setDuration(animatorDuration);
 onPauseAnimator.start();
 if (helper != null) helper.pause();
}

代码示例来源:origin: eneim/toro

@Override public void play() {
 playerView.setUseController(true);
 if (onPlayAnimator != null) onPlayAnimator.cancel();
 onPlayAnimator = overLay.animate().alpha(0.0f).setListener(new AnimatorListenerAdapter() {
  @Override public void onAnimationCancel(Animator animation) {
   animation.end();
  }
 }).setDuration(animatorDuration);
 onPlayAnimator.start();
 if (helper != null) helper.play();
}

代码示例来源:origin: mayubao/KuaiChuan

@Override
public void onNestedPreScroll(CoordinatorLayout coordinatorLayout, View child, View target, int dx, int dy, int[] consumed) {
  Log.i(TAG, "onNestedPreScroll------>>>" + "dx:" + dx + ",dy:" + dy);
  Log.i(TAG, "onNestedPreScroll------>>>target : " +  target.getClass().getSimpleName());
  if (dy > 0 && sinceDirectionChange < 0 || dy < 0 && sinceDirectionChange > 0) {
    child.animate().cancel();
    sinceDirectionChange = 0;
  }
  sinceDirectionChange += dy;
  if (sinceDirectionChange > child.getHeight() && child.getVisibility() == View.VISIBLE) {
    hide(child);
  } else if (sinceDirectionChange < 0 && child.getVisibility() == View.GONE) {
    show(child);
  }
}

代码示例来源:origin: eneim/toro

@Override public void release() {
 if (onPlayAnimator != null) onPlayAnimator.cancel();
 if (onPauseAnimator != null) onPauseAnimator.cancel();
 onPlayAnimator = null;
 onPauseAnimator = null;
 if (helper != null) {
  helper.removeEventListener(listener);
  helper.removePlayerEventListener(eventListener);
  helper.release();
  helper = null;
 }
}

代码示例来源:origin: chaychan/TouTiao

@Override
  public void onOffsetChanged(AppBarLayout appBarLayout, int verticalOffset) {
    if (Math.abs(verticalOffset) > appBarLayout.getHeight() - collapsingToolbarLayout.getScrimVisibleHeightTrigger()) {
      //toolbar被折叠时显示状态栏
      if (statusView.getAlpha() == 0) {
        statusView.animate().cancel();
        statusView.animate().alpha(1f).setDuration(collapsingToolbarLayout.getScrimAnimationDuration()).start();
      }
    } else {
      //toolbar展开时显示状态栏
      if (statusView.getAlpha() == 1) {
        statusView.animate().cancel();
        statusView.animate().alpha(0f).setDuration(collapsingToolbarLayout.getScrimAnimationDuration()).start();
      }
    }
  }
});

代码示例来源:origin: pili-engineering/PLDroidShortVideo

public void focusCancel() {
  animate().cancel();
  removeCallbacks(mDisappear);
  mDisappear.run();
  setScaleX(1f);
  setScaleY(1f);
}

相关文章