├── LICENSE ├── README.md └── email-input-view ├── .gitignore ├── app ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── danialgoodwin │ │ └── sample │ │ └── emailinputview │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── danialgoodwin │ │ └── sample │ │ └── emailinputview │ │ └── MainActivity.java │ └── res │ ├── layout │ └── activity_main.xml │ ├── mipmap-hdpi │ └── ic_launcher.png │ ├── mipmap-mdpi │ └── ic_launcher.png │ ├── mipmap-xhdpi │ └── ic_launcher.png │ ├── mipmap-xxhdpi │ └── ic_launcher.png │ ├── values-w820dp │ └── dimens.xml │ └── values │ ├── dimens.xml │ ├── strings.xml │ └── styles.xml ├── build.gradle ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── lib-emailinputview ├── .gitignore ├── build.gradle ├── proguard-rules.pro └── src │ ├── androidTest │ └── java │ │ └── com │ │ └── danialgoodwin │ │ └── ui │ │ └── emailinputview │ │ └── ApplicationTest.java │ └── main │ ├── AndroidManifest.xml │ ├── java │ └── com │ │ └── danialgoodwin │ │ └── ui │ │ └── EmailInputView.java │ └── res │ └── values │ └── strings.xml └── settings.gradle /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Danial Goodwin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # EmailInputView for Android 2 | 3 | An enhanced EditText with easy ability to get valid email from user. An error message will appear for invalid emails. 4 | 5 | 6 | 7 | ## Features ## 8 | 9 | - Keyboards will show the `@` and `.com` (depends on the user's keyboard). 10 | - Show error message for invalid email addresses, but not when the user is in the middle of typing it! 11 | - Convenience method `isValid()`. (Based on Android's `Patterns.EMAIL_ADDRESS`) 12 | - Ability to override `showErrorMessage()` to change behavior. 13 | - All other default `EditText` features, including standard Android UI. 14 | - Minimal size library. 15 | 16 | 17 | 18 | ## Usage ## 19 | 20 | In the app's build.gradle file, add the dependency: 21 | ```groovy 22 | compile 'com.danialgoodwin.android:email-input-view:1.0' 23 | ``` 24 | In XML layout: 25 | ```xml 26 | 30 | ``` 31 | Note: All modern Android projects should already be using jCenter. In the project's root build.gradle file, the following should already be there. 32 | 33 | ```groovy 34 | buildscript { 35 | repositories { 36 | jcenter() 37 | } 38 | ... 39 | } 40 | ``` 41 | 42 | 43 | ## TODO ## 44 | Features up for grabs to get pull-request experience: 45 | 46 | - Don't allow spaces in input. 47 | 48 | 49 | 50 | ## License ## 51 | MIT 52 | -------------------------------------------------------------------------------- /email-input-view/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle 2 | /local.properties 3 | .idea 4 | /.idea/* 5 | .DS_Store 6 | /build 7 | /captures 8 | *.iml 9 | -------------------------------------------------------------------------------- /email-input-view/app/.gitignore: -------------------------------------------------------------------------------- 1 | /build -------------------------------------------------------------------------------- /email-input-view/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion 23 5 | buildToolsVersion "23.0.2" 6 | 7 | defaultConfig { 8 | applicationId "com.danialgoodwin.sample.emailinputview" 9 | minSdkVersion 8 10 | targetSdkVersion 23 11 | versionCode 1 12 | versionName "1.0" 13 | } 14 | buildTypes { 15 | release { 16 | minifyEnabled false 17 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 18 | } 19 | } 20 | } 21 | 22 | dependencies { 23 | // compile fileTree(dir: 'libs', include: ['*.jar']) 24 | // compile 'com.android.support:appcompat-v7:23.1.1' 25 | compile project(':lib-emailinputview') 26 | } 27 | -------------------------------------------------------------------------------- /email-input-view/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /home/dan/dev/android-sdk/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /email-input-view/app/src/androidTest/java/com/danialgoodwin/sample/emailinputview/ApplicationTest.java: -------------------------------------------------------------------------------- 1 | package com.danialgoodwin.sample.emailinputview; 2 | 3 | import android.app.Application; 4 | import android.test.ApplicationTestCase; 5 | 6 | /** 7 | * Testing Fundamentals 8 | */ 9 | public class ApplicationTest extends ApplicationTestCase { 10 | public ApplicationTest() { 11 | super(Application.class); 12 | } 13 | } -------------------------------------------------------------------------------- /email-input-view/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 10 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /email-input-view/app/src/main/java/com/danialgoodwin/sample/emailinputview/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.danialgoodwin.sample.emailinputview; 2 | 3 | import android.app.Activity; 4 | import android.os.Bundle; 5 | import android.view.View; 6 | import android.widget.Toast; 7 | 8 | import com.danialgoodwin.ui.EmailInputView; 9 | 10 | public class MainActivity extends Activity { 11 | 12 | private EmailInputView mEmailInputView; 13 | 14 | @Override 15 | protected void onCreate(Bundle savedInstanceState) { 16 | super.onCreate(savedInstanceState); 17 | setContentView(R.layout.activity_main); 18 | mEmailInputView = (EmailInputView) findViewById(R.id.emailInputView); 19 | 20 | findViewById(R.id.submitButton).setOnClickListener(new View.OnClickListener() { 21 | @Override 22 | public void onClick(View v) { 23 | if (mEmailInputView.isValid()) { 24 | showToast("Email submitted!"); 25 | } else { 26 | showToast("Email not recognized!"); 27 | } 28 | } 29 | }); 30 | } 31 | 32 | private void showToast(CharSequence message) { 33 | Toast.makeText(this, message, Toast.LENGTH_LONG).show(); 34 | } 35 | 36 | } 37 | -------------------------------------------------------------------------------- /email-input-view/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 11 | 12 | 16 | 17 | 21 | 22 | 27 | 28 |