/** * Called during DataDiffSection's diffing to determine if two objects represent the same item. * See {@link android.support.v7.util.DiffUtil.Callback#areItemsTheSame(int, int)} for more info. * * @return true if the two objects in the event represent the same item. */ @OnEvent(OnCheckIsSameItemEvent.class) static boolean isSameItem( ComponentContext c, @FromEvent DemoListActivity.DemoListDataModel previousItem, @FromEvent DemoListActivity.DemoListDataModel nextItem) { return previousItem == nextItem; }
@OnEvent(OnCheckIsSameContentEvent.class) protected static boolean onCheckIsSameContent( SectionContext c, @FromEvent Object previousItem, @FromEvent Object nextItem, @Prop(optional = true) Comparator isSameContentComparator) { return isSameContentComparator.compare(previousItem, nextItem) == 0; } }
@OnEvent(RenderEvent.class) protected static RenderInfo onRenderEvent( SectionContext c, @FromEvent int index, @FromEvent Object model, @FromEvent Bundle loggingExtras, @Prop EventHandler<RenderWithHideItemHandlerEvent> renderWithHideItemHandler) { return HideableDataDiffSection.dispatchRenderWithHideItemHandlerEvent( renderWithHideItemHandler, index, model, HideableDataDiffSection.onHideItem(c), loggingExtras); }
@OnEvent(RenderEvent.class) static RenderInfo onRender(ComponentContext c, @FromEvent Message model) { return model.createComponent(c); } }
@OnEvent(RenderEvent.class) static RenderInfo onRender(ComponentContext c, @FromEvent Datum model) { return model.createComponent(c); } }
@OnEvent(ClickEvent.class) static void onClick( ComponentContext c, @FromEvent View view) { FavouriteButton.toggleFavouritedSync(c); } }
@OnEvent(ItemSelectedEvent.class) static void onScrollToPositionSelected( ComponentContext c, @FromEvent String newSelection, @Prop RecyclerCollectionEventsController eventsController) { eventsController.requestScrollToPositionWithSnap(Integer.parseInt(newSelection)); }
@OnEvent(ClickEvent.class) static void onClick( ComponentContext c, @FromEvent View view, @Prop final DemoListActivity.DemoListDataModel model, @Prop final int[] currentIndices) { final Intent intent = new Intent( c.getAndroidContext(), model.datamodels == null ? model.klass : DemoListActivity.class); intent.putExtra(DemoListActivity.INDICES, currentIndices); c.getAndroidContext().startActivity(intent); } }
@OnEvent(HideItemEvent.class) public static void onHideItem( SectionContext c, @FromEvent Object model, @Prop EventHandler<GetUniqueIdentifierEvent> getUniqueIdentifierHandler) { HideableDataDiffSection.onBlacklistUpdateSync(c, model, getUniqueIdentifierHandler); } }
@OnEvent(ItemSelectedEvent.class) static void onSnapModeSelected(ComponentContext c, @FromEvent String newSelection) { HorizontalScrollWithSnapComponent.updateSnapModeSync(c, getSnapModeInt(newSelection)); }
@OnEvent(ErrorEvent.class) static void __internalOnErrorHandler(ComponentContext c, @FromEvent Exception exception) {} }
@OnEvent(RenderEvent.class) static RenderInfo onRender( ComponentContext c, @Prop @Nullable int[] parentIndices, @FromEvent DemoListActivity.DemoListDataModel model, @FromEvent int index) { return ComponentRenderInfo.create() .component( DemoListItemComponent.create(c) .model(model) .currentIndices(getUpdatedIndices(parentIndices, index)) .build()) .build(); }
@OnEvent(RenderEvent.class) static RenderInfo onRender(ComponentContext c, @FromEvent ListRow model) { return ComponentRenderInfo.create().component(model.createComponent(c)).build(); } }
@OnEvent(RenderEvent.class) static RenderInfo onRender(ComponentContext c, @FromEvent String model) { return ComponentRenderInfo.create().component(createImageComponent(c, model).build()).build(); }
@OnEvent(RenderEvent.class) protected static RenderInfo onRender( SectionContext c, @FromEvent Object model, @Param ComponentContext context) { return ComponentRenderInfo.create() .customAttribute("model", model) .component(Text.create(context).text(model.toString()).build()) .build(); }
@OnEvent(RenderEvent.class) static RenderInfo renderStory(SectionContext c, @FromEvent String model, @FromEvent int index) { return ComponentRenderInfo.create() .component( StoryCardComponent.create(c) .content(model) .header( StoryHeaderComponent.create(c) .title("Story #" + index) .subtitle("subtitle") .build()) .build()) .build(); }
@OnEvent(RenderEvent.class) static RenderInfo onRender(ComponentContext c, @FromEvent Object model, @FromEvent int index) { return ComponentRenderInfo.create() .component( Row.create(c) .justifyContent(YogaJustify.CENTER) .widthDip(120) .heightDip(120) .backgroundColor((int) model) .child( Text.create(c) .textSizeSp(20) .textColor(Color.LTGRAY) .text(Integer.toString(index)) .verticalGravity(VerticalGravity.CENTER))) .build(); }
@OnEvent(Object.class) public void testEventMethod1( @Prop boolean arg0, @State int arg1, @Param Object arg2, @Param T arg3, @FromEvent long arg4) {}