SmartyStreets AutocompleteTextView


Source link: https://github.com/RacZo/Smarty-Streets-AutoCompleteTextView

Smarty Streets AutoCompleteTextView

Gradle library. Android AutoCompleteTextView that receives and displays US address suggestions from SmartyStreets's US Autocomplete API.

SmartyStreet's Android SDK does not offer address suggestions, it only offers address verification and zip code lookup.

Demo

Yes, there is a demo app!

Demo app repository: https://github.com/RacZo/SmartyStreets-AutoComplete-Demo

Dependencies

If your app is already using the following SUPER AWESOME libraries:

  1. Google's Gson version 2.8.0 https://github.com/google/gson
  2. Square's okhttp version 3.6.0 https://github.com/square/okhttp
  3. Square's okhttp-logging-interceptor version 3.6.0 https://github.com/square/okhttp/tree/master/okhttp-logging-interceptor

you are set! If not, add the following to your app's build.gradle:

compile 'com.google.code.gson:gson:2.8.' compile 'com.squareup.okhttp3:okhttp:3.6.0' compile 'com.squareup.okhttp3:logging-interceptor:3.6.0'

Installation

Via Gradle, by putting the following in your build.gradle:

compile 'com.oscarsalguero:smartystreetsautocomplete:1.0.1'

Or Maven:

<dependency>
<groupId>com.oscarsalguero</groupId>
<artifactId>smartystreetsautocomplete</artifactId>
<version>1.0.1</version>
<type>pom</type> </dependency>

Usage

  1. Sign up for an account on https://smartystreets.com and create a Website key (API key).

  2. Do not forget to add <uses-permission android:name="android.permission.INTERNET" /> to your app's Manifest.xml.

  3. Create an adapter class called "AddressAutocompleteAdapter" and make it extend "AbstractAddressAutocompleteAdapter", implement the required methods and define a layout for the dropdown item (R.layout.dropdown_text_item).

  4. You will need your API key and a "referer" (host you entered when you created your key). The referer in your app must have "https://" as prefix or the API won't work.

    <com.oscarsalguero.smartystreetsautocomplete.SmartyStreetsAutocompleteTextView
      android:id="@+id/autocomplete_text_view"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:completionHint="Number Street, City State"
      android:completionThreshold="1"
      android:hint="Address"
      android:maxLength="100"
      app:ssacv_adapterClass=".adapter.AddressAutocompleteAdapter"
      app:ssacv_referer="YOUR_REFERER"
      app:ssacv_suggestions="5"
      app:ssacv_webApiKey="YOUR_WEBSITE_KEY" />
  5. To capture the address selection (when the user taps a suggestion) you'll use the provided listener:

    autoCompleteTextView.setOnAddressSelectedListener(new OnAddressSelectedListener() {
    
     @Override
     public void onAddressSelected(@NonNull Address address) {
    
     
    }
     
    }
    );
    

And... voilà!

Contributing

  1. Fork this repo and clone your fork. Create an empty file called "bintray.gradle" in the root of your project.
  2. Make your desired changes
  3. Add tests for your new feature and ensure all tests are passing
  4. Commit and push
  5. Submit a Pull Request through Github's interface and I'll review your changes to see if they make it to the next release.

Issues

Use this repo's github issues.

Based On

SeatGeek's autocomplete library for Google Places https://github.com/seatgeek/android-PlacesAutocompleteTextView and the fact SmartyStreet's Android SDK does not offer address suggestions.

License

Copyright 2017 Oscar Salguero  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. 

Resources

PhotographicPrintAnimator realize a beautiful photographic print animation as described in the Material design spec

Android application compatible with ZX2C4's Pass command line application.

Highly flexible Android Camera which offers granular control over the video quality and file size, while restricting recordings to be landscape only.

MvpCleanArchitecture is a sample project using Clean architecture and MVP.

Adroit is a smart way to develop android applications. Enhance your application development skills by providing safe checks and speed up development process.

IconicDroid is a custom Android Drawable which allows to draw icons from several iconic font.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes