Place Search Dialog

Additional

Language
Java
Version
N/A
Created
Sep 9, 2016
Updated
Feb 28, 2017
Owner
codemybrainsout
Contributor
ahulr
1
Activity
Badge
Generate
Download
Source code
APK file

Commercial

Place Search Dialog

A place autocomplete search dialog which uses Google's places API for finding results.

The dialog searches for locations from all around the world. To customize it, set the new location bounds using .setLatLngBounds(BOUNDS)

How to use

Setup

PlaceSearchDialog requires Places API key by Google. You can get it from

Use the dialog as it is

 PlaceSearchDialog placeSearchDialog = new PlaceSearchDialog.Builder(this)
                .setLocationNameListener(new PlaceSearchDialog.LocationNameListener() {
                    @Override
                    public void locationName(String locationName) {
                        //set textview or edittext
                    }
                })
                .build();
placeSearchDialog.show();

or Customize it accordingly

 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();

Add this in your applications AndroidManifest.xml

<meta-data android:name="com.google.android.geo.API_KEY"
            android:value="YOUR_API_KEY" />

Installation

Gradle

Just use it as a dependency in your app's build.gradle file

dependencies {
    compile 'com.codemybrainsout.placesearchdialog:placesearch:1.0.1'
}

Maven

Ensure you have android-maven-plugin version that support aar archives and add following dependency:

<dependency>
  <groupId>com.codemybrainsout.placesearchdialog</groupId>
  <artifactId>placesearch</artifactId>
  <version>1.0.0</version>
  <type>pom</type>
</dependency>

Credits

This project was initiated by Code My Brains Out. You can contribute to this project by submitting issues or/and by forking this repo and sending a pull request.

Follow us on:

     

Author: Rahul Juneja

License

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.