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

The following examples show how to use androidx.recyclerview.widget.RecyclerView#setNestedScrollingEnabled() . 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: GroupManagerActivity.java    From Aegis with GNU General Public License v3.0 6 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_groups);

    Intent intent = getIntent();
    _groups = new TreeSet<>(Collator.getInstance());
    _groups.addAll(intent.getStringArrayListExtra("groups"));

    if (getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setDisplayShowHomeEnabled(true);
    }

    // set up the recycler view
    _adapter = new GroupAdapter(this);
    RecyclerView slotsView = findViewById(R.id.list_slots);
    LinearLayoutManager layoutManager = new LinearLayoutManager(this);
    slotsView.setLayoutManager(layoutManager);
    slotsView.setAdapter(_adapter);
    slotsView.setNestedScrollingEnabled(false);

    for (String group : _groups) {
        _adapter.addGroup(group);
    }
}
 
Example 2
Source File: HelpFragment.java    From Status with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View v = inflater.inflate(R.layout.fragment_help, container, false);

    RecyclerView recycler = v.findViewById(R.id.recycler);

    recycler.setLayoutManager(new GridLayoutManager(getContext(), 1));
    recycler.setNestedScrollingEnabled(false);

    adapter = new ArrayAdapter(getContext(), R.array.faq);
    recycler.setAdapter(adapter);

    v.findViewById(R.id.community).setOnClickListener(v1 -> startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(COMMUNITY_URL))));

    return v;
}
 
Example 3
Source File: CollegeActivity.java    From AndroidAnimationExercise with Apache License 2.0 6 votes vote down vote up
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View rootView = inflater.inflate(R.layout.fragment_college, container, false);
    RecyclerView mRecyclerView = (RecyclerView) rootView.findViewById(R.id.recyclerview);

    List<String> datas = getArguments().getStringArrayList(ARG_SECTION_DATAS);
    LinearLayoutManager mLinearLayoutManager = new LinearLayoutManager(getContext());
    mLinearLayoutManager.setSmoothScrollbarEnabled(true);
    mRecyclerView.setLayoutManager(mLinearLayoutManager);
    mRecyclerView.setHasFixedSize(true);
    mRecyclerView.setNestedScrollingEnabled(false);
    MyAdapter mMyAdapter = new MyAdapter(datas);
    mRecyclerView.setAdapter(mMyAdapter);
    return rootView;
}
 
Example 4
Source File: ReactWithAnyEmojiAdapter.java    From mollyim-android with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onAttachedToRecyclerView(@NonNull RecyclerView recyclerView) {
  recyclerView.setNestedScrollingEnabled(false);
  ViewGroup.LayoutParams params = recyclerView.getLayoutParams();
  params.height = (int) (recyclerView.getResources().getDisplayMetrics().heightPixels * 0.80);
  recyclerView.setLayoutParams(params);
  recyclerView.setHasFixedSize(true);
}
 
Example 5
Source File: PlaylistRecyclerViewAdapter.java    From Bop with Apache License 2.0 5 votes vote down vote up
@Override
public void onAttachedToRecyclerView(@NonNull RecyclerView recyclerView) {
    super.onAttachedToRecyclerView(recyclerView);

    mRecyclerView = recyclerView;
    recyclerView.setNestedScrollingEnabled(false);
}
 
Example 6
Source File: ResultView.java    From mapbox-plugins-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void initializeResultList() {
  RecyclerView recyclerView = findViewById(R.id.rv_search_results);
  RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(getContext());
  layoutManager.setAutoMeasureEnabled(true);
  recyclerView.addItemDecoration(new ResultItemDecoration(getContext()));
  recyclerView.setLayoutManager(layoutManager);
  recyclerView.setNestedScrollingEnabled(false);
  recyclerView.setAdapter(adapter);
}
 
