@Test public void testStartAnimation() throws Exception { module.startAnimation(module.mWXSDKInstance,null,null,null); TestComponent comp = new TestComponent(module.mWXSDKInstance,new TestDomObject(),null); module.startAnimation(module.mWXSDKInstance,comp,null,null); WXAnimationBean animation = new WXAnimationBean(); module.startAnimation(module.mWXSDKInstance,comp,animation,null); animation.styles = new WXAnimationBean.Style(); module.startAnimation(module.mWXSDKInstance,comp,animation,null); }
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); } }
WXAnimationModule extends WXModule { 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); } } }
WXAnimationModule extends WXModule { 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); } }  }
WXAnimationModule extends WXModule { 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); } }  @JSMethod void transition(@Nullable String ref, @Nullable String animation, @Nullable String callBack); static void startAnimation(WXSDKInstance mWXSDKInstance, WXComponent component,
                                    @NonNull WXAnimationBean animationBean, @Nullable String callback); static @Nullable Animator.AnimatorListener createAnimatorListener(final WXSDKInstance mWXSDKInstance, @Nullable final String callBack); }
WXAnimationModule extends WXModule { 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); } }  @JSMethod void transition(@Nullable String ref, @Nullable String animation, @Nullable String callBack); static void startAnimation(WXSDKInstance mWXSDKInstance, WXComponent component,
                                    @NonNull WXAnimationBean animationBean, @Nullable String callback); static @Nullable Animator.AnimatorListener createAnimatorListener(final WXSDKInstance mWXSDKInstance, @Nullable final String callBack);  }