当前位置: 首页>>代码示例>>Java>>正文


Java Animator.addListener方法代码示例

本文整理汇总了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();
    }
}
 
开发者ID:TeamBrainStorm,项目名称:SimpleUILauncher,代码行数:18,代码来源:PagedView.java

示例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();
    }
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:19,代码来源:PagedView.java

示例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();
        }
    }
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:22,代码来源:NotificationFooterLayout.java

示例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;
}
 
开发者ID:xzg8023,项目名称:ArcLayout-master,代码行数:23,代码来源:DemoLikePathActivity.java

示例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();
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:20,代码来源:PhotoPaintView.java

示例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);
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:15,代码来源:PinchAnimationManager.java

示例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();
            }
        });
    }
}
 
开发者ID:sdrausty,项目名称:buildAPKsSamples,代码行数:12,代码来源:ListViewItemAnimations.java

示例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();
    }
}
 
开发者ID:interactiveservices,项目名称:utils-android,代码行数:32,代码来源:AnimUtils.java

示例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);
  }
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:33,代码来源:WXAnimationModule.java

示例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();
}
 
开发者ID:InnoFang,项目名称:FamilyBond,代码行数:32,代码来源:CircularAnimUtils.java

示例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();
}
 
开发者ID:UdiOshi85,项目名称:libSearchToolbar,代码行数:40,代码来源:SearchAnimationToolbar.java

示例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();
    }
 
开发者ID:PacktPublishing,项目名称:Expert-Android-Programming,代码行数:10,代码来源:SearchPlaceActivity.java

示例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;
}
 
开发者ID:dibakarece,项目名称:DMAudioStreamer,代码行数:11,代码来源:PlayPauseDrawable.java

示例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;
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:11,代码来源:KeyPreviewChoreographer.java

示例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;
}
 
开发者ID:zawadz88,项目名称:AnimationShowcase,代码行数:35,代码来源:RevealActivity.java


注:本文中的android.animation.Animator.addListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。