Description
An Android library to use the what3words v3 API autosuggest.
To obtain an API key, please visit https://what3words.com/select-plan and sign up for an account.
what3words Autosuggest EditText alternatives and similar packages
Based on the "Navigation" category.
Alternatively, view what3words Autosuggest EditText alternatives based on common mentions on social networks and blogs.
-
SlidingTutorial
Android Library for making animated tutorials inside your app -
Compose Destinations
Annotation processing library for type-safe Jetpack Compose navigation with no boilerplate. -
Bubble Navigation
๐ [Android Library] A light-weight library to easily make beautiful Navigation Bar with ton of ๐จ customization option. -
FragNav
An Android library for managing multiple stacks of fragments -
RecyclerTabLayout
An efficient TabLayout library implemented with RecyclerView. -
Duo Navigation Drawer
A flexible, easy to use, unique drawer library for your Android project. -
AnimatedBottomBar
A customizable and easy to use BottomBar navigation view with sleek animations, with support for ViewPager, ViewPager2, NavController, and badges. -
Chip Navigation Bar
An android navigation bar widget -
BubbleTabBar
BubbleTabBar is a bottom navigation bar with customizable bubble-like tabs -
Compose Navigation Reimagined
๐ Type-safe navigation library for Jetpack Compose -
Alligator
Alligator is a modern Android navigation library that will help to organize your navigation code in clean and testable way. -
Fragula 2
๐ง Fragula is a swipe-to-dismiss extension for navigation component library for Android -
PagerSlidingTabStrip
An interactive indicator to navigate between the different pages of a ViewPager -
Okuki
Okuki is a simple, hierarchical navigation bus and back stack for Android, with optional Rx bindings, and Toothpick DI integration. -
CarMarker-Animation
Marker Animation android googlemap -
Dual-color-Polyline-Animation
This library will help to show the polyline in dual color similar as Uber. -
Keyboard Dismisser
Dismiss your keyboard by tapping anywhere outside it. -
Debug-Artist
Debug menu for happy android dev -
TypedNavigation
A lightweight library to help you navigate in compose with well typed functions. -
Facilis
A sleek, out of the box, easy to understand and use, swipe gesture based Navigational Library for android. -
fragstack
Memory efficient android library for managing individual fragment backstack. -
EasySideNavigation
Create side navigation in easy way -
AndroidBriefActions
Android library for sending and observing non persistent actions such as showing a message; nice readable way to call navigation actions from ViewModel or Activity/Fragment.
Appwrite - The Open Source Firebase alternative introduces iOS support
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of what3words Autosuggest EditText or a related project?
README
w3w-autosuggest-edittext-android
An Android library to use the what3words v3 API autosuggest.
To obtain an API key, please visit https://what3words.com/select-plan and sign up for an account.
Installation
The artifact is available through Maven Central.
Gradle
implementation 'com.what3words:w3w-autosuggest-edittext-android:1.0.0'
Documentation
See the what3words public API documentation
Usage
AndroidManifest.xml
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.yourpackage.yourapp">
<uses-permission android:name="android.permission.INTERNET" />
build.gradle (app level)
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
jvmTarget = "1.8"
}
activity_main.xml
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.what3words.autosuggest.W3WAutoSuggestEditText
android:id="@+id/suggestionEditText"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
Kotlin
class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
suggestionEditText.apiKey("YOUR_API_KEY_HERE")
.returnCoordinates(false)
.onSelected { suggestion, latitude, longitude ->
if (suggestion != null) {
Log.i("MainActivity","words: ${suggestion.words}, country: ${suggestion.country}, near: ${suggestion.nearestPlace}, distance: ${suggestion.distanceToFocusKm}, latitude: $latitude, longitude: $longitude")
} else {
Log.i("MainActivity","invalid w3w address")
}
}
}
}
Java
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
W3WAutoSuggestEditText autoSuggestEditText = findViewById(R.id.suggestionEditText);
autoSuggestEditText.apiKey("YOUR_API_KEY_HERE")
.returnCoordinates(false)
.onSelected((suggestion, latitude, longitude) -> {
if (suggestion != null) {
Log.i("MainActivity", String.format("words: %s, country: %s, near: %s, distance: %d, latitude: %s, longitude: %s", suggestion.getWords(), suggestion.getCountry(), suggestion.getNearestPlace(), suggestion.getDistanceToFocusKm(), latitude, longitude));
} else {
Log.i("MainActivity", "invalid w3w address");
}
return Unit.INSTANCE;
});
}
If you run our Enterprise Suite API Server yourself, you may specify the URL to your own server like so:
suggestionEditText.apiKey("YOUR_API_KEY_HERE", "https://api.yourserver.com")
Available properties:
property | default value | type | description | XML | Programatically |
---|---|---|---|---|---|
apiKey | N/A | String | Your what3words API key. mandatory | :heavy_check_mark: | |
hint | e.g. lock.spout.radar | String | Placeholder text to display in the input in its default empty state. | :heavy_check_mark: | |
errorMessage | No valid what3words address found | String | Overwrite the validation error message with a custom value. | :heavy_check_mark: | :heavy_check_mark: |
focus | N/A | Coordinates | This is a location, specified as a latitude/longitude (often where the user making the query is). If specified, the results will be weighted to give preference to those near the focus | :heavy_check_mark: | |
clipToCountry | N/A | String | Clip results to a given country or comma separated list of countries. Example value:"GB,US". | :heavy_check_mark: | |
clipToCircle | N/A | Coordinates, Int | Clip results to a circle, specified by Coordinate(lat,lng) and kilometres, where kilometres in the radius of the circle. | :heavy_check_mark: | |
clipToBoundingBox | N/A | BoundingBox | Clip results to a bounding box specified using co-ordinates. | :heavy_check_mark: | |
clipToPolygon | N/A | List of Coordinates | Clip results to a bounding box specified using co-ordinates. | :heavy_check_mark: | |
returnCoordinates | false | Boolean | Calls the what3words API to obtain the coordinates for the selected 3 word address (to then use on a map or pass through to a logistic company etc) | :heavy_check_mark: | :heavy_check_mark: |
imageTintColor | #E11F26 | Color | Changes /// image colour. | :heavy_check_mark: |
Styles:
Use our base style as parent and you can set the custom properties available with XML on the table above and the normal EditText styling, i.e:
<style name="YourCustomStyle" parent="Widget.AppCompat.W3WAutoSuggestEditText">
<item name="android:textColor">#000000</item>
<item name="android:textColorHint">#888888</item>
<item name="errorMessage">Your custom error message</item>
<item name="android:hint">Your custom placeholder</item>
<item name="android:textAppearance">@style/YourCustomStyleTextAppearance</item>
</style>
<style name="YourCustomStyleTextAppearance" parent="TextAppearance.AppCompat">
<item name="android:textSize">22sp</item>
<item name="android:fontFamily">sans-serif-medium</item>
</style>