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
  • Field Details

    • TAG

      public static final String TAG
      See Also:
    • placeSelectionListener

      protected PlaceSelectionListener placeSelectionListener
    • poisResponseListener

      protected PoisResponseListener poisResponseListener
    • viewModel

      protected PlaceAutocompleteViewModel viewModel
    • searchHistoryView

      protected ResultView searchHistoryView
    • searchResultView

      protected ResultView searchResultView
    • offlineResultView

      protected android.view.View offlineResultView
    • noResultsFoundView

      protected android.widget.TextView noResultsFoundView
    • offlineImageView

      protected android.widget.ImageView offlineImageView
    • categoryListView

      protected CategoryListView categoryListView
    • searchView

      protected SearchView searchView
    • rootView

      protected android.view.View rootView
    • poiListBottomSheet

      protected PoiListBottomSheet poiListBottomSheet
    • poiClusterListBottomSheet

      protected PoiListBottomSheet poiClusterListBottomSheet
    • categorySelectedId

      protected int categorySelectedId
    • categorySelectedName

      protected String categorySelectedName
    • categorySelectedDrawable

      protected android.graphics.drawable.Drawable categorySelectedDrawable
    • query

      protected CharSequence query
      Search string
    • features

      protected final List<com.trimblemaps.geojson.Feature> 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

      public static PlaceAutocompleteFragment newInstance()
    • newInstance

      public static PlaceAutocompleteFragment newInstance(@Nullable PlaceOptions placeOptions)
    • onCreateView

      @Nullable public android.view.View onCreateView(android.view.LayoutInflater inflater, @Nullable android.view.ViewGroup container, @Nullable android.os.Bundle savedInstanceState)
      Overrides:
      onCreateView in class androidx.fragment.app.Fragment
    • onViewCreated

      public void onViewCreated(android.view.View view, @Nullable android.os.Bundle savedInstanceState)
      Overrides:
      onViewCreated in class androidx.fragment.app.Fragment
    • onSaveInstanceState

      public void onSaveInstanceState(@NonNull @NotNull @NotNull android.os.Bundle outState)
      Overrides:
      onSaveInstanceState in class androidx.fragment.app.Fragment
    • setPlaceOptions

      public void setPlaceOptions(PlaceOptions placeOptions)
    • 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:
      onActivityCreated in class androidx.fragment.app.Fragment
    • initializeViewModel

      protected void initializeViewModel()
    • onResume

      public void onResume()
      Overrides:
      onResume in class androidx.fragment.app.Fragment
    • onScrollChanged

      public void onScrollChanged()
      Specified by:
      onScrollChanged in interface android.view.ViewTreeObserver.OnScrollChangedListener
    • onQueryChange

      public void onQueryChange(CharSequence charSequence)
      Specified by:
      onQueryChange in interface SearchView.QueryListener
    • resetQueryTimer

      public void resetQueryTimer()
      Specified by:
      resetQueryTimer in interface SearchView.QueryListener
    • onFocusChange

      public void onFocusChange(boolean hasFocus)
      Specified by:
      onFocusChange in interface SearchView.FocusListener
    • onClick

      public void onClick(com.trimblemaps.api.geocoding.v1.models.TrimbleMapsLocation carmenFeature)
      Specified by:
      onClick in interface ResultClickCallback
    • onCategorySelected

      public void onCategorySelected(com.trimblemaps.api.poi.v1.models.PoiType category)
      Specified by:
      onCategorySelected in interface CategoryView.CategorySelectedListener
    • onShowCategoryList

      public void onShowCategoryList()
      Specified by:
      onShowCategoryList in interface CategoryView.CategoryListVisibilityListener
    • onHideCategoryList

      public void onHideCategoryList()
      Specified by:
      onHideCategoryList in interface CategoryView.CategoryListVisibilityListener
    • onDestroyView

      public void onDestroyView()
      Overrides:
      onDestroyView in class androidx.fragment.app.Fragment
    • onBackButtonPress

      public void onBackButtonPress()
      Specified by:
      onBackButtonPress in interface SearchView.BackButtonListener
    • getCategoryId

      public int getCategoryId()
    • getCategorySelectedName

      public String getCategorySelectedName()
    • getSearchQuery

      public String getSearchQuery()
    • setOnSettingsClickListener

      public void setOnSettingsClickListener(SettingsClickListener listener)
    • setOnPlaceSelectedListener

      public void setOnPlaceSelectedListener(PlaceSelectionListener listener)
    • setOnLoadedListenerListener

      public void setOnLoadedListenerListener(PlaceAutocompleteFragment.OnLoadedListener listener)
    • setOnMenuIconClickListener

      public void setOnMenuIconClickListener(MenuIconClickListener listener)
    • setOnAdditionalInfoShownListener

      public void setOnAdditionalInfoShownListener(AdditionalInfoShownListener listener)
    • 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

      public void setFocusListener(SearchView.FocusListener listener)
    • 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

      public void setPoisResponseListener(PoisResponseListener listener)
    • updateFavoritePlacesView

      protected void updateFavoritePlacesView()
    • showNoResultsFound

      protected void showNoResultsFound(String message)
    • 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

      public Integer 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

      public Boolean isMenuIconVisible()