コード例 #1
0
  private void handleBorderProperty(String property, Object value) {
    if (background.getBorder() == null) {
      background.setBorder(new TiBackgroundDrawable.Border());
    }
    TiBackgroundDrawable.Border border = background.getBorder();

    if (property.equals(TiC.PROPERTY_BORDER_COLOR)) {
      border.setColor(TiConvert.toColor(value.toString()));
    } else if (property.equals(TiC.PROPERTY_BORDER_RADIUS)) {
      float radius = TiConvert.toFloat(value);
      if (radius > 0f && HONEYCOMB_OR_GREATER) {
        disableHWAcceleration();
      }
      border.setRadius(radius);
    } else if (property.equals(TiC.PROPERTY_BORDER_WIDTH)) {
      border.setWidth(TiConvert.toFloat(value));
    }
    applyCustomBackground();
  }
コード例 #2
0
  private void initializeBorder(KrollDict d, Integer bgColor) {
    if (d.containsKey(TiC.PROPERTY_BORDER_RADIUS)
        || d.containsKey(TiC.PROPERTY_BORDER_COLOR)
        || d.containsKey(TiC.PROPERTY_BORDER_WIDTH)) {

      if (nativeView != null) {
        if (background == null) {
          applyCustomBackground();
        }

        if (background.getBorder() == null) {
          background.setBorder(new TiBackgroundDrawable.Border());
        }

        TiBackgroundDrawable.Border border = background.getBorder();

        if (d.containsKey(TiC.PROPERTY_BORDER_RADIUS)) {
          float radius = TiConvert.toFloat(d, TiC.PROPERTY_BORDER_RADIUS);
          if (radius > 0f && HONEYCOMB_OR_GREATER) {
            disableHWAcceleration();
          }
          border.setRadius(radius);
        }
        if (d.containsKey(TiC.PROPERTY_BORDER_COLOR) || d.containsKey(TiC.PROPERTY_BORDER_WIDTH)) {
          if (d.containsKey(TiC.PROPERTY_BORDER_COLOR)) {
            border.setColor(TiConvert.toColor(d, TiC.PROPERTY_BORDER_COLOR));
          } else {
            if (bgColor != null) {
              border.setColor(bgColor);
            }
          }
          if (d.containsKey(TiC.PROPERTY_BORDER_WIDTH)) {
            border.setWidth(TiConvert.toFloat(d, TiC.PROPERTY_BORDER_WIDTH));
          }
        }
        // applyCustomBackground();
      }
    }
  }