Giter VIP home page Giter VIP logo

intlphoneinput's Introduction

International Phone Input

A fork of the IntlPhoneInput library by RIMOTO

What is it?

IntlNumberInput is a custom view for Android that allows the user to enter his phone number in an elegant and friendly way. It adds a flag dropdown to any input, automatically detects the user's country, displays a relevant placeholder and auto formats the number as they type.

Features

Features from the original version

  1. Automatically format the number as the user types
  2. Automatically set the input placeholder to an example number for the selected country
  3. Selecting a country from the dropdown will update the dial code in the input
  4. Easy embedding as a Custom View
  5. Listener available to detect validity change
  6. Automatically detect phone number when information available
  7. Listen to "done" even on the keyboard

Features added in this version

  1. Set view style using custom XML attributes
  2. Custom error field
  3. Support for mobile and landline phone numbers
  4. Possibility to hide the country spinner (to benefit phone number validation and formatting for a single country)

Download

Download via Gradle:

compile 'com.juxbzh:intlphoneinput:1.0.7'

or Maven:

<dependency>
  <groupId>com.juxbzh</groupId>
  <artifactId>intlphoneinput</artifactId>
  <version>1.0.7</version>
</dependency>

Usage

It's easy like 1-2-3!

  1. Add the view to your layout XML:
<net.rimoto.intlphoneinput.IntlPhoneInput
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:id="@+id/my_phone_input" />
  1. Find it in your java
IntlPhoneInput phoneInputView = (IntlPhoneInput) findById(R.id.my_phone_input);
  1. Check for validity and get the number!
String myInternationalNumber;
if(phoneInputView.isValid()) {
    myInternationalNumber = phoneInputView.getNumber();
}
  1. Customize appearance via XML
<net.rimoto.intlphoneinput.IntlPhoneInput
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="@dimen/component_default_spacing"
    app:textColor="#FF0000"
    app:textColorHint="#FFBBBB"
    app:countryNameColor="@color/colorPrimary"
    app:dialCodeColor="@color/colorAccent"
    app:textSize="20sp"/>

For more details see attached sample project

intlphoneinput's People

Contributors

almogbaku avatar juxbzh avatar chenbachar avatar

Stargazers

GANitak avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.