Search in sources :

Example 1 with WXEditText

use of com.taobao.weex.ui.view.WXEditText in project weex-example by KalicyZhou.

the class EditComponentTest method testEvent.

@Test
public void testEvent() throws Exception {
    WXEditText view = component.getHostView();
    view.performClick();
    view.setText("");
    view.requestFocus();
    view.setText("hello");
    view.clearFocus();
    view.setText(null);
}
Also used : WXEditText(com.taobao.weex.ui.view.WXEditText) Test(org.junit.Test) WXSDKInstanceTest(com.taobao.weex.WXSDKInstanceTest) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest)

Example 2 with WXEditText

use of com.taobao.weex.ui.view.WXEditText in project weex-example by KalicyZhou.

the class AbstractEditComponent method initComponentHostView.

@Override
protected WXEditText initComponentHostView(@NonNull Context context) {
    final WXEditText inputView = new WXEditText(context);
    appleStyleAfterCreated(inputView);
    return inputView;
}
Also used : WXEditText(com.taobao.weex.ui.view.WXEditText)

Example 3 with WXEditText

use of com.taobao.weex.ui.view.WXEditText in project weex-example by KalicyZhou.

the class AbstractEditComponent method setValue.

@WXComponentProp(name = Constants.Name.VALUE)
public void setValue(String value) {
    WXEditText view;
    if ((view = getHostView()) == null) {
        return;
    }
    view.setText(value);
    view.setSelection(value == null ? 0 : value.length());
}
Also used : WXEditText(com.taobao.weex.ui.view.WXEditText)

Example 4 with WXEditText

use of com.taobao.weex.ui.view.WXEditText in project weex-example by KalicyZhou.

the class AbstractEditComponent method focus.

@JSMethod
public void focus() {
    WXEditText host = getHostView();
    if (host != null && !host.hasFocus()) {
        if (getParent() != null) {
            getParent().ignoreFocus();
        }
        host.requestFocus();
        host.setFocusable(true);
        host.setFocusableInTouchMode(true);
        showSoftKeyboard();
    }
}
Also used : WXEditText(com.taobao.weex.ui.view.WXEditText) JSMethod(com.taobao.weex.annotation.JSMethod)

Example 5 with WXEditText

use of com.taobao.weex.ui.view.WXEditText in project weex-example by KalicyZhou.

the class AbstractEditComponent method blur.

@JSMethod
public void blur() {
    WXEditText host = getHostView();
    if (host != null && host.hasFocus()) {
        if (getParent() != null) {
            getParent().interceptFocus();
        }
        host.clearFocus();
        hideSoftKeyboard();
    }
}
Also used : WXEditText(com.taobao.weex.ui.view.WXEditText) JSMethod(com.taobao.weex.annotation.JSMethod)

Aggregations

WXEditText (com.taobao.weex.ui.view.WXEditText)6 JSMethod (com.taobao.weex.annotation.JSMethod)2 WXSDKInstanceTest (com.taobao.weex.WXSDKInstanceTest)1 Test (org.junit.Test)1 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)1