Java Code Examples for com.taobao.weex.utils.WXUtils#getInteger()

The following examples show how to use com.taobao.weex.utils.WXUtils#getInteger() . 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: WXScroller.java    From ucar-weex-core with Apache License 2.0 6 votes vote down vote up
@Override
protected boolean setProperty(String key, Object param) {
  switch (key) {
    case Constants.Name.SHOW_SCROLLBAR:
      Boolean result = WXUtils.getBoolean(param,null);
      if (result != null)
        setShowScrollbar(result);
      return true;
    case Constants.Name.SCROLLABLE:
      boolean scrollable = WXUtils.getBoolean(param, true);
      setScrollable(scrollable);
      return true;
    case Constants.Name.OFFSET_ACCURACY:
      int accuracy = WXUtils.getInteger(param, 10);
      setOffsetAccuracy(accuracy);
      return true;
  }
  return super.setProperty(key, param);
}
 
Example 2
Source File: WXIndicator.java    From ucar-weex-core with Apache License 2.0 6 votes vote down vote up
@Override
protected boolean setProperty(String key, Object param) {
  switch (key) {
    case Constants.Name.ITEM_COLOR:
      String item_color = WXUtils.getString(param,null);
      if (item_color != null)
        setItemColor(item_color);
      return true;
    case Constants.Name.ITEM_SELECTED_COLOR:
      String selected_color = WXUtils.getString(param,null);
      if (selected_color != null)
        setItemSelectedColor(selected_color);
      return true;
    case Constants.Name.ITEM_SIZE:
      Integer item_size = WXUtils.getInteger(param,null);
      if (item_size != null)
        setItemSize(item_size);
      return true;
  }
  return super.setProperty(key, param);
}
 
Example 3
Source File: BasicListComponent.java    From ucar-weex-core with Apache License 2.0 6 votes vote down vote up
@Override
protected boolean setProperty(String key, Object param) {
  switch (key) {
    case LOADMOREOFFSET:
      return true;
    case Constants.Name.SCROLLABLE:
      boolean scrollable = WXUtils.getBoolean(param, true);
      setScrollable(scrollable);
      return true;
    case Constants.Name.OFFSET_ACCURACY:
      int accuracy = WXUtils.getInteger(param, 10);
      setOffsetAccuracy(accuracy);
      return true;
    case Constants.Name.DRAGGABLE:
      boolean draggable = WXUtils.getBoolean(param,false);
      setDraggable(draggable);
      return true;
  }
  return super.setProperty(key, param);
}
 
Example 4
Source File: WXIndicator.java    From weex-uikit with MIT License 6 votes vote down vote up
@Override
protected boolean setProperty(String key, Object param) {
  switch (key) {
    case Constants.Name.ITEM_COLOR:
      String item_color = WXUtils.getString(param,null);
      if (item_color != null)
        setItemColor(item_color);
      return true;
    case Constants.Name.ITEM_SELECTED_COLOR:
      String selected_color = WXUtils.getString(param,null);
      if (selected_color != null)
        setItemSelectedColor(selected_color);
      return true;
    case Constants.Name.ITEM_SIZE:
      Integer item_size = WXUtils.getInteger(param,null);
      if (item_size != null)
        setItemSize(item_size);
      return true;
  }
  return super.setProperty(key, param);
}
 
Example 5
Source File: Textarea.java    From ucar-weex-core with Apache License 2.0 5 votes vote down vote up
@Override
protected boolean setProperty(String key, Object param) {
  switch (key) {
    case Constants.Name.ROWS:
      Integer rows = WXUtils.getInteger(param,null);
      if (rows != null)
        setRows(rows);
      return true;
  }
  return super.setProperty(key, param);
}
 
Example 6
Source File: Textarea.java    From weex-uikit with MIT License 5 votes vote down vote up
@Override
protected boolean setProperty(String key, Object param) {
  switch (key) {
    case Constants.Name.ROWS:
      Integer rows = WXUtils.getInteger(param,null);
      if (rows != null)
        setRows(rows);
      return true;
  }
  return super.setProperty(key, param);
}
 
