Search in sources :

Example 1 with WXEvent

use of com.taobao.weex.dom.WXEvent in project weex-example by KalicyZhou.

the class WXDivTest method setUp.

@Before
public void setUp() throws Exception {
    WXSDKInstance instance = Mockito.mock(WXSDKInstance.class);
    Mockito.when(instance.getContext()).thenReturn(RuntimeEnvironment.application);
    WXDomObject divDom = new WXDomObject();
    WXDomObject spy = Mockito.spy(divDom);
    Mockito.when(spy.getPadding()).thenReturn(new Spacing());
    Mockito.when(spy.getEvents()).thenReturn(new WXEvent());
    Mockito.when(spy.clone()).thenReturn(divDom);
    TestDomObject.setRef(divDom, "1");
    mWXDiv = new WXDiv(instance, divDom, null);
    mWXDiv.initView();
}
Also used : WXSDKInstance(com.taobao.weex.WXSDKInstance) WXDomObject(com.taobao.weex.dom.WXDomObject) WXEvent(com.taobao.weex.dom.WXEvent) Spacing(com.taobao.weex.dom.flex.Spacing) Before(org.junit.Before)

Example 2 with WXEvent

use of com.taobao.weex.dom.WXEvent in project weex-example by KalicyZhou.

the class WXSDKInstance method onBackPressed.

public boolean onBackPressed() {
    WXComponent comp = getRootComponent();
    if (comp != null) {
        WXEvent events = comp.getDomObject().getEvents();
        boolean hasBackPressed = events.contains(Constants.Event.CLICKBACKITEM);
        if (hasBackPressed) {
            WXBridgeManager.getInstance().fireEvent(this.mInstanceId, comp.getRef(), Constants.Event.CLICKBACKITEM, null, null);
        }
        return hasBackPressed;
    }
    return false;
}
Also used : WXComponent(com.taobao.weex.ui.component.WXComponent) WXEvent(com.taobao.weex.dom.WXEvent)

Aggregations

WXEvent (com.taobao.weex.dom.WXEvent)2 WXSDKInstance (com.taobao.weex.WXSDKInstance)1 WXDomObject (com.taobao.weex.dom.WXDomObject)1 Spacing (com.taobao.weex.dom.flex.Spacing)1 WXComponent (com.taobao.weex.ui.component.WXComponent)1 Before (org.junit.Before)1