本文整理汇总了Java中com.google.android.gms.location.places.AutocompleteFilter类的典型用法代码示例。如果您正苦于以下问题:Java AutocompleteFilter类的具体用法?Java AutocompleteFilter怎么用?Java AutocompleteFilter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AutocompleteFilter类属于com.google.android.gms.location.places包,在下文中一共展示了AutocompleteFilter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: selectCity
import com.google.android.gms.location.places.AutocompleteFilter; //导入依赖的package包/类
@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.
}
}
示例2: PlaceAutocompleteAdapter
import com.google.android.gms.location.places.AutocompleteFilter; //导入依赖的package包/类
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;
}
示例3: AutoCompleteAdapter
import com.google.android.gms.location.places.AutocompleteFilter; //导入依赖的package包/类
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;
}
示例4: PlaceAutoCompleteAdapter
import com.google.android.gms.location.places.AutocompleteFilter; //导入依赖的package包/类
/**
* 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;
}
示例5: AutoCompleteAdapter
import com.google.android.gms.location.places.AutocompleteFilter; //导入依赖的package包/类
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;
}
示例6: onClick
import com.google.android.gms.location.places.AutocompleteFilter; //导入依赖的package包/类
@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.
}
}
示例7: PlaceAutocompleteAdapter
import com.google.android.gms.location.places.AutocompleteFilter; //导入依赖的package包/类
/**
* 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;
}
示例8: PlaceAutocompleteAdapter
import com.google.android.gms.location.places.AutocompleteFilter; //导入依赖的package包/类
/**
* 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;
}
示例9: PlaceAutocompleteAdapter
import com.google.android.gms.location.places.AutocompleteFilter; //导入依赖的package包/类
/**
* 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;
}
示例10: PlaceAutocompleteAdapter
import com.google.android.gms.location.places.AutocompleteFilter; //导入依赖的package包/类
/**
* 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<>();
}
示例11: PlaceAutocompleteAdapter
import com.google.android.gms.location.places.AutocompleteFilter; //导入依赖的package包/类
/**
* 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;
}
示例12: PlaceAutocompleteAdapter
import com.google.android.gms.location.places.AutocompleteFilter; //导入依赖的package包/类
public PlaceAutocompleteAdapter(Context context, int resource, GoogleApiClient googleApiClient,
LatLngBounds bounds, AutocompleteFilter filter) {
super(context, resource);
mGoogleApiClient = googleApiClient;
mBounds = bounds;
mPlaceFilter = filter;
}
示例13: PlaceAutocompleteAdapter
import com.google.android.gms.location.places.AutocompleteFilter; //导入依赖的package包/类
/**
* 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;
}
示例14: displayPredictiveResults
import com.google.android.gms.location.places.AutocompleteFilter; //导入依赖的package包/类
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 );
}
示例15: PlacesAutoCompleteAdapter
import com.google.android.gms.location.places.AutocompleteFilter; //导入依赖的package包/类
public PlacesAutoCompleteAdapter(Context context, int resource, GoogleApiClient googleApiClient,
LatLngBounds bounds, AutocompleteFilter filter) {
mContext = context;
layout = resource;
mGoogleApiClient = googleApiClient;
mBounds = bounds;
mPlaceFilter = filter;
}
开发者ID:doomtrooper,项目名称:GoogleAutoCompleteWithRecyclerView,代码行数:9,代码来源:PlacesAutoCompleteAdapter.java