Class BaseObservableSnapshotArray<S,​E,​L extends BaseChangeEventListener<S,​E>,​T>

    • Method Detail

      • getSnapshots

        @NonNull
        protected abstract List<S> getSnapshots()
        Get the list of snapshots mirroring the server's data. Must be mutable and use a single instance over the lifetime of this class's active lifecycle.
        Returns:
        the local copy of the server's snapshots
      • get

        @NonNull
        public T get​(int index)
        Specified by:
        get in interface List<S>
        Specified by:
        get in class AbstractList<T>
      • getSnapshot

        @NonNull
        public S getSnapshot​(int index)
        Returns the snapshot at the specified position in this list.
        Parameters:
        index - index of the snapshot to return
        Returns:
        the snapshot at the specified position in this list
        Throws:
        IndexOutOfBoundsException - if the index is out of range (index < 0 || index >= size())
      • removeChangeEventListener

        @CallSuper
        public void removeChangeEventListener​(@NonNull
                                              L listener)
        Remove a listener from the array.

        If no listeners remain, onDestroy() will be called.

      • removeAllListeners

        @CallSuper
        public void removeAllListeners()
        Remove all listeners from the array and reset its state.
      • onCreate

        @CallSuper
        protected void onCreate()
        Called when the BaseObservableSnapshotArray is active and should start listening to the Firebase database.
      • onDestroy

        @CallSuper
        protected void onDestroy()
        Called when the BaseObservableSnapshotArray is inactive and should stop listening to the Firebase database.

        All data and saved state should also be cleared here.

      • isListening

        public boolean isListening()
        Returns:
        true if the array is listening for change events from the Firebase database, false otherwise
      • isListening

        public boolean isListening​(@NonNull
                                   L listener)
        Returns:
        true if the provided listener is listening for changes
      • notifyOnChildChanged

        protected final void notifyOnChildChanged​(@NonNull
                                                  ChangeEventType type,
                                                  @NonNull
                                                  S snapshot,
                                                  int newIndex,
                                                  int oldIndex)
      • notifyOnDataChanged

        protected final void notifyOnDataChanged()
      • notifyOnError

        protected final void notifyOnError​(@NonNull
                                           E e)