Class EventDateListPresenter<T extends EventDateListView>

  • Type Parameters:
    T - the EventDateListView 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>
    The RefreshablePresenter class for EventDateListFragment
    • Method Detail

      • getEventDatesReceivedListener

        protected com.cheetahdigital.corekit.models.module.ListenerModel<com.cheetahdigital.corekit.models.BaseModel<EventDates>,​EventDates> getEventDatesReceivedListener()
        Create a listener for EventsAPI
        Returns:
        listener to handle EventsAPI requests
      • getEventFavoritedListener

        protected com.cheetahdigital.corekit.models.module.Listener<com.cheetahdigital.corekit.models.responses.SuccessResponse> getEventFavoritedListener()
        Create a listener for EventsAPI
        Returns:
        listener to handle EventsAPI requests
      • loadData

        public void loadData()
        Description copied from class: com.cheetahdigital.uikit.architecture.lce.LcePresenter
        Load initial view data.
        Specified by:
        loadData in class com.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 class com.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 save
        eventsParams - 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 remove
        eventsParams - 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 in EventDates
      • 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 class com.cheetahdigital.uikit.architecture.refreshable.RefreshablePresenter<T extends EventDateListView>
        Parameters:
        data - the BaseData.
      • 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
      • processNewDate

        public void processNewDate​(EventDate date)
        Update the dates based on the current date selected
        Parameters:
        date - instance of EventDate on which the event and favorite list is updated