20 | * This class is a generic way of backing an Android RecyclerView with a Firebase location. 21 | * It handles all of the child events at the given Firebase location. 22 | * It marshals received data into the given class type. 23 | * Extend this class and provide an implementation of the abstract methods, which will notify when 24 | * the adapter list changes. 25 | *
26 | * This class also simplifies the management of configuration change (e.g.: device rotation)
27 | * allowing the restore of the list.
28 | *
29 | * @param limit()
, startAt()
, and endAt()
.
42 | */
43 | public FirebaseRecyclerAdapter(Query query) {
44 | this(query, null, null);
45 | }
46 |
47 | /**
48 | * @param query The Firebase location to watch for data changes.
49 | * Can also be a slice of a location, using some combination of
50 | * limit()
, startAt()
, and endAt()
.
51 | * @param items List of items that will load the adapter before starting the listener.
52 | * Generally null or empty, but this can be useful when dealing with a
53 | * configuration change (e.g.: reloading the adapter after a device rotation).
54 | * Be careful: keys must be coherent with this list.
55 | * @param keys List of keys of items that will load the adapter before starting the listener.
56 | * Generally null or empty, but this can be useful when dealing with a
57 | * configuration change (e.g.: reloading the adapter after a device rotation).
58 | * Be careful: items must be coherent with this list.
59 | */
60 | public FirebaseRecyclerAdapter(Query query,
61 | @Nullable ArrayList