Giter Site home page Giter Site logo

recyclerviewselection's Introduction

Build

RecyclerView selection

Snip20210504_5 Snip20210504_4

Features:

  1. recyclerview-selection using String as a way to identify items (this allows mutability in the list as opposed to using position of the item in the list. Position of an item might change when the list mutates)
  2. ActionMode is displayed when items are activated.
  3. Activation of an item happens when long-press and also when the delete icon is clicked (due to implementation of inSelectionHotspot to activate when a specific item is clicked)
  4. Only certain items that meet the criteria get activated, others don't and those get "disabled" by making them less visible when ActionMode gets activated (SelectionPredicate)
  5. If the list mutates while the user is in ActionMode the amount of selected items is updated and if there are none selected anymore then the ActionMode finishes.
  6. Support for multiple ViewTypes, which behave differently upon click.

Useful links:

FAQ

  • Why inSelectionHotspot(e) is called ONLY if there is no items activated?

Because of this code in the library:

// Touch events select if they occur in the selection hotspot,
// otherwise they activate.
return item.inSelectionHotspot(e)
    ? selectItem(item)
    : mOnItemActivatedListener.onItemActivated(item, e);

Using this library it makes sense to startActionMode once the first item has been activated, so the user knows that the next click will be used for activating a non-activated item or to deselect an already activated item.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.