GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - marcorei/Infinite-Fire: Connects Firebase to a RecyclerView

This repository was archived by the owner on Apr 24, 2018. It is now read-only.
BranchesTags
Open more actions menu

Latest commit

 

History

27 Commits
27 Commits

Folders and files

NameName
Last commit message
Last commit date
app
app
 
 
gradle/wrapper
gradle/wrapper
 
 
infinitefire
infinitefire
 
 
.gitignore
.gitignore
 
 
Infinite-Fire.iml
Infinite-Fire.iml
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
build.gradle
build.gradle
 
 
gradle.properties
gradle.properties
 
 
gradlew
gradlew
 
 
gradlew.bat
gradlew.bat
 
 
settings.gradle
settings.gradle
 
 

Repository files navigation

⚠️ This project is no longer maintained ⚠️


Infinite Fire

A small library that helps you connecting Firebase to a RecyclerView.

Inspired by the official FirebaseUI-Android library.

Demo

Add your own google-services.json to the app folder to run the demo app! Use the following rules for your database:

{
  "rules": {
    ".read": "auth != null",
    ".write": "auth != null",
    "chat": {
      ".read": "true",
      "$chat": {
        ".write": "true",
        ".validate": "newData.hasChildren(['name', 'text'])",
        "name": {".validate": "true"},
        "text": {".validate": "true"},
        "$other": {".validate": "false"}
      }
    }
  }
}

How to use Infinite Fire

The core of Infinite Fire is the InfiniteFireArray.

InfiniteFireArray<ModelClass> array = new InfiniteFireArray<>(
        
        // Your model's class. InfiniteFireArray uses DataSnapshot#getValue(ModelClass.class) to marshal 
        // DataSnapshots to ModelClass.
        ModelClass.class,
        
        // Your Firebase Query.
        // Do NOT use Query#limitToFirst() or Query#limitToLast(), InfiniteFireArray will do that for you.
        // Do sort your Query by using Query#orderByKey() or Query#orderByString(String)
        query, 

        // The number of inital items.
        // InfiniteFireArray will limit the Query using this int.
        20,

        // This number of items loaded each time you call InfiniteFireArray.more().
        // InfiniteFireArray will use this number to raise the limit of the initial Query.
        20,

        // Defines if your Query will be limited using Query#limitToFirst() or Query#limitToLast()
        // In most cases you want this to be false to load the newest items first.
        false,

        // Defines if InfiniteFireArray changes the order of the items after the inital load.
        // For more info see below.
        false
);

Then implement InfiniteFireRecyclerViewAdapter and pass the InfiniteFireArray as parameter.

class MyRecyclerView extends InfiniteFireRecyclerViewAdapter {...}
MyRecyclerView recyclerView = new MyRecyclerView(array);

For more information take a look at the examples.

Features

Scroll-to-load-more.

Use InfiniteFireArray#more() to implement a scroll-to-load-more pattern. It raises the limit of your Query incrementally.

Pull-to-refresh.

Firebase offers real-time functionality. InfiniteFireArray uses the Query#addChildEventListener() to keep your data up to date.

There are use-cases though in which constantly changing the order of your items results in a really bad user experience. Think about a grid view that is sorted by a value that changes a lot, e.g. a comments counter -- your view would look like a memory game.

InfiniteFireArray allows you to maintain the order while still updating the existing items in real-time. Implementing a SwipeRefreshLayout allows you to call InfiniteArray#reset() to "reload" the data and set the limit of the Query to its orignial limit.

Loading events.

Attach a InfiniteFireArray.OnLoadingStatusListener to receive loading events.

Please note that these events only indicate when the inital sync is completed. InfiniteFireArray will still receive real-time updates without dispatching further events after the inital sync.

How to install Infinite Fire

Get it from Jitpack via Gradle or Maven.

Thanks

  • FirebaseUI-Android library Inspiration for this library, uses an Array to connect Firebase to RecyclerViews
  • Kato Great support, thank you!

About

Connects Firebase to a RecyclerView

Resources

Readme
Apache-2.0 license
Activity

Stars

19 stars

Watchers

1 watching

Forks

7 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.