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 ofPlaceIntentKey.PRIMARY_PARAMS-PlacesParamsto 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 inintto search on the area. This will only take effect whenPLACES_USE_DEFAULT_SERVERis falsePLACES_CUSTOM_UNIT- unit to be used to search the area.This will only take effect when *PLACES_USE_DEFAULT_SERVERis false. Please see the list of available custom unit inCustomUnit
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.StringPLACES_CUSTOM_DISTANCEstatic java.lang.StringPLACES_CUSTOM_UNITstatic java.lang.StringPLACES_USE_DEFAULT_SERVERstatic java.lang.StringTAG-
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 voidappendPlacesList(java.util.List<Place> places, int totalEntries)This notifies the view to append the list ofPlaceto the existing listvoidattach(PlacesMapFragment mapFragment)voidclear()This notifies the view to clear the adapter inPlacesListFragmentvoidclearData()Clears the places listprotected androidx.recyclerview.widget.RecyclerView.ItemDecorationcreateItemDecoration()Create theRecyclerView.ItemDecorationused in the RecyclerView.protected PlacesAdaptercreatePlacesAdapter()Create an instance ofPlacesAdapter.protected PcreatePresenter()InstantiateMvpFragmentView.mPresenterto be used for thisMvpActivityViewprotected intgetContentLayoutId()Provide the Content Layout ID which is of a Layout Resource Reference of AndroidPlacesMapFragmentgetMap()intgetScreenName()android.view.ViewonCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState)voidsearch(double latitude, double longitude)Search for nearby placesvoidsearch(double latitude, double longitude, java.lang.Double radius)Search for nearby places with specified radiusvoidshowPlacesList(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:
onCreateViewin classEndlessListFragmentView<A extends PlacesAdapter,V extends PlacesListView,P extends PlacesListPresenter<V>>
-
getScreenName
public int getScreenName()
- Specified by:
getScreenNamein interfaceAnalyticsManager.AnalyticsScreen- Overrides:
getScreenNamein classMvpFragmentView<V extends PlacesListView,P extends PlacesListPresenter<V>>
-
getContentLayoutId
protected int getContentLayoutId()
Description copied from class:MvpFragmentViewProvide the Content Layout ID which is of a Layout Resource Reference of Android- Specified by:
getContentLayoutIdin classMvpFragmentView<V extends PlacesListView,P extends PlacesListPresenter<V>>- Returns:
- id of the content layout
-
createPresenter
protected P createPresenter()
Description copied from class:MvpFragmentViewInstantiateMvpFragmentView.mPresenterto be used for thisMvpActivityView- Specified by:
createPresenterin 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:PlacesListViewThis notifies the view to show the list ofPlace- Specified by:
showPlacesListin interfacePlacesListView- Parameters:
places- list ofPlacetotalEntries- total number of entries
-
appendPlacesList
public void appendPlacesList(java.util.List<Place> places, int totalEntries)
Description copied from interface:PlacesListViewThis notifies the view to append the list ofPlaceto the existing list- Specified by:
appendPlacesListin interfacePlacesListView- Parameters:
places- list ofPlacefrom a certain pagetotalEntries- total number of entries
-
clear
public void clear()
Description copied from interface:PlacesListViewThis notifies the view to clear the adapter inPlacesListFragment- Specified by:
clearin 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 ifPlacesAdapterwas subclassed.- Returns:
- instance of
PlacesAdapter
-
createItemDecoration
protected androidx.recyclerview.widget.RecyclerView.ItemDecoration createItemDecoration()
Create theRecyclerView.ItemDecorationused in the RecyclerView. This will be invoked when initializing the list for the first time.- Returns:
- instance of
RecyclerView.ItemDecorationfor the RecyclerView
-
attach
public void attach(PlacesMapFragment mapFragment)
-
getMap
public PlacesMapFragment getMap()
-
-