Ejemplo n.º 1
0
 public AnimationItem load(Element node) throws ScreenElementLoadException {
   try {
     mTime = Long.parseLong(node.getAttribute("time"));
   } catch (NumberFormatException numberformatexception) {
     Log.e(LOG_TAG, "fail to get time attribute");
     throw new ScreenElementLoadException("fail to get time attribute");
   }
   if (mAttrs != null) {
     mExps = new Expression[mAttrs.length];
     for (int i = 0; i < mAttrs.length; i++) {
       mExps[i] = Expression.build(node.getAttribute(mAttrs[i]));
     }
   }
   return this;
 }
Ejemplo n.º 2
0
 public ColorParser(String expression) {
   mColorExpression = expression.trim();
   if (mColorExpression.startsWith("#")) {
     mType = ExpressionType.CONST;
     try {
       mColor = Color.parseColor(mColorExpression);
     } catch (IllegalArgumentException e) {
       mColor = DEFAULT_COLOR;
     }
   } else if (mColorExpression.startsWith("@")) {
     mType = ExpressionType.VARIABLE;
   } else if (mColorExpression.startsWith("argb(") && mColorExpression.endsWith(")")) {
     mRGBExpression =
         Expression.buildMultiple(mColorExpression.substring(5, -1 + mColorExpression.length()));
     if (mRGBExpression.length == 4) {
       mType = ExpressionType.ARGB;
     } else {
       Log.e(LOG_TAG, "bad expression format");
       throw new IllegalArgumentException("bad expression format.");
     }
   } else {
     mType = ExpressionType.INVALID;
   }
 }