当前位置: 首页>>代码示例>>Java>>正文


Java WXViewUtils.getRealPxByWidth方法代码示例

本文整理汇总了Java中com.taobao.weex.utils.WXViewUtils.getRealPxByWidth方法的典型用法代码示例。如果您正苦于以下问题:Java WXViewUtils.getRealPxByWidth方法的具体用法?Java WXViewUtils.getRealPxByWidth怎么用?Java WXViewUtils.getRealPxByWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.taobao.weex.utils.WXViewUtils的用法示例。


在下文中一共展示了WXViewUtils.getRealPxByWidth方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onLoadMore

import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
@Override
public void onLoadMore(int offScreenY) {
  try {
    String offset = getDomObject().getAttrs().getLoadMoreOffset();

    if (TextUtils.isEmpty(offset)) {
      offset = "0";
    }
    float offsetParsed = WXViewUtils.getRealPxByWidth(Integer.parseInt(offset),getInstance().getInstanceViewPortWidth());

    if (offScreenY < offsetParsed) {

      if (mListCellCount != mChildren.size()
          || mForceLoadmoreNextTime) {
        fireEvent(Constants.Event.LOADMORE);
        mListCellCount = mChildren.size();
        mForceLoadmoreNextTime = false;
      }
    }
  } catch (Exception e) {
    WXLogUtils.d(TAG + "onLoadMore :", e);
  }
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:24,代码来源:BasicListComponent.java

示例2: scrollTo

import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
/**
 * @see com.taobao.weex.dom.WXDomStatement#scrollToDom(String, JSONObject)
 */
void scrollTo(String ref, Map<String, Object> options) {
  WXComponent component = mRegistry.get(ref);
  if (component == null) {
    return;
  }

  float offsetFloat = 0;
  if (options != null) {
    String offset = options.get("offset") == null ? "0" : options.get("offset").toString();
    if (offset != null) {
      try {
        offsetFloat = WXViewUtils.getRealPxByWidth(Float.parseFloat(offset));
      }catch (Exception e ){
         WXLogUtils.e("Float parseFloat error :"+e.getMessage());
      }
    }
  }

  Scrollable scroller = component.getParentScroller();
  if (scroller == null) {
    return;
  }
  scroller.scrollTo(component,(int)offsetFloat);
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:28,代码来源:WXRenderStatement.java

示例3: getLineHeight

import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
public static int getLineHeight(Map<String, Object> style,int viewPortW){
  if (style == null) {
    return UNSET;
  }
  int lineHeight = WXUtils.getInt(style.get(Constants.Name.LINE_HEIGHT));
  if (lineHeight <= 0) {
    lineHeight = UNSET;
    return lineHeight;
  }
  return (int) WXViewUtils.getRealPxByWidth(lineHeight,viewPortW);
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:12,代码来源:WXStyle.java

示例4: getFontSize

import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
public static int getFontSize(Map<String, Object> style) {
  if (style == null) {
    return (int) WXViewUtils.getRealPxByWidth(WXText.sDEFAULT_SIZE);
  }
  int fontSize = WXUtils.getInt(style.get(Constants.Name.FONT_SIZE));
  if (fontSize <= 0) {
    fontSize = WXText.sDEFAULT_SIZE;
  }
  return (int) WXViewUtils.getRealPxByWidth(fontSize);
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:11,代码来源:WXStyle.java

示例5: getLineHeight

import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
public static int getLineHeight(Map<String, Object> style){
  if (style == null) {
    return UNSET;
  }
  int lineHeight = WXUtils.getInt(style.get(Constants.Name.LINE_HEIGHT));
  if (lineHeight <= 0) {
    lineHeight = UNSET;
    return lineHeight;
  }
  return (int) WXViewUtils.getRealPxByWidth(lineHeight);
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:12,代码来源:WXStyle.java

示例6: parsePercentOrPx

import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
private static float parsePercentOrPx(String raw, int unit) {
  final int precision = 1;
  int suffix;
  if ((suffix = raw.lastIndexOf(FunctionParser.PERCENT)) != -1) {
    return parsePercent(raw.substring(0, suffix), unit, precision);
  } else if ((suffix = raw.lastIndexOf(PX)) != -1) {
    return WXViewUtils.getRealPxByWidth(WXUtils.fastGetFloat(raw.substring(0, suffix), precision));
  }
  return WXViewUtils.getRealPxByWidth(WXUtils.fastGetFloat(raw, precision));
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:11,代码来源:WXAnimationBean.java

示例7: scrollTo

import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
@Override
public void scrollTo(WXComponent component,int offset) {
  int offsetIntF = (int) WXViewUtils.getRealPxByWidth(offset);

  int viewYInScroller=component.getAbsoluteY() - getAbsoluteY();
  int viewXInScroller=component.getAbsoluteX() - getAbsoluteX();

  scrollBy(viewXInScroller - getScrollX()+offsetIntF,viewYInScroller - getScrollY() + offsetIntF);
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:10,代码来源:WXScroller.java

示例8: parsePercentOrPx

import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
private static float parsePercentOrPx(String raw, int unit,int viewportW) {
  final int precision = 1;
  int suffix;
  if ((suffix = raw.lastIndexOf(WXUtils.PERCENT)) != -1) {
    return parsePercent(raw.substring(0, suffix), unit, precision);
  } else if ((suffix = raw.lastIndexOf(PX)) != -1) {
    return WXViewUtils.getRealPxByWidth(WXUtils.fastGetFloat(raw.substring(0, suffix), precision),viewportW);
  }
  return WXViewUtils.getRealPxByWidth(WXUtils.fastGetFloat(raw, precision),viewportW);
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:11,代码来源:WXAnimationBean.java

示例9: getFontSize

import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
public static int getFontSize(Map<String, Object> style,int viewPortW) {
  if (style == null) {
    return (int) WXViewUtils.getRealPxByWidth(WXText.sDEFAULT_SIZE,viewPortW);
  }
  int fontSize = WXUtils.getInt(style.get(Constants.Name.FONT_SIZE));
  if (fontSize <= 0) {
    fontSize = WXText.sDEFAULT_SIZE;
  }
  return (int) WXViewUtils.getRealPxByWidth(fontSize,viewPortW);
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:11,代码来源:WXStyle.java

示例10: onLoadMore

import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
/**
 * Handle loadMore Event.when Scroller has bind loadMore Event and set the attr of loadMoreOffset
 * it will tell the JS to handle the event of onLoadMore;
 * @param scrollView  the WXScrollView
 * @param x the X direction
 * @param y the Y direction
 */
protected void onLoadMore(WXScrollView scrollView, int x, int y) {
  try {
    String offset = getDomObject().getAttrs().getLoadMoreOffset();
    if (TextUtils.isEmpty(offset)) {
      return;
    }
    int offsetInt = (int)WXViewUtils.getRealPxByWidth(Float.parseFloat(offset), getInstance().getInstanceViewPortWidth());

    int contentH = scrollView.getChildAt(0).getHeight();
    int scrollerH = scrollView.getHeight();
    int offScreenY = contentH - y - scrollerH;
    if (offScreenY < offsetInt) {
      if (WXEnvironment.isApkDebugable()) {
        WXLogUtils.d("[WXScroller-onScroll] offScreenY :" + offScreenY);
      }
      if (mContentHeight != contentH || mForceLoadmoreNextTime) {
        fireEvent(Constants.Event.LOADMORE);
        mContentHeight = contentH;
        mForceLoadmoreNextTime = false;
      }
    }
  } catch (Exception e) {
    WXLogUtils.d("[WXScroller-onScroll] ", e);
  }

}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:34,代码来源:WXScroller.java

示例11: setWidth

import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
@WXComponentProp(name = Constants.Name.WIDTH)
public void setWidth(int width) {
  mWidth = width;
  getHostView().getLayoutParams().width = (int) WXViewUtils.getRealPxByWidth(width, 750);
}
 
开发者ID:weex-plugins,项目名称:weex-svg,代码行数:6,代码来源:WXSvgContainer.java

示例12: setHeight

import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
@WXComponentProp(name = Constants.Name.HEIGHT)
public void setHeight(int height) {
  mHeight = height;
  getHostView().getLayoutParams().height = (int) WXViewUtils.getRealPxByWidth(height, 750);
}
 
开发者ID:weex-plugins,项目名称:weex-svg,代码行数:6,代码来源:WXSvgContainer.java

示例13: setMaxWidth

import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
@Override
public void setMaxWidth(float maxWidth) {
    super.setMaxWidth(WXViewUtils.getRealPxByWidth(FIXED_WIDTH));
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:5,代码来源:WXSwitchDomObject.java

示例14: setOffsetAccuracy

import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
@WXComponentProp(name = Constants.Name.OFFSET_ACCURACY)
public void setOffsetAccuracy(int accuracy) {
  float realPx = WXViewUtils.getRealPxByWidth(accuracy, getInstance().getInstanceViewPortWidth());
  this.mOffsetAccuracy = (int) realPx;
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:6,代码来源:WXScroller.java

示例15: setMinHeight

import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
@Override
public void setMinHeight(float minHeight) {
    super.setMinHeight(WXViewUtils.getRealPxByWidth(FIXED_HEIGHT));
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:5,代码来源:WXSwitchDomObject.java


注:本文中的com.taobao.weex.utils.WXViewUtils.getRealPxByWidth方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。