-
-
Notifications
You must be signed in to change notification settings - Fork 509
Flag Emoji Support
Harsh B. Bhakta edited this page Mar 18, 2019
·
5 revisions
- Issue #285 came up with a really exciting idea to use flag emoji instead of flag images. This can reduce the library size and flag style can blend with OS theme.
Screen after enabling emoji flags,
- Make sure you are using v2.2.5 or higher.
- Now simply add
app:ccp_useFlagEmoji="true"
to XML Layout and CCP will start using Flag Emoji.
<com.hbb20.CountryCodePicker
android:id="@+id/ccp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:ccp_useFlagEmoji="true" />
- Sometimes Android Studio is Unable to show flag emoji in preview for some countries due to Android Studio Fonts.
- In such conditions, it will place boxed 2 digit name code. For example, instead of new Zealand flag NZ is rendered.
-
- This can lead to incorrect measurement in preview.
- Add additional
app:ccp_useDummyEmojiForPreview="true"
to your CCP XML. This will put Checkered Flag Emoji instead of country flag. And your preview will be something like this: -
- This will override flag emoji only during preview in Android Studio. When you run, your Android Device's font will be used. If your Android device has that emoji then it will be shown correctly.
While we were excited about the approach, we realized following problems. Right now, this feature is still in BETA.
- If your users are running on older device which does not have emoji support for newly released flag emojis then they will not be rendered correctly.
- Emojis are platform specific. So they might not look just the same on devices from different manufacturer. If you are concerned about consistency, you might want to stick with flag images only.
- Library artifact still contain flag images. So library size will not be reduced even if you are using emoji flags.
- How to Integrate into your project
- Full Number Support
- Use as a Country Selector
- Auto detect country
- Auto detect language
- Remember last selection
- Country Preference
- Custom Mater List
- Exclude Countries
- Example phonenumber as hint
- Multi Language Support
- Default Country
- Country Selection Listener
- Dialog events listener
- CCP Theme Customization
- CCP Dialog Theme Customization
- Custom TypeFace
- Read Selected Country
- XML Properties
- Update Guide to v2
- Guide to Add New Language Support
- Guide to add New Country
- Change contry names for local project
- Handle CCP ClickListener Manually
- Custom Dialog Title/Hint/Empty Result ACK
- Flag Emoji Support (BETA)
- Change Log