Code Monkey home page Code Monkey logo

countrypicker's Introduction

CountryPicker

CountryPicker is a library that consist of a PhoneNumberEditText and a standalone Picker for countries. PhoneNumberEditText offers and EditText for smooth selection of any Countries dial code and other intesting features.

Build Status Codacy Badge Android Arsenal License

Showcase

                       

Quick Setup

1. Include library

Using Gradle

TimelineView is currently available in on Jitpack so add the following line before every other thing if you have not done that already.

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

Then add the following line

dependencies {
  compile 'com.github.po10cio:CountryPicker:1.0.0'
}

Using Maven

Also add the following lines before adding the maven dependency

<repositories>
  <repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
  </repository>
</repositories>

Then add the dependency

<dependency>
  <groupId>com.github.po10cio</groupId>
  <artifactId>CountryPicker</artifactId>
  <version>1.0.0</version>
</dependency>

2. Usage

In your XML layout include the TimelineView as follows:

<me.jerryhanks.countrypicker.PhoneNumberEditText
        android:id="@+id/countryPicker"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginEnd="8dp"
        android:layout_marginStart="8dp"
        android:layout_marginTop="58dp"
        android:hint="08030720816"
        app:cp_autoDetectCountry="false"
        app:cp_fastScrollerBubbleColor="@color/colorPrimary"
        app:cp_fastScrollerBubbleTextAppearance="@style/TextAppearance.AppCompat.Medium"
        app:cp_fastScrollerHandleColor="@color/colorAccent"
        app:cp_preferredCountries="ng,dz,au,az"
        app:cp_rememberLastSelection="true"
        app:cp_setCountryCodeBorder="true"
        app:cp_showCountryCodeInView="true"
        app:cp_showCountryDialCodeInView="true"
        app:cp_showFastScroll="true"
        app:cp_showFullScreeDialog="true" />
      

XML Attributes

List of xml attribues that are available in PhoneNumberEdittext

XML Attribute Description Default
cp_autoDetectCountry Enables auto detection of the country the device is currently being used true
cp_searchAllowed Enables search functionality in the CountryPicker. true
cp_showFastScroll Determines whether the Fastscroller button is show or not. true
cp_dialogKeyboardAutoPopup Use this to toggle Kwyboard auto popup for CountryPicker in dialog mode. true
cp_showFullScreeDialog Use this to switch between Dialog and full screen Pickers false
cp_showCountryCodeInView Dtermins whether the country code is shown in the EditText true
cp_showCountryCodeInList Determins whether the Country Code is shown in the picker list. true
cp_showCountryDialCodeInView Determind if the Country Dial code is shown in the view. true
cp_showCountryDialCodeInList Dtermins if the Country Code is show in the picker lsit. true
cp_setCountryCodeBorder Determins whether a fancy border is shown around the Picker view. false
cp_defaultCountryName Use this to specify the dafult country you want to show in the PickerView Empty
cp_preferredCountries Use this to enter comma seperated list of prefferd countries. Empty
cp_fastScrollerBubbleColor Sets the color of the fast scroller bubble color #5e64ce
cp_fastScrollerBubbleTextAppearance Sets the testAppearance of the fastScroller TextAppearance.AppCompat.Medium
cp_fastScrollerHandleColor Sets the fastscroller handle color #8f93d1

Dependencies

Recycler Fast scroller by FutureMind

Android Port of libPhonenumber by Michael Rozumyanskiy

Changelog

See the changelog file.

License

CountryPicker is distributed under the MIT license. See LICENSE for details.

countrypicker's People

Contributors

jerryokafor avatar

Stargazers

 avatar  avatar  avatar  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.