Material design components to pick country
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.idea
art
buildSrc
countrypicker-sheet
countrypicker
demo
gradle/wrapper
.gitignore
.travis.yml
LICENSE
README.md
build.gradle.kts
gradle.properties
gradlew
gradlew.bat
settings.gradle.kts

README.md

CountryPicker

bintray download build license

demo1 demo2

Material design components to pick country.

Download

repositories {
    google()
    jcenter()
}

dependencies {
    implementation "com.hendraanggrian.appcompat:countrypicker:$version"
    implementation "com.hendraanggrian.appcompat:countrypicker-sheet:$version"
}

Using dialog

Use 'CountryPickerDialog.Builder' to build or show 'CountryPickerDialog'.

new CountryPickerDialog.Builder(context)
    .setOnSelectedListener(new CountryPicker.OnSelectedListener() {
        @Override
        public void onSelected(@NonNull Country country) {
            // do something
        }
    })
    .show();

Using bottom sheet

No builder here, create traditionally.

BottomSheetDialog dialog = new CountryPickerSheetDialog(context);
dialog.setOnSelectedListener(new CountryPicker.OnSelectedListener() {
    @Override
    public void onSelected(@NonNull Country country) {
        // do something
    }
});
dialog.show()

Country flags

Emoji flags

By default, country flags are represented in emoji to achieve lowest library size.

Image flags

To use custom flag images, have a drawable with name format flag_{2-digit iso code} in your project. For example if you want to display US flag, the drawable name should be flag_us.

See Country.java for all available country codes.

License

Copyright 2018 Hendra Anggrian

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.