public abstract class

BaseRecyclerViewEventDistributor

extends Object
java.lang.Object
   ↳ com.h6ah4i.android.widget.advrecyclerview.event.BaseRecyclerViewEventDistributor<T>
Known Direct Subclasses

Summary

Fields
protected List<T> mListeners
protected boolean mPerformingClearMethod
protected RecyclerView mRecyclerView
protected boolean mReleased
Public Constructors
BaseRecyclerViewEventDistributor()
Public Methods
boolean add(T listener)
Add a T listener to the chain.
boolean add(T listener, int index)
Add a T listener to the chain at the specified position.
void attachRecyclerView(RecyclerView rv)
Attaches android.support.v7.widget.RecyclerView instance.
void clear()
Remove all listeners from the chain.
boolean contains(T listener)
Gets whether the specified listener object is contained in the chain.
RecyclerView getRecyclerView()
Gets attached android.support.v7.widget.RecyclerView
boolean isReleased()
Indicates whether this distributor has been released
void release()
Release all references.
boolean remove(T listener)
Remove a T listener from the chain.
int size()
Gets the number of underlying listener objects.
Protected Methods
void clear(boolean calledFromRelease)
void onRecyclerViewAttached(RecyclerView rv)
void onRelease()
void verifyIsNotPerformingClearMethod(String methodName)
void verifyIsNotReleased(String methodName)
[Expand]
Inherited Methods
From class java.lang.Object

Fields

protected List<T> mListeners

protected boolean mPerformingClearMethod

protected RecyclerView mRecyclerView

protected boolean mReleased

Public Constructors

public BaseRecyclerViewEventDistributor ()

Public Methods

public boolean add (T listener)

Add a T listener to the chain.

Parameters
listener The T instance
Returns
  • True if the listener object successfully added, otherwise false. Also returns true if have already been added.

public boolean add (T listener, int index)

Add a T listener to the chain at the specified position.

Parameters
listener The T instance
index Position in the listener chain to insert this listener at. (< 0: tail of the chain)
Returns
  • True if the listener object successfully added, otherwise false. Also returns true if have already been added.

public void attachRecyclerView (RecyclerView rv)

Attaches android.support.v7.widget.RecyclerView instance.

Parameters
rv The android.support.v7.widget.RecyclerView instance

public void clear ()

Remove all listeners from the chain.

public boolean contains (T listener)

Gets whether the specified listener object is contained in the chain.

Parameters
listener Listener to check
Returns
  • True for the listener contains in the chain, otherwise false

public RecyclerView getRecyclerView ()

Gets attached android.support.v7.widget.RecyclerView

Returns
  • The android.support.v7.widget.RecyclerView instance

public boolean isReleased ()

Indicates whether this distributor has been released

Returns
  • True for this distributor has been released, otherwise false

public void release ()

Release all references. This method should be called to avoid memory leaks.

public boolean remove (T listener)

Remove a T listener from the chain.

Parameters
listener Listener to remove
Returns
  • True for successfully removed the listener object, otherwise false

public int size ()

Gets the number of underlying listener objects.

Returns
  • Number of underlying listener objects in the chain.

Protected Methods

protected void clear (boolean calledFromRelease)

protected void onRecyclerViewAttached (RecyclerView rv)

protected void onRelease ()

protected void verifyIsNotPerformingClearMethod (String methodName)

protected void verifyIsNotReleased (String methodName)