Example 7
Source File: WXImage.java    From ucar-weex-core with Apache License 2.0 4 votes vote down vote up
@Override
public Integer map(String raw) {
  return WXUtils.getInteger(raw,0);
}
 
Example 8
Source File: WXSlider.java    From ucar-weex-core with Apache License 2.0 4 votes vote down vote up
@Override
protected boolean setProperty(String key, Object param) {
  switch (key) {
    case Constants.Name.VALUE:
      String value = WXUtils.getString(param, null);
      if (value != null) {
        setValue(value);
      }
      return true;
    case Constants.Name.AUTO_PLAY:
      String aotu_play = WXUtils.getString(param, null);
      if (aotu_play != null) {
        setAutoPlay(aotu_play);
      }
      return true;
    case Constants.Name.SHOW_INDICATORS:
      String indicators = WXUtils.getString(param, null);
      if (indicators != null) {
        setShowIndicators(indicators);
      }
      return true;
    case Constants.Name.INTERVAL:
      Integer interval = WXUtils.getInteger(param, null);
      if (interval != null) {
        setInterval(interval);
      }
      return true;
    case Constants.Name.INDEX:
      Integer index = WXUtils.getInteger(param, null);
      if (index != null) {
        setIndex(index);
      }
      return true;
    case Constants.Name.OFFSET_X_ACCURACY:
      Float accuracy = WXUtils.getFloat(param, 0.1f);
      if (accuracy != 0) {
        setOffsetXAccuracy(accuracy);
      }
      return true;
    case Constants.Name.SCROLLABLE:
      boolean scrollable = WXUtils.getBoolean(param, true);
      setScrollable(scrollable);
      return true;
  }
  return super.setProperty(key, param);
}
 
Example 9
Source File: AbstractEditComponent.java    From ucar-weex-core with Apache License 2.0 4 votes vote down vote up
@Override
protected boolean setProperty(String key, Object param) {
  switch (key) {
    case Constants.Name.PLACEHOLDER:
      String placeholder = WXUtils.getString(param,null);
      if (placeholder != null)
        setPlaceholder(placeholder);
      return true;
    case Constants.Name.PLACEHOLDER_COLOR:
      String placeholder_color = WXUtils.getString(param,null);
      if (placeholder_color != null)
        setPlaceholderColor(placeholder_color);
      return true;
    case Constants.Name.TYPE:
      String input_type = WXUtils.getString(param,null);
      if (input_type != null)
        setType(input_type);
      return true;
    case Constants.Name.AUTOFOCUS:
      Boolean result = WXUtils.getBoolean(param, null);
      if (result != null)
        setAutofocus(result);
      return true;
    case Constants.Name.COLOR:
      String color = WXUtils.getString(param,null);
      if (color != null)
        setColor(color);
      return true;
    case Constants.Name.FONT_SIZE:
      String fontsize = WXUtils.getString(param,null);
      if (fontsize != null)
        setFontSize(fontsize);
      return true;
    case Constants.Name.TEXT_ALIGN:
      String text_align = WXUtils.getString(param,null);
      if (text_align != null)
        setTextAlign(text_align);
      return true;
    case Constants.Name.SINGLELINE:
      Boolean singLineResult = WXUtils.getBoolean(param, null);
      if (singLineResult != null)
        setSingleLine(singLineResult);
      return true;
    case Constants.Name.LINES:
      Integer lines = WXUtils.getInteger(param, null);
      if (lines != null)
        setLines(lines);
      return true;
    case Constants.Name.MAX_LENGTH:
      Integer maxlength = WXUtils.getInteger(param, null);
      if (maxlength != null)
        setMaxLength(maxlength);
      return true;
    case Constants.Name.MAXLENGTH:
      Integer maxLength = WXUtils.getInteger(param, null);
      if (maxLength != null)
        setMaxLength(maxLength);
      return true;
    case Constants.Name.MAX:
      setMax(String.valueOf(param));
      return true;
    case Constants.Name.MIN:
      setMin(String.valueOf(param));
      return true;
    case Constants.Name.RETURN_KEY_TYPE:
      setReturnKeyType(String.valueOf(param));
      return true;
  }
  return super.setProperty(key, param);
}
 
Example 10
Source File: WXSlider.java    From weex-uikit with MIT License 4 votes vote down vote up
@Override
protected boolean setProperty(String key, Object param) {
  switch (key) {
    case Constants.Name.VALUE:
      String value = WXUtils.getString(param, null);
      if (value != null) {
        setValue(value);
      }
      return true;
    case Constants.Name.AUTO_PLAY:
      String aotu_play = WXUtils.getString(param, null);
      if (aotu_play != null) {
        setAutoPlay(aotu_play);
      }
      return true;
    case Constants.Name.SHOW_INDICATORS:
      String indicators = WXUtils.getString(param, null);
      if (indicators != null) {
        setShowIndicators(indicators);
      }
      return true;
    case Constants.Name.INTERVAL:
      Integer interval = WXUtils.getInteger(param, null);
      if (interval != null) {
        setInterval(interval);
      }
      return true;
    case Constants.Name.INDEX:
      Integer index = WXUtils.getInteger(param, null);
      if (index != null) {
        setIndex(index);
      }
      return true;
    case Constants.Name.OFFSET_X_ACCURACY:
      Float accuracy = WXUtils.getFloat(param, 0.1f);
      if (accuracy != 0) {
        setOffsetXAccuracy(accuracy);
      }
      return true;
    case Constants.Name.SCROLLABLE:
      boolean scrollable = WXUtils.getBoolean(param, true);
      setScrollable(scrollable);
      return true;
  }
  return super.setProperty(key, param);
}
 
Example 11
Source File: AbstractEditComponent.java    From weex-uikit with MIT License 4 votes vote down vote up
@Override
protected boolean setProperty(String key, Object param) {
  switch (key) {
    case Constants.Name.PLACEHOLDER:
      String placeholder = WXUtils.getString(param,null);
      if (placeholder != null)
        setPlaceholder(placeholder);
      return true;
    case Constants.Name.PLACEHOLDER_COLOR:
      String placeholder_color = WXUtils.getString(param,null);
      if (placeholder_color != null)
        setPlaceholderColor(placeholder_color);
      return true;
    case Constants.Name.TYPE:
      String input_type = WXUtils.getString(param,null);
      if (input_type != null)
        setType(input_type);
      return true;
    case Constants.Name.AUTOFOCUS:
      Boolean result = WXUtils.getBoolean(param, null);
      if (result != null)
        setAutofocus(result);
      return true;
    case Constants.Name.COLOR:
      String color = WXUtils.getString(param,null);
      if (color != null)
        setColor(color);
      return true;
    case Constants.Name.FONT_SIZE:
      String fontsize = WXUtils.getString(param,null);
      if (fontsize != null)
        setFontSize(fontsize);
      return true;
    case Constants.Name.TEXT_ALIGN:
      String text_align = WXUtils.getString(param,null);
      if (text_align != null)
        setTextAlign(text_align);
      return true;
    case Constants.Name.SINGLELINE:
      Boolean singLineResult = WXUtils.getBoolean(param, null);
      if (singLineResult != null)
        setSingleLine(singLineResult);
      return true;
    case Constants.Name.LINES:
      Integer lines = WXUtils.getInteger(param, null);
      if (lines != null)
        setLines(lines);
      return true;
    case Constants.Name.MAX_LENGTH:
      Integer maxlength = WXUtils.getInteger(param, null);
      if (maxlength != null)
        setMaxLength(maxlength);
      return true;
    case Constants.Name.MAXLENGTH:
      Integer maxLength = WXUtils.getInteger(param, null);
      if (maxLength != null)
        setMaxLength(maxLength);
        return true;
    case Constants.Name.MAX:
      setMax(String.valueOf(param));
      return true;
    case Constants.Name.MIN:
      setMin(String.valueOf(param));
      return true;
  }
  return super.setProperty(key, param);
}