[go: nahoru, domu]

Move use of global recomposer to be explicit

A Composer's Recomposer is now accessible, permitting access from
inside a composable function via currentComposer.recomposer.

Activity.setContent still uses the global recomposer for now, we will
want to default to a recomposer bound to the main thread in this case.

Test: existing tests
Change-Id: I98e8254f67e6db3961d9d13d1e2341161dce7b46
diff --git a/ui/ui-test/src/androidTest/java/androidx/ui/test/FirstDrawTest.kt b/ui/ui-test/src/androidTest/java/androidx/ui/test/FirstDrawTest.kt
index 5ff4be1..086fe88 100644
--- a/ui/ui-test/src/androidTest/java/androidx/ui/test/FirstDrawTest.kt
+++ b/ui/ui-test/src/androidTest/java/androidx/ui/test/FirstDrawTest.kt
@@ -19,6 +19,7 @@
 import android.view.ViewGroup
 import android.widget.FrameLayout
 import androidx.activity.ComponentActivity
+import androidx.compose.Recomposer
 import androidx.test.espresso.Espresso.onIdle
 import androidx.test.filters.MediumTest
 import androidx.ui.core.Modifier
@@ -85,7 +86,7 @@
 
             root.addView(outOfBoundsView)
             activity.setContentView(root)
-            outOfBoundsView.setContent {
+            outOfBoundsView.setContent(Recomposer.current()) {
                 // If you see this box when running the test, the test is setup incorrectly
                 Box(Modifier, backgroundColor = Color.Yellow)
                 Canvas(Modifier) {