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

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

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

ViewPropertyAnimator.setListener介绍

暂无

代码示例

代码示例来源:origin: ankidroid/Anki-Android

private void hideViewWithAnimation(final View view) {
  view.animate()
      .alpha(0f)
      .setDuration(ANIMATION_DURATION)
      .setListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
          view.setVisibility(View.GONE);
        }
      });
}

代码示例来源:origin: ankidroid/Anki-Android

private void showViewWithAnimation(final View view) {
  view.setAlpha(0.0f);
  view.setVisibility(View.VISIBLE);
  view.animate().alpha(TRANSPARENCY).setDuration(ANIMATION_DURATION).setListener(null);
}

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

@Override
public void onReleased(@NonNull final RefreshLayout layout, int height, int maxDragHeight) {
  final View imageView = mImageView;
  final View dropView = mWaterDropView;
  mProgressDrawable.start();
  imageView.setVisibility(GONE);
  mWaterDropView.createAnimator().start();//开始回弹
  dropView.animate().setDuration(150).alpha(0).setListener(new AnimatorListenerAdapter() {
    public void onAnimationEnd(Animator animation) {
      dropView.setVisibility(GONE);
      dropView.setAlpha(1);
    }
  });
}

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

private void viewEnterAnimation(View view, float offset, Interpolator interp) {
  view.setTranslationY(-offset);
  view.setAlpha(0.6f);
  view.animate()
      .translationY(0f)
      .alpha(1f)
      .setDuration(600L)
      .setInterpolator(interp)
      .setListener(null)
      .start();
}

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

private void viewEnterAnimationNest(View view, float offset, Interpolator interp) {
  view.setTranslationY(-offset);
  view.setAlpha(0.3f);
  view.animate()
      .translationY(0f)
      .alpha(1f)
      .setDuration(500L)
      .setInterpolator(interp)
      .setListener(null)
      .start();
}

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

private void viewEnterAnimationNest(View view, float offset, Interpolator interp) {
  view.setTranslationY(-offset);
  view.animate()
      .translationY(0f)
      .alpha(1f)
      .setDuration(50L)
      .setInterpolator(interp)
      .setListener(null)
      .start();
}

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

private void viewEnterAnimation(View view, float offset, Interpolator interp) {
  view.setTranslationY(-offset);
  view.setAlpha(0f);
  view.animate()
      .translationY(0f)
      .alpha(1f)
      .setDuration(500L)
      .setInterpolator(interp)
      .setListener(null)
      .start();
}
private void viewEnterAnimationNest(View view, float offset, Interpolator interp) {

代码示例来源:origin: frogermcs/InstaMaterial

private void runEnterAnimation(final FeedAdapter.CellFeedViewHolder holder) {
  final int screenHeight = Utils.getScreenHeight(holder.itemView.getContext());
  holder.itemView.setTranslationY(screenHeight);
  holder.itemView.animate()
      .translationY(0)
      .setInterpolator(new DecelerateInterpolator(3.f))
      .setDuration(700)
      .setListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
          dispatchAddFinished(holder);
        }
      })
      .start();
}

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

private void translateWidgets(int deltaX, View... views) {
 for (final View v : views) {
  v.setLayerType(View.LAYER_TYPE_HARDWARE, null);
  v.animate().translationXBy(deltaX).setDuration(ANIM_DURATION)
   .setListener(new AnimatorListenerAdapter() {
    @Override
    public void onAnimationEnd(Animator animation) {
     v.setLayerType(View.LAYER_TYPE_NONE, null);
    }
   });
 }
}

代码示例来源:origin: CameraKit/blurkit-android

@Override
  public void onAnimationEnd(Animator animation) {
    super.onAnimationEnd(animation);
    movement = movement > 0 ? -150 : 150;
    blurLayout.animate().translationY(movement).setDuration(1500).setListener(this).start();
  }
}).start();

代码示例来源: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: seven332/EhViewer

private void hideActionFab() {
  if (null != mFabLayout && STATE_NORMAL == mState && mShowActionFab) {
    mShowActionFab = false;
    View fab = mFabLayout.getPrimaryFab();
    fab.animate().scaleX(0.0f).scaleY(0.0f).setListener(mActionFabAnimatorListener)
        .setDuration(ANIMATE_TIME).setStartDelay(0L)
        .setInterpolator(AnimationUtils.SLOW_FAST_INTERPOLATOR).start();
  }
}

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

@Override
 public void onAnimationEnd(Animator animator) {
  title.setText(newTitle);
  doTranslation(title, translation);
  final ViewPropertyAnimator viewPropertyAnimator = title.animate();
  if (orientation == MaterialCalendarView.HORIZONTAL) {
   viewPropertyAnimator.translationX(0);
  } else {
   viewPropertyAnimator.translationY(0);
  }
  viewPropertyAnimator
    .alpha(1)
    .setDuration(animDuration)
    .setInterpolator(interpolator)
    .setListener(new AnimatorListener())
    .start();
 }
}).start();

代码示例来源:origin: CameraKit/blurkit-android

@Override
protected void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.activity_main);
  blurLayout = (BlurLayout) findViewById(R.id.blurLayout);
  blurLayout.animate().translationY(movement).setDuration(1500).setListener(new AnimatorListenerAdapter() {
    @Override
    public void onAnimationEnd(Animator animation) {
      super.onAnimationEnd(animation);
      movement = movement > 0 ? -150 : 150;
      blurLayout.animate().translationY(movement).setDuration(1500).setListener(this).start();
    }
  }).start();
}

代码示例来源:origin: seven332/EhViewer

private void showActionFab() {
  if (null != mFabLayout && STATE_NORMAL == mState && !mShowActionFab) {
    mShowActionFab = true;
    View fab = mFabLayout.getPrimaryFab();
    fab.setVisibility(View.VISIBLE);
    fab.setRotation(-45.0f);
    fab.animate().scaleX(1.0f).scaleY(1.0f).rotation(0.0f).setListener(null)
        .setDuration(ANIMATE_TIME).setStartDelay(0L)
        .setInterpolator(AnimationUtils.FAST_SLOW_INTERPOLATOR).start();
  }
}

代码示例来源:origin: frogermcs/InstaMaterial

@Override
  public void onLoadingFinished() {
    vSendingProgress.animate().scaleY(0).scaleX(0).setDuration(200).setStartDelay(100);
    vProgressBg.animate().alpha(0.f).setDuration(200).setStartDelay(100)
        .setListener(new AnimatorListenerAdapter() {
          @Override
          public void onAnimationEnd(Animator animation) {
            vSendingProgress.setScaleX(1);
            vSendingProgress.setScaleY(1);
            vProgressBg.setAlpha(1);
            if (onLoadingFinishedListener != null) {
              onLoadingFinishedListener.onLoadingFinished();
              onLoadingFinishedListener = null;
            }
          }
        }).start();
  }
});

代码示例来源:origin: frogermcs/InstaMaterial

@Override
public void onBackPressed() {
  ViewCompat.setElevation(getToolbar(), 0);
  contentRoot.animate()
      .translationY(Utils.getScreenHeight(this))
      .setDuration(200)
      .setListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
          CommentsActivity.super.onBackPressed();
          overridePendingTransition(0, 0);
        }
      })
      .start();
}

代码示例来源:origin: frogermcs/InstaMaterial

private void startIntroAnimation() {
  ViewCompat.setElevation(getToolbar(), 0);
  contentRoot.setScaleY(0.1f);
  contentRoot.setPivotY(drawingStartLocation);
  llAddComment.setTranslationY(200);
  contentRoot.animate()
      .scaleY(1)
      .setDuration(200)
      .setInterpolator(new AccelerateInterpolator())
      .setListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
          ViewCompat.setElevation(getToolbar(), Utils.dpToPx(8));
          animateContent();
        }
      })
      .start();
}

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

@Override
public void onStopNestedScroll(View child) {
  if (Math.abs(totalDrag) >= dragDismissDistance) {
    dispatchDismissCallback();
  } else { // settle back to natural position
    if (mLastActionEvent == MotionEvent.ACTION_DOWN) {
      // this is a 'defensive cleanup for new gestures',
      // don't animate here
      // see also https://github.com/nickbutcher/plaid/issues/185
      setTranslationY(0f);
      setScaleX(1f);
      setScaleY(1f);
    } else {
      animate()
        .translationY(0f)
        .scaleX(1f)
        .scaleY(1f)
        .setDuration(200L)
        .setInterpolator(AnimUtils.getFastOutSlowInInterpolator(getContext()))
        .setListener(null)
        .start();
    }
    totalDrag = 0;
    draggingDown = draggingUp = false;
    dispatchDragCallback(0f, 0f, 0f, 0f);
  }
}

代码示例来源:origin: frogermcs/InstaMaterial

private void performShowAnimation() {
  contextMenuView.setPivotX(contextMenuView.getWidth() / 2);
  contextMenuView.setPivotY(contextMenuView.getHeight());
  contextMenuView.setScaleX(0.1f);
  contextMenuView.setScaleY(0.1f);
  contextMenuView.animate()
      .scaleX(1f).scaleY(1f)
      .setDuration(150)
      .setInterpolator(new OvershootInterpolator())
      .setListener(new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
          isContextMenuShowing = false;
        }
      });
}

相关文章