com.google.android.gms.location.places.AutocompleteFilter Java Examples

The following examples show how to use com.google.android.gms.location.places.AutocompleteFilter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CustomAutoCompleteAdapter.java    From Place-Search-Service with MIT License 5 votes vote down vote up
private Task<AutocompletePredictionBufferResponse> getAutoCompletePlaces(String query) {
    //create autocomplete filter using data from filter Views
    AutocompleteFilter.Builder filterBuilder = new AutocompleteFilter.Builder();
    Task<AutocompletePredictionBufferResponse> results =
            geoDataClient.getAutocompletePredictions(query, null,
                    filterBuilder.build());
    return results;
}
 
Example #2
Source File: AutoCompleteAdapter.java    From AutocompleteLocation with Apache License 2.0 5 votes vote down vote up
public AutoCompleteAdapter(Context context, GoogleApiClient googleApiClient, LatLngBounds bounds,
    AutocompleteFilter filter) {
  super(context, android.R.layout.simple_expandable_list_item_2, android.R.id.text1);
  mGoogleApiClient = googleApiClient;
  mBounds = bounds;
  mPlaceFilter = filter;
}
 
Example #3
Source File: PlaceAutocompleteAdapter.java    From place-search-dialog with Apache License 2.0 5 votes vote down vote up
/**
 * Initializes with a resource for text rows and autocomplete query bounds.
 *
 * @see ArrayAdapter#ArrayAdapter(Context, int)
 */
public PlaceAutocompleteAdapter(Context context, GoogleApiClient googleApiClient,
                                LatLngBounds bounds, AutocompleteFilter filter) {
    super(context, android.R.layout.simple_expandable_list_item_2, android.R.id.text1);
    mGoogleApiClient = googleApiClient;
    mBounds = bounds;
    mPlaceFilter = filter;
}
 
Example #4
Source File: PlaceAutocompleteAdapter.java    From Airbnb-Android-Google-Map-View with MIT License 5 votes vote down vote up
/**
 * Initializes with a resource for text rows and autocomplete query bounds.
 *
 * @see ArrayAdapter#ArrayAdapter(Context, int)
 */
public PlaceAutocompleteAdapter(Context context, int resource, GoogleApiClient googleApiClient,
                                LatLngBounds bounds, AutocompleteFilter filter) {
    super(context, resource);
    mResultList = new ArrayList<>();
    mContext = context;
    mGoogleApiClient = googleApiClient;
    mBounds = bounds;
    mPlaceFilter = filter;
}
 
Example #5
Source File: PlaceAutocompleteAdapter.java    From ExamplesAndroid with Apache License 2.0 5 votes vote down vote up
/**
 * Initializes with a resource for text rows and autocomplete query bounds.
 *
 * @see android.widget.ArrayAdapter#ArrayAdapter(android.content.Context, int)
 */
public PlaceAutocompleteAdapter(Context context, GoogleApiClient googleApiClient,
                                LatLngBounds bounds, AutocompleteFilter filter) {
    super(context, android.R.layout.simple_expandable_list_item_2, android.R.id.text1);
    mGoogleApiClient = googleApiClient;
    mBounds = bounds;
    mPlaceFilter = filter;
}
 
Example #6
Source File: PlaceAutocompleteAdapter.java    From android-play-places with Apache License 2.0 5 votes vote down vote up
/**
 * Initializes with a resource for text rows and autocomplete query bounds.
 *
 * @see android.widget.ArrayAdapter#ArrayAdapter(android.content.Context, int)
 */
public PlaceAutocompleteAdapter(Context context, GeoDataClient geoDataClient,
        LatLngBounds bounds, AutocompleteFilter filter) {
    super(context, android.R.layout.simple_expandable_list_item_2, android.R.id.text1);
    mGeoDataClient = geoDataClient;
    mBounds = bounds;
    mPlaceFilter = filter;
}
 
Example #7
Source File: PlacesAutoCompleteAdapter.java    From GoogleAutoCompleteWithRecyclerView with GNU General Public License v2.0 5 votes vote down vote up
public PlacesAutoCompleteAdapter(Context context, int resource, GoogleApiClient googleApiClient,
                                LatLngBounds bounds, AutocompleteFilter filter) {
    mContext = context;
    layout = resource;
    mGoogleApiClient = googleApiClient;
    mBounds = bounds;
    mPlaceFilter = filter;
}
 
Example #8
Source File: AutoCompleteAdapter.java    From AndroidDemoProjects with Apache License 2.0 5 votes vote down vote up
private void displayPredictiveResults( String query )
{
    //Southwest corner to Northeast corner.
    LatLngBounds bounds = new LatLngBounds( new LatLng( 39.906374, -105.122337 ), new LatLng( 39.949552, -105.068779 ) );

    //Filter: https://developers.google.com/places/supported_types#table3
    List<Integer> filterTypes = new ArrayList<Integer>();
    filterTypes.add( Place.TYPE_ESTABLISHMENT );

    Places.GeoDataApi.getAutocompletePredictions( mGoogleApiClient, query, bounds, AutocompleteFilter.create( filterTypes ) )
        .setResultCallback (
            new ResultCallback<AutocompletePredictionBuffer>() {
                @Override
                public void onResult( AutocompletePredictionBuffer buffer ) {

                    if( buffer == null )
                        return;

                    if( buffer.getStatus().isSuccess() ) {
                        for( AutocompletePrediction prediction : buffer ) {
                            //Add as a new item to avoid IllegalArgumentsException when buffer is released
                            add( new AutoCompletePlace( prediction.getPlaceId(), prediction.getDescription() ) );
                        }
                    }

                    //Prevent memory leak by releasing buffer
                    buffer.release();
                }
            }, 60, TimeUnit.SECONDS );
}
 
Example #9
Source File: GoogleLocationManagerServiceImpl.java    From android_packages_apps_GmsCore with Apache License 2.0 4 votes vote down vote up
@Override
public void iglms55(String var1, LatLngBounds var2, AutocompleteFilter var3, PlacesParams var4,
                    IPlacesCallbacks var5) throws RemoteException {
    Log.d(TAG, "iglms55: " + var1);
}