Java Code Examples for com.libra.Utils#isEL()

The following examples show how to use com.libra.Utils#isEL() . 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: ImageBase.java    From Virtualview-Android with MIT License 6 votes vote down vote up
@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 2
Source File: PicassoImage.java    From Virtualview-Android with MIT License 6 votes vote down vote up
@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 3
Source File: Parser.java    From virtualview_tools with MIT License 6 votes vote down vote up
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 4
Source File: TextBase.java    From Virtualview-Android with MIT License 5 votes vote down vote up
@Override
protected boolean setAttribute(int key, String stringValue) {
    boolean ret = super.setAttribute(key, stringValue);

    if (!ret) {
        switch (key) {
            case StringBase.STR_ID_text:
                if (Utils.isEL(stringValue)) {
                    mViewCache.put(this, StringBase.STR_ID_text, stringValue, Item.TYPE_STRING);
                } else {
                    mText = stringValue;
                }
                break;
            case StringBase.STR_ID_typeface:
                mTypeface = stringValue;
                break;
            case StringBase.STR_ID_textSize:
                mViewCache.put(this, StringBase.STR_ID_textSize, stringValue, Item.TYPE_FLOAT);
                break;
            case StringBase.STR_ID_textColor:
                mViewCache.put(this, StringBase.STR_ID_textColor, stringValue, Item.TYPE_COLOR);
                break;
            case StringBase.STR_ID_textStyle:
                mViewCache.put(this, StringBase.STR_ID_textStyle, stringValue, Item.TYPE_TEXT_STYLE);
                break;
            default:
                ret = false;
                break;
        }
    }
    return ret;
}
 
Example 5
Source File: TotalContainer.java    From Virtualview-Android with MIT License 5 votes vote down vote up
@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 6
Source File: TextBaseParser.java    From virtualview_tools with MIT License 5 votes vote down vote up
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 7
Source File: ViewBaseParser.java    From virtualview_tools with MIT License 5 votes vote down vote up
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 8
Source File: Parser.java    From virtualview_tools with MIT License 5 votes vote down vote up
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;
}
 
Example 9
Source File: Parser.java    From virtualview_tools with MIT License 5 votes vote down vote up
protected static boolean parseNumber(AttrItem value) {
    boolean ret = false;
    if (null != value && !TextUtils.isEmpty(value.mStrValue)) {
        String str = value.mStrValue.trim();
        ret = true;
        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;
            }
            try {
                if (str.indexOf('.') > 0) {
                    // float
                    value.setFloatValue(Float.parseFloat(str));
                } else {
                    // int
                    value.setIntValue(Integer.parseInt(str));
                }
            } catch (NumberFormatException e) {
                if (Utils.isEL(str)) {
                    value.setStr(str);
                    ret = true;
                } else {
                    Log.e(TAG, "parseNumber error:" + e);
                    ret = false;
                }
            }
        }
    } else {
        Log.e(TAG, "parseNumber value invalidate:" + value);
    }
    return ret;
}
 
Example 10
Source File: FloatValueParser.java    From virtualview_tools with MIT License 5 votes vote down vote up
public boolean parser(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: IntValueParser.java    From virtualview_tools with MIT License 5 votes vote down vote up
@Override
public boolean parser(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;
}
 
Example 12
Source File: AlignValueParser.java    From virtualview_tools with MIT License 5 votes vote down vote up
public boolean parser(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 13
Source File: TextStyleValueParser.java    From virtualview_tools with MIT License 5 votes vote down vote up
public boolean parser(Parser.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 if (TextUtils.equals("underline", str)) {
                   value |= TextBaseCommon.UNDERLINE;
               } else {
                   Log.e(TAG, "invalidate value:" + str);
                   ret = false;
                   break;
               }
           }

           if (ret) {
               item.setIntValue(value);
           }

       }

       return ret;
}
 
Example 14
Source File: NumberValueParser.java    From virtualview_tools with MIT License 5 votes vote down vote up
public boolean parser(AttrItem value) {
	boolean ret = false;
	if (null != value && !TextUtils.isEmpty(value.mStrValue)) {
		String str = value.mStrValue.trim();
		ret = true;
		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;
			}
			try {
				if (str.indexOf('.') > 0) {
					// float
					value.setFloatValue(Float.parseFloat(str));
				} else {
					// int
					value.setIntValue(Integer.parseInt(str));
				}
			} catch (NumberFormatException e) {
				if (Utils.isEL(str)) {
					value.setStr(str);
					ret = true;
				} else {
					Log.e(TAG, "parseNumber error:" + e);
					ret = false;
				}
			}
		}
	} else {
		Log.e(TAG, "parseNumber value invalidate:" + value);
	}
	return ret;
}
 
Example 15
Source File: ViewBaseParser.java    From virtualview_tools with MIT License 4 votes vote down vote up
public static boolean parseColor(AttrItem item) {
    boolean ret = true;

    int value = 0;
    String str = item.mStrValue;
    if (Utils.isEL(str)) {
        item.setStr(str);
    } else {
        try {
            if (TextUtils.equals("black", str)) {
                value = Color.BLACK;
            } else if (TextUtils.equals("blue", str)) {
                value = Color.BLUE;
            } else if (TextUtils.equals("cyan", str)) {
                value = Color.CYAN;
            } else if (TextUtils.equals("dkgray", str)) {
                value = Color.DKGRAY;
            } else if (TextUtils.equals("gray", str)) {
                value = Color.GRAY;
            } else if (TextUtils.equals("green", str)) {
                value = Color.GREEN;
            } else if (TextUtils.equals("ltgray", str)) {
                value = Color.LTGRAY;
            } else if (TextUtils.equals("magenta", str)) {
                value = Color.MAGENTA;
            } else if (TextUtils.equals("magenta", str)) {
                value = Color.MAGENTA;
            } else if (TextUtils.equals("red", str)) {
                value = Color.RED;
            } else if (TextUtils.equals("transparent", str)) {
                value = Color.TRANSPARENT;
            } else if (TextUtils.equals("yellow", str)) {
                value = Color.YELLOW;
            } else {
                value = Color.parseColor(str);
            }
        } catch (IllegalArgumentException e) {
            Log.e(TAG, "parseColor error:" + e + " string:" + str);
            ret = false;
        }
        if (ret) {
            item.setIntValue(value);
        }
    }
    return ret;
}
 
Example 16
Source File: ColorValueParser.java    From virtualview_tools with MIT License 4 votes vote down vote up
public boolean parser(Parser.AttrItem item){
	boolean ret = true;

       int value = 0;
       String str = item.mStrValue;
       if (Utils.isEL(str)) {
           item.setStr(str);
       } else {
           try {
               if (TextUtils.equals("black", str)) {
                   value = Color.BLACK;
               } else if (TextUtils.equals("blue", str)) {
                   value = Color.BLUE;
               } else if (TextUtils.equals("cyan", str)) {
                   value = Color.CYAN;
               } else if (TextUtils.equals("dkgray", str)) {
                   value = Color.DKGRAY;
               } else if (TextUtils.equals("gray", str)) {
                   value = Color.GRAY;
               } else if (TextUtils.equals("green", str)) {
                   value = Color.GREEN;
               } else if (TextUtils.equals("ltgray", str)) {
                   value = Color.LTGRAY;
               } else if (TextUtils.equals("magenta", str)) {
                   value = Color.MAGENTA;
               } else if (TextUtils.equals("magenta", str)) {
                   value = Color.MAGENTA;
               } else if (TextUtils.equals("red", str)) {
                   value = Color.RED;
               } else if (TextUtils.equals("transparent", str)) {
                   value = Color.TRANSPARENT;
               } else if (TextUtils.equals("yellow", str)) {
                   value = Color.YELLOW;
               } else if (TextUtils.equals("white", str)) {
                   value = Color.WHITE;
               } else {
                   value = Color.parseColor(str);
               }
           } catch (IllegalArgumentException e) {
               Log.e(TAG, "parseColor error:" + e + " string:" + str);
               ret = false;
           }
           if (ret) {
               item.setIntValue(value);
           }
       }
       return ret;
}