public class LoadOnDemandBehavior extends ListViewBehavior
ListViewBehavior
that can be used to not load
all items at start but wait until the user 'demands' more. This can happen when a special button is
clicked (when the mode is MANUAL) or when a certain number of items before the end is reached
(when mode is AUTOMATIC).Modifier and Type | Class and Description |
---|---|
static interface |
LoadOnDemandBehavior.LoadOnDemandListener
Interface definition for a callback to be invoked when load on demand starts or finishes.
|
static class |
LoadOnDemandBehavior.LoadOnDemandMode
An enumeration with the different modes that can be used as a parameter for
the
setMode(com.telerik.widget.list.LoadOnDemandBehavior.LoadOnDemandMode) method. |
Constructor and Description |
---|
LoadOnDemandBehavior()
Creates a new instance of the LoadOnDemandBehavior with default settings.
|
LoadOnDemandBehavior(View manualDemandView,
View automaticDemandView)
Creates a new instance of the LoadOnDemandBehavior which uses the provided views as presenters
of the load button in manual mode and the load indicator in automatic mode.
|
Modifier and Type | Method and Description |
---|---|
void |
addListener(LoadOnDemandBehavior.LoadOnDemandListener listener)
Adds a listener to be called when items are demanded.
|
void |
endLoad()
A method that is used to notify the behavior that the loading is complete.
|
int |
getMaxRemainingItems()
Gets the current value of the items remaining that are necessary to invoke loading in the
automatic load on demand mode.
|
LoadOnDemandBehavior.LoadOnDemandMode |
getMode()
Gets the current
LoadOnDemandBehavior.LoadOnDemandMode . |
boolean |
isEnabled()
Gets a value indicating whether the current behavior is enabled.
|
boolean |
isInProgress()
Returns true if the current behavior is in progress.
|
void |
onAttached(RadListView listView)
Called when the behavior is attached to
RadListView with
addBehavior(ListViewBehavior). |
void |
onDetached(RadListView listView)
Called when the behavior is detached to
RadListView with
removeBehavior(ListViewBehavior). |
void |
removeListener(LoadOnDemandBehavior.LoadOnDemandListener listener)
Removes a listener that is called when items are demanded.
|
void |
setEnabled(boolean enabled)
Makes the current behavior enabled.
|
void |
setMaxRemainingItems(int maxRemainingItems)
Sets a new value for the remaining items that are necessary to invoke loading in the
automatic load on demand mode.
|
void |
setMode(LoadOnDemandBehavior.LoadOnDemandMode mode)
Sets a new
LoadOnDemandBehavior.LoadOnDemandMode . |
void |
startLoad()
A method that initiates loading.
|
bindViewHolder, createViewHolder, getItemViewType, managesViewHolders, onActionUpOrCancel, onDispatchDraw, onFling, onInterceptTouchEvent, onLayout, onLongPress, onLongPressDrag, onLongPressDragEnded, onScrolled, onShortPressDrag, onTapUp
public LoadOnDemandBehavior()
public LoadOnDemandBehavior(View manualDemandView, View automaticDemandView)
manualDemandView
- View that represents the load more button.automaticDemandView
- View that represents the loading indicator.public int getMaxRemainingItems()
public void setMaxRemainingItems(int maxRemainingItems)
maxRemainingItems
- max remaining items to be usedpublic void setEnabled(boolean enabled)
enabled
- whether this behavior should be enabledpublic boolean isEnabled()
public void setMode(LoadOnDemandBehavior.LoadOnDemandMode mode)
LoadOnDemandBehavior.LoadOnDemandMode
.
The default value is MANUAL
.mode
- whether the user will demand items manually through button or automatically.public LoadOnDemandBehavior.LoadOnDemandMode getMode()
LoadOnDemandBehavior.LoadOnDemandMode
.
The default value is MANUAL
.public void addListener(LoadOnDemandBehavior.LoadOnDemandListener listener)
listener
- the new listener.public void removeListener(LoadOnDemandBehavior.LoadOnDemandListener listener)
listener
- the listener to remove.public void startLoad()
public void endLoad()
public boolean isInProgress()
ListViewBehavior
isInProgress
in class ListViewBehavior
public void onAttached(RadListView listView)
ListViewBehavior
RadListView
with
addBehavior(ListViewBehavior).onAttached
in class ListViewBehavior
listView
- The parent list viewpublic void onDetached(RadListView listView)
ListViewBehavior
RadListView
with
removeBehavior(ListViewBehavior).onDetached
in class ListViewBehavior
listView
- The parent list view