Java Code Examples for com.facebook.litho.annotations.ResType#FLOAT

The following examples show how to use com.facebook.litho.annotations.ResType#FLOAT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FrescoImageSpec.java    From litho with Apache License 2.0 5 votes vote down vote up
@OnMeasure
protected static void onMeasure(
    ComponentContext c,
    ComponentLayout layout,
    int widthSpec,
    int heightSpec,
    Size size,
    @Prop(optional = true, resType = ResType.FLOAT) float imageAspectRatio) {
  MeasureUtils.measureWithAspectRatio(widthSpec, heightSpec, imageAspectRatio, size);
}
 
Example 2
Source File: FrescoVitoImage2Spec.java    From fresco with MIT License 5 votes vote down vote up
@OnMeasure
static void onMeasure(
    ComponentContext c,
    ComponentLayout layout,
    int widthSpec,
    int heightSpec,
    Size size,
    @Prop(optional = true, resType = ResType.FLOAT) float imageAspectRatio) {
  MeasureUtils.measureWithAspectRatio(widthSpec, heightSpec, imageAspectRatio, size);
}
 
Example 3
Source File: FrescoVitoImage2Spec.java    From fresco with MIT License 5 votes vote down vote up
@ShouldUpdate(onMount = true)
static boolean shouldUpdate(
    @Prop(optional = true) Diff<Uri> uri,
    @Prop(optional = true) Diff<ImageSource> imageSource,
    @Prop(optional = true) Diff<ImageOptions> imageOptions,
    @Prop(optional = true, resType = ResType.FLOAT) Diff<Float> imageAspectRatio,
    @Prop(optional = true) Diff<ImageListener> imageListener) {
  return !ObjectsCompat.equals(uri.getPrevious(), uri.getNext())
      || !ObjectsCompat.equals(imageSource.getPrevious(), imageSource.getNext())
      || !ObjectsCompat.equals(imageOptions.getPrevious(), imageOptions.getNext())
      || !ObjectsCompat.equals(imageAspectRatio.getPrevious(), imageAspectRatio.getNext())
      || !ObjectsCompat.equals(imageListener.getPrevious(), imageListener.getNext());
}
 
Example 4
Source File: EditTextSpec.java    From litho with Apache License 2.0 4 votes vote down vote up
@OnMount
static void onMount(
    final ComponentContext c,
    EditTextWithEventHandlers editText,
    @Prop(optional = true, resType = ResType.STRING) CharSequence text,
    @Prop(optional = true, resType = ResType.STRING) CharSequence initialText,
    @Prop(optional = true, resType = ResType.STRING) CharSequence hint,
    @Prop(optional = true) TextUtils.TruncateAt ellipsize,
    @Prop(optional = true, resType = ResType.INT) int minLines,
    @Prop(optional = true, resType = ResType.INT) int maxLines,
    @Prop(optional = true, resType = ResType.INT) int maxLength,
    @Prop(optional = true, resType = ResType.DIMEN_OFFSET) float shadowRadius,
    @Prop(optional = true, resType = ResType.DIMEN_OFFSET) float shadowDx,
    @Prop(optional = true, resType = ResType.DIMEN_OFFSET) float shadowDy,
    @Prop(optional = true, resType = ResType.COLOR) int shadowColor,
    @Prop(optional = true, resType = ResType.BOOL) boolean isSingleLine,
    @Prop(optional = true, resType = ResType.COLOR) int textColor,
    @Prop(optional = true) ColorStateList textColorStateList,
    @Prop(optional = true, resType = ResType.COLOR) int hintColor,
    @Prop(optional = true) ColorStateList hintColorStateList,
    @Prop(optional = true, resType = ResType.COLOR) int linkColor,
    @Prop(optional = true, resType = ResType.COLOR) int highlightColor,
    @Prop(optional = true) ColorStateList tintColorStateList,
    @Prop(optional = true, resType = ResType.DIMEN_TEXT) int textSize,
    @Prop(optional = true, resType = ResType.DIMEN_OFFSET) float extraSpacing,
    @Prop(optional = true, resType = ResType.FLOAT) float spacingMultiplier,
    @Prop(optional = true) int textStyle,
    @Prop(optional = true) Typeface typeface,
    @Prop(optional = true) Layout.Alignment textAlignment,
    @Prop(optional = true) int gravity,
    @Prop(optional = true) boolean editable,
    @Prop(optional = true) int selection,
    @Prop(optional = true) int inputType,
    @Prop(optional = true) int rawInputType,
    @Prop(optional = true) int imeOptions,
    @Prop(optional = true) TextView.OnEditorActionListener editorActionListener,
    @Prop(optional = true) boolean isSingleLineWrap,
    @Prop(optional = true) boolean requestFocus,
    @Prop(optional = true) int cursorDrawableRes,
    @Prop(optional = true, varArg = "inputFilter") List<InputFilter> inputFilters,
    @State AtomicReference<EditTextWithEventHandlers> mountedView,
    @State AtomicBoolean configuredInitialText,
    @State(canUpdateLazily = true) CharSequence input) {

  mountedView.set(editText);

  initEditText(
      editText,
      input == null ? text : input,
      // Only set initialText on the EditText during the very first mount.
      configuredInitialText.getAndSet(true) ? null : initialText,
      hint,
      ellipsize,
      inputFilters,
      minLines,
      maxLines,
      maxLength,
      shadowRadius,
      shadowDx,
      shadowDy,
      shadowColor,
      isSingleLine,
      textColor,
      textColorStateList,
      hintColor,
      hintColorStateList,
      linkColor,
      highlightColor,
      tintColorStateList,
      textSize,
      extraSpacing,
      spacingMultiplier,
      textStyle,
      typeface,
      textAlignment,
      gravity,
      editable,
      selection,
      inputType,
      rawInputType,
      imeOptions,
      editorActionListener,
      isSingleLineWrap,
      requestFocus,
      cursorDrawableRes);
}
 
Example 5
Source File: GlideImageSpec.java    From litho-glide with MIT License 4 votes vote down vote up
@OnMeasure
static void onMeasureLayout(ComponentContext c, ComponentLayout layout, int widthSpec,
    int heightSpec, Size size,
    @Prop(optional = true, resType = ResType.FLOAT) float imageAspectRatio) {
  MeasureUtils.measureWithAspectRatio(widthSpec, heightSpec, imageAspectRatio, size);
}