@Test public void testAddEvent() throws Exception { component.addEvent(Constants.Event.FOCUS); }
public void addEvent(String type) { if (TextUtils.isEmpty(type)) { return; } mAppendEvents.add(type); View view = getRealView(); if (type.equals(Constants.Event.CLICK) && view != null) { addClickListener(mClickEventListener); } else if ((type.equals( Constants.Event.FOCUS) || type.equals( Constants.Event.BLUR)) ) { addFocusChangeListener(new OnFocusChangeListener() { public void onFocusChange(boolean hasFocus) { Map<String, Object> params = new HashMap<>(); params.put("timeStamp", System.currentTimeMillis()); fireEvent(hasFocus ? Constants.Event.FOCUS : Constants.Event.BLUR, params); } }); } else if (view != null && needGestureDetector(type)) { if (view instanceof WXGestureObservable) { if (wxGesture == null) { wxGesture = new WXGesture(this, mContext); } mGestureType.add(type); ((WXGestureObservable) view).registerGestureListener(wxGesture); } else { WXLogUtils.e(view.getClass().getSimpleName() + " don't implement " + "WXGestureObservable, so no gesture is supported."); } } else { Scrollable scroller = getParentScroller(); if (type.equals(Constants.Event.APPEAR) && scroller != null) { scroller.bindAppearEvent(this); } if (type.equals(Constants.Event.DISAPPEAR) && scroller != null) { scroller.bindDisappearEvent(this); } } }
WXComponent implements IWXObject, IWXActivityStateListener,OnActivePseudoListner { public void addEvent(String type) { if (TextUtils.isEmpty(type)) { return; } mAppendEvents.add(type); View view = getRealView(); if (type.equals(Constants.Event.CLICK) && view != null) { addClickListener(mClickEventListener); } else if ((type.equals( Constants.Event.FOCUS) || type.equals( Constants.Event.BLUR)) ) { addFocusChangeListener(new OnFocusChangeListener() { public void onFocusChange(boolean hasFocus) { Map<String, Object> params = new HashMap<>(); params.put("timeStamp", System.currentTimeMillis()); fireEvent(hasFocus ? Constants.Event.FOCUS : Constants.Event.BLUR, params); } }); } else if (view != null && needGestureDetector(type)) { if (view instanceof WXGestureObservable) { if (wxGesture == null) { wxGesture = new WXGesture(this, mContext); } mGestureType.add(type); ((WXGestureObservable) view).registerGestureListener(wxGesture); } else { WXLogUtils.e(view.getClass().getSimpleName() + " don't implement " + "WXGestureObservable, so no gesture is supported."); } } else { Scrollable scroller = getParentScroller(); if (type.equals(Constants.Event.APPEAR) && scroller != null) { scroller.bindAppearEvent(this); } if (type.equals(Constants.Event.DISAPPEAR) && scroller != null) { scroller.bindDisappearEvent(this); } } } }
WXComponent implements IWXObject, IWXActivityStateListener,OnActivePseudoListner { public void addEvent(String type) { if (TextUtils.isEmpty(type)) { return; } mAppendEvents.add(type); View view = getRealView(); if (type.equals(Constants.Event.CLICK) && view != null) { addClickListener(mClickEventListener); } else if ((type.equals( Constants.Event.FOCUS) || type.equals( Constants.Event.BLUR)) ) { addFocusChangeListener(new OnFocusChangeListener() { public void onFocusChange(boolean hasFocus) { Map<String, Object> params = new HashMap<>(); params.put("timeStamp", System.currentTimeMillis()); fireEvent(hasFocus ? Constants.Event.FOCUS : Constants.Event.BLUR, params); } }); } else if (view != null && needGestureDetector(type)) { if (view instanceof WXGestureObservable) { if (wxGesture == null) { wxGesture = new WXGesture(this, mContext); } mGestureType.add(type); ((WXGestureObservable) view).registerGestureListener(wxGesture); } else { WXLogUtils.e(view.getClass().getSimpleName() + " don't implement " + "WXGestureObservable, so no gesture is supported."); } } else { Scrollable scroller = getParentScroller(); if (type.equals(Constants.Event.APPEAR) && scroller != null) { scroller.bindAppearEvent(this); } if (type.equals(Constants.Event.DISAPPEAR) && scroller != null) { scroller.bindDisappearEvent(this); } } } @Deprecated  WXComponent(WXSDKInstance instance, WXDomObject dom, WXVContainer parent, String instanceId, boolean isLazy); @Deprecated  WXComponent(WXSDKInstance instance, WXDomObject dom, WXVContainer parent, boolean isLazy);  WXComponent(WXSDKInstance instance, WXDomObject dom, WXVContainer parent); }
WXComponent implements IWXObject, IWXActivityStateListener,OnActivePseudoListner { public void addEvent(String type) { if (TextUtils.isEmpty(type)) { return; } mAppendEvents.add(type); View view = getRealView(); if (type.equals(Constants.Event.CLICK) && view != null) { addClickListener(mClickEventListener); } else if ((type.equals( Constants.Event.FOCUS) || type.equals( Constants.Event.BLUR)) ) { addFocusChangeListener(new OnFocusChangeListener() { public void onFocusChange(boolean hasFocus) { Map<String, Object> params = new HashMap<>(); params.put("timeStamp", System.currentTimeMillis()); fireEvent(hasFocus ? Constants.Event.FOCUS : Constants.Event.BLUR, params); } }); } else if (view != null && needGestureDetector(type)) { if (view instanceof WXGestureObservable) { if (wxGesture == null) { wxGesture = new WXGesture(this, mContext); } mGestureType.add(type); ((WXGestureObservable) view).registerGestureListener(wxGesture); } else { WXLogUtils.e(view.getClass().getSimpleName() + " don't implement " + "WXGestureObservable, so no gesture is supported."); } } else { Scrollable scroller = getParentScroller(); if (type.equals(Constants.Event.APPEAR) && scroller != null) { scroller.bindAppearEvent(this); } if (type.equals(Constants.Event.DISAPPEAR) && scroller != null) { scroller.bindDisappearEvent(this); } } } @Deprecated  WXComponent(WXSDKInstance instance, WXDomObject dom, WXVContainer parent, String instanceId, boolean isLazy); @Deprecated  WXComponent(WXSDKInstance instance, WXDomObject dom, WXVContainer parent, boolean isLazy);  WXComponent(WXSDKInstance instance, WXDomObject dom, WXVContainer parent); void postAnimation(WXAnimationModule.AnimationHolder holder); String getInstanceId(); Rect getComponentSize(); final void invoke(String method, JSONArray args); void bindHolder(IFComponentHolder holder); WXSDKInstance getInstance(); Context getContext(); final void fireEvent(String type); final void fireEvent(String type, Map<String, Object> params); boolean isLazy(); void applyLayoutAndEvent(WXComponent component); void bindData(WXComponent component); void refreshData(WXComponent component); final void setLayout(ImmutableDomObject domObject); int getLayoutTopOffsetForSibling(); void setPadding(Spacing padding, Spacing border); void updateExtra(Object extra); ImmutableDomObject getDomObject(); void updateProperties(Map<String, Object> props); void addEvent(String type); View getRealView(); Scrollable getParentScroller(); WXVContainer getParent(); String getRef(); final void createView(); T getHostView(); @Deprecated View getView(); int getAbsoluteY(); int getAbsoluteX(); void updateDom(WXDomObject dom); final void removeEvent(String type); final void removeAllEvent(); final void removeStickyStyle(); boolean isSticky(); void setDisabled(boolean disabled); void setSticky(String sticky); void setBackgroundColor(String color); void setBackgroundImage(String bgImage); void setOpacity(float opacity); void setBorderRadius(String key, float borderRadius); void setBorderWidth(String key, float borderWidth); void setBorderStyle(String key, String borderStyle); void setBorderColor(String key, String borderColor); @Nullable String getVisibility(); void setVisibility(String visibility); @Deprecated void registerActivityStateListener(); void onActivityCreate(); void onActivityStart(); void onActivityPause(); void onActivityResume(); void onActivityStop(); void onActivityDestroy(); boolean onActivityBack(); void onActivityResult(int requestCode, int resultCode, Intent data); boolean onCreateOptionsMenu(Menu menu); void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults); void destroy(); View detachViewAndClearPreInfo(); void computeVisiblePointInViewCoordinate(PointF pointF); boolean containsGesture(WXGestureType WXGestureType); void notifyAppearStateChange(String wxEventType,String direction); boolean isUsing(); void setUsing(boolean using); void readyToRender(); boolean isVirtualComponent(); void removeVirtualComponent(); boolean hasScrollParent(WXComponent component); @Override void updateActivePseudo(boolean isSet); }
WXComponent implements IWXObject, IWXActivityStateListener,OnActivePseudoListner { public void addEvent(String type) { if (TextUtils.isEmpty(type)) { return; } mAppendEvents.add(type); View view = getRealView(); if (type.equals(Constants.Event.CLICK) && view != null) { addClickListener(mClickEventListener); } else if ((type.equals( Constants.Event.FOCUS) || type.equals( Constants.Event.BLUR)) ) { addFocusChangeListener(new OnFocusChangeListener() { public void onFocusChange(boolean hasFocus) { Map<String, Object> params = new HashMap<>(); params.put("timeStamp", System.currentTimeMillis()); fireEvent(hasFocus ? Constants.Event.FOCUS : Constants.Event.BLUR, params); } }); } else if (view != null && needGestureDetector(type)) { if (view instanceof WXGestureObservable) { if (wxGesture == null) { wxGesture = new WXGesture(this, mContext); } mGestureType.add(type); ((WXGestureObservable) view).registerGestureListener(wxGesture); } else { WXLogUtils.e(view.getClass().getSimpleName() + " don't implement " + "WXGestureObservable, so no gesture is supported."); } } else { Scrollable scroller = getParentScroller(); if (type.equals(Constants.Event.APPEAR) && scroller != null) { scroller.bindAppearEvent(this); } if (type.equals(Constants.Event.DISAPPEAR) && scroller != null) { scroller.bindDisappearEvent(this); } } } @Deprecated  WXComponent(WXSDKInstance instance, WXDomObject dom, WXVContainer parent, String instanceId, boolean isLazy); @Deprecated  WXComponent(WXSDKInstance instance, WXDomObject dom, WXVContainer parent, boolean isLazy);  WXComponent(WXSDKInstance instance, WXDomObject dom, WXVContainer parent); void postAnimation(WXAnimationModule.AnimationHolder holder); String getInstanceId(); Rect getComponentSize(); final void invoke(String method, JSONArray args); void bindHolder(IFComponentHolder holder); WXSDKInstance getInstance(); Context getContext(); final void fireEvent(String type); final void fireEvent(String type, Map<String, Object> params); boolean isLazy(); void applyLayoutAndEvent(WXComponent component); void bindData(WXComponent component); void refreshData(WXComponent component); final void setLayout(ImmutableDomObject domObject); int getLayoutTopOffsetForSibling(); void setPadding(Spacing padding, Spacing border); void updateExtra(Object extra); ImmutableDomObject getDomObject(); void updateProperties(Map<String, Object> props); void addEvent(String type); View getRealView(); Scrollable getParentScroller(); WXVContainer getParent(); String getRef(); final void createView(); T getHostView(); @Deprecated View getView(); int getAbsoluteY(); int getAbsoluteX(); void updateDom(WXDomObject dom); final void removeEvent(String type); final void removeAllEvent(); final void removeStickyStyle(); boolean isSticky(); void setDisabled(boolean disabled); void setSticky(String sticky); void setBackgroundColor(String color); void setBackgroundImage(String bgImage); void setOpacity(float opacity); void setBorderRadius(String key, float borderRadius); void setBorderWidth(String key, float borderWidth); void setBorderStyle(String key, String borderStyle); void setBorderColor(String key, String borderColor); @Nullable String getVisibility(); void setVisibility(String visibility); @Deprecated void registerActivityStateListener(); void onActivityCreate(); void onActivityStart(); void onActivityPause(); void onActivityResume(); void onActivityStop(); void onActivityDestroy(); boolean onActivityBack(); void onActivityResult(int requestCode, int resultCode, Intent data); boolean onCreateOptionsMenu(Menu menu); void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults); void destroy(); View detachViewAndClearPreInfo(); void computeVisiblePointInViewCoordinate(PointF pointF); boolean containsGesture(WXGestureType WXGestureType); void notifyAppearStateChange(String wxEventType,String direction); boolean isUsing(); void setUsing(boolean using); void readyToRender(); boolean isVirtualComponent(); void removeVirtualComponent(); boolean hasScrollParent(WXComponent component); @Override void updateActivePseudo(boolean isSet); static final String PROP_FIXED_SIZE; static final String PROP_FS_MATCH_PARENT; static final String PROP_FS_WRAP_CONTENT; static int mComponentNum; }