@PropDefault public final String getTitle() { return title; } }
private static ImmutableList<PropDefaultModel> extractFromField(Element enclosedElement) { if (enclosedElement.getKind() != ElementKind.FIELD) { return ImmutableList.of(); } final VariableElement variableElement = (VariableElement) enclosedElement; final Annotation propDefaultAnnotation = variableElement.getAnnotation(PropDefault.class); if (propDefaultAnnotation == null) { return ImmutableList.of(); } final ResType propDefaultResType = ((PropDefault) propDefaultAnnotation).resType(); final int propDefaultResId = ((PropDefault) propDefaultAnnotation).resId(); return ImmutableList.of( new PropDefaultModel( TypeName.get(variableElement.asType()), variableElement.getSimpleName().toString(), ImmutableList.copyOf(new ArrayList<>(variableElement.getModifiers())), variableElement, propDefaultResType, propDefaultResId)); }
@PropDefault public static void title$annotations() {} }
private static final int DEFAULT_SHADOW_SIZE_DP = 2; @PropDefault static final int cardBackgroundColor = Color.WHITE; @PropDefault static final int clippingColor = Color.TRANSPARENT; @PropDefault static final int shadowStartColor = 0x37000000; @PropDefault static final int shadowEndColor = 0x03000000; @PropDefault static final float cornerRadius = -1; @PropDefault static final float elevation = -1; @PropDefault static final int shadowBottomOverride = -1;
@PropDefault protected static final float imageAspectRatio = FrescoImageDefaults.DEFAULT_IMAGE_ASPECT_RATION; @PropDefault protected static final ScalingUtils.ScaleType actualImageScaleType = FrescoImageDefaults.DEFAULT_ACTUAL_IMAGE_SCALE_TYPE; @PropDefault protected static final int fadeDuration = FrescoImageDefaults.DEFAULT_FADE_DURATION; @PropDefault protected static final ScalingUtils.ScaleType failureImageScaleType = FrescoImageDefaults.DEFAULT_SCALE_TYPE; @PropDefault protected static final PointF placeholderImageFocusPoint = FrescoImageDefaults.DEFAULT_PLACEHOLDER_IMAGE_FOCUS_POINT; @PropDefault protected static final ScalingUtils.ScaleType placeholderImageScaleType = FrescoImageDefaults.DEFAULT_SCALE_TYPE; @PropDefault protected static final ScalingUtils.ScaleType progressBarImageScaleType = FrescoImageDefaults.DEFAULT_SCALE_TYPE; @PropDefault protected static final ScalingUtils.ScaleType retryImageScaleType = FrescoImageDefaults.DEFAULT_SCALE_TYPE;
private static final int DEFAULT_SHADOW_SIZE_DP = 2; @PropDefault static final int cardBackgroundColor = Color.WHITE; @PropDefault static final int clippingColor = Color.WHITE; @PropDefault static final int shadowStartColor = 0x37000000; @PropDefault static final int shadowEndColor = 0x03000000; @PropDefault static final float cornerRadius = -1; @PropDefault static final float elevation = -1; @PropDefault static final int shadowBottomOverride = -1;
@GroupSectionSpec public class TestGroupSectionSpec { @PropDefault public static final Boolean trimHeadAndTail = false; @PropDefault public static final Boolean trimSameInstancesOnly = false;
class RecyclerSpec { @PropDefault static final int scrollBarStyle = View.SCROLLBARS_INSIDE_OVERLAY; @PropDefault static final boolean hasFixedSize = true; @PropDefault static final boolean nestedScrollingEnabled = true; @PropDefault static final ItemAnimator itemAnimator = new NoUpdateItemAnimator(); @PropDefault static final int recyclerViewId = View.NO_ID; @PropDefault static final int overScrollMode = View.OVER_SCROLL_ALWAYS; @PropDefault static final int refreshProgressBarColor = Color.BLACK; @PropDefault static final boolean clipToPadding = true; @PropDefault static final boolean clipChildren = true; @PropDefault static final int leftPadding = 0; @PropDefault static final int rightPadding = 0; @PropDefault static final int topPadding = 0; @PropDefault static final int bottomPadding = 0; @PropDefault static final boolean pullToRefresh = true;
/** * A component that renders a solid color. * * @uidocs https://fburl.com/SolidColor:b0df * @prop color Color to be shown. * @prop alpha The alpha of the color, in the range [0.0, 1.0] */ @LayoutSpec class SolidColorSpec { @PropDefault static final float alpha = -1.0f; @OnCreateLayout static Component onCreateLayout( ComponentContext c, @Prop(resType = COLOR) int color, @Prop(optional = true, isCommonProp = true, overrideCommonPropBehavior = true) float alpha) { if (alpha >= 0f) { alpha = Math.min(1f, alpha); color = ColorUtils.setAlphaComponent(color, (int) (alpha * 255f)); } return Image.create(c) .scaleType(FIT_XY) .drawable(new ColorDrawable(color)) .build(); } }
class TransparencyEnabledCardClipSpec { @PropDefault static final int cardBackgroundColor = Color.WHITE;
@PropDefault protected static final int minLines = Integer.MIN_VALUE; @PropDefault protected static final int maxLines = Integer.MAX_VALUE; @PropDefault protected static final int minEms = DEFAULT_EMS; @PropDefault protected static final int maxEms = DEFAULT_EMS; @PropDefault protected static final int minTextWidth = DEFAULT_MIN_WIDTH; @PropDefault protected static final int maxTextWidth = DEFAULT_MAX_WIDTH; @PropDefault protected static final int shadowColor = Color.GRAY; @PropDefault protected static final int textColor = DEFAULT_COLOR; @PropDefault protected static final int linkColor = DEFAULT_COLOR; @PropDefault protected static final ColorStateList textColorStateList = new ColorStateList( DEFAULT_TEXT_COLOR_STATE_LIST_STATES, DEFAULT_TEXT_COLOR_STATE_LIST_COLORS); @PropDefault protected static final int textSize = 13; @PropDefault protected static final int textStyle = DEFAULT_TYPEFACE.getStyle(); @PropDefault protected static final Typeface typeface = DEFAULT_TYPEFACE; @PropDefault protected static final float spacingMultiplier = 1.0f; @PropDefault protected static final VerticalGravity verticalGravity = VerticalGravity.TOP; @PropDefault protected static final boolean glyphWarming = false; @PropDefault protected static final boolean shouldIncludeFontPadding = true; @PropDefault protected static final Alignment textAlignment = TextStylesHelper.textAlignmentDefault; @PropDefault protected static final int breakStrategy = DEFAULT_BREAK_STRATEGY; @PropDefault protected static final int hyphenationFrequency = DEFAULT_HYPHENATION_FREQUENCY; @PropDefault protected static final int justificationMode = DEFAULT_JUSTIFICATION_MODE; @PropDefault protected static final int highlightStartOffset = -1; @PropDefault protected static final int highlightEndOffset = -1; @PropDefault protected static final boolean clipToBounds = true;
@PropDefault protected static final int minLines = Integer.MIN_VALUE; @PropDefault protected static final int maxLines = Integer.MAX_VALUE; @PropDefault protected static final int maxLength = Integer.MAX_VALUE; @PropDefault protected static final int shadowColor = Color.GRAY; @PropDefault protected static final int textColor = DEFAULT_COLOR; @PropDefault protected static final ColorStateList textColorStateList = new ColorStateList(DEFAULT_TEXT_COLOR_STATE_LIST_STATES,DEFAULT_TEXT_COLOR_STATE_LIST_COLORS); @PropDefault protected static final int hintColor = DEFAULT_HINT_COLOR; @PropDefault protected static final ColorStateList hintColorStateList = new ColorStateList(DEFAULT_HINT_COLOR_STATE_LIST_STATES,DEFAULT_HINT_COLOR_STATE_LIST_COLORS); @PropDefault protected static final int linkColor = DEFAULT_COLOR; @PropDefault protected static final int textSize = 13; @PropDefault protected static final int textStyle = DEFAULT_TYPEFACE.getStyle(); @PropDefault protected static final Typeface typeface = DEFAULT_TYPEFACE; @PropDefault protected static final float spacingMultiplier = 1.0f; @PropDefault protected static final Layout.Alignment textAlignment = ALIGN_NORMAL; @PropDefault protected static final int gravity = DEFAULT_GRAVITY; @PropDefault protected static final boolean editable = true; @PropDefault protected static final int selection = -1; @PropDefault protected static final int inputType = EditorInfo.TYPE_CLASS_TEXT | EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE; @PropDefault protected static final int rawInputType = EditorInfo.TYPE_NULL; @PropDefault protected static final int imeOptions = EditorInfo.IME_NULL; @PropDefault protected static final boolean isSingleLineWrap = false; @PropDefault protected static final boolean requestFocus = false; @PropDefault protected static final int cursorDrawableRes = -1; @PropDefault protected static final EditTextStateUpdatePolicy stateUpdatePolicy = NO_UPDATES;
public class RecyclerCollectionComponentSpec { @PropDefault public static final RecyclerConfiguration recyclerConfiguration = new ListRecyclerConfiguration(); @PropDefault public static final boolean nestedScrollingEnabled = true; @PropDefault public static final int scrollBarStyle = View.SCROLLBARS_INSIDE_OVERLAY; @PropDefault public static final int recyclerViewId = View.NO_ID; @PropDefault public static final int overScrollMode = View.OVER_SCROLL_ALWAYS; @PropDefault protected static final boolean asyncStateUpdates = SectionsConfiguration.sectionComponentsAsyncStateUpdates; @PropDefault public static final ItemAnimator itemAnimator = new NoUpdateItemAnimator(); @PropDefault protected static final boolean asyncPropUpdates = SectionsConfiguration.sectionComponentsAsyncPropUpdates; @PropDefault protected static final boolean setRootAsync = ComponentsConfiguration.setRootAsyncRecyclerCollectionComponent; @PropDefault public static final boolean clipToPadding = true; @PropDefault public static final boolean clipChildren = true; @PropDefault public static final int refreshProgressBarColor = 0XFF4267B2; // blue private static final int MIN_SCROLL_FOR_PAGE = 20;
@PropDefault protected static final ColorStateList textColorStateList = ColorStateList.valueOf(Color.BLACK); @PropDefault protected static final ColorStateList hintColorStateList = ColorStateList.valueOf(Color.LTGRAY); @PropDefault static final CharSequence hint = ""; @PropDefault static final CharSequence initialText = ""; @PropDefault protected static final int shadowColor = Color.GRAY; @PropDefault protected static final int textSize = 13; @PropDefault protected static final Typeface typeface = Typeface.DEFAULT; @PropDefault protected static final int textAlignment = TEXT_ALIGNMENT_GRAVITY; @PropDefault protected static final int gravity = Gravity.CENTER_VERTICAL | Gravity.START; @PropDefault protected static final boolean editable = true; @PropDefault protected static final int inputType = EditorInfo.TYPE_CLASS_TEXT; @PropDefault protected static final int imeOptions = EditorInfo.IME_NULL; @PropDefault protected static final int cursorDrawableRes = -1; @PropDefault static final boolean multiline = false; @PropDefault protected static final int minLines = 1; @PropDefault protected static final int maxLines = Integer.MAX_VALUE;
@LayoutSpec public class LearningStateComponentSpec { @PropDefault static final boolean canClick = true;
private static final int SPINNER_HEIGHT = 48; @PropDefault static final int itemLayout = android.R.layout.simple_dropdown_item_1line; @PropDefault static final float selectedTextSize = -1; @PropDefault static final int selectedTextColor = 0xDE000000; // 87% Black
class CardClipSpec { @PropDefault static final int clippingColor = Color.WHITE;
public class VerticalScrollSpec { @PropDefault static final boolean scrollbarEnabled = true; @PropDefault static final boolean scrollbarFadingEnabled = true;
@LayoutSpec static class TestSpec { @PropDefault protected static boolean arg0 = true; @PropDefault(resType = ResType.DIMEN_SIZE, resId = 12345) protected static float arg5; @OnCreateLayout public void testDelegateMethod( @Prop boolean arg0, @Prop Section section, @State int arg1, @Param Object arg2, @Prop(optional = true) boolean arg3, @Prop(varArg = "name") List<String> names, @Prop(optional = true) float arg5) {} @OnEvent(Object.class) public void testEventMethod(@Prop boolean arg0) {} @OnUpdateState public void testUpdateStateMethod() {} }