{"id":13604173,"url":"https://github.com/Willena/Android_PhoneNumber_Input","last_synced_at":"2025-04-11T23:31:53.069Z","repository":{"id":19950643,"uuid":"88362346","full_name":"Willena/Android_PhoneNumber_Input","owner":"Willena","description":"A small library that bring a more powerful widget for telephone number inputs","archived":false,"fork":false,"pushed_at":"2022-03-17T23:55:04.000Z","size":2176,"stargazers_count":8,"open_issues_count":0,"forks_count":4,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-11-07T08:42:15.432Z","etag":null,"topics":["android","formatter","formatting","input","international-telephone","java","libphonenumber","library","phone","phone-number","ui-components","validation","widgets"],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Willena.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-04-15T17:16:02.000Z","updated_at":"2022-09-26T16:37:56.000Z","dependencies_parsed_at":"2022-07-25T07:17:00.167Z","dependency_job_id":null,"html_url":"https://github.com/Willena/Android_PhoneNumber_Input","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Willena%2FAndroid_PhoneNumber_Input","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Willena%2FAndroid_PhoneNumber_Input/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Willena%2FAndroid_PhoneNumber_Input/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Willena%2FAndroid_PhoneNumber_Input/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Willena","download_url":"https://codeload.github.com/Willena/Android_PhoneNumber_Input/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248495018,"owners_count":21113547,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","formatter","formatting","input","international-telephone","java","libphonenumber","library","phone","phone-number","ui-components","validation","widgets"],"created_at":"2024-08-01T19:00:41.092Z","updated_at":"2025-04-11T23:31:52.062Z","avatar_url":"https://github.com/Willena.png","language":"Java","funding_links":[],"categories":["Java"],"sub_categories":[],"readme":"# Android_PhoneNumber_Input\n[![](https://jitpack.io/v/Willena/Android_PhoneNumber_Input.svg)](https://jitpack.io/#Willena/Android_PhoneNumber_Input)\n\nA small library that bring a more powerful widget for telephone number inputs\n\n## What can this lib do\n\nThe main purpose of this library is to pre-validate, phone numbers when asked to the user. The widget automaticaly genrate a number in the international format.\nIt also bring a more intuitive interface for users. Everytime I personnaly have to enter my phone number, I always ask myself : \"Which format should I use ? The international one with the dialing code ? The nationnal one ? Should I remove the fist digit of the number ?\"\n\nThese kind of question disappear with this widget.\n\nThanks to the more low level google's phonenumber library (https://github.com/googlei18n/libphonenumber) it is possible to format phonenumber as needed and also to validate them and now this library act as an interface for this library ! Cool isn't it ?\n\n## How to install\n\nThis library is made for android from API 15 to API 29 (and probably more in the future ).\nInstallation within android Studio is pretty easy, just add these lines to your gradle dependencies.\n\n1. Add this in your root build.gradle at the end of repositories:\n```gradle\n\tallprojects {\n\t\trepositories {\n\t\t\t...\n\t\t\tmaven { url 'https://jitpack.io' }\n\t\t}\n\t}\n  ```\n2. Add the dependency\n```gradle\n\tdependencies {\n\t        compile 'com.github.Willena:Android_PhoneNumber_Input:1.3.2'\n\t}\n```\n## How to use\n\nThe widget can be used in your .xml layout, here is an example :\n```xml\n \u003ccom.github.willena.phoneinputview.PhoneInputView\n        android:layout_width=\"match_parent\"\n        android:layout_height=\"60dp\"\n        android:id=\"@+id/phoneId\"/\u003e\n```\n  \n  and then in your activity :\n  \n```java\nphoneView = (PhoneInputView) findViewById(R.id.phoneId);\n```\n \nThere are some useful method such as :\n- **setConfig** : this method take a CountryConfigurator as parameter\n- **getConfig** : this method give you back the current configuration applied to the widget\n- **getFormatedNumber** : this method should be called when the OnValidEntryListener is triggered. The method also accept as the output type as parameter. The default one is INTERNATIONAL but here are the format supported by google's number formating lib:\n  * E164\n  * INTERNATIONAL\n  * NATIONAL\n  * RFC3966\n- **setCountry** : this method sets the country on the spinner\n- **setDisplayMobileHint** : this method sets the phone number type that will be displayed as hint\n- **setPhoneNumber** : this method sets the number and the country.\n- **getCountryList** : this method returns the list of availale country\n\nThere are also some Listener to listen to allowing you to get information from the widget in real time such as:\n- **OnCountryChangedListener** : triggered when the user decide to change the country in the spinner, you can get the associated country code.\n- **OnValidEntryListener** : triggered when the user enter a valid number ( may be false )\n\n### Three words about the CountryConfigurator\n\nFor now it only permit you to display or not some element in the Spiner, such as the flag _(1)_, the country code _(2)_, and the dial code _(3)_.\nBy default all values are set to true, so every thing is displayed\n\n![this image shows what is (1) (2) (3) ](https://github.com/Willena/Android_PhoneNumber_Input/raw/master/screenshoot/spinner_display_explain.png)\n\n\n```java\nCountryConfigurator config = new CountryConfigurator();\nconfig.setDisplayFlag(true);\nconfig.setDisplayCountryCode(true);\nconfig.setDisplayDialingCode(true);\nconfig.setPhoneNumberHintType(MOBILE); //Set the phone number type that will be displayed as hint (MOBILE, FIXED, NONE)\nconfig.setDefaultCountry(\"FR\"); //Set the default country that will be selected when loading\n``` \n\nSettings can be aplied by using : ``` phoneView.setConfig(config); ```\n\n## Screenshots\n\n![this annimated image shows the widget in action](https://github.com/Willena/Android_PhoneNumber_Input/raw/master/screenshoot/demo_phone_number.gif)\n\n\n## Contributions\nAny suggestions are welcome.\nThis library may not be complete (some flags or country may be missing from the list). Feel free to fork this depos and add new features to this lib.\nIf you have any questions, feel free to ask, I will be happy to answer them.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWillena%2FAndroid_PhoneNumber_Input","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FWillena%2FAndroid_PhoneNumber_Input","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FWillena%2FAndroid_PhoneNumber_Input/lists"}