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


Java YogaMeasureOutput类代码示例

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


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

示例1: measure

import com.facebook.yoga.YogaMeasureOutput; //导入依赖的package包/类
public synchronized long measure(
        Tweet tweet,
        YogaNode node,
        float width,
        YogaMeasureMode widthMode,
        float height,
        YogaMeasureMode heightMode
) {
  if (mTweetView == null) {
    mTweetView = ReactTweetViewManager.createTweetView(getThemedContext());
  }

  if (tweet != null) {
    mTweetView.setTweet(tweet);
  }
  mTweetView.measure(yogaToAndroid(widthMode, width), yogaToAndroid(heightMode, height));

  int measuredWidth = mTweetView.getMeasuredWidth();
  int measuredHeight = mTweetView.getMeasuredHeight();
  return YogaMeasureOutput.make(measuredWidth, measuredHeight);
}
 
开发者ID:netceteragroup,项目名称:react-native-twitterkit,代码行数:22,代码来源:TweetShadowNode.java

示例2: measure

import com.facebook.yoga.YogaMeasureOutput; //导入依赖的package包/类
@Override
public long measure(
    YogaNode node,
    float width,
    YogaMeasureMode widthMode,
    float height,
    YogaMeasureMode heightMode) {
  // measure() should never be called before setThemedContext()
  EditText editText = Assertions.assertNotNull(mEditText);

  int fontSize = getFontSize();
  editText.setTextSize(
      TypedValue.COMPLEX_UNIT_PX,
      fontSize == UNSET ?
          (int) Math.ceil(PixelUtil.toPixelFromSP(ViewDefaults.FONT_SIZE_SP)) : fontSize);

  if (mNumberOfLines != UNSET) {
    editText.setLines(mNumberOfLines);
  }

  editText.measure(
      MeasureUtil.getMeasureSpec(width, widthMode),
      MeasureUtil.getMeasureSpec(height, heightMode));
  return YogaMeasureOutput.make(editText.getMeasuredWidth(), editText.getMeasuredHeight());
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:26,代码来源:RCTTextInput.java

示例3: measure

import com.facebook.yoga.YogaMeasureOutput; //导入依赖的package包/类
@Override
public long measure(
    YogaNode node,
    float width,
    YogaMeasureMode widthMode,
    float height,
    YogaMeasureMode heightMode) {
  if (!mMeasured) {
    // Create a switch with the default config and measure it; since we don't (currently)
    // support setting custom switch text, this is fine, as all switches will measure the same
    // on a specific device/theme/locale combination.
    ReactSwitch reactSwitch = new ReactSwitch(getThemedContext());
    final int spec = View.MeasureSpec.makeMeasureSpec(
        ViewGroup.LayoutParams.WRAP_CONTENT,
        View.MeasureSpec.UNSPECIFIED);
    reactSwitch.measure(spec, spec);
    mWidth = reactSwitch.getMeasuredWidth();
    mHeight = reactSwitch.getMeasuredHeight();
    mMeasured = true;
  }

  return YogaMeasureOutput.make(mWidth, mHeight);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:24,代码来源:ReactSwitchManager.java

示例4: measure

import com.facebook.yoga.YogaMeasureOutput; //导入依赖的package包/类
@Override
public long measure(
    YogaNode node,
    float width,
    YogaMeasureMode widthMode,
    float height,
    YogaMeasureMode heightMode) {
  final int style = ReactProgressBarViewManager.getStyleFromString(getStyle());
  if (!mMeasured.contains(style)) {
    ProgressBar progressBar = ReactProgressBarViewManager.createProgressBar(getThemedContext(), style);
    final int spec = View.MeasureSpec.makeMeasureSpec(
        ViewGroup.LayoutParams.WRAP_CONTENT,
        View.MeasureSpec.UNSPECIFIED);
    progressBar.measure(spec, spec);
    mHeight.put(style, progressBar.getMeasuredHeight());
    mWidth.put(style, progressBar.getMeasuredWidth());
    mMeasured.add(style);
  }

  return YogaMeasureOutput.make(mWidth.get(style), mHeight.get(style));
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:22,代码来源:ProgressBarShadowNode.java

示例5: measure

import com.facebook.yoga.YogaMeasureOutput; //导入依赖的package包/类
@Override
public long measure(
    YogaNode node,
    float width,
    YogaMeasureMode widthMode,
    float height,
    YogaMeasureMode heightMode) {
  if (!mMeasured) {
    SeekBar reactSlider = new ReactSlider(getThemedContext(), null, STYLE);
    final int spec = View.MeasureSpec.makeMeasureSpec(
        ViewGroup.LayoutParams.WRAP_CONTENT,
        View.MeasureSpec.UNSPECIFIED);
    reactSlider.measure(spec, spec);
    mWidth = reactSlider.getMeasuredWidth();
    mHeight = reactSlider.getMeasuredHeight();
    mMeasured = true;
  }

  return YogaMeasureOutput.make(mWidth, mHeight);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:21,代码来源:ReactSliderManager.java

示例6: measure

import com.facebook.yoga.YogaMeasureOutput; //导入依赖的package包/类
@Override
public long measure(
    YogaNodeAPI node,
    float width,
    YogaMeasureMode widthMode,
    float height,
    YogaMeasureMode heightMode) {
  // measure() should never be called before setThemedContext()
  EditText editText = Assertions.assertNotNull(mEditText);

  int fontSize = getFontSize();
  editText.setTextSize(
      TypedValue.COMPLEX_UNIT_PX,
      fontSize == UNSET ?
          (int) Math.ceil(PixelUtil.toPixelFromSP(ViewDefaults.FONT_SIZE_SP)) : fontSize);

  if (mNumberOfLines != UNSET) {
    editText.setLines(mNumberOfLines);
  }

  editText.measure(
      MeasureUtil.getMeasureSpec(width, widthMode),
      MeasureUtil.getMeasureSpec(height, heightMode));
  return YogaMeasureOutput.make(editText.getMeasuredWidth(), editText.getMeasuredHeight());
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:26,代码来源:RCTTextInput.java

示例7: measure

import com.facebook.yoga.YogaMeasureOutput; //导入依赖的package包/类
@Override
public long measure(
    YogaNodeAPI node,
    float width,
    YogaMeasureMode widthMode,
    float height,
    YogaMeasureMode heightMode) {
  if (!mMeasured) {
    // Create a switch with the default config and measure it; since we don't (currently)
    // support setting custom switch text, this is fine, as all switches will measure the same
    // on a specific device/theme/locale combination.
    ReactSwitch reactSwitch = new ReactSwitch(getThemedContext());
    final int spec = View.MeasureSpec.makeMeasureSpec(
        ViewGroup.LayoutParams.WRAP_CONTENT,
        View.MeasureSpec.UNSPECIFIED);
    reactSwitch.measure(spec, spec);
    mWidth = reactSwitch.getMeasuredWidth();
    mHeight = reactSwitch.getMeasuredHeight();
    mMeasured = true;
  }

  return YogaMeasureOutput.make(mWidth, mHeight);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:24,代码来源:ReactSwitchManager.java

示例8: measure

import com.facebook.yoga.YogaMeasureOutput; //导入依赖的package包/类
@Override
public long measure(
    YogaNodeAPI node,
    float width,
    YogaMeasureMode widthMode,
    float height,
    YogaMeasureMode heightMode) {
  final int style = ReactProgressBarViewManager.getStyleFromString(getStyle());
  if (!mMeasured.contains(style)) {
    ProgressBar progressBar = ReactProgressBarViewManager.createProgressBar(getThemedContext(), style);
    final int spec = View.MeasureSpec.makeMeasureSpec(
        ViewGroup.LayoutParams.WRAP_CONTENT,
        View.MeasureSpec.UNSPECIFIED);
    progressBar.measure(spec, spec);
    mHeight.put(style, progressBar.getMeasuredHeight());
    mWidth.put(style, progressBar.getMeasuredWidth());
    mMeasured.add(style);
  }

  return YogaMeasureOutput.make(mWidth.get(style), mHeight.get(style));
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:22,代码来源:ProgressBarShadowNode.java

示例9: measure

import com.facebook.yoga.YogaMeasureOutput; //导入依赖的package包/类
@Override
public long measure(
    YogaNodeAPI node,
    float width,
    YogaMeasureMode widthMode,
    float height,
    YogaMeasureMode heightMode) {
  if (!mMeasured) {
    SeekBar reactSlider = new ReactSlider(getThemedContext(), null, STYLE);
    final int spec = View.MeasureSpec.makeMeasureSpec(
        ViewGroup.LayoutParams.WRAP_CONTENT,
        View.MeasureSpec.UNSPECIFIED);
    reactSlider.measure(spec, spec);
    mWidth = reactSlider.getMeasuredWidth();
    mHeight = reactSlider.getMeasuredHeight();
    mMeasured = true;
  }

  return YogaMeasureOutput.make(mWidth, mHeight);
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:21,代码来源:ReactSliderManager.java

示例10: measure

import com.facebook.yoga.YogaMeasureOutput; //导入依赖的package包/类
@Override
public long measure(
    YogaNode node,
    float width,
    YogaMeasureMode widthMode,
    float height,
    YogaMeasureMode heightMode) {

  CharSequence text = getText();
  if (TextUtils.isEmpty(text)) {
    // to indicate that we don't have anything to display
    mText = null;
    return YogaMeasureOutput.make(0, 0);
  } else {
    mText = text;
  }

  Layout layout = createTextLayout(
      (int) Math.ceil(width),
      widthMode,
      TextUtils.TruncateAt.END,
      true,
      mNumberOfLines,
      mNumberOfLines == 1,
      text,
      getFontSize(),
      mSpacingAdd,
      mSpacingMult,
      getFontStyle(),
      getAlignment());

  if (mDrawCommand != null && !mDrawCommand.isFrozen()) {
    mDrawCommand.setLayout(layout);
  } else {
    mDrawCommand = new DrawTextLayout(layout);
  }

  return YogaMeasureOutput.make(mDrawCommand.getLayoutWidth(), mDrawCommand.getLayoutHeight());
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:40,代码来源:RCTText.java

示例11: measure

import com.facebook.yoga.YogaMeasureOutput; //导入依赖的package包/类
@Override
public long measure(
    YogaNode node,
    float width,
    YogaMeasureMode widthMode,
    float height,
    YogaMeasureMode heightMode) {
  // measure() should never be called before setThemedContext()
  EditText editText = Assertions.assertNotNull(mEditText);

  editText.setTextSize(
      TypedValue.COMPLEX_UNIT_PX,
      mFontSize == UNSET ?
          (int) Math.ceil(PixelUtil.toPixelFromSP(ViewDefaults.FONT_SIZE_SP)) : mFontSize);

  if (mNumberOfLines != UNSET) {
    editText.setLines(mNumberOfLines);
  }

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    if (editText.getBreakStrategy() != mTextBreakStrategy) {
      editText.setBreakStrategy(mTextBreakStrategy);
    }
  }

  editText.measure(
      MeasureUtil.getMeasureSpec(width, widthMode),
      MeasureUtil.getMeasureSpec(height, heightMode));

  return YogaMeasureOutput.make(editText.getMeasuredWidth(), editText.getMeasuredHeight());
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:32,代码来源:ReactTextInputShadowNode.java

示例12: measure

import com.facebook.yoga.YogaMeasureOutput; //导入依赖的package包/类
@Override
public long measure(
    YogaNodeAPI node,
    float width,
    YogaMeasureMode widthMode,
    float height,
    YogaMeasureMode heightMode) {

  CharSequence text = getText();
  if (TextUtils.isEmpty(text)) {
    // to indicate that we don't have anything to display
    mText = null;
    return YogaMeasureOutput.make(0, 0);
  } else {
    mText = text;
  }

  Layout layout = createTextLayout(
      (int) Math.ceil(width),
      widthMode,
      TextUtils.TruncateAt.END,
      true,
      mNumberOfLines,
      mNumberOfLines == 1,
      text,
      getFontSize(),
      mSpacingAdd,
      mSpacingMult,
      getFontStyle(),
      getAlignment());

  if (mDrawCommand != null && !mDrawCommand.isFrozen()) {
    mDrawCommand.setLayout(layout);
  } else {
    mDrawCommand = new DrawTextLayout(layout);
  }

  return YogaMeasureOutput.make(mDrawCommand.getLayoutWidth(), mDrawCommand.getLayoutHeight());
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:40,代码来源:RCTText.java

示例13: measure

import com.facebook.yoga.YogaMeasureOutput; //导入依赖的package包/类
@Override
public long measure(
    YogaNodeAPI node,
    float width,
    YogaMeasureMode widthMode,
    float height,
    YogaMeasureMode heightMode) {
  // measure() should never be called before setThemedContext()
  EditText editText = Assertions.assertNotNull(mEditText);

  editText.setTextSize(
      TypedValue.COMPLEX_UNIT_PX,
      mFontSize == UNSET ?
          (int) Math.ceil(PixelUtil.toPixelFromSP(ViewDefaults.FONT_SIZE_SP)) : mFontSize);

  if (mNumberOfLines != UNSET) {
    editText.setLines(mNumberOfLines);
  }

  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
    if (editText.getBreakStrategy() != mTextBreakStrategy) {
      editText.setBreakStrategy(mTextBreakStrategy);
    }
  }

  editText.measure(
      MeasureUtil.getMeasureSpec(width, widthMode),
      MeasureUtil.getMeasureSpec(height, heightMode));

  return YogaMeasureOutput.make(editText.getMeasuredWidth(), editText.getMeasuredHeight());
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:32,代码来源:ReactTextInputShadowNode.java

示例14: measure

import com.facebook.yoga.YogaMeasureOutput; //导入依赖的package包/类
@Override
public long measure(YogaNode node, float width, YogaMeasureMode widthMode, float height, YogaMeasureMode heightMode) {
    if(!mMeasured) {
        FloatingActionButtonView nodeView = new FloatingActionButtonView(getThemedContext());
        final int spec = View.MeasureSpec.makeMeasureSpec(
                ViewGroup.LayoutParams.WRAP_CONTENT,
                View.MeasureSpec.UNSPECIFIED);
        nodeView.measure(spec, spec);
        mWidth = nodeView.getMeasuredWidth();
        mHeight = nodeView.getMeasuredHeight();
        mMeasured = true;
    }

    return YogaMeasureOutput.make(mWidth, mHeight);
}
 
开发者ID:cesardeazevedo,项目名称:react-native-bottom-sheet-behavior,代码行数:16,代码来源:FloatingActionButtonShadowNode.java


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