• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java Constants类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.taobao.weex.common.Constants的典型用法代码示例。如果您正苦于以下问题:Java Constants类的具体用法?Java Constants怎么用?Java Constants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Constants类属于com.taobao.weex.common包,在下文中一共展示了Constants类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setBorderWidth

import com.taobao.weex.common.Constants; //导入依赖的package包/类
public void setBorderWidth(String key, float borderWidth) {
  if (borderWidth >= 0) {
    switch (key) {
      case Constants.Name.BORDER_WIDTH:
        getOrCreateBorder().setBorderWidth(Spacing.ALL, WXViewUtils.getRealSubPxByWidth(borderWidth,getInstance().getViewPortWidth()));
        break;
      case Constants.Name.BORDER_TOP_WIDTH:
        getOrCreateBorder().setBorderWidth(Spacing.TOP, WXViewUtils.getRealSubPxByWidth(borderWidth,getInstance().getViewPortWidth()));
        break;
      case Constants.Name.BORDER_RIGHT_WIDTH:
        getOrCreateBorder().setBorderWidth(Spacing.RIGHT, WXViewUtils.getRealSubPxByWidth(borderWidth,getInstance().getViewPortWidth()));
        break;
      case Constants.Name.BORDER_BOTTOM_WIDTH:
        getOrCreateBorder().setBorderWidth(Spacing.BOTTOM, WXViewUtils.getRealSubPxByWidth(borderWidth,getInstance().getViewPortWidth()));
        break;
      case Constants.Name.BORDER_LEFT_WIDTH:
        getOrCreateBorder().setBorderWidth(Spacing.LEFT, WXViewUtils.getRealSubPxByWidth(borderWidth,getInstance().getViewPortWidth()));
        break;
    }
  }
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:22,代码来源:WXComponent.java


示例2: getImageSharpen

import com.taobao.weex.common.Constants; //导入依赖的package包/类
public WXImageSharpen getImageSharpen() {
  Object obj = get(Constants.Name.SHARPEN);
  if (obj == null) {
    obj = get(Constants.Name.IMAGE_SHARPEN);
  }
  if (obj == null) {
    return WXImageSharpen.UNSHARPEN;
  }
  String imageSharpen = obj.toString();
  WXImageSharpen waImageSharpen = WXImageSharpen.UNSHARPEN;
  if (imageSharpen.equals("sharpen")) {
    waImageSharpen = WXImageSharpen.SHARPEN;
  }

  return waImageSharpen;
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:17,代码来源:WXAttr.java


示例3: scrollTo

import com.taobao.weex.common.Constants; //导入依赖的package包/类
@Override
public void scrollTo(WXComponent component, Map<String, Object> options) {
  float offsetFloat = 0;
  boolean smooth = true;

  if (options != null) {
    String offset = options.get(Constants.Name.OFFSET) == null ? "0" : options.get(Constants.Name.OFFSET).toString();
    smooth = WXUtils.getBoolean(options.get(Constants.Name.ANIMATED), true);
    if (offset != null) {
      try {
        offsetFloat = WXViewUtils.getRealPxByWidth(Float.parseFloat(offset), getInstance().getInstanceViewPortWidth());
      }catch (Exception e ){
        WXLogUtils.e("Float parseFloat error :"+e.getMessage());
      }
    }
  }

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

  scrollBy(viewXInScroller - getScrollX() + (int) offsetFloat, viewYInScroller - getScrollY() + (int) offsetFloat, smooth);
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:23,代码来源:WXScroller.java


示例4: getFontWeight

import com.taobao.weex.common.Constants; //导入依赖的package包/类
public static int getFontWeight(Map<String, Object> style) {
  int typeface = android.graphics.Typeface.NORMAL;
  if (style != null) {
    Object temp = style.get(Constants.Name.FONT_WEIGHT);
    if (temp != null) {
      String fontWeight = temp.toString();
      switch (fontWeight){
        case "600":
        case "700":
        case "800":
        case "900":
        case Constants.Value.BOLD:
          typeface=Typeface.BOLD;
          break;
      }
    }
  }
  return typeface;
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:20,代码来源:WXStyle.java


示例5: procAppear

import com.taobao.weex.common.Constants; //导入依赖的package包/类
/**
 * Process event like appear and disappear
 */
private void procAppear(int x, int y, int oldx,
                        int oldy) {
  int moveY = y - oldy;
  int moveX = x - oldx;
  String direction = moveY > 0 ? Constants.Value.DIRECTION_UP :
          moveY < 0 ? Constants.Value.DIRECTION_DOWN : null;
  if (mOrientation == Constants.Orientation.HORIZONTAL && moveX != 0) {
    direction = moveX > 0 ? Constants.Value.DIRECTION_RIGHT : Constants.Value.DIRECTION_LEFT;
  }

  for (Entry<String, AppearanceHelper> item : mAppearanceComponents.entrySet()) {
    AppearanceHelper helper = item.getValue();

    if (!helper.isWatch()) {
      continue;
    }
    boolean visible = helper.isViewVisible();

    int result = helper.setAppearStatus(visible);
    if (result != AppearanceHelper.RESULT_NO_CHANGE) {
      helper.getAwareChild().notifyAppearStateChange(result == AppearanceHelper.RESULT_APPEAR ? Constants.Event.APPEAR : Constants.Event.DISAPPEAR, direction);
    }
  }
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:28,代码来源:WXScroller.java


示例6: setBorderColor

import com.taobao.weex.common.Constants; //导入依赖的package包/类
public void setBorderColor(String key, String borderColor) {
  if (!TextUtils.isEmpty(borderColor)) {
    int colorInt = WXResourceUtils.getColor(borderColor);
    if (colorInt != Integer.MIN_VALUE) {
      switch (key) {
        case Constants.Name.BORDER_COLOR:
          getOrCreateBorder().setBorderColor(Spacing.ALL, colorInt);
          break;
        case Constants.Name.BORDER_TOP_COLOR:
          getOrCreateBorder().setBorderColor(Spacing.TOP, colorInt);
          break;
        case Constants.Name.BORDER_RIGHT_COLOR:
          getOrCreateBorder().setBorderColor(Spacing.RIGHT, colorInt);
          break;
        case Constants.Name.BORDER_BOTTOM_COLOR:
          getOrCreateBorder().setBorderColor(Spacing.BOTTOM, colorInt);
          break;
        case Constants.Name.BORDER_LEFT_COLOR:
          getOrCreateBorder().setBorderColor(Spacing.LEFT, colorInt);
          break;
      }
    }
  }
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:25,代码来源:WXComponent.java


示例7: setFooterView

import com.taobao.weex.common.Constants; //导入依赖的package包/类
/**
 *
 * @param loading should be {@link WXRefreshView}
 */
public void setFooterView(WXComponent loading) {
    setLoadmoreEnable(true);
    if (swipeLayout != null) {
        if (swipeLayout.getFooterView() != null) {
            swipeLayout.setLoadingHeight((int) loading.getDomObject().getLayoutHeight());

            String colorStr = (String) loading.getDomObject().getStyles().get(Constants.Name.BACKGROUND_COLOR);
            String bgColor = WXUtils.getString(colorStr, null);

            if (bgColor != null) {
                if (!TextUtils.isEmpty(bgColor)) {
                    int colorInt = WXResourceUtils.getColor(bgColor);
                    if (!(colorInt == Color.TRANSPARENT)) {
                        swipeLayout.setLoadingBgColor(colorInt);
                    }
                }
            }
            swipeLayout.getFooterView().setRefreshView(loading.getHostView());
        }
    }
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:26,代码来源:BaseBounceView.java


示例8: measure

import com.taobao.weex.common.Constants; //导入依赖的package包/类
@Override
protected MeasureOutput measure(int width, int height) {
  MeasureOutput measureOutput = new MeasureOutput();
  if (this.mOrientation == Constants.Orientation.HORIZONTAL) {
    int screenW = WXViewUtils.getScreenWidth(WXEnvironment.sApplication);
    int weexW = WXViewUtils.getWeexWidth(getInstanceId());
    measureOutput.width = width > (weexW >= screenW ? screenW : weexW) ? FrameLayout.LayoutParams.MATCH_PARENT
                                                                       : width;
    measureOutput.height = height;
  } else {
    int screenH = WXViewUtils.getScreenHeight(WXEnvironment.sApplication);
    int weexH = WXViewUtils.getWeexHeight(getInstanceId());
    measureOutput.height = height > (weexH >= screenH ? screenH : weexH) ? FrameLayout.LayoutParams.MATCH_PARENT
                                                                         : height;
    measureOutput.width = width;
  }
  return measureOutput;
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:19,代码来源:WXScroller.java


示例9: setBorderRadius

import com.taobao.weex.common.Constants; //导入依赖的package包/类
public void setBorderRadius(String key, float borderRadius) {
  if (borderRadius >= 0) {
    switch (key) {
      case Constants.Name.BORDER_RADIUS:
        getOrCreateBorder().setBorderRadius(BorderDrawable.BORDER_RADIUS_ALL, WXViewUtils.getRealSubPxByWidth(borderRadius,mInstance.getInstanceViewPortWidth()));
        break;
      case Constants.Name.BORDER_TOP_LEFT_RADIUS:
        getOrCreateBorder().setBorderRadius(BorderDrawable.BORDER_TOP_LEFT_RADIUS, WXViewUtils.getRealSubPxByWidth(borderRadius,mInstance.getInstanceViewPortWidth()));
        break;
      case Constants.Name.BORDER_TOP_RIGHT_RADIUS:
        getOrCreateBorder().setBorderRadius(BorderDrawable.BORDER_TOP_RIGHT_RADIUS, WXViewUtils.getRealSubPxByWidth(borderRadius,mInstance.getInstanceViewPortWidth()));
        break;
      case Constants.Name.BORDER_BOTTOM_RIGHT_RADIUS:
        getOrCreateBorder().setBorderRadius(BorderDrawable.BORDER_BOTTOM_RIGHT_RADIUS, WXViewUtils.getRealSubPxByWidth(borderRadius,mInstance.getInstanceViewPortWidth()));
        break;
      case Constants.Name.BORDER_BOTTOM_LEFT_RADIUS:
        getOrCreateBorder().setBorderRadius(BorderDrawable.BORDER_BOTTOM_LEFT_RADIUS, WXViewUtils.getRealSubPxByWidth(borderRadius,mInstance.getInstanceViewPortWidth()));
        break;
    }
  }
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:22,代码来源:WXComponent.java


示例10: setIndex

import com.taobao.weex.common.Constants; //导入依赖的package包/类
@WXComponentProp(name = Constants.Name.INDEX)
public void setIndex(int index) {
  if (mViewPager != null && mAdapter != null) {
    if (index >= mAdapter.getRealCount() || index < 0) {
      return;
    }
    mViewPager.setCurrentItem(index);
    if (mIndicator != null && mIndicator.getHostView() != null
            && mIndicator.getHostView().getRealCurrentItem() != index) {
      //OnPageChangeListener not triggered
      WXLogUtils.d("setIndex >>>> correction indicator to " + index);
      mIndicator.getHostView().setRealCurrentItem(index);
      mIndicator.getHostView().invalidate();

      if (mPageChangeListener != null && mAdapter != null) {
        mPageChangeListener.onPageSelected(mAdapter.getFirst() + index);
      }
    }
  }
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:21,代码来源:WXSlider.java


示例11: setProperty

import com.taobao.weex.common.Constants; //导入依赖的package包/类
@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);
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:22,代码来源:WXIndicator.java


示例12: shouldReport

import com.taobao.weex.common.Constants; //导入依赖的package包/类
private boolean shouldReport(int x, int y) {
  if (mLastReport.x == -1 && mLastReport.y == -1) {
    mLastReport.x = x;
    mLastReport.y = y;
    return true;
  }

  if (mOrientation == Constants.Orientation.HORIZONTAL
          && Math.abs(x - mLastReport.x) >= mOffsetAccuracy) {
    mLastReport.x = x;
    mLastReport.y = y;
    return true;
  }

  if (mOrientation == Constants.Orientation.VERTICAL
          && Math.abs(y - mLastReport.y) >= mOffsetAccuracy) {
    mLastReport.x = x;
    mLastReport.y = y;
    return true;
  }

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


示例13: procAppear

import com.taobao.weex.common.Constants; //导入依赖的package包/类
/**
 * Process event like appear and disappear
 */
private void procAppear(int x, int y, int oldx,
                        int oldy) {
  String direction = y - oldy > 0 ? "up" : "down";
  if (mOrientation == Constants.Orientation.HORIZONTAL) {
    direction = x - oldx > 0 ? "right" : "left";
  }

  for (Entry<String, AppearanceHelper> item : mAppearanceComponents.entrySet()) {
    AppearanceHelper helper = item.getValue();

    if (!helper.isWatch()) {
      continue;
    }
    boolean visible = helper.isViewVisible();

    int result = helper.setAppearStatus(visible);
    if (result != AppearanceHelper.RESULT_NO_CHANGE) {
      helper.getAwareChild().notifyAppearStateChange(result == AppearanceHelper.RESULT_APPEAR ? Constants.Event.APPEAR : Constants.Event.DISAPPEAR, direction);
    }
  }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:25,代码来源:WXScroller.java


示例14: prepareRoot

import com.taobao.weex.common.Constants; //导入依赖的package包/类
public static void prepareRoot(WXDomObject domObj,float defaultHeight,float defaultWidth) {
  domObj.mRef = WXDomObject.ROOT;

  WXStyle domStyles = domObj.getStyles();
  Map<String, Object> style = new HashMap<>(5);
  if (!domStyles.containsKey(Constants.Name.FLEX_DIRECTION)) {
    style.put(Constants.Name.FLEX_DIRECTION, "column");
  }
  if (!domStyles.containsKey(Constants.Name.BACKGROUND_COLOR)) {
    style.put(Constants.Name.BACKGROUND_COLOR, "#ffffff");
  }

  style.put(Constants.Name.DEFAULT_WIDTH, defaultWidth);
  style.put(Constants.Name.DEFAULT_HEIGHT, defaultHeight);

  domObj.updateStyle(style);
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:18,代码来源:WXDomObject.java


示例15: getColumnCount

import com.taobao.weex.common.Constants; //导入依赖的package包/类
public int getColumnCount() {

    Object obj = get(Constants.Name.COLUMN_COUNT);
    if (obj == null) {
      return Constants.Value.AUTO;
    }

    String value = String.valueOf(obj);
    if(Constants.Name.AUTO.equals(value)){
      return Constants.Value.AUTO;
    }

    try {
      int columnCount = Integer.parseInt(value);
      return columnCount > 0 ? columnCount : Constants.Value.AUTO;
    } catch (Exception e) {
      WXLogUtils.e("[WXAttr] getColumnCount:", e);
      return Constants.Value.AUTO;
    }
  }
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:21,代码来源:WXAttr.java


示例16: setProperty

import com.taobao.weex.common.Constants; //导入依赖的package包/类
@Override
protected boolean setProperty(String key, Object param) {
  switch (key) {
    case Constants.Name.SRC:
      String src = WXUtils.getString(param, null);
      if (src != null) {
        setSrc(src);
      }
      return true;
    case Constants.Name.AUTO_PLAY:
      Boolean result = WXUtils.getBoolean(param, null);
      if (result != null) {
        setAutoPlay(result);
      }
      return true;
    case Constants.Name.PLAY_STATUS:
      String status = WXUtils.getString(param, null);
      if (status != null) {
        setPlaystatus(status);
      }
      return true;
  }
  return super.setProperty(key, param);
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:25,代码来源:WXVideo.java


示例17: setAutofocus

import com.taobao.weex.common.Constants; //导入依赖的package包/类
@WXComponentProp(name = Constants.Name.AUTOFOCUS)
public void setAutofocus(boolean autofocus) {
  if (getHostView() == null) {
    return;
  }
  mAutoFocus = autofocus;
  EditText inputView = getHostView();
  if (mAutoFocus) {
    inputView.setFocusable(true);
    inputView.requestFocus();
    inputView.setFocusableInTouchMode(true);
    showSoftKeyboard();
  } else {
    hideSoftKeyboard();
  }
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:17,代码来源:AbstractEditComponent.java


示例18: setPlaystatus

import com.taobao.weex.common.Constants; //导入依赖的package包/类
@WXComponentProp(name = Constants.Name.PLAY_STATUS)
public void setPlaystatus(String playstatus) {

  if (mPrepared && !mError && !mStopped) {
    if (playstatus.equals(Constants.Value.PLAY)) {
      mWrapper.start();
    } else if (playstatus.equals(Constants.Value.PAUSE)) {
      mWrapper.pause();
    } else if (playstatus.equals(Constants.Value.STOP)) {
      mWrapper.stopPlayback();
      mStopped = true;
    }
  } else if ((mError || mStopped) && playstatus.equals(Constants.Value.PLAY)) {
    mError = false;
    mWrapper.resume();

    mWrapper.getProgressBar().setVisibility(View.VISIBLE);
  }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:20,代码来源:WXVideo.java


示例19: removeEventFromView

import com.taobao.weex.common.Constants; //导入依赖的package包/类
protected void removeEventFromView(String type) {
  if (type.equals(Constants.Event.CLICK) && getRealView() != null && mHostClickListeners != null) {
    mHostClickListeners.remove(mClickEventListener);
    //click event only remove from listener array
  }
  Scrollable scroller = getParentScroller();
  if (type.equals(Constants.Event.APPEAR) && scroller != null) {
    scroller.unbindAppearEvent(this);
  }
  if (type.equals(Constants.Event.DISAPPEAR) && scroller != null) {
    scroller.unbindDisappearEvent(this);
  }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:14,代码来源:WXComponent.java


示例20: setScrollable

import com.taobao.weex.common.Constants; //导入依赖的package包/类
@WXComponentProp(name = Constants.Name.SCROLLABLE)
public void setScrollable(boolean scrollable) {
  View inner = getHostView().getInnerView();
  if (inner instanceof WXRecyclerView) {
    ((WXRecyclerView) inner).setScrollable(scrollable);
  }
  ;
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:9,代码来源:BasicListComponent.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StandardTargetWeights类代码示例发布时间:2022-05-22
下一篇:
Java JFactory类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap