A fully functional Android app built entirely with Kotlin and Jetpack Compose
Fix formatting
Tomáš Mlynarič7a762de37864
diff --git a/benchmark/src/main/java/com/google/samples/apps/nowinandroid/Utils.kt b/benchmark/src/main/java/com/google/samples/apps/nowinandroid/Utils.ktindex 5db7b5c91..41f817c8d 100644--- a/benchmark/src/main/java/com/google/samples/apps/nowinandroid/Utils.kt+++ b/benchmark/src/main/java/com/google/samples/apps/nowinandroid/Utils.kt@@ -1,17 +1,17 @@/** Copyright 2022 The Android Open Source Project- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * https://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * https://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.*/package com.google.samples.apps.nowinandroiddiff --git a/benchmark/src/main/java/com/google/samples/apps/nowinandroid/baselineprofile/BaselineProfileGenerator.kt b/benchmark/src/main/java/com/google/samples/apps/nowinandroid/baselineprofile/BaselineProfileGenerator.ktindex 889b62191..bd234dccb 100644--- a/benchmark/src/main/java/com/google/samples/apps/nowinandroid/baselineprofile/BaselineProfileGenerator.kt+++ b/benchmark/src/main/java/com/google/samples/apps/nowinandroid/baselineprofile/BaselineProfileGenerator.kt@@ -50,7 +50,7 @@ class BaselineProfileGenerator {forYouSelectAuthors()forYouScrollFeedDownUp()- // Navigate to interests screen+ // Navigate to interests screendevice.findObject(By.text("Interests")).click()device.waitForIdle()@@ -63,4 +63,3 @@ class BaselineProfileGenerator {interestsScrollPeopleDownUp()}}-diff --git a/benchmark/src/main/java/com/google/samples/apps/nowinandroid/foryou/ForYouActions.kt b/benchmark/src/main/java/com/google/samples/apps/nowinandroid/foryou/ForYouActions.ktindex 218e1a210..257b7e910 100644--- a/benchmark/src/main/java/com/google/samples/apps/nowinandroid/foryou/ForYouActions.kt+++ b/benchmark/src/main/java/com/google/samples/apps/nowinandroid/foryou/ForYouActions.kt@@ -1,17 +1,17 @@/** Copyright 2022 The Android Open Source Project- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * https://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * https://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.*/package com.google.samples.apps.nowinandroid.foryoudiff --git a/benchmark/src/main/java/com/google/samples/apps/nowinandroid/foryou/ScrollForYouFeedBenchmark.kt b/benchmark/src/main/java/com/google/samples/apps/nowinandroid/foryou/ScrollForYouFeedBenchmark.ktindex a78947724..3021db75f 100644--- a/benchmark/src/main/java/com/google/samples/apps/nowinandroid/foryou/ScrollForYouFeedBenchmark.kt+++ b/benchmark/src/main/java/com/google/samples/apps/nowinandroid/foryou/ScrollForYouFeedBenchmark.kt@@ -1,17 +1,17 @@/** Copyright 2022 The Android Open Source Project- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * https://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * https://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.*/package com.google.samples.apps.nowinandroid.foryou@@ -54,4 +54,3 @@ class ScrollForYouFeedBenchmark {forYouScrollFeedDownUp()}}-diff --git a/benchmark/src/main/java/com/google/samples/apps/nowinandroid/interests/InterestsActions.kt b/benchmark/src/main/java/com/google/samples/apps/nowinandroid/interests/InterestsActions.ktindex 8dea3d308..474aefe74 100644--- a/benchmark/src/main/java/com/google/samples/apps/nowinandroid/interests/InterestsActions.kt+++ b/benchmark/src/main/java/com/google/samples/apps/nowinandroid/interests/InterestsActions.kt@@ -1,17 +1,17 @@/** Copyright 2022 The Android Open Source Project- *- * Licensed under the Apache License, Version 2.0 (the "License");- * you may not use this file except in compliance with the License.- * You may obtain a copy of the License at- *- * https://www.apache.org/licenses/LICENSE-2.0- *- * Unless required by applicable law or agreed to in writing, software- * distributed under the License is distributed on an "AS IS" BASIS,- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.- * See the License for the specific language governing permissions and- * limitations under the License.+ *+ * Licensed under the Apache License, Version 2.0 (the "License");+ * you may not use this file except in compliance with the License.+ * You may obtain a copy of the License at+ *+ * https://www.apache.org/licenses/LICENSE-2.0+ *+ * Unless required by applicable law or agreed to in writing, software+ * distributed under the License is distributed on an "AS IS" BASIS,+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.+ * See the License for the specific language governing permissions and+ * limitations under the License.*/package com.google.samples.apps.nowinandroid.interestsdiff --git a/benchmark/src/main/java/com/google/samples/apps/nowinandroid/startup/StartupBenchmark.kt b/benchmark/src/main/java/com/google/samples/apps/nowinandroid/startup/StartupBenchmark.ktindex 777b8d80e..5d83d89b2 100644--- a/benchmark/src/main/java/com/google/samples/apps/nowinandroid/startup/StartupBenchmark.kt+++ b/benchmark/src/main/java/com/google/samples/apps/nowinandroid/startup/StartupBenchmark.kt@@ -86,7 +86,7 @@ abstract class AbstractStartupBenchmark(private val startupMode: StartupMode) {}) {startActivityAndWait()- // Waits until the content is ready to capture Time To Full Display+ // Waits until the content is ready to capture Time To Full DisplayforYouWaitForContent()}}diff --git a/feature-foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreen.kt b/feature-foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreen.ktindex 185f7e06c..46b8adc5d 100644--- a/feature-foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreen.kt+++ b/feature-foryou/src/main/java/com/google/samples/apps/nowinandroid/feature/foryou/ForYouScreen.kt@@ -166,10 +166,15 @@ fun ForYouScreen(}// Workaround to call Activity.reportFullyDrawn from Jetpack Compose.- // This code should be called when the UI is ready for use and relates to Time To Full Display.- if (interestsSelectionState !is ForYouInterestsSelectionUiState.Loading && feedState !is ForYouFeedUiState.Loading) {+ // This code should be called when the UI is ready for use+ // and relates to Time To Full Display.+ val interestsLoaded =+ interestsSelectionState !is ForYouInterestsSelectionUiState.Loading+ val feedLoaded = feedState !is ForYouFeedUiState.Loading++ if (interestsLoaded && feedLoaded) {val localView = LocalView.current- // Unit prevents calling it only once on recomposition, but doesn't prevent when the composable goes out of scope.+ // Unit prevents calling it only once on recomposition, but doesn't prevent when the composable goes out of scope.// Activity.reportFullyDrawn has inside check to be called only once.LaunchedEffect(Unit) {// We're leveraging the fact, that the current view is directly set as content of Activity.