Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesSc94 authored Oct 11, 2021
1 parent c1cce76 commit f8d2f6f
Showing 1 changed file with 144 additions and 1 deletion.
145 changes: 144 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,137 @@ dataBinding {
enabled = true
}
```
Step 4. Usage
Step 4. Usage (View or DialogFragment)
```
//View(XML)
<com.jamessc.countrypicker.CountryRecyclerview
android:id="@+id/activity_main_rv"
android:layout_width="match_parent"
android:layout_height="match_parent" />
val rv = findViewById<CountryRecyclerview>(R.id.activity_main_rv)
rv.setVisibleCheckbox(true)
rv.setVisiblePrefix(true)
rv.setVisibleIcon(true)
rv.setVisibleName(true)
rv.setVisibleNameShort(true)
rv.setVisibleCurrency(true)
rv.setVisibleCurrencyShort(true)
rv.setVisibleCapital(true)
rv.setVisibleInfo(true)
//Position
rv.setPositionCheckbox(1)
rv.setPositionPrefix(1)
rv.setPositionIcon(1)
rv.setPositionName(1)
rv.setPositionNameShort(1)
rv.setPositionCurrency(1)
rv.setPositionCurrencyShort(1)
rv.setPositionCapital(1)
//Weight
rv.setWeightCheckbox(1f)
rv.setWeightPrefix(1f)
rv.setWeightIcon(1f)
rv.setWeightName(1f)
rv.setWeightNameShort(1f)
rv.setWeightCurrency(1f)
rv.setWeightCurrencyShort(1f)
rv.setWeightCapital(1f)
rv.setWeightInfo(1f)
//Spacing
rv.setSpacingCheckbox(0.2f)
rv.setSpacingPrefix(0.2f)
rv.setSpacingIcon(0.1f)
rv.setSpacingName(0.3f)
rv.setSpacingNameShort(0.2f)
rv.setSpacingCurrency(0.3f)
rv.setSpacingCurrencyShort(0.1f)
rv.setSpacingCapital(0.5f)
rv.setSpacingInfo(0.2f)
//Info
rv.setInfoMessageAll("All msg")
rv.setInfoMessageCustom(hm)
rv.setInfoHiddenOnly(hidden)
rv.setInfoShowOnly(showTemp)
//Hidden
rv.setHiddenOnlyWithName(hidden)
rv.setShowOnlyWithName(show)
//TextView
rv.setTextViewSizeName(20f)
rv.setTextViewSizeNameShort(12f)
rv.setTextViewSizePrefix(25f)
rv.setTextViewSizeCurrency(18f)
rv.setTextViewSizeCurrencyShort(30f)
rv.setTextViewSizeCapital(10f)
rv.setTextViewSizeAll(10f)
rv.setTextViewBoldName(true)
rv.setTextViewBoldNameShort(false)
rv.setTextViewBoldPrefix(true)
rv.setTextViewBoldCurrency(false)
rv.setTextViewBoldCurrencyShort(false)
rv.setTextViewBoldCapital(false)
rv.setTextViewBoldAll(true)
rv.setTextViewColorName(Color.BLUE)
rv.setTextViewColorNameShort(Color.BLUE)
rv.setTextViewColorPrefix(Color.BLUE)
rv.setTextViewColorCurrency(Color.BLUE)
rv.setTextViewColorCurrencyShort(Color.BLUE)
rv.setTextViewColorCapital(Color.BLUE)
rv.setTextViewColorAll(Color.BLUE)
//TextView Custom
rv.setTextViewPrefixSizeWithName(showSize, 15f)
rv.setTextViewNameSizeWithName(showSize, 30f)
rv.setTextViewNameShortSizeWithName(showSize, 25f)
rv.setTextViewCurrencySizeWithName(showSize, 10f)
rv.setTextViewCurrencyShortSizeWithName(showSize, 5f)
rv.setTextViewCapitalSizeWithName(showSize, 20f)
rv.setTextViewPrefixBoldWithName(show, true)
rv.setTextViewNameBoldWithName(show, true)
rv.setTextViewNameShortBoldWithName(show, true)
rv.setTextViewCurrencyBoldWithName(show, true)
rv.setTextViewCurrencyShortBoldWithName(show, true)
rv.setTextViewCapitalBoldWithName(show, true)
rv.setTextViewPrefixColorWithName(show, Color.RED)
rv.setTextViewNameColorWithName(show, Color.RED)
rv.setTextViewNameShortColorWithName(show, Color.RED)
rv.setTextViewCurrencyColorWithName(show, Color.RED)
rv.setTextViewCurrencyShortColorWithName(show, Color.RED)
rv.setTextViewCapitalColorWithName(show, Color.RED)
//Sort
rv.setSortByName()
rv.setSortByNameShort()
rv.setSortByCurrency()
rv.setSortByCurrencyShort()
rv.setSortByCapital()
rv.setSortPrioritizeByName(show)
//BG
rv.setBackgroundColor(Color.GRAY)
rv.setBackgroundListOddColor(Color.GREEN)
rv.setBackgroundListEvenColor(Color.CYAN)
rv.setOnSelectionListener(object : OnSelectionListener {
override fun onResult(c : Country) {
}
})
rv.getMultiSelected()
//DialogFragment
//Visible
val d = DialogCountryJ(this)
d.setVisibleCheckbox(true)
Expand Down Expand Up @@ -190,6 +319,20 @@ Step 4. Usage
d.setBackgroundListEvenColor(Color.CYAN)
d.show(this.supportFragmentManager, "")
d.setOnSelectionListener(object : OnSelectionListener {
override fun onResult(c : Country) {
}
})
d.setOnMultiSelectionListener(object : OnMultiSelectionListener {
override fun onResult(c : List<Country>) {
}
})
```

Happy coding
Expand Down

0 comments on commit f8d2f6f

Please sign in to comment.