@OnClick(R.id.weather_city) public void selectCity() { //restrict to cities AutocompleteFilter cityFilter = new AutocompleteFilter.Builder() .setTypeFilter(AutocompleteFilter.TYPE_FILTER_CITIES) .build(); try { Intent intent = new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_OVERLAY) .setFilter(cityFilter) .build(getActivity()); startActivityForResult(intent, PLACE_AUTOCOMPLETE_REQUEST_CODE); } catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e) { // TODO: Handle the error. } }
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; }
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; }
/** * 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); mGoogleApiClient = googleApiClient; mBounds = bounds; mPlaceFilter = filter; }
public AutoCompleteAdapter(Context mContext, int mLayout, GoogleApiClient mGoogleApiClient, LatLngBounds mBounds, AutocompleteFilter mPlaceFilter, PlaceAutoCompleteInterface mPlaceClickInterface){ this.mContext=mContext; this.mLayout=mLayout; this.mGoogleApiClient=mGoogleApiClient; this.mPlaceFilter=mPlaceFilter; this.mBounds=mBounds; this.mPlaceClickInterface=mPlaceClickInterface; }
@Override public void onClick(View v) { try { // Launch autocomplete activity Intent intent = new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_FULLSCREEN) .setFilter(new AutocompleteFilter.Builder() .setCountry("BR") .build()) .build(MapActivity.this); startActivityForResult(intent, PLACE_AUTOCOMPLETE_REQUEST_CODE); } catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e) { // TODO: Handle the error. } }
/** * 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; }
/** * 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; }
/** * 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; }
/** * 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, R.layout.list_item_layout, android.R.id.text1); mGoogleApiClient = googleApiClient; mBounds = bounds; mPlaceFilter = filter; fixedResults = new ArrayList<>(); }
/** * Initializes with a resource for text rows and autocomplete query bounds. * * @see android.widget.ArrayAdapter#ArrayAdapter(android.content.Context, int) */ public PlaceAutocompleteAdapter(Context context, int resource, LatLngBounds bounds, AutocompleteFilter filter) { super(context, resource); mBounds = bounds; mPlaceFilter = filter; }
public PlaceAutocompleteAdapter(Context context, int resource, GoogleApiClient googleApiClient, LatLngBounds bounds, AutocompleteFilter filter) { super(context, resource); mGoogleApiClient = googleApiClient; mBounds = bounds; mPlaceFilter = filter; }
/** * 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; }
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 ); }
public PlacesAutoCompleteAdapter(Context context, int resource, GoogleApiClient googleApiClient, LatLngBounds bounds, AutocompleteFilter filter) { mContext = context; layout = resource; mGoogleApiClient = googleApiClient; mBounds = bounds; mPlaceFilter = filter; }
public PlaceAutoCompleteAdapter(Context context, GoogleApiClient googleApiClient, AutocompleteFilter filter) { super(context, R.layout.item_place, R.id.place1); mGoogleApiClient = googleApiClient; mPlaceFilter = filter; }
@NonNull public Single<AutocompletePredictionBufferResponse> getAutocompletePredictions(String query, LatLngBounds bounds, AutocompleteFilter filter) { return SingleTask.create(() -> client.getAutocompletePredictions(query, bounds, filter)); }
public PlaceArrayAdapter(Context context, int resource, LatLngBounds bounds, AutocompleteFilter filter) { super(context, resource); mBounds = bounds; mPlaceFilter = filter; }
@Override public void iglms55(String var1, LatLngBounds var2, AutocompleteFilter var3, PlacesParams var4, IPlacesCallbacks var5) throws RemoteException { Log.d(TAG, "iglms55: " + var1); }
/** * Returns observable that fetches autocomplete predictions from Places API. To flatmap and autorelease * {@link com.google.android.gms.location.places.AutocompletePredictionBuffer} you can use * {@link DataBufferObservable}. * * @param query search query * @param bounds bounds where to fetch suggestions from * @param filter filter * @return observable with suggestions buffer and completes */ public Observable<AutocompletePredictionBuffer> getPlaceAutocompletePredictions(final String query, final LatLngBounds bounds, final AutocompleteFilter filter) { return getGoogleApiClientObservable(Places.PLACE_DETECTION_API, Places.GEO_DATA_API) .flatMap(new Func1<GoogleApiClient, Observable<AutocompletePredictionBuffer>>() { @Override public Observable<AutocompletePredictionBuffer> call(GoogleApiClient api) { return fromPendingResult(Places.GeoDataApi.getAutocompletePredictions(api, query, bounds, filter)); } }); }
/** * Constructor * * @param context Context * @param resource Layout resource * @param bounds Used to specify the search bounds * @param filter Used to specify place types */ public PlaceAdapter(Context context, int resource, LatLngBounds bounds, AutocompleteFilter filter) { super(context, resource); mBounds = bounds; mPlaceFilter = filter; }
/** * Constructor * * @param context Context * @param resource Layout resource * @param bounds Used to specify the search bounds * @param filter Used to specify place types */ public PlaceArrayAdapter(Context context, int resource, LatLngBounds bounds, AutocompleteFilter filter) { super(context, resource); mBounds = bounds; mPlaceFilter = filter; }