本文整理汇总了Java中android.animation.Animator.addListener方法的典型用法代码示例。如果您正苦于以下问题:Java Animator.addListener方法的具体用法?Java Animator.addListener怎么用?Java Animator.addListener使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.animation.Animator
的用法示例。
在下文中一共展示了Animator.addListener方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: animateDragViewToOriginalPosition
import android.animation.Animator; //导入方法依赖的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();
}
}
示例2: animateDragViewToOriginalPosition
import android.animation.Animator; //导入方法依赖的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();
}
}
示例3: removeViewFromIconRow
import android.animation.Animator; //导入方法依赖的package包/类
private void removeViewFromIconRow(View child) {
mIconRow.removeView(child);
mNotifications.remove((NotificationInfo) child.getTag());
updateOverflowEllipsisVisibility();
if (mIconRow.getChildCount() == 0) {
// There are no more icons in the footer, so hide it.
PopupContainerWithArrow popup = PopupContainerWithArrow.getOpen(
Launcher.getLauncher(getContext()));
if (popup != null) {
Animator collapseFooter = popup.reduceNotificationViewHeight(getHeight(),
getResources().getInteger(R.integer.config_removeNotificationViewDuration));
collapseFooter.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
((ViewGroup) getParent()).removeView(NotificationFooterLayout.this);
}
});
collapseFooter.start();
}
}
}
示例4: createHideItemAnimator
import android.animation.Animator; //导入方法依赖的package包/类
private Animator createHideItemAnimator(final View item) {
float dx = fab.getX() - item.getX();
float dy = fab.getY() - item.getY();
Animator anim = ObjectAnimator.ofPropertyValuesHolder(
item,
AnimatorUtils.rotation(720f, 0f),
AnimatorUtils.translationX(0f, dx),
AnimatorUtils.translationY(0f, dy)
);
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
item.setTranslationX(0f);
item.setTranslationY(0f);
}
});
return anim;
}
示例5: setDimVisibility
import android.animation.Animator; //导入方法依赖的package包/类
private void setDimVisibility(final boolean visible) {
Animator animator;
if (visible) {
dimView.setVisibility(VISIBLE);
animator = ObjectAnimator.ofFloat(dimView, "alpha", 0.0f, 1.0f);
} else {
animator = ObjectAnimator.ofFloat(dimView, "alpha", 1.0f, 0.0f);
}
animator.addListener(new AnimatorListenerAdapterProxy() {
@Override
public void onAnimationEnd(Animator animation) {
if (!visible) {
dimView.setVisibility(GONE);
}
}
});
animator.setDuration(200);
animator.start();
}
示例6: animateShowHideView
import android.animation.Animator; //导入方法依赖的package包/类
private void animateShowHideView(int index, final View view, boolean show) {
Animator animator = new LauncherViewPropertyAnimator(view).alpha(show ? 1 : 0).withLayer();
if (show) {
view.setVisibility(View.VISIBLE);
} else {
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
view.setVisibility(View.INVISIBLE);
}
});
}
startAnimator(index, animator, THRESHOLD_ANIM_DURATION);
}
示例7: setAnimatorEndAction
import android.animation.Animator; //导入方法依赖的package包/类
@SuppressLint("NewApi")
private void setAnimatorEndAction(Animator animator, final Runnable endAction) {
if (endAction != null) {
animator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
endAction.run();
}
});
}
}
示例8: hideCircularReveal
import android.animation.Animator; //导入方法依赖的package包/类
public static void hideCircularReveal(final Context context,
final View view,
final RevealAnimationSetting revealSettings,
final int startColor,
final int endColor,
final Dismissible.OnDismissedListener listener) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
int cx = revealSettings.getCenterX();
int cy = revealSettings.getCenterY();
int width = revealSettings.getWidth();
int height = revealSettings.getHeight();
int duration =
context.getResources().getInteger(android.R.integer.config_mediumAnimTime);
float initRadius = (float) Math.sqrt(width * width + height * height);
Animator anim = ViewAnimationUtils.createCircularReveal(view, cx, cy, initRadius, 0);
anim.setDuration(duration);
anim.setInterpolator(new FastOutSlowInInterpolator());
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
view.setVisibility(View.GONE);
listener.onDismissed();
}
});
anim.start();
recolorBackground(view, startColor, endColor, duration);
} else {
listener.onDismissed();
}
}
示例9: startAnimation
import android.animation.Animator; //导入方法依赖的package包/类
public static void startAnimation(WXSDKInstance mWXSDKInstance, WXComponent component,
@NonNull WXAnimationBean animationBean, @Nullable String callback) {
if(component == null){
return;
}
if (component.getHostView() == null) {
AnimationHolder holder = new AnimationHolder(animationBean, callback);
component.postAnimation(holder);
return;
}
try {
Animator animator = createAnimator(animationBean, component.getHostView(),mWXSDKInstance.getViewPortWidth());
if (animator != null) {
Animator.AnimatorListener animatorCallback = createAnimatorListener(mWXSDKInstance, callback);
if(Build.VERSION.SDK_INT<Build.VERSION_CODES.JELLY_BEAN_MR2) {
component.getHostView().setLayerType(View.LAYER_TYPE_HARDWARE, null);
}
Interpolator interpolator = createTimeInterpolator(animationBean);
if (animatorCallback != null) {
animator.addListener(animatorCallback);
}
if (interpolator != null) {
animator.setInterpolator(interpolator);
}
animator.setDuration(animationBean.duration);
animator.start();
}
} catch (RuntimeException e) {
e.printStackTrace();
WXLogUtils.e("", e);
}
}
示例10: hide
import android.animation.Animator; //导入方法依赖的package包/类
/**
* 由满向中间收缩,直到隐藏。
*/
@SuppressLint("NewApi")
public static void hide(final View myView, float endRadius, long durationMills) {
if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) {
myView.setVisibility(View.INVISIBLE);
return;
}
int cx = (myView.getLeft() + myView.getRight()) / 2;
int cy = (myView.getTop() + myView.getBottom()) / 2;
int w = myView.getWidth();
int h = myView.getHeight();
// 勾股定理 & 进一法
int initialRadius = (int) Math.sqrt(w * w + h * h) + 1;
Animator anim =
ViewAnimationUtils.createCircularReveal(myView, cx, cy, initialRadius, endRadius);
anim.setDuration(durationMills);
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
myView.setVisibility(View.INVISIBLE);
}
});
anim.start();
}
示例11: circleReveal
import android.animation.Animator; //导入方法依赖的package包/类
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
public void circleReveal(final boolean isShow) {
int width = toolbar.getWidth();
width -= (getResources().getDimensionPixelSize(R.dimen.abc_action_button_min_width_material) / 2);
int cx = width;
int cy = toolbar.getHeight() / 2;
Animator anim;
if (isShow)
anim = ViewAnimationUtils.createCircularReveal(searchToolbar, cx, cy, 0, (float) width);
else
anim = ViewAnimationUtils.createCircularReveal(searchToolbar, cx, cy, (float) width, 0);
anim.setDuration(250L);
// make the view invisible when the animation is done
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
if (!isShow) {
super.onAnimationEnd(animation);
searchToolbar.setVisibility(View.INVISIBLE);
}
}
});
// make the view visible and start the animation
if (isShow) {
searchToolbar.setVisibility(View.VISIBLE);
notifySearchExpanded();
} else {
notifySearchCallapsed();
}
// start the animation
anim.start();
}
示例12: showBottom
import android.animation.Animator; //导入方法依赖的package包/类
private void showBottom(View view, Animator.AnimatorListener listener) {
view.setVisibility(View.VISIBLE);
Animator iconAnim = ObjectAnimator.ofPropertyValuesHolder(view,
PropertyValuesHolder.ofFloat(View.TRANSLATION_Y, view.getHeight(), 0f));
iconAnim.setDuration(VIEW_ANIMATION);
iconAnim.addListener(listener);
iconAnim.start();
}
示例13: getPausePlayAnimator
import android.animation.Animator; //导入方法依赖的package包/类
public Animator getPausePlayAnimator() {
final Animator anim = ObjectAnimator.ofFloat(this, PROGRESS, mIsPlay ? 1 : 0, mIsPlay ? 0 : 1);
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
mIsPlay = !mIsPlay;
}
});
return anim;
}
示例14: createDismissAnimator
import android.animation.Animator; //导入方法依赖的package包/类
private Animator createDismissAnimator(final Key key, final KeyPreviewView keyPreviewView) {
final Animator dismissAnimator = mParams.createDismissAnimator(keyPreviewView);
dismissAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(final Animator animator) {
dismissKeyPreview(key, false /* withAnimation */);
}
});
return dismissAnimator;
}
示例15: onReveal
import android.animation.Animator; //导入方法依赖的package包/类
@OnClick(R.id.reveal)
public void onReveal() {
// get the center for the clipping circle
int cx = revealContainer.getWidth() / 2;
int cy = revealContainer.getHeight() / 2;
// get the radius for the clipping circle
float radius = (float) Math.hypot(cx, cy);
Animator anim;
if (animateForward) {
// create the animator for this view (the start radius is zero)
anim = ViewAnimationUtils.createCircularReveal(revealContainer, cx, cy, 0, radius);
// make the view visible and start the animation
revealContainer.setVisibility(View.VISIBLE);
} else {
// create the animation (the final radius is zero)
anim = ViewAnimationUtils.createCircularReveal(revealContainer, cx, cy, radius, 0);
// make the view invisible when the animation is done
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
super.onAnimationEnd(animation);
revealContainer.setVisibility(View.INVISIBLE);
}
});
}
anim.start();
animateForward = !animateForward;
}