Hide Owner Implementation
The owner interface is implemented by AndroidComposeView. This CL makes the implementation internal to ui-platform, and only exposes the Owner interface.
Bug: 151475149
Test: Fixed all the affected tests, and ran the demo app locally.
Change-Id: I6bd57507105fece7df0facb6acdb627491a1d59b
diff --git a/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/benchmark/test/autofill/AndroidAutofillBenchmark.kt b/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/benchmark/test/autofill/AndroidAutofillBenchmark.kt
index 73fbfdf..801d4be 100644
--- a/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/benchmark/test/autofill/AndroidAutofillBenchmark.kt
+++ b/ui/integration-tests/benchmark/src/androidTest/java/androidx/ui/benchmark/test/autofill/AndroidAutofillBenchmark.kt
@@ -19,6 +19,7 @@
import android.app.Activity
import android.graphics.Rect
import android.util.SparseArray
+import android.view.View
import android.view.autofill.AutofillValue
import androidx.benchmark.junit4.BenchmarkRule
import androidx.benchmark.junit4.measureRepeated
@@ -28,7 +29,8 @@
import androidx.ui.autofill.AutofillNode
import androidx.test.filters.SdkSuppress
import androidx.ui.autofill.AutofillType
-import androidx.ui.core.AndroidComposeView
+import androidx.ui.core.Owner
+import androidx.ui.core.createOwner
import org.junit.Before
import org.junit.Rule
import org.junit.Test
@@ -45,11 +47,11 @@
@get:Rule
val benchmarkRule = BenchmarkRule()
- private lateinit var composeView: AndroidComposeView
+ private lateinit var owner: Owner
@Before
fun setup() {
- composeView = AndroidComposeView(activityRule.activity)
+ owner = createOwner(activityRule.activity)
}
@Test
@@ -66,11 +68,11 @@
val autofillValues = SparseArray<AutofillValue>().apply {
append(autofillNode.id, AutofillValue.forText("Name"))
}
- composeView.autofillTree += autofillNode
+ owner.autofillTree += autofillNode
// Assess.
benchmarkRule.measureRepeated {
- composeView.autofill(autofillValues)
+ (owner as View).autofill(autofillValues)
}
}
}
\ No newline at end of file
diff --git a/ui/ui-android-view/src/androidTest/java/androidx/ui/androidview/test/ComposedViewTest.kt b/ui/ui-android-view/src/androidTest/java/androidx/ui/androidview/test/ComposedViewTest.kt
index 67dc4f5..3c23b29 100644
--- a/ui/ui-android-view/src/androidTest/java/androidx/ui/androidview/test/ComposedViewTest.kt
+++ b/ui/ui-android-view/src/androidTest/java/androidx/ui/androidview/test/ComposedViewTest.kt
@@ -25,7 +25,7 @@
import androidx.test.espresso.matcher.ViewMatchers.withParent
import androidx.test.filters.SmallTest
import androidx.ui.androidview.AndroidView
-import androidx.ui.core.AndroidComposeView
+import androidx.ui.core.Owner
import androidx.ui.test.createComposeRule
import org.hamcrest.CoreMatchers.instanceOf
import org.junit.Rule
@@ -56,15 +56,15 @@
AndroidView(R.layout.test_layout)
}
Espresso
- .onView(withParent(withParent(instanceOf(AndroidComposeView::class.java))))
+ .onView(withParent(withParent(instanceOf(Owner::class.java))))
.check(matches(isDisplayed()))
.check { view, exception ->
if (view.layoutParams.width !=
- TypedValue.applyDimension(
- TypedValue.COMPLEX_UNIT_DIP,
- 300f,
- view.context.resources.displayMetrics
- ).roundToInt()
+ TypedValue.applyDimension(
+ TypedValue.COMPLEX_UNIT_DIP,
+ 300f,
+ view.context.resources.displayMetrics
+ ).roundToInt()
) {
throw exception
}
diff --git a/ui/ui-framework/api/0.1.0-dev07.txt b/ui/ui-framework/api/0.1.0-dev07.txt
index 31d2df4..71d2daab 100644
--- a/ui/ui-framework/api/0.1.0-dev07.txt
+++ b/ui/ui-framework/api/0.1.0-dev07.txt
@@ -122,10 +122,8 @@
}
public final class WrapperKt {
- method public static void ComposeView(kotlin.jvm.functions.Function0<kotlin.Unit> children);
method @Deprecated public static void disposeComposition(android.view.ViewGroup);
method @Deprecated public static void disposeComposition(android.app.Activity);
- method public static androidx.compose.ProvidableAmbient<androidx.ui.core.AndroidComposeView> getAndroidComposeViewAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.animation.AnimationClockObservable> getAnimationClockAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.autofill.Autofill> getAutofillAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.autofill.AutofillTree> getAutofillTreeAmbient();
@@ -137,6 +135,7 @@
method public static androidx.compose.ProvidableAmbient<androidx.ui.text.font.Font.ResourceLoader> getFontLoaderAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.core.hapticfeedback.HapticFeedback> getHapticFeedBackAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.core.LayoutDirection> getLayoutDirectionAmbient();
+ method public static androidx.compose.ProvidableAmbient<androidx.ui.core.Owner> getOwnerAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.input.TextInputService> getTextInputServiceAmbient();
method public static androidx.compose.Composition setContent(android.app.Activity, kotlin.jvm.functions.Function0<kotlin.Unit> content);
method public static androidx.compose.Composition setContent(android.view.ViewGroup, kotlin.jvm.functions.Function0<kotlin.Unit> content);
diff --git a/ui/ui-framework/api/current.txt b/ui/ui-framework/api/current.txt
index 31d2df4..71d2daab 100644
--- a/ui/ui-framework/api/current.txt
+++ b/ui/ui-framework/api/current.txt
@@ -122,10 +122,8 @@
}
public final class WrapperKt {
- method public static void ComposeView(kotlin.jvm.functions.Function0<kotlin.Unit> children);
method @Deprecated public static void disposeComposition(android.view.ViewGroup);
method @Deprecated public static void disposeComposition(android.app.Activity);
- method public static androidx.compose.ProvidableAmbient<androidx.ui.core.AndroidComposeView> getAndroidComposeViewAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.animation.AnimationClockObservable> getAnimationClockAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.autofill.Autofill> getAutofillAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.autofill.AutofillTree> getAutofillTreeAmbient();
@@ -137,6 +135,7 @@
method public static androidx.compose.ProvidableAmbient<androidx.ui.text.font.Font.ResourceLoader> getFontLoaderAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.core.hapticfeedback.HapticFeedback> getHapticFeedBackAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.core.LayoutDirection> getLayoutDirectionAmbient();
+ method public static androidx.compose.ProvidableAmbient<androidx.ui.core.Owner> getOwnerAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.input.TextInputService> getTextInputServiceAmbient();
method public static androidx.compose.Composition setContent(android.app.Activity, kotlin.jvm.functions.Function0<kotlin.Unit> content);
method public static androidx.compose.Composition setContent(android.view.ViewGroup, kotlin.jvm.functions.Function0<kotlin.Unit> content);
diff --git a/ui/ui-framework/api/public_plus_experimental_0.1.0-dev07.txt b/ui/ui-framework/api/public_plus_experimental_0.1.0-dev07.txt
index 31d2df4..71d2daab 100644
--- a/ui/ui-framework/api/public_plus_experimental_0.1.0-dev07.txt
+++ b/ui/ui-framework/api/public_plus_experimental_0.1.0-dev07.txt
@@ -122,10 +122,8 @@
}
public final class WrapperKt {
- method public static void ComposeView(kotlin.jvm.functions.Function0<kotlin.Unit> children);
method @Deprecated public static void disposeComposition(android.view.ViewGroup);
method @Deprecated public static void disposeComposition(android.app.Activity);
- method public static androidx.compose.ProvidableAmbient<androidx.ui.core.AndroidComposeView> getAndroidComposeViewAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.animation.AnimationClockObservable> getAnimationClockAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.autofill.Autofill> getAutofillAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.autofill.AutofillTree> getAutofillTreeAmbient();
@@ -137,6 +135,7 @@
method public static androidx.compose.ProvidableAmbient<androidx.ui.text.font.Font.ResourceLoader> getFontLoaderAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.core.hapticfeedback.HapticFeedback> getHapticFeedBackAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.core.LayoutDirection> getLayoutDirectionAmbient();
+ method public static androidx.compose.ProvidableAmbient<androidx.ui.core.Owner> getOwnerAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.input.TextInputService> getTextInputServiceAmbient();
method public static androidx.compose.Composition setContent(android.app.Activity, kotlin.jvm.functions.Function0<kotlin.Unit> content);
method public static androidx.compose.Composition setContent(android.view.ViewGroup, kotlin.jvm.functions.Function0<kotlin.Unit> content);
diff --git a/ui/ui-framework/api/public_plus_experimental_current.txt b/ui/ui-framework/api/public_plus_experimental_current.txt
index 31d2df4..71d2daab 100644
--- a/ui/ui-framework/api/public_plus_experimental_current.txt
+++ b/ui/ui-framework/api/public_plus_experimental_current.txt
@@ -122,10 +122,8 @@
}
public final class WrapperKt {
- method public static void ComposeView(kotlin.jvm.functions.Function0<kotlin.Unit> children);
method @Deprecated public static void disposeComposition(android.view.ViewGroup);
method @Deprecated public static void disposeComposition(android.app.Activity);
- method public static androidx.compose.ProvidableAmbient<androidx.ui.core.AndroidComposeView> getAndroidComposeViewAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.animation.AnimationClockObservable> getAnimationClockAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.autofill.Autofill> getAutofillAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.autofill.AutofillTree> getAutofillTreeAmbient();
@@ -137,6 +135,7 @@
method public static androidx.compose.ProvidableAmbient<androidx.ui.text.font.Font.ResourceLoader> getFontLoaderAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.core.hapticfeedback.HapticFeedback> getHapticFeedBackAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.core.LayoutDirection> getLayoutDirectionAmbient();
+ method public static androidx.compose.ProvidableAmbient<androidx.ui.core.Owner> getOwnerAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.input.TextInputService> getTextInputServiceAmbient();
method public static androidx.compose.Composition setContent(android.app.Activity, kotlin.jvm.functions.Function0<kotlin.Unit> content);
method public static androidx.compose.Composition setContent(android.view.ViewGroup, kotlin.jvm.functions.Function0<kotlin.Unit> content);
diff --git a/ui/ui-framework/api/restricted_0.1.0-dev07.txt b/ui/ui-framework/api/restricted_0.1.0-dev07.txt
index ad2c108..c81aa1e 100644
--- a/ui/ui-framework/api/restricted_0.1.0-dev07.txt
+++ b/ui/ui-framework/api/restricted_0.1.0-dev07.txt
@@ -122,10 +122,8 @@
}
public final class WrapperKt {
- method public static void ComposeView(kotlin.jvm.functions.Function0<kotlin.Unit> children);
method @Deprecated public static void disposeComposition(android.view.ViewGroup);
method @Deprecated public static void disposeComposition(android.app.Activity);
- method public static androidx.compose.ProvidableAmbient<androidx.ui.core.AndroidComposeView> getAndroidComposeViewAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.animation.AnimationClockObservable> getAnimationClockAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.autofill.Autofill> getAutofillAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.autofill.AutofillTree> getAutofillTreeAmbient();
@@ -137,6 +135,7 @@
method public static androidx.compose.ProvidableAmbient<androidx.ui.text.font.Font.ResourceLoader> getFontLoaderAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.core.hapticfeedback.HapticFeedback> getHapticFeedBackAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.core.LayoutDirection> getLayoutDirectionAmbient();
+ method public static androidx.compose.ProvidableAmbient<androidx.ui.core.Owner> getOwnerAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.input.TextInputService> getTextInputServiceAmbient();
method public static androidx.compose.Composition setContent(android.app.Activity, kotlin.jvm.functions.Function0<kotlin.Unit> content);
method public static androidx.compose.Composition setContent(android.view.ViewGroup, kotlin.jvm.functions.Function0<kotlin.Unit> content);
diff --git a/ui/ui-framework/api/restricted_current.txt b/ui/ui-framework/api/restricted_current.txt
index ad2c108..c81aa1e 100644
--- a/ui/ui-framework/api/restricted_current.txt
+++ b/ui/ui-framework/api/restricted_current.txt
@@ -122,10 +122,8 @@
}
public final class WrapperKt {
- method public static void ComposeView(kotlin.jvm.functions.Function0<kotlin.Unit> children);
method @Deprecated public static void disposeComposition(android.view.ViewGroup);
method @Deprecated public static void disposeComposition(android.app.Activity);
- method public static androidx.compose.ProvidableAmbient<androidx.ui.core.AndroidComposeView> getAndroidComposeViewAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.animation.AnimationClockObservable> getAnimationClockAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.autofill.Autofill> getAutofillAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.autofill.AutofillTree> getAutofillTreeAmbient();
@@ -137,6 +135,7 @@
method public static androidx.compose.ProvidableAmbient<androidx.ui.text.font.Font.ResourceLoader> getFontLoaderAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.core.hapticfeedback.HapticFeedback> getHapticFeedBackAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.core.LayoutDirection> getLayoutDirectionAmbient();
+ method public static androidx.compose.ProvidableAmbient<androidx.ui.core.Owner> getOwnerAmbient();
method public static androidx.compose.ProvidableAmbient<androidx.ui.input.TextInputService> getTextInputServiceAmbient();
method public static androidx.compose.Composition setContent(android.app.Activity, kotlin.jvm.functions.Function0<kotlin.Unit> content);
method public static androidx.compose.Composition setContent(android.view.ViewGroup, kotlin.jvm.functions.Function0<kotlin.Unit> content);
diff --git a/ui/ui-framework/src/androidTest/java/androidx/ui/core/PopupTest.kt b/ui/ui-framework/src/androidTest/java/androidx/ui/core/PopupTest.kt
index bcf8c15..d2240e7 100644
--- a/ui/ui-framework/src/androidTest/java/androidx/ui/core/PopupTest.kt
+++ b/ui/ui-framework/src/androidTest/java/androidx/ui/core/PopupTest.kt
@@ -73,7 +73,7 @@
composeTestRule.setContent {
// Get the compose view position on screen
- val composeView = AndroidComposeViewAmbient.current
+ val composeView = OwnerAmbient.current as View
val positionArray = IntArray(2)
composeView.getLocationOnScreen(positionArray)
composeViewAbsolutePosition = IntPxPosition(
@@ -107,7 +107,7 @@
private fun popupMatches(viewMatcher: Matcher<in View>) {
// Make sure that current measurement/drawing is finished
composeTestRule.runOnIdleCompose { }
- Espresso.onView(instanceOf(AndroidComposeView::class.java))
+ Espresso.onView(instanceOf(Owner::class.java))
.inRoot(PopupLayoutMatcher())
.check(matches(viewMatcher))
}
@@ -521,7 +521,7 @@
private fun matchesAndroidComposeView(): BoundedMatcher<View, View> {
return object : BoundedMatcher<View, View>(View::class.java) {
override fun matchesSafely(item: View?): Boolean {
- return (item is AndroidComposeView)
+ return (item is Owner)
}
override fun describeTo(description: Description?) {
@@ -546,6 +546,7 @@
return object : BoundedMatcher<View, View>(View::class.java) {
// (-1, -1) no position found
var positionFound = IntPxPosition(IntPx(-1), IntPx(-1))
+
override fun matchesSafely(item: View?): Boolean {
val position = IntArray(2)
item?.getLocationOnScreen(position)
@@ -555,8 +556,9 @@
}
override fun describeTo(description: Description?) {
- description?.appendText("with expected position: $expectedPosition" +
- " but position found: $positionFound")
+ description?.appendText(
+ "with expected position: $expectedPosition but position found: $positionFound"
+ )
}
}
}
diff --git a/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/AndroidLayoutDrawTest.kt b/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/AndroidLayoutDrawTest.kt
index 9f37d0b..36db5e6 100644
--- a/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/AndroidLayoutDrawTest.kt
+++ b/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/AndroidLayoutDrawTest.kt
@@ -36,7 +36,6 @@
import androidx.test.filters.SdkSuppress
import androidx.test.filters.SmallTest
import androidx.test.rule.ActivityTestRule
-import androidx.ui.core.AndroidComposeView
import androidx.ui.core.Constraints
import androidx.ui.core.DrawLayerModifier
import androidx.ui.core.DrawModifier
@@ -47,6 +46,7 @@
import androidx.ui.core.LayoutTag
import androidx.ui.core.Measurable
import androidx.ui.core.Modifier
+import androidx.ui.core.Owner
import androidx.ui.core.ParentData
import androidx.ui.core.ParentDataModifier
import androidx.ui.core.PassThroughLayout
@@ -111,12 +111,14 @@
val excessiveAssertions = AndroidOwnerExtraAssertionsRule()
private lateinit var activity: TestActivity
private lateinit var drawLatch: CountDownLatch
+ private lateinit var outerLatch: CountDownLatch
@Before
fun setup() {
activity = activityTestRule.activity
activity.hasFocusLatch.await(5, TimeUnit.SECONDS)
drawLatch = CountDownLatch(1)
+ outerLatch = CountDownLatch(1)
}
// Tests that simple drawing works with layered squares
@@ -1611,11 +1613,11 @@
activityTestRule.runOnUiThreadIR {
activity.setContentInFrameLayout {
AtLeastSize(100.ipx, PaddingModifier(10.ipx) + drawLayer() +
- draw { _, parentSize ->
- assertEquals(100.px, parentSize.width)
- assertEquals(100.px, parentSize.height)
- latch.countDown()
- }) {
+ draw { _, parentSize ->
+ assertEquals(100.px, parentSize.width)
+ assertEquals(100.px, parentSize.height)
+ latch.countDown()
+ }) {
}
}
}
@@ -1931,10 +1933,12 @@
canvas.drawRect(size.toRect(), Paint().apply { color = green })
}) {
FixedSize(model.offset, modifier = AlignTopLeft + drawLayer() +
- draw { canvas, parentSize ->
- drawLatch.countDown()
- canvas.drawRect(parentSize.toRect(), Paint().apply { color = blue })
- }) {
+ draw { canvas, parentSize ->
+ drawLatch.countDown()
+ canvas.drawRect(
+ parentSize.toRect(),
+ Paint().apply { color = blue })
+ }) {
}
}
}
@@ -1984,8 +1988,8 @@
}
val content = activity.findViewById<ViewGroup>(android.R.id.content)
val frameLayout = content.getChildAt(0) as ViewGroup
- val androidComposeView = frameLayout.getChildAt(0) as AndroidComposeView
- androidComposeView.showLayoutBounds = true
+ val owner = frameLayout.getChildAt(0) as Owner
+ owner.showLayoutBounds = true
}
activityTestRule.waitAndScreenShot().apply {
assertRect(Color.White, size = 8)
@@ -2113,8 +2117,10 @@
FixedSize(
size = 10.ipx,
modifier = PaddingModifier(10.ipx) +
- drawLayer(clipToOutline = false, outlineShape = triangleShape,
- clipToBounds = false) +
+ drawLayer(
+ clipToOutline = false, outlineShape = triangleShape,
+ clipToBounds = false
+ ) +
draw { canvas, _ ->
val paint = Paint().apply {
color = Color.Blue
@@ -2172,7 +2178,6 @@
@FlakyTest
@Test
fun doubleDraw() {
- var outerLatch = CountDownLatch(1)
val model = OffsetModel(0.ipx)
activityTestRule.runOnUiThread {
activity.setContent {
@@ -2818,20 +2823,22 @@
runOnUiThread(runnable)
}
-fun ActivityTestRule<*>.findAndroidComposeView(): AndroidComposeView {
+fun ActivityTestRule<*>.findAndroidComposeView(): ViewGroup {
val contentViewGroup = activity.findViewById<ViewGroup>(android.R.id.content)
return findAndroidComposeView(contentViewGroup)!!
}
-fun findAndroidComposeView(parent: ViewGroup): AndroidComposeView? {
+fun findAndroidComposeView(parent: ViewGroup): ViewGroup? {
for (index in 0 until parent.childCount) {
val child = parent.getChildAt(index)
- if (child is AndroidComposeView) {
- return child
- } else if (child is ViewGroup) {
- val composeView = findAndroidComposeView(child)
- if (composeView != null) {
- return composeView
+ if (child is ViewGroup) {
+ if (child is Owner)
+ return child
+ else {
+ val composeView = findAndroidComposeView(child)
+ if (composeView != null) {
+ return composeView
+ }
}
}
}
diff --git a/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/AndroidOwnerExtraAssertionsRule.kt b/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/AndroidOwnerExtraAssertionsRule.kt
index be69b70..77a0867 100644
--- a/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/AndroidOwnerExtraAssertionsRule.kt
+++ b/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/AndroidOwnerExtraAssertionsRule.kt
@@ -16,13 +16,13 @@
package androidx.ui.core.test
-import androidx.ui.core.AndroidComposeView
+import androidx.ui.core.Owner
import org.junit.rules.TestRule
import org.junit.runner.Description
import org.junit.runners.model.Statement
/**
- * Enables extra assertions inside [AndroidComposeView].
+ * Enables extra assertions inside [Owner].
*/
class AndroidOwnerExtraAssertionsRule : TestRule {
@@ -34,11 +34,11 @@
private val base: Statement
) : Statement() {
override fun evaluate() {
- AndroidComposeView.enableExtraAssertions = true
+ Owner.enableExtraAssertions = true
try {
base.evaluate()
} finally {
- AndroidComposeView.enableExtraAssertions = false
+ Owner.enableExtraAssertions = false
}
}
}
diff --git a/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/AndroidViewCompatTest.kt b/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/AndroidViewCompatTest.kt
index df6e025..e8f2fa6 100644
--- a/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/AndroidViewCompatTest.kt
+++ b/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/AndroidViewCompatTest.kt
@@ -33,13 +33,13 @@
import androidx.test.espresso.matcher.ViewMatchers.isDescendantOfA
import androidx.test.filters.SdkSuppress
import androidx.test.filters.SmallTest
-import androidx.ui.core.AndroidComposeView
import androidx.ui.core.Constraints
import androidx.ui.core.Layout
import androidx.ui.core.LayoutDirection
import androidx.ui.core.LayoutModifier
import androidx.ui.unit.Density
import androidx.ui.core.Modifier
+import androidx.ui.core.Owner
import androidx.ui.core.Ref
import androidx.ui.core.TestTag
import androidx.ui.core.drawLayer
@@ -100,7 +100,7 @@
assertNotNull(squareView)
Espresso
.onView(instanceOf(ColoredSquareView::class.java))
- .check(matches(isDescendantOfA(instanceOf(AndroidComposeView::class.java))))
+ .check(matches(isDescendantOfA(instanceOf(Owner::class.java))))
.check(matches(`is`(squareView)))
composeTestRule.runOnUiThread {
@@ -111,7 +111,7 @@
findByTag("content").assertIsDisplayed()
Espresso
.onView(instanceOf(ColoredSquareView::class.java))
- .check(matches(isDescendantOfA(instanceOf(AndroidComposeView::class.java))))
+ .check(matches(isDescendantOfA(instanceOf(Owner::class.java))))
.check(matches(`is`(squareView)))
composeTestRule.runOnUiThread {
@@ -122,7 +122,7 @@
findByTag("content").assertIsDisplayed()
Espresso
.onView(instanceOf(ColoredSquareView::class.java))
- .check(matches(isDescendantOfA(instanceOf(AndroidComposeView::class.java))))
+ .check(matches(isDescendantOfA(instanceOf(Owner::class.java))))
.check(matches(`is`(squareView)))
}
@@ -146,7 +146,7 @@
assertNotNull(squareView)
Espresso
.onView(instanceOf(ColoredSquareView::class.java))
- .check(matches(isDescendantOfA(instanceOf(AndroidComposeView::class.java))))
+ .check(matches(isDescendantOfA(instanceOf(Owner::class.java))))
.check(matches(`is`(squareView)))
val expectedPixelColor = { position: IntPxPosition ->
if (position.x.value < squareSize && position.y.value < squareSize) {
@@ -167,7 +167,7 @@
}
Espresso
.onView(instanceOf(ColoredSquareView::class.java))
- .check(matches(isDescendantOfA(instanceOf(AndroidComposeView::class.java))))
+ .check(matches(isDescendantOfA(instanceOf(Owner::class.java))))
.check(matches(`is`(squareView)))
findByTag("content")
.assertIsDisplayed()
@@ -181,7 +181,7 @@
}
Espresso
.onView(instanceOf(ColoredSquareView::class.java))
- .check(matches(isDescendantOfA(instanceOf(AndroidComposeView::class.java))))
+ .check(matches(isDescendantOfA(instanceOf(Owner::class.java))))
.check(matches(`is`(squareView)))
findByTag("content")
.assertIsDisplayed()
@@ -344,6 +344,7 @@
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
setMeasuredDimension(size, size)
}
+
override fun draw(canvas: Canvas?) {
super.draw(canvas)
canvas!!.drawRect(
@@ -392,5 +393,8 @@
}
}
-@Model private data class ColorModel(var color: Color)
-@Model private data class ConstraintsModel(var constraints: Constraints)
+@Model
+private data class ColorModel(var color: Color)
+
+@Model
+private data class ConstraintsModel(var constraints: Constraints)
diff --git a/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/WrapperTest.kt b/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/WrapperTest.kt
index 8360f75..d328fd7 100644
--- a/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/WrapperTest.kt
+++ b/ui/ui-framework/src/androidTest/java/androidx/ui/core/test/WrapperTest.kt
@@ -21,8 +21,7 @@
import androidx.compose.Recompose
import androidx.compose.onActive
import androidx.compose.onCommit
-import androidx.ui.core.ComposeView
-import androidx.ui.core.setViewContent
+import androidx.ui.core.setContent
import org.junit.Assert.assertEquals
import org.junit.Assert.assertTrue
import org.junit.Before
@@ -50,27 +49,22 @@
@Test
fun ensureComposeWrapperDoesntPropagateInvalidations() {
val commitLatch = CountDownLatch(2)
- var rootCount = 0
var composeWrapperCount = 0
var innerCount = 0
runOnUiThread {
- activity.setViewContent {
- onCommit { rootCount++ }
- ComposeView {
- onCommit { composeWrapperCount++ }
- Recompose { recompose ->
- onCommit {
- innerCount++
- commitLatch.countDown()
- }
- onActive { recompose() }
+ activity.setContent {
+ onCommit { composeWrapperCount++ }
+ Recompose { recompose ->
+ onCommit {
+ innerCount++
+ commitLatch.countDown()
}
+ onActive { recompose() }
}
}
}
assertTrue(commitLatch.await(1, TimeUnit.SECONDS))
- assertEquals(1, rootCount)
assertEquals(1, composeWrapperCount)
assertEquals(2, innerCount)
}
diff --git a/ui/ui-framework/src/main/java/androidx/ui/core/Popup.kt b/ui/ui-framework/src/main/java/androidx/ui/core/Popup.kt
index f8416a8..c4daf21 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/core/Popup.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/core/Popup.kt
@@ -139,18 +139,20 @@
) {
val context = ContextAmbient.current
// TODO(b/139866476): Decide if we want to expose the AndroidComposeView
- val composeView = AndroidComposeViewAmbient.current
+ val owner = OwnerAmbient.current
val providedTestTag = PopupTestTagAmbient.current
val popupLayout = remember(popupProperties) {
- escapeCompose { PopupLayout(
- context = context,
- composeView = composeView,
- popupProperties = popupProperties,
- popupPositionProperties = popupPositionProperties,
- calculatePopupPosition = calculatePopupPosition,
- testTag = providedTestTag
- ) }
+ escapeCompose {
+ PopupLayout(
+ context = context,
+ composeView = owner as View,
+ popupProperties = popupProperties,
+ popupPositionProperties = popupPositionProperties,
+ calculatePopupPosition = calculatePopupPosition,
+ testTag = providedTestTag
+ )
+ }
}
popupLayout.calculatePopupPosition = calculatePopupPosition
@@ -291,7 +293,8 @@
*/
override fun onTouchEvent(event: MotionEvent?): Boolean {
if ((event?.action == MotionEvent.ACTION_DOWN) &&
- ((event.x < 0) || (event.x >= width) || (event.y < 0) || (event.y >= height))) {
+ ((event.x < 0) || (event.x >= width) || (event.y < 0) || (event.y >= height))
+ ) {
popupProperties.onDismissRequest?.invoke()
return true
@@ -452,7 +455,7 @@
fun disposeActivityComposition(activity: Activity) {
val composeView = activity.window.decorView
.findViewById<ViewGroup>(android.R.id.content)
- .getChildAt(0) as? AndroidComposeView
+ .getChildAt(0) as? Owner
?: error("No root view found")
@Suppress("DEPRECATION")
diff --git a/ui/ui-framework/src/main/java/androidx/ui/core/Wrapper.kt b/ui/ui-framework/src/main/java/androidx/ui/core/Wrapper.kt
index 9563a66..2118ecb 100644
--- a/ui/ui-framework/src/main/java/androidx/ui/core/Wrapper.kt
+++ b/ui/ui-framework/src/main/java/androidx/ui/core/Wrapper.kt
@@ -19,7 +19,6 @@
import android.app.Activity
import android.content.Context
import android.content.res.Configuration
-import android.util.SparseArray
import android.view.View
import android.view.ViewGroup
import android.widget.FrameLayout
@@ -33,13 +32,9 @@
import androidx.compose.CompositionReference
import androidx.compose.FrameManager
import androidx.compose.NeverEqual
-import androidx.compose.Observe
import androidx.compose.Providers
import androidx.compose.StructurallyEqual
-import androidx.compose.Untracked
import androidx.compose.ambientOf
-import androidx.compose.compositionReference
-import androidx.compose.onPreCommit
import androidx.compose.remember
import androidx.compose.state
import androidx.compose.staticAmbientOf
@@ -293,63 +288,6 @@
}
/**
- * Composes a view containing ui composables into a view composition.
- * <p>
- * This is supposed to be used only in view compositions. If compose ui is supposed to be the root of composition use
- * [Activity.setContent] or [ViewGroup.setContent] extensions.
- */
-@Composable
-fun ComposeView(children: @Composable() () -> Unit) {
- val rootRef = remember { Ref<AndroidComposeView>() }
-
- AndroidComposeView(ref = rootRef) {
- var reference: CompositionReference? = null
- var cc: Composition? = null
-
- // This is a temporary solution until we get proper subcomposition APIs in place.
- // Right now, we want to enforce a sort of "depth-first" ordering of recompositions,
- // even when they happen across composition contexts. When we do "subcomposition",
- // like we are doing here, that means for every invalidation of the child context, we
- // need to invalidate the scope of the parent reference, and wait for it to recompose
- // the child. The Observe is put in place here to ensure that the scope around the
- // reference we are using is as small as possible, and, in particular, does not include
- // the composition of `children()`. This means that we are using the nullability of `cc`
- // to determine if the ComposeWrapper in general is getting recomposed, or if its just
- // the invalidation scope of the Observe. If it's the latter, we just want to call
- // `cc.recomposeSync()` which will only recompose the invalidations in the child context,
- // which means it *will not* call `children()` again if it doesn't have to.
- Observe {
- mapOf(123 to 234)
- reference = compositionReference()
- cc?.recomposeSync()
- onPreCommit(true) {
- onDispose {
- cc?.dispose()
- }
- }
- }
- val view = rootRef.value ?: error("Failed to create root platform view")
- val rootLayoutNode = view.root
- val context = view.context
-
- // to not postpone the composition in this mode let's just pretend there is no state
- // restoring is going to happen and restore the empty state instead.
- view.restoreHierarchyState(SparseArray())
-
- // If this value is inlined where it is used, an error that includes 'Precise Reference:
- // kotlinx.coroutines.Dispatchers' not instance of 'Precise Reference: androidx.compose.Ambient'.
- val coroutineContext = Dispatchers.Main
- cc = subcomposeInto(
- container = rootLayoutNode,
- context = context,
- parent = reference
- ) @Untracked {
- WrapWithAmbients(rootRef.value!!, context, coroutineContext, children)
- }
- }
-}
-
-/**
* Composes the given composable into the given activity. The composable will become the root view
* of the given activity.
*
@@ -359,10 +297,14 @@
content: @Composable() () -> Unit
): Composition {
FrameManager.ensureStarted()
- val composeView = window.decorView
+ val composeView: Owner = window.decorView
.findViewById<ViewGroup>(android.R.id.content)
- .getChildAt(0) as? AndroidComposeView
- ?: AndroidComposeView(this).also { setContentView(it) }
+ .getChildAt(0) as? Owner
+ ?: createOwner(this).also {
+ if (it is ViewGroup) {
+ setContentView(it)
+ }
+ }
// TODO(lmr): setup lifecycle-based dispose since we have Activity here
@@ -425,17 +367,21 @@
content: @Composable() () -> Unit
): Composition {
val composeView =
- if (childCount > 0) { getChildAt(0) as? AndroidComposeView } else { removeAllViews(); null }
- ?: AndroidComposeView(context).also { addView(it) }
+ if (childCount > 0) {
+ getChildAt(0) as? Owner
+ } else {
+ removeAllViews(); null
+ }
+ ?: createOwner(context).also { if (it is ViewGroup) addView(it) }
return doSetContent(composeView, context, content)
}
-private fun createComposeViewComposition(composeView: AndroidComposeView): Composition {
- val composition = UiComposition(composeView.root, composeView.context, null)
- // we will postpone (disable) the composition until [AndroidComposeView] restores the state
- if (composeView.savedStateRegistry == null) {
+private fun createComposeViewComposition(owner: Owner, context: Context): Composition {
+ val composition = UiComposition(owner.root, context, null)
+ // we will postpone (disable) the composition until [Owner] restores the state
+ if (owner.savedStateRegistry == null) {
composition.enabled = false
- composeView.setOnSavedStateRegistryAvailable {
+ owner.setOnSavedStateRegistryAvailable {
composition.enabled = true
}
}
@@ -443,14 +389,14 @@
}
private fun doSetContent(
- composeView: AndroidComposeView,
+ owner: Owner,
context: Context,
content: @Composable() () -> Unit
): Composition {
- val composition = findComposition(composeView.root)
- ?: createComposeViewComposition(composeView)
+ val composition = findComposition(owner.root)
+ ?: createComposeViewComposition(owner, context)
composition.compose {
- WrapWithAmbients(composeView, context, Dispatchers.Main) {
+ WrapWithAmbients(owner, context, Dispatchers.Main) {
WrapWithSelectionContainer(content)
}
}
@@ -460,7 +406,7 @@
@SuppressLint("UnnecessaryLambdaCreation")
@Composable
private fun WrapWithAmbients(
- composeView: AndroidComposeView,
+ owner: Owner,
context: Context,
coroutineContext: CoroutineContext,
content: @Composable() () -> Unit
@@ -477,7 +423,7 @@
// context / themed activity, and may not actually reflect the system. So instead we
// use this hook to grab the applicationContext's configuration, which accurately
// reflects the state of the application / system.
- composeView.configurationChangeObserver = {
+ owner.configurationChangeObserver = {
configuration = context.applicationContext.resources.configuration
}
@@ -494,19 +440,19 @@
}
val rootAnimationClock = remember { rootAnimationClockFactory() }
- val savedStateRegistry = requireNotNull(composeView.savedStateRegistry)
+ val savedStateRegistry = requireNotNull(owner.savedStateRegistry)
Providers(
ContextAmbient provides context,
CoroutineContextAmbient provides coroutineContext,
DensityAmbient provides Density(context),
FocusManagerAmbient provides focusManager,
- TextInputServiceAmbient provides composeView.textInputService,
- FontLoaderAmbient provides composeView.fontLoader,
- HapticFeedBackAmbient provides composeView.hapticFeedBack,
- AutofillTreeAmbient provides composeView.autofillTree,
+ TextInputServiceAmbient provides owner.textInputService,
+ FontLoaderAmbient provides owner.fontLoader,
+ HapticFeedBackAmbient provides owner.hapticFeedBack,
+ AutofillTreeAmbient provides owner.autofillTree,
ConfigurationAmbient provides configuration,
- AndroidComposeViewAmbient provides composeView,
+ OwnerAmbient provides owner,
LayoutDirectionAmbient provides layoutDirection,
AnimationClockAmbient provides rootAnimationClock,
UiSavedStateRegistryAmbient provides savedStateRegistry,
@@ -522,8 +468,8 @@
val ConfigurationAmbient = ambientOf<Configuration>(NeverEqual)
-// TODO(b/139866476): The AndroidComposeView should not be exposed via ambient
-val AndroidComposeViewAmbient = staticAmbientOf<AndroidComposeView>()
+// TODO(b/139866476): The Owner should not be exposed via ambient
+val OwnerAmbient = staticAmbientOf<Owner>()
val AutofillAmbient = ambientOf<Autofill?>()
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/ConstraintLayoutTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/ConstraintLayoutTest.kt
index e4e0ea8..09ec400 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/ConstraintLayoutTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/ConstraintLayoutTest.kt
@@ -52,7 +52,7 @@
}
assertTrue(countDownLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
val rootWidth = root.width.ipx
val rootHeight = root.height.ipx
@@ -84,7 +84,7 @@
}
assertTrue(countDownLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
val rootWidth = root.width.ipx
val rootHeight = root.height.ipx
@@ -133,16 +133,19 @@
}
}
) {
- Stack(LayoutTag("box1") + LayoutSize(boxSize, boxSize) +
- saveLayoutInfo(size[0], position[0], countDownLatch)
+ Stack(
+ LayoutTag("box1") + LayoutSize(boxSize, boxSize) +
+ saveLayoutInfo(size[0], position[0], countDownLatch)
) {
}
- Stack(LayoutTag("box2") + LayoutSize(boxSize, boxSize) +
- saveLayoutInfo(size[1], position[1], countDownLatch)
+ Stack(
+ LayoutTag("box2") + LayoutSize(boxSize, boxSize) +
+ saveLayoutInfo(size[1], position[1], countDownLatch)
) {
}
- Stack(LayoutTag("box3") + LayoutSize(boxSize, boxSize) +
- saveLayoutInfo(size[2], position[2], countDownLatch)
+ Stack(
+ LayoutTag("box3") + LayoutSize(boxSize, boxSize) +
+ saveLayoutInfo(size[2], position[2], countDownLatch)
) {
}
}
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutAlignTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutAlignTest.kt
index c233d94..8151a2d 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutAlignTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutAlignTest.kt
@@ -82,7 +82,7 @@
}
assertTrue(positionedLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(IntPxSize(root.width.ipx, root.height.ipx), alignSize.value)
@@ -105,11 +105,13 @@
val childSize = Ref<IntPxSize>()
val childPosition = Ref<PxPosition>()
show {
- Container(saveLayoutInfo(
- size = alignSize,
- position = alignPosition,
- positionedLatch = positionedLatch
- )) {
+ Container(
+ saveLayoutInfo(
+ size = alignSize,
+ position = alignPosition,
+ positionedLatch = positionedLatch
+ )
+ ) {
Container(
LayoutSize.Fill + LayoutAlign.BottomEnd + LayoutSize(sizeDp, sizeDp) +
@@ -124,7 +126,7 @@
}
assertTrue(positionedLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(IntPxSize(root.width.ipx, root.height.ipx), alignSize.value)
@@ -147,25 +149,27 @@
val childSize = Ref<IntPxSize>()
val childPosition = Ref<PxPosition>()
show {
- Container(saveLayoutInfo(
+ Container(
+ saveLayoutInfo(
size = alignSize,
position = alignPosition,
positionedLatch = positionedLatch
)
) {
- Container(LayoutSize.Fill + LayoutAlign.End + LayoutWidth(sizeDp) +
- saveLayoutInfo(
- size = childSize,
- position = childPosition,
- positionedLatch = positionedLatch
- )
+ Container(
+ LayoutSize.Fill + LayoutAlign.End + LayoutWidth(sizeDp) +
+ saveLayoutInfo(
+ size = childSize,
+ position = childPosition,
+ positionedLatch = positionedLatch
+ )
) {
}
}
}
assertTrue(positionedLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(IntPxSize(root.width.ipx, root.height.ipx), alignSize.value)
@@ -184,41 +188,44 @@
val childPosition = Array(3) { Ref<PxPosition>() }
show {
Stack(LayoutDirectionModifier.Rtl) {
- Stack(LayoutSize.Fill + LayoutAlign.TopStart) {
- Stack(LayoutSize(sizeDp, sizeDp) +
- saveLayoutInfo(
- size = childSize[0],
- position = childPosition[0],
- positionedLatch = positionedLatch
- )
- ) {
- }
- }
- Stack(LayoutSize.Fill + LayoutAlign.CenterVertically) {
- Stack(LayoutSize(sizeDp, sizeDp) +
- saveLayoutInfo(
- size = childSize[1],
- position = childPosition[1],
- positionedLatch = positionedLatch
- )
- ) {
- }
- }
- Stack(LayoutSize.Fill + LayoutAlign.BottomEnd) {
- Stack(LayoutSize(sizeDp, sizeDp) +
- saveLayoutInfo(
- size = childSize[2],
- position = childPosition[2],
- positionedLatch = positionedLatch
- )
- ) {
- }
+ Stack(LayoutSize.Fill + LayoutAlign.TopStart) {
+ Stack(
+ LayoutSize(sizeDp, sizeDp) +
+ saveLayoutInfo(
+ size = childSize[0],
+ position = childPosition[0],
+ positionedLatch = positionedLatch
+ )
+ ) {
}
}
+ Stack(LayoutSize.Fill + LayoutAlign.CenterVertically) {
+ Stack(
+ LayoutSize(sizeDp, sizeDp) +
+ saveLayoutInfo(
+ size = childSize[1],
+ position = childPosition[1],
+ positionedLatch = positionedLatch
+ )
+ ) {
+ }
+ }
+ Stack(LayoutSize.Fill + LayoutAlign.BottomEnd) {
+ Stack(
+ LayoutSize(sizeDp, sizeDp) +
+ saveLayoutInfo(
+ size = childSize[2],
+ position = childPosition[2],
+ positionedLatch = positionedLatch
+ )
+ ) {
+ }
+ }
+ }
}
assertTrue(positionedLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(
@@ -265,14 +272,16 @@
show {
Layout(
children = {
- Align(alignment = Alignment.BottomEnd,
+ Align(
+ alignment = Alignment.BottomEnd,
modifier = saveLayoutInfo(
size = alignSize,
position = alignPosition,
positionedLatch = positionedLatch
)
) {
- Container(width = sizeDp, height = sizeDp,
+ Container(
+ width = sizeDp, height = sizeDp,
modifier = saveLayoutInfo(
size = childSize,
position = childPosition,
@@ -292,7 +301,7 @@
}
assertTrue(positionedLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(IntPxSize(size, size), alignSize.value)
@@ -316,18 +325,20 @@
show {
Layout(
children = {
- Container(saveLayoutInfo(
+ Container(
+ saveLayoutInfo(
size = alignSize,
position = alignPosition,
positionedLatch = positionedLatch
)
) {
- Container(LayoutAlign.BottomEnd + LayoutSize(sizeDp, sizeDp) +
- saveLayoutInfo(
- size = childSize,
- position = childPosition,
- positionedLatch = positionedLatch
- )
+ Container(
+ LayoutAlign.BottomEnd + LayoutSize(sizeDp, sizeDp) +
+ saveLayoutInfo(
+ size = childSize,
+ position = childPosition,
+ positionedLatch = positionedLatch
+ )
) {
}
}
@@ -342,7 +353,7 @@
}
assertTrue(positionedLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(IntPxSize(size, size), alignSize.value)
@@ -370,12 +381,13 @@
positionedLatch.countDown()
},
children = {
- Container(LayoutAlign.Center + LayoutSize(sizeDp, sizeDp) +
- saveLayoutInfo(
- size = childSize,
- position = childPosition,
- positionedLatch = positionedLatch
- )
+ Container(
+ LayoutAlign.Center + LayoutSize(sizeDp, sizeDp) +
+ saveLayoutInfo(
+ size = childSize,
+ position = childPosition,
+ positionedLatch = positionedLatch
+ )
) {
}
},
@@ -547,14 +559,16 @@
Layout(
children = {
Container(width = parentSize, height = parentSize) {
- Align(alignment = Alignment.BottomEnd,
+ Align(
+ alignment = Alignment.BottomEnd,
modifier = saveLayoutInfo(
size = alignSize,
position = alignPosition,
positionedLatch = positionedLatch
)
) {
- Container(width = childSizeDp, height = childSizeDp,
+ Container(
+ width = childSizeDp, height = childSizeDp,
modifier = saveLayoutInfo(
size = childSize,
position = childPosition,
@@ -574,7 +588,7 @@
}
assertTrue(positionedLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(IntPxSize(childSizeIpx, childSizeIpx), childSize.value)
@@ -607,20 +621,22 @@
show {
Layout(
children = {
- Container(LayoutSize(parentSize, parentSize) +
- saveLayoutInfo(
- size = alignSize,
- position = alignPosition,
- positionedLatch = positionedLatch
- )
+ Container(
+ LayoutSize(parentSize, parentSize) +
+ saveLayoutInfo(
+ size = alignSize,
+ position = alignPosition,
+ positionedLatch = positionedLatch
+ )
) {
- Container(LayoutSize.Fill + LayoutAlign.BottomEnd +
- LayoutSize(childSizeDp, childSizeDp) +
- saveLayoutInfo(
- size = childSize,
- position = childPosition,
- positionedLatch = positionedLatch
- )
+ Container(
+ LayoutSize.Fill + LayoutAlign.BottomEnd +
+ LayoutSize(childSizeDp, childSizeDp) +
+ saveLayoutInfo(
+ size = childSize,
+ position = childPosition,
+ positionedLatch = positionedLatch
+ )
) {
}
}
@@ -634,7 +650,7 @@
}
positionedLatch.await(1, TimeUnit.SECONDS)
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(IntPxSize(childSizeIpx, childSizeIpx), childSize.value)
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutPaddingTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutPaddingTest.kt
index 4b61a56..f92154d 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutPaddingTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutPaddingTest.kt
@@ -255,7 +255,7 @@
}
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
val rootWidth = root.width.ipx
@@ -308,7 +308,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
val innerSize = (size - paddingPx * 2)
@@ -355,7 +355,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
val paddingLeft = left.toIntPx()
@@ -407,7 +407,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(IntPxSize(0.ipx, 0.ipx), childSize)
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutTest.kt
index 024a92b..6625c90 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/LayoutTest.kt
@@ -25,11 +25,11 @@
import androidx.test.rule.ActivityTestRule
import androidx.ui.core.Alignment
import androidx.ui.core.AlignmentLine
-import androidx.ui.core.AndroidComposeView
import androidx.ui.core.Constraints
import androidx.ui.core.Layout
import androidx.ui.core.LayoutDirection
import androidx.ui.core.Modifier
+import androidx.ui.core.Owner
import androidx.ui.core.Placeable
import androidx.ui.core.Ref
import androidx.ui.core.enforce
@@ -98,24 +98,24 @@
activityTestRule.runOnUiThread(runnable)
}
- internal fun findAndroidComposeView(): AndroidComposeView {
- return findAndroidComposeView(activity)
+ internal fun findOwnerView(): View {
+ return findOwner(activity) as View
}
- internal fun findAndroidComposeView(activity: Activity): AndroidComposeView {
+ internal fun findOwner(activity: Activity): Owner {
val contentViewGroup = activity.findViewById<ViewGroup>(android.R.id.content)
- return findAndroidComposeView(contentViewGroup)!!
+ return findOwner(contentViewGroup)!!
}
- internal fun findAndroidComposeView(parent: ViewGroup): AndroidComposeView? {
+ internal fun findOwner(parent: ViewGroup): Owner? {
for (index in 0 until parent.childCount) {
val child = parent.getChildAt(index)
- if (child is AndroidComposeView) {
+ if (child is Owner) {
return child
} else if (child is ViewGroup) {
- val composeView = findAndroidComposeView(child)
- if (composeView != null) {
- return composeView
+ val owner = findOwner(child)
+ if (owner != null) {
+ return owner
}
}
}
diff --git a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/RowColumnTest.kt b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/RowColumnTest.kt
index 3ba122f..ab06257 100644
--- a/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/RowColumnTest.kt
+++ b/ui/ui-layout/src/androidTest/java/androidx/ui/layout/test/RowColumnTest.kt
@@ -109,7 +109,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(IntPxSize(size, size), childSize[0])
@@ -151,7 +151,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
val rootWidth = root.width.px
@@ -188,7 +188,7 @@
},
width = width,
height = height
- ) {
+ ) {
}
Container(
@@ -199,14 +199,14 @@
},
width = width,
height = height * 2
- ) {
+ ) {
}
}
}
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(IntPxSize(childrenWidth, childrenHeight), childSize[0])
@@ -251,7 +251,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(IntPxSize(size, size), childSize[0])
@@ -301,7 +301,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
val rootHeight = root.height.px
@@ -353,7 +353,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(IntPxSize(childrenWidth, childrenHeight), childSize[0])
@@ -586,7 +586,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(IntPxSize(size, root.height.ipx), childSize[0])
@@ -644,7 +644,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
val rootHeight = root.height.px
@@ -719,8 +719,8 @@
childSize[3] = coordinates.size
childPosition[3] = coordinates.globalPosition
drawLatch.countDown()
- }
- ) {
+ }
+ ) {
}
}
}
@@ -788,7 +788,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(IntPxSize(root.width.ipx, size), childSize[0])
@@ -839,14 +839,14 @@
childPosition[2] = coordinates.globalPosition
drawLatch.countDown()
}
- ) {
+ ) {
}
}
}
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
val rootWidth = root.width.px
@@ -967,7 +967,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(
@@ -995,7 +995,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(
@@ -1032,7 +1032,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(
@@ -1060,7 +1060,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(
@@ -1088,7 +1088,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(
@@ -1119,7 +1119,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(
@@ -1159,7 +1159,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(
@@ -1190,7 +1190,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(
@@ -1221,7 +1221,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(
@@ -1252,7 +1252,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(
@@ -1298,7 +1298,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(
@@ -1414,7 +1414,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(
@@ -1442,7 +1442,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(
@@ -1479,7 +1479,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(
@@ -1507,7 +1507,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(
@@ -1535,7 +1535,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(
@@ -1566,7 +1566,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(
@@ -1606,7 +1606,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(
@@ -1637,7 +1637,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(
@@ -1668,7 +1668,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(
@@ -1699,7 +1699,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(
@@ -1741,7 +1741,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(
@@ -1873,7 +1873,7 @@
calculateChildPositions(childPosition, parentLayoutCoordinates, childLayoutCoordinates)
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(PxPosition(0.px, 0.px), childPosition[0])
@@ -1916,7 +1916,7 @@
calculateChildPositions(childPosition, parentLayoutCoordinates, childLayoutCoordinates)
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(PxPosition(root.width.px - size.toPx() * 3, 0.px), childPosition[0])
@@ -1959,7 +1959,7 @@
calculateChildPositions(childPosition, parentLayoutCoordinates, childLayoutCoordinates)
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
val extraSpace = root.width.px.round() - size * 3
@@ -2003,7 +2003,7 @@
calculateChildPositions(childPosition, parentLayoutCoordinates, childLayoutCoordinates)
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
val gap = (root.width.px - size.toPx() * 3) / 4
@@ -2047,7 +2047,7 @@
calculateChildPositions(childPosition, parentLayoutCoordinates, childLayoutCoordinates)
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
val gap = (root.width.px - size.toPx() * 3) / 2
@@ -2094,7 +2094,7 @@
calculateChildPositions(childPosition, parentLayoutCoordinates, childLayoutCoordinates)
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
val gap = (root.width.px.round() - size * 3) / 3
@@ -2138,7 +2138,7 @@
calculateChildPositions(childPosition, parentLayoutCoordinates, childLayoutCoordinates)
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
val step = (root.width.px - size.toPx() * 3) / 3
@@ -2187,7 +2187,7 @@
calculateChildPositions(childPosition, parentLayoutCoordinates, childLayoutCoordinates)
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(PxPosition(0.px, 0.px), childPosition[0])
@@ -2230,7 +2230,7 @@
calculateChildPositions(childPosition, parentLayoutCoordinates, childLayoutCoordinates)
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(PxPosition(0.px, root.height.px - size.toPx() * 3), childPosition[0])
@@ -2273,7 +2273,7 @@
calculateChildPositions(childPosition, parentLayoutCoordinates, childLayoutCoordinates)
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
val extraSpace = root.height.px.round() - size * 3
@@ -2317,7 +2317,7 @@
calculateChildPositions(childPosition, parentLayoutCoordinates, childLayoutCoordinates)
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
val gap = (root.height.px - size.toPx() * 3) / 4
@@ -2372,7 +2372,7 @@
calculateChildPositions(childPosition, parentLayoutCoordinates, childLayoutCoordinates)
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
val gap = (root.height.px - size.toPx() * 3) / 2
@@ -2416,7 +2416,7 @@
calculateChildPositions(childPosition, parentLayoutCoordinates, childLayoutCoordinates)
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
val gap = (root.height.px - size.toPx() * 3) / 3
@@ -2466,7 +2466,7 @@
calculateChildPositions(childPosition, parentLayoutCoordinates, childLayoutCoordinates)
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
val step = (root.height.px - size.toPx() * 3) / 3
@@ -3169,7 +3169,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
val rootWidth = root.width.px
@@ -3244,7 +3244,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
assertEquals(PxPosition((sizeDp.toPx() * 2).round().toPx(), 0.px), childPosition[0])
@@ -3277,7 +3277,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
val rootWidth = root.width.px
@@ -3307,11 +3307,11 @@
Container(
LayoutSize(sizeDp * 2, sizeDp * 2) + LayoutGravity.End +
- onPositioned { coordinates ->
- childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
- drawLatch.countDown()
- }
- ) {
+ onPositioned { coordinates ->
+ childPosition[1] = coordinates.localToGlobal(PxPosition(0.px, 0.px))
+ drawLatch.countDown()
+ }
+ ) {
}
}
}
@@ -3352,7 +3352,7 @@
}
assertTrue(drawLatch.await(1, TimeUnit.SECONDS))
- val root = findAndroidComposeView()
+ val root = findOwnerView()
waitForDraw(root)
val rootWidth = root.width.px
diff --git a/ui/ui-platform/api/0.1.0-dev07.txt b/ui/ui-platform/api/0.1.0-dev07.txt
index e944f80..868d3b2 100644
--- a/ui/ui-platform/api/0.1.0-dev07.txt
+++ b/ui/ui-platform/api/0.1.0-dev07.txt
@@ -11,73 +11,15 @@
package androidx.ui.core {
- public final class AndroidComposeView extends android.view.ViewGroup implements androidx.ui.core.AndroidOwner androidx.ui.core.SemanticsTreeProvider {
- ctor public AndroidComposeView(android.content.Context context);
- method public void addAndroidView(android.view.View view, androidx.ui.core.LayoutNode layoutNode);
- method public androidx.ui.unit.IntPxPosition calculatePosition();
- method public void callDraw(androidx.ui.graphics.Canvas canvas, androidx.ui.core.ComponentNode node, androidx.ui.unit.PxSize parentSize);
- method public androidx.ui.core.OwnedLayer createLayer(androidx.ui.core.DrawLayerModifier drawLayerModifier, kotlin.jvm.functions.Function2<? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.Density,kotlin.Unit> drawBlock);
- method public java.util.List<androidx.ui.core.semantics.SemanticsNode> getAllSemanticNodes();
- method public androidx.ui.autofill.Autofill? getAutofill();
- method public androidx.ui.autofill.AutofillTree getAutofillTree();
- method public kotlin.jvm.functions.Function0<kotlin.Unit> getConfigurationChangeObserver();
- method public androidx.ui.core.Constraints getConstraints();
- method public androidx.ui.unit.Density getDensity();
- method public androidx.ui.text.font.Font.ResourceLoader getFontLoader();
- method public androidx.ui.core.hapticfeedback.HapticFeedback getHapticFeedBack();
- method public long getMeasureIteration();
- method public androidx.ui.core.Ref<androidx.ui.core.AndroidComposeView>? getRef();
- method public androidx.ui.core.LayoutNode getRoot();
- method public androidx.ui.savedinstancestate.UiSavedStateRegistry? getSavedStateRegistry();
- method public androidx.ui.core.semantics.SemanticsOwner getSemanticsOwner();
- method public boolean getShowLayoutBounds();
- method public androidx.ui.input.TextInputService getTextInputService();
- method public void measureAndLayout();
- method public void observeLayerModelReads(androidx.ui.core.OwnedLayer layer, kotlin.jvm.functions.Function0<kotlin.Unit> block);
- method public void observeLayoutModelReads(androidx.ui.core.LayoutNode node, kotlin.jvm.functions.Function0<kotlin.Unit> block);
- method public void observeMeasureModelReads(androidx.ui.core.LayoutNode node, kotlin.jvm.functions.Function0<kotlin.Unit> block);
- method public void onAttach(androidx.ui.core.ComponentNode node);
- method public void onDetach(androidx.ui.core.ComponentNode node);
- method public void onInvalidate(androidx.ui.core.DrawNode drawNode);
- method public void onInvalidate(androidx.ui.core.LayoutNode layoutNode);
- method public void onPositionChange(androidx.ui.core.LayoutNode layoutNode);
- method public void onRequestMeasure(androidx.ui.core.LayoutNode layoutNode);
- method public void onSizeChange(androidx.ui.core.LayoutNode layoutNode);
- method public void pauseModelReadObserveration(kotlin.jvm.functions.Function0<kotlin.Unit> block);
- method public void removeAndroidView(android.view.View view);
- method public void sendEvent(android.view.MotionEvent event);
- method public void setConfigurationChangeObserver(kotlin.jvm.functions.Function0<kotlin.Unit> p);
- method public void setConstraints(androidx.ui.core.Constraints p);
- method public void setOnSavedStateRegistryAvailable(kotlin.jvm.functions.Function1<? super androidx.ui.savedinstancestate.UiSavedStateRegistry,kotlin.Unit> callback);
- method public void setRef(androidx.ui.core.Ref<androidx.ui.core.AndroidComposeView>? value);
- property public final androidx.ui.autofill.Autofill? autofill;
- property public final androidx.ui.autofill.AutofillTree autofillTree;
- property public final kotlin.jvm.functions.Function0<kotlin.Unit> configurationChangeObserver;
- property public final androidx.ui.core.Constraints constraints;
- property public androidx.ui.unit.Density density;
- property public final androidx.ui.text.font.Font.ResourceLoader fontLoader;
- property public final androidx.ui.core.hapticfeedback.HapticFeedback hapticFeedBack;
- property public long measureIteration;
- property public final androidx.ui.core.Ref<androidx.ui.core.AndroidComposeView>? ref;
- property public final androidx.ui.core.LayoutNode root;
- property public final androidx.ui.savedinstancestate.UiSavedStateRegistry? savedStateRegistry;
- property public androidx.ui.core.semantics.SemanticsOwner semanticsOwner;
- property public boolean showLayoutBounds;
- property public final androidx.ui.input.TextInputService textInputService;
- field public static final androidx.ui.core.AndroidComposeView.Companion! Companion;
- }
-
- public static final class AndroidComposeView.Companion {
- method public boolean getEnableExtraAssertions();
- method public void setEnableExtraAssertions(boolean p);
- property public final boolean enableExtraAssertions;
- }
-
public interface AndroidOwner extends androidx.ui.core.Owner {
method public void addAndroidView(android.view.View view, androidx.ui.core.LayoutNode layoutNode);
method public void removeAndroidView(android.view.View view);
}
+ public final class AndroidOwnerKt {
+ method public static androidx.ui.core.Owner createOwner(android.content.Context context);
+ }
+
public abstract sealed class ComponentNode {
method public void attach(androidx.ui.core.Owner owner);
method public void detach();
@@ -283,10 +225,18 @@
method public androidx.ui.unit.IntPxPosition calculatePosition();
method public void callDraw(androidx.ui.graphics.Canvas canvas, androidx.ui.core.ComponentNode node, androidx.ui.unit.PxSize parentSize);
method public androidx.ui.core.OwnedLayer createLayer(androidx.ui.core.DrawLayerModifier drawLayerModifier, kotlin.jvm.functions.Function2<? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.Density,kotlin.Unit> drawBlock);
+ method public androidx.ui.autofill.Autofill? getAutofill();
+ method public androidx.ui.autofill.AutofillTree getAutofillTree();
+ method public kotlin.jvm.functions.Function0<kotlin.Unit> getConfigurationChangeObserver();
method public androidx.ui.unit.Density getDensity();
+ method public androidx.ui.text.font.Font.ResourceLoader getFontLoader();
+ method public androidx.ui.core.hapticfeedback.HapticFeedback getHapticFeedBack();
method public long getMeasureIteration();
+ method public androidx.ui.core.LayoutNode getRoot();
+ method public androidx.ui.savedinstancestate.UiSavedStateRegistry? getSavedStateRegistry();
method public androidx.ui.core.semantics.SemanticsOwner getSemanticsOwner();
method public boolean getShowLayoutBounds();
+ method public androidx.ui.input.TextInputService getTextInputService();
method public void measureAndLayout();
method public void observeLayoutModelReads(androidx.ui.core.LayoutNode node, kotlin.jvm.functions.Function0<kotlin.Unit> block);
method public void observeMeasureModelReads(androidx.ui.core.LayoutNode node, kotlin.jvm.functions.Function0<kotlin.Unit> block);
@@ -299,10 +249,27 @@
method public void onSizeChange(androidx.ui.core.LayoutNode layoutNode);
method public void pauseModelReadObserveration(kotlin.jvm.functions.Function0<kotlin.Unit> block);
method public boolean requestFocus();
+ method public void setConfigurationChangeObserver(kotlin.jvm.functions.Function0<kotlin.Unit> p);
+ method public void setOnSavedStateRegistryAvailable(kotlin.jvm.functions.Function1<? super androidx.ui.savedinstancestate.UiSavedStateRegistry,kotlin.Unit> callback);
+ property public abstract androidx.ui.autofill.Autofill? autofill;
+ property public abstract androidx.ui.autofill.AutofillTree autofillTree;
+ property public abstract kotlin.jvm.functions.Function0<kotlin.Unit> configurationChangeObserver;
property public abstract androidx.ui.unit.Density density;
+ property public abstract androidx.ui.text.font.Font.ResourceLoader fontLoader;
+ property public abstract androidx.ui.core.hapticfeedback.HapticFeedback hapticFeedBack;
property public abstract long measureIteration;
+ property public abstract androidx.ui.core.LayoutNode root;
+ property public abstract androidx.ui.savedinstancestate.UiSavedStateRegistry? savedStateRegistry;
property public abstract androidx.ui.core.semantics.SemanticsOwner semanticsOwner;
property public abstract boolean showLayoutBounds;
+ property public abstract androidx.ui.input.TextInputService textInputService;
+ field public static final androidx.ui.core.Owner.Companion! Companion;
+ }
+
+ public static final class Owner.Companion {
+ method public boolean getEnableExtraAssertions();
+ method public void setEnableExtraAssertions(boolean p);
+ property public final boolean enableExtraAssertions;
}
public final class PointerInputNode extends androidx.ui.core.ComponentNode {
diff --git a/ui/ui-platform/api/current.txt b/ui/ui-platform/api/current.txt
index e944f80..868d3b2 100644
--- a/ui/ui-platform/api/current.txt
+++ b/ui/ui-platform/api/current.txt
@@ -11,73 +11,15 @@
package androidx.ui.core {
- public final class AndroidComposeView extends android.view.ViewGroup implements androidx.ui.core.AndroidOwner androidx.ui.core.SemanticsTreeProvider {
- ctor public AndroidComposeView(android.content.Context context);
- method public void addAndroidView(android.view.View view, androidx.ui.core.LayoutNode layoutNode);
- method public androidx.ui.unit.IntPxPosition calculatePosition();
- method public void callDraw(androidx.ui.graphics.Canvas canvas, androidx.ui.core.ComponentNode node, androidx.ui.unit.PxSize parentSize);
- method public androidx.ui.core.OwnedLayer createLayer(androidx.ui.core.DrawLayerModifier drawLayerModifier, kotlin.jvm.functions.Function2<? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.Density,kotlin.Unit> drawBlock);
- method public java.util.List<androidx.ui.core.semantics.SemanticsNode> getAllSemanticNodes();
- method public androidx.ui.autofill.Autofill? getAutofill();
- method public androidx.ui.autofill.AutofillTree getAutofillTree();
- method public kotlin.jvm.functions.Function0<kotlin.Unit> getConfigurationChangeObserver();
- method public androidx.ui.core.Constraints getConstraints();
- method public androidx.ui.unit.Density getDensity();
- method public androidx.ui.text.font.Font.ResourceLoader getFontLoader();
- method public androidx.ui.core.hapticfeedback.HapticFeedback getHapticFeedBack();
- method public long getMeasureIteration();
- method public androidx.ui.core.Ref<androidx.ui.core.AndroidComposeView>? getRef();
- method public androidx.ui.core.LayoutNode getRoot();
- method public androidx.ui.savedinstancestate.UiSavedStateRegistry? getSavedStateRegistry();
- method public androidx.ui.core.semantics.SemanticsOwner getSemanticsOwner();
- method public boolean getShowLayoutBounds();
- method public androidx.ui.input.TextInputService getTextInputService();
- method public void measureAndLayout();
- method public void observeLayerModelReads(androidx.ui.core.OwnedLayer layer, kotlin.jvm.functions.Function0<kotlin.Unit> block);
- method public void observeLayoutModelReads(androidx.ui.core.LayoutNode node, kotlin.jvm.functions.Function0<kotlin.Unit> block);
- method public void observeMeasureModelReads(androidx.ui.core.LayoutNode node, kotlin.jvm.functions.Function0<kotlin.Unit> block);
- method public void onAttach(androidx.ui.core.ComponentNode node);
- method public void onDetach(androidx.ui.core.ComponentNode node);
- method public void onInvalidate(androidx.ui.core.DrawNode drawNode);
- method public void onInvalidate(androidx.ui.core.LayoutNode layoutNode);
- method public void onPositionChange(androidx.ui.core.LayoutNode layoutNode);
- method public void onRequestMeasure(androidx.ui.core.LayoutNode layoutNode);
- method public void onSizeChange(androidx.ui.core.LayoutNode layoutNode);
- method public void pauseModelReadObserveration(kotlin.jvm.functions.Function0<kotlin.Unit> block);
- method public void removeAndroidView(android.view.View view);
- method public void sendEvent(android.view.MotionEvent event);
- method public void setConfigurationChangeObserver(kotlin.jvm.functions.Function0<kotlin.Unit> p);
- method public void setConstraints(androidx.ui.core.Constraints p);
- method public void setOnSavedStateRegistryAvailable(kotlin.jvm.functions.Function1<? super androidx.ui.savedinstancestate.UiSavedStateRegistry,kotlin.Unit> callback);
- method public void setRef(androidx.ui.core.Ref<androidx.ui.core.AndroidComposeView>? value);
- property public final androidx.ui.autofill.Autofill? autofill;
- property public final androidx.ui.autofill.AutofillTree autofillTree;
- property public final kotlin.jvm.functions.Function0<kotlin.Unit> configurationChangeObserver;
- property public final androidx.ui.core.Constraints constraints;
- property public androidx.ui.unit.Density density;
- property public final androidx.ui.text.font.Font.ResourceLoader fontLoader;
- property public final androidx.ui.core.hapticfeedback.HapticFeedback hapticFeedBack;
- property public long measureIteration;
- property public final androidx.ui.core.Ref<androidx.ui.core.AndroidComposeView>? ref;
- property public final androidx.ui.core.LayoutNode root;
- property public final androidx.ui.savedinstancestate.UiSavedStateRegistry? savedStateRegistry;
- property public androidx.ui.core.semantics.SemanticsOwner semanticsOwner;
- property public boolean showLayoutBounds;
- property public final androidx.ui.input.TextInputService textInputService;
- field public static final androidx.ui.core.AndroidComposeView.Companion! Companion;
- }
-
- public static final class AndroidComposeView.Companion {
- method public boolean getEnableExtraAssertions();
- method public void setEnableExtraAssertions(boolean p);
- property public final boolean enableExtraAssertions;
- }
-
public interface AndroidOwner extends androidx.ui.core.Owner {
method public void addAndroidView(android.view.View view, androidx.ui.core.LayoutNode layoutNode);
method public void removeAndroidView(android.view.View view);
}
+ public final class AndroidOwnerKt {
+ method public static androidx.ui.core.Owner createOwner(android.content.Context context);
+ }
+
public abstract sealed class ComponentNode {
method public void attach(androidx.ui.core.Owner owner);
method public void detach();
@@ -283,10 +225,18 @@
method public androidx.ui.unit.IntPxPosition calculatePosition();
method public void callDraw(androidx.ui.graphics.Canvas canvas, androidx.ui.core.ComponentNode node, androidx.ui.unit.PxSize parentSize);
method public androidx.ui.core.OwnedLayer createLayer(androidx.ui.core.DrawLayerModifier drawLayerModifier, kotlin.jvm.functions.Function2<? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.Density,kotlin.Unit> drawBlock);
+ method public androidx.ui.autofill.Autofill? getAutofill();
+ method public androidx.ui.autofill.AutofillTree getAutofillTree();
+ method public kotlin.jvm.functions.Function0<kotlin.Unit> getConfigurationChangeObserver();
method public androidx.ui.unit.Density getDensity();
+ method public androidx.ui.text.font.Font.ResourceLoader getFontLoader();
+ method public androidx.ui.core.hapticfeedback.HapticFeedback getHapticFeedBack();
method public long getMeasureIteration();
+ method public androidx.ui.core.LayoutNode getRoot();
+ method public androidx.ui.savedinstancestate.UiSavedStateRegistry? getSavedStateRegistry();
method public androidx.ui.core.semantics.SemanticsOwner getSemanticsOwner();
method public boolean getShowLayoutBounds();
+ method public androidx.ui.input.TextInputService getTextInputService();
method public void measureAndLayout();
method public void observeLayoutModelReads(androidx.ui.core.LayoutNode node, kotlin.jvm.functions.Function0<kotlin.Unit> block);
method public void observeMeasureModelReads(androidx.ui.core.LayoutNode node, kotlin.jvm.functions.Function0<kotlin.Unit> block);
@@ -299,10 +249,27 @@
method public void onSizeChange(androidx.ui.core.LayoutNode layoutNode);
method public void pauseModelReadObserveration(kotlin.jvm.functions.Function0<kotlin.Unit> block);
method public boolean requestFocus();
+ method public void setConfigurationChangeObserver(kotlin.jvm.functions.Function0<kotlin.Unit> p);
+ method public void setOnSavedStateRegistryAvailable(kotlin.jvm.functions.Function1<? super androidx.ui.savedinstancestate.UiSavedStateRegistry,kotlin.Unit> callback);
+ property public abstract androidx.ui.autofill.Autofill? autofill;
+ property public abstract androidx.ui.autofill.AutofillTree autofillTree;
+ property public abstract kotlin.jvm.functions.Function0<kotlin.Unit> configurationChangeObserver;
property public abstract androidx.ui.unit.Density density;
+ property public abstract androidx.ui.text.font.Font.ResourceLoader fontLoader;
+ property public abstract androidx.ui.core.hapticfeedback.HapticFeedback hapticFeedBack;
property public abstract long measureIteration;
+ property public abstract androidx.ui.core.LayoutNode root;
+ property public abstract androidx.ui.savedinstancestate.UiSavedStateRegistry? savedStateRegistry;
property public abstract androidx.ui.core.semantics.SemanticsOwner semanticsOwner;
property public abstract boolean showLayoutBounds;
+ property public abstract androidx.ui.input.TextInputService textInputService;
+ field public static final androidx.ui.core.Owner.Companion! Companion;
+ }
+
+ public static final class Owner.Companion {
+ method public boolean getEnableExtraAssertions();
+ method public void setEnableExtraAssertions(boolean p);
+ property public final boolean enableExtraAssertions;
}
public final class PointerInputNode extends androidx.ui.core.ComponentNode {
diff --git a/ui/ui-platform/api/public_plus_experimental_0.1.0-dev07.txt b/ui/ui-platform/api/public_plus_experimental_0.1.0-dev07.txt
index fe04e6f..6199e06 100644
--- a/ui/ui-platform/api/public_plus_experimental_0.1.0-dev07.txt
+++ b/ui/ui-platform/api/public_plus_experimental_0.1.0-dev07.txt
@@ -11,74 +11,15 @@
package androidx.ui.core {
- public final class AndroidComposeView extends android.view.ViewGroup implements androidx.ui.core.AndroidOwner androidx.ui.core.SemanticsTreeProvider {
- ctor public AndroidComposeView(android.content.Context context);
- method public void addAndroidView(android.view.View view, androidx.ui.core.LayoutNode layoutNode);
- method public androidx.ui.unit.IntPxPosition calculatePosition();
- method public void callDraw(androidx.ui.graphics.Canvas canvas, androidx.ui.core.ComponentNode node, androidx.ui.unit.PxSize parentSize);
- method public androidx.ui.core.OwnedLayer createLayer(androidx.ui.core.DrawLayerModifier drawLayerModifier, kotlin.jvm.functions.Function2<? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.Density,kotlin.Unit> drawBlock);
- method public java.util.List<androidx.ui.core.semantics.SemanticsNode> getAllSemanticNodes();
- method public androidx.ui.autofill.Autofill? getAutofill();
- method public androidx.ui.autofill.AutofillTree getAutofillTree();
- method public kotlin.jvm.functions.Function0<kotlin.Unit> getConfigurationChangeObserver();
- method public androidx.ui.core.Constraints getConstraints();
- method public androidx.ui.unit.Density getDensity();
- method public androidx.ui.text.font.Font.ResourceLoader getFontLoader();
- method public androidx.ui.core.hapticfeedback.HapticFeedback getHapticFeedBack();
- method public long getMeasureIteration();
- method public androidx.ui.core.Ref<androidx.ui.core.AndroidComposeView>? getRef();
- method public androidx.ui.core.LayoutNode getRoot();
- method public androidx.ui.savedinstancestate.UiSavedStateRegistry? getSavedStateRegistry();
- method public androidx.ui.core.semantics.SemanticsOwner getSemanticsOwner();
- method public boolean getShowLayoutBounds();
- method public androidx.ui.input.TextInputService getTextInputService();
- method public void measureAndLayout();
- method public void observeLayerModelReads(androidx.ui.core.OwnedLayer layer, kotlin.jvm.functions.Function0<kotlin.Unit> block);
- method public void observeLayoutModelReads(androidx.ui.core.LayoutNode node, kotlin.jvm.functions.Function0<kotlin.Unit> block);
- method public void observeMeasureModelReads(androidx.ui.core.LayoutNode node, kotlin.jvm.functions.Function0<kotlin.Unit> block);
- method public void onAttach(androidx.ui.core.ComponentNode node);
- method public void onDetach(androidx.ui.core.ComponentNode node);
- method public void onInvalidate(androidx.ui.core.DrawNode drawNode);
- method public void onInvalidate(androidx.ui.core.LayoutNode layoutNode);
- method public void onPositionChange(androidx.ui.core.LayoutNode layoutNode);
- method public void onRequestMeasure(androidx.ui.core.LayoutNode layoutNode);
- method public void onSizeChange(androidx.ui.core.LayoutNode layoutNode);
- method public void pauseModelReadObserveration(kotlin.jvm.functions.Function0<kotlin.Unit> block);
- method public void removeAndroidView(android.view.View view);
- method public void sendEvent(android.view.MotionEvent event);
- method public void setConfigurationChangeObserver(kotlin.jvm.functions.Function0<kotlin.Unit> p);
- method public void setConstraints(androidx.ui.core.Constraints p);
- method public void setOnSavedStateRegistryAvailable(kotlin.jvm.functions.Function1<? super androidx.ui.savedinstancestate.UiSavedStateRegistry,kotlin.Unit> callback);
- method public void setRef(androidx.ui.core.Ref<androidx.ui.core.AndroidComposeView>? value);
- method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public void setShowLayoutBounds(boolean p);
- property public final androidx.ui.autofill.Autofill? autofill;
- property public final androidx.ui.autofill.AutofillTree autofillTree;
- property public final kotlin.jvm.functions.Function0<kotlin.Unit> configurationChangeObserver;
- property public final androidx.ui.core.Constraints constraints;
- property public androidx.ui.unit.Density density;
- property public final androidx.ui.text.font.Font.ResourceLoader fontLoader;
- property public final androidx.ui.core.hapticfeedback.HapticFeedback hapticFeedBack;
- property public long measureIteration;
- property public final androidx.ui.core.Ref<androidx.ui.core.AndroidComposeView>? ref;
- property public final androidx.ui.core.LayoutNode root;
- property public final androidx.ui.savedinstancestate.UiSavedStateRegistry? savedStateRegistry;
- property public androidx.ui.core.semantics.SemanticsOwner semanticsOwner;
- property public boolean showLayoutBounds;
- property public final androidx.ui.input.TextInputService textInputService;
- field public static final androidx.ui.core.AndroidComposeView.Companion! Companion;
- }
-
- public static final class AndroidComposeView.Companion {
- method public boolean getEnableExtraAssertions();
- method public void setEnableExtraAssertions(boolean p);
- property public final boolean enableExtraAssertions;
- }
-
public interface AndroidOwner extends androidx.ui.core.Owner {
method public void addAndroidView(android.view.View view, androidx.ui.core.LayoutNode layoutNode);
method public void removeAndroidView(android.view.View view);
}
+ public final class AndroidOwnerKt {
+ method public static androidx.ui.core.Owner createOwner(android.content.Context context);
+ }
+
public abstract sealed class ComponentNode {
method public void attach(androidx.ui.core.Owner owner);
method public void detach();
@@ -285,10 +226,18 @@
method public androidx.ui.unit.IntPxPosition calculatePosition();
method public void callDraw(androidx.ui.graphics.Canvas canvas, androidx.ui.core.ComponentNode node, androidx.ui.unit.PxSize parentSize);
method public androidx.ui.core.OwnedLayer createLayer(androidx.ui.core.DrawLayerModifier drawLayerModifier, kotlin.jvm.functions.Function2<? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.Density,kotlin.Unit> drawBlock);
+ method public androidx.ui.autofill.Autofill? getAutofill();
+ method public androidx.ui.autofill.AutofillTree getAutofillTree();
+ method public kotlin.jvm.functions.Function0<kotlin.Unit> getConfigurationChangeObserver();
method public androidx.ui.unit.Density getDensity();
+ method public androidx.ui.text.font.Font.ResourceLoader getFontLoader();
+ method public androidx.ui.core.hapticfeedback.HapticFeedback getHapticFeedBack();
method public long getMeasureIteration();
+ method public androidx.ui.core.LayoutNode getRoot();
+ method public androidx.ui.savedinstancestate.UiSavedStateRegistry? getSavedStateRegistry();
method public androidx.ui.core.semantics.SemanticsOwner getSemanticsOwner();
method public boolean getShowLayoutBounds();
+ method public androidx.ui.input.TextInputService getTextInputService();
method public void measureAndLayout();
method public void observeLayoutModelReads(androidx.ui.core.LayoutNode node, kotlin.jvm.functions.Function0<kotlin.Unit> block);
method public void observeMeasureModelReads(androidx.ui.core.LayoutNode node, kotlin.jvm.functions.Function0<kotlin.Unit> block);
@@ -301,10 +250,28 @@
method public void onSizeChange(androidx.ui.core.LayoutNode layoutNode);
method public void pauseModelReadObserveration(kotlin.jvm.functions.Function0<kotlin.Unit> block);
method public boolean requestFocus();
+ method public void setConfigurationChangeObserver(kotlin.jvm.functions.Function0<kotlin.Unit> p);
+ method public void setOnSavedStateRegistryAvailable(kotlin.jvm.functions.Function1<? super androidx.ui.savedinstancestate.UiSavedStateRegistry,kotlin.Unit> callback);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public void setShowLayoutBounds(boolean p);
+ property public abstract androidx.ui.autofill.Autofill? autofill;
+ property public abstract androidx.ui.autofill.AutofillTree autofillTree;
+ property public abstract kotlin.jvm.functions.Function0<kotlin.Unit> configurationChangeObserver;
property public abstract androidx.ui.unit.Density density;
+ property public abstract androidx.ui.text.font.Font.ResourceLoader fontLoader;
+ property public abstract androidx.ui.core.hapticfeedback.HapticFeedback hapticFeedBack;
property public abstract long measureIteration;
+ property public abstract androidx.ui.core.LayoutNode root;
+ property public abstract androidx.ui.savedinstancestate.UiSavedStateRegistry? savedStateRegistry;
property public abstract androidx.ui.core.semantics.SemanticsOwner semanticsOwner;
property public abstract boolean showLayoutBounds;
+ property public abstract androidx.ui.input.TextInputService textInputService;
+ field public static final androidx.ui.core.Owner.Companion! Companion;
+ }
+
+ public static final class Owner.Companion {
+ method public boolean getEnableExtraAssertions();
+ method public void setEnableExtraAssertions(boolean p);
+ property public final boolean enableExtraAssertions;
}
public final class PointerInputNode extends androidx.ui.core.ComponentNode {
diff --git a/ui/ui-platform/api/public_plus_experimental_current.txt b/ui/ui-platform/api/public_plus_experimental_current.txt
index fe04e6f..6199e06 100644
--- a/ui/ui-platform/api/public_plus_experimental_current.txt
+++ b/ui/ui-platform/api/public_plus_experimental_current.txt
@@ -11,74 +11,15 @@
package androidx.ui.core {
- public final class AndroidComposeView extends android.view.ViewGroup implements androidx.ui.core.AndroidOwner androidx.ui.core.SemanticsTreeProvider {
- ctor public AndroidComposeView(android.content.Context context);
- method public void addAndroidView(android.view.View view, androidx.ui.core.LayoutNode layoutNode);
- method public androidx.ui.unit.IntPxPosition calculatePosition();
- method public void callDraw(androidx.ui.graphics.Canvas canvas, androidx.ui.core.ComponentNode node, androidx.ui.unit.PxSize parentSize);
- method public androidx.ui.core.OwnedLayer createLayer(androidx.ui.core.DrawLayerModifier drawLayerModifier, kotlin.jvm.functions.Function2<? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.Density,kotlin.Unit> drawBlock);
- method public java.util.List<androidx.ui.core.semantics.SemanticsNode> getAllSemanticNodes();
- method public androidx.ui.autofill.Autofill? getAutofill();
- method public androidx.ui.autofill.AutofillTree getAutofillTree();
- method public kotlin.jvm.functions.Function0<kotlin.Unit> getConfigurationChangeObserver();
- method public androidx.ui.core.Constraints getConstraints();
- method public androidx.ui.unit.Density getDensity();
- method public androidx.ui.text.font.Font.ResourceLoader getFontLoader();
- method public androidx.ui.core.hapticfeedback.HapticFeedback getHapticFeedBack();
- method public long getMeasureIteration();
- method public androidx.ui.core.Ref<androidx.ui.core.AndroidComposeView>? getRef();
- method public androidx.ui.core.LayoutNode getRoot();
- method public androidx.ui.savedinstancestate.UiSavedStateRegistry? getSavedStateRegistry();
- method public androidx.ui.core.semantics.SemanticsOwner getSemanticsOwner();
- method public boolean getShowLayoutBounds();
- method public androidx.ui.input.TextInputService getTextInputService();
- method public void measureAndLayout();
- method public void observeLayerModelReads(androidx.ui.core.OwnedLayer layer, kotlin.jvm.functions.Function0<kotlin.Unit> block);
- method public void observeLayoutModelReads(androidx.ui.core.LayoutNode node, kotlin.jvm.functions.Function0<kotlin.Unit> block);
- method public void observeMeasureModelReads(androidx.ui.core.LayoutNode node, kotlin.jvm.functions.Function0<kotlin.Unit> block);
- method public void onAttach(androidx.ui.core.ComponentNode node);
- method public void onDetach(androidx.ui.core.ComponentNode node);
- method public void onInvalidate(androidx.ui.core.DrawNode drawNode);
- method public void onInvalidate(androidx.ui.core.LayoutNode layoutNode);
- method public void onPositionChange(androidx.ui.core.LayoutNode layoutNode);
- method public void onRequestMeasure(androidx.ui.core.LayoutNode layoutNode);
- method public void onSizeChange(androidx.ui.core.LayoutNode layoutNode);
- method public void pauseModelReadObserveration(kotlin.jvm.functions.Function0<kotlin.Unit> block);
- method public void removeAndroidView(android.view.View view);
- method public void sendEvent(android.view.MotionEvent event);
- method public void setConfigurationChangeObserver(kotlin.jvm.functions.Function0<kotlin.Unit> p);
- method public void setConstraints(androidx.ui.core.Constraints p);
- method public void setOnSavedStateRegistryAvailable(kotlin.jvm.functions.Function1<? super androidx.ui.savedinstancestate.UiSavedStateRegistry,kotlin.Unit> callback);
- method public void setRef(androidx.ui.core.Ref<androidx.ui.core.AndroidComposeView>? value);
- method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public void setShowLayoutBounds(boolean p);
- property public final androidx.ui.autofill.Autofill? autofill;
- property public final androidx.ui.autofill.AutofillTree autofillTree;
- property public final kotlin.jvm.functions.Function0<kotlin.Unit> configurationChangeObserver;
- property public final androidx.ui.core.Constraints constraints;
- property public androidx.ui.unit.Density density;
- property public final androidx.ui.text.font.Font.ResourceLoader fontLoader;
- property public final androidx.ui.core.hapticfeedback.HapticFeedback hapticFeedBack;
- property public long measureIteration;
- property public final androidx.ui.core.Ref<androidx.ui.core.AndroidComposeView>? ref;
- property public final androidx.ui.core.LayoutNode root;
- property public final androidx.ui.savedinstancestate.UiSavedStateRegistry? savedStateRegistry;
- property public androidx.ui.core.semantics.SemanticsOwner semanticsOwner;
- property public boolean showLayoutBounds;
- property public final androidx.ui.input.TextInputService textInputService;
- field public static final androidx.ui.core.AndroidComposeView.Companion! Companion;
- }
-
- public static final class AndroidComposeView.Companion {
- method public boolean getEnableExtraAssertions();
- method public void setEnableExtraAssertions(boolean p);
- property public final boolean enableExtraAssertions;
- }
-
public interface AndroidOwner extends androidx.ui.core.Owner {
method public void addAndroidView(android.view.View view, androidx.ui.core.LayoutNode layoutNode);
method public void removeAndroidView(android.view.View view);
}
+ public final class AndroidOwnerKt {
+ method public static androidx.ui.core.Owner createOwner(android.content.Context context);
+ }
+
public abstract sealed class ComponentNode {
method public void attach(androidx.ui.core.Owner owner);
method public void detach();
@@ -285,10 +226,18 @@
method public androidx.ui.unit.IntPxPosition calculatePosition();
method public void callDraw(androidx.ui.graphics.Canvas canvas, androidx.ui.core.ComponentNode node, androidx.ui.unit.PxSize parentSize);
method public androidx.ui.core.OwnedLayer createLayer(androidx.ui.core.DrawLayerModifier drawLayerModifier, kotlin.jvm.functions.Function2<? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.Density,kotlin.Unit> drawBlock);
+ method public androidx.ui.autofill.Autofill? getAutofill();
+ method public androidx.ui.autofill.AutofillTree getAutofillTree();
+ method public kotlin.jvm.functions.Function0<kotlin.Unit> getConfigurationChangeObserver();
method public androidx.ui.unit.Density getDensity();
+ method public androidx.ui.text.font.Font.ResourceLoader getFontLoader();
+ method public androidx.ui.core.hapticfeedback.HapticFeedback getHapticFeedBack();
method public long getMeasureIteration();
+ method public androidx.ui.core.LayoutNode getRoot();
+ method public androidx.ui.savedinstancestate.UiSavedStateRegistry? getSavedStateRegistry();
method public androidx.ui.core.semantics.SemanticsOwner getSemanticsOwner();
method public boolean getShowLayoutBounds();
+ method public androidx.ui.input.TextInputService getTextInputService();
method public void measureAndLayout();
method public void observeLayoutModelReads(androidx.ui.core.LayoutNode node, kotlin.jvm.functions.Function0<kotlin.Unit> block);
method public void observeMeasureModelReads(androidx.ui.core.LayoutNode node, kotlin.jvm.functions.Function0<kotlin.Unit> block);
@@ -301,10 +250,28 @@
method public void onSizeChange(androidx.ui.core.LayoutNode layoutNode);
method public void pauseModelReadObserveration(kotlin.jvm.functions.Function0<kotlin.Unit> block);
method public boolean requestFocus();
+ method public void setConfigurationChangeObserver(kotlin.jvm.functions.Function0<kotlin.Unit> p);
+ method public void setOnSavedStateRegistryAvailable(kotlin.jvm.functions.Function1<? super androidx.ui.savedinstancestate.UiSavedStateRegistry,kotlin.Unit> callback);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public void setShowLayoutBounds(boolean p);
+ property public abstract androidx.ui.autofill.Autofill? autofill;
+ property public abstract androidx.ui.autofill.AutofillTree autofillTree;
+ property public abstract kotlin.jvm.functions.Function0<kotlin.Unit> configurationChangeObserver;
property public abstract androidx.ui.unit.Density density;
+ property public abstract androidx.ui.text.font.Font.ResourceLoader fontLoader;
+ property public abstract androidx.ui.core.hapticfeedback.HapticFeedback hapticFeedBack;
property public abstract long measureIteration;
+ property public abstract androidx.ui.core.LayoutNode root;
+ property public abstract androidx.ui.savedinstancestate.UiSavedStateRegistry? savedStateRegistry;
property public abstract androidx.ui.core.semantics.SemanticsOwner semanticsOwner;
property public abstract boolean showLayoutBounds;
+ property public abstract androidx.ui.input.TextInputService textInputService;
+ field public static final androidx.ui.core.Owner.Companion! Companion;
+ }
+
+ public static final class Owner.Companion {
+ method public boolean getEnableExtraAssertions();
+ method public void setEnableExtraAssertions(boolean p);
+ property public final boolean enableExtraAssertions;
}
public final class PointerInputNode extends androidx.ui.core.ComponentNode {
diff --git a/ui/ui-platform/api/restricted_0.1.0-dev07.txt b/ui/ui-platform/api/restricted_0.1.0-dev07.txt
index e20e7d9..56baf4c 100644
--- a/ui/ui-platform/api/restricted_0.1.0-dev07.txt
+++ b/ui/ui-platform/api/restricted_0.1.0-dev07.txt
@@ -11,74 +11,15 @@
package androidx.ui.core {
- public final class AndroidComposeView extends android.view.ViewGroup implements androidx.ui.core.AndroidOwner androidx.ui.core.SemanticsTreeProvider {
- ctor public AndroidComposeView(android.content.Context context);
- method public void addAndroidView(android.view.View view, androidx.ui.core.LayoutNode layoutNode);
- method public androidx.ui.unit.IntPxPosition calculatePosition();
- method public void callDraw(androidx.ui.graphics.Canvas canvas, androidx.ui.core.ComponentNode node, androidx.ui.unit.PxSize parentSize);
- method public androidx.ui.core.OwnedLayer createLayer(androidx.ui.core.DrawLayerModifier drawLayerModifier, kotlin.jvm.functions.Function2<? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.Density,kotlin.Unit> drawBlock);
- method public java.util.List<androidx.ui.core.semantics.SemanticsNode> getAllSemanticNodes();
- method public androidx.ui.autofill.Autofill? getAutofill();
- method public androidx.ui.autofill.AutofillTree getAutofillTree();
- method public kotlin.jvm.functions.Function0<kotlin.Unit> getConfigurationChangeObserver();
- method public androidx.ui.core.Constraints getConstraints();
- method public androidx.ui.unit.Density getDensity();
- method public androidx.ui.text.font.Font.ResourceLoader getFontLoader();
- method public androidx.ui.core.hapticfeedback.HapticFeedback getHapticFeedBack();
- method public long getMeasureIteration();
- method public androidx.ui.core.Ref<androidx.ui.core.AndroidComposeView>? getRef();
- method public androidx.ui.core.LayoutNode getRoot();
- method public androidx.ui.savedinstancestate.UiSavedStateRegistry? getSavedStateRegistry();
- method public androidx.ui.core.semantics.SemanticsOwner getSemanticsOwner();
- method public boolean getShowLayoutBounds();
- method public androidx.ui.input.TextInputService getTextInputService();
- method public void measureAndLayout();
- method public void observeLayerModelReads(androidx.ui.core.OwnedLayer layer, kotlin.jvm.functions.Function0<kotlin.Unit> block);
- method public void observeLayoutModelReads(androidx.ui.core.LayoutNode node, kotlin.jvm.functions.Function0<kotlin.Unit> block);
- method public void observeMeasureModelReads(androidx.ui.core.LayoutNode node, kotlin.jvm.functions.Function0<kotlin.Unit> block);
- method public void onAttach(androidx.ui.core.ComponentNode node);
- method public void onDetach(androidx.ui.core.ComponentNode node);
- method public void onInvalidate(androidx.ui.core.DrawNode drawNode);
- method public void onInvalidate(androidx.ui.core.LayoutNode layoutNode);
- method public void onPositionChange(androidx.ui.core.LayoutNode layoutNode);
- method public void onRequestMeasure(androidx.ui.core.LayoutNode layoutNode);
- method public void onSizeChange(androidx.ui.core.LayoutNode layoutNode);
- method public void pauseModelReadObserveration(kotlin.jvm.functions.Function0<kotlin.Unit> block);
- method public void removeAndroidView(android.view.View view);
- method public void sendEvent(android.view.MotionEvent event);
- method public void setConfigurationChangeObserver(kotlin.jvm.functions.Function0<kotlin.Unit> p);
- method public void setConstraints(androidx.ui.core.Constraints p);
- method public void setOnSavedStateRegistryAvailable(kotlin.jvm.functions.Function1<? super androidx.ui.savedinstancestate.UiSavedStateRegistry,kotlin.Unit> callback);
- method public void setRef(androidx.ui.core.Ref<androidx.ui.core.AndroidComposeView>? value);
- method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public void setShowLayoutBounds(boolean p);
- property public final androidx.ui.autofill.Autofill? autofill;
- property public final androidx.ui.autofill.AutofillTree autofillTree;
- property public final kotlin.jvm.functions.Function0<kotlin.Unit> configurationChangeObserver;
- property public final androidx.ui.core.Constraints constraints;
- property public androidx.ui.unit.Density density;
- property public final androidx.ui.text.font.Font.ResourceLoader fontLoader;
- property public final androidx.ui.core.hapticfeedback.HapticFeedback hapticFeedBack;
- property public long measureIteration;
- property public final androidx.ui.core.Ref<androidx.ui.core.AndroidComposeView>? ref;
- property public final androidx.ui.core.LayoutNode root;
- property public final androidx.ui.savedinstancestate.UiSavedStateRegistry? savedStateRegistry;
- property public androidx.ui.core.semantics.SemanticsOwner semanticsOwner;
- property public boolean showLayoutBounds;
- property public final androidx.ui.input.TextInputService textInputService;
- field public static final androidx.ui.core.AndroidComposeView.Companion! Companion;
- }
-
- public static final class AndroidComposeView.Companion {
- method public boolean getEnableExtraAssertions();
- method public void setEnableExtraAssertions(boolean p);
- property public final boolean enableExtraAssertions;
- }
-
public interface AndroidOwner extends androidx.ui.core.Owner {
method public void addAndroidView(android.view.View view, androidx.ui.core.LayoutNode layoutNode);
method public void removeAndroidView(android.view.View view);
}
+ public final class AndroidOwnerKt {
+ method public static androidx.ui.core.Owner createOwner(android.content.Context context);
+ }
+
public abstract sealed class ComponentNode {
method public void attach(androidx.ui.core.Owner owner);
method public void detach();
@@ -287,10 +228,18 @@
method public androidx.ui.unit.IntPxPosition calculatePosition();
method public void callDraw(androidx.ui.graphics.Canvas canvas, androidx.ui.core.ComponentNode node, androidx.ui.unit.PxSize parentSize);
method public androidx.ui.core.OwnedLayer createLayer(androidx.ui.core.DrawLayerModifier drawLayerModifier, kotlin.jvm.functions.Function2<? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.Density,kotlin.Unit> drawBlock);
+ method public androidx.ui.autofill.Autofill? getAutofill();
+ method public androidx.ui.autofill.AutofillTree getAutofillTree();
+ method public kotlin.jvm.functions.Function0<kotlin.Unit> getConfigurationChangeObserver();
method public androidx.ui.unit.Density getDensity();
+ method public androidx.ui.text.font.Font.ResourceLoader getFontLoader();
+ method public androidx.ui.core.hapticfeedback.HapticFeedback getHapticFeedBack();
method public long getMeasureIteration();
+ method public androidx.ui.core.LayoutNode getRoot();
+ method public androidx.ui.savedinstancestate.UiSavedStateRegistry? getSavedStateRegistry();
method public androidx.ui.core.semantics.SemanticsOwner getSemanticsOwner();
method public boolean getShowLayoutBounds();
+ method public androidx.ui.input.TextInputService getTextInputService();
method public void measureAndLayout();
method public void observeLayoutModelReads(androidx.ui.core.LayoutNode node, kotlin.jvm.functions.Function0<kotlin.Unit> block);
method public void observeMeasureModelReads(androidx.ui.core.LayoutNode node, kotlin.jvm.functions.Function0<kotlin.Unit> block);
@@ -303,10 +252,28 @@
method public void onSizeChange(androidx.ui.core.LayoutNode layoutNode);
method public void pauseModelReadObserveration(kotlin.jvm.functions.Function0<kotlin.Unit> block);
method public boolean requestFocus();
+ method public void setConfigurationChangeObserver(kotlin.jvm.functions.Function0<kotlin.Unit> p);
+ method public void setOnSavedStateRegistryAvailable(kotlin.jvm.functions.Function1<? super androidx.ui.savedinstancestate.UiSavedStateRegistry,kotlin.Unit> callback);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public void setShowLayoutBounds(boolean p);
+ property public abstract androidx.ui.autofill.Autofill? autofill;
+ property public abstract androidx.ui.autofill.AutofillTree autofillTree;
+ property public abstract kotlin.jvm.functions.Function0<kotlin.Unit> configurationChangeObserver;
property public abstract androidx.ui.unit.Density density;
+ property public abstract androidx.ui.text.font.Font.ResourceLoader fontLoader;
+ property public abstract androidx.ui.core.hapticfeedback.HapticFeedback hapticFeedBack;
property public abstract long measureIteration;
+ property public abstract androidx.ui.core.LayoutNode root;
+ property public abstract androidx.ui.savedinstancestate.UiSavedStateRegistry? savedStateRegistry;
property public abstract androidx.ui.core.semantics.SemanticsOwner semanticsOwner;
property public abstract boolean showLayoutBounds;
+ property public abstract androidx.ui.input.TextInputService textInputService;
+ field public static final androidx.ui.core.Owner.Companion! Companion;
+ }
+
+ public static final class Owner.Companion {
+ method public boolean getEnableExtraAssertions();
+ method public void setEnableExtraAssertions(boolean p);
+ property public final boolean enableExtraAssertions;
}
public final class PointerInputNode extends androidx.ui.core.ComponentNode {
diff --git a/ui/ui-platform/api/restricted_current.txt b/ui/ui-platform/api/restricted_current.txt
index e20e7d9..56baf4c 100644
--- a/ui/ui-platform/api/restricted_current.txt
+++ b/ui/ui-platform/api/restricted_current.txt
@@ -11,74 +11,15 @@
package androidx.ui.core {
- public final class AndroidComposeView extends android.view.ViewGroup implements androidx.ui.core.AndroidOwner androidx.ui.core.SemanticsTreeProvider {
- ctor public AndroidComposeView(android.content.Context context);
- method public void addAndroidView(android.view.View view, androidx.ui.core.LayoutNode layoutNode);
- method public androidx.ui.unit.IntPxPosition calculatePosition();
- method public void callDraw(androidx.ui.graphics.Canvas canvas, androidx.ui.core.ComponentNode node, androidx.ui.unit.PxSize parentSize);
- method public androidx.ui.core.OwnedLayer createLayer(androidx.ui.core.DrawLayerModifier drawLayerModifier, kotlin.jvm.functions.Function2<? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.Density,kotlin.Unit> drawBlock);
- method public java.util.List<androidx.ui.core.semantics.SemanticsNode> getAllSemanticNodes();
- method public androidx.ui.autofill.Autofill? getAutofill();
- method public androidx.ui.autofill.AutofillTree getAutofillTree();
- method public kotlin.jvm.functions.Function0<kotlin.Unit> getConfigurationChangeObserver();
- method public androidx.ui.core.Constraints getConstraints();
- method public androidx.ui.unit.Density getDensity();
- method public androidx.ui.text.font.Font.ResourceLoader getFontLoader();
- method public androidx.ui.core.hapticfeedback.HapticFeedback getHapticFeedBack();
- method public long getMeasureIteration();
- method public androidx.ui.core.Ref<androidx.ui.core.AndroidComposeView>? getRef();
- method public androidx.ui.core.LayoutNode getRoot();
- method public androidx.ui.savedinstancestate.UiSavedStateRegistry? getSavedStateRegistry();
- method public androidx.ui.core.semantics.SemanticsOwner getSemanticsOwner();
- method public boolean getShowLayoutBounds();
- method public androidx.ui.input.TextInputService getTextInputService();
- method public void measureAndLayout();
- method public void observeLayerModelReads(androidx.ui.core.OwnedLayer layer, kotlin.jvm.functions.Function0<kotlin.Unit> block);
- method public void observeLayoutModelReads(androidx.ui.core.LayoutNode node, kotlin.jvm.functions.Function0<kotlin.Unit> block);
- method public void observeMeasureModelReads(androidx.ui.core.LayoutNode node, kotlin.jvm.functions.Function0<kotlin.Unit> block);
- method public void onAttach(androidx.ui.core.ComponentNode node);
- method public void onDetach(androidx.ui.core.ComponentNode node);
- method public void onInvalidate(androidx.ui.core.DrawNode drawNode);
- method public void onInvalidate(androidx.ui.core.LayoutNode layoutNode);
- method public void onPositionChange(androidx.ui.core.LayoutNode layoutNode);
- method public void onRequestMeasure(androidx.ui.core.LayoutNode layoutNode);
- method public void onSizeChange(androidx.ui.core.LayoutNode layoutNode);
- method public void pauseModelReadObserveration(kotlin.jvm.functions.Function0<kotlin.Unit> block);
- method public void removeAndroidView(android.view.View view);
- method public void sendEvent(android.view.MotionEvent event);
- method public void setConfigurationChangeObserver(kotlin.jvm.functions.Function0<kotlin.Unit> p);
- method public void setConstraints(androidx.ui.core.Constraints p);
- method public void setOnSavedStateRegistryAvailable(kotlin.jvm.functions.Function1<? super androidx.ui.savedinstancestate.UiSavedStateRegistry,kotlin.Unit> callback);
- method public void setRef(androidx.ui.core.Ref<androidx.ui.core.AndroidComposeView>? value);
- method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public void setShowLayoutBounds(boolean p);
- property public final androidx.ui.autofill.Autofill? autofill;
- property public final androidx.ui.autofill.AutofillTree autofillTree;
- property public final kotlin.jvm.functions.Function0<kotlin.Unit> configurationChangeObserver;
- property public final androidx.ui.core.Constraints constraints;
- property public androidx.ui.unit.Density density;
- property public final androidx.ui.text.font.Font.ResourceLoader fontLoader;
- property public final androidx.ui.core.hapticfeedback.HapticFeedback hapticFeedBack;
- property public long measureIteration;
- property public final androidx.ui.core.Ref<androidx.ui.core.AndroidComposeView>? ref;
- property public final androidx.ui.core.LayoutNode root;
- property public final androidx.ui.savedinstancestate.UiSavedStateRegistry? savedStateRegistry;
- property public androidx.ui.core.semantics.SemanticsOwner semanticsOwner;
- property public boolean showLayoutBounds;
- property public final androidx.ui.input.TextInputService textInputService;
- field public static final androidx.ui.core.AndroidComposeView.Companion! Companion;
- }
-
- public static final class AndroidComposeView.Companion {
- method public boolean getEnableExtraAssertions();
- method public void setEnableExtraAssertions(boolean p);
- property public final boolean enableExtraAssertions;
- }
-
public interface AndroidOwner extends androidx.ui.core.Owner {
method public void addAndroidView(android.view.View view, androidx.ui.core.LayoutNode layoutNode);
method public void removeAndroidView(android.view.View view);
}
+ public final class AndroidOwnerKt {
+ method public static androidx.ui.core.Owner createOwner(android.content.Context context);
+ }
+
public abstract sealed class ComponentNode {
method public void attach(androidx.ui.core.Owner owner);
method public void detach();
@@ -287,10 +228,18 @@
method public androidx.ui.unit.IntPxPosition calculatePosition();
method public void callDraw(androidx.ui.graphics.Canvas canvas, androidx.ui.core.ComponentNode node, androidx.ui.unit.PxSize parentSize);
method public androidx.ui.core.OwnedLayer createLayer(androidx.ui.core.DrawLayerModifier drawLayerModifier, kotlin.jvm.functions.Function2<? super androidx.ui.graphics.Canvas,? super androidx.ui.unit.Density,kotlin.Unit> drawBlock);
+ method public androidx.ui.autofill.Autofill? getAutofill();
+ method public androidx.ui.autofill.AutofillTree getAutofillTree();
+ method public kotlin.jvm.functions.Function0<kotlin.Unit> getConfigurationChangeObserver();
method public androidx.ui.unit.Density getDensity();
+ method public androidx.ui.text.font.Font.ResourceLoader getFontLoader();
+ method public androidx.ui.core.hapticfeedback.HapticFeedback getHapticFeedBack();
method public long getMeasureIteration();
+ method public androidx.ui.core.LayoutNode getRoot();
+ method public androidx.ui.savedinstancestate.UiSavedStateRegistry? getSavedStateRegistry();
method public androidx.ui.core.semantics.SemanticsOwner getSemanticsOwner();
method public boolean getShowLayoutBounds();
+ method public androidx.ui.input.TextInputService getTextInputService();
method public void measureAndLayout();
method public void observeLayoutModelReads(androidx.ui.core.LayoutNode node, kotlin.jvm.functions.Function0<kotlin.Unit> block);
method public void observeMeasureModelReads(androidx.ui.core.LayoutNode node, kotlin.jvm.functions.Function0<kotlin.Unit> block);
@@ -303,10 +252,28 @@
method public void onSizeChange(androidx.ui.core.LayoutNode layoutNode);
method public void pauseModelReadObserveration(kotlin.jvm.functions.Function0<kotlin.Unit> block);
method public boolean requestFocus();
+ method public void setConfigurationChangeObserver(kotlin.jvm.functions.Function0<kotlin.Unit> p);
+ method public void setOnSavedStateRegistryAvailable(kotlin.jvm.functions.Function1<? super androidx.ui.savedinstancestate.UiSavedStateRegistry,kotlin.Unit> callback);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP) public void setShowLayoutBounds(boolean p);
+ property public abstract androidx.ui.autofill.Autofill? autofill;
+ property public abstract androidx.ui.autofill.AutofillTree autofillTree;
+ property public abstract kotlin.jvm.functions.Function0<kotlin.Unit> configurationChangeObserver;
property public abstract androidx.ui.unit.Density density;
+ property public abstract androidx.ui.text.font.Font.ResourceLoader fontLoader;
+ property public abstract androidx.ui.core.hapticfeedback.HapticFeedback hapticFeedBack;
property public abstract long measureIteration;
+ property public abstract androidx.ui.core.LayoutNode root;
+ property public abstract androidx.ui.savedinstancestate.UiSavedStateRegistry? savedStateRegistry;
property public abstract androidx.ui.core.semantics.SemanticsOwner semanticsOwner;
property public abstract boolean showLayoutBounds;
+ property public abstract androidx.ui.input.TextInputService textInputService;
+ field public static final androidx.ui.core.Owner.Companion! Companion;
+ }
+
+ public static final class Owner.Companion {
+ method public boolean getEnableExtraAssertions();
+ method public void setEnableExtraAssertions(boolean p);
+ property public final boolean enableExtraAssertions;
}
public final class PointerInputNode extends androidx.ui.core.ComponentNode {
diff --git a/ui/ui-platform/src/androidTest/java/androidx/ui/core/AndroidComposeViewTest.kt b/ui/ui-platform/src/androidTest/java/androidx/ui/core/AndroidComposeViewTest.kt
index 86e8927..6037073 100644
--- a/ui/ui-platform/src/androidTest/java/androidx/ui/core/AndroidComposeViewTest.kt
+++ b/ui/ui-platform/src/androidTest/java/androidx/ui/core/AndroidComposeViewTest.kt
@@ -20,6 +20,7 @@
import android.graphics.Rect
import android.util.SparseArray
import android.view.View
+import android.view.ViewGroup
import android.view.ViewStructure
import android.view.autofill.AutofillValue
import androidx.test.filters.SdkSuppress
@@ -38,29 +39,33 @@
val activityTestRule = ActivityTestRule<Activity>(Activity::class.java)
private val PACKAGE_NAME = "androidx.ui.platform.test"
- private lateinit var composeView: AndroidComposeView
+ private lateinit var owner: Owner
+ private lateinit var composeView: ViewGroup
@Before
fun setup() {
- composeView = AndroidComposeView(activityTestRule.activity)
+ owner = createOwner(activityTestRule.activity)
+ if (owner is ViewGroup) {
+ composeView = owner as ViewGroup
+ }
}
@SdkSuppress(maxSdkVersion = 25)
@Test
fun autofillAmbient_belowApi26_isNull() {
- assertThat(composeView.autofill).isNull()
+ assertThat(owner.autofill).isNull()
}
@SdkSuppress(minSdkVersion = 26)
@Test
fun autofillAmbient_isNotNull() {
- assertThat(composeView.autofill).isNotNull()
+ assertThat(owner.autofill).isNotNull()
}
@SdkSuppress(minSdkVersion = 26)
@Test
fun autofillAmbient_returnsAnInstanceOfAndroidAutofill() {
- assertThat(composeView.autofill).isInstanceOf(AndroidAutofill::class.java)
+ assertThat(owner.autofill).isInstanceOf(AndroidAutofill::class.java)
}
@SdkSuppress(minSdkVersion = 26)
@@ -73,7 +78,7 @@
autofillTypes = listOf(AutofillType.Name),
boundingBox = Rect(0, 0, 0, 0)
)
- composeView.autofillTree += autofillNode
+ owner.autofillTree += autofillNode
// Act.
composeView.onProvideAutofillVirtualStructure(viewStructure, 0)
@@ -104,7 +109,7 @@
val autofillValues = SparseArray<AutofillValue>().apply {
append(autofillNode.id, AutofillValue.forText(expectedValue))
}
- composeView.autofillTree += autofillNode
+ owner.autofillTree += autofillNode
// Act.
composeView.autofill(autofillValues)
diff --git a/ui/ui-platform/src/main/java/androidx/ui/core/AndroidOwner.kt b/ui/ui-platform/src/main/java/androidx/ui/core/AndroidOwner.kt
index 610d628..6bee89e 100644
--- a/ui/ui-platform/src/main/java/androidx/ui/core/AndroidOwner.kt
+++ b/ui/ui-platform/src/main/java/androidx/ui/core/AndroidOwner.kt
@@ -31,7 +31,6 @@
import android.view.autofill.AutofillValue
import android.view.inputmethod.EditorInfo
import android.view.inputmethod.InputConnection
-import androidx.annotation.RestrictTo
import androidx.ui.autofill.AndroidAutofill
import androidx.ui.autofill.Autofill
import androidx.ui.autofill.AutofillTree
@@ -39,6 +38,7 @@
import androidx.ui.autofill.populateViewStructure
import androidx.ui.autofill.registerCallback
import androidx.ui.autofill.unregisterCallback
+import androidx.ui.core.Owner.Companion.enableExtraAssertions
import androidx.ui.core.hapticfeedback.AndroidHapticFeedback
import androidx.ui.core.hapticfeedback.HapticFeedback
import androidx.ui.core.pointerinput.MotionEventAdapter
@@ -58,17 +58,21 @@
import androidx.ui.unit.ipx
import androidx.ui.unit.max
import androidx.ui.util.trace
-import org.jetbrains.annotations.TestOnly
import java.lang.reflect.Method
+/***
+ * This function creates an instance of Owner.
+ */
+fun createOwner(context: Context): Owner = AndroidComposeView(context)
+
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
-class AndroidComposeView constructor(context: Context) :
+internal class AndroidComposeView constructor(context: Context) :
ViewGroup(context), AndroidOwner, SemanticsTreeProvider {
override var density = Density(context)
private set
- val root = LayoutNode().also {
+ override val root = LayoutNode().also {
it.measureBlocks = RootMeasureBlocks
it.layoutDirection = context.getLayoutDirection()
it.modifier = drawLayer(clipToBounds = false)
@@ -83,7 +87,7 @@
// TODO: Replace with SemanticsTree: Temporary hack until we have a semantics tree implemented.
// TODO: Replace with SemanticsTree.
// This is a temporary hack until we have a semantics tree implemented.
- val autofillTree = AutofillTree()
+ override val autofillTree = AutofillTree()
// OwnedLayers that are dirty and should be redrawn.
internal val dirtyLayers = mutableListOf<OwnedLayer>()
@@ -106,12 +110,12 @@
// Used for updating the ConfigurationAmbient when configuration changes - consume the
// configuration ambient instead of changing this observer if you are writing a component that
// adapts to configuration changes.
- var configurationChangeObserver: () -> Unit = {}
+ override var configurationChangeObserver: () -> Unit = {}
private val _autofill = if (autofillSupported()) AndroidAutofill(this, autofillTree) else null
// Used as an ambient for performing autofill.
- val autofill: Autofill? get() = _autofill
+ override val autofill: Autofill? get() = _autofill
override var measureIteration: Long = 1L
get() {
@@ -163,10 +167,6 @@
private val >
override var showLayoutBounds = false
- /** @hide */
- @TestOnly
- @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
- set
private val consistencyChecker: LayoutTreeConsistencyChecker? =
if (enableExtraAssertions) {
@@ -287,7 +287,8 @@
private fun requestRelayout(layoutNode: LayoutNode) {
if (layoutNode.needsRelayout || (layoutNode.needsRemeasure && layoutNode !== root) ||
- layoutNode.isLayingOut) {
+ layoutNode.isLayingOut
+ ) {
// don't need to do anything else since the parent is already scheduled
// for a relayout (measure pass includes relayout), or is laying out right now
consistencyChecker?.assertConsistent()
@@ -310,7 +311,8 @@
var layout = layoutNode
while (layout != layoutNode.alignmentLinesQueryOwner &&
// and relayout or remeasure(includes relayout) is not scheduled already
- !(layout.needsRelayout || layout.needsRemeasure)) {
+ !(layout.needsRelayout || layout.needsRemeasure)
+ ) {
layout.markRelayoutRequested()
layout.dirtyAlignmentLines = true
if (layout.parentLayoutNode == null) break
@@ -613,14 +615,14 @@
private val textInputServiceAndroid = TextInputServiceAndroid(this)
- val textInputService = TextInputService(textInputServiceAndroid)
+ override val textInputService = TextInputService(textInputServiceAndroid)
- val fontLoader: Font.ResourceLoader = AndroidFontResourceLoader(context)
+ override val fontLoader: Font.ResourceLoader = AndroidFontResourceLoader(context)
/**
* Provide haptic feedback to the user. Use the Android version of haptic feedback.
*/
- val hapticFeedBack: HapticFeedback =
+ override val hapticFeedBack: HapticFeedback =
AndroidHapticFeedback(this)
override fun onCheckIsTextEditor(): Boolean = textInputServiceAndroid.isEditorFocused()
@@ -653,12 +655,13 @@
* The current instance of [UiSavedStateRegistry]. If it's null you can wait for it to became
* available using [setOnSavedStateRegistryAvailable].
*/
- val savedStateRegistry: UiSavedStateRegistry? get() = savedStateDelegate.savedStateRegistry
+ override val savedStateRegistry: UiSavedStateRegistry?
+ get() = savedStateDelegate.savedStateRegistry
/**
* Allows other components to be notified when the [UiSavedStateRegistry] became available.
*/
- fun setOnSavedStateRegistryAvailable(callback: (UiSavedStateRegistry) -> Unit) {
+ override fun setOnSavedStateRegistryAvailable(callback: (UiSavedStateRegistry) -> Unit) {
savedStateDelegate.setOnSaveRegistryAvailable(callback)
}
@@ -719,12 +722,6 @@
}
}
- /**
- * Enables additional (and expensive to do in production) assertions. Useful to be set
- * to true during the tests covering our core logic.
- */
- var enableExtraAssertions: Boolean = false
-
private val RootMeasureBlocks = object : LayoutNode.MeasureBlocks {
override fun measure(
measureScope: MeasureScope,
diff --git a/ui/ui-platform/src/main/java/androidx/ui/core/ComponentNodes.kt b/ui/ui-platform/src/main/java/androidx/ui/core/ComponentNodes.kt
index c532467..61abd7f 100644
--- a/ui/ui-platform/src/main/java/androidx/ui/core/ComponentNodes.kt
+++ b/ui/ui-platform/src/main/java/androidx/ui/core/ComponentNodes.kt
@@ -15,9 +15,13 @@
*/
package androidx.ui.core
+import androidx.annotation.RestrictTo
+import androidx.ui.autofill.Autofill
+import androidx.ui.autofill.AutofillTree
import androidx.ui.core.focus.findParentFocusNode
import androidx.ui.core.focus.ownerHasFocus
import androidx.ui.core.focus.requestFocusForOwner
+import androidx.ui.core.hapticfeedback.HapticFeedback
import androidx.ui.core.pointerinput.PointerInputFilter
import androidx.ui.core.pointerinput.PointerInputModifier
import androidx.ui.core.semantics.SemanticsConfiguration
@@ -30,6 +34,9 @@
import androidx.ui.focus.FocusDetailedState.Disabled
import androidx.ui.focus.FocusDetailedState.Inactive
import androidx.ui.graphics.Canvas
+import androidx.ui.input.TextInputService
+import androidx.ui.savedinstancestate.UiSavedStateRegistry
+import androidx.ui.text.font.Font
import androidx.ui.unit.Density
import androidx.ui.unit.IntPx
import androidx.ui.unit.IntPxPosition
@@ -38,6 +45,7 @@
import androidx.ui.unit.PxSize
import androidx.ui.unit.ipx
import androidx.ui.unit.round
+import org.jetbrains.annotations.TestOnly
import kotlin.properties.ReadWriteProperty
import kotlin.reflect.KProperty
@@ -53,14 +61,63 @@
*/
interface Owner {
+ /**
+ * The root layout node in the component tree.
+ */
+ val root: LayoutNode
+
+ /**
+ * Used for updating the ConfigurationAmbient when configuration changes - consume the
+ * configuration ambient instead of changing this observer if you are writing a component
+ * that adapts to configuration changes.
+ */
+ var configurationChangeObserver: () -> Unit
+
+ /**
+ * Provide haptic feedback to the user. Use the Android version of haptic feedback.
+ */
+ val hapticFeedBack: HapticFeedback
+
+ /**
+ * A data structure used to store autofill information. It is used by components that want to
+ * provide autofill semantics.
+ * TODO(ralu): Replace with SemanticsTree. This is a temporary hack until we have a semantics
+ * tree implemented.
+ */
+ val autofillTree: AutofillTree
+
+ /**
+ * The [Autofill] class can be used to perform autofill operations. It is used as an ambient.
+ */
+ val autofill: Autofill?
+
+ /**
+ * The current instance of [UiSavedStateRegistry]. If it's null you can wait for it to became
+ * available using [setOnSavedStateRegistryAvailable].
+ */
+ val savedStateRegistry: UiSavedStateRegistry?
+
+ /**
+ * Allows other components to be notified when the [UiSavedStateRegistry] became available.
+ */
+ fun setOnSavedStateRegistryAvailable(callback: (UiSavedStateRegistry) -> Unit)
+
val density: Density
val semanticsOwner: SemanticsOwner
+ val textInputService: TextInputService
+
+ val fontLoader: Font.ResourceLoader
+
/**
* `true` when layout should draw debug bounds.
*/
- val showLayoutBounds: Boolean
+ var showLayoutBounds: Boolean
+ /** @hide */
+ @TestOnly
+ @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
+ set
/**
* Called from a [DrawNode], this registers with the underlying view system that a
@@ -158,6 +215,14 @@
): OwnedLayer
val measureIteration: Long
+
+ companion object {
+ /**
+ * Enables additional (and expensive to do in production) assertions. Useful to be set
+ * to true during the tests covering our core logic.
+ */
+ var enableExtraAssertions: Boolean = false
+ }
}
/**
@@ -1152,8 +1217,9 @@
owner?.onInvalidate(this)
}
- @Deprecated("Temporary API to support our transition from single child composables to " +
- "modifiers.")
+ @Deprecated(
+ "Temporary API to support our transition from single child composables to modifiers."
+ )
// TODO(popam): remove this
var handlesParentData: Boolean = true
diff --git a/ui/ui-test/src/main/java/androidx/ui/test/android/AndroidComposeTestCaseRunner.kt b/ui/ui-test/src/main/java/androidx/ui/test/android/AndroidComposeTestCaseRunner.kt
index 03f27dc..caa6232 100644
--- a/ui/ui-test/src/main/java/androidx/ui/test/android/AndroidComposeTestCaseRunner.kt
+++ b/ui/ui-test/src/main/java/androidx/ui/test/android/AndroidComposeTestCaseRunner.kt
@@ -34,9 +34,9 @@
import androidx.compose.Recomposer
import androidx.compose.frames.currentFrame
import androidx.compose.frames.inFrame
-import androidx.ui.core.AndroidComposeView
import androidx.ui.core.ComponentNode
import androidx.ui.core.DrawNode
+import androidx.ui.core.Owner
import androidx.ui.core.setContent
import androidx.ui.test.ComposeBenchmarkScope
import androidx.ui.test.ComposeTestCase
@@ -108,7 +108,7 @@
recomposer = Recomposer.current()
composition = activity.setContent { testCase!!.emitContent() }
- val composeView = findComposeView(activity)!!
+ val composeView = (findComposeView(activity) as ViewGroup?)!!
// AndroidComposeView is postponing the composition till the saved state will be restored.
// We will emulate the restoration of the empty state to trigger the real composition.
composeView.restoreHierarchyState(SparseArray())
@@ -146,8 +146,10 @@
}
override fun drawPrepare() {
- require(simulationState == SimulationState.LayoutDone ||
- simulationState == SimulationState.DrawDone) {
+ require(
+ simulationState == SimulationState.LayoutDone ||
+ simulationState == SimulationState.DrawDone
+ ) {
"Draw can be only executed after layout or draw, current state is '$simulationState'"
}
canvas = capture.beginRecording(getView().width, getView().height)
@@ -277,12 +279,12 @@
RecomposeDone
}
-private fun findComposeView(activity: Activity): AndroidComposeView? {
+private fun findComposeView(activity: Activity): Owner? {
return findComposeView(activity.findViewById(android.R.id.content) as ViewGroup)
}
-private fun findComposeView(view: View): AndroidComposeView? {
- if (view is AndroidComposeView) {
+private fun findComposeView(view: View): Owner? {
+ if (view is Owner) {
return view
}
@@ -305,7 +307,7 @@
invalidateViews(child)
}
}
- if (view is AndroidComposeView) {
+ if (view is Owner) {
invalidateComponentNodes(view.root)
}
}