本文整理汇总了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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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));
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例13: setMaxWidth
import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
@Override
public void setMaxWidth(float maxWidth) {
super.setMaxWidth(WXViewUtils.getRealPxByWidth(FIXED_WIDTH));
}
示例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;
}
示例15: setMinHeight
import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
@Override
public void setMinHeight(float minHeight) {
super.setMinHeight(WXViewUtils.getRealPxByWidth(FIXED_HEIGHT));
}