com.taobao.weex.ui.view.WXSwitchView Java Examples
The following examples show how to use
com.taobao.weex.ui.view.WXSwitchView.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: WXSwitchDomObject.java From ucar-weex-core with Apache License 2.0 | 6 votes |
@Override public void measure(CSSNode node, float width, MeasureOutput measureOutput) { try { Context context=((WXDomObject) node).getDomContext().getUIContext(); WXSwitchView wxSwitchView = new WXSwitchView(context); int widthSpec, heightSpec; heightSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED); if (Float.isNaN(width)) { widthSpec = MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED); } else { widthSpec = MeasureSpec.makeMeasureSpec((int) width, MeasureSpec.AT_MOST); } wxSwitchView.measure(widthSpec, heightSpec); measureOutput.width = wxSwitchView.getMeasuredWidth(); measureOutput.height = wxSwitchView.getMeasuredHeight(); } catch (RuntimeException e) { WXLogUtils.e(TAG, WXLogUtils.getStackTrace(e)); } }
Example #2
Source File: WXSwitchDomObject.java From weex-uikit with MIT License | 6 votes |
@Override public void measure(CSSNode node, float width, MeasureOutput measureOutput) { try { if (!measured) { WXSwitchView wxSwitchView = new WXSwitchView(((WXDomObject) node).getDomContext().getUIContext()); int heightSpec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED); int widthSpec = View.MeasureSpec.makeMeasureSpec((int) width, View.MeasureSpec.AT_MOST); wxSwitchView.measure(widthSpec, heightSpec); mWidth = wxSwitchView.getMeasuredWidth(); mHeight = wxSwitchView.getMeasuredHeight(); measured = true; } measureOutput.width = mWidth; measureOutput.height = mHeight; } catch (RuntimeException e) { WXLogUtils.e(TAG, WXLogUtils.getStackTrace(e)); } }
Example #3
Source File: WXSwitch.java From ucar-weex-core with Apache License 2.0 | 4 votes |
@Override protected WXSwitchView initComponentHostView(@NonNull Context context) { return new WXSwitchView(context); }
Example #4
Source File: WXSwitchTest.java From ucar-weex-core with Apache License 2.0 | 4 votes |
@Before public void setUp() throws Exception { component = create(); ComponentTest.create(component, Mockito.mock(WXSwitchView.class)); }
Example #5
Source File: WXSwitch.java From weex-uikit with MIT License | 4 votes |
@Override protected WXSwitchView initComponentHostView(@NonNull Context context) { return new WXSwitchView(context); }
Example #6
Source File: WXSwitchTest.java From weex-uikit with MIT License | 4 votes |
@Before public void setUp() throws Exception { component = create(); ComponentTest.create(component, Mockito.mock(WXSwitchView.class)); }
Example #7
Source File: WXSwitch.java From weex with Apache License 2.0 | 4 votes |
@Override protected void initView() { super.initView(); mHost = new WXSwitchView(mContext); getView().setTextSize(TypedValue.COMPLEX_UNIT_PX,22); }
Example #8
Source File: WXSwitch.java From weex with Apache License 2.0 | 4 votes |
@Override public WXSwitchView getView() { return (WXSwitchView) super.getView(); }