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 ofEndlessListPresenter
which is bound to theGiftcardsListView
, which means that this will be used to display theGiftcards
object 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 GiftcardsAPI
getGiftcardsAPI()
Get current instance ofGiftcardsAPI
protected ListenerModel<BaseModel<Giftcards>,Giftcards>
getGiftcardsReceivedListener()
Create a listener forGiftcardsAPI
protected ListenerModel<BaseModel<PurchaseResponse>,PurchaseResponse>
getPurchaseResponseListener()
void
loadData()
Load initial view data.void
loadMore(int currentPage)
void
onLoadMoreSuccess(BaseData data)
End of load more with success requestprotected void
onPurchaseFailed(java.lang.String error)
Callback method when puchase failedprotected void
onPurchaseReceived(PurchaseResponse response)
Callback method when purchase is successfulvoid
onRefreshSuccess(BaseData data)
End of refresh with success request.void
purchaseGiftcard(GiftcardParams query, GiftcardFields fields)
Call to purchase a gift cardvoid
refreshData()
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
- customGiftcardParams
for giftcards API call inloadData()
-
-
Method Detail
-
getGiftcardsReceivedListener
protected ListenerModel<BaseModel<Giftcards>,Giftcards> getGiftcardsReceivedListener()
Create a listener forGiftcardsAPI
- Returns:
- listener to handle
GiftcardsAPI
requests
-
getPurchaseResponseListener
protected ListenerModel<BaseModel<PurchaseResponse>,PurchaseResponse> getPurchaseResponseListener()
-
getGiftcardsAPI
protected GiftcardsAPI getGiftcardsAPI()
Get current instance ofGiftcardsAPI
- Returns:
GiftcardsAPI
used on this presenter
-
loadData
public void loadData()
Description copied from class:LcePresenter
Load initial view data.- Specified by:
loadData
in classLcePresenter<T extends GiftcardsListView>
-
refreshData
public void refreshData()
Description copied from class:RefreshablePresenter
Start the refresh view data.- Overrides:
refreshData
in classRefreshablePresenter<T extends GiftcardsListView>
-
loadMore
public void loadMore(int currentPage)
- Overrides:
loadMore
in classEndlessListPresenter<T extends GiftcardsListView>
-
onRefreshSuccess
public void onRefreshSuccess(BaseData data)
Description copied from class:RefreshablePresenter
End of refresh with success request.- Overrides:
onRefreshSuccess
in classRefreshablePresenter<T extends GiftcardsListView>
- Parameters:
data
- theBaseData
.
-
onLoadMoreSuccess
public void onLoadMoreSuccess(BaseData data)
Description copied from class:EndlessListPresenter
End of load more with success request- Overrides:
onLoadMoreSuccess
in classEndlessListPresenter<T extends GiftcardsListView>
- Parameters:
data
- instance ofBaseData
passed
-
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
-
-