From be9dc533e36815ddbdeb448a69e641e9ca1687ab Mon Sep 17 00:00:00 2001 From: Simon Marquis Date: Fri, 22 Dec 2023 09:48:37 +0100 Subject: [PATCH] Replace `Enum.values()` with `Enum.entries` 'Enum.values()' is recommended to be replaced by 'Enum.entries' since 1.9 --- .../com/google/samples/apps/nowinandroid/ui/NiaAppState.kt | 2 +- .../interests/ScrollTopicListPowerMetricsBenchmark.kt | 2 +- .../apps/nowinandroid/core/testing/util/ScreenshotHelper.kt | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/NiaAppState.kt b/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/NiaAppState.kt index b99eab245..7a38b6649 100644 --- a/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/NiaAppState.kt +++ b/app/src/main/kotlin/com/google/samples/apps/nowinandroid/ui/NiaAppState.kt @@ -115,7 +115,7 @@ class NiaAppState( * Map of top level destinations to be used in the TopBar, BottomBar and NavRail. The key is the * route. */ - val topLevelDestinations: List = TopLevelDestination.values().asList() + val topLevelDestinations: List = TopLevelDestination.entries /** * The top level destinations that have unread news resources. diff --git a/benchmarks/src/main/kotlin/com/google/samples/apps/nowinandroid/interests/ScrollTopicListPowerMetricsBenchmark.kt b/benchmarks/src/main/kotlin/com/google/samples/apps/nowinandroid/interests/ScrollTopicListPowerMetricsBenchmark.kt index 13c6f55e3..f938fad62 100644 --- a/benchmarks/src/main/kotlin/com/google/samples/apps/nowinandroid/interests/ScrollTopicListPowerMetricsBenchmark.kt +++ b/benchmarks/src/main/kotlin/com/google/samples/apps/nowinandroid/interests/ScrollTopicListPowerMetricsBenchmark.kt @@ -45,7 +45,7 @@ class ScrollTopicListPowerMetricsBenchmark { @get:Rule val benchmarkRule = MacrobenchmarkRule() - private val categories = PowerCategory.values() + private val categories = PowerCategory.entries .associateWith { PowerCategoryDisplayLevel.TOTAL } @Test diff --git a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/util/ScreenshotHelper.kt b/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/util/ScreenshotHelper.kt index 0f00ff16d..468fff8df 100644 --- a/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/util/ScreenshotHelper.kt +++ b/core/testing/src/main/kotlin/com/google/samples/apps/nowinandroid/core/testing/util/ScreenshotHelper.kt @@ -53,7 +53,7 @@ fun AndroidComposeTestRule, A>.c screenshotName: String, body: @Composable () -> Unit, ) { - DefaultTestDevices.values().forEach { + DefaultTestDevices.entries.forEach { this.captureForDevice(it.description, it.spec, screenshotName, body = body) } }