Example 7
Source File: SelectEntriesActivity.java    From Aegis with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_select_entries);

    ActionBar bar = getSupportActionBar();
    bar.setHomeAsUpIndicator(R.drawable.ic_close);
    bar.setDisplayHomeAsUpEnabled(true);

    _adapter = new ImportEntriesAdapter();
    RecyclerView entriesView = findViewById(R.id.list_entries);
    entriesView.addOnScrollListener(new RecyclerView.OnScrollListener() {
        @Override
        public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
            super.onScrolled(recyclerView, dx, dy);
            onScroll(dx, dy);
        }
    });

    LinearLayoutManager layoutManager = new LinearLayoutManager(this);
    entriesView.setLayoutManager(layoutManager);
    entriesView.setAdapter(_adapter);
    entriesView.setNestedScrollingEnabled(false);

    Intent intent = getIntent();
    List<ImportEntry> entries = (ArrayList<ImportEntry>) intent.getSerializableExtra("entries");
    List<DatabaseImporterEntryException> errors = (ArrayList<DatabaseImporterEntryException>) intent.getSerializableExtra("errors");

    for (ImportEntry entry : entries) {
        _adapter.addEntry(entry);
    }

    if (errors.size() > 0) {
        showErrorDialog(errors);
    }

    FloatingActionButton fabMenu = findViewById(R.id.fab);
    fabMenu.setOnClickListener(v -> returnSelectedEntries());
    _fabScrollHelper = new FabScrollHelper(fabMenu);
}
 
Example 8
Source File: MaterialAboutListAdapter.java    From material-about-library with Apache License 2.0 5 votes vote down vote up
MaterialAboutListViewHolder(View view) {
    super(view);
    cardView = view.findViewById(R.id.mal_list_card);
    title = (TextView) view.findViewById(R.id.mal_list_card_title);
    recyclerView = (RecyclerView) view.findViewById(R.id.mal_card_recyclerview);
    adapter = new MaterialAboutItemAdapter(viewTypeManager);
    recyclerView.setLayoutManager(new LinearLayoutManager(context));
    recyclerView.setAdapter(adapter);
    recyclerView.setNestedScrollingEnabled(false);
}
 
Example 9
Source File: DebugPageContentView.java    From under-the-hood with Apache License 2.0 5 votes vote down vote up
private void setup(@ColorInt int zebraColor) {
    FrameLayout layout = (FrameLayout) LayoutInflater.from(getContext()).inflate(R.layout.hoodlib_view_page, this, true);
    setNestedScrollingEnabled(true);
    mRecyclerView = (RecyclerView) layout.findViewById(R.id.recycler_view);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    mRecyclerView.setNestedScrollingEnabled(true);
    mRecyclerView.setAdapter(new DebugEntriesAdapter(page, zebraColor));
}
 
Example 10
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);
}
 
Example 11
Source File: SlotManagerActivity.java    From Aegis with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_slots);
    _edited = false;

    ActionBar bar = getSupportActionBar();
    bar.setHomeAsUpIndicator(R.drawable.ic_close);
    bar.setDisplayHomeAsUpEnabled(true);

    findViewById(R.id.button_add_biometric).setOnClickListener(view -> {
        if (BiometricsHelper.isAvailable(this)) {
            BiometricSlotInitializer initializer = new BiometricSlotInitializer(SlotManagerActivity.this, new RegisterBiometricsListener());
            BiometricPrompt.PromptInfo info = new BiometricPrompt.PromptInfo.Builder()
                    .setTitle(getString(R.string.add_biometric_slot))
                    .setNegativeButtonText(getString(android.R.string.cancel))
                    .build();
            initializer.authenticate(info);
        }
    });

    findViewById(R.id.button_add_password).setOnClickListener(view -> {
        Dialogs.showSetPasswordDialog(this, new PasswordListener());
    });

    // set up the recycler view
    _adapter = new SlotAdapter(this);
    RecyclerView slotsView = findViewById(R.id.list_slots);
    LinearLayoutManager layoutManager = new LinearLayoutManager(this);
    slotsView.setLayoutManager(layoutManager);
    slotsView.setAdapter(_adapter);
    slotsView.setNestedScrollingEnabled(false);

    // load the slots and masterKey
    _creds = (VaultFileCredentials) getIntent().getSerializableExtra("creds");
    for (Slot slot : _creds.getSlots()) {
        _adapter.addSlot(slot);
    }

    updateBiometricsButton();
}