@OnEvent(ClickEvent.class) static void onClickAbsoluteChild(ComponentContext c, @Param String absoluteParam) { Toast.makeText(c.getAndroidContext(), "Absolute child clicked: " + absoluteParam, LENGTH_SHORT) .show(); } }
@OnUpdateState static void updateError(StateValue<Optional<String>> error, @Param String errorMsg) { error.set(Optional.of(errorMsg)); }
@OnUpdateState public static void onBlacklistUpdate( StateValue<HashSet> blacklistState, @Param Object modelObject, @Param EventHandler<GetUniqueIdentifierEvent> getUniqueIdentifierHandlerParam) { HashSet<Object> newSet = new HashSet<>(blacklistState.get()); newSet.add(HideableDataDiffSection.dispatchGetUniqueIdentifierEvent( getUniqueIdentifierHandlerParam, modelObject)); blacklistState.set(newSet); }
@OnUpdateState static void updateError(StateValue<Optional<Exception>> error, @Param Exception e) { error.set(Optional.of(e)); }
@OnUpdateState static void updateIsShowingDropDown( StateValue<Boolean> isShowingDropDown, @Param boolean isShowing) { isShowingDropDown.set(isShowing); }
@OnUpdateState static void updateExpandedState(StateValue<Boolean> expanded, @Param boolean expand) { expanded.set(expand); }
@OnUpdateState static void onUpdateState( StateValue<Integer> extra, @Param int newExtra) { extra.set(newExtra); }
@OnUpdateState static void updateLoadingState( StateValue<LoadingState> loadingState, @Param LoadingState currentLoadingState) { loadingState.set(currentLoadingState); }
@OnUpdateState protected static void onUpdateMeasure(@Param int measureVer, StateValue<Integer> measureVersion) { // We don't really need to update a state here. This state update is only really used to force // a re-layout on the tree containing this Recycler. measureVersion.set(measureVer); }
@OnUpdateState static void updateSnapMode(StateValue<Integer> snapMode, @Param int newSnapMode) { snapMode.set(newSnapMode); }
@OnUpdateState static void updateSelection(StateValue<String> selection, @Param String newSelection) { selection.set(newSelection); }
@OnUpdateState static void updateInput(StateValue<CharSequence> input, @Param CharSequence newInput) { input.set(newInput); }
@OnEvent(ClickEvent.class) static void onClick( ComponentContext c, @Prop List<Message> initialMessages, @Param boolean adding) { ExpandableElementRootComponent.onUpdateListSync(c, adding, initialMessages.size()); }
@OnUpdateState static void onUpdateList( StateValue<List<Message>> messages, StateValue<Integer> counter, @Param boolean adding, @Param int initialMessagesSize) { final ArrayList<Message> updatedMessageList = new ArrayList<>(messages.get()); int counterValue = counter.get(); if (adding) { updatedMessageList.add( 1, new Message(true, "Just Added #" + counterValue, true, "Recently", true)); counter.set(counterValue + 1); } else if (initialMessagesSize < updatedMessageList.size()) { updatedMessageList.remove(1); } messages.set(updatedMessageList); }
@OnEvent(ClickEvent.class) static void onClick( ComponentContext c, @Prop RecyclerCollectionEventsController eventsController, @Param boolean forward) { if (forward) { eventsController.requestScrollToNextPosition(true); } else { eventsController.requestScrollToPreviousPosition(true); } } }
@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(Object.class) public void testMethod( @Prop boolean testProp, @State int testState, @Param Object testPermittedAnnotation) { // Don't do anything. }
@OnUpdateState public void testMethod( @Prop boolean testProp, @State int testState, @Param Object testPermittedAnnotation) { // Don't do anything. } }