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


Java WXViewUtils.getWebPxByWidth方法代码示例

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


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

示例1: notifyNativeSizeChanged

import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
/**
 * Trigger a updateStyle invoke to relayout current page
 */
public void notifyNativeSizeChanged(int w, int h) {
  if (!mNeedLayoutOnAnimation) {
    return;
  }

  Message message = Message.obtain();
  WXDomTask task = new WXDomTask();
  task.instanceId = getInstanceId();
  if (task.args == null) {
    task.args = new ArrayList<>();
  }

  JSONObject style = new JSONObject(2);
  float webW = WXViewUtils.getWebPxByWidth(w);
  float webH = WXViewUtils.getWebPxByWidth(h);

  style.put("width", webW);
  style.put("height", webH);

  task.args.add(getRef());
  task.args.add(style);
  message.obj = task;
  message.what = WXDomHandler.MsgType.WX_DOM_UPDATE_STYLE;
  WXSDKManager.getInstance().getWXDomManager().sendMessage(message);
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:29,代码来源:WXComponent.java

示例2: getEventLocInScreenCoordinate

import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
/**
 * Get event location in Screen's coordinate, e.g. root(global) coordinate.
 * @param eventX {@link MotionEvent#getX()} or {@link MotionEvent#getHistoricalX(int, int)}
 * @param eventY {@link MotionEvent#getX()} or {@link MotionEvent#getHistoricalX(int, int)}
 * @return the eventLocation in screen's coordinate
 * @see {@link #getEventLocInScreenCoordinate(MotionEvent, int, int)}
 */
@NonNull
private PointF getEventLocInScreenCoordinate(float eventX, float eventY) {
  globalRect.set(0, 0, 0, 0);
  globalOffset.set(0, 0);
  globalEventOffset.set((int) eventX, (int) eventY);
  component.getRealView().getGlobalVisibleRect(globalRect, globalOffset);
  globalEventOffset.offset(globalOffset.x, globalOffset.y);
  return new PointF(WXViewUtils.getWebPxByWidth(globalEventOffset.x),
                    WXViewUtils.getWebPxByWidth(globalEventOffset.y));
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:18,代码来源:WXGesture.java

示例3: getEventLocInPageCoordinate

import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
/**
 * Get event's location in Document's (Page) coordinate.
 * @param eventX {@link MotionEvent#getX()} or {@link MotionEvent#getHistoricalX(int, int)}
 * @param eventY {@link MotionEvent#getX()} or {@link MotionEvent#getHistoricalX(int, int)}
 * @return the event location in page's coordinate.
 * @see {@link #getEventLocInPageCoordinate(MotionEvent, int, int)}
 */
@NonNull
private PointF getEventLocInPageCoordinate(float eventX, float eventY) {
  locEventOffset.set(eventX, eventY);
  locLeftTop.set(0, 0);
  component.computeVisiblePointInViewCoordinate(locLeftTop);
  locEventOffset.offset(locLeftTop.x, locLeftTop.y);
  return new PointF(WXViewUtils.getWebPxByWidth(locEventOffset.x),
                    WXViewUtils.getWebPxByWidth(locEventOffset.y));
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:17,代码来源:WXGesture.java

示例4: setSize

import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
public void setSize(int width, int height) {
  if (width < 0 || height < 0) {
    return;
  }
  mGodViewWidth = width;
  mGodViewHeight = height;
  float realWidth = WXViewUtils.getWebPxByWidth(width);
  float realHeight = WXViewUtils.getWebPxByWidth(height);

  View godView = mGodCom.getHostView();
  if (godView != null) {
    ViewGroup.LayoutParams layoutParams = godView.getLayoutParams();
    if (layoutParams != null) {
      layoutParams.width = width;
      layoutParams.height = height;
      godView.setLayoutParams(layoutParams);

      JSONObject style = new JSONObject();
      if (mGodCom instanceof WXVContainer) {
        WXComponent rootComponent = ((WXVContainer) mGodCom).getChild(0);
        if (rootComponent != null && rootComponent.getDomObject() != null && rootComponent.getDomObject().isModifyHeight()) {
          style.put(Constants.Name.HEIGHT, realHeight);
        }
        if (rootComponent != null && rootComponent.getDomObject() != null && rootComponent.getDomObject().isModifyWidth()) {
          style.put(Constants.Name.WIDTH, realWidth);
        }
        updateRootComponentStyle(style);
      }
    }
  }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:32,代码来源:WXSDKInstance.java

示例5: preCalculateCellWidth

import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
public void preCalculateCellWidth(){

        if (getAttrs() != null) {
            mColumnCount = getAttrs().getColumnCount();
            mColumnWidth = getAttrs().getColumnWidth();
            mColumnGap =  getAttrs().getColumnGap();

            mAvailableWidth = getStyleWidth()-getPadding().get(Spacing.LEFT)-getPadding().get(Spacing.RIGHT);
            mAvailableWidth = WXViewUtils.getWebPxByWidth(mAvailableWidth,getViewPortWidth());

            if (Constants.Value.AUTO == mColumnCount && Constants.Value.AUTO == mColumnWidth) {
                mColumnCount = Constants.Value.COLUMN_COUNT_NORMAL;
            } else if (Constants.Value.AUTO == mColumnWidth && Constants.Value.AUTO != mColumnCount) {
                mColumnWidth = (mAvailableWidth - ((mColumnCount - 1) * mColumnGap)) / mColumnCount;
                mColumnWidth = mColumnWidth > 0 ? mColumnWidth :0;
            } else if (Constants.Value.AUTO != mColumnWidth && Constants.Value.AUTO == mColumnCount) {
                mColumnCount = Math.round((mAvailableWidth + mColumnGap) / (mColumnWidth + mColumnGap)-0.5f);
                mColumnCount = mColumnCount > 0 ? mColumnCount :1;
                if (mColumnCount <= 0)
                    mColumnCount = Constants.Value.COLUMN_COUNT_NORMAL;
                mColumnWidth =((mAvailableWidth + mColumnGap) / mColumnCount) - mColumnGap;
            } else if(Constants.Value.AUTO != mColumnWidth && Constants.Value.AUTO != mColumnCount){
                int columnCount = Math.round((mAvailableWidth + mColumnGap) / (mColumnWidth + mColumnGap)-0.5f);
                mColumnCount = columnCount > mColumnCount ? mColumnCount :columnCount;
                if (mColumnCount <= 0)
                    mColumnCount = Constants.Value.COLUMN_COUNT_NORMAL;
                mColumnWidth= ((mAvailableWidth + mColumnGap) / mColumnCount) - mColumnGap;
            }
            mIsPreCalculateCellWidth = true;
            if(WXEnvironment.isApkDebugable()) {
                WXLogUtils.d("preCalculateCellWidth mColumnGap :" + mColumnGap + " mColumnWidth:" + mColumnWidth + " mColumnCount:" + mColumnCount);
            }
        }
    }
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:35,代码来源:WXRecyclerDomObject.java

示例6: getEventLocInScreenCoordinate

import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
/**
 * Get event location in Screen's coordinate, e.g. root(global) coordinate.
 * @param eventX {@link MotionEvent#getX()} or {@link MotionEvent#getHistoricalX(int, int)}
 * @param eventY {@link MotionEvent#getX()} or {@link MotionEvent#getHistoricalX(int, int)}
 * @return the eventLocation in screen's coordinate
 * @see {@link #getEventLocInScreenCoordinate(MotionEvent, int, int)}
 */
@NonNull
private PointF getEventLocInScreenCoordinate(float eventX, float eventY) {
  globalRect.set(0, 0, 0, 0);
  globalOffset.set(0, 0);
  globalEventOffset.set((int) eventX, (int) eventY);
  component.getRealView().getGlobalVisibleRect(globalRect, globalOffset);
  globalEventOffset.offset(globalOffset.x, globalOffset.y);
  return new PointF(WXViewUtils.getWebPxByWidth(globalEventOffset.x,component.getInstance().getInstanceViewPortWidth()),
                    WXViewUtils.getWebPxByWidth(globalEventOffset.y,component.getInstance().getInstanceViewPortWidth()));
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:18,代码来源:WXGesture.java

示例7: getEventLocInPageCoordinate

import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
/**
 * Get event's location in Document's (Page) coordinate.
 * @param eventX {@link MotionEvent#getX()} or {@link MotionEvent#getHistoricalX(int, int)}
 * @param eventY {@link MotionEvent#getX()} or {@link MotionEvent#getHistoricalX(int, int)}
 * @return the event location in page's coordinate.
 * @see {@link #getEventLocInPageCoordinate(MotionEvent, int, int)}
 */
@NonNull
private PointF getEventLocInPageCoordinate(float eventX, float eventY) {
  locEventOffset.set(eventX, eventY);
  locLeftTop.set(0, 0);
  component.computeVisiblePointInViewCoordinate(locLeftTop);
  locEventOffset.offset(locLeftTop.x, locLeftTop.y);
  return new PointF(WXViewUtils.getWebPxByWidth(locEventOffset.x,component.getInstance().getInstanceViewPortWidth()),
                    WXViewUtils.getWebPxByWidth(locEventOffset.y,component.getInstance().getInstanceViewPortWidth()));
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:17,代码来源:WXGesture.java

示例8: setSize

import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
public void setSize(int width, int height) {
  if (width < 0 || height < 0 || isDestroy || !mRendered) {
    return;
  }
  float realWidth = WXViewUtils.getWebPxByWidth(width,getInstanceViewPortWidth());
  float realHeight = WXViewUtils.getWebPxByWidth(height,getInstanceViewPortWidth());

  View godView = mRenderContainer;
  if (godView != null) {
    ViewGroup.LayoutParams layoutParams = godView.getLayoutParams();
    if (layoutParams != null) {
      if(godView.getWidth() != width || godView.getHeight() != height) {
        layoutParams.width = width;
        layoutParams.height = height;
        godView.setLayoutParams(layoutParams);
      }

      JSONObject style = new JSONObject();
      WXComponent rootComponent = mRootComp;

      if(rootComponent == null){
        return;
      }
      style.put(Constants.Name.DEFAULT_WIDTH, realWidth);
      style.put(Constants.Name.DEFAULT_HEIGHT, realHeight);
      updateRootComponentStyle(style);
    }
  }
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:30,代码来源:WXSDKInstance.java

示例9: getEventLocInScreenCoordinate

import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
/**
 * Get event location in Screen's coordinate, e.g. root(global) coordinate.
 * @param eventX {@link MotionEvent#getX()} or {@link MotionEvent#getHistoricalX(int, int)}
 * @param eventY {@link MotionEvent#getX()} or {@link MotionEvent#getHistoricalX(int, int)}
 * @return the eventLocation in screen's coordinate
 * @see {@link #getEventLocInScreenCoordinate(MotionEvent, int, int)}
 */
@NonNull
private PointF getEventLocInScreenCoordinate(float eventX, float eventY) {
  globalRect.set(0, 0, 0, 0);
  globalOffset.set(0, 0);
  globalEventOffset.set((int) eventX, (int) eventY);
  component.getRealView().getGlobalVisibleRect(globalRect, globalOffset);
  globalEventOffset.offset(globalOffset.x, globalOffset.y);
  return new PointF(WXViewUtils.getWebPxByWidth(globalEventOffset.x,component.getInstance().getViewPortWidth()),
                    WXViewUtils.getWebPxByWidth(globalEventOffset.y,component.getInstance().getViewPortWidth()));
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:18,代码来源:WXGesture.java

示例10: getEventLocInPageCoordinate

import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
/**
 * Get event's location in Document's (Page) coordinate.
 * @param eventX {@link MotionEvent#getX()} or {@link MotionEvent#getHistoricalX(int, int)}
 * @param eventY {@link MotionEvent#getX()} or {@link MotionEvent#getHistoricalX(int, int)}
 * @return the event location in page's coordinate.
 * @see {@link #getEventLocInPageCoordinate(MotionEvent, int, int)}
 */
@NonNull
private PointF getEventLocInPageCoordinate(float eventX, float eventY) {
  locEventOffset.set(eventX, eventY);
  locLeftTop.set(0, 0);
  component.computeVisiblePointInViewCoordinate(locLeftTop);
  locEventOffset.offset(locLeftTop.x, locLeftTop.y);
  return new PointF(WXViewUtils.getWebPxByWidth(locEventOffset.x,component.getInstance().getViewPortWidth()),
                    WXViewUtils.getWebPxByWidth(locEventOffset.y,component.getInstance().getViewPortWidth()));
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:17,代码来源:WXGesture.java

示例11: setSize

import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
public void setSize(int width, int height) {
  if (width < 0 || height < 0 || isDestroy || !mRendered) {
    return;
  }
  float realWidth = WXViewUtils.getWebPxByWidth(width,getViewPortWidth());
  float realHeight = WXViewUtils.getWebPxByWidth(height,getViewPortWidth());

  View godView = mRenderContainer;
  if (godView != null) {
    ViewGroup.LayoutParams layoutParams = godView.getLayoutParams();
    if (layoutParams != null) {
      if(godView.getWidth() != width || godView.getHeight() != height) {
        layoutParams.width = width;
        layoutParams.height = height;
        godView.setLayoutParams(layoutParams);
      }

      JSONObject style = new JSONObject();
      WXComponent rootComponent = mRootComp;

      if(rootComponent == null){
        return;
      }
      style.put(Constants.Name.DEFAULT_WIDTH, realWidth);
      style.put(Constants.Name.DEFAULT_HEIGHT, realHeight);
      updateRootComponentStyle(style);
    }
  }
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:30,代码来源:WXSDKInstance.java

示例12: getWebPxValue

import com.taobao.weex.utils.WXViewUtils; //导入方法依赖的package包/类
@NonNull
private float getWebPxValue(int value,int viewport) {
  return WXViewUtils.getWebPxByWidth(value, viewport);
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:5,代码来源:GetComponentRectAction.java


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