MCPcopy Index your code
hub / github.com/exallium/RxRecyclerView

github.com/exallium/RxRecyclerView @release-2.1.2

Chat with this repo
repository ↗ · DeepWiki ↗ · release release-2.1.2 ↗ · + Follow
98 symbols 232 edges 17 files 23 documented · 23%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

RxRecyclerViewAdapter Library 2.0

Crazy easy to use RecyclerView Adapter for Reactive Applications

Data Flow Visualization

Interface

  • RxRecyclerViewAdapter::onCreateViewHolder is the same as RecyclerView.Adapter
  • RxRecyclerViewAdapter::onBindViewHolder gives you the Element you are binding to
  • RxRecyclerViewAdapter::preProcessElement gives you the chance to work with elements before they enter the underlying tree set.
  • RxRecyclerViewAdapter::postProcessElement gives you the chance to work with elements after the RecyclerView has been notified of the element.
  • Event<K,V> is Immutable and takes an Event.TYPE, Key, and Value.
  • Event<K,V> also contains an UNKNOWN type and is overridable for custom processing.
  • EventElement<K,V> and it's subclasses wrap Events and contain a view type for easy addition of headers, footers, and "list is empty" view.

Creating an Adapter

You need to have an Observable that you've merged all of your event emitters into. You then need to either map those into EventElements or utilize GroupComparator and it's corresponding Operator via Observable::lift to do the conversion for you.

Sorting and Grouping your stuff

There is an interface called GroupComparator that lets you sort and group your Events. These are passed to an instance of ElementGenerationOperator which will then add in Header and Footer items, as well as handle Empty items per your provided Options. The Adapter uses a TreeSet internally, which allows for automatic sorting by natural keys (Elements subclass Comparator).

View Types

You can create your own new view types by extending the appropriate EventElement subclass, or EventElement itself. Each View type has a corresponding bit mask that are placed in the 11th and 12th bits of the View type integer. This means that when you want to know what kind of view you are looking at, you can simply shift it's view type like so: element.getViewType() >> EventElement.MASK_SHIFT and compare it to the defined static integer masks within EventElement. This allows you to do things like create your own Header elements and whatnot, with unique viewtypes, and rest assured that they'll work properly.

This system allows us to avoid using instanceof calls everywhere, and stick to switch cases.

Examples

Are available in the app module!

Licensing

This work is (C) under the MIT License.

Gradle

This has been released on Bintray

repositories {
    maven {
        url  "http://dl.bintray.com/exallium/maven" 
    }
}

dependencies {
    compile 'com.exallium.rxrecyclerview:lib:2.1.2'
}

Extension points exported contracts — how you extend this code

GroupComparator (Interface)
Allows for easy Grouping and Sorting of Events and their Internal Data @param The Event Key @param The Event Val [2 implementers]
lib/src/main/java/com/exallium/rxrecyclerview/lib/GroupComparator.java

Core symbols most depended-on inside this repo

getData
called by 17
lib/src/main/java/com/exallium/rxrecyclerview/lib/element/EventElement.java
getKey
called by 17
lib/src/main/java/com/exallium/rxrecyclerview/lib/event/Event.java
getIndexOf
called by 7
lib/src/main/java/com/exallium/rxrecyclerview/lib/RxRecyclerViewAdapter.java
getGroup
called by 7
lib/src/main/java/com/exallium/rxrecyclerview/lib/element/EventElement.java
getValue
called by 7
lib/src/main/java/com/exallium/rxrecyclerview/lib/event/Event.java
getViewType
called by 6
lib/src/main/java/com/exallium/rxrecyclerview/lib/element/EventElement.java
getType
called by 5
lib/src/main/java/com/exallium/rxrecyclerview/lib/event/Event.java
getInstance
called by 4
app/src/main/java/com/exallium/rxrecyclerview/app/model/ObjectModel.java

Shape

Method 76
Class 20
Enum 1
Interface 1

Languages

Java100%

Modules by API surface

lib/src/main/java/com/exallium/rxrecyclerview/lib/RxRecyclerViewAdapter.java14 symbols
lib/src/main/java/com/exallium/rxrecyclerview/lib/operators/ElementGenerationOperator.java13 symbols
app/src/main/java/com/exallium/rxrecyclerview/app/Adapter.java10 symbols
app/src/androidTest/java/com/exallium/rxrecyclerview/app/MainEspressoTest.java8 symbols
lib/src/main/java/com/exallium/rxrecyclerview/lib/event/Event.java6 symbols
lib/src/main/java/com/exallium/rxrecyclerview/lib/element/EventElement.java6 symbols
app/src/main/java/com/exallium/rxrecyclerview/app/model/ObjectModel.java6 symbols
app/src/main/java/com/exallium/rxrecyclerview/app/MainActivity.java6 symbols
app/src/androidTest/java/com/exallium/rxrecyclerview/app/RecyclerViewAssertions.java5 symbols
lib/src/main/java/com/exallium/rxrecyclerview/lib/element/HeaderElement.java4 symbols
lib/src/main/java/com/exallium/rxrecyclerview/lib/element/FooterElement.java4 symbols
lib/src/main/java/com/exallium/rxrecyclerview/lib/InsertionOrderComparator.java4 symbols

For agents

$ claude mcp add RxRecyclerView \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact