Giter VIP home page Giter VIP logo

yasserakbbach / phonenumberpicker Goto Github PK

View Code? Open in Web Editor NEW
5.0 1.0 1.0 21.68 MB

PhoneNumberPicker is an Android library that's built upon the material TextInputLayout with country flags/code/iso2 to ease the process of entering/retrieving phone numbers.

License: MIT License

Java 24.39% Kotlin 75.60% Assembly 0.02%
android kotlin android-library phone-number country-codes country-list country-flags country-picker material-design

phonenumberpicker's Introduction

PhoneNumberPicker Build Status

PhoneNumberPicker is an Android library that's built upon the material TextInputLayout with country flags/code/iso2 to ease the process of entering/retrieving phone numbers.

Features

  • All countries: it has around 220+ country (including some independent ones).
  • Filter by continents: you can filter countries by continent.
  • Exclude country: you can exclude countries by their ISO2 code.
  • Modern country flags: the flags used in the library are here rectangular-rounded-edges.
  • Full phone number details: you can extract country name, code and ISO2 easily!
  • Full control: you have the ability to change default country flag, text color and size, outline border color and max length of digits.
  • Bottom Sheet Dialog: country list
  • Search: you can search and filter countries of the bottom sheet list by name.

Installation

Step 1. Add it in your root build.gradle at the end of repositories:

allprojects {
    repositories {
	...
	maven { url 'https://jitpack.io' }
    }
}

Step 2. Add the dependency

dependencies {
	implementation 'com.github.yasserakbbach:PhoneNumberPicker:1.0.0'
}

Demo

demo

Quick Start

<com.yasserakbbach.phonenumberpicker.PhoneNumberPicker
        android:id="@+id/phone_number"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginStart="12dp"
        android:layout_marginEnd="12dp"/>

XML properties

Name Value
app:textColor #FF0000 OR @color/red
app:outlineBorderColor #FF0000 OR @color/red
app:textSize 18sp
app:defaultCountry ma, us, gb or other ISO2 code
app:continents all/africa/asia/europe/north_america/south_america/oceania
app:maxLength 14

Methods and properties

// Get current countries list
phoneNumber.currentCountries

// Get full phone number
fun getFullPhoneNumber() : String

// Get selected country
fun getSelectedCountry() : Country

// Get countries of specifi continents
fun onlyContinents(vararg continents : Continent) : Unit

// Exclude certain countries by ISO2 criteria
fun exceptCountries(vararg iso2s : String) : Unit

// Add listener on country selection
fun setOnCountrySelected(onCountrySelected: OnCountrySelected) : Unit

// Change text color by a resource OR hexadecimal color #FF0000
fun setTextColor(@ColorRes color : Int) : Unit
fun setTextColor(color : String) : Unit

// Change the outline border color of the TextInputLayout by resource OR hexadecimal color 
fun setOutlineBorderColor(@ColorRes color : Int) : Unit
fun setOutlineBorderColor(color : String) : Unit

// Change text size, the used unit is PIXEL
fun setTextSize(size : Float)

// Set default country flag by given iso2
fun setDefaultCountry(iso2 : String)

// To change max length of digits including the [+] digit!
fun setMaxLength(maxLength : Int)

Special Thanks to:

Knowledge is weapon

License

MIT

phonenumberpicker's People

Contributors

yasserakbbach avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 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.