Dialog penelusuran pelengkapan otomatis tempat yang menggunakan API tempat Google untuk menemukan hasil.
Dialog mencari lokasi dari seluruh dunia. Untuk menyesuaikannya, tetapkan batas lokasi baru menggunakan .setLatLngBounds(BOUNDS)
PlaceSearchDialog memerlukan kunci Places API oleh Google. Anda bisa mendapatkannya dari sini.
Gunakan dialog apa adanya
PlaceSearchDialog placeSearchDialog = new PlaceSearchDialog . Builder ( this )
. setLocationNameListener ( new PlaceSearchDialog . LocationNameListener () {
@ Override
public void locationName ( String locationName ) {
//set textview or edittext
}
})
. build ();
placeSearchDialog . show ();
atau Sesuaikan sesuai kebutuhan
PlaceSearchDialog placeSearchDialog = new PlaceSearchDialog . Builder ( this )
. setHeaderImage ( R . drawable . dialog_header )
. setHintText ( "Enter location name" )
. setHintTextColor ( R . color . light_gray )
. setNegativeText ( "CANCEL" )
. setNegativeTextColor ( R . color . gray )
. setPositiveText ( "SUBMIT" )
. setPositiveTextColor ( R . color . red )
. setLatLngBounds ( BOUNDS )
. setLocationNameListener ( new PlaceSearchDialog . LocationNameListener () {
@ Override
public void locationName ( String locationName ) {
//set textview or edittext
}
})
. build ();
placeSearchDialog . show ();
Tambahkan ini di aplikasi Anda AndroidManifest.xml
< meta-data android : name = " com.google.android.geo.API_KEY "
android : value = " YOUR_API_KEY " />
Gunakan saja ini sebagai dependensi di file build.gradle aplikasi Anda
dependencies {
compile ' com.codemybrainsout.placesearchdialog:placesearch:1.0.1 '
}
Pastikan Anda memiliki versi plugin Android-maven yang mendukung arsip aar dan menambahkan ketergantungan berikut:
< dependency >
< groupId >com.codemybrainsout.placesearchdialog</ groupId >
< artifactId >placesearch</ artifactId >
< version >1.0.0</ version >
< type >pom</ type >
</ dependency >
Proyek ini diprakarsai oleh Code My Brains Out . Anda dapat berkontribusi pada proyek ini dengan mengirimkan masalah atau/dan dengan mem-forking repo ini dan mengirimkan permintaan penarikan.
Ikuti kami di:
Pengarang: Rahul Juneja
Copyright (C) 2016 Code My Brains Out
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.