/EmailChecker-Android

Email checking library for Android

Primary LanguageKotlinGNU General Public License v2.0GPL-2.0

Email Checker for Android

Introduction

This library helps to catch simple email domain typos. Its intended to be used as a hint when a user have to enter an email address.

The library is written in Kotlin and is inspired by the algorithm described here: http://norvig.com/spell-correct.html (Warning, it's not the exact same algo).

How to use it in an Android project

If you want to use it in your Android project, your can add it as a library in your build.gradle file, don't forget to add the wordpress-mobile maven repository. For instance:

dependencies {
    // use the latest version
    compile 'org.wordpress:emailchecker2:+'
}

Sample usage in Java:

String emailToCheck = "salut@gmial.com";
String suggestion = EmailCheckerKt.suggestDomainCorrection(emailToCheck);
if (suggestion.compareTo(email) != 0) {
    Log.v("MYAPP", "did you mean: " + suggestion + " ?");
}

Sample usage in Kotlin:

val emailToCheck = "salut@gmial.com";
val suggestion = suggestDomainCorrection(emailToCheck)
if (suggestion != emailToCheck) {
    Log.v("MYAPP", "did you mean: " + suggestion + " ?");      
}

Hack it

Directory structure

|-- example                 # Example App
`-- emailchecker            # EmailChecker Library

Build

  • Build:
$ ./gradlew build
  • Publish to bintray:
$ ./gradlew build bintrayUpload -PbintrayUser=XXX -PbintrayKey=XXX -PdryRun=false

LICENSE

This library is dual licensed unded MIT and GPL v2.

CHANGELOG

1.0.0

  • Initial release