Class EventDateListPresenter<T extends EventDateListView>
- java.lang.Object
-
- com.cheetahdigital.uikit.architecture.mvp.MvpNullObjectBasePresenter<V>
-
- com.cheetahdigital.uikit.architecture.mvp.Presenter<V>
-
- com.cheetahdigital.uikit.architecture.lce.LcePresenter<V>
-
- com.cheetahdigital.uikit.architecture.refreshable.RefreshablePresenter<T>
-
- com.cheetahdigital.event.ui.eventdate.list.EventDateListPresenter<T>
-
- Type Parameters:
T
- theEventDateListView
class
- All Implemented Interfaces:
com.cheetahdigital.uikit.architecture.mvp.MvpPresenter<T>
public class EventDateListPresenter<T extends EventDateListView> extends com.cheetahdigital.uikit.architecture.refreshable.RefreshablePresenter<T>
TheRefreshablePresenter
class forEventDateListFragment
MODE_ALL_EVENTS
- state that indicated the mode for all eventsMODE_MY_AGENDA
- state that indicated the mode for all agenda
-
-
Field Summary
Fields Modifier and Type Field Description static int
MODE_ALL_EVENTS
static int
MODE_MY_AGENDA
-
Constructor Summary
Constructors Constructor Description EventDateListPresenter()
Constructor forEventDateListPresenter
EventDateListPresenter(EventsParams eventsParams)
Constructor forEventDateListPresenter
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addEventToFavorite(java.lang.String eventId)
Save an event to watchlistvoid
addEventToFavorite(java.lang.String eventId, EventsParams eventsParams)
Save an event to watchlistprotected com.cheetahdigital.corekit.models.module.ListenerModel<com.cheetahdigital.corekit.models.BaseModel<EventDates>,EventDates>
getEventDatesReceivedListener()
Create a listener forEventsAPI
protected com.cheetahdigital.corekit.models.module.Listener<com.cheetahdigital.corekit.models.responses.SuccessResponse>
getEventFavoritedListener()
Create a listener forEventsAPI
protected EventsAPI
getEventsAPI()
Get current instance ofEventsAPI
int
getMode()
int
getSelectedDateIndex()
void
loadData()
Load initial view data.protected void
onEventDateDownloadSuccess(EventDates data)
Called after a successful call for fetching eventsvoid
onFavoriteFailed(java.lang.String error)
Method called when the API to favorite an event failedvoid
onFavoriteSuccess()
Method called when the API to favorite an event succeedsvoid
onRefreshSuccess(com.cheetahdigital.corekit.models.data.BaseData data)
End of refresh with success request.void
processNewDate(EventDate date)
Update the dates based on the current date selectedvoid
refreshData()
Start the refresh view data.void
removeEventFromFavorite(java.lang.String eventId)
Remove an event to watchlistvoid
removeEventFromFavorite(java.lang.String eventId, EventsParams eventsParams)
Remove an event to watchlistvoid
setMode(int mode)
Set current mode for the listvoid
setSelectedDateIndex(int selectedDateIndex)
Set current selected date index-
Methods inherited from class com.cheetahdigital.uikit.architecture.refreshable.RefreshablePresenter
isRefreshing, onRefreshFailed
-
Methods inherited from class com.cheetahdigital.uikit.architecture.lce.LcePresenter
onLoadFailed, onLoadSuccess
-
-
-
-
Field Detail
-
MODE_ALL_EVENTS
public static final int MODE_ALL_EVENTS
- See Also:
- Constant Field Values
-
MODE_MY_AGENDA
public static final int MODE_MY_AGENDA
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
EventDateListPresenter
public EventDateListPresenter()
Constructor forEventDateListPresenter
-
EventDateListPresenter
public EventDateListPresenter(EventsParams eventsParams)
Constructor forEventDateListPresenter
- Parameters:
eventsParams
- instance ofEventsParams
to be used forEventsAPI
-
-
Method Detail
-
getEventDatesReceivedListener
protected com.cheetahdigital.corekit.models.module.ListenerModel<com.cheetahdigital.corekit.models.BaseModel<EventDates>,EventDates> getEventDatesReceivedListener()
Create a listener forEventsAPI
- Returns:
- listener to handle
EventsAPI
requests
-
getEventFavoritedListener
protected com.cheetahdigital.corekit.models.module.Listener<com.cheetahdigital.corekit.models.responses.SuccessResponse> getEventFavoritedListener()
Create a listener forEventsAPI
- Returns:
- listener to handle
EventsAPI
requests
-
getEventsAPI
protected EventsAPI getEventsAPI()
Get current instance ofEventsAPI
- Returns:
EventsAPI
used on this presenter
-
loadData
public void loadData()
Description copied from class:com.cheetahdigital.uikit.architecture.lce.LcePresenter
Load initial view data.- Specified by:
loadData
in classcom.cheetahdigital.uikit.architecture.lce.LcePresenter<T extends EventDateListView>
-
refreshData
public void refreshData()
Description copied from class:com.cheetahdigital.uikit.architecture.refreshable.RefreshablePresenter
Start the refresh view data.- Overrides:
refreshData
in classcom.cheetahdigital.uikit.architecture.refreshable.RefreshablePresenter<T extends EventDateListView>
-
addEventToFavorite
public void addEventToFavorite(java.lang.String eventId)
Save an event to watchlist- Parameters:
eventId
- Event to save
-
addEventToFavorite
public void addEventToFavorite(java.lang.String eventId, EventsParams eventsParams)
Save an event to watchlist- Parameters:
eventId
- Event to saveeventsParams
-EventsParams
to use for responding
-
removeEventFromFavorite
public void removeEventFromFavorite(java.lang.String eventId)
Remove an event to watchlist- Parameters:
eventId
- Event to remove
-
removeEventFromFavorite
public void removeEventFromFavorite(java.lang.String eventId, EventsParams eventsParams)
Remove an event to watchlist- Parameters:
eventId
- Event to removeeventsParams
-EventsParams
to use for removing event
-
setMode
public void setMode(int mode)
Set current mode for the list- Parameters:
mode
- mode of the displayed list
-
getMode
public int getMode()
- Returns:
- the current mode
-
getSelectedDateIndex
public int getSelectedDateIndex()
- Returns:
- current selected date index
-
setSelectedDateIndex
public void setSelectedDateIndex(int selectedDateIndex)
Set current selected date index- Parameters:
selectedDateIndex
- position of the current date selected
-
onEventDateDownloadSuccess
protected void onEventDateDownloadSuccess(EventDates data)
Called after a successful call for fetching events- Parameters:
data
- response received formated inEventDates
-
onRefreshSuccess
public void onRefreshSuccess(com.cheetahdigital.corekit.models.data.BaseData data)
Description copied from class:com.cheetahdigital.uikit.architecture.refreshable.RefreshablePresenter
End of refresh with success request.- Overrides:
onRefreshSuccess
in classcom.cheetahdigital.uikit.architecture.refreshable.RefreshablePresenter<T extends EventDateListView>
- Parameters:
data
- theBaseData
.
-
onFavoriteFailed
public void onFavoriteFailed(java.lang.String error)
Method called when the API to favorite an event failed- Parameters:
error
- error message
-
onFavoriteSuccess
public void onFavoriteSuccess()
Method called when the API to favorite an event succeeds
-
-