Java Code Examples for androidx.recyclerview.widget.RecyclerView#setOverScrollMode()

The following examples show how to use androidx.recyclerview.widget.RecyclerView#setOverScrollMode() . 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: SingleChoiceListDialogFragment.java    From SAI with GNU General Public License v3.0 5 votes vote down vote up
@Nullable
@Override
protected View onCreateContentView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    RecyclerView recyclerView = new RecyclerView(requireContext());
    recyclerView.setOverScrollMode(RecyclerView.OVER_SCROLL_NEVER);
    return recyclerView;
}
 
Example 2
Source File: SingleChoiceListDialogFragment.java    From SAI with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onContentViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onContentViewCreated(view, savedInstanceState);

    setTitle(mParams.title);
    getPositiveButton().setVisibility(View.GONE);
    getNegativeButton().setOnClickListener(v -> dismiss());

    RecyclerView recyclerView = (RecyclerView) view;
    recyclerView.setOverScrollMode(RecyclerView.OVER_SCROLL_NEVER);
    recyclerView.setLayoutManager(new LinearLayoutManager(requireContext()));
    recyclerView.setAdapter(new ItemsAdapter());

    revealBottomSheet();
}
 
Example 3
Source File: ThemeSelectionDialogFragment.java    From SAI with GNU General Public License v3.0 5 votes vote down vote up
@Nullable
@Override
protected View onCreateContentView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    RecyclerView recyclerView = new RecyclerView(requireContext());
    recyclerView.setOverScrollMode(RecyclerView.OVER_SCROLL_NEVER);
    return recyclerView;
}
 
Example 4
Source File: RecyclerSpec.java    From litho with Apache License 2.0 4 votes vote down vote up
@OnMount
static void onMount(
    ComponentContext c,
    SectionsRecyclerView sectionsRecycler,
    @Prop Binder<RecyclerView> binder,
    @Prop(optional = true) boolean hasFixedSize,
    @Prop(optional = true) boolean clipToPadding,
    @Prop(optional = true) int leftPadding,
    @Prop(optional = true) int rightPadding,
    @Prop(optional = true) int topPadding,
    @Prop(optional = true) int bottomPadding,
    @Prop(optional = true, resType = ResType.COLOR) @Nullable
        Integer refreshProgressBarBackgroundColor,
    @Prop(optional = true, resType = ResType.COLOR) int refreshProgressBarColor,
    @Prop(optional = true) boolean clipChildren,
    @Prop(optional = true) boolean nestedScrollingEnabled,
    @Prop(optional = true) int scrollBarStyle,
    @Prop(optional = true) RecyclerView.ItemDecoration itemDecoration,
    @Prop(optional = true) boolean horizontalFadingEdgeEnabled,
    @Prop(optional = true) boolean verticalFadingEdgeEnabled,
    @Prop(optional = true, resType = ResType.DIMEN_SIZE) int fadingEdgeLength,
    @Prop(optional = true) @IdRes int recyclerViewId,
    @Prop(optional = true) int overScrollMode,
    @Prop(optional = true, isCommonProp = true) CharSequence contentDescription,
    @Prop(optional = true) ItemAnimator itemAnimator) {
  final RecyclerView recyclerView = sectionsRecycler.getRecyclerView();

  if (recyclerView == null) {
    throw new IllegalStateException(
        "RecyclerView not found, it should not be removed from SwipeRefreshLayout");
  }
  recyclerView.setContentDescription(contentDescription);
  recyclerView.setHasFixedSize(hasFixedSize);
  recyclerView.setClipToPadding(clipToPadding);
  sectionsRecycler.setClipToPadding(clipToPadding);
  ViewCompat.setPaddingRelative(
      recyclerView, leftPadding, topPadding, rightPadding, bottomPadding);
  recyclerView.setClipChildren(clipChildren);
  sectionsRecycler.setClipChildren(clipChildren);
  recyclerView.setNestedScrollingEnabled(nestedScrollingEnabled);
  sectionsRecycler.setNestedScrollingEnabled(nestedScrollingEnabled);
  recyclerView.setScrollBarStyle(scrollBarStyle);
  recyclerView.setHorizontalFadingEdgeEnabled(horizontalFadingEdgeEnabled);
  recyclerView.setVerticalFadingEdgeEnabled(verticalFadingEdgeEnabled);
  recyclerView.setFadingEdgeLength(fadingEdgeLength);
  // TODO (t14949498) determine if this is necessary
  recyclerView.setId(recyclerViewId);
  recyclerView.setOverScrollMode(overScrollMode);
  if (refreshProgressBarBackgroundColor != null) {
    sectionsRecycler.setProgressBackgroundColorSchemeColor(refreshProgressBarBackgroundColor);
  }
  sectionsRecycler.setColorSchemeColors(refreshProgressBarColor);

  if (itemDecoration != null) {
    recyclerView.addItemDecoration(itemDecoration);
  }

  sectionsRecycler.setItemAnimator(
      itemAnimator != RecyclerSpec.itemAnimator ? itemAnimator : new NoUpdateItemAnimator());

  binder.mount(recyclerView);
}