Class PlacesListPresenter<T extends PlacesListView>
- 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.locations.ui.places.list.PlacesListPresenter<T>
-
- Type Parameters:
T- theMvpViewclass
- All Implemented Interfaces:
MvpPresenter<T>
public class PlacesListPresenter<T extends PlacesListView> extends EndlessListPresenter<T>
TheMvpPresenterclass forPlacesListFragment
-
-
Constructor Summary
Constructors Constructor Description PlacesListPresenter()Constructor of this presenter.PlacesListPresenter(PlacesParams placesParams)Constructor of this presenter.PlacesListPresenter(PlacesParams placesParams, boolean useDefaultServer, java.lang.Integer customDistance, java.lang.String customUnit)Constructor of this presenter.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected ListenerModel<BaseModel<Places>,Places>getDistanceUnitReceivedListener()Get the default distance unit from the server and gets the nearby places Create a listener forPlacesAPIvoidgetNearbyPlaces(double radius, double latitude, double longitude)Get the nearby places.protected voidgetNearbyPlaces(int distance, java.lang.String unit)Called after receiving distance data to compute the correct distance for nearby placesprotected ListenerModel<BaseModel<Places>,Places>getNearbyPlacesReceivedListener()Create a listener forPlacesAPIprotected PlacesAPIgetPlacesAPI()Get current instance ofPlacesAPIvoidloadData()Load initial view data.voidloadMore(int currentPage)protected voidonDistanceDataReceivedFailure(java.lang.String error)Called whengetNearbyPlaces(double, double, double)failedprotected voidonDistanceDataReceivedSuccess(Places data)Called whengetNearbyPlaces(double, double, double)was successfulvoidonLoadFailed(java.lang.String error)Show the error viewvoidonLoadMoreFailed(java.lang.String error)End of load more with failed requestvoidonLoadMoreSuccess(BaseData data)End of load more with success requestvoidonRefreshFailed(java.lang.String error)End of refresh with failed attemptvoidonRefreshSuccess(BaseData data)End of refresh with success request.voidrefreshData()Start the refresh view data.voidsearch(double latitude, double longitude)-
Methods inherited from class com.cheetahdigital.uikit.widget.list.EndlessListPresenter
isAppending
-
Methods inherited from class com.cheetahdigital.uikit.architecture.refreshable.RefreshablePresenter
isRefreshing
-
Methods inherited from class com.cheetahdigital.uikit.architecture.lce.LcePresenter
onLoadSuccess
-
Methods inherited from class com.cheetahdigital.uikit.architecture.mvp.MvpNullObjectBasePresenter
attachView, detachView, getView
-
-
-
-
Constructor Detail
-
PlacesListPresenter
public PlacesListPresenter()
Constructor of this presenter. Creates the defaultPlacesParamsfor Places API calls.
-
PlacesListPresenter
public PlacesListPresenter(PlacesParams placesParams)
Constructor of this presenter. Creates the defaultPlacesParamsfor Places API calls with default server value set to true.- Parameters:
placesParams- contains the query params for place API
-
PlacesListPresenter
public PlacesListPresenter(PlacesParams placesParams, boolean useDefaultServer, java.lang.Integer customDistance, java.lang.String customUnit)
Constructor of this presenter. Creates the defaultPlacesParamsfor Places API calls.- Parameters:
placesParams- places parameter for api callsuseDefaultServer- true if to use the default server search radius and unit provided in the Program Settings - Location - Search Radius and Program Settings - Location - Search Radius UnitcustomDistance- distance to be search in IntegercustomUnit- unit of the customDistance. It is limited to theCustomUnit
-
-
Method Detail
-
getNearbyPlacesReceivedListener
protected ListenerModel<BaseModel<Places>,Places> getNearbyPlacesReceivedListener()
Create a listener forPlacesAPI- Returns:
- listener to handle
PlacesAPIrequests
-
getDistanceUnitReceivedListener
protected ListenerModel<BaseModel<Places>,Places> getDistanceUnitReceivedListener()
Get the default distance unit from the server and gets the nearby places Create a listener forPlacesAPI- Returns:
- listener to handle
PlacesAPIrequests
-
getPlacesAPI
protected PlacesAPI getPlacesAPI()
Get current instance ofPlacesAPI- Returns:
PlacesAPIused on this presenter
-
loadData
public void loadData()
Description copied from class:LcePresenterLoad initial view data.- Specified by:
loadDatain classLcePresenter<T extends PlacesListView>
-
loadMore
public void loadMore(int currentPage)
- Overrides:
loadMorein classEndlessListPresenter<T extends PlacesListView>
-
refreshData
public void refreshData()
Description copied from class:RefreshablePresenterStart the refresh view data.- Overrides:
refreshDatain classRefreshablePresenter<T extends PlacesListView>
-
search
public void search(double latitude, double longitude)
-
getNearbyPlaces
public void getNearbyPlaces(double radius, double latitude, double longitude)Get the nearby places. Radius is based on the configured style. Can be via- Parameters:
radius- range of radiuslatitude- point for latitudelongitude- point for longitude
-
onRefreshFailed
public void onRefreshFailed(java.lang.String error)
Description copied from class:RefreshablePresenterEnd of refresh with failed attempt- Overrides:
onRefreshFailedin classRefreshablePresenter<T extends PlacesListView>- Parameters:
error- short description on reason of failure
-
onRefreshSuccess
public void onRefreshSuccess(BaseData data)
Description copied from class:RefreshablePresenterEnd of refresh with success request.- Overrides:
onRefreshSuccessin classRefreshablePresenter<T extends PlacesListView>- Parameters:
data- theBaseData.
-
onLoadFailed
public void onLoadFailed(java.lang.String error)
Description copied from class:LcePresenterShow the error view- Overrides:
onLoadFailedin classLcePresenter<T extends PlacesListView>- Parameters:
error- message detailing the error
-
onLoadMoreFailed
public void onLoadMoreFailed(java.lang.String error)
Description copied from class:EndlessListPresenterEnd of load more with failed request- Overrides:
onLoadMoreFailedin classEndlessListPresenter<T extends PlacesListView>- Parameters:
error- message used for failed cases
-
onLoadMoreSuccess
public void onLoadMoreSuccess(BaseData data)
Description copied from class:EndlessListPresenterEnd of load more with success request- Overrides:
onLoadMoreSuccessin classEndlessListPresenter<T extends PlacesListView>- Parameters:
data- instance ofBaseDatapassed
-
onDistanceDataReceivedSuccess
protected void onDistanceDataReceivedSuccess(Places data)
Called whengetNearbyPlaces(double, double, double)was successful- Parameters:
data-Places
-
getNearbyPlaces
@CallSuper protected void getNearbyPlaces(int distance, java.lang.String unit)Called after receiving distance data to compute the correct distance for nearby places- Parameters:
distance- distance to cover in search of nearby placesunit- unit to use for the distance
-
onDistanceDataReceivedFailure
protected void onDistanceDataReceivedFailure(java.lang.String error)
Called whengetNearbyPlaces(double, double, double)failed- Parameters:
error- error message
-
-