Class PlaceAutocompleteFragment
java.lang.Object
androidx.fragment.app.Fragment
com.trimblemaps.mapsdk.plugins.places.autocomplete.ui.PlaceAutocompleteFragment
- All Implemented Interfaces:
android.content.ComponentCallbacks,android.view.View.OnCreateContextMenuListener,android.view.ViewTreeObserver.OnScrollChangedListener,androidx.activity.result.ActivityResultCaller,androidx.lifecycle.HasDefaultViewModelProviderFactory,androidx.lifecycle.LifecycleOwner,androidx.lifecycle.ViewModelStoreOwner,androidx.savedstate.SavedStateRegistryOwner,CategoryView.CategoryListVisibilityListener,CategoryView.CategorySelectedListener,ResultClickCallback,SearchView.BackButtonListener,SearchView.FocusListener,SearchView.QueryListener
public class PlaceAutocompleteFragment extends androidx.fragment.app.Fragment implements ResultClickCallback, SearchView.QueryListener, SearchView.BackButtonListener, SearchView.FocusListener, CategoryView.CategorySelectedListener, CategoryView.CategoryListVisibilityListener, android.view.ViewTreeObserver.OnScrollChangedListener
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfacestatic interfaceNested classes/interfaces inherited from class androidx.fragment.app.Fragment
androidx.fragment.app.Fragment.InstantiationException, androidx.fragment.app.Fragment.SavedState -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected CategoryListViewprotected android.graphics.drawable.Drawableprotected intprotected Stringprotected final List<com.trimblemaps.geojson.Feature> List of features representing the search results for a specific POI categoryprotected booleanprotected android.widget.TextViewprotected android.widget.ImageViewprotected android.view.Viewprotected PlaceSelectionListenerprotected PoiListBottomSheetprotected PoiListBottomSheetprotected PoisResponseListenerprotected CharSequenceSearch stringprotected android.view.Viewprotected ResultViewprotected ResultViewprotected SearchViewstatic final Stringprotected PlaceAutocompleteViewModelFields inherited from class androidx.fragment.app.Fragment
mPreviousWho -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidprotected com.trimblemaps.api.poi.v1.models.PoiTypefindCategoryById(int categoryId) Return a POI category by IDintReturns the height of the bottom sheet in pixelsintintReturns the height of the toolbarvoidprotected voidprotected voidprotected voidprotected voidbooleanstatic PlaceAutocompleteFragmentstatic PlaceAutocompleteFragmentnewInstance(PlaceOptions placeOptions) voidonActivityCreated(android.os.Bundle savedInstanceState) voidvoidonCategorySelected(com.trimblemaps.api.poi.v1.models.PoiType category) voidonClick(com.trimblemaps.api.geocoding.v1.models.TrimbleMapsLocation carmenFeature) android.view.ViewonCreateView(android.view.LayoutInflater inflater, android.view.ViewGroup container, android.os.Bundle savedInstanceState) voidvoidonFocusChange(boolean hasFocus) voidvoidonQueryChange(CharSequence charSequence) voidonResume()voidonSaveInstanceState(@NotNull android.os.Bundle outState) voidvoidvoidonViewCreated(android.view.View view, android.os.Bundle savedInstanceState) voidReset the category selected This method should be called to clear/reset the category ID selected (on back pressed or similar)voidvoidsetCenter(com.trimblemaps.geojson.Point center) Set the center point for all result viewsvoidsetFocusListener(SearchView.FocusListener listener) voidvoidvoidvoidvoidvoidsetPlaceOptions(PlaceOptions placeOptions) voidvoidsetPoisResponseListener(PoisResponseListener listener) protected voidvoidprotected voidshowNoResultsFound(String message) protected voidprotected voidprotected voidprotected voidprotected voidprotected voidprotected voidprotected voidupdateCategoryView(com.trimblemaps.api.poi.v1.models.PoiTypesResponse response) voidupdateClusterList(List<com.trimblemaps.api.geocoding.v1.models.TrimbleMapsLocation> locations) protected voidMethods inherited from class androidx.fragment.app.Fragment
dump, equals, getActivity, getAllowEnterTransitionOverlap, getAllowReturnTransitionOverlap, getArguments, getChildFragmentManager, getContext, getDefaultViewModelCreationExtras, getDefaultViewModelProviderFactory, getEnterTransition, getExitTransition, getFragmentManager, getHost, getId, getLayoutInflater, getLayoutInflater, getLifecycle, getLoaderManager, getParentFragment, getParentFragmentManager, 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, onActivityResult, onAttach, 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, onStart, onStop, onViewStateRestored, postponeEnterTransition, postponeEnterTransition, registerForActivityResult, registerForActivityResult, 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, startActivity, startActivityForResult, startActivityForResult, startIntentSenderForResult, startPostponedEnterTransition, toString, unregisterForContextMenu
-
Field Details
-
TAG
- See Also:
-
placeSelectionListener
-
poisResponseListener
-
viewModel
-
searchHistoryView
-
searchResultView
-
offlineResultView
protected android.view.View offlineResultView -
noResultsFoundView
protected android.widget.TextView noResultsFoundView -
offlineImageView
protected android.widget.ImageView offlineImageView -
categoryListView
-
searchView
-
rootView
protected android.view.View rootView -
poiListBottomSheet
-
poiClusterListBottomSheet
-
categorySelectedId
protected int categorySelectedId -
categorySelectedName
-
categorySelectedDrawable
protected android.graphics.drawable.Drawable categorySelectedDrawable -
query
Search string -
features
List of features representing the search results for a specific POI category -
isPoiOnRouteActive
protected boolean isPoiOnRouteActive
-
-
Constructor Details
-
PlaceAutocompleteFragment
public PlaceAutocompleteFragment()
-
-
Method Details
-
newInstance
-
newInstance
-
onCreateView
@Nullable public android.view.View onCreateView(android.view.LayoutInflater inflater, @Nullable android.view.ViewGroup container, @Nullable android.os.Bundle savedInstanceState) - Overrides:
onCreateViewin classandroidx.fragment.app.Fragment
-
onViewCreated
public void onViewCreated(android.view.View view, @Nullable android.os.Bundle savedInstanceState) - Overrides:
onViewCreatedin classandroidx.fragment.app.Fragment
-
onSaveInstanceState
public void onSaveInstanceState(@NonNull @NotNull @NotNull android.os.Bundle outState) - Overrides:
onSaveInstanceStatein classandroidx.fragment.app.Fragment
-
setPlaceOptions
-
setCenter
public void setCenter(com.trimblemaps.geojson.Point center) Set the center point for all result views -
hideCategoryView
protected void hideCategoryView() -
showCategoryView
public void showCategoryView() -
hideCategoryListView
protected void hideCategoryListView() -
showCategoryListView
protected void showCategoryListView() -
isCategoryListViewVisible
public boolean isCategoryListViewVisible() -
styleView
protected void styleView() -
onActivityCreated
public void onActivityCreated(@Nullable android.os.Bundle savedInstanceState) - Overrides:
onActivityCreatedin classandroidx.fragment.app.Fragment
-
initializeViewModel
protected void initializeViewModel() -
onResume
public void onResume()- Overrides:
onResumein classandroidx.fragment.app.Fragment
-
onScrollChanged
public void onScrollChanged()- Specified by:
onScrollChangedin interfaceandroid.view.ViewTreeObserver.OnScrollChangedListener
-
onQueryChange
- Specified by:
onQueryChangein interfaceSearchView.QueryListener
-
resetQueryTimer
public void resetQueryTimer()- Specified by:
resetQueryTimerin interfaceSearchView.QueryListener
-
onFocusChange
public void onFocusChange(boolean hasFocus) - Specified by:
onFocusChangein interfaceSearchView.FocusListener
-
onClick
public void onClick(com.trimblemaps.api.geocoding.v1.models.TrimbleMapsLocation carmenFeature) - Specified by:
onClickin interfaceResultClickCallback
-
onCategorySelected
public void onCategorySelected(com.trimblemaps.api.poi.v1.models.PoiType category) - Specified by:
onCategorySelectedin interfaceCategoryView.CategorySelectedListener
-
onShowCategoryList
public void onShowCategoryList()- Specified by:
onShowCategoryListin interfaceCategoryView.CategoryListVisibilityListener
-
onHideCategoryList
public void onHideCategoryList()- Specified by:
onHideCategoryListin interfaceCategoryView.CategoryListVisibilityListener
-
onDestroyView
public void onDestroyView()- Overrides:
onDestroyViewin classandroidx.fragment.app.Fragment
-
onBackButtonPress
public void onBackButtonPress()- Specified by:
onBackButtonPressin interfaceSearchView.BackButtonListener
-
getCategoryId
public int getCategoryId() -
getCategorySelectedName
-
getSearchQuery
-
setOnSettingsClickListener
-
setOnPlaceSelectedListener
-
setOnLoadedListenerListener
-
setOnMenuIconClickListener
-
setOnAdditionalInfoShownListener
-
resetCategorySelected
public void resetCategorySelected()Reset the category selected This method should be called to clear/reset the category ID selected (on back pressed or similar) -
setPoiCategorySelectedListener
public void setPoiCategorySelectedListener(PlaceAutocompleteFragment.PoiCategorySelectedListener listener) -
setFocusListener
-
bindClickListeners
protected void bindClickListeners() -
bindViews
protected void bindViews() -
updateClusterList
public void updateClusterList(List<com.trimblemaps.api.geocoding.v1.models.TrimbleMapsLocation> locations) -
updateCategoryView
protected void updateCategoryView(@Nullable com.trimblemaps.api.poi.v1.models.PoiTypesResponse response) -
setPoisResponseListener
-
updateFavoritePlacesView
protected void updateFavoritePlacesView() -
showNoResultsFound
-
showRequestTimeout
protected void showRequestTimeout() -
showRequestError
protected void showRequestError() -
showRequestException
protected void showRequestException() -
showOfflineMessage
protected void showOfflineMessage() -
showSearchingMessage
protected void showSearchingMessage() -
hideSearchingMessage
protected void hideSearchingMessage() -
subscribe
protected void subscribe() -
findCategoryById
protected com.trimblemaps.api.poi.v1.models.PoiType findCategoryById(int categoryId) Return a POI category by ID- Parameters:
categoryId- specified ID- Returns:
- category or null if not found
-
handleRecentsList
public void handleRecentsList() -
getHistoryCount
-
getToolbarHeight
public int getToolbarHeight()Returns the height of the toolbar- Returns:
- height of the toolbar in pixels
-
getBottomSheetHeight
public int getBottomSheetHeight()Returns the height of the bottom sheet in pixels- Returns:
-
isMenuIconVisible
-