Skip to content

Commit

Permalink
Move RecyclerConfiguration to top-level
Browse files Browse the repository at this point in the history
Summary:
The nesting seems counter-intuitive as it's implemented by other top-level
classes and has the side-effect of being excluded from javadoc generation as
it's part of the spec and not the generated component.

Reviewed By: IanChilds, marco-cova

Differential Revision: D7287233

fbshipit-source-id: a73ccb1e75bd0bb4ec76df0c10a65e1538f021d2
  • Loading branch information
passy authored and facebook-github-bot committed Mar 15, 2018
1 parent d980e88 commit f2b00a8
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import android.support.v7.widget.SnapHelper;
import com.facebook.litho.ComponentContext;
import com.facebook.litho.sections.SectionTree;
import com.facebook.litho.sections.widget.RecyclerCollectionComponentSpec.RecyclerConfiguration;
import com.facebook.litho.widget.Binder;
import com.facebook.litho.widget.GridLayoutInfo;
import com.facebook.litho.widget.RecyclerBinder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import android.support.v7.widget.SnapHelper;
import com.facebook.litho.ComponentContext;
import com.facebook.litho.sections.SectionTree;
import com.facebook.litho.sections.widget.RecyclerCollectionComponentSpec.RecyclerConfiguration;
import com.facebook.litho.widget.Binder;
import com.facebook.litho.widget.LinearLayoutInfo;
import com.facebook.litho.widget.RecyclerBinder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
import com.facebook.litho.widget.StaggeredGridLayoutHelper;
import com.facebook.litho.widget.ViewportInfo;
import java.util.List;
import javax.annotation.Nullable;

/**
* A {@link Component} that renders a {@link Recycler} backed by a {@link Section} tree.
Expand Down Expand Up @@ -107,18 +106,6 @@ public class RecyclerCollectionComponentSpec {
@PropDefault static final int refreshProgressBarColor = 0XFF4267B2; // blue
private static final int MIN_SCROLL_FOR_PAGE = 20;

/**
* A configuration object the {@link RecyclerCollectionComponent} will use to determine which
* layout manager should be used for the {@link RecyclerView}
*/
public interface RecyclerConfiguration {

<E extends Binder<RecyclerView> & Target> E buildTarget(ComponentContext c);

@Nullable
SnapHelper getSnapHelper();
}

@OnCreateLayout
static Component onCreateLayout(
final ComponentContext c,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright (c) 2017-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*/

package com.facebook.litho.sections.widget;

import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SnapHelper;
import com.facebook.litho.ComponentContext;
import com.facebook.litho.sections.SectionTree;
import com.facebook.litho.widget.Binder;
import javax.annotation.Nullable;

/**
* A configuration object the {@link RecyclerCollectionComponent} will use to determine which layout
* manager should be used for the {@link RecyclerView}
*/
public interface RecyclerConfiguration {

<E extends Binder<RecyclerView> & SectionTree.Target> E buildTarget(ComponentContext c);

@Nullable
SnapHelper getSnapHelper();
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
import android.support.v7.widget.StaggeredGridLayoutManager;
import com.facebook.litho.ComponentContext;
import com.facebook.litho.sections.SectionTree;
import com.facebook.litho.sections.widget.RecyclerCollectionComponentSpec.RecyclerConfiguration;
import com.facebook.litho.widget.Binder;
import com.facebook.litho.widget.RecyclerBinder;
import com.facebook.litho.widget.StaggeredGridLayoutInfo;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import com.facebook.litho.sections.common.RenderEvent;
import com.facebook.litho.sections.widget.ListRecyclerConfiguration;
import com.facebook.litho.sections.widget.RecyclerCollectionComponent;
import com.facebook.litho.sections.widget.RecyclerCollectionComponentSpec.RecyclerConfiguration;
import com.facebook.litho.sections.widget.RecyclerConfiguration;
import com.facebook.litho.widget.ComponentRenderInfo;
import com.facebook.litho.widget.RenderInfo;
import java.util.Arrays;
Expand Down

0 comments on commit f2b00a8

Please sign in to comment.