本文整理汇总了Java中android.animation.AnimatorListenerAdapter类的典型用法代码示例。如果您正苦于以下问题:Java AnimatorListenerAdapter类的具体用法?Java AnimatorListenerAdapter怎么用?Java AnimatorListenerAdapter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AnimatorListenerAdapter类属于android.animation包,在下文中一共展示了AnimatorListenerAdapter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hideProgressBar
import android.animation.AnimatorListenerAdapter; //导入依赖的package包/类
/**
*/
@Override
void hideProgressBar(SearchView searchView) {
final CircularProgressBar progressBar = searchView.mProgressBar;
final ViewPropertyAnimator progressBarAnimator = progressBar.animate();
progressBarAnimator.setListener(null);
progressBarAnimator.cancel();
progressBarAnimator
.alpha(0.0f)
.setDuration(UiConfig.ANIMATION_DURATION_SHORT)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
progressBar.setVisibility(View.INVISIBLE);
}
})
.start();
final View icon = searchView.mButtonIcon;
final ViewPropertyAnimator iconAnimator = icon.animate();
iconAnimator.setListener(null);
iconAnimator.cancel();
icon.setVisibility(View.VISIBLE);
icon.setScaleX(0.5f);
icon.setScaleY(0.5f);
icon.setAlpha(0.0f);
iconAnimator
.scaleX(1.0f)
.scaleY(1.0f)
.alpha(1.0f)
.setDuration(UiConfig.ANIMATION_DURATION_SHORT)
.setInterpolator(iconInterpolator)
.setListener(null)
.start();
}
示例2: createHideItemAnimator
import android.animation.AnimatorListenerAdapter; //导入依赖的package包/类
private Animator createHideItemAnimator(final View item) {
final float dx = centerItem.getX() - item.getX();
final float dy = centerItem.getY() - item.getY();
Animator anim = ObjectAnimator.ofPropertyValuesHolder(
item,
AnimatorUtils.scaleX(1f, 0f),
AnimatorUtils.scaleY(1f, 0f),
AnimatorUtils.translationX(0f, dx),
AnimatorUtils.translationY(0f, dy)
);
anim.setInterpolator(new DecelerateInterpolator());
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
item.setTranslationX(0f);
item.setTranslationY(0f);
}
});
anim.setDuration(50);
return anim;
}
示例3: startTwoLevel
import android.animation.AnimatorListenerAdapter; //导入依赖的package包/类
@Override
public RefreshKernel startTwoLevel(boolean open) {
if (open) {
AnimatorListenerAdapter listener = new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
SmartRefreshLayout.this.notifyStateChanged(RefreshState.TwoLevel);
}
};
ValueAnimator animator = SmartRefreshLayout.this.animSpinner(SmartRefreshLayout.this.getMeasuredHeight());
if (animator != null && animator == SmartRefreshLayout.this.reboundAnimator) {
animator.setDuration(SmartRefreshLayout.this.mFloorDuration);
animator.addListener(listener);
} else {
listener.onAnimationEnd(null);
}
} else {
if (animSpinner(0) == null) {
SmartRefreshLayout.this.notifyStateChanged(RefreshState.None);
}
}
return this;
}
示例4: doStart
import android.animation.AnimatorListenerAdapter; //导入依赖的package包/类
private void doStart(long delay) {
ObjectAnimator topMaskAnimator = ObjectAnimator.ofFloat(topMaskView, "translationY", topMaskView.getTranslationY(), -halfHitBlockHeight);
ObjectAnimator bottomMaskAnimator = ObjectAnimator.ofFloat(bottomMaskView, "translationY", bottomMaskView.getTranslationY(), halfHitBlockHeight);
ObjectAnimator maskShadowAnimator = ObjectAnimator.ofFloat(maskReLayout, "alpha", maskReLayout.getAlpha(), 0);
AnimatorSet animatorSet = new AnimatorSet();
animatorSet.play(topMaskAnimator).with(bottomMaskAnimator).with(maskShadowAnimator);
animatorSet.setDuration(800);
animatorSet.setStartDelay(delay);
animatorSet.start();
animatorSet.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
topMaskView.setVisibility(View.GONE);
bottomMaskView.setVisibility(View.GONE);
maskReLayout.setVisibility(View.GONE);
onGameStart();
}
});
}
示例5: toolbarAnimateHide
import android.animation.AnimatorListenerAdapter; //导入依赖的package包/类
private void toolbarAnimateHide() {
if (mIsActionBarVisible) {
mCommonToolbar.animate()
.translationY(-mCommonToolbar.getHeight())
.setInterpolator(new LinearInterpolator())
.setDuration(180)
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
toolbarSetElevation(0);
hideStatusBar();
if (mTocListPopupWindow != null && mTocListPopupWindow.isShowing()) {
mTocListPopupWindow.dismiss();
}
}
});
mIsActionBarVisible = false;
}
}
示例6: reset
import android.animation.AnimatorListenerAdapter; //导入依赖的package包/类
private void reset() {
//Animate mobile view back to original position
final View view = getViewByPosition(mobileViewCurrentPos);
if (view != null && mobileView != null) {
float y = getViewRawCoords(view)[1];
mobileView.animate().y(y).setDuration(MOVE_DURATION).setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
view.setVisibility(View.VISIBLE);
if (mobileView != null) {
ViewGroup parent = (ViewGroup) mobileView.getParent();
parent.removeView(mobileView);
mobileView = null;
}
}
});
}
dragging = false;
mobileViewStartY = -1;
mobileViewCurrentPos = -1;
}
示例7: loadMore
import android.animation.AnimatorListenerAdapter; //导入依赖的package包/类
public void loadMore() {
if (mPullLoadMoreListener != null && hasMore) {
mFooterView.animate()
.translationY(0)
.setDuration(300)
.setInterpolator(new AccelerateDecelerateInterpolator())
.setListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
mprogressBar.setVisibility(View.VISIBLE);
loadMoreText.setText(mContext.getString(R.string.load_more_text));
mFooterView.setVisibility(View.VISIBLE);
}
})
.start();
invalidate();
mPullLoadMoreListener.onLoadMore();
}
}
示例8: animateRevealHide
import android.animation.AnimatorListenerAdapter; //导入依赖的package包/类
private void animateRevealHide(final View viewRoot) {
int cx = (viewRoot.getLeft() + viewRoot.getRight()) / 2;
int cy = (viewRoot.getTop() + viewRoot.getBottom()) / 2;
int initialRadius = viewRoot.getWidth();
Animator anim = ViewAnimationUtils.createCircularReveal(viewRoot, cx, cy, initialRadius, 0);
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
viewRoot.setVisibility(View.INVISIBLE);
}
});
anim.setDuration(getResources().getInteger(R.integer.anim_duration_medium));
anim.start();
}
示例9: showSharePicker
import android.animation.AnimatorListenerAdapter; //导入依赖的package包/类
private void showSharePicker() {
final boolean hasSubView = presentView != null;
if (hasSubView) {
final View focusedChild = ShareView.this.getFocusedChild();
UiUtils.hideKeyBoard(focusedChild);
final Animator appearAnimator = animatorFactory.createDisappearAnimator(presentView);
appearAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
removeSubViews();
sharePickerView.setVisibility(VISIBLE);
}
});
appearAnimator.start();
}
shareContext = null;
}
示例10: showContent
import android.animation.AnimatorListenerAdapter; //导入依赖的package包/类
@Override public void showContent() {
if (adapter.getItemCount() == 0) {
if (isRestoringViewState()) {
emptyView.setVisibility(View.VISIBLE);
} else {
ObjectAnimator anim = ObjectAnimator.ofFloat(emptyView, "alpha", 0f, 1f).setDuration(300);
anim.setStartDelay(250);
anim.addListener(new AnimatorListenerAdapter() {
@Override public void onAnimationStart(Animator animation) {
emptyView.setVisibility(View.VISIBLE);
}
});
anim.start();
}
} else {
emptyView.setVisibility(View.GONE);
}
super.showContent();
}
示例11: animateDragViewToOriginalPosition
import android.animation.AnimatorListenerAdapter; //导入依赖的package包/类
private void animateDragViewToOriginalPosition() {
if (mDragView != null) {
Animator anim = new LauncherViewPropertyAnimator(mDragView)
.translationX(0)
.translationY(0)
.scaleX(1)
.scaleY(1)
.setDuration(REORDERING_DROP_REPOSITION_DURATION);
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
onPostReorderingAnimationCompleted();
}
});
anim.start();
}
}
示例12: unRevealActivity
import android.animation.AnimatorListenerAdapter; //导入依赖的package包/类
private void unRevealActivity(final View revealView, int endCenterX, int endCenterY) {
int startCenterX = revealView.getWidth() / 2;
int startCenterY = revealView.getHeight() / 2;
float startRadius = Math.max(revealView.getWidth(), revealView.getHeight()) * 1.1f;
float finalRadius = 0;
Animator circularReveal = ViewAnimationCompatUtils.createCircularReveal(revealView, startCenterX, startCenterY, startRadius, endCenterX, endCenterY, finalRadius);
circularReveal.setDuration(500);
circularReveal.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
revealView.setVisibility(View.INVISIBLE);
finish();
}
});
circularReveal.start();
}
示例13: createExpandValueAnimator
import android.animation.AnimatorListenerAdapter; //导入依赖的package包/类
private ValueAnimator createExpandValueAnimator() {
ValueAnimator animator = ValueAnimator.ofFloat(0f, 1f);
animator.setDuration(DEFAULT_ANIMATION_DURATION_EXPAND);
animator.setInterpolator(new AccelerateInterpolator());
animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
@Override
public void onAnimationUpdate(ValueAnimator valueAnimator) {
mExpandedScaleFactor[0] = (float) valueAnimator.getAnimatedValue();
invalidateSelf();
}
});
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
notifyExpanded();
}
});
return animator;
}
示例14: animateDragViewToOriginalPosition
import android.animation.AnimatorListenerAdapter; //导入依赖的package包/类
private void animateDragViewToOriginalPosition() {
if (mDragView != null) {
Animator anim = LauncherAnimUtils.ofPropertyValuesHolder(mDragView,
new PropertyListBuilder()
.scale(1)
.translationX(0)
.translationY(0)
.build())
.setDuration(REORDERING_DROP_REPOSITION_DURATION);
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
onPostReorderingAnimationCompleted();
}
});
anim.start();
}
}
示例15: snapChild
import android.animation.AnimatorListenerAdapter; //导入依赖的package包/类
private void snapChild(final View animView, final float targetLeft, float velocity) {
final boolean canBeDismissed = mCallback.canChildBeDismissed(animView);
AnimatorUpdateListener updateListener = new AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator animation) {
onTranslationUpdate(animView, (float) animation.getAnimatedValue(), canBeDismissed);
}
};
Animator anim = getViewTranslationAnimator(animView, targetLeft, updateListener);
if (anim == null) {
return;
}
int duration = SNAP_ANIM_LEN;
anim.setDuration(duration);
anim.addListener(new AnimatorListenerAdapter() {
public void onAnimationEnd(Animator animator) {
mSnappingChild = false;
updateSwipeProgressFromOffset(animView, canBeDismissed);
mCallback.onChildSnappedBack(animView, targetLeft);
}
});
prepareSnapBackAnimation(animView, anim);
mSnappingChild = true;
anim.start();
}