Java Code Examples for com.facebook.litho.ComponentContext#getLogger()

The following examples show how to use com.facebook.litho.ComponentContext#getLogger() . 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: RecyclerBinder.java    From litho with Apache License 2.0 6 votes vote down vote up
/** @param c The {@link ComponentContext} the RecyclerBinder will use. */
public RecyclerBinder build(ComponentContext c) {
  componentContext =
      new ComponentContext(
          c.getAndroidContext(), c.getLogTag(), c.getLogger(), null, c.getTreePropsCopy());

  // Incremental mount will not work if this ComponentTree is nested in a parent with it turned
  // off, so always disable it in that case
  incrementalMount = incrementalMount && ComponentContext.isIncrementalMountEnabled(c);
  visibilityProcessing =
      visibilityProcessing && ComponentContext.isVisibilityProcessingEnabled(c);

  if (recyclingMode == ComponentTree.RecyclingMode.DEFAULT) {
    // Only override from parent if recycling mode is not explicitly set.
    recyclingMode = c.getRecyclingMode();
  }

  if (layoutInfo == null) {
    layoutInfo = new LinearLayoutInfo(c.getAndroidContext(), VERTICAL, false);
  }

  return new RecyclerBinder(this);
}
 
Example 2
Source File: SectionsLogEventUtils.java    From litho with Apache License 2.0 6 votes vote down vote up
/**
 * Create a performance event that will add the names of the current and next section as params.
 */
@Nullable
public static PerfEvent getSectionsPerformanceEvent(
    ComponentContext c, int eventId, Section currentSection, Section nextSection) {
  final ComponentsLogger logger = c.getLogger();

  if (logger == null) {
    return null;
  }

  final PerfEvent logEvent =
      LogTreePopulator.populatePerfEventFromLogger(
          c, logger, logger.newPerformanceEvent(c, eventId));
  if (logEvent != null) {
    logEvent.markerAnnotate(
        PARAM_SECTION_CURRENT, currentSection == null ? "null" : currentSection.getSimpleName());
    logEvent.markerAnnotate(
        PARAM_SECTION_NEXT, nextSection == null ? "null" : nextSection.getSimpleName());
  }

  return logEvent;
}
 
Example 3
Source File: SectionContext.java    From litho with Apache License 2.0 5 votes vote down vote up
public SectionContext(ComponentContext context) {
  this(
      context.getAndroidContext(),
      context.getLogTag(),
      context.getLogger(),
      context.getTreePropsCopy());
}