Class GiftcardsListPresenter<T extends GiftcardsListView>
- 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<V>
-
- com.cheetahdigital.uikit.widget.list.ListPresenter<V>
-
- com.cheetahdigital.uikit.widget.list.EndlessListPresenter<T>
-
- com.cheetahdigital.giftcards.ui.list.GiftcardsListPresenter<T>
-
- Type Parameters:
T- an interface that extends theGiftcardsListView
- All Implemented Interfaces:
MvpPresenter<T>
public class GiftcardsListPresenter<T extends GiftcardsListView> extends EndlessListPresenter<T>
This presenter class contains the API call for getting the list of Giftcards. This is a child class ofEndlessListPresenterwhich is bound to theGiftcardsListView, which means that this will be used to display theGiftcardsobject to a view of typeGiftcardsListView
-
-
Constructor Summary
Constructors Constructor Description GiftcardsListPresenter()Constructor of this presenterGiftcardsListPresenter(GiftcardParams queryParams)Constructor of this presenter
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected GiftcardsAPIgetGiftcardsAPI()Get current instance ofGiftcardsAPIprotected ListenerModel<BaseModel<Giftcards>,Giftcards>getGiftcardsReceivedListener()Create a listener forGiftcardsAPIprotected ListenerModel<BaseModel<PurchaseResponse>,PurchaseResponse>getPurchaseResponseListener()voidloadData()Load initial view data.voidloadMore(int currentPage)voidonLoadMoreSuccess(BaseData data)End of load more with success requestprotected voidonPurchaseFailed(java.lang.String error)Callback method when puchase failedprotected voidonPurchaseReceived(PurchaseResponse response)Callback method when purchase is successfulvoidonRefreshSuccess(BaseData data)End of refresh with success request.voidpurchaseGiftcard(GiftcardParams query, GiftcardFields fields)Call to purchase a gift cardvoidrefreshData()Start the refresh view data.-
Methods inherited from class com.cheetahdigital.uikit.widget.list.EndlessListPresenter
isAppending, onLoadMoreFailed
-
Methods inherited from class com.cheetahdigital.uikit.architecture.refreshable.RefreshablePresenter
isRefreshing, onRefreshFailed
-
Methods inherited from class com.cheetahdigital.uikit.architecture.lce.LcePresenter
onLoadFailed, onLoadSuccess
-
Methods inherited from class com.cheetahdigital.uikit.architecture.mvp.MvpNullObjectBasePresenter
attachView, detachView, getView
-
-
-
-
Constructor Detail
-
GiftcardsListPresenter
public GiftcardsListPresenter()
Constructor of this presenter
-
GiftcardsListPresenter
public GiftcardsListPresenter(GiftcardParams queryParams)
Constructor of this presenter- Parameters:
queryParams- customGiftcardParamsfor giftcards API call inloadData()
-
-
Method Detail
-
getGiftcardsReceivedListener
protected ListenerModel<BaseModel<Giftcards>,Giftcards> getGiftcardsReceivedListener()
Create a listener forGiftcardsAPI- Returns:
- listener to handle
GiftcardsAPIrequests
-
getPurchaseResponseListener
protected ListenerModel<BaseModel<PurchaseResponse>,PurchaseResponse> getPurchaseResponseListener()
-
getGiftcardsAPI
protected GiftcardsAPI getGiftcardsAPI()
Get current instance ofGiftcardsAPI- Returns:
GiftcardsAPIused on this presenter
-
loadData
public void loadData()
Description copied from class:LcePresenterLoad initial view data.- Specified by:
loadDatain classLcePresenter<T extends GiftcardsListView>
-
refreshData
public void refreshData()
Description copied from class:RefreshablePresenterStart the refresh view data.- Overrides:
refreshDatain classRefreshablePresenter<T extends GiftcardsListView>
-
loadMore
public void loadMore(int currentPage)
- Overrides:
loadMorein classEndlessListPresenter<T extends GiftcardsListView>
-
onRefreshSuccess
public void onRefreshSuccess(BaseData data)
Description copied from class:RefreshablePresenterEnd of refresh with success request.- Overrides:
onRefreshSuccessin classRefreshablePresenter<T extends GiftcardsListView>- Parameters:
data- theBaseData.
-
onLoadMoreSuccess
public void onLoadMoreSuccess(BaseData data)
Description copied from class:EndlessListPresenterEnd of load more with success request- Overrides:
onLoadMoreSuccessin classEndlessListPresenter<T extends GiftcardsListView>- Parameters:
data- instance ofBaseDatapassed
-
purchaseGiftcard
public void purchaseGiftcard(GiftcardParams query, GiftcardFields fields)
Call to purchase a gift card- Parameters:
query- query parametersfields- field parameters
-
onPurchaseReceived
protected void onPurchaseReceived(PurchaseResponse response)
Callback method when purchase is successful- Parameters:
response- the purchase response
-
onPurchaseFailed
protected void onPurchaseFailed(java.lang.String error)
Callback method when puchase failed- Parameters:
error- error from the API response
-
-