Exemple #1
0
 @Override
 public boolean fillTypedValue(String data, TypedValue typedValue) {
   try {
     typedValue.type = TypedValue.TYPE_INT_COLOR_ARGB8;
     typedValue.data = ResourceHelper.getColor(data);
     typedValue.assetCookie = 0;
     return true;
   } catch (NumberFormatException nfe) {
     return false;
   }
 }
  @Override
  public int getColor(int id) throws NotFoundException {
    IResourceValue value = getResourceValue(id, mPlatformResourceFlag);

    if (value != null) {
      try {
        return ResourceHelper.getColor(value.getValue());
      } catch (NumberFormatException e) {
        return 0;
      }
    }

    // id was not found or not resolved. Throw a NotFoundException.
    throwException(id);

    // this is not used since the method above always throws
    return 0;
  }
Exemple #3
0
 @Override
 public int asInt(TypedResource typedResource) {
   return ResourceHelper.getColor(typedResource.asString().trim());
 }