com.libra.Utils Java Examples
The following examples show how to use
com.libra.Utils.
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: GridLayout.java From Virtualview-Android with MIT License | 6 votes |
@Override protected boolean setRPAttribute(int key, float value) { boolean ret = super.setRPAttribute(key, value); if (!ret) { ret = true; switch (key) { case StringBase.STR_ID_itemHeight: mItemHeight = Utils.rp2px(value); break; case StringBase.STR_ID_itemHorizontalMargin: mItemHorizontalMargin = Utils.rp2px(value); break; case StringBase.STR_ID_itemVerticalMargin: mItemVerticalMargin = Utils.rp2px(value); break; default: ret = false; break; } } return ret; }
Example #2
Source File: NativeText.java From Virtualview-Android with MIT License | 6 votes |
@Override protected boolean setRPAttribute(int key, int value) { boolean ret = super.setRPAttribute(key, value); if (!ret) { ret = true; switch (key) { case StringBase.STR_ID_lineHeight: mLineHeight = Utils.rp2px(value); break; default: ret = false; break; } } return ret; }
Example #3
Source File: PicassoImage.java From Virtualview-Android with MIT License | 6 votes |
@Override protected boolean setAttribute(int key, String stringValue) { boolean ret = true; if (key == degreeId) { if (Utils.isEL(stringValue)) { mViewCache.put(this, degreeId, stringValue, Item.TYPE_FLOAT); } } else if (key == urlId) { if (Utils.isEL(stringValue)) { mViewCache.put(this, urlId, stringValue, Item.TYPE_STRING); } else { url = stringValue; } } else { ret = super.setAttribute(key, stringValue); } return ret; }
Example #4
Source File: TextBase.java From Virtualview-Android with MIT License | 6 votes |
@Override protected boolean setRPAttribute(int key, int value) { boolean ret = super.setRPAttribute(key, value); if (!ret) { ret = true; switch (key) { case StringBase.STR_ID_textSize: mTextSize = Utils.rp2px(value); break; default: ret = false; } } return ret; }
Example #5
Source File: NativeText.java From Virtualview-Android with MIT License | 6 votes |
@Override protected boolean setRPAttribute(int key, float value) { boolean ret = super.setRPAttribute(key, value); if (!ret) { ret = true; switch (key) { case StringBase.STR_ID_lineHeight: mLineHeight = Utils.rp2px(value); break; default: ret = false; break; } } return ret; }
Example #6
Source File: TextBase.java From Virtualview-Android with MIT License | 6 votes |
@Override protected boolean setRPAttribute(int key, float value) { boolean ret = super.setRPAttribute(key, value); if (!ret) { ret = true; switch (key) { case StringBase.STR_ID_textSize: mTextSize = Utils.rp2px(value); break; default: ret = false; } } return ret; }
Example #7
Source File: TextBase.java From Virtualview-Android with MIT License | 6 votes |
@Override protected boolean setAttribute(int key, float value) { boolean ret = super.setAttribute(key, value); if (!ret) { ret = true; switch (key) { case StringBase.STR_ID_textSize: mTextSize = Utils.dp2px(Math.round(value)); break; default: ret = false; } } return ret; }
Example #8
Source File: VirtualProgress.java From Virtualview-Android with MIT License | 6 votes |
@Override protected boolean setAttribute(int key, float value) { boolean ret = super.setAttribute(key, value); if (!ret) { ret = true; switch (key) { case StringBase.STR_ID_initValue: mInitPos = Utils.dp2px(value); break; default: ret = false; } } return ret; }
Example #9
Source File: GridLayout.java From Virtualview-Android with MIT License | 6 votes |
@Override protected boolean setRPAttribute(int key, int value) { boolean ret = super.setRPAttribute(key, value); if (!ret) { ret = true; switch (key) { case StringBase.STR_ID_itemHeight: mItemHeight = Utils.rp2px(value); break; case StringBase.STR_ID_itemHorizontalMargin: mItemHorizontalMargin = Utils.rp2px(value); break; case StringBase.STR_ID_itemVerticalMargin: mItemVerticalMargin = Utils.rp2px(value); break; default: ret = false; break; } } return ret; }
Example #10
Source File: Parser.java From virtualview_tools with MIT License | 6 votes |
protected static boolean parseFloat(AttrItem value) { boolean ret = false; if (null != value && !TextUtils.isEmpty(value.mStrValue)) { String str = value.mStrValue.trim(); if (str.endsWith(RP)) { str = str.substring(0, str.length() - 2); value.mExtra = AttrItem.EXTRA_RP; } try { // float value.setFloatValue(Float.parseFloat(str)); ret = true; } catch (NumberFormatException e) { if (Utils.isEL(str)) { value.setStr(str); ret = true; } else { Log.e(TAG, "parseFloat error:" + e); } } } else { Log.e(TAG, "parseFloat value invalidate:" + value); } return ret; }
Example #11
Source File: Grid.java From Virtualview-Android with MIT License | 6 votes |
@Override protected boolean setAttribute(int key, float value) { boolean ret = super.setAttribute(key, value); if (!ret) { ret = true; switch (key) { case StringBase.STR_ID_itemHeight: mNative.setItemHeight(Utils.dp2px(value)); break; case StringBase.STR_ID_itemHorizontalMargin: mNative.setItemHorizontalMargin(Utils.dp2px(value)); break; case StringBase.STR_ID_itemVerticalMargin: mNative.setItemVerticalMargin(Utils.dp2px(value)); break; default: ret = false; break; } } return ret; }
Example #12
Source File: LineBase.java From Virtualview-Android with MIT License | 6 votes |
@Override protected boolean setRPAttribute(int key, float value) { boolean ret = super.setRPAttribute(key, value); if (!ret) { ret = true; switch (key) { case StringBase.STR_ID_paintWidth: mLineWidth = Utils.rp2px(value); if (mLineWidth <= 0) { mLineWidth = 1; } break; default: ret = false; break; } } return ret; }
Example #13
Source File: LineBase.java From Virtualview-Android with MIT License | 6 votes |
@Override protected boolean setRPAttribute(int key, int value) { boolean ret = super.setRPAttribute(key, value); if (!ret) { ret = true; switch (key) { case StringBase.STR_ID_paintWidth: mLineWidth = Utils.rp2px(value); if (mLineWidth <= 0) { mLineWidth = 1; } break; default: ret = false; break; } } return ret; }
Example #14
Source File: LineBase.java From Virtualview-Android with MIT License | 6 votes |
@Override protected boolean setAttribute(int key, float value) { boolean ret = true; switch (key) { case StringBase.STR_ID_paintWidth: mLineWidth = Utils.dp2px(value); if (mLineWidth <= 0) { mLineWidth = 1; } break; default: ret = false; break; } return ret; }
Example #15
Source File: SliderCompact.java From Virtualview-Android with MIT License | 6 votes |
@Override protected boolean setRPAttribute(int key, int value) { boolean ret = super.setRPAttribute(key, value); if (!ret) { ret = true; switch (key) { case StringBase.STR_ID_span: mNative.setSpan(Utils.rp2px(value)); break; case StringBase.STR_ID_itemWidth: mNative.setItemWidth(Utils.rp2px(value)); break; default: ret = false; break; } } return ret; }
Example #16
Source File: SliderCompact.java From Virtualview-Android with MIT License | 6 votes |
@Override protected boolean setRPAttribute(int key, float value) { boolean ret = super.setRPAttribute(key, value); if (!ret) { ret = true; switch (key) { case StringBase.STR_ID_span: mNative.setSpan(Utils.rp2px(value)); break; case StringBase.STR_ID_itemWidth: mNative.setItemWidth(Utils.rp2px(value)); break; default: ret = false; break; } } return ret; }
Example #17
Source File: SliderCompact.java From Virtualview-Android with MIT License | 6 votes |
@Override protected boolean setAttribute(int key, float value) { boolean ret = super.setAttribute(key, value); if (!ret) { ret = true; switch (key) { case StringBase.STR_ID_span: mNative.setSpan(Utils.dp2px(value)); break; case StringBase.STR_ID_itemWidth: mNative.setItemWidth(Utils.dp2px(value)); break; default: ret = false; break; } } return ret; }
Example #18
Source File: GridLayout.java From Virtualview-Android with MIT License | 6 votes |
@Override protected boolean setAttribute(int key, float value) { boolean ret = super.setAttribute(key, value); if (!ret) { ret = true; switch (key) { case StringBase.STR_ID_itemHeight: mItemHeight = Utils.dp2px(Math.round(value)); break; case StringBase.STR_ID_itemHorizontalMargin: mItemHorizontalMargin = Utils.dp2px(value); break; case StringBase.STR_ID_itemVerticalMargin: mItemVerticalMargin = Utils.dp2px(value); break; default: ret = false; break; } } return ret; }
Example #19
Source File: ImageBase.java From Virtualview-Android with MIT License | 6 votes |
@Override protected boolean setAttribute(int key, String stringValue) { boolean ret = super.setAttribute(key, stringValue); if (!ret) { ret = true; switch (key) { case StringBase.STR_ID_src: if (Utils.isEL(stringValue)) { mViewCache.put(this, StringBase.STR_ID_src, stringValue, Item.TYPE_STRING); } else { mSrc = stringValue; } break; default: ret = false; } } return ret; }
Example #20
Source File: ExprCompiler.java From virtualview_tools with MIT License | 6 votes |
private boolean isSpace(String str) { boolean ret = true; if (!TextUtils.isEmpty(str)) { int len = str.length(); for (int i = 0; i < len; ++i) { char c = str.charAt(i); if (!Utils.isSpace(c)) { ret = false; break; } } } return ret; }
Example #21
Source File: Grid.java From Virtualview-Android with MIT License | 6 votes |
@Override protected boolean setRPAttribute(int key, int value) { boolean ret = true; switch (key) { case StringBase.STR_ID_itemHeight: mNative.setItemHeight(Utils.rp2px(value)); break; case StringBase.STR_ID_itemHorizontalMargin: mNative.setItemHorizontalMargin(Utils.rp2px(value)); break; case StringBase.STR_ID_itemVerticalMargin: mNative.setItemVerticalMargin(Utils.rp2px(value)); break; default: ret = super.setRPAttribute(key, value); break; } return ret; }
Example #22
Source File: Grid.java From Virtualview-Android with MIT License | 6 votes |
@Override protected boolean setRPAttribute(int key, float value) { boolean ret = true; switch (key) { case StringBase.STR_ID_itemHeight: mNative.setItemHeight(Utils.rp2px(value)); break; case StringBase.STR_ID_itemHorizontalMargin: mNative.setItemHorizontalMargin(Utils.rp2px(value)); break; case StringBase.STR_ID_itemVerticalMargin: mNative.setItemVerticalMargin(Utils.rp2px(value)); break; default: ret = super.setRPAttribute(key, value); break; } return ret; }
Example #23
Source File: Grid.java From Virtualview-Android with MIT License | 6 votes |
@Override protected boolean setAttribute(int key, int value) { boolean ret = true; switch (key) { case StringBase.STR_ID_colCount: mNative.setColumnCount(value); break; case StringBase.STR_ID_itemHeight: mNative.setItemHeight(Utils.dp2px(value)); break; case StringBase.STR_ID_itemHorizontalMargin: mNative.setItemHorizontalMargin(Utils.dp2px(value)); break; case StringBase.STR_ID_itemVerticalMargin: mNative.setItemVerticalMargin(Utils.dp2px(value)); break; default: ret = super.setAttribute(key, value); break; } return ret; }
Example #24
Source File: ViewCache.java From Virtualview-Android with MIT License | 5 votes |
public Item(ViewBase v, int key, String attrEL, int valueType) { mView = v; mKey = key; mAttrEL = attrEL; mValueType = valueType; if (mAttrEL != null) { if (Utils.isThreeUnknown(attrEL)) { mParser = new ThreeUnknownELParser(); mParser.compile(mAttrEL); } else { mParser = new SimpleELParser(); mParser.compile(mAttrEL); } } }
Example #25
Source File: GridLayout.java From Virtualview-Android with MIT License | 5 votes |
@Override protected boolean setAttribute(int key, int value) { boolean ret = super.setAttribute(key, value); if (!ret) { ret = true; switch (key) { case StringBase.STR_ID_colCount: mColCount = value; break; case StringBase.STR_ID_itemHeight: mItemHeight = Utils.dp2px(value); break; case StringBase.STR_ID_itemHorizontalMargin: mItemHorizontalMargin = Utils.dp2px(value); break; case StringBase.STR_ID_itemVerticalMargin: mItemVerticalMargin = Utils.dp2px(value); break; default: ret = false; break; } } return ret; }
Example #26
Source File: VH.java From Virtualview-Android with MIT License | 5 votes |
@Override protected boolean setAttribute(int key, float value) { boolean ret = super.setAttribute(key, value); if (!ret) { ret = true; switch (key) { case StringBase.STR_ID_itemWidth: mNative.setItemWidth(Utils.dp2px(value)); break; case StringBase.STR_ID_itemHeight: mNative.setItemHeight(Utils.dp2px(value)); break; case StringBase.STR_ID_itemMargin: mNative.setItemMargin(Utils.dp2px(value)); break; default: ret = false; break; } } return ret; }
Example #27
Source File: TotalContainer.java From Virtualview-Android with MIT License | 5 votes |
@Override protected boolean setAttribute(int key, String stringValue) { boolean ret = true; if (key == mNativeId) { if (Utils.isEL(stringValue)) { mViewCache.put(this, key, stringValue, ViewCache.Item.TYPE_STRING); } else { mNativeViewName = stringValue; parseView(); } }else { ret = super.setAttribute(key, stringValue); } return ret; }
Example #28
Source File: TextBaseParser.java From virtualview_tools with MIT License | 5 votes |
protected static boolean parseTextStyle(AttrItem item) { boolean ret = true; if (Utils.isEL(item.mStrValue)) { item.setStr(item.mStrValue); } else { int value = 0; String[] strs = item.mStrValue.split("\\|"); for (String str : strs) { str = str.trim(); if (TextUtils.equals("bold", str)) { value |= TextBaseCommon.BOLD; } else if (TextUtils.equals("italic", str)) { value |= TextBaseCommon.ITALIC; } else if (TextUtils.equals("strike", str)) { value |= TextBaseCommon.STRIKE; } else { Log.e(TAG, "invalidate value:" + str); ret = false; break; } } if (ret) { item.setIntValue(value); } } return ret; }
Example #29
Source File: ViewBaseParser.java From virtualview_tools with MIT License | 5 votes |
protected static boolean parseAlign(AttrItem item) { boolean ret = true; if (Utils.isEL(item.mStrValue)) { item.setStr(item.mStrValue); } else { int value = 0; String[] strArr = item.mStrValue.split("\\|"); for (String str : strArr) { str = str.trim(); if (TextUtils.equals("left", str)) { value |= ViewBaseCommon.LEFT; } else if (TextUtils.equals("right", str)) { value |= ViewBaseCommon.RIGHT; } else if (TextUtils.equals("h_center", str)) { value |= ViewBaseCommon.H_CENTER; } else if (TextUtils.equals("top", str)) { value |= ViewBaseCommon.TOP; } else if (TextUtils.equals("bottom", str)) { value |= ViewBaseCommon.BOTTOM; } else if (TextUtils.equals("v_center", str)) { value |= ViewBaseCommon.V_CENTER; } else { Log.e(TAG, "invalidate value:" + str); ret = false; break; } } if (ret) { item.setIntValue(value); } } return ret; }
Example #30
Source File: Parser.java From virtualview_tools with MIT License | 5 votes |
protected static boolean parseInteger(AttrItem value) { boolean ret = false; if (null != value && !TextUtils.isEmpty(value.mStrValue)) { String str = value.mStrValue.trim(); try { // int if (str.equals("true")) { value.setIntValue(1); } else if (str.equals("false")) { value.setIntValue(0); } else { if (str.endsWith(RP)) { str = str.substring(0, str.length() - 2); value.mExtra = AttrItem.EXTRA_RP; } value.setIntValue(Integer.parseInt(str)); } ret = true; } catch (NumberFormatException e) { if (Utils.isEL(str)) { value.setStr(str); ret = true; } else { Log.e(TAG, "parseInteger error:" + e); } } } else { Log.e(TAG, "parseInteger value invalidate:" + value); } return ret; }