diff --git a/README.md b/README.md index 73a7577..d49b7cf 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,7 @@ Let's see how we can do that by following the steps listed above: private fun getPickerItems(): List { - return mutableListOf().apply { + return buildList { for(number in 1..100) { add( PickerItem( diff --git a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/clothingsizepicker/ClothingSizePickerFragment.kt b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/clothingsizepicker/ClothingSizePickerFragment.kt index 7d900cd..eb003f6 100644 --- a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/clothingsizepicker/ClothingSizePickerFragment.kt +++ b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/clothingsizepicker/ClothingSizePickerFragment.kt @@ -68,7 +68,7 @@ internal class ClothingSizePickerFragment : BaseFragment< } private fun generateClothingSizePickerItems(): List { - return ClothingSize.values().map { + return ClothingSize.entries.map { PickerItem( id = it.ordinal, title = it.name, diff --git a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/dashboard/DashboardFragment.kt b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/dashboard/DashboardFragment.kt index 03d637c..9cb5025 100644 --- a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/dashboard/DashboardFragment.kt +++ b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/dashboard/DashboardFragment.kt @@ -41,7 +41,7 @@ internal class DashboardFragment : BaseFragment< private fun initAdapter(): DashboardRecyclerViewAdapter { return DashboardRecyclerViewAdapter( context = requireContext(), - items = DashboardDestination.values().toList(), + items = DashboardDestination.entries.toList(), onItemClickListener = ::navigateToDestination, ) } diff --git a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/datepicker/DatePickerFragment.kt b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/datepicker/DatePickerFragment.kt index 1bb0a34..3d5be1a 100644 --- a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/datepicker/DatePickerFragment.kt +++ b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/datepicker/DatePickerFragment.kt @@ -71,7 +71,7 @@ internal class DatePickerFragment : BaseFragment< } private fun generateMonthPickerItems(longMonthNames: Boolean): List { - return Month.values().map { + return Month.entries.map { PickerItem( id = it.ordinal, title = if (longMonthNames) it.longName else it.shortName, @@ -92,7 +92,7 @@ internal class DatePickerFragment : BaseFragment< } private fun generateDayPickerItems(): List { - return mutableListOf().apply { + return buildList { for (day in 1..31) { add( PickerItem( @@ -116,7 +116,7 @@ internal class DatePickerFragment : BaseFragment< } private fun generateYearPickerItems(): List { - return mutableListOf().apply { + return buildList { for (year in 2020..2030) { add( PickerItem( diff --git a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/moviefilteringpicker/MovieFilteringPickerFragment.kt b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/moviefilteringpicker/MovieFilteringPickerFragment.kt index ed2449f..dfc1cfc 100644 --- a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/moviefilteringpicker/MovieFilteringPickerFragment.kt +++ b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/moviefilteringpicker/MovieFilteringPickerFragment.kt @@ -76,7 +76,7 @@ internal class MovieFilteringPickerFragment : BaseFragment< } private fun generateGenrePickerItems(): List { - return Genre.values().map { + return Genre.entries.map { PickerItem( id = it.ordinal, title = it.title, @@ -98,7 +98,7 @@ internal class MovieFilteringPickerFragment : BaseFragment< } private fun generateYearPickerItems(): List { - return mutableListOf().apply { + return buildList { for (year in 1930..2020) { add( PickerItem( @@ -128,7 +128,7 @@ internal class MovieFilteringPickerFragment : BaseFragment< } private fun generateServicePickerItems(): List { - return StreamingService.values().map { + return StreamingService.entries.map { PickerItem( id = it.ordinal, title = it.title, diff --git a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/personinfopicker/PersonInfoPickerFragment.kt b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/personinfopicker/PersonInfoPickerFragment.kt index a4a1e01..d3fdda6 100644 --- a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/personinfopicker/PersonInfoPickerFragment.kt +++ b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/personinfopicker/PersonInfoPickerFragment.kt @@ -81,7 +81,7 @@ internal class PersonInfoPickerFragment : BaseFragment< } private fun generateAgePickerItems(): List { - return mutableListOf().apply { + return buildList { for (age in 1..100) { add( PickerItem( @@ -106,7 +106,7 @@ internal class PersonInfoPickerFragment : BaseFragment< } private fun generateHeightPickerItems(): List { - return mutableListOf().apply { + return buildList { for (cm in 50..250) { add( PickerItem( @@ -136,7 +136,7 @@ internal class PersonInfoPickerFragment : BaseFragment< } private fun generateWeightPickerItems(): List { - return mutableListOf().apply { + return buildList { for (kg in 10..150) { add( PickerItem( diff --git a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/ratingpicker/RatingPickerFragment.kt b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/ratingpicker/RatingPickerFragment.kt index c0eb0e6..71637a0 100644 --- a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/ratingpicker/RatingPickerFragment.kt +++ b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/ratingpicker/RatingPickerFragment.kt @@ -61,7 +61,7 @@ internal class RatingPickerFragment : BaseFragment< } private fun generateRatingPickerItems(): List { - return Rating.values().map { + return Rating.entries.map { PickerItem( id = it.ordinal, title = it.number.toString(), diff --git a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/teampicker/TeamPickerFragment.kt b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/teampicker/TeamPickerFragment.kt index 789fac4..4efa9bf 100644 --- a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/teampicker/TeamPickerFragment.kt +++ b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/teampicker/TeamPickerFragment.kt @@ -69,7 +69,7 @@ internal class TeamPickerFragment : BaseFragment< } private fun generateTeamPickerItems(): List { - return Team.values().map { + return Team.entries.map { PickerItem( id = it.ordinal, title = it.longName, diff --git a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/timepicker/TimePickerFragment.kt b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/timepicker/TimePickerFragment.kt index 784f685..ebf4320 100644 --- a/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/timepicker/TimePickerFragment.kt +++ b/sample/src/main/java/com/paulrybitskyi/valuepicker/sample/timepicker/TimePickerFragment.kt @@ -70,7 +70,7 @@ internal class TimePickerFragment : BaseFragment< } private fun generateHourPickerItems(): List { - return mutableListOf().apply { + return buildList { for (hour in 1..12) { add( PickerItem( @@ -94,7 +94,7 @@ internal class TimePickerFragment : BaseFragment< } private fun generateMinutePickerItems(): List { - return mutableListOf().apply { + return buildList { for (minute in 0..59) { add( PickerItem( @@ -118,7 +118,7 @@ internal class TimePickerFragment : BaseFragment< } private fun generatePeriodPickerItems(): List { - return mutableListOf().apply { + return buildList { add( PickerItem( id = 1,