مربع حوار بحث الإكمال التلقائي للمكان الذي يستخدم واجهة برمجة تطبيقات أماكن Google للعثور على النتائج.
يبحث مربع الحوار عن مواقع من جميع أنحاء العالم. لتخصيصه، قم بتعيين حدود الموقع الجديدة باستخدام .setLatLngBounds(BOUNDS)
يتطلب PlaceSearchDialog مفتاح واجهة برمجة تطبيقات الأماكن من Google. يمكنك الحصول عليه من هنا.
استخدم مربع الحوار كما هو
PlaceSearchDialog placeSearchDialog = new PlaceSearchDialog . Builder ( this )
. setLocationNameListener ( new PlaceSearchDialog . LocationNameListener () {
@ Override
public void locationName ( String locationName ) {
//set textview or edittext
}
})
. build ();
placeSearchDialog . show ();
أو تخصيصه وفقا لذلك
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 ();
أضف هذا إلى تطبيقاتك AndroidManifest.xml
< meta-data android : name = " com.google.android.geo.API_KEY "
android : value = " YOUR_API_KEY " />
ما عليك سوى استخدامه باعتباره تبعية في ملف build.gradle الخاص بتطبيقك
dependencies {
compile ' com.codemybrainsout.placesearchdialog:placesearch:1.0.1 '
}
تأكد من أن لديك إصدار android-maven-plugin الذي يدعم أرشيفات aar ويضيف التبعية التالية:
< dependency >
< groupId >com.codemybrainsout.placesearchdialog</ groupId >
< artifactId >placesearch</ artifactId >
< version >1.0.0</ version >
< type >pom</ type >
</ dependency >
بدأ هذا المشروع بواسطة Code My Brains Out . يمكنك المساهمة في هذا المشروع عن طريق إرسال المشكلات و/أو عن طريق تفرع هذا الريبو وإرسال طلب سحب.
تابعونا على:
المؤلف: راهول جونيجا
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.