-
-
Notifications
You must be signed in to change notification settings - Fork 31
Country Row
Harsh B. Bhakta edited this page Aug 15, 2020
·
4 revisions
Country Row is the country item that you see inside the recycler view / list. It can be customized using CPRowConfig
(source). Since it's embeded part of the recycler view, CPRecyclerViewHelper
[todo: add link] will take in an instance of CPRowConfig
.



Configuration - CPListConfig
source
- By default, country's emoji flag is loaded
- How to provide custom flag images?
- Add flags as your drawable resources
- Create a class
CustomFlagImageProvider
that extendsCPFlagImageProvider
(source) - Provide an instance of
CustomFlagImageProvider
to CPRowConfig through extension functions [todo: add link] orCPRecyclerViewHelper
[todo: add link].
- By default, country's name is set as primary text.
- How to provide custom primary text?
- Example
-
- To add alpha3 code at end of the name do following:
val primaryTextGenerator = { cpCountry: CPCountry -> "${cpCountry.name} (${cpCountry.alpha3})" }
-
- Provide
primaryTextGenerator
to CPRowConfig through extension functions [todo: add link] orCPRecyclerViewHelper
[todo: add link].
- By default, secondary text is
null
(that's why hidden) - How to provide custom secondary text?
- Example
-
- To add country's capital as secondary text do following:
val secondaryTextGenerator = { cpCountry: CPCountry -> cpCountry.capitalEnglishName }
-
- Provide
secondaryTextGenerator
to CPRowConfig through extension functions [todo: add link] orCPRecyclerViewHelper
[todo: add link].
- By default, highlighted text is
null
(that's why hidden) - How to provide custom highlighted text?
- Example
-
- To add phone code as highlighted text do following:
val highlightedTextGenerator = { cpCountry: CPCountry -> "+${cpCountry.phoneCode}" }
-
- Provide
highlightedTextGenerator
to CPRowConfig through extension functions [todo: add link] orCPRecyclerViewHelper
[todo: add link].