Class PlacesListFragment<A extends PlacesAdapter,V extends PlacesListView,P extends PlacesListPresenter<V>>
- java.lang.Object
-
- androidx.fragment.app.Fragment
-
- com.cheetahdigital.uikit.architecture.mvp.MvpFragmentView<V,P>
-
- com.cheetahdigital.uikit.architecture.lce.LceFragmentView<V,P>
-
- com.cheetahdigital.uikit.architecture.refreshable.RefreshableFragmentView<V,P>
-
- com.cheetahdigital.uikit.widget.list.ListFragmentView<V,P>
-
- com.cheetahdigital.uikit.widget.list.EndlessListFragmentView<A,V,P>
-
- com.cheetahdigital.locations.ui.places.list.PlacesListFragment<A,V,P>
-
- All Implemented Interfaces:
android.content.ComponentCallbacks
,android.view.View.OnCreateContextMenuListener
,androidx.lifecycle.LifecycleOwner
,androidx.lifecycle.ViewModelStoreOwner
,androidx.savedstate.SavedStateRegistryOwner
,androidx.swiperefreshlayout.widget.SwipeRefreshLayout.OnRefreshListener
,AnalyticsManager.AnalyticsScreen
,PlacesListView
,LceView
,MvpLceView
,MvpView
,RefreshableView
,EndlessListView
,ListView
- Direct Known Subclasses:
NearbyPlacesFragment
public class PlacesListFragment<A extends PlacesAdapter,V extends PlacesListView,P extends PlacesListPresenter<V>> extends EndlessListFragmentView<A,V,P> implements PlacesListView
The fragment class for the list ofPlace
IntentKey.PRIMARY_PARAMS
-PlacesParams
to usePLACES_USE_DEFAULT_SERVER
- return true if program settings search radius and search radius unit will be used. Otherwise, false. Default is true.PLACES_CUSTOM_DISTANCE
- distance inint
to search on the area. This will only take effect whenPLACES_USE_DEFAULT_SERVER
is falsePLACES_CUSTOM_UNIT
- unit to be used to search the area.This will only take effect when *PLACES_USE_DEFAULT_SERVER
is false. Please see the list of available custom unit inCustomUnit
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
PLACES_CUSTOM_DISTANCE
static java.lang.String
PLACES_CUSTOM_UNIT
static java.lang.String
PLACES_USE_DEFAULT_SERVER
static java.lang.String
TAG
-
Fields inherited from class com.cheetahdigital.uikit.widget.list.EndlessListFragmentView
mEndlessRecyclerOnScrollListener
-
Fields inherited from class com.cheetahdigital.uikit.widget.list.ListFragmentView
mLinearLayoutManager, mListView, mSelectedPosition
-
Fields inherited from class com.cheetahdigital.uikit.architecture.refreshable.RefreshableFragmentView
mSwipeRefreshLayout
-
Fields inherited from class com.cheetahdigital.uikit.architecture.lce.LceFragmentView
mContentView, mErrorView, mInitialLoad, mLoadingView
-
-
Constructor Summary
Constructors Constructor Description PlacesListFragment()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
appendPlacesList(java.util.List<Place> places, int totalEntries)
This notifies the view to append the list ofPlace
to the existing listvoid
attach(PlacesMapFragment mapFragment)
void
clear()
This notifies the view to clear the adapter inPlacesListFragment
void
clearData()
Clears the places listprotected androidx.recyclerview.widget.RecyclerView.ItemDecoration
createItemDecoration()
Create theRecyclerView.ItemDecoration
used in the RecyclerView.protected PlacesAdapter
createPlacesAdapter()
Create an instance ofPlacesAdapter
.protected P
createPresenter()
InstantiateMvpFragmentView.mPresenter
to be used for thisMvpActivityView
protected int
getContentLayoutId()
Provide the Content Layout ID which is of a Layout Resource Reference of AndroidPlacesMapFragment
getMap()
int
getScreenName()
android.view.View
onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState)
void
search(double latitude, double longitude)
Search for nearby placesvoid
search(double latitude, double longitude, java.lang.Double radius)
Search for nearby places with specified radiusvoid
showPlacesList(java.util.List<Place> places, int totalEntries)
This notifies the view to show the list ofPlace
-
Methods inherited from class com.cheetahdigital.uikit.widget.list.EndlessListFragmentView
onFinishLoadMore, onFinishRefresh, onLoadMoreFailed, setListTotalEntries
-
Methods inherited from class com.cheetahdigital.uikit.widget.list.ListFragmentView
getLayoutManager, isListAnimationEnabled, onAttach, setExitTransition, showContent, startActivity, startActivityForResult
-
Methods inherited from class com.cheetahdigital.uikit.architecture.refreshable.RefreshableFragmentView
onRefresh, onRefreshFailed, reloadData, showError, showLoading, startRefresh
-
Methods inherited from class com.cheetahdigital.uikit.architecture.lce.LceFragmentView
onLoadFailed, onLoadSuccess, onViewCreated, setErrorViewClickListener
-
Methods inherited from class com.cheetahdigital.uikit.architecture.mvp.MvpFragmentView
captureSharedElementValues, getPresenter, getSharedElementViews, initSharedElementValues, isSharedAnimationEnabled, onDestroyView
-
Methods inherited from class androidx.fragment.app.Fragment
dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLayoutInflater, getLayoutInflater, getLifecycle, getLoaderManager, getParentFragment, getReenterTransition, getResources, getRetainInstance, getReturnTransition, getSavedStateRegistry, getSharedElementEnterTransition, getSharedElementReturnTransition, getString, getString, getTag, getTargetFragment, getTargetRequestCode, getText, getUserVisibleHint, getView, getViewLifecycleOwner, getViewLifecycleOwnerLiveData, getViewModelStore, hashCode, hasOptionsMenu, instantiate, instantiate, isAdded, isDetached, isHidden, isInLayout, isMenuVisible, isRemoving, isResumed, isStateSaved, isVisible, onActivityCreated, onActivityResult, onAttach, onAttachFragment, onConfigurationChanged, onContextItemSelected, onCreate, onCreateAnimation, onCreateAnimator, onCreateContextMenu, onCreateOptionsMenu, onDestroy, onDestroyOptionsMenu, onDetach, onGetLayoutInflater, onHiddenChanged, onInflate, onInflate, onLowMemory, onMultiWindowModeChanged, onOptionsItemSelected, onOptionsMenuClosed, onPause, onPictureInPictureModeChanged, onPrepareOptionsMenu, onPrimaryNavigationFragmentChanged, onRequestPermissionsResult, onResume, onSaveInstanceState, onStart, onStop, onViewStateRestored, postponeEnterTransition, postponeEnterTransition, registerForContextMenu, requestPermissions, requireActivity, requireArguments, requireContext, requireFragmentManager, requireHost, requireParentFragment, requireView, setAllowEnterTransitionOverlap, setAllowReturnTransitionOverlap, setArguments, setEnterSharedElementCallback, setEnterTransition, setExitSharedElementCallback, setExitTransition, setHasOptionsMenu, setInitialSavedState, setMenuVisibility, setReenterTransition, setRetainInstance, setReturnTransition, setSharedElementEnterTransition, setSharedElementReturnTransition, setTargetFragment, setUserVisibleHint, shouldShowRequestPermissionRationale, startActivity, startActivityForResult, startIntentSenderForResult, startPostponedEnterTransition, toString, unregisterForContextMenu
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.cheetahdigital.uikit.widget.list.EndlessListView
onFinishLoadMore, onLoadMoreFailed
-
Methods inherited from interface com.cheetahdigital.uikit.architecture.lce.LceView
onLoadFailed, onLoadSuccess, setErrorViewClickListener
-
Methods inherited from interface com.cheetahdigital.uikit.architecture.lce.MvpLceView
showContent, showError, showLoading
-
Methods inherited from interface com.cheetahdigital.uikit.architecture.refreshable.RefreshableView
onFinishRefresh, onRefreshFailed
-
-
-
-
Field Detail
-
TAG
public static final java.lang.String TAG
- See Also:
- Constant Field Values
-
PLACES_USE_DEFAULT_SERVER
public static final java.lang.String PLACES_USE_DEFAULT_SERVER
- See Also:
- Constant Field Values
-
PLACES_CUSTOM_DISTANCE
public static final java.lang.String PLACES_CUSTOM_DISTANCE
- See Also:
- Constant Field Values
-
PLACES_CUSTOM_UNIT
public static final java.lang.String PLACES_CUSTOM_UNIT
- See Also:
- Constant Field Values
-
-
Method Detail
-
onCreateView
@Nullable public android.view.View onCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState)
- Overrides:
onCreateView
in classEndlessListFragmentView<A extends PlacesAdapter,V extends PlacesListView,P extends PlacesListPresenter<V>>
-
getScreenName
public int getScreenName()
- Specified by:
getScreenName
in interfaceAnalyticsManager.AnalyticsScreen
- Overrides:
getScreenName
in classMvpFragmentView<V extends PlacesListView,P extends PlacesListPresenter<V>>
-
getContentLayoutId
protected int getContentLayoutId()
Description copied from class:MvpFragmentView
Provide the Content Layout ID which is of a Layout Resource Reference of Android- Specified by:
getContentLayoutId
in classMvpFragmentView<V extends PlacesListView,P extends PlacesListPresenter<V>>
- Returns:
- id of the content layout
-
createPresenter
protected P createPresenter()
Description copied from class:MvpFragmentView
InstantiateMvpFragmentView.mPresenter
to be used for thisMvpActivityView
- Specified by:
createPresenter
in classMvpFragmentView<V extends PlacesListView,P extends PlacesListPresenter<V>>
- Returns:
- return the
MvpBasePresenter
-
clearData
public void clearData()
Clears the places list
-
showPlacesList
public void showPlacesList(java.util.List<Place> places, int totalEntries)
Description copied from interface:PlacesListView
This notifies the view to show the list ofPlace
- Specified by:
showPlacesList
in interfacePlacesListView
- Parameters:
places
- list ofPlace
totalEntries
- total number of entries
-
appendPlacesList
public void appendPlacesList(java.util.List<Place> places, int totalEntries)
Description copied from interface:PlacesListView
This notifies the view to append the list ofPlace
to the existing list- Specified by:
appendPlacesList
in interfacePlacesListView
- Parameters:
places
- list ofPlace
from a certain pagetotalEntries
- total number of entries
-
clear
public void clear()
Description copied from interface:PlacesListView
This notifies the view to clear the adapter inPlacesListFragment
- Specified by:
clear
in interfacePlacesListView
-
search
public void search(double latitude, double longitude)
Search for nearby places- Parameters:
latitude
- current location latitude valuelongitude
- current location longitude value
-
search
public void search(double latitude, double longitude, java.lang.Double radius)
Search for nearby places with specified radius- Parameters:
latitude
- place latitude valuelongitude
- place longitude valueradius
- search radius distance
-
createPlacesAdapter
protected PlacesAdapter createPlacesAdapter()
Create an instance ofPlacesAdapter
. Usually used ifPlacesAdapter
was subclassed.- Returns:
- instance of
PlacesAdapter
-
createItemDecoration
protected androidx.recyclerview.widget.RecyclerView.ItemDecoration createItemDecoration()
Create theRecyclerView.ItemDecoration
used in the RecyclerView. This will be invoked when initializing the list for the first time.- Returns:
- instance of
RecyclerView.ItemDecoration
for the RecyclerView
-
attach
public void attach(PlacesMapFragment mapFragment)
-
getMap
public PlacesMapFragment getMap()
-
-