Class PunchcardDetailsPresenter<T extends PunchcardDetailsView>
- java.lang.Object
-
- com.cheetahdigital.uikit.architecture.mvp.MvpNullObjectBasePresenter<V>
-
- com.cheetahdigital.uikit.architecture.mvp.Presenter<V>
-
- com.cheetahdigital.uikit.architecture.lce.LcePresenter<T>
-
- com.cheetahdigital.punchcards.ui.details.PunchcardDetailsPresenter<T>
-
- All Implemented Interfaces:
MvpPresenter<T>
public class PunchcardDetailsPresenter<T extends PunchcardDetailsView> extends LcePresenter<T>
The MVP Presenter Class forPunchcardAPI
-
-
Constructor Summary
Constructors Constructor Description PunchcardDetailsPresenter(java.lang.String punchcardId)
Default constructor that accepts Punchcard id.PunchcardDetailsPresenter(java.lang.String punchcardId, PunchcardParams punchcardParams)
Constructor of the presenter which accepts a String as a parameter
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected PunchcardAPI
getPunchcardAPI()
Get current instance ofPunchcardAPI
protected java.util.List<Punch>
getPunchcardInstancePunches(java.lang.Object data)
Get the list ofPunch
based on the required punches, current punches and max allowed punchesprotected ListenerModel<BaseModel<PunchcardInstance>,PunchcardInstance>
getPunchcardInstanceReceivedListener()
Create a listener forPunchcardAPI
protected ListenerModel<BaseModel<Punchcard>,Punchcard>
getPunchcardReceivedListener()
Create a listener forPunchcardAPI
void
getPunchcardType()
Get punchcard typeprotected java.lang.String
getRewardPoints(java.util.List<PunchcardReward> rewards)
Parse the reward points from the list ofPunchcardReward
void
loadData()
Load initial view data.protected void
onPunchcardInstanceReceivedFailed(java.lang.String error)
Called when failing to receive response fromPunchcardAPI
protected void
onPunchcardInstanceReceivedSuccess(PunchcardInstance data)
Called when receiving response fromPunchcardAPI
protected void
onPunchcardReceivedFail(java.lang.String error)
Called when failing to receive response fromPunchcardAPI
protected void
onPunchcardReceivedSuccess(Punchcard data)
Called when receiving response fromPunchcardAPI
-
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
-
PunchcardDetailsPresenter
public PunchcardDetailsPresenter(java.lang.String punchcardId)
Default constructor that accepts Punchcard id. Using this constructor creates a defaultPunchcardParams
for Punchcard Details- Parameters:
punchcardId
- id/name of the punchcard to get details
-
PunchcardDetailsPresenter
public PunchcardDetailsPresenter(java.lang.String punchcardId, PunchcardParams punchcardParams)
Constructor of the presenter which accepts a String as a parameter- Parameters:
punchcardId
- internal name of the punchcardpunchcardParams
- query params for Punchcard API
-
-
Method Detail
-
getPunchcardReceivedListener
protected ListenerModel<BaseModel<Punchcard>,Punchcard> getPunchcardReceivedListener()
Create a listener forPunchcardAPI
- Returns:
- listener to handle
PunchcardAPI
requests
-
getPunchcardInstanceReceivedListener
protected ListenerModel<BaseModel<PunchcardInstance>,PunchcardInstance> getPunchcardInstanceReceivedListener()
Create a listener forPunchcardAPI
- Returns:
- listener to handle
PunchcardAPI
requests
-
getPunchcardAPI
protected PunchcardAPI getPunchcardAPI()
Get current instance ofPunchcardAPI
- Returns:
PunchcardAPI
used on this presenter
-
loadData
public void loadData()
Description copied from class:LcePresenter
Load initial view data.- Specified by:
loadData
in classLcePresenter<T extends PunchcardDetailsView>
-
getPunchcardType
public void getPunchcardType()
Get punchcard type
-
onPunchcardReceivedSuccess
protected void onPunchcardReceivedSuccess(Punchcard data)
Called when receiving response fromPunchcardAPI
- Parameters:
data
- response received in formatted usingPunchcard
model
-
onPunchcardReceivedFail
protected void onPunchcardReceivedFail(java.lang.String error)
Called when failing to receive response fromPunchcardAPI
- Parameters:
error
- message describing the details of the error
-
onPunchcardInstanceReceivedSuccess
protected void onPunchcardInstanceReceivedSuccess(PunchcardInstance data)
Called when receiving response fromPunchcardAPI
- Parameters:
data
- response received in formatted usingPunchcardInstance
model
-
onPunchcardInstanceReceivedFailed
protected void onPunchcardInstanceReceivedFailed(java.lang.String error)
Called when failing to receive response fromPunchcardAPI
- Parameters:
error
- message describing the details of the error
-
getRewardPoints
protected java.lang.String getRewardPoints(java.util.List<PunchcardReward> rewards)
Parse the reward points from the list ofPunchcardReward
- Parameters:
rewards
- list used to check for the points- Returns:
- reward points in string format
-
getPunchcardInstancePunches
protected java.util.List<Punch> getPunchcardInstancePunches(java.lang.Object data)
Get the list ofPunch
based on the required punches, current punches and max allowed punches- Parameters:
data
- instance ofPunchcard
orPunchcardInstance
- Returns:
- total
Punch
generated fromPunchcard
/PunchcardInstance
-
-