本文整理汇总了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);
}
示例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());
}
示例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);
}
示例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));
}
示例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);
}
示例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());
}
示例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);
}
示例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));
}
示例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);
}
示例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());
}
示例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());
}
示例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());
}
示例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());
}
示例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