Merge "build.sh asserting that a .git dir exists" into androidx-master-dev
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
index 48d79af..c80cea4 100644
--- a/.github/ISSUE_TEMPLATE/config.yml
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -1,5 +1,14 @@
blank_issues_enabled: false
contact_links:
+ - name: Activity
+ url: https://issuetracker.google.com/issues/new?component=527362&template=1189829
+ about: File a bug or feature request for Activity
+ - name: Fragment
+ url: https://issuetracker.google.com/issues/new?component=460964&template=1182267
+ about: File a bug or feature request for Fragment
+ - name: Navigation
+ url: https://issuetracker.google.com/issues/new?component=409828&template=1093757
+ about: File a bug or feature request for Navigation
- name: Paging
url: https://issuetracker.google.com/issues/new?component=413106&template=1096385
about: File a bug or feature request for Paging
diff --git a/.github/workflows/presubmit.yml b/.github/workflows/presubmit.yml
index 8bc8c2d..dc39336 100644
--- a/.github/workflows/presubmit.yml
+++ b/.github/workflows/presubmit.yml
@@ -67,9 +67,12 @@
run: echo $DIST_DIR && ls $HOME/Library/Android/sdk
- name: build on server
run: |
- cd paging && ./gradlew :buildOnServer && \
- cd ../room && ./gradlew :buildOnServer && \
- cd ../work && ./gradlew :buildOnServer
+ cd activity && ./gradlew :buildOnServer && \
+ cd ../fragment && ./gradlew :buildOnServer && \
+ cd ../navigation && ./gradlew :buildOnServer && \
+ cd ../paging && ./gradlew :buildOnServer && \
+ cd ../room && ./gradlew :buildOnServer && \
+ cd ../work && ./gradlew :buildOnServer
id: gradlew_bos
- name: Upload Results
if: always()
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index b390ac1..8046f2f 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -9,6 +9,9 @@
### What can you contribute to?
You can start contributing to any of the following library groups from GitHub:
+ - [Activity](https://developer.android.com/guide/components/activities/intro-activities)
+ - [Fragment](https://developer.android.com/guide/components/fragments)
+ - [Navigation](https://developer.android.com/guide/navigation)
- [Paging](https://developer.android.com/topic/libraries/architecture/paging)
- [Room](https://developer.android.com/topic/libraries/architecture/room)
- [WorkManager](https://developer.android.com/topic/libraries/architecture/workmanager)
diff --git a/README.md b/README.md
index 1cc495d..924bb1b 100644
--- a/README.md
+++ b/README.md
@@ -12,7 +12,13 @@
For contributions via GitHub, see the [GitHub Contribution Guide](CONTRIBUTING.md).
-Note: The contributions workflow via GitHub is currently experimental - only contributions to [Paging](paging), [Room](room) and [WorkManager](work) are being accepted at this time.
+Note: The contributions workflow via GitHub is currently experimental - only contributions to the following projects are being accepted at this time:
+* [Activity](activity)
+* [Fragment](fragment)
+* [Navigation](navigation)
+* [Paging](paging)
+* [Room](room)
+* [WorkManager](work)
## Code Review Etiquette
When contributing to Jetpack, follow the [code review etiquette](code-review.md).
diff --git a/activity/.idea/codeStyles/Project.xml b/activity/.idea/codeStyles/Project.xml
new file mode 120000
index 0000000..b52b28c
--- /dev/null
+++ b/activity/.idea/codeStyles/Project.xml
@@ -0,0 +1 @@
+../../../.idea/codeStyles/Project.xml
\ No newline at end of file
diff --git a/activity/.idea/codeStyles/codeStyleConfig.xml b/activity/.idea/codeStyles/codeStyleConfig.xml
new file mode 120000
index 0000000..19c4848
--- /dev/null
+++ b/activity/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1 @@
+../../../.idea/codeStyles/codeStyleConfig.xml
\ No newline at end of file
diff --git a/activity/.idea/copyright/AndroidCopyright.xml b/activity/.idea/copyright/AndroidCopyright.xml
new file mode 120000
index 0000000..afbbd04
--- /dev/null
+++ b/activity/.idea/copyright/AndroidCopyright.xml
@@ -0,0 +1 @@
+../../../.idea/copyright/AndroidCopyright.xml
\ No newline at end of file
diff --git a/activity/.idea/copyright/profiles_settings.xml b/activity/.idea/copyright/profiles_settings.xml
new file mode 120000
index 0000000..5996ccd
--- /dev/null
+++ b/activity/.idea/copyright/profiles_settings.xml
@@ -0,0 +1 @@
+../../../.idea/copyright/profiles_settings.xml
\ No newline at end of file
diff --git a/activity/.idea/inspectionProfiles/Project_Default.xml b/activity/.idea/inspectionProfiles/Project_Default.xml
new file mode 120000
index 0000000..a7481f4
--- /dev/null
+++ b/activity/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1 @@
+../../../.idea/inspectionProfiles/Project_Default.xml
\ No newline at end of file
diff --git a/activity/.idea/scopes/Ignore_API_Files.xml b/activity/.idea/scopes/Ignore_API_Files.xml
new file mode 120000
index 0000000..3361ee1
--- /dev/null
+++ b/activity/.idea/scopes/Ignore_API_Files.xml
@@ -0,0 +1 @@
+../../../.idea/scopes/Ignore_API_Files.xml
\ No newline at end of file
diff --git a/activity/.idea/scopes/buildSrc.xml b/activity/.idea/scopes/buildSrc.xml
new file mode 120000
index 0000000..25b7d3b
--- /dev/null
+++ b/activity/.idea/scopes/buildSrc.xml
@@ -0,0 +1 @@
+../../../.idea/scopes/buildSrc.xml
\ No newline at end of file
diff --git a/activity/activity-ktx/build.gradle b/activity/activity-ktx/build.gradle
index 0fb2f0d..4175155 100644
--- a/activity/activity-ktx/build.gradle
+++ b/activity/activity-ktx/build.gradle
@@ -30,16 +30,16 @@
api("androidx.core:core-ktx:1.1.0") {
because 'Mirror activity dependency graph for -ktx artifacts'
}
- api(project(":lifecycle:lifecycle-runtime-ktx")) {
+ api(projectOrArtifact(":lifecycle:lifecycle-runtime-ktx")) {
because 'Mirror activity dependency graph for -ktx artifacts'
}
- api(project(":lifecycle:lifecycle-viewmodel-ktx"))
- api(project(":savedstate:savedstate-ktx")) {
+ api(projectOrArtifact(":lifecycle:lifecycle-viewmodel-ktx"))
+ api(projectOrArtifact(":savedstate:savedstate-ktx")) {
because 'Mirror activity dependency graph for -ktx artifacts'
}
api(KOTLIN_STDLIB)
- androidTestImplementation(project(":lifecycle:lifecycle-runtime-testing"))
+ androidTestImplementation(projectOrArtifact(":lifecycle:lifecycle-runtime-testing"))
androidTestImplementation(JUNIT)
androidTestImplementation(TRUTH)
androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
diff --git a/activity/activity/build.gradle b/activity/activity/build.gradle
index ed1b9d8..e683bb6 100644
--- a/activity/activity/build.gradle
+++ b/activity/activity/build.gradle
@@ -23,12 +23,12 @@
api("androidx.annotation:annotation:1.1.0")
implementation("androidx.collection:collection:1.0.0")
api("androidx.core:core:1.1.0")
- api(project(":lifecycle:lifecycle-runtime"))
- api(project(":lifecycle:lifecycle-viewmodel"))
- api(project(":savedstate:savedstate"))
- api(project(":lifecycle:lifecycle-viewmodel-savedstate"))
+ api(projectOrArtifact(":lifecycle:lifecycle-runtime"))
+ api(projectOrArtifact(":lifecycle:lifecycle-viewmodel"))
+ api(projectOrArtifact(":savedstate:savedstate"))
+ api(projectOrArtifact(":lifecycle:lifecycle-viewmodel-savedstate"))
- androidTestImplementation(project(":lifecycle:lifecycle-runtime-testing"))
+ androidTestImplementation(projectOrArtifact(":lifecycle:lifecycle-runtime-testing"))
androidTestImplementation(KOTLIN_STDLIB)
androidTestImplementation(LEAKCANARY)
androidTestImplementation(LEAKCANARY_INSTRUMENTATION)
diff --git a/activity/gradle b/activity/gradle
new file mode 120000
index 0000000..1c936b3
--- /dev/null
+++ b/activity/gradle
@@ -0,0 +1 @@
+../playground-common/gradle
\ No newline at end of file
diff --git a/activity/gradle.properties b/activity/gradle.properties
new file mode 120000
index 0000000..d952fb0
--- /dev/null
+++ b/activity/gradle.properties
@@ -0,0 +1 @@
+../playground-common/androidx-shared.properties
\ No newline at end of file
diff --git a/activity/gradlew b/activity/gradlew
new file mode 120000
index 0000000..05b75179
--- /dev/null
+++ b/activity/gradlew
@@ -0,0 +1 @@
+../playground-common/gradlew
\ No newline at end of file
diff --git a/activity/gradlew.bat b/activity/gradlew.bat
new file mode 120000
index 0000000..b20877e
--- /dev/null
+++ b/activity/gradlew.bat
@@ -0,0 +1 @@
+../playground-common/gradlew.bat
\ No newline at end of file
diff --git a/activity/settings.gradle b/activity/settings.gradle
new file mode 100644
index 0000000..d9432af
--- /dev/null
+++ b/activity/settings.gradle
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// see ../playground-common/README.md for details on how this works
+rootProject.name = "paging-playground"
+apply from: "../playground-common/playground-include-settings.gradle"
+setupPlayground(this, "..")
+selectProjectsFromAndroidX({ name ->
+ if (name.startsWith(":activity")) return true
+ if (name.startsWith(":internal-testutils-runtime")) return true
+ return false
+})
+
diff --git a/benchmark/benchmark-macro-runtime/build.gradle b/benchmark/benchmark-macro-runtime/build.gradle
new file mode 100644
index 0000000..c0d02a2
--- /dev/null
+++ b/benchmark/benchmark-macro-runtime/build.gradle
@@ -0,0 +1,67 @@
+/*
+ * Copyright (C) 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import static androidx.build.dependencies.DependenciesKt.*
+import androidx.build.LibraryGroups
+import androidx.build.Publish
+
+plugins {
+ id("AndroidXPlugin")
+ id("com.android.library")
+ id("kotlin-android")
+}
+
+android {
+ defaultConfig {
+ minSdkVersion 28
+ multiDexEnabled true
+ }
+}
+
+dependencies {
+ api(JUNIT)
+ api(KOTLIN_STDLIB)
+ api("androidx.annotation:annotation:1.1.0")
+ implementation(GUAVA_ANDROID)
+ implementation(ANDROIDX_TEST_EXT_JUNIT)
+ implementation(ANDROIDX_TEST_UIAUTOMATOR)
+
+ androidTestImplementation("com.android:collector-device-lib:0.1.0")
+ // Get rid of this dependency eventually
+ androidTestImplementation("com.android:collector-device-lib-platform:0.1.0")
+ androidTestImplementation("com.android:collector-helper-utilities:0.1.0")
+ androidTestImplementation("com.android:jank-helper:0.1.0")
+ androidTestImplementation("com.android:memory-helper:0.1.0")
+ androidTestImplementation("com.android:perfetto-helper:0.1.0")
+ androidTestImplementation("com.android:platform-test-composers:0.1.0")
+ androidTestImplementation("com.android:power-helper:0.1.0")
+ androidTestImplementation("com.android:simpleperf-helper:0.1.0")
+ androidTestImplementation("com.android:statsd-helper:0.1.0")
+ androidTestImplementation("com.android:system-metric-helper:0.1.0")
+ androidTestImplementation("com.android:test-composers:0.1.0")
+ androidTestImplementation("com.android:platform-test-rules:0.1.0")
+ androidTestImplementation("com.android:microbenchmark-device-lib:0.1.0")
+ androidTestImplementation("androidx.test:rules:1.3.0")
+ androidTestImplementation("androidx.test:runner:1.3.0")
+}
+
+androidx {
+ name = "Android Benchmark - Macrobenchmark Runtime"
+ publish = Publish.NONE
+ mavenGroup = LibraryGroups.BENCHMARK
+ inceptionYear = "2020"
+ description = "Android Benchmark - Macrobenchmark Runtime"
+}
diff --git a/benchmark/benchmark-macro-runtime/src/main/AndroidManifest.xml b/benchmark/benchmark-macro-runtime/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..e156320
--- /dev/null
+++ b/benchmark/benchmark-macro-runtime/src/main/AndroidManifest.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2020 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+<manifest package="androidx.benchmark.macro.runtime"/>
diff --git a/benchmark/common/lint-baseline.xml b/benchmark/common/lint-baseline.xml
index d51639b..2f099a3 100644
--- a/benchmark/common/lint-baseline.xml
+++ b/benchmark/common/lint-baseline.xml
@@ -52,7 +52,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/androidx/benchmark/Errors.kt"
- line="198"
+ line="199"
column="73"/>
</issue>
@@ -63,7 +63,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/androidx/benchmark/IsolationActivity.kt"
- line="162"
+ line="165"
column="30"/>
</issue>
@@ -74,7 +74,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/androidx/benchmark/IsolationActivity.kt"
- line="171"
+ line="174"
column="37"/>
</issue>
@@ -85,7 +85,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/androidx/benchmark/IsolationActivity.kt"
- line="178"
+ line="181"
column="37"/>
</issue>
@@ -96,7 +96,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/androidx/benchmark/IsolationActivity.kt"
- line="179"
+ line="182"
column="30"/>
</issue>
@@ -107,7 +107,7 @@
errorLine2=" ~~~~~~~~~~~~~~~">
<location
file="src/main/java/androidx/benchmark/IsolationActivity.kt"
- line="180"
+ line="183"
column="30"/>
</issue>
diff --git a/benchmark/gradle-plugin/src/main/resources/scripts/lockClocks.sh b/benchmark/gradle-plugin/src/main/resources/scripts/lockClocks.sh
index a2ca833..df929f4 100755
--- a/benchmark/gradle-plugin/src/main/resources/scripts/lockClocks.sh
+++ b/benchmark/gradle-plugin/src/main/resources/scripts/lockClocks.sh
@@ -110,7 +110,11 @@
enableIndices=''
disableIndices=''
cpu=0
- while [ -d ${CPU_BASE}/cpu${cpu}/cpufreq ]; do
+
+ # Loop through all available cores; We have to check by the parent folder
+ # "cpu#" instead of cpu#/online or cpu#/cpufreq directly, since they may
+ # not be accessible yet.
+ while [ -d ${CPU_BASE}/cpu${cpu} ]; do
# Try to enable core, so we can find its frequencies.
# Note: In cases where the online file is inaccessible, it represents a
# core which cannot be turned off, so we simply assume it is enabled if
diff --git a/buildSrc/src/main/kotlin/androidx/build/AndroidXGradleProperties.kt b/buildSrc/src/main/kotlin/androidx/build/AndroidXGradleProperties.kt
index 17b488b..de0d139 100644
--- a/buildSrc/src/main/kotlin/androidx/build/AndroidXGradleProperties.kt
+++ b/buildSrc/src/main/kotlin/androidx/build/AndroidXGradleProperties.kt
@@ -38,6 +38,11 @@
const val ALL_WARNINGS_AS_ERRORS = "androidx.allWarningsAsErrors"
/**
+ * Setting this property enables multiplatform builds of Compose
+ */
+const val COMPOSE_MPP_ENABLED = "androidx.compose.multiplatformEnabled"
+
+/**
* Setting this property enables calculating the fraction of code covered by tests
*/
const val COVERAGE_ENABLED = "androidx.coverageEnabled"
@@ -87,6 +92,7 @@
val ALL_ANDROIDX_PROPERTIES = setOf(
ALL_WARNINGS_AS_ERRORS,
+ COMPOSE_MPP_ENABLED,
COVERAGE_ENABLED,
DISPLAY_TEST_OUTPUT,
ENABLE_DOCUMENTATION,
diff --git a/buildSrc/src/main/kotlin/androidx/build/AndroidXPlugin.kt b/buildSrc/src/main/kotlin/androidx/build/AndroidXPlugin.kt
index f843aa7..7744dab 100644
--- a/buildSrc/src/main/kotlin/androidx/build/AndroidXPlugin.kt
+++ b/buildSrc/src/main/kotlin/androidx/build/AndroidXPlugin.kt
@@ -36,6 +36,7 @@
import androidx.build.checkapi.configureProjectForApiTasks
import androidx.build.studio.StudioTask
import com.android.build.api.artifact.ArtifactType
+import com.android.build.api.artifact.Artifacts
import com.android.build.api.dsl.ApplicationExtension
import com.android.build.api.dsl.CommonExtension
import com.android.build.gradle.AppExtension
@@ -269,13 +270,67 @@
configureAndroidCommonOptions(project, androidXExtension)
configureAndroidLibraryOptions(project, androidXExtension)
}
- libraryExtension.onVariants.withBuildType("release") {
- // Disable unit test for release build type
- unitTest {
- @Suppress("UnstableApiUsage")
- enabled = false
- }
+
+ try {
+ val libraryAndroidComponentsExtensionType =
+ Class.forName("com.android.build.api.extension.LibraryAndroidComponentsExtension")
+ val androidComponentsExtension =
+ project.extensions.getByType(libraryAndroidComponentsExtensionType)
+ val selectorType = Class.forName("com.android.build.api.extension.VariantSelector")
+ val selector = libraryAndroidComponentsExtensionType.getMethod("selector")
+ .invoke(androidComponentsExtension)
+ libraryAndroidComponentsExtensionType
+ .getMethod("beforeUnitTest", selectorType, Function1::class.java)
+ .invoke(
+ androidComponentsExtension,
+ selectorType.getMethod("withBuildType", String::class.java)
+ .invoke(selector, "release"),
+ { unitTest: Any ->
+ unitTest.javaClass.getMethod("setEnabled", Boolean::class.java)
+ .invoke(unitTest, false)
+ }
+ )
+ } catch (cnfe: ClassNotFoundException) {
+ // old iteration of the new API.
+ val allVariants = libraryExtension.javaClass.getMethod("getOnVariants")
+ .invoke(libraryExtension)
+
+ allVariants.javaClass.getMethod(
+ "withBuildType",
+ String::class.java,
+ Function1::class.java
+ ).invoke(
+ allVariants,
+ "release",
+ { variant: Any ->
+ variant.javaClass.getMethod(
+ "unitTest",
+ Function1::class.java
+ ).invoke(
+ variant,
+ { unitTest: Any ->
+ unitTest.javaClass.getMethod(
+ "setEnabled",
+ Boolean::class.java
+ ).invoke(
+ unitTest,
+ false
+ )
+ }
+ )
+ }
+ )
}
+
+ // switch to this code once 4.2.0-beta1 can be used.
+
+ // project.extensions.getByType<LibraryAndroidComponentsExtension>().apply {
+ // beforeUnitTest(selector().withBuildType("release")) {
+ // // Disable unit test for release build type
+ // @Suppress("UnstableApiUsage")
+ // enabled = false
+ // }
+ // }
libraryExtension.packagingOptions {
// TODO: Replace this with a per-variant packagingOption for androidTest specifically
// once b/69953968 is resolved.
@@ -486,7 +541,40 @@
val commonExtension = project.extensions.getByType(CommonExtension::class.java)
if (hasAndroidTestSourceCode(project, this)) {
- commonExtension.configureTestConfigGeneration(project)
+ try {
+ val androidComponentsExtensionType =
+ Class.forName("com.android.build.api.extension.AndroidComponentsExtension")
+ val androidComponentsExtension =
+ project.extensions.getByType(androidComponentsExtensionType)
+ val selectorType = Class.forName("com.android.build.api.extension.VariantSelector")
+ val selector = androidComponentsExtensionType.getMethod("selector")
+ .invoke(androidComponentsExtension)
+ androidComponentsExtension.javaClass.getMethod(
+ "androidTest",
+ selectorType,
+ Function1::class.java
+ ).invoke(
+ androidComponentsExtension,
+ selector.javaClass.getMethod("all").invoke(selector),
+ { androidTest: Any ->
+ createTestConfigurationGenerationTask(
+ project,
+ androidTest.javaClass.getMethod(
+ "getName"
+ ).invoke(
+ androidTest
+ ) as String,
+ androidTest.javaClass.getMethod(
+ "getArtifacts"
+ ).invoke(
+ androidTest
+ ) as Artifacts
+ )
+ }
+ )
+ } catch (cnfe: ClassNotFoundException) {
+ commonExtension.configureTestConfigGeneration(project)
+ }
}
val buildTestApksTask = project.rootProject.tasks.named(BUILD_TEST_APKS_TASK)
@@ -500,36 +588,72 @@
private fun CommonExtension<*, *, *, *, *, *, *, *>
.configureTestConfigGeneration(project: Project) {
- onVariants {
- val variant = this
- androidTestProperties {
- val generateTestConfigurationTask = project.tasks.register(
- "${project.name}${GENERATE_TEST_CONFIGURATION_TASK}${variant.name}",
- GenerateTestConfigurationTask::class.java
- ) {
- it.testFolder.set(artifacts.get(ArtifactType.APK))
- it.testLoader.set(artifacts.getBuiltArtifactsLoader())
- it.outputXml.fileValue(
- File(
- project.getTestConfigDirectory(),
- "${project.asFilenamePrefix()}${variant.name}AndroidTest.xml"
- )
+ // old iteration of the new API.
+ javaClass.getMethod("onVariants", Function1::class.java)
+ .invoke(
+ this,
+ { variant: Any ->
+ variant.javaClass.getMethod(
+ "androidTestProperties",
+ Function1::class.java
+ ).invoke(
+ variant,
+ { androidTest: Any ->
+ createTestConfigurationGenerationTask(
+ project,
+ androidTest.javaClass.getMethod(
+ "getName"
+ ).invoke(androidTest) as String,
+ androidTest.javaClass.getMethod(
+ "getArtifacts"
+ ).invoke(androidTest) as Artifacts
+ )
+ }
)
- }
- project.rootProject.tasks.findByName(ZIP_TEST_CONFIGS_WITH_APKS_TASK)!!
- .dependsOn(generateTestConfigurationTask)
- }
+ } as Function1<Any, Any>
+ )
+ }
+
+ private fun createTestConfigurationGenerationTask(
+ project: Project,
+ variantName: String,
+ artifacts: Artifacts
+ ) {
+ val generateTestConfigurationTask = project.tasks.register(
+ "${project.name}${GENERATE_TEST_CONFIGURATION_TASK}$variantName",
+ GenerateTestConfigurationTask::class.java
+ ) {
+ it.testFolder.set(artifacts.get(ArtifactType.APK))
+ it.testLoader.set(artifacts.getBuiltArtifactsLoader())
+ it.outputXml.fileValue(
+ File(
+ project.getTestConfigDirectory(),
+ "${project.asFilenamePrefix()}${variantName}AndroidTest.xml"
+ )
+ )
}
+ project.rootProject.tasks.findByName(ZIP_TEST_CONFIGS_WITH_APKS_TASK)!!
+ .dependsOn(generateTestConfigurationTask)
}
private fun ApplicationExtension<*, *, *, *, *>
.addAppApkToTestConfigGeneration(project: Project) {
- onVariantProperties.withBuildType("debug") {
- project.tasks.withType(GenerateTestConfigurationTask::class.java) {
- it.appFolder.set(artifacts.get(ArtifactType.APK))
- it.appLoader.set(artifacts.getBuiltArtifactsLoader())
- }
- }
+ val allVariants = javaClass.getMethod("getOnVariantProperties")
+ .invoke(this)
+
+ allVariants.javaClass.getMethod("withBuildType", String::class.java, Function1::class.java)
+ .invoke(
+ allVariants,
+ "debug",
+ { debugVariant: Any ->
+ val artifacts = debugVariant.javaClass.getMethod("getArtifacts")
+ .invoke(debugVariant) as Artifacts
+ project.tasks.withType(GenerateTestConfigurationTask::class.java) {
+ it.appFolder.set(artifacts.get(ArtifactType.APK))
+ it.appLoader.set(artifacts.getBuiltArtifactsLoader())
+ }
+ }
+ )
}
private fun hasAndroidTestSourceCode(project: Project, extension: TestedExtension): Boolean {
@@ -664,8 +788,38 @@
}
}
- val applicationExtension = project.extensions.getByType(ApplicationExtension::class.java)
- applicationExtension.addAppApkToTestConfigGeneration(project)
+ try {
+ val androidComponentsExtensionType = Class.forName(
+ "com.android.build.api.extension.ApplicationAndroidComponentsExtension"
+ )
+ val androidComponentsExtension =
+ project.extensions.getByType(androidComponentsExtensionType)
+ val selectorType = Class.forName(
+ "com.android.build.api.extension.VariantSelector"
+ )
+ val selector = androidComponentsExtensionType.getMethod("selector")
+ .invoke(androidComponentsExtension)
+ androidComponentsExtensionType
+ .getMethod("onVariants", selectorType, Function1::class.java)
+ .invoke(
+ androidComponentsExtension,
+ selectorType.getMethod("withBuildType", String::class.java)
+ .invoke(selector, "debug"),
+ { debugVariant: Any ->
+ val artifacts = debugVariant.javaClass.getMethod("getArtifacts")
+ .invoke(debugVariant) as Artifacts
+ project.tasks.withType(GenerateTestConfigurationTask::class.java) {
+ it.appFolder.set(artifacts.get(ArtifactType.APK))
+ it.appLoader.set(artifacts.getBuiltArtifactsLoader())
+ }
+ }
+ )
+ } catch (cnfe: ClassNotFoundException) {
+ val applicationExtension = project.extensions.getByType(
+ ApplicationExtension::class.java
+ )
+ applicationExtension.addAppApkToTestConfigGeneration(project)
+ }
val buildTestApksTask = project.rootProject.tasks.named(BUILD_TEST_APKS_TASK)
applicationVariants.all { variant ->
diff --git a/buildSrc/src/main/kotlin/androidx/build/AndroidXUiPlugin.kt b/buildSrc/src/main/kotlin/androidx/build/AndroidXUiPlugin.kt
index 10018d8..fe0eb44 100644
--- a/buildSrc/src/main/kotlin/androidx/build/AndroidXUiPlugin.kt
+++ b/buildSrc/src/main/kotlin/androidx/build/AndroidXUiPlugin.kt
@@ -21,6 +21,7 @@
import org.gradle.api.DomainObjectCollection
import org.gradle.api.Plugin
import org.gradle.api.Project
+import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.findByType
import org.gradle.kotlin.dsl.invoke
import org.jetbrains.kotlin.gradle.plugin.KotlinBasePluginWrapper
@@ -85,58 +86,121 @@
}
}
}
-}
-/**
- * General configuration for MPP projects. In the future, these workarounds should either be
- * generified and added to AndroidXPlugin, or removed as/when the underlying issues have been
- * resolved.
- */
-private fun Project.configureForMultiplatform() {
- val libraryExtension = project.extensions.findByType<LibraryExtension>() ?: return
-
- // TODO: b/148416113: AGP doesn't know about Kotlin-MPP's sourcesets yet, so add
- // them to its source directories (this fixes lint, and code completion in
- // Android Studio on versions >= 4.0canary8)
- libraryExtension.apply {
- sourceSets.findByName("main")?.apply {
- java.srcDirs(
- "src/commonMain/kotlin", "src/jvmMain/kotlin",
- "src/androidMain/kotlin"
- )
- res.srcDirs("src/androidMain/res")
+ companion object {
+ @JvmStatic
+ fun Project.isMultiplatformEnabled(): Boolean {
+ return properties.get(COMPOSE_MPP_ENABLED)?.toString()?.toBoolean() ?: false
}
- sourceSets.findByName("test")?.apply {
- java.srcDirs("src/test/kotlin")
- res.srcDirs("src/test/res")
+
+ @JvmStatic
+ fun Project.applyAndConfigureKotlinPlugin() {
+ if (isMultiplatformEnabled()) {
+ apply(plugin = "kotlin-multiplatform")
+ } else {
+ apply(plugin = "org.jetbrains.kotlin.android")
+ }
+
+ configureManifests()
+ configureForKotlinMultiplatformSourceStructure()
+ if (isMultiplatformEnabled()) {
+ configureForMultiplatform()
+ }
+
+ tasks.withType(KotlinCompile::class.java).configureEach { compile ->
+ // Needed to enable `expect` and `actual` keywords
+ compile.kotlinOptions.freeCompilerArgs += "-Xmulti-platform"
+ }
}
- sourceSets.findByName("androidTest")?.apply {
- java.srcDirs("src/androidAndroidTest/kotlin")
- res.srcDirs("src/androidAndroidTest/res")
+
+ private fun Project.configureManifests() {
+ val libraryExtension = project.extensions.findByType<LibraryExtension>() ?: return
+ libraryExtension.apply {
+ sourceSets.findByName("main")!!.manifest
+ .srcFile("src/androidMain/AndroidManifest.xml")
+ sourceSets.findByName("androidTest")!!.manifest
+ .srcFile("src/androidAndroidTest/AndroidManifest.xml")
+ }
}
- }
- /*
- The following configures source sets - note:
+ /**
+ * General configuration for MPP projects. In the future, these workarounds should either be
+ * generified and added to AndroidXPlugin, or removed as/when the underlying issues have been
+ * resolved.
+ */
+ private fun Project.configureForKotlinMultiplatformSourceStructure() {
+ val libraryExtension = project.extensions.findByType<LibraryExtension>() ?: return
- 1. The common unit test source set, commonTest, is included by default in both android
- unit and instrumented tests. This causes unnecessary duplication, so we explicitly do
- _not_ use commonTest, instead choosing to just use the unit test variant.
- TODO: Consider using commonTest for unit tests if a usable feature is added for
- https://youtrack.jetbrains.com/issue/KT-34662.
+ // TODO: b/148416113: AGP doesn't know about Kotlin-MPP's sourcesets yet, so add
+ // them to its source directories (this fixes lint, and code completion in
+ // Android Studio on versions >= 4.0canary8)
+ libraryExtension.apply {
+ sourceSets.findByName("main")?.apply {
+ java.srcDirs(
+ "src/commonMain/kotlin", "src/jvmMain/kotlin",
+ "src/androidMain/kotlin"
+ )
+ res.srcDirs("src/androidMain/res")
- 2. The default (android) unit test source set is named 'androidTest', which conflicts / is
- confusing as this shares the same name / expected directory as AGP's 'androidTest', which
- represents _instrumented_ tests.
- TODO: Consider changing unitTest to androidLocalTest and androidAndroidTest to
- androidDeviceTest when https://github.com/JetBrains/kotlin/pull/2829 rolls in.
- */
- multiplatformExtension!!.sourceSets {
- // Allow all experimental APIs, since MPP projects are themselves experimental
- (this as DomainObjectCollection<KotlinSourceSet>).all {
- it.languageSettings.apply {
- useExperimentalAnnotation("kotlin.Experimental")
- useExperimentalAnnotation("kotlin.ExperimentalMultiplatform")
+ // Keep Kotlin files in java source sets so the source set is not empty when
+ // running unit tests which would prevent the tests from running in CI.
+ java.includes.add("**/*.kt")
+ }
+ sourceSets.findByName("test")?.apply {
+ java.srcDirs("src/test/kotlin")
+ res.srcDirs("src/test/res")
+
+ // Keep Kotlin files in java source sets so the source set is not empty when
+ // running unit tests which would prevent the tests from running in CI.
+ java.includes.add("**/*.kt")
+ }
+ sourceSets.findByName("androidTest")?.apply {
+ java.srcDirs("src/androidAndroidTest/kotlin")
+ res.srcDirs("src/androidAndroidTest/res")
+
+ // Keep Kotlin files in java source sets so the source set is not empty when
+ // running unit tests which would prevent the tests from running in CI.
+ java.includes.add("**/*.kt")
+ }
+ }
+ }
+
+ /**
+ * General configuration for MPP projects. In the future, these workarounds should either be
+ * generified and added to AndroidXPlugin, or removed as/when the underlying issues have been
+ * resolved.
+ */
+ private fun Project.configureForMultiplatform() {
+ if (multiplatformExtension == null) {
+ throw IllegalStateException(
+ "Unable to configureForMultiplatform() when " +
+ "multiplatformExtension is null (multiplatform plugin not enabled?)"
+ )
+ }
+
+ /*
+ The following configures source sets - note:
+
+ 1. The common unit test source set, commonTest, is included by default in both android
+ unit and instrumented tests. This causes unnecessary duplication, so we explicitly do
+ _not_ use commonTest, instead choosing to just use the unit test variant.
+ TODO: Consider using commonTest for unit tests if a usable feature is added for
+ https://youtrack.jetbrains.com/issue/KT-34662.
+
+ 2. The default (android) unit test source set is named 'androidTest', which conflicts / is
+ confusing as this shares the same name / expected directory as AGP's 'androidTest', which
+ represents _instrumented_ tests.
+ TODO: Consider changing unitTest to androidLocalTest and androidAndroidTest to
+ androidDeviceTest when https://github.com/JetBrains/kotlin/pull/2829 rolls in.
+ */
+ multiplatformExtension!!.sourceSets {
+ // Allow all experimental APIs, since MPP projects are themselves experimental
+ (this as DomainObjectCollection<KotlinSourceSet>).all {
+ it.languageSettings.apply {
+ useExperimentalAnnotation("kotlin.Experimental")
+ useExperimentalAnnotation("kotlin.ExperimentalMultiplatform")
+ }
+ }
}
}
}
diff --git a/buildSrc/src/main/kotlin/androidx/build/LibraryVersions.kt b/buildSrc/src/main/kotlin/androidx/build/LibraryVersions.kt
index 6cb3dd3..5449e64 100644
--- a/buildSrc/src/main/kotlin/androidx/build/LibraryVersions.kt
+++ b/buildSrc/src/main/kotlin/androidx/build/LibraryVersions.kt
@@ -62,7 +62,7 @@
val EMOJI = Version("1.2.0-alpha03")
val ENTERPRISE = Version("1.1.0-beta01")
val EXIFINTERFACE = Version("1.4.0-alpha01")
- val FRAGMENT = Version("1.3.0-beta01")
+ val FRAGMENT = Version("1.3.0-beta02")
val FUTURES = Version("1.2.0-alpha01")
val GRIDLAYOUT = Version("1.1.0-alpha01")
val HEIFWRITER = Version("1.1.0-alpha01")
diff --git a/buildSrc/src/main/kotlin/androidx/build/PublishDocsRules.kt b/buildSrc/src/main/kotlin/androidx/build/PublishDocsRules.kt
index f5d683c..a3c9d4a 100644
--- a/buildSrc/src/main/kotlin/androidx/build/PublishDocsRules.kt
+++ b/buildSrc/src/main/kotlin/androidx/build/PublishDocsRules.kt
@@ -41,6 +41,7 @@
prebuilts(LibraryGroups.AUTOFILL, "1.1.0-beta01")
ignore(LibraryGroups.BENCHMARK.group, "benchmark-gradle-plugin")
ignore(LibraryGroups.BENCHMARK.group, "benchmark-macro")
+ ignore(LibraryGroups.BENCHMARK.group, "benchmark-macro-runtime")
ignore(LibraryGroups.BENCHMARK.group, "benchmark-perfetto")
prebuilts(LibraryGroups.BENCHMARK, "1.1.0-alpha01")
prebuilts(LibraryGroups.BIOMETRIC, "biometric", "1.1.0-beta01")
diff --git a/buildSrc/src/main/kotlin/androidx/build/Release.kt b/buildSrc/src/main/kotlin/androidx/build/Release.kt
index ce6f81b..305bfa7 100644
--- a/buildSrc/src/main/kotlin/androidx/build/Release.kt
+++ b/buildSrc/src/main/kotlin/androidx/build/Release.kt
@@ -174,15 +174,10 @@
}
val version = project.version
- var zipTasks: MutableList<TaskProvider<GMavenZipTask>> = mutableListOf()
- if (!extension.mavenGroup!!.requireSameVersion) {
- zipTasks.add(getProjectZipTask(project))
- }
- zipTasks.addAll(
- listOf(
- getGroupReleaseZipTask(project, mavenGroup),
- getGlobalFullZipTask(project)
- )
+ var zipTasks = listOf(
+ getProjectZipTask(project),
+ getGroupReleaseZipTask(project, mavenGroup),
+ getGlobalFullZipTask(project)
)
val artifact = Artifact(
mavenGroup = mavenGroup,
diff --git a/camera/integration-tests/viewtestapp/src/androidTest/java/androidx/camera/integration/view/CameraControllerFragmentTest.kt b/camera/integration-tests/viewtestapp/src/androidTest/java/androidx/camera/integration/view/CameraControllerFragmentTest.kt
index 97fdada..3fc2256 100644
--- a/camera/integration-tests/viewtestapp/src/androidTest/java/androidx/camera/integration/view/CameraControllerFragmentTest.kt
+++ b/camera/integration-tests/viewtestapp/src/androidTest/java/androidx/camera/integration/view/CameraControllerFragmentTest.kt
@@ -409,7 +409,7 @@
)
}
- private fun createFragmentScenario(): FragmentScenario<CameraControllerFragment?> {
+ private fun createFragmentScenario(): FragmentScenario<CameraControllerFragment> {
return FragmentScenario.launchInContainer(
CameraControllerFragment::class.java, null, R.style.AppTheme,
null
@@ -419,7 +419,7 @@
}
}
- private fun FragmentScenario<CameraControllerFragment?>.getFragment():
+ private fun FragmentScenario<CameraControllerFragment>.getFragment():
CameraControllerFragment {
var fragment: CameraControllerFragment? = null
this.onFragment { newValue: CameraControllerFragment -> fragment = newValue }
diff --git a/camera/integration-tests/viewtestapp/src/androidTest/java/androidx/camera/integration/view/PreviewViewFragmentTest.java b/camera/integration-tests/viewtestapp/src/androidTest/java/androidx/camera/integration/view/PreviewViewFragmentTest.java
index f9ebfd4..f6e9765 100644
--- a/camera/integration-tests/viewtestapp/src/androidTest/java/androidx/camera/integration/view/PreviewViewFragmentTest.java
+++ b/camera/integration-tests/viewtestapp/src/androidTest/java/androidx/camera/integration/view/PreviewViewFragmentTest.java
@@ -29,6 +29,7 @@
import androidx.camera.testing.CameraUtil;
import androidx.camera.testing.CoreAppTestUtil;
import androidx.camera.view.PreviewView;
+import androidx.fragment.app.FragmentFactory;
import androidx.fragment.app.testing.FragmentScenario;
import androidx.lifecycle.Lifecycle;
import androidx.test.ext.junit.runners.AndroidJUnit4;
@@ -217,7 +218,7 @@
@NonNull
private FragmentScenario<PreviewViewFragment> createScenario() {
return FragmentScenario.launchInContainer(PreviewViewFragment.class, null, R.style.AppTheme,
- null);
+ new FragmentFactory());
}
private void assertPreviewUpdating(@NonNull FragmentScenario<PreviewViewFragment> scenario) {
diff --git a/compose/androidview/androidview/build.gradle b/compose/androidview/androidview/build.gradle
index db6fb8f..1328942 100644
--- a/compose/androidview/androidview/build.gradle
+++ b/compose/androidview/androidview/build.gradle
@@ -27,7 +27,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
// TODO: remove / refactor out reflection dependencies, this is a large dependency to bundle
// with a library.
diff --git a/compose/androidview/androidview/integration-tests/androidview-demos/build.gradle b/compose/androidview/androidview/integration-tests/androidview-demos/build.gradle
index 6523313..7e37835 100644
--- a/compose/androidview/androidview/integration-tests/androidview-demos/build.gradle
+++ b/compose/androidview/androidview/integration-tests/androidview-demos/build.gradle
@@ -26,7 +26,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
diff --git a/compose/animation/animation-core/build.gradle b/compose/animation/animation-core/build.gradle
index 4a9c4e6..e11c31d 100644
--- a/compose/animation/animation-core/build.gradle
+++ b/compose/animation/animation-core/build.gradle
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+
+import androidx.build.AndroidXUiPlugin
import androidx.build.LibraryGroups
import androidx.build.LibraryVersions
import androidx.build.Publish
@@ -25,44 +27,75 @@
id("AndroidXPlugin")
id("com.android.library")
id("AndroidXUiPlugin")
- id("kotlin-multiplatform")
}
+AndroidXUiPlugin.applyAndConfigureKotlinPlugin(project)
+
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
+
+ if(!AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block below
+ */
+
+ api "androidx.annotation:annotation:1.1.0"
+
+ implementation project(":compose:runtime:runtime")
+ implementation project(":compose:runtime:runtime-dispatch")
+ implementation project(":compose:ui:ui-util")
+ implementation (KOTLIN_STDLIB)
+
+ testImplementation(ANDROIDX_TEST_RULES)
+ testImplementation(ANDROIDX_TEST_RUNNER)
+ testImplementation(JUNIT)
+ testImplementation(TRUTH)
+ testImplementation(KOTLIN_COROUTINES_CORE)
+
+ androidTestImplementation(ANDROIDX_TEST_RULES)
+ androidTestImplementation(ANDROIDX_TEST_RUNNER)
+ androidTestImplementation(JUNIT)
+ }
}
-kotlin {
- android()
- jvm("desktop")
+if(AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ kotlin {
+ android()
+ jvm("desktop")
- sourceSets {
- commonMain.dependencies {
- implementation project(":compose:runtime:runtime")
- implementation project(":compose:runtime:runtime-dispatch")
- implementation project(":compose:ui:ui-util")
- implementation (KOTLIN_STDLIB_COMMON)
- }
- androidMain.dependencies {
- api "androidx.annotation:annotation:1.1.0"
- implementation (KOTLIN_STDLIB)
- }
- desktopMain.dependencies {
- implementation (KOTLIN_STDLIB)
- }
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block above
+ */
+ sourceSets {
+ commonMain.dependencies {
+ implementation project(":compose:runtime:runtime")
+ implementation project(":compose:runtime:runtime-dispatch")
+ implementation project(":compose:ui:ui-util")
+ implementation(KOTLIN_STDLIB_COMMON)
+ }
+ androidMain.dependencies {
+ api "androidx.annotation:annotation:1.1.0"
+ implementation(KOTLIN_STDLIB)
+ }
+ desktopMain.dependencies {
+ implementation(KOTLIN_STDLIB)
+ }
- androidTest.dependencies {
- implementation(ANDROIDX_TEST_RULES)
- implementation(ANDROIDX_TEST_RUNNER)
- implementation(JUNIT)
- implementation(TRUTH)
- implementation(KOTLIN_COROUTINES_CORE)
- }
+ androidTest.dependencies {
+ implementation(ANDROIDX_TEST_RULES)
+ implementation(ANDROIDX_TEST_RUNNER)
+ implementation(JUNIT)
+ implementation(TRUTH)
+ implementation(KOTLIN_COROUTINES_CORE)
+ }
- androidAndroidTest.dependencies {
- implementation(ANDROIDX_TEST_RULES)
- implementation(ANDROIDX_TEST_RUNNER)
- implementation(JUNIT)
+ androidAndroidTest.dependencies {
+ implementation(ANDROIDX_TEST_RULES)
+ implementation(ANDROIDX_TEST_RUNNER)
+ implementation(JUNIT)
+ }
}
}
}
diff --git a/compose/animation/animation-core/samples/build.gradle b/compose/animation/animation-core/samples/build.gradle
index 19cc58b..b5e845a 100644
--- a/compose/animation/animation-core/samples/build.gradle
+++ b/compose/animation/animation-core/samples/build.gradle
@@ -29,12 +29,10 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
-
implementation project(":annotation:annotation-sampled")
-
implementation project(":compose:animation:animation-core")
implementation project(":compose:ui:ui-unit")
}
diff --git a/compose/animation/animation/build.gradle b/compose/animation/animation/build.gradle
index 19d793e..bc7174f 100644
--- a/compose/animation/animation/build.gradle
+++ b/compose/animation/animation/build.gradle
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+
+import androidx.build.AndroidXUiPlugin
import androidx.build.LibraryGroups
import androidx.build.LibraryVersions
import androidx.build.Publish
@@ -25,46 +27,80 @@
id("AndroidXPlugin")
id("com.android.library")
id("AndroidXUiPlugin")
- id("kotlin-multiplatform")
}
+AndroidXUiPlugin.applyAndConfigureKotlinPlugin(project)
+
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
+
+ if(!AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block below
+ */
+
+ api "androidx.annotation:annotation:1.1.0"
+ api project(":compose:animation:animation-core")
+ api project(":compose:foundation:foundation-layout")
+ api project(":compose:runtime:runtime")
+ api project(":compose:ui:ui")
+ api project(":compose:ui:ui-geometry")
+
+ implementation project(":compose:ui:ui-util")
+ implementation(KOTLIN_STDLIB_COMMON)
+
+ testImplementation(ANDROIDX_TEST_RULES)
+ testImplementation(ANDROIDX_TEST_RUNNER)
+ testImplementation(JUNIT)
+
+ androidTestImplementation project(":compose:foundation:foundation")
+ androidTestImplementation project(":ui:ui-test")
+ androidTestImplementation(ANDROIDX_TEST_RULES)
+ androidTestImplementation(ANDROIDX_TEST_RUNNER)
+ androidTestImplementation(JUNIT)
+ }
}
-kotlin {
- android()
- jvm("desktop")
+if(AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ kotlin {
+ android()
+ jvm("desktop")
- sourceSets {
- commonMain.dependencies {
- implementation(KOTLIN_STDLIB_COMMON)
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block above
+ */
+ sourceSets {
+ commonMain.dependencies {
+ implementation(KOTLIN_STDLIB_COMMON)
- api project(":compose:animation:animation-core")
- api project(":compose:foundation:foundation-layout")
- api project(":compose:runtime:runtime")
- api project(":compose:ui:ui")
- api project(":compose:ui:ui-geometry")
+ api project(":compose:animation:animation-core")
+ api project(":compose:foundation:foundation-layout")
+ api project(":compose:runtime:runtime")
+ api project(":compose:ui:ui")
+ api project(":compose:ui:ui-geometry")
- implementation project(":compose:ui:ui-util")
- }
+ implementation project(":compose:ui:ui-util")
+ }
- androidMain.dependencies {
- api "androidx.annotation:annotation:1.1.0"
- }
+ androidMain.dependencies {
+ api "androidx.annotation:annotation:1.1.0"
+ }
- androidTest.dependencies {
- implementation(ANDROIDX_TEST_RULES)
- implementation(ANDROIDX_TEST_RUNNER)
- implementation(JUNIT)
- }
+ androidTest.dependencies {
+ implementation(ANDROIDX_TEST_RULES)
+ implementation(ANDROIDX_TEST_RUNNER)
+ implementation(JUNIT)
+ }
- androidAndroidTest.dependencies {
- implementation(ANDROIDX_TEST_RULES)
- implementation(ANDROIDX_TEST_RUNNER)
- implementation(JUNIT)
- implementation project(":compose:foundation:foundation")
- implementation project(":ui:ui-test")
+ androidAndroidTest.dependencies {
+ implementation(ANDROIDX_TEST_RULES)
+ implementation(ANDROIDX_TEST_RUNNER)
+ implementation(JUNIT)
+ implementation project(":compose:foundation:foundation")
+ implementation project(":ui:ui-test")
+ }
}
}
}
diff --git a/compose/animation/animation/integration-tests/animation-demos/build.gradle b/compose/animation/animation/integration-tests/animation-demos/build.gradle
index 3f8a7c4..043cb3a 100644
--- a/compose/animation/animation/integration-tests/animation-demos/build.gradle
+++ b/compose/animation/animation/integration-tests/animation-demos/build.gradle
@@ -10,7 +10,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
diff --git a/compose/animation/animation/samples/build.gradle b/compose/animation/animation/samples/build.gradle
index f8b4cb5..3e5aef0 100644
--- a/compose/animation/animation/samples/build.gradle
+++ b/compose/animation/animation/samples/build.gradle
@@ -29,7 +29,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
diff --git a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/KtxCrossModuleTests.kt b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/KtxCrossModuleTests.kt
index ecd7e7e..a63f6f7 100644
--- a/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/KtxCrossModuleTests.kt
+++ b/compose/compiler/compiler-hosted/integration-tests/src/test/java/androidx/compose/compiler/plugins/kotlin/KtxCrossModuleTests.kt
@@ -830,6 +830,45 @@
}
}
+ /**
+ * Test for b/169071070
+ */
+ @Test
+ fun testCrossModule_ComposableInterfaceFunctionWithInlineClasses(): Unit = ensureSetup {
+ compile(
+ mapOf(
+ "library module" to mapOf (
+ "x/Library.kt" to """
+ package x
+
+ import androidx.compose.runtime.Composable
+
+ inline class InlineClass(val value: Float)
+
+ interface Foo {
+ @Composable
+ fun apply(value: InlineClass)
+ }
+ """.trimIndent()
+ ),
+ "Main" to mapOf(
+ "y/Impl.kt" to """
+ package y
+
+ import androidx.compose.runtime.Composable
+ import x.Foo
+ import x.InlineClass
+
+ object Bar : Foo {
+ @Composable
+ override fun apply(value: InlineClass) {}
+ }
+ """.trimIndent()
+ )
+ )
+ )
+ }
+
fun compile(
modules: Map<String, Map<String, String>>,
dumpClasses: Boolean = false,
diff --git a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ComposerParamTransformer.kt b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ComposerParamTransformer.kt
index 43aef7b..f8bf938 100644
--- a/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ComposerParamTransformer.kt
+++ b/compose/compiler/compiler-hosted/src/main/java/androidx/compose/compiler/plugins/kotlin/lower/ComposerParamTransformer.kt
@@ -500,7 +500,10 @@
type = newType, varargElementType = param.varargElementType,
isCrossinline = param.isCrossinline,
isNoinline = param.isNoinline
- ).also { it.defaultValue = param.defaultValue }
+ ).also {
+ it.defaultValue = param.defaultValue
+ it.parent = param.parent
+ }
}
val valueParametersMapping = explicitParameters
diff --git a/compose/desktop/desktop/build.gradle b/compose/desktop/desktop/build.gradle
index c78c311..9d50583 100644
--- a/compose/desktop/desktop/build.gradle
+++ b/compose/desktop/desktop/build.gradle
@@ -26,7 +26,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
}
kotlin {
diff --git a/compose/desktop/desktop/samples/build.gradle b/compose/desktop/desktop/samples/build.gradle
index 74ba22e..70583fc 100644
--- a/compose/desktop/desktop/samples/build.gradle
+++ b/compose/desktop/desktop/samples/build.gradle
@@ -27,7 +27,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
}
kotlin {
diff --git a/compose/foundation/foundation-layout/build.gradle b/compose/foundation/foundation-layout/build.gradle
index 3fecc34..ca37fa4 100644
--- a/compose/foundation/foundation-layout/build.gradle
+++ b/compose/foundation/foundation-layout/build.gradle
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+
+import androidx.build.AndroidXUiPlugin
import androidx.build.LibraryGroups
import androidx.build.LibraryVersions
import androidx.build.Publish
@@ -25,50 +27,84 @@
id("AndroidXPlugin")
id("com.android.library")
id("AndroidXUiPlugin")
- id("kotlin-multiplatform")
}
+AndroidXUiPlugin.applyAndConfigureKotlinPlugin(project)
+
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
+
+ if(!AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block below
+ */
+
+ api "androidx.annotation:annotation:1.1.0"
+ api project(":compose:ui:ui")
+
+ implementation project(":compose:foundation:foundation-text")
+ implementation project(":compose:runtime:runtime")
+ implementation project(":compose:ui:ui-util")
+ implementation(CONSTRAINT_LAYOUT_CORE)
+ implementation(KOTLIN_STDLIB_COMMON)
+
+ testImplementation(ANDROIDX_TEST_RULES)
+ testImplementation(ANDROIDX_TEST_RUNNER)
+ testImplementation(JUNIT)
+
+ androidTestImplementation project(":compose:foundation:foundation")
+ androidTestImplementation project(":ui:ui-test")
+ androidTestImplementation(ANDROIDX_TEST_RULES)
+ androidTestImplementation(ANDROIDX_TEST_RUNNER)
+ androidTestImplementation(JUNIT)
+ androidTestImplementation(TRUTH)
+ }
}
-kotlin {
- android()
- jvm("desktop")
+if(AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ kotlin {
+ android()
+ jvm("desktop")
- sourceSets {
- commonMain.dependencies {
- implementation(KOTLIN_STDLIB_COMMON)
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block above
+ */
+ sourceSets {
+ commonMain.dependencies {
+ implementation(KOTLIN_STDLIB_COMMON)
- api project(":compose:ui:ui")
- implementation project(":compose:foundation:foundation-text")
- implementation project(":compose:runtime:runtime")
- implementation project(":compose:ui:ui-util")
- }
+ api project(":compose:ui:ui")
+ implementation project(":compose:foundation:foundation-text")
+ implementation project(":compose:runtime:runtime")
+ implementation project(":compose:ui:ui-util")
+ }
- androidMain.dependencies {
- api "androidx.annotation:annotation:1.1.0"
- implementation(CONSTRAINT_LAYOUT_CORE)
- }
+ androidMain.dependencies {
+ api "androidx.annotation:annotation:1.1.0"
+ implementation(CONSTRAINT_LAYOUT_CORE)
+ }
- desktopMain.dependencies {
- implementation(KOTLIN_STDLIB)
- }
+ desktopMain.dependencies {
+ implementation(KOTLIN_STDLIB)
+ }
- androidTest.dependencies {
- implementation(ANDROIDX_TEST_RULES)
- implementation(ANDROIDX_TEST_RUNNER)
- implementation(JUNIT)
- }
+ androidTest.dependencies {
+ implementation(ANDROIDX_TEST_RULES)
+ implementation(ANDROIDX_TEST_RUNNER)
+ implementation(JUNIT)
+ }
- androidAndroidTest.dependencies {
- implementation project(":compose:foundation:foundation")
- implementation project(":ui:ui-test")
+ androidAndroidTest.dependencies {
+ implementation project(":compose:foundation:foundation")
+ implementation project(":ui:ui-test")
- implementation(ANDROIDX_TEST_RULES)
- implementation(ANDROIDX_TEST_RUNNER)
- implementation(JUNIT)
- implementation(TRUTH)
+ implementation(ANDROIDX_TEST_RULES)
+ implementation(ANDROIDX_TEST_RUNNER)
+ implementation(JUNIT)
+ implementation(TRUTH)
+ }
}
}
}
diff --git a/compose/foundation/foundation-layout/integration-tests/layout-demos/build.gradle b/compose/foundation/foundation-layout/integration-tests/layout-demos/build.gradle
index bce0020..f83dc4e 100644
--- a/compose/foundation/foundation-layout/integration-tests/layout-demos/build.gradle
+++ b/compose/foundation/foundation-layout/integration-tests/layout-demos/build.gradle
@@ -26,7 +26,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
diff --git a/compose/foundation/foundation-layout/samples/build.gradle b/compose/foundation/foundation-layout/samples/build.gradle
index c97f30c..9803900 100644
--- a/compose/foundation/foundation-layout/samples/build.gradle
+++ b/compose/foundation/foundation-layout/samples/build.gradle
@@ -29,7 +29,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
diff --git a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/LayoutSizeTest.kt b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/LayoutSizeTest.kt
index 1ab40a2..dee2483 100644
--- a/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/LayoutSizeTest.kt
+++ b/compose/foundation/foundation-layout/src/androidAndroidTest/kotlin/androidx/compose/foundation/layout/LayoutSizeTest.kt
@@ -1118,29 +1118,20 @@
@Test
fun testInspectableParameter() {
- checkModifier(
- Modifier.width(200.0.dp), "width", 200.0.dp,
- listOf(ValueElement("width", 200.0.dp))
- )
- checkModifier(
- Modifier.height(300.0.dp), "height", 300.0.dp,
- listOf(ValueElement("height", 300.0.dp))
- )
- checkModifier(
- Modifier.size(400.0.dp), "size", 400.0.dp,
- listOf(ValueElement("size", 400.0.dp))
- )
+ checkModifier(Modifier.width(200.0.dp), "width", 200.0.dp, listOf())
+ checkModifier(Modifier.height(300.0.dp), "height", 300.0.dp, listOf())
+ checkModifier(Modifier.size(400.0.dp), "size", 400.0.dp, listOf())
checkModifier(
Modifier.size(100.0.dp, 200.0.dp), "size", null,
listOf(ValueElement("width", 100.0.dp), ValueElement("height", 200.0.dp))
)
checkModifier(
Modifier.widthIn(100.0.dp, 200.0.dp), "widthIn", null,
- listOf(ValueElement("minWidth", 100.0.dp), ValueElement("maxWidth", 200.0.dp))
+ listOf(ValueElement("min", 100.0.dp), ValueElement("max", 200.0.dp))
)
checkModifier(
Modifier.heightIn(10.0.dp, 200.0.dp), "heightIn", null,
- listOf(ValueElement("minHeight", 10.0.dp), ValueElement("maxHeight", 200.0.dp))
+ listOf(ValueElement("min", 10.0.dp), ValueElement("max", 200.0.dp))
)
checkModifier(
Modifier.sizeIn(10.dp, 20.dp, 30.dp, 40.dp), "sizeIn", null,
@@ -1149,29 +1140,20 @@
ValueElement("maxWidth", 30.dp), ValueElement("maxHeight", 40.dp)
)
)
- checkModifier(
- Modifier.preferredWidth(200.0.dp), "preferredWidth", 200.0.dp,
- listOf(ValueElement("width", 200.0.dp))
- )
- checkModifier(
- Modifier.preferredHeight(300.0.dp), "preferredHeight", 300.0.dp,
- listOf(ValueElement("height", 300.0.dp))
- )
- checkModifier(
- Modifier.preferredSize(400.0.dp), "preferredSize", 400.0.dp,
- listOf(ValueElement("size", 400.0.dp))
- )
+ checkModifier(Modifier.preferredWidth(200.0.dp), "preferredWidth", 200.0.dp, listOf())
+ checkModifier(Modifier.preferredHeight(300.0.dp), "preferredHeight", 300.0.dp, listOf())
+ checkModifier(Modifier.preferredSize(400.0.dp), "preferredSize", 400.0.dp, listOf())
checkModifier(
Modifier.preferredSize(100.0.dp, 200.0.dp), "preferredSize", null,
listOf(ValueElement("width", 100.0.dp), ValueElement("height", 200.0.dp))
)
checkModifier(
Modifier.preferredWidthIn(100.0.dp, 200.0.dp), "preferredWidthIn", null,
- listOf(ValueElement("minWidth", 100.0.dp), ValueElement("maxWidth", 200.0.dp))
+ listOf(ValueElement("min", 100.0.dp), ValueElement("max", 200.0.dp))
)
checkModifier(
Modifier.preferredHeightIn(10.0.dp, 200.0.dp), "preferredHeightIn", null,
- listOf(ValueElement("minHeight", 10.0.dp), ValueElement("maxHeight", 200.0.dp))
+ listOf(ValueElement("min", 10.0.dp), ValueElement("max", 200.0.dp))
)
checkModifier(
Modifier.preferredSizeIn(10.dp, 20.dp, 30.dp, 40.dp), "preferredSizeIn", null,
@@ -1181,21 +1163,72 @@
)
)
- checkModifier(Modifier.fillMaxWidth(), "fillMaxWidth", null, listOf())
- checkModifier(Modifier.fillMaxHeight(), "fillMaxHeight", null, listOf())
- checkModifier(Modifier.fillMaxSize(), "fillMaxSize", null, listOf())
+ checkModifier(
+ Modifier.fillMaxWidth(), "fillMaxWidth", null,
+ listOf(ValueElement("fraction", 1.0f))
+ )
+ checkModifier(
+ Modifier.fillMaxWidth(0.7f), "fillMaxWidth", null,
+ listOf(ValueElement("fraction", 0.7f))
+ )
+ checkModifier(
+ Modifier.fillMaxHeight(), "fillMaxHeight", null,
+ listOf(ValueElement("fraction", 1.0f))
+ )
+ checkModifier(
+ Modifier.fillMaxHeight(0.15f), "fillMaxHeight", null,
+ listOf(ValueElement("fraction", 0.15f))
+ )
+ checkModifier(
+ Modifier.fillMaxSize(), "fillMaxSize", null,
+ listOf(ValueElement("fraction", 1.0f))
+ )
+ checkModifier(
+ Modifier.fillMaxSize(0.25f), "fillMaxSize", null,
+ listOf(ValueElement("fraction", 0.25f))
+ )
checkModifier(
Modifier.wrapContentWidth(), "wrapContentWidth", null,
- listOf(ValueElement("alignment", Alignment.CenterHorizontally))
+ listOf(
+ ValueElement("align", Alignment.CenterHorizontally),
+ ValueElement("unbounded", false)
+ )
+ )
+ checkModifier(
+ Modifier.wrapContentWidth(Alignment.End, true), "wrapContentWidth", null,
+ listOf(
+ ValueElement("align", Alignment.End),
+ ValueElement("unbounded", true)
+ )
)
checkModifier(
Modifier.wrapContentHeight(), "wrapContentHeight", null,
- listOf(ValueElement("alignment", Alignment.CenterVertically))
+ listOf(
+ ValueElement("align", Alignment.CenterVertically),
+ ValueElement("unbounded", false)
+ )
+ )
+ checkModifier(
+ Modifier.wrapContentHeight(Alignment.Bottom, true), "wrapContentHeight", null,
+ listOf(
+ ValueElement("align", Alignment.Bottom),
+ ValueElement("unbounded", true)
+ )
)
checkModifier(
Modifier.wrapContentSize(), "wrapContentSize", null,
- listOf(ValueElement("alignment", Alignment.Center))
+ listOf(
+ ValueElement("align", Alignment.Center),
+ ValueElement("unbounded", false)
+ )
+ )
+ checkModifier(
+ Modifier.wrapContentSize(Alignment.BottomCenter, true), "wrapContentSize", null,
+ listOf(
+ ValueElement("align", Alignment.BottomCenter),
+ ValueElement("unbounded", true)
+ )
)
checkModifier(
diff --git a/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/LayoutSize.kt b/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/LayoutSize.kt
index 77edd9d..d5c9d38 100644
--- a/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/LayoutSize.kt
+++ b/compose/foundation/foundation-layout/src/commonMain/kotlin/androidx/compose/foundation/layout/LayoutSize.kt
@@ -24,8 +24,9 @@
import androidx.compose.ui.Modifier
import androidx.compose.ui.layout.IntrinsicMeasurable
import androidx.compose.ui.layout.IntrinsicMeasureScope
-import androidx.compose.ui.platform.InspectableValue
-import androidx.compose.ui.platform.ValueElement
+import androidx.compose.ui.platform.InspectorInfo
+import androidx.compose.ui.platform.InspectorValueInfo
+import androidx.compose.ui.platform.debugInspectorInfo
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.Density
import androidx.compose.ui.unit.Dp
@@ -50,7 +51,17 @@
* @sample androidx.compose.foundation.layout.samples.SimplePreferredWidthModifier
*/
@Stable
-fun Modifier.preferredWidth(width: Dp) = preferredSizeIn(minWidth = width, maxWidth = width)
+fun Modifier.preferredWidth(width: Dp) = this.then(
+ SizeModifier(
+ minWidth = width,
+ maxWidth = width,
+ enforceIncoming = true,
+ inspectorInfo = debugInspectorInfo {
+ name = "preferredWidth"
+ value = width
+ }
+ )
+)
/**
* Declare the preferred height of the content to be exactly [height]dp. The incoming measurement
@@ -64,7 +75,17 @@
* @sample androidx.compose.foundation.layout.samples.SimplePreferredHeightModifier
*/
@Stable
-fun Modifier.preferredHeight(height: Dp) = preferredSizeIn(minHeight = height, maxHeight = height)
+fun Modifier.preferredHeight(height: Dp) = this.then(
+ SizeModifier(
+ minHeight = height,
+ maxHeight = height,
+ enforceIncoming = true,
+ inspectorInfo = debugInspectorInfo {
+ name = "preferredHeight"
+ value = height
+ }
+ )
+)
/**
* Declare the preferred size of the content to be exactly [size]dp square. The incoming measurement
@@ -78,7 +99,19 @@
* @sample androidx.compose.foundation.layout.samples.SimplePreferredSizeModifier
*/
@Stable
-fun Modifier.preferredSize(size: Dp) = preferredSizeIn(size, size, size, size)
+fun Modifier.preferredSize(size: Dp) = this.then(
+ SizeModifier(
+ minWidth = size,
+ maxWidth = size,
+ minHeight = size,
+ maxHeight = size,
+ enforceIncoming = true,
+ inspectorInfo = debugInspectorInfo {
+ name = "preferredSize"
+ value = size
+ }
+ )
+)
/**
* Declare the preferred size of the content to be exactly [width]dp by [height]dp. The incoming
@@ -93,11 +126,19 @@
* @sample androidx.compose.foundation.layout.samples.SimplePreferredSizeModifier
*/
@Stable
-fun Modifier.preferredSize(width: Dp, height: Dp) = preferredSizeIn(
- minWidth = width,
- maxWidth = width,
- minHeight = height,
- maxHeight = height
+fun Modifier.preferredSize(width: Dp, height: Dp) = this.then(
+ SizeModifier(
+ minWidth = width,
+ maxWidth = width,
+ minHeight = height,
+ maxHeight = height,
+ enforceIncoming = true,
+ inspectorInfo = debugInspectorInfo {
+ name = "preferredSize"
+ properties["width"] = width
+ properties["height"] = height
+ }
+ )
)
/**
@@ -110,7 +151,18 @@
fun Modifier.preferredWidthIn(
min: Dp = Dp.Unspecified,
max: Dp = Dp.Unspecified
-) = preferredSizeIn(minWidth = min, maxWidth = max)
+) = this.then(
+ SizeModifier(
+ minWidth = min,
+ maxWidth = max,
+ enforceIncoming = true,
+ inspectorInfo = debugInspectorInfo {
+ name = "preferredWidthIn"
+ properties["min"] = min
+ properties["max"] = max
+ }
+ )
+)
/**
* Constrain the height of the content to be between [min]dp and [max]dp as permitted
@@ -122,7 +174,18 @@
fun Modifier.preferredHeightIn(
min: Dp = Dp.Unspecified,
max: Dp = Dp.Unspecified
-) = preferredSizeIn(minHeight = min, maxHeight = max)
+) = this.then(
+ SizeModifier(
+ minHeight = min,
+ maxHeight = max,
+ enforceIncoming = true,
+ inspectorInfo = debugInspectorInfo {
+ name = "preferredHeightIn"
+ properties["min"] = min
+ properties["max"] = max
+ }
+ )
+)
/**
* Constrain the size of the content to be within [constraints] as permitted by the incoming
@@ -155,7 +218,22 @@
minHeight: Dp = Dp.Unspecified,
maxWidth: Dp = Dp.Unspecified,
maxHeight: Dp = Dp.Unspecified
-) = this.then(SizeModifier(minWidth, minHeight, maxWidth, maxHeight, true))
+) = this.then(
+ SizeModifier(
+ minWidth = minWidth,
+ minHeight = minHeight,
+ maxWidth = maxWidth,
+ maxHeight = maxHeight,
+ enforceIncoming = true,
+ inspectorInfo = debugInspectorInfo {
+ name = "preferredSizeIn"
+ properties["minWidth"] = minWidth
+ properties["minHeight"] = minHeight
+ properties["maxWidth"] = maxWidth
+ properties["maxHeight"] = maxHeight
+ }
+ )
+)
/**
* Declare the width of the content to be exactly [width]dp. The incoming measurement
@@ -173,7 +251,17 @@
* @sample androidx.compose.foundation.layout.samples.SimpleWidthModifier
*/
@Stable
-fun Modifier.width(width: Dp) = sizeIn(minWidth = width, maxWidth = width)
+fun Modifier.width(width: Dp) = this.then(
+ SizeModifier(
+ minWidth = width,
+ maxWidth = width,
+ enforceIncoming = false,
+ inspectorInfo = debugInspectorInfo {
+ name = "width"
+ value = width
+ }
+ )
+)
/**
* Declare the height of the content to be exactly [height]dp. The incoming measurement
@@ -191,7 +279,17 @@
* @sample androidx.compose.foundation.layout.samples.SimpleHeightModifier
*/
@Stable
-fun Modifier.height(height: Dp) = sizeIn(minHeight = height, maxHeight = height)
+fun Modifier.height(height: Dp) = this.then(
+ SizeModifier(
+ minHeight = height,
+ maxHeight = height,
+ enforceIncoming = false,
+ inspectorInfo = debugInspectorInfo {
+ name = "height"
+ value = height
+ }
+ )
+)
/**
* Declare the size of the content to be exactly [size]dp width and height. The incoming measurement
@@ -209,7 +307,19 @@
* @sample androidx.compose.foundation.layout.samples.SimpleSizeModifier
*/
@Stable
-fun Modifier.size(size: Dp) = sizeIn(size, size, size, size)
+fun Modifier.size(size: Dp) = this.then(
+ SizeModifier(
+ minWidth = size,
+ maxWidth = size,
+ minHeight = size,
+ maxHeight = size,
+ enforceIncoming = false,
+ inspectorInfo = debugInspectorInfo {
+ name = "size"
+ value = size
+ }
+ )
+)
/**
* Declare the size of the content to be exactly [width]dp and [height]dp. The incoming measurement
@@ -227,11 +337,19 @@
* @sample androidx.compose.foundation.layout.samples.SimpleWidthModifier
*/
@Stable
-fun Modifier.size(width: Dp, height: Dp) = sizeIn(
- minWidth = width,
- maxWidth = width,
- minHeight = height,
- maxHeight = height
+fun Modifier.size(width: Dp, height: Dp) = this.then(
+ SizeModifier(
+ minWidth = width,
+ maxWidth = width,
+ minHeight = height,
+ maxHeight = height,
+ enforceIncoming = false,
+ inspectorInfo = debugInspectorInfo {
+ name = "size"
+ properties["width"] = width
+ properties["height"] = height
+ }
+ )
)
/**
@@ -245,7 +363,18 @@
fun Modifier.widthIn(
min: Dp = Dp.Unspecified,
max: Dp = Dp.Unspecified
-) = sizeIn(minWidth = min, maxWidth = max)
+) = this.then(
+ SizeModifier(
+ minWidth = min,
+ maxWidth = max,
+ enforceIncoming = false,
+ inspectorInfo = debugInspectorInfo {
+ name = "widthIn"
+ properties["min"] = min
+ properties["max"] = max
+ }
+ )
+)
/**
* Constrain the height of the content to be between [min]dp and [max]dp.
@@ -258,7 +387,18 @@
fun Modifier.heightIn(
min: Dp = Dp.Unspecified,
max: Dp = Dp.Unspecified
-) = sizeIn(minHeight = min, maxHeight = max)
+) = this.then(
+ SizeModifier(
+ minHeight = min,
+ maxHeight = max,
+ enforceIncoming = false,
+ inspectorInfo = debugInspectorInfo {
+ name = "heightIn"
+ properties["min"] = min
+ properties["max"] = max
+ }
+ )
+)
/**
* Constrain the size of the content to be within [constraints].
@@ -294,7 +434,22 @@
minHeight: Dp = Dp.Unspecified,
maxWidth: Dp = Dp.Unspecified,
maxHeight: Dp = Dp.Unspecified
-) = this.then(SizeModifier(minWidth, minHeight, maxWidth, maxHeight, false))
+) = this.then(
+ SizeModifier(
+ minWidth = minWidth,
+ minHeight = minHeight,
+ maxWidth = maxWidth,
+ maxHeight = maxHeight,
+ enforceIncoming = false,
+ inspectorInfo = debugInspectorInfo {
+ name = "sizeIn"
+ properties["minWidth"] = minWidth
+ properties["minHeight"] = minHeight
+ properties["maxWidth"] = maxWidth
+ properties["maxHeight"] = maxHeight
+ }
+ )
+)
/**
* Have the content fill (possibly only partially) the [Constraints.maxWidth] of the incoming
@@ -310,7 +465,16 @@
*/
@Stable
fun Modifier.fillMaxWidth(@FloatRange(from = 0.0, to = 1.0) fraction: Float = 1f) =
- this.then(FillModifier(Direction.Horizontal, fraction))
+ this.then(
+ FillModifier(
+ direction = Direction.Horizontal,
+ scale = fraction,
+ inspectorInfo = debugInspectorInfo {
+ name = "fillMaxWidth"
+ properties["fraction"] = fraction
+ }
+ )
+ )
/**
* Have the content fill (possibly only partially) the [Constraints.maxHeight] of the incoming
@@ -326,7 +490,16 @@
*/
@Stable
fun Modifier.fillMaxHeight(@FloatRange(from = 0.0, to = 1.0) fraction: Float = 1f) =
- this.then(FillModifier(Direction.Vertical, fraction))
+ this.then(
+ FillModifier(
+ direction = Direction.Vertical,
+ scale = fraction,
+ inspectorInfo = debugInspectorInfo {
+ name = "fillMaxHeight"
+ properties["fraction"] = fraction
+ }
+ )
+ )
/**
* Have the content fill (possibly only partially) the [Constraints.maxWidth] and
@@ -346,7 +519,16 @@
*/
@Stable
fun Modifier.fillMaxSize(@FloatRange(from = 0.0, to = 1.0) fraction: Float = 1f) =
- this.then(FillModifier(Direction.Both, fraction))
+ this.then(
+ FillModifier(
+ direction = Direction.Both,
+ scale = fraction,
+ inspectorInfo = debugInspectorInfo {
+ name = "fillMaxSize"
+ properties["fraction"] = fraction
+ }
+ )
+ )
/**
* Allow the content to measure at its desired width without regard for the incoming measurement
@@ -366,9 +548,18 @@
align: Alignment.Horizontal = Alignment.CenterHorizontally,
unbounded: Boolean = false
) = this.then(
- WrapContentModifier(Direction.Horizontal, align, unbounded) { size, layoutDirection ->
- IntOffset(align.align(size.width, layoutDirection), 0)
- }
+ WrapContentModifier(
+ direction = Direction.Horizontal,
+ unbounded = unbounded,
+ alignmentCallback = { size, layoutDirection ->
+ IntOffset(align.align(size.width, layoutDirection), 0)
+ },
+ inspectorInfo = debugInspectorInfo {
+ name = "wrapContentWidth"
+ properties["align"] = align
+ properties["unbounded"] = unbounded
+ }
+ )
)
/**
@@ -388,9 +579,18 @@
align: Alignment.Vertical = Alignment.CenterVertically,
unbounded: Boolean = false
) = this.then(
- WrapContentModifier(Direction.Vertical, align, unbounded) { size, _ ->
- IntOffset(0, align.align(size.height))
- }
+ WrapContentModifier(
+ direction = Direction.Vertical,
+ unbounded = unbounded,
+ alignmentCallback = { size, _ ->
+ IntOffset(0, align.align(size.height))
+ },
+ inspectorInfo = debugInspectorInfo {
+ name = "wrapContentHeight"
+ properties["align"] = align
+ properties["unbounded"] = unbounded
+ }
+ )
)
/**
@@ -409,9 +609,18 @@
align: Alignment = Alignment.Center,
unbounded: Boolean = false
) = this.then(
- WrapContentModifier(Direction.Both, align, unbounded) { size, layoutDirection ->
- align.align(size, layoutDirection)
- }
+ WrapContentModifier(
+ direction = Direction.Both,
+ unbounded = unbounded,
+ alignmentCallback = { size, layoutDirection ->
+ align.align(size, layoutDirection)
+ },
+ inspectorInfo = debugInspectorInfo {
+ name = "wrapContentSize"
+ properties["align"] = align
+ properties["unbounded"] = unbounded
+ }
+ )
)
/**
@@ -428,12 +637,23 @@
fun Modifier.defaultMinSizeConstraints(
minWidth: Dp = Dp.Unspecified,
minHeight: Dp = Dp.Unspecified
-) = this.then(UnspecifiedConstraintsModifier(minWidth, minHeight))
+) = this.then(
+ UnspecifiedConstraintsModifier(
+ minWidth = minWidth,
+ minHeight = minHeight,
+ inspectorInfo = debugInspectorInfo {
+ name = "defaultMinSizeConstraints"
+ properties["minWidth"] = minWidth
+ properties["minHeight"] = minHeight
+ }
+ )
+)
-private data class FillModifier(
+private class FillModifier(
private val direction: Direction,
- private val scale: Float
-) : LayoutModifier, InspectableValue {
+ private val scale: Float,
+ inspectorInfo: InspectorInfo.() -> Unit
+) : LayoutModifier, InspectorValueInfo(inspectorInfo) {
override fun MeasureScope.measure(
measurable: Measurable,
constraints: Constraints
@@ -468,24 +688,16 @@
placeable.placeRelative(0, 0)
}
}
-
- override val nameFallback: String =
- when (direction) {
- Direction.Vertical -> "fillMaxHeight"
- Direction.Horizontal -> "fillMaxWidth"
- Direction.Both -> "fillMaxSize"
- }
-
- override val inspectableElements: Sequence<ValueElement> = emptySequence()
}
-private data class SizeModifier(
+private class SizeModifier(
private val minWidth: Dp = Dp.Unspecified,
private val minHeight: Dp = Dp.Unspecified,
private val maxWidth: Dp = Dp.Unspecified,
private val maxHeight: Dp = Dp.Unspecified,
- private val enforceIncoming: Boolean
-) : LayoutModifier, InspectableValue {
+ private val enforceIncoming: Boolean,
+ inspectorInfo: InspectorInfo.() -> Unit
+) : LayoutModifier, InspectorValueInfo(inspectorInfo) {
private val Density.targetConstraints
get() = Constraints(
minWidth = if (minWidth != Dp.Unspecified) minWidth.toIntPx() else 0,
@@ -571,70 +783,14 @@
val constraints = targetConstraints
constraints.constrainHeight(it)
}
-
- override val nameFallback: String
- get() {
- val name = simpleName
- return if (enforceIncoming) "preferred${simpleName.capitalize()}" else name
- }
-
- override val valueOverride: Any?
- get() = when (simpleName) {
- "width" -> minWidth
- "height" -> minHeight
- "size" -> if (minWidth == minHeight) minWidth else null
- else -> null
- }
-
- override val inspectableElements: Sequence<ValueElement>
- get() = when (simpleName) {
- "width" -> sequenceOf(ValueElement("width", minWidth))
- "height" -> sequenceOf(ValueElement("height", minHeight))
- "size" ->
- if (minWidth == minHeight) {
- sequenceOf(ValueElement("size", minWidth))
- } else sequenceOf(
- ValueElement("width", minWidth),
- ValueElement("height", minHeight)
- )
- "widthIn" -> sequenceOf(
- ValueElement("minWidth", minWidth),
- ValueElement("maxWidth", maxWidth)
- )
- "heightIn" -> sequenceOf(
- ValueElement("minHeight", minHeight),
- ValueElement("maxHeight", maxHeight)
- )
- else -> sequenceOf(
- ValueElement("minWidth", minWidth),
- ValueElement("minHeight", minHeight),
- ValueElement("maxWidth", maxWidth),
- ValueElement("maxHeight", maxHeight)
- )
- }
-
- private val simpleName: String =
- if (minWidth == maxWidth && minHeight == maxHeight) {
- when {
- minHeight == Dp.Unspecified -> "width"
- minWidth == Dp.Unspecified -> "height"
- else -> "size"
- }
- } else {
- when {
- minHeight == Dp.Unspecified && maxHeight == Dp.Unspecified -> "widthIn"
- minWidth == Dp.Unspecified && maxWidth == Dp.Unspecified -> "heightIn"
- else -> "sizeIn"
- }
- }
}
-private data class WrapContentModifier(
+private class WrapContentModifier(
private val direction: Direction,
- private val alignment: Any,
private val unbounded: Boolean,
- private val alignmentCallback: (IntSize, LayoutDirection) -> IntOffset
-) : LayoutModifier, InspectableValue {
+ private val alignmentCallback: (IntSize, LayoutDirection) -> IntOffset,
+ inspectorInfo: InspectorInfo.() -> Unit
+) : LayoutModifier, InspectorValueInfo(inspectorInfo) {
override fun MeasureScope.measure(
measurable: Measurable,
constraints: Constraints
@@ -667,22 +823,13 @@
placeable.place(position)
}
}
-
- override val nameFallback: String =
- when (direction) {
- Direction.Vertical -> "wrapContentHeight"
- Direction.Horizontal -> "wrapContentWidth"
- Direction.Both -> "wrapContentSize"
- }
-
- override val inspectableElements: Sequence<ValueElement>
- get() = sequenceOf(ValueElement("alignment", alignment))
}
-private data class UnspecifiedConstraintsModifier(
+private class UnspecifiedConstraintsModifier(
val minWidth: Dp = Dp.Unspecified,
- val minHeight: Dp = Dp.Unspecified
-) : LayoutModifier, InspectableValue {
+ val minHeight: Dp = Dp.Unspecified,
+ inspectorInfo: InspectorInfo.() -> Unit
+) : LayoutModifier, InspectorValueInfo(inspectorInfo) {
override fun MeasureScope.measure(
measurable: Measurable,
constraints: Constraints
@@ -734,14 +881,6 @@
) = measurable.maxIntrinsicHeight(width).coerceAtLeast(
if (minHeight != Dp.Unspecified) minHeight.toIntPx() else 0
)
-
- override val nameFallback = "defaultMinSizeConstraints"
-
- override val inspectableElements: Sequence<ValueElement>
- get() = sequenceOf(
- ValueElement("minWidth", minWidth),
- ValueElement("minHeight", minHeight)
- )
}
internal enum class Direction {
diff --git a/compose/foundation/foundation-text/api/current.txt b/compose/foundation/foundation-text/api/current.txt
index 4084b44..cebd21a 100644
--- a/compose/foundation/foundation-text/api/current.txt
+++ b/compose/foundation/foundation-text/api/current.txt
@@ -2,7 +2,7 @@
package androidx.compose.foundation.text {
public final class CoreTextFieldKt {
- method @androidx.compose.runtime.Composable public static void CoreTextField-5rHpvpc(androidx.compose.ui.text.input.TextFieldValue value, optional androidx.compose.ui.Modifier modifier, kotlin.jvm.functions.Function1<? super androidx.compose.ui.text.input.TextFieldValue,kotlin.Unit> onValueChange, optional androidx.compose.ui.text.TextStyle textStyle, optional androidx.compose.ui.text.input.KeyboardType keyboardType, optional androidx.compose.ui.text.input.ImeAction imeAction, optional kotlin.jvm.functions.Function1<? super androidx.compose.ui.text.input.ImeAction,kotlin.Unit> onImeActionPerformed, optional androidx.compose.ui.text.input.VisualTransformation visualTransformation, optional kotlin.jvm.functions.Function1<? super androidx.compose.ui.text.TextLayoutResult,kotlin.Unit> onTextLayout, optional kotlin.jvm.functions.Function1<? super androidx.compose.ui.text.SoftwareKeyboardController,kotlin.Unit> onTextInputStarted, optional long cursorColor);
+ method @androidx.compose.runtime.Composable public static void CoreTextField-2qr7l3g(androidx.compose.ui.text.input.TextFieldValue value, optional androidx.compose.ui.Modifier modifier, kotlin.jvm.functions.Function1<? super androidx.compose.ui.text.input.TextFieldValue,kotlin.Unit> onValueChange, optional androidx.compose.ui.text.TextStyle textStyle, optional androidx.compose.ui.text.input.KeyboardType keyboardType, optional androidx.compose.ui.text.input.ImeAction imeAction, optional kotlin.jvm.functions.Function1<? super androidx.compose.ui.text.input.ImeAction,kotlin.Unit> onImeActionPerformed, optional androidx.compose.ui.text.input.VisualTransformation visualTransformation, optional kotlin.jvm.functions.Function1<? super androidx.compose.ui.text.TextLayoutResult,kotlin.Unit> onTextLayout, optional kotlin.jvm.functions.Function1<? super androidx.compose.ui.text.SoftwareKeyboardController,kotlin.Unit> onTextInputStarted, optional long cursorColor, optional boolean softWrap);
method @VisibleForTesting public static void setBlinkingCursorEnabled(boolean p);
}
diff --git a/compose/foundation/foundation-text/api/public_plus_experimental_current.txt b/compose/foundation/foundation-text/api/public_plus_experimental_current.txt
index 4084b44..cebd21a 100644
--- a/compose/foundation/foundation-text/api/public_plus_experimental_current.txt
+++ b/compose/foundation/foundation-text/api/public_plus_experimental_current.txt
@@ -2,7 +2,7 @@
package androidx.compose.foundation.text {
public final class CoreTextFieldKt {
- method @androidx.compose.runtime.Composable public static void CoreTextField-5rHpvpc(androidx.compose.ui.text.input.TextFieldValue value, optional androidx.compose.ui.Modifier modifier, kotlin.jvm.functions.Function1<? super androidx.compose.ui.text.input.TextFieldValue,kotlin.Unit> onValueChange, optional androidx.compose.ui.text.TextStyle textStyle, optional androidx.compose.ui.text.input.KeyboardType keyboardType, optional androidx.compose.ui.text.input.ImeAction imeAction, optional kotlin.jvm.functions.Function1<? super androidx.compose.ui.text.input.ImeAction,kotlin.Unit> onImeActionPerformed, optional androidx.compose.ui.text.input.VisualTransformation visualTransformation, optional kotlin.jvm.functions.Function1<? super androidx.compose.ui.text.TextLayoutResult,kotlin.Unit> onTextLayout, optional kotlin.jvm.functions.Function1<? super androidx.compose.ui.text.SoftwareKeyboardController,kotlin.Unit> onTextInputStarted, optional long cursorColor);
+ method @androidx.compose.runtime.Composable public static void CoreTextField-2qr7l3g(androidx.compose.ui.text.input.TextFieldValue value, optional androidx.compose.ui.Modifier modifier, kotlin.jvm.functions.Function1<? super androidx.compose.ui.text.input.TextFieldValue,kotlin.Unit> onValueChange, optional androidx.compose.ui.text.TextStyle textStyle, optional androidx.compose.ui.text.input.KeyboardType keyboardType, optional androidx.compose.ui.text.input.ImeAction imeAction, optional kotlin.jvm.functions.Function1<? super androidx.compose.ui.text.input.ImeAction,kotlin.Unit> onImeActionPerformed, optional androidx.compose.ui.text.input.VisualTransformation visualTransformation, optional kotlin.jvm.functions.Function1<? super androidx.compose.ui.text.TextLayoutResult,kotlin.Unit> onTextLayout, optional kotlin.jvm.functions.Function1<? super androidx.compose.ui.text.SoftwareKeyboardController,kotlin.Unit> onTextInputStarted, optional long cursorColor, optional boolean softWrap);
method @VisibleForTesting public static void setBlinkingCursorEnabled(boolean p);
}
diff --git a/compose/foundation/foundation-text/api/restricted_current.txt b/compose/foundation/foundation-text/api/restricted_current.txt
index 4084b44..cebd21a 100644
--- a/compose/foundation/foundation-text/api/restricted_current.txt
+++ b/compose/foundation/foundation-text/api/restricted_current.txt
@@ -2,7 +2,7 @@
package androidx.compose.foundation.text {
public final class CoreTextFieldKt {
- method @androidx.compose.runtime.Composable public static void CoreTextField-5rHpvpc(androidx.compose.ui.text.input.TextFieldValue value, optional androidx.compose.ui.Modifier modifier, kotlin.jvm.functions.Function1<? super androidx.compose.ui.text.input.TextFieldValue,kotlin.Unit> onValueChange, optional androidx.compose.ui.text.TextStyle textStyle, optional androidx.compose.ui.text.input.KeyboardType keyboardType, optional androidx.compose.ui.text.input.ImeAction imeAction, optional kotlin.jvm.functions.Function1<? super androidx.compose.ui.text.input.ImeAction,kotlin.Unit> onImeActionPerformed, optional androidx.compose.ui.text.input.VisualTransformation visualTransformation, optional kotlin.jvm.functions.Function1<? super androidx.compose.ui.text.TextLayoutResult,kotlin.Unit> onTextLayout, optional kotlin.jvm.functions.Function1<? super androidx.compose.ui.text.SoftwareKeyboardController,kotlin.Unit> onTextInputStarted, optional long cursorColor);
+ method @androidx.compose.runtime.Composable public static void CoreTextField-2qr7l3g(androidx.compose.ui.text.input.TextFieldValue value, optional androidx.compose.ui.Modifier modifier, kotlin.jvm.functions.Function1<? super androidx.compose.ui.text.input.TextFieldValue,kotlin.Unit> onValueChange, optional androidx.compose.ui.text.TextStyle textStyle, optional androidx.compose.ui.text.input.KeyboardType keyboardType, optional androidx.compose.ui.text.input.ImeAction imeAction, optional kotlin.jvm.functions.Function1<? super androidx.compose.ui.text.input.ImeAction,kotlin.Unit> onImeActionPerformed, optional androidx.compose.ui.text.input.VisualTransformation visualTransformation, optional kotlin.jvm.functions.Function1<? super androidx.compose.ui.text.TextLayoutResult,kotlin.Unit> onTextLayout, optional kotlin.jvm.functions.Function1<? super androidx.compose.ui.text.SoftwareKeyboardController,kotlin.Unit> onTextInputStarted, optional long cursorColor, optional boolean softWrap);
method @VisibleForTesting public static void setBlinkingCursorEnabled(boolean p);
}
diff --git a/compose/foundation/foundation-text/build.gradle b/compose/foundation/foundation-text/build.gradle
index 4d36bda..0acccf9 100644
--- a/compose/foundation/foundation-text/build.gradle
+++ b/compose/foundation/foundation-text/build.gradle
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+
+import androidx.build.AndroidXUiPlugin
import androidx.build.LibraryGroups
import androidx.build.LibraryVersions
import androidx.build.Publish
@@ -25,61 +27,109 @@
id("AndroidXPlugin")
id("com.android.library")
id("AndroidXUiPlugin")
- id("kotlin-multiplatform")
}
+AndroidXUiPlugin.applyAndConfigureKotlinPlugin(project)
+
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
+
+ if(!AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block below
+ */
+
+ api project(":compose:ui:ui")
+ api project(":compose:ui:ui-text")
+ api project(":compose:ui:ui-util")
+
+ implementation(KOTLIN_STDLIB)
+ implementation(KOTLIN_COROUTINES_CORE)
+
+ testImplementation(ANDROIDX_TEST_RULES)
+ testImplementation(ANDROIDX_TEST_RUNNER)
+ testImplementation(JUNIT)
+ testImplementation(MOCKITO_CORE)
+ testImplementation(TRUTH)
+ testImplementation(KOTLIN_REFLECT)
+ testImplementation MOCKITO_KOTLIN, {
+ exclude group: 'org.mockito' // to keep control on the mockito version
+ }
+
+ androidTestImplementation project(":compose:foundation:foundation-layout")
+ androidTestImplementation project(":compose:ui:ui-test-font")
+ androidTestImplementation project(":ui:ui-test")
+ androidTestImplementation "androidx.core:core:1.5.0-alpha01"
+ androidTestImplementation(ANDROIDX_TEST_RULES)
+ androidTestImplementation(ANDROIDX_TEST_RUNNER)
+ androidTestImplementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
+ androidTestImplementation(ESPRESSO_CORE)
+ androidTestImplementation(JUNIT)
+ androidTestImplementation(MOCKITO_CORE, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
+ androidTestImplementation(TRUTH)
+ androidTestImplementation MOCKITO_KOTLIN, {
+ exclude group: 'org.mockito' // to keep control on the mockito version
+ }
+ }
}
-kotlin {
- android()
- jvm("desktop")
+if(AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ kotlin {
+ android()
+ jvm("desktop")
- sourceSets {
- commonMain.dependencies {
- implementation(KOTLIN_STDLIB_COMMON)
- implementation(KOTLIN_COROUTINES_CORE)
- api project(":compose:ui:ui")
- api project(":compose:ui:ui-text")
- api project(":compose:ui:ui-util")
- }
-
- androidMain.dependencies {
- implementation(KOTLIN_STDLIB)
- }
-
- desktopMain.dependencies {
- implementation(KOTLIN_STDLIB)
- implementation(SKIKO)
- }
-
- test.dependencies {
- implementation(ANDROIDX_TEST_RULES)
- implementation(ANDROIDX_TEST_RUNNER)
- implementation(JUNIT)
- implementation(MOCKITO_CORE)
- implementation(TRUTH)
- implementation(KOTLIN_REFLECT)
- implementation MOCKITO_KOTLIN, {
- exclude group: 'org.mockito' // to keep control on the mockito version
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block above
+ */
+ sourceSets {
+ commonMain.dependencies {
+ implementation(KOTLIN_STDLIB_COMMON)
+ implementation(KOTLIN_COROUTINES_CORE)
+ api project(":compose:ui:ui")
+ api project(":compose:ui:ui-text")
+ api project(":compose:ui:ui-util")
}
- }
- androidAndroidTest.dependencies {
- implementation project(":compose:foundation:foundation-layout")
- implementation project(":compose:ui:ui-test-font")
- implementation project(":ui:ui-test")
- implementation "androidx.core:core:1.5.0-alpha01"
- implementation(ANDROIDX_TEST_RULES)
- implementation(ANDROIDX_TEST_RUNNER)
- implementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
- implementation(ESPRESSO_CORE)
- implementation(JUNIT)
- implementation(MOCKITO_CORE, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
- implementation(TRUTH)
- implementation MOCKITO_KOTLIN, {
- exclude group: 'org.mockito' // to keep control on the mockito version
+ androidMain.dependencies {
+ implementation(KOTLIN_STDLIB)
+ }
+
+ desktopMain.dependencies {
+ implementation(KOTLIN_STDLIB)
+ implementation(SKIKO)
+ }
+
+ test.dependencies {
+ implementation(ANDROIDX_TEST_RULES)
+ implementation(ANDROIDX_TEST_RUNNER)
+ implementation(JUNIT)
+ implementation(MOCKITO_CORE)
+ implementation(TRUTH)
+ implementation(KOTLIN_REFLECT)
+ implementation MOCKITO_KOTLIN, {
+ exclude group: 'org.mockito' // to keep control on the mockito version
+ }
+ }
+
+ androidAndroidTest.dependencies {
+ implementation project(":compose:foundation:foundation-layout")
+ implementation project(":compose:ui:ui-test-font")
+ implementation project(":ui:ui-test")
+ implementation "androidx.core:core:1.5.0-alpha01"
+ implementation(ANDROIDX_TEST_RULES)
+ implementation(ANDROIDX_TEST_RUNNER)
+ implementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy)
+ // DexMaker has it"s own MockMaker
+ implementation(ESPRESSO_CORE)
+ implementation(JUNIT)
+ implementation(MOCKITO_CORE, libs.exclude_bytebuddy)
+ // DexMaker has it"s own MockMaker
+ implementation(TRUTH)
+ implementation MOCKITO_KOTLIN, {
+ exclude group: 'org.mockito' // to keep control on the mockito version
+ }
}
}
}
@@ -109,24 +159,25 @@
}
}
-// An ugly hack to workaround b/159426957 causing MPP+AGP to conflict.
-// See also: https://youtrack.jetbrains.com/issue/KT-34650
-// See also: https://youtrack.jetbrains.com/issue/KT-39712
-afterEvaluate {
- ["Api", "Implementation", "CompileOnly", "RuntimeOnly"].each { scope ->
- def erroneousExtendsFrom = [
- "androidTest$scope",
- "androidTestDebug$scope"
- ].collect { configurations[it] }
- [
- "androidDebugUnitTest$scope",
- "test$scope",
- "testDebug$scope",
- "testRelease$scope"
- ].each {
- def configuration = configurations[it]
- configuration.setExtendsFrom(configuration.extendsFrom - erroneousExtendsFrom)
+if(AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ // An ugly hack to workaround b/159426957 causing MPP+AGP to conflict.
+ // See also: https://youtrack.jetbrains.com/issue/KT-34650
+ // See also: https://youtrack.jetbrains.com/issue/KT-39712
+ afterEvaluate {
+ ["Api", "Implementation", "CompileOnly", "RuntimeOnly"].each { scope ->
+ def erroneousExtendsFrom = [
+ "androidTest$scope",
+ "androidTestDebug$scope"
+ ].collect { configurations[it] }
+ [
+ "androidDebugUnitTest$scope",
+ "test$scope",
+ "testDebug$scope",
+ "testRelease$scope"
+ ].each {
+ def configuration = configurations[it]
+ configuration.setExtendsFrom(configuration.extendsFrom - erroneousExtendsFrom)
+ }
}
}
}
-
diff --git a/compose/foundation/foundation-text/integration-tests/ui-text-compose-demos/build.gradle b/compose/foundation/foundation-text/integration-tests/ui-text-compose-demos/build.gradle
index 76019ce..70d1c29 100644
--- a/compose/foundation/foundation-text/integration-tests/ui-text-compose-demos/build.gradle
+++ b/compose/foundation/foundation-text/integration-tests/ui-text-compose-demos/build.gradle
@@ -10,7 +10,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
diff --git a/compose/foundation/foundation-text/integration-tests/ui-text-compose-demos/src/main/java/androidx/compose/foundation/text/demos/ComposeInputFieldSoftWrap.kt b/compose/foundation/foundation-text/integration-tests/ui-text-compose-demos/src/main/java/androidx/compose/foundation/text/demos/ComposeInputFieldSoftWrap.kt
new file mode 100644
index 0000000..9b8e4d6
--- /dev/null
+++ b/compose/foundation/foundation-text/integration-tests/ui-text-compose-demos/src/main/java/androidx/compose/foundation/text/demos/ComposeInputFieldSoftWrap.kt
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.foundation.text.demos
+
+import androidx.compose.foundation.ExperimentalFoundationApi
+import androidx.compose.foundation.ScrollableColumn
+import androidx.compose.foundation.layout.defaultMinSizeConstraints
+import androidx.compose.foundation.text.CoreTextField
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.savedinstancestate.savedInstanceState
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.text.TextStyle
+import androidx.compose.ui.text.input.TextFieldValue
+import androidx.compose.ui.unit.dp
+
+@Composable
+fun SoftWrapDemo() {
+ ScrollableColumn {
+ CoreTextFieldWithWrap(false)
+ CoreTextFieldWithWrap(true)
+ }
+}
+
+@Composable
+@OptIn(ExperimentalFoundationApi::class)
+private fun CoreTextFieldWithWrap(softWrap: Boolean) {
+ val state = savedInstanceState(saver = TextFieldValue.Saver) {
+ TextFieldValue("abc ".repeat(20))
+ }
+ CoreTextField(
+ modifier = demoTextFieldModifiers.defaultMinSizeConstraints(100.dp),
+ value = state.value,
+ softWrap = softWrap,
+ onValueChange = { state.value = it },
+ textStyle = TextStyle(fontSize = fontSize8),
+ cursorColor = Color.Red
+ )
+}
\ No newline at end of file
diff --git a/compose/foundation/foundation-text/integration-tests/ui-text-compose-demos/src/main/java/androidx/compose/foundation/text/demos/TextDemos.kt b/compose/foundation/foundation-text/integration-tests/ui-text-compose-demos/src/main/java/androidx/compose/foundation/text/demos/TextDemos.kt
index d1679a3..dfba227 100644
--- a/compose/foundation/foundation-text/integration-tests/ui-text-compose-demos/src/main/java/androidx/compose/foundation/text/demos/TextDemos.kt
+++ b/compose/foundation/foundation-text/integration-tests/ui-text-compose-demos/src/main/java/androidx/compose/foundation/text/demos/TextDemos.kt
@@ -35,7 +35,8 @@
ComposableDemo("Tricky input field") { InputFieldTrickyUseCase() },
ComposableDemo("Focus transition") { TextFieldFocusTransition() },
ComposableDemo("Tail Following Text Field") { TailFollowingTextFieldDemo() },
- ComposableDemo("TextField in Scroller") { TextFieldWithScrollerDemo() }
+ ComposableDemo("TextField in Scroller") { TextFieldWithScrollerDemo() },
+ ComposableDemo("Soft Wrap") { SoftWrapDemo() },
)
),
ComposableDemo("Text Accessibility") { TextAccessibilityDemo() }
diff --git a/compose/foundation/foundation-text/samples/build.gradle b/compose/foundation/foundation-text/samples/build.gradle
index 74835e6..667077d 100644
--- a/compose/foundation/foundation-text/samples/build.gradle
+++ b/compose/foundation/foundation-text/samples/build.gradle
@@ -29,7 +29,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
diff --git a/compose/foundation/foundation-text/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/CoreTextFieldSoftWrapTest.kt b/compose/foundation/foundation-text/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/CoreTextFieldSoftWrapTest.kt
new file mode 100644
index 0000000..63178d1
--- /dev/null
+++ b/compose/foundation/foundation-text/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/CoreTextFieldSoftWrapTest.kt
@@ -0,0 +1,127 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.foundation.text
+
+import androidx.compose.foundation.layout.width
+import androidx.compose.runtime.Providers
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.onGloballyPositioned
+import androidx.compose.ui.platform.DensityAmbient
+import androidx.compose.ui.text.TextLayoutResult
+import androidx.compose.ui.text.TextStyle
+import androidx.compose.ui.text.font.FontStyle
+import androidx.compose.ui.text.font.FontWeight
+import androidx.compose.ui.text.font.ResourceFont
+import androidx.compose.ui.text.font.asFontFamily
+import androidx.compose.ui.text.input.TextFieldValue
+import androidx.compose.ui.unit.sp
+import androidx.test.filters.LargeTest
+import androidx.ui.test.createComposeRule
+import com.google.common.truth.Truth.assertThat
+import org.junit.Rule
+import org.junit.Test
+import androidx.compose.ui.text.font.test.R
+import androidx.compose.ui.unit.Density
+import androidx.compose.ui.unit.dp
+import org.junit.runner.RunWith
+import org.junit.runners.JUnit4
+
+@LargeTest
+@RunWith(JUnit4::class)
+class CoreTextFieldSoftWrapTest {
+
+ private val fontFamily = ResourceFont(
+ resId = R.font.sample_font,
+ weight = FontWeight.Normal,
+ style = FontStyle.Normal
+ ).asFontFamily()
+
+ @get:Rule
+ val rule = createComposeRule()
+
+ @Test
+ fun textField_softWrapFalse_returnsSizeForMaxIntrinsicWidth() {
+ val density = Density(density = 1f, fontScale = 1f)
+ val fontSize = 100.sp
+ val composableWidth = 50.dp
+ val textStyle = TextStyle(fontFamily = fontFamily, fontSize = fontSize)
+ val string = "a".repeat(20)
+
+ var textLayout: TextLayoutResult? = null
+ var width: Int? = null
+
+ rule.setContent {
+ Providers(DensityAmbient provides density) {
+ CoreTextField(
+ value = TextFieldValue(string),
+ onValueChange = {},
+ textStyle = textStyle,
+ softWrap = false,
+ onTextLayout = { textLayout = it },
+ modifier = Modifier.width(composableWidth)
+ .onGloballyPositioned {
+ width = it.size.width
+ }
+ )
+ }
+ }
+
+ with(density) {
+ assertThat(textLayout).isNotNull()
+ assertThat(width).isNotNull()
+ assertThat(width).isEqualTo(composableWidth.toIntPx())
+ assertThat(textLayout?.lineCount).isEqualTo(1)
+ }
+ }
+
+ @Test
+ fun textField_softWrapTrue_respectsTheGivenMaxWidth() {
+ val density = Density(density = 1f, fontScale = 1f)
+ val fontSize = 100.sp
+ val composableWidth = 100.dp
+ val textStyle = TextStyle(fontFamily = fontFamily, fontSize = fontSize)
+ val string = "a".repeat(20)
+
+ var textLayout: TextLayoutResult? = null
+ var width: Int? = null
+
+ rule.setContent {
+ Providers(DensityAmbient provides density) {
+ CoreTextField(
+ value = TextFieldValue(string),
+ onValueChange = {},
+ textStyle = textStyle,
+ softWrap = true,
+ onTextLayout = { textLayout = it },
+ modifier = Modifier.width(composableWidth)
+ .onGloballyPositioned {
+ width = it.size.width
+ }
+ )
+ }
+ }
+
+ with(density) {
+ assertThat(textLayout).isNotNull()
+ assertThat(width).isNotNull()
+ assertThat(width).isEqualTo(composableWidth.toIntPx())
+ // each character has the same width as composable width
+ // therefore the string.length is the line count
+ assertThat(textLayout?.lineCount).isEqualTo(string.length)
+ }
+ }
+}
\ No newline at end of file
diff --git a/compose/foundation/foundation-text/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/TextFieldDelegateIntegrationTest.kt b/compose/foundation/foundation-text/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/TextFieldDelegateIntegrationTest.kt
index fe6de38..25895bc 100644
--- a/compose/foundation/foundation-text/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/TextFieldDelegateIntegrationTest.kt
+++ b/compose/foundation/foundation-text/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/TextFieldDelegateIntegrationTest.kt
@@ -32,7 +32,6 @@
import androidx.compose.ui.text.font.ResourceFont
import androidx.compose.ui.text.input.OffsetMap
import androidx.compose.ui.text.input.TextFieldValue
-import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.Density
import androidx.compose.ui.unit.LayoutDirection
@@ -100,49 +99,6 @@
}
@Test
- fun layout_width_constraint_min_width() {
- val textDelegate = TextDelegate(
- text = AnnotatedString("Hello, World"),
- style = TextStyle.Default,
- maxLines = 2,
- density = density,
- resourceLoader = resourceLoader
- )
- val layoutResult = textDelegate.layout(Constraints.fixedWidth(1024), layoutDirection)
- val requestWidth = layoutResult.size.width / 2
-
- val (width, _, _) = TextFieldDelegate.layout(
- textDelegate,
- Constraints.fixedWidth(requestWidth),
- layoutDirection
- )
-
- assertThat(width).isEqualTo(requestWidth)
- }
-
- @Test
- fun layout_width_constraint_max_width() {
- val textDelegate = TextDelegate(
- text = AnnotatedString("Hello, World"),
- style = TextStyle.Default,
- overflow = TextOverflow.Clip,
- softWrap = false,
- density = density,
- resourceLoader = resourceLoader
- )
- val layoutResult = textDelegate.layout(Constraints.fixedWidth(1024), layoutDirection)
- val requestWidth = layoutResult.size.width / 2
-
- val (width, _, _) = TextFieldDelegate.layout(
- textDelegate,
- Constraints.fixedWidth(requestWidth),
- layoutDirection
- )
-
- assertThat(width).isEqualTo(requestWidth)
- }
-
- @Test
fun layout_height_constraint_max_height() {
val textDelegate = TextDelegate(
text = AnnotatedString("Hello, World"),
@@ -183,117 +139,6 @@
assertThat(height).isEqualTo(requestHeight)
}
-
- @Test
- fun layout_empty_text_height_constraint_min_height() {
- val textDelegate = TextDelegate(
- text = AnnotatedString(""),
- style = TextStyle.Default,
- density = density,
- resourceLoader = resourceLoader
- )
- val layoutResult = textDelegate.layout(Constraints.fixedWidth(1024), layoutDirection)
- val requestHeight = layoutResult.size.height * 2
-
- val (_, height, _) = TextFieldDelegate.layout(
- textDelegate,
- Constraints.fixedHeight(requestHeight),
- layoutDirection
- )
-
- assertThat(height).isEqualTo(requestHeight)
- }
-
- @Test
- fun layout_empty_text_height_constraint_max_height() {
- val textDelegate = TextDelegate(
- text = AnnotatedString(""),
- style = TextStyle.Default,
- density = density,
- resourceLoader = resourceLoader
- )
- val layoutResult = textDelegate.layout(Constraints.fixedWidth(1024), layoutDirection)
- val requestHeight = layoutResult.size.height / 2
-
- val (_, height, _) = TextFieldDelegate.layout(
- textDelegate,
- Constraints.fixedHeight(requestHeight),
- layoutDirection
- )
-
- assertThat(height).isEqualTo(requestHeight)
- }
-
- @Test
- fun overflow_none_width_overflow() {
- val textDelegate = TextDelegate(
- text = AnnotatedString("Hello, World"),
- style = TextStyle.Default,
- overflow = TextOverflow.None,
- softWrap = false,
- density = density,
- resourceLoader = resourceLoader
- )
- val layoutResult = textDelegate.layout(Constraints.fixedWidth(1024), layoutDirection)
- val requestWidth = layoutResult.size.width / 2
-
- val (width, height, _) = TextFieldDelegate.layout(
- textDelegate,
- Constraints.fixedWidth(requestWidth),
- layoutDirection
- )
-
- // When overflow is None, TextFieldDelegate will report its actual size.
- assertThat(width).isEqualTo(layoutResult.size.width)
- assertThat(height).isEqualTo(layoutResult.size.height)
- }
-
- @Test
- fun overflow_none_height_overflow() {
- val textDelegate = TextDelegate(
- text = AnnotatedString("Hello, World"),
- style = TextStyle.Default,
- overflow = TextOverflow.None,
- density = density,
- resourceLoader = resourceLoader
- )
- val layoutResult = textDelegate.layout(Constraints.fixedWidth(1024), layoutDirection)
- val requestHeight = layoutResult.size.height / 2
-
- val (width, height, _) = TextFieldDelegate.layout(
- textDelegate,
- Constraints.fixedHeight(requestHeight),
- layoutDirection
- )
-
- // When overflow is None, TextFieldDelegate will report its actual size.
- assertThat(width).isEqualTo(layoutResult.size.width)
- assertThat(height).isEqualTo(layoutResult.size.height)
- }
-
- @Test
- fun overflow_none_empty_text_height_overflow() {
- val textDelegate = TextDelegate(
- text = AnnotatedString(""),
- style = TextStyle.Default,
- overflow = TextOverflow.None,
- density = density,
- resourceLoader = resourceLoader
- )
-
- val layoutResult = textDelegate.layout(Constraints.fixedWidth(1024), layoutDirection)
- val requestHeight = layoutResult.size.height / 2
-
- val (width, height, _) = TextFieldDelegate.layout(
- textDelegate,
- Constraints.fixedHeight(requestHeight),
- layoutDirection
- )
-
- // When overflow is None, TextFieldDelegate will report its actual size.
- assertThat(width).isEqualTo(layoutResult.size.width)
- assertThat(height).isEqualTo(layoutResult.size.height)
- }
}
private fun TextLayoutResult.toBitmap() = Bitmap.createBitmap(
diff --git a/compose/foundation/foundation-text/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionContainerTest.kt b/compose/foundation/foundation-text/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionContainerTest.kt
index f3de6db..54af8c0 100644
--- a/compose/foundation/foundation-text/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionContainerTest.kt
+++ b/compose/foundation/foundation-text/src/androidAndroidTest/kotlin/androidx/compose/foundation/text/selection/SelectionContainerTest.kt
@@ -20,6 +20,7 @@
import android.view.View
import android.view.ViewGroup
import androidx.activity.ComponentActivity
+import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.text.CoreText
import androidx.compose.runtime.Composable
import androidx.compose.runtime.Providers
@@ -28,7 +29,6 @@
import androidx.compose.ui.Layout
import androidx.compose.ui.Modifier
import androidx.compose.ui.composed
-import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.hapticfeedback.HapticFeedback
import androidx.compose.ui.hapticfeedback.HapticFeedbackType
import androidx.compose.ui.input.pointer.PointerEvent
@@ -37,9 +37,6 @@
import androidx.compose.ui.input.pointer.PointerInputFilter
import androidx.compose.ui.input.pointer.PointerInputModifier
import androidx.compose.ui.input.pointer.changedToUp
-import androidx.compose.ui.layout.LayoutCoordinates
-import androidx.compose.ui.node.Ref
-import androidx.compose.ui.onGloballyPositioned
import androidx.compose.ui.platform.HapticFeedBackAmbient
import androidx.compose.ui.selection.Selection
import androidx.compose.ui.selection.SelectionContainer
@@ -92,10 +89,6 @@
private val hapticFeedback = mock<HapticFeedback>()
- // Variables used to store position and size of the CoreText.
- private val textPosition = Ref<Offset>()
- private val textSize = Ref<IntSize>()
-
@Before
fun setup() {
rule.setContent {
@@ -112,7 +105,7 @@
) {
CoreText(
AnnotatedString(textContent),
- modifier = saveLayout(textPosition, textSize),
+ Modifier.fillMaxSize(),
style = TextStyle(fontFamily = fontFamily, fontSize = fontSize),
softWrap = true,
overflow = TextOverflow.Clip,
@@ -133,18 +126,15 @@
@SdkSuppress(minSdkVersion = 27)
fun press_to_cancel() {
// Setup. Long press to create a selection.
- // The long press position.
- // positionX is 50 pixels to the right of the CoreText's left edge.
- // positionY is the middle of the CoreText.
- val positionX = textPosition.value!!.x + 50f
- val positionY = textPosition.value!!.y + textSize.value!!.height / 2
- longPress(x = positionX, y = positionY)
+ // A reasonable number.
+ val position = 50f
+ longPress(x = position, y = position)
rule.runOnIdle {
assertThat(selection.value).isNotNull()
}
// Act.
- press(x = positionX, y = positionY)
+ press(x = position, y = position)
// Assert.
rule.runOnIdle {
@@ -160,17 +150,14 @@
@SdkSuppress(minSdkVersion = 27)
fun tapToCancelDoesNotBlockUp() {
// Setup. Long press to create a selection.
- // The long press position.
- // positionX is 50 pixels to the right of the CoreText's left edge.
- // positionY is the middle of the CoreText.
- val positionX = textPosition.value!!.x + 50f
- val positionY = textPosition.value!!.y + textSize.value!!.height / 2
- longPress(x = positionX, y = positionY)
+ // A reasonable number.
+ val position = 50f
+ longPress(x = position, y = position)
log.entries.clear()
// Act.
- press(x = positionX, y = positionY)
+ press(x = position, y = position)
// Assert.
rule.runOnIdle {
@@ -290,14 +277,6 @@
val pass: PointerEventPass
)
-private fun saveLayout(
- coords: Ref<Offset>,
- size: Ref<IntSize>
-): Modifier = Modifier.onGloballyPositioned { coordinates: LayoutCoordinates ->
- coords.value = coordinates.localToRoot(Offset.Zero)
- size.value = coordinates.size
-}
-
private fun Modifier.gestureSpy(
onPointerInput: (PointerEvent, PointerEventPass) -> Unit
): Modifier = composed {
diff --git a/compose/foundation/foundation-text/src/commonMain/kotlin/androidx/compose/foundation/text/CoreText.kt b/compose/foundation/foundation-text/src/commonMain/kotlin/androidx/compose/foundation/text/CoreText.kt
index bf00df8..d1d98d6 100644
--- a/compose/foundation/foundation-text/src/commonMain/kotlin/androidx/compose/foundation/text/CoreText.kt
+++ b/compose/foundation/foundation-text/src/commonMain/kotlin/androidx/compose/foundation/text/CoreText.kt
@@ -82,13 +82,6 @@
* [androidx.compose.foundation.Text], which is a higher level Text element that contains semantics and
* consumes style information from a theme.
*
- * During the measurement, CoreText tends to shrink its size and reports the minimal needed size
- * to its parent. It will ignore the minWidth and minHeight except when [TextAlign] is
- * [TextAlign.Justify]. When [TextAlign.Justify] is specified and [text] is short enough that
- * doesn't exceed minWidth, CoreText will justify the [text] to fill the given minWidth.
- * When input [text] is too long and exceeds the maxWidth/maxHeight constrains, it will determine
- * its size based on the [overflow] option.
- *
* @param text AnnotatedString encoding a styled text.
* @param modifier Modifier to apply to this layout node.
* @param style Style configuration for the text such as color, font, line height etc.
diff --git a/compose/foundation/foundation-text/src/commonMain/kotlin/androidx/compose/foundation/text/CoreTextField.kt b/compose/foundation/foundation-text/src/commonMain/kotlin/androidx/compose/foundation/text/CoreTextField.kt
index 0d7659d..2e23228 100644
--- a/compose/foundation/foundation-text/src/commonMain/kotlin/androidx/compose/foundation/text/CoreTextField.kt
+++ b/compose/foundation/foundation-text/src/commonMain/kotlin/androidx/compose/foundation/text/CoreTextField.kt
@@ -37,7 +37,6 @@
import androidx.compose.runtime.onDispose
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
-import androidx.compose.runtime.state
import androidx.compose.runtime.structuralEqualityPolicy
import androidx.compose.ui.Layout
import androidx.compose.ui.Modifier
@@ -96,9 +95,9 @@
import androidx.compose.ui.text.input.OffsetMap
import androidx.compose.ui.text.input.TextFieldValue
import androidx.compose.ui.text.input.VisualTransformation
+import androidx.compose.ui.unit.Density
import androidx.compose.ui.unit.dp
import androidx.compose.ui.util.annotation.VisibleForTesting
-import androidx.compose.ui.unit.Density
import kotlin.math.max
import kotlin.math.roundToInt
@@ -145,6 +144,8 @@
* [SoftwareKeyboardController] instance which can be used for requesting input show/hide software
* keyboard.
* @param cursorColor Color of the cursor. If [Color.Unspecified], there will be no cursor drawn
+ * @param softWrap Whether the text should break at soft line breaks. If false, the glyphs in the
+ * text will be positioned as if there was unlimited horizontal space.
*/
@Composable
@OptIn(
@@ -162,7 +163,8 @@
visualTransformation: VisualTransformation = VisualTransformation.None,
onTextLayout: (TextLayoutResult) -> Unit = {},
onTextInputStarted: (SoftwareKeyboardController) -> Unit = {},
- cursorColor: Color = Color.Unspecified
+ cursorColor: Color = Color.Unspecified,
+ softWrap: Boolean = true
) {
// If developer doesn't pass new value to TextField, recompose won't happen but internal state
// and IME may think it is updated. To fix this inconsistent state, enforce recompose.
@@ -186,6 +188,7 @@
TextDelegate(
text = visualText,
style = textStyle,
+ softWrap = softWrap,
density = density,
resourceLoader = resourceLoader
)
@@ -194,6 +197,7 @@
state.update(
visualText,
textStyle,
+ softWrap,
density,
resourceLoader,
onValueChange,
@@ -537,6 +541,7 @@
fun update(
visualText: AnnotatedString,
textStyle: TextStyle,
+ softWrap: Boolean,
density: Density,
resourceLoader: Font.ResourceLoader,
onValueChange: (TextFieldValue) -> Unit,
@@ -549,6 +554,7 @@
current = textDelegate,
text = visualText,
style = textStyle,
+ softWrap = softWrap,
density = density,
resourceLoader = resourceLoader,
placeholders = emptyList()
diff --git a/compose/foundation/foundation-text/src/commonMain/kotlin/androidx/compose/foundation/text/TextFieldDelegate.kt b/compose/foundation/foundation-text/src/commonMain/kotlin/androidx/compose/foundation/text/TextFieldDelegate.kt
index 5d93aee..0a48ef2a 100644
--- a/compose/foundation/foundation-text/src/commonMain/kotlin/androidx/compose/foundation/text/TextFieldDelegate.kt
+++ b/compose/foundation/foundation-text/src/commonMain/kotlin/androidx/compose/foundation/text/TextFieldDelegate.kt
@@ -47,7 +47,6 @@
import androidx.compose.ui.text.input.TransformedText
import androidx.compose.ui.text.resolveDefaults
import androidx.compose.ui.text.style.TextDecoration
-import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.Density
import androidx.compose.ui.unit.LayoutDirection
@@ -105,12 +104,7 @@
layoutDirection: LayoutDirection,
prevResultText: TextLayoutResult? = null
): Triple<Int, Int, TextLayoutResult> {
- val layoutResult = textDelegate.layout(
- constraints = constraints,
- layoutDirection = layoutDirection,
- prevResult = prevResultText,
- respectMinConstraints = true
- )
+ val layoutResult = textDelegate.layout(constraints, layoutDirection, prevResultText)
val isEmptyText = textDelegate.text.text.isEmpty()
val height = if (isEmptyText) {
@@ -119,12 +113,7 @@
density = textDelegate.density,
resourceLoader = textDelegate.resourceLoader
)
- when (textDelegate.overflow) {
- TextOverflow.None ->
- singleLineHeight.coerceAtLeast(constraints.minHeight)
- TextOverflow.Clip, TextOverflow.Ellipsis ->
- constraints.constrainHeight(singleLineHeight)
- }
+ constraints.constrainHeight(singleLineHeight)
} else {
layoutResult.size.height
}
diff --git a/compose/foundation/foundation-text/src/test/kotlin/androidx/compose/foundation/text/TextFieldDelegateTest.kt b/compose/foundation/foundation-text/src/test/kotlin/androidx/compose/foundation/text/TextFieldDelegateTest.kt
index 5583123..d8f4d2b 100644
--- a/compose/foundation/foundation-text/src/test/kotlin/androidx/compose/foundation/text/TextFieldDelegateTest.kt
+++ b/compose/foundation/foundation-text/src/test/kotlin/androidx/compose/foundation/text/TextFieldDelegateTest.kt
@@ -303,7 +303,7 @@
whenever(mDelegate.style).thenReturn(TextStyle())
whenever(mDelegate.density).thenReturn(Density(1.0f))
whenever(mDelegate.resourceLoader).thenReturn(mock())
- whenever(mDelegate.layout(Constraints(anyLong()), any(), eq(null), eq(true)))
+ whenever(mDelegate.layout(Constraints(anyLong()), any(), eq(null)))
.thenReturn(textLayoutResult)
val (width, height, layoutResult) = TextFieldDelegate.layout(
diff --git a/compose/foundation/foundation/build.gradle b/compose/foundation/foundation/build.gradle
index 09a9f1e..ff05dc5 100644
--- a/compose/foundation/foundation/build.gradle
+++ b/compose/foundation/foundation/build.gradle
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+
+import androidx.build.AndroidXUiPlugin
import androidx.build.LibraryGroups
import androidx.build.LibraryVersions
import androidx.build.Publish
@@ -25,66 +27,111 @@
id("AndroidXPlugin")
id("com.android.library")
id("AndroidXUiPlugin")
- id("kotlin-multiplatform")
}
+AndroidXUiPlugin.applyAndConfigureKotlinPlugin(project)
+
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
+
+ if(!AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block above
+ */
+ api "androidx.annotation:annotation:1.1.0"
+ api project(':compose:animation:animation')
+ api project(':compose:runtime:runtime')
+ api project(':compose:runtime:runtime-saved-instance-state')
+ api project(':compose:ui:ui')
+
+ implementation(KOTLIN_STDLIB_COMMON)
+ implementation project(':compose:foundation:foundation-layout')
+ implementation project(':compose:foundation:foundation-text')
+ implementation project(':compose:ui:ui-text')
+ implementation project(':compose:ui:ui-util')
+
+ testImplementation(ANDROIDX_TEST_RULES)
+ testImplementation(ANDROIDX_TEST_RUNNER)
+ testImplementation(JUNIT)
+ testImplementation(TRUTH)
+
+ androidTestImplementation project(':ui:ui-test')
+ androidTestImplementation(ANDROIDX_TEST_UIAUTOMATOR)
+ androidTestImplementation(ANDROIDX_TEST_RULES)
+ androidTestImplementation(ANDROIDX_TEST_RUNNER)
+ androidTestImplementation(ESPRESSO_CORE)
+ androidTestImplementation(JUNIT)
+ androidTestImplementation(TRUTH)
+ androidTestImplementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own
+ // MockMaker
+ androidTestImplementation(MOCKITO_CORE, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
+ androidTestImplementation MOCKITO_KOTLIN, {
+ exclude group: 'org.mockito' // to keep control on the mockito version
+ }
+ }
}
-kotlin {
- android()
- jvm("desktop")
+if(AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ kotlin {
+ android()
+ jvm("desktop")
- sourceSets {
- commonMain.dependencies {
- implementation(KOTLIN_STDLIB_COMMON)
- api project(':compose:animation:animation')
- api project(':compose:runtime:runtime')
- api project(':compose:runtime:runtime-saved-instance-state')
- api project(':compose:ui:ui')
- implementation project(':compose:foundation:foundation-layout')
- implementation project(':compose:foundation:foundation-text')
- implementation project(':compose:ui:ui-text')
- implementation project(':compose:ui:ui-util')
- }
- androidMain.dependencies {
- api "androidx.annotation:annotation:1.1.0"
- }
-
- desktopMain.dependencies {
- implementation(KOTLIN_STDLIB)
- implementation(SKIKO)
- }
-
- androidTest.dependencies {
- implementation(ANDROIDX_TEST_RULES)
- implementation(ANDROIDX_TEST_RUNNER)
- implementation(JUNIT)
- }
-
- androidAndroidTest.dependencies {
- implementation project(':ui:ui-test')
-
- implementation(ANDROIDX_TEST_UIAUTOMATOR)
- implementation(ANDROIDX_TEST_RULES)
- implementation(ANDROIDX_TEST_RUNNER)
- implementation(ESPRESSO_CORE)
- implementation(JUNIT)
- implementation(TRUTH)
- implementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own
- // MockMaker
- implementation(MOCKITO_CORE, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
- implementation MOCKITO_KOTLIN, {
- exclude group: 'org.mockito' // to keep control on the mockito version
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block above
+ */
+ sourceSets {
+ commonMain.dependencies {
+ implementation(KOTLIN_STDLIB_COMMON)
+ api project(':compose:animation:animation')
+ api project(':compose:runtime:runtime')
+ api project(':compose:runtime:runtime-saved-instance-state')
+ api project(':compose:ui:ui')
+ implementation project(':compose:foundation:foundation-layout')
+ implementation project(':compose:foundation:foundation-text')
+ implementation project(':compose:ui:ui-text')
+ implementation project(':compose:ui:ui-util')
}
- }
+ androidMain.dependencies {
+ api "androidx.annotation:annotation:1.1.0"
+ }
- desktopTest.dependencies {
- implementation project(':ui:ui-test')
- implementation(TRUTH)
- implementation(JUNIT)
- implementation(SKIKO_CURRENT_OS)
+ desktopMain.dependencies {
+ implementation(KOTLIN_STDLIB)
+ implementation(SKIKO)
+ }
+
+ androidTest.dependencies {
+ implementation(ANDROIDX_TEST_RULES)
+ implementation(ANDROIDX_TEST_RUNNER)
+ implementation(JUNIT)
+ }
+
+ androidAndroidTest.dependencies {
+ implementation project(':ui:ui-test')
+
+ implementation(ANDROIDX_TEST_UIAUTOMATOR)
+ implementation(ANDROIDX_TEST_RULES)
+ implementation(ANDROIDX_TEST_RUNNER)
+ implementation(ESPRESSO_CORE)
+ implementation(JUNIT)
+ implementation(TRUTH)
+ implementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own
+ // MockMaker
+ implementation(MOCKITO_CORE, libs.exclude_bytebuddy)
+ // DexMaker has it"s own MockMaker
+ implementation MOCKITO_KOTLIN, {
+ exclude group: 'org.mockito' // to keep control on the mockito version
+ }
+ }
+
+ desktopTest.dependencies {
+ implementation project(':ui:ui-test')
+ implementation(TRUTH)
+ implementation(JUNIT)
+ implementation(SKIKO_CURRENT_OS)
+ }
}
}
}
diff --git a/compose/foundation/foundation/integration-tests/foundation-demos/build.gradle b/compose/foundation/foundation/integration-tests/foundation-demos/build.gradle
index 9c474bd..856ea6a 100644
--- a/compose/foundation/foundation/integration-tests/foundation-demos/build.gradle
+++ b/compose/foundation/foundation/integration-tests/foundation-demos/build.gradle
@@ -26,7 +26,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
diff --git a/compose/foundation/foundation/samples/build.gradle b/compose/foundation/foundation/samples/build.gradle
index 614cad4..d0172fb 100644
--- a/compose/foundation/foundation/samples/build.gradle
+++ b/compose/foundation/foundation/samples/build.gradle
@@ -29,7 +29,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
diff --git a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyForIndexedTest.kt b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyForIndexedTest.kt
index 8a91674..b84316d 100644
--- a/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyForIndexedTest.kt
+++ b/compose/foundation/foundation/src/androidAndroidTest/kotlin/androidx/compose/foundation/lazy/LazyForIndexedTest.kt
@@ -16,18 +16,17 @@
package androidx.compose.foundation.lazy
-import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.Text
import androidx.compose.foundation.layout.height
import androidx.compose.foundation.layout.preferredHeight
import androidx.compose.foundation.layout.preferredWidth
import androidx.compose.foundation.layout.width
import androidx.compose.ui.Modifier
-import androidx.compose.ui.platform.testTag
import androidx.compose.ui.unit.dp
import androidx.ui.test.assertLeftPositionInRootIsEqualTo
import androidx.ui.test.assertTopPositionInRootIsEqualTo
import androidx.ui.test.createComposeRule
-import androidx.ui.test.onNodeWithTag
+import androidx.ui.test.onNodeWithText
import org.junit.Rule
import org.junit.Test
@@ -42,14 +41,14 @@
rule.setContent {
LazyColumnForIndexed(items, Modifier.preferredHeight(200.dp)) { index, item ->
- Spacer(Modifier.fillParentMaxWidth().height(100.dp).testTag("${index}x$item"))
+ Text("${index}x$item", Modifier.fillParentMaxWidth().height(100.dp))
}
}
- rule.onNodeWithTag("0x0")
+ rule.onNodeWithText("0x0")
.assertTopPositionInRootIsEqualTo(0.dp)
- rule.onNodeWithTag("1x1")
+ rule.onNodeWithText("1x1")
.assertTopPositionInRootIsEqualTo(100.dp)
}
@@ -59,14 +58,14 @@
rule.setContent {
LazyRowForIndexed(items, Modifier.preferredWidth(200.dp)) { index, item ->
- Spacer(Modifier.fillParentMaxHeight().width(100.dp).testTag("${index}x$item"))
+ Text("${index}x$item", Modifier.fillParentMaxHeight().width(100.dp))
}
}
- rule.onNodeWithTag("0x0")
+ rule.onNodeWithText("0x0")
.assertLeftPositionInRootIsEqualTo(0.dp)
- rule.onNodeWithTag("1x1")
+ rule.onNodeWithText("1x1")
.assertLeftPositionInRootIsEqualTo(100.dp)
}
}
diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Text.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Text.kt
index 55d4056..42445ed 100644
--- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Text.kt
+++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/Text.kt
@@ -60,13 +60,6 @@
* [AmbientContentColor] will be used - this allows this [Text] or element containing this [Text] to
* adapt to different background colors and still maintain contrast and accessibility.
*
- * During the measurement, CoreText tends to shrink its size and reports the minimal needed size
- * to its parent. It will ignore the minWidth and minHeight except when [TextAlign] is
- * [TextAlign.Justify]. When [TextAlign.Justify] is specified and [text] is short enough that
- * doesn't exceed minWidth, CoreText will justify the [text] to fill the given minWidth.
- * When input [text] is too long and exceeds the maxWidth/maxHeight constrains, it will determine
- * its size based on the [overflow] option.
- *
* @param text The text to be displayed.
* @param modifier [Modifier] to apply to this layout node.
* @param color [Color] to apply to the text. If [Color.Unspecified], and [style] has no color set,
@@ -153,13 +146,6 @@
* [AmbientContentColor] will be used - this allows this [Text] or element containing this [Text] to
* adapt to different background colors and still maintain contrast and accessibility.
*
- * During the measurement, CoreText tends to shrink its size and reports the minimal needed size
- * to its parent. It will ignore the minWidth and minHeight except when [TextAlign] is
- * [TextAlign.Justify]. When [TextAlign.Justify] is specified and [text] is short enough that
- * doesn't exceed minWidth, CoreText will justify the [text] to fill the given minWidth.
- * When input [text] is too long and exceeds the maxWidth/maxHeight constrains, it will determine
- * its size based on the [overflow] option.
- *
* @param text The text to be displayed.
* @param modifier [Modifier] to apply to this layout node.
* @param color [Color] to apply to the text. If [Color.Unspecified], and [style] has no color set,
diff --git a/compose/integration-tests/benchmark/build.gradle b/compose/integration-tests/benchmark/build.gradle
index a6dfa41..f46802f 100644
--- a/compose/integration-tests/benchmark/build.gradle
+++ b/compose/integration-tests/benchmark/build.gradle
@@ -30,7 +30,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation project(":benchmark:benchmark-junit4")
implementation project(":compose:foundation:foundation-layout")
diff --git a/compose/integration-tests/build.gradle b/compose/integration-tests/build.gradle
index a99f159..9545c4b 100644
--- a/compose/integration-tests/build.gradle
+++ b/compose/integration-tests/build.gradle
@@ -30,7 +30,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
diff --git a/compose/integration-tests/demos/build.gradle b/compose/integration-tests/demos/build.gradle
index a96f3ef..8095f3a 100644
--- a/compose/integration-tests/demos/build.gradle
+++ b/compose/integration-tests/demos/build.gradle
@@ -10,7 +10,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation project(":compose:androidview:androidview:integration-tests:androidview-demos")
implementation project(":compose:animation:animation:integration-tests:animation-demos")
diff --git a/compose/integration-tests/demos/common/build.gradle b/compose/integration-tests/demos/common/build.gradle
index 46b1585..33c7f2f 100644
--- a/compose/integration-tests/demos/common/build.gradle
+++ b/compose/integration-tests/demos/common/build.gradle
@@ -26,7 +26,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
api "androidx.activity:activity:1.2.0-alpha02"
diff --git a/compose/integration-tests/demos/lint-baseline.xml b/compose/integration-tests/demos/lint-baseline.xml
index 88bfc59..da9ae23 100644
--- a/compose/integration-tests/demos/lint-baseline.xml
+++ b/compose/integration-tests/demos/lint-baseline.xml
@@ -47,7 +47,7 @@
errorLine2=" ~~~~~~~~~">
<location
file="src/main/java/androidx/compose/integration/demos/DemoActivity.kt"
- line="76"
+ line="78"
column="13"/>
</issue>
@@ -58,7 +58,7 @@
errorLine2=" ~~~~~~~~~~~~">
<location
file="src/main/java/androidx/compose/integration/demos/DemoActivity.kt"
- line="151"
+ line="153"
column="13"/>
</issue>
diff --git a/compose/material/material-icons-core/build.gradle b/compose/material/material-icons-core/build.gradle
index 62742a3..8eac4c5 100644
--- a/compose/material/material-icons-core/build.gradle
+++ b/compose/material/material-icons-core/build.gradle
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+
+import androidx.build.AndroidXUiPlugin
import androidx.build.LibraryGroups
import androidx.build.LibraryVersions
import androidx.build.Publish
@@ -26,26 +28,50 @@
id("AndroidXPlugin")
id("com.android.library")
id("AndroidXUiPlugin")
- id("kotlin-multiplatform")
}
-kotlin {
- android()
- jvm("desktop")
+AndroidXUiPlugin.applyAndConfigureKotlinPlugin(project)
- sourceSets {
- commonMain.dependencies {
- implementation(KOTLIN_STDLIB_COMMON)
- api project(":compose:ui:ui")
- }
+if (!AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ dependencies {
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block below
+ */
+ kotlinPlugin project(":compose:compiler:compiler")
- androidMain.dependencies {
- implementation(KOTLIN_STDLIB)
+ api project(":compose:ui:ui")
+ implementation(KOTLIN_STDLIB)
+ }
+}
+
+if (AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ kotlin {
+ android()
+ jvm("desktop")
+
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block above
+ */
+ sourceSets {
+ commonMain.dependencies {
+ implementation(KOTLIN_STDLIB_COMMON)
+ api project(":compose:ui:ui")
+ }
+
+ androidMain.dependencies {
+ implementation(KOTLIN_STDLIB)
+ }
}
}
}
-IconGenerationTask.registerCoreIconProject(project)
+IconGenerationTask.registerCoreIconProject(
+ project,
+ android,
+ AndroidXUiPlugin.isMultiplatformEnabled(project)
+)
androidx {
name = "Compose Material Icons Core"
@@ -59,8 +85,6 @@
tasks.withType(KotlinCompile).configureEach {
kotlinOptions {
- freeCompilerArgs += [
- "-Xallow-jvm-ir-dependencies"
- ]
+ freeCompilerArgs += ["-Xallow-jvm-ir-dependencies"]
}
}
diff --git a/compose/material/material-icons-core/samples/build.gradle b/compose/material/material-icons-core/samples/build.gradle
index 5475392..5b123a9 100644
--- a/compose/material/material-icons-core/samples/build.gradle
+++ b/compose/material/material-icons-core/samples/build.gradle
@@ -29,7 +29,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
diff --git a/compose/material/material-icons-extended/build.gradle b/compose/material/material-icons-extended/build.gradle
index 6cd7c12f..6072319 100644
--- a/compose/material/material-icons-extended/build.gradle
+++ b/compose/material/material-icons-extended/build.gradle
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+
+import androidx.build.AndroidXUiPlugin
import androidx.build.LibraryGroups
import androidx.build.LibraryVersions
import androidx.build.Publish
@@ -26,43 +28,79 @@
id("AndroidXPlugin")
id("com.android.library")
id("AndroidXUiPlugin")
- id("kotlin-multiplatform")
}
+AndroidXUiPlugin.applyAndConfigureKotlinPlugin(project)
+
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
+
+ if(!AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block below
+ */
+
+ api project(":compose:material:material-icons-core")
+
+ implementation(KOTLIN_STDLIB_COMMON)
+ implementation project(":compose:runtime:runtime")
+
+ androidTestImplementation(ANDROIDX_TEST_RULES)
+ androidTestImplementation(ANDROIDX_TEST_RUNNER)
+ androidTestImplementation(JUNIT)
+ androidTestImplementation(KOTLIN_REFLECT)
+ androidTestImplementation(TRUTH)
+
+ androidTestImplementation project(":compose:foundation:foundation")
+ androidTestImplementation project(":compose:foundation:foundation-layout")
+ androidTestImplementation project(":compose:ui:ui")
+ androidTestImplementation project(":test-screenshot")
+ androidTestImplementation project(":ui:ui-test")
+ }
}
-kotlin {
- android()
- sourceSets {
- commonMain.dependencies {
- implementation(KOTLIN_STDLIB_COMMON)
- api project(":compose:material:material-icons-core")
- implementation project(":compose:runtime:runtime")
- }
+if(AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ kotlin {
+ android()
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block above
+ */
+ sourceSets {
+ commonMain.dependencies {
+ implementation(KOTLIN_STDLIB_COMMON)
+ api project(":compose:material:material-icons-core")
+ implementation project(":compose:runtime:runtime")
+ }
- androidTest.dependencies {
- implementation project(":compose:foundation:foundation")
- implementation project(":compose:foundation:foundation-layout")
- implementation project(":compose:ui:ui")
- implementation project(":test-screenshot")
- implementation project(":ui:ui-test")
+ androidTest.dependencies {
+ implementation project(":compose:foundation:foundation")
+ implementation project(":compose:foundation:foundation-layout")
+ implementation project(":compose:ui:ui")
+ implementation project(":test-screenshot")
+ implementation project(":ui:ui-test")
- implementation(ANDROIDX_TEST_RULES)
- implementation(ANDROIDX_TEST_RUNNER)
- implementation(JUNIT)
- implementation(KOTLIN_REFLECT)
- implementation(TRUTH)
+ implementation(ANDROIDX_TEST_RULES)
+ implementation(ANDROIDX_TEST_RUNNER)
+ implementation(JUNIT)
+ implementation(KOTLIN_REFLECT)
+ implementation(TRUTH)
+ }
}
}
}
+
android.buildTypes.all {
// Jacoco hangs intermittently due to the large number of files
testCoverageEnabled = false
}
-IconGenerationTask.registerExtendedIconProject(project, android)
+IconGenerationTask.registerExtendedIconProject(
+ project,
+ android,
+ AndroidXUiPlugin.isMultiplatformEnabled(project)
+)
androidx {
name = "Compose Material Icons Extended"
diff --git a/compose/material/material/build.gradle b/compose/material/material/build.gradle
index e7beba8..1af93a4 100644
--- a/compose/material/material/build.gradle
+++ b/compose/material/material/build.gradle
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+
+import androidx.build.AndroidXUiPlugin
import androidx.build.LibraryGroups
import androidx.build.LibraryVersions
import androidx.build.Publish
@@ -25,62 +27,106 @@
id("AndroidXPlugin")
id("com.android.library")
id("AndroidXUiPlugin")
- id("kotlin-multiplatform")
}
+AndroidXUiPlugin.applyAndConfigureKotlinPlugin(project)
+
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
+
+ if(!AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block below
+ */
+ api project(":compose:animation:animation-core")
+ api project(":compose:foundation:foundation")
+ api project(":compose:foundation:foundation-text")
+ api project(":compose:material:material-icons-core")
+ api project(":compose:runtime:runtime")
+ api project(":compose:ui:ui")
+ api project(":compose:ui:ui-text")
+
+ implementation(KOTLIN_STDLIB_COMMON)
+ implementation project(":compose:animation:animation")
+ implementation project(":compose:foundation:foundation-layout")
+ implementation project(":compose:ui:ui-util")
+
+ testImplementation(ANDROIDX_TEST_RULES)
+ testImplementation(ANDROIDX_TEST_RUNNER)
+ testImplementation(JUNIT)
+ testImplementation(TRUTH)
+
+ androidTestImplementation project(":compose:material:material:material-samples")
+ androidTestImplementation project(":test-screenshot")
+ androidTestImplementation project(":ui:ui-test")
+ androidTestImplementation(ANDROIDX_TEST_RULES)
+ androidTestImplementation(ANDROIDX_TEST_RUNNER)
+ androidTestImplementation(JUNIT)
+ androidTestImplementation(TRUTH)
+ androidTestImplementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
+ androidTestImplementation(MOCKITO_CORE, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
+ androidTestImplementation MOCKITO_KOTLIN, {
+ exclude group: 'org.mockito' // to keep control on the mockito version
+ }
+ }
}
-kotlin {
- android()
- jvm("desktop")
+if(AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ kotlin {
+ android()
+ jvm("desktop")
- sourceSets {
- commonMain.dependencies {
- implementation(KOTLIN_STDLIB_COMMON)
- api project(":compose:animation:animation-core")
- api project(":compose:foundation:foundation")
- api project(":compose:foundation:foundation-text")
- api project(":compose:material:material-icons-core")
- api project(":compose:runtime:runtime")
- api project(":compose:ui:ui")
- api project(":compose:ui:ui-text")
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block above
+ */
+ sourceSets {
+ commonMain.dependencies {
+ implementation(KOTLIN_STDLIB_COMMON)
+ api project(":compose:animation:animation-core")
+ api project(":compose:foundation:foundation")
+ api project(":compose:foundation:foundation-text")
+ api project(":compose:material:material-icons-core")
+ api project(":compose:runtime:runtime")
+ api project(":compose:ui:ui")
+ api project(":compose:ui:ui-text")
- implementation project(":compose:animation:animation")
- implementation project(":compose:foundation:foundation-layout")
- implementation project(":compose:ui:ui-util")
- }
+ implementation project(":compose:animation:animation")
+ implementation project(":compose:foundation:foundation-layout")
+ implementation project(":compose:ui:ui-util")
+ }
- androidMain.dependencies {
- api "androidx.annotation:annotation:1.1.0"
- }
+ androidMain.dependencies {
+ api "androidx.annotation:annotation:1.1.0"
+ }
- desktopMain.dependencies {
- implementation(KOTLIN_STDLIB)
- implementation(SKIKO)
- }
+ desktopMain.dependencies {
+ implementation(KOTLIN_STDLIB)
+ implementation(SKIKO)
+ }
- test.dependencies {
- implementation(ANDROIDX_TEST_RULES)
- implementation(ANDROIDX_TEST_RUNNER)
- implementation(JUNIT)
- implementation(TRUTH)
- }
+ test.dependencies {
+ implementation(ANDROIDX_TEST_RULES)
+ implementation(ANDROIDX_TEST_RUNNER)
+ implementation(JUNIT)
+ implementation(TRUTH)
+ }
- androidAndroidTest.dependencies {
- implementation project(":compose:material:material:material-samples")
- implementation project(":test-screenshot")
- implementation project(":ui:ui-test")
+ androidAndroidTest.dependencies {
+ implementation project(":compose:material:material:material-samples")
+ implementation project(":test-screenshot")
+ implementation project(":ui:ui-test")
- implementation(ANDROIDX_TEST_RULES)
- implementation(ANDROIDX_TEST_RUNNER)
- implementation(JUNIT)
- implementation(TRUTH)
- implementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
- implementation(MOCKITO_CORE, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
- implementation MOCKITO_KOTLIN, {
- exclude group: 'org.mockito' // to keep control on the mockito version
+ implementation(ANDROIDX_TEST_RULES)
+ implementation(ANDROIDX_TEST_RUNNER)
+ implementation(JUNIT)
+ implementation(TRUTH)
+ implementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
+ implementation(MOCKITO_CORE, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
+ implementation MOCKITO_KOTLIN, {
+ exclude group: 'org.mockito' // to keep control on the mockito version
+ }
}
}
}
@@ -113,8 +159,6 @@
tasks.withType(KotlinCompile).configureEach {
kotlinOptions {
- freeCompilerArgs += [
- "-Xallow-jvm-ir-dependencies"
- ]
+ freeCompilerArgs += ["-Xallow-jvm-ir-dependencies"]
}
}
diff --git a/compose/material/material/icons/generator/src/main/kotlin/androidx/compose/material/icons/generator/tasks/IconGenerationTask.kt b/compose/material/material/icons/generator/src/main/kotlin/androidx/compose/material/icons/generator/tasks/IconGenerationTask.kt
index 2f07104..6a16d7d 100644
--- a/compose/material/material/icons/generator/src/main/kotlin/androidx/compose/material/icons/generator/tasks/IconGenerationTask.kt
+++ b/compose/material/material/icons/generator/src/main/kotlin/androidx/compose/material/icons/generator/tasks/IconGenerationTask.kt
@@ -94,8 +94,18 @@
* [androidx.compose.material.icons.generator.CoreIcons], and no tests.
*/
@JvmStatic
- fun registerCoreIconProject(project: Project) {
- CoreIconGenerationTask.register(project)
+ fun registerCoreIconProject(
+ project: Project,
+ libraryExtension: LibraryExtension,
+ isMpp: Boolean
+ ) {
+ if (isMpp) {
+ CoreIconGenerationTask.register(project, null)
+ } else {
+ libraryExtension.libraryVariants.all { variant ->
+ CoreIconGenerationTask.register(project, variant)
+ }
+ }
}
/**
@@ -104,8 +114,18 @@
* test for every icon in both the core and extended project.
*/
@JvmStatic
- fun registerExtendedIconProject(project: Project, libraryExtension: LibraryExtension) {
- ExtendedIconGenerationTask.register(project)
+ fun registerExtendedIconProject(
+ project: Project,
+ libraryExtension: LibraryExtension,
+ isMpp: Boolean
+ ) {
+ if (isMpp) {
+ ExtendedIconGenerationTask.register(project, null)
+ } else {
+ libraryExtension.libraryVariants.all { variant ->
+ ExtendedIconGenerationTask.register(project, variant)
+ }
+ }
libraryExtension.testVariants.all { variant ->
IconTestingGenerationTask.register(project, variant)
diff --git a/compose/material/material/icons/generator/src/main/kotlin/androidx/compose/material/icons/generator/tasks/IconSourceTasks.kt b/compose/material/material/icons/generator/src/main/kotlin/androidx/compose/material/icons/generator/tasks/IconSourceTasks.kt
index 5335f84..8c4baef 100644
--- a/compose/material/material/icons/generator/src/main/kotlin/androidx/compose/material/icons/generator/tasks/IconSourceTasks.kt
+++ b/compose/material/material/icons/generator/src/main/kotlin/androidx/compose/material/icons/generator/tasks/IconSourceTasks.kt
@@ -18,6 +18,7 @@
import androidx.compose.material.icons.generator.CoreIcons
import androidx.compose.material.icons.generator.IconWriter
+import com.android.build.gradle.api.BaseVariant
import org.gradle.api.Project
import org.jetbrains.kotlin.gradle.plugin.KotlinSourceSet
@@ -32,12 +33,14 @@
/**
* Registers [CoreIconGenerationTask] in [project].
*/
- fun register(project: Project) {
+ fun register(project: Project, variant: BaseVariant? = null) {
val task = project.createGenerationTask(
"generateCoreIcons",
- CoreIconGenerationTask::class.java
+ CoreIconGenerationTask::class.java,
+ variant
)
- registerIconGenerationTask(project, task)
+ if (variant == null) registerIconGenerationTask(project, task) // multiplatform
+ else variant.registerIconGenerationTask(task) // agp
}
}
}
@@ -51,14 +54,16 @@
companion object {
/**
- * Registers [ExtendedIconGenerationTask] in [project].
+ * Registers [ExtendedIconGenerationTask] in [project]. (for use with mpp)
*/
- fun register(project: Project) {
+ fun register(project: Project, variant: BaseVariant? = null) {
val task = project.createGenerationTask(
"generateExtendedIcons",
- ExtendedIconGenerationTask::class.java
+ ExtendedIconGenerationTask::class.java,
+ variant
)
- registerIconGenerationTask(project, task)
+ if (variant == null) registerIconGenerationTask(project, task) // multiplatform
+ else variant.registerIconGenerationTask(task) // agp
}
}
}
@@ -73,3 +78,12 @@
val sourceSet = project.getMultiplatformSourceSet(KotlinSourceSet.COMMON_MAIN_SOURCE_SET_NAME)
sourceSet.kotlin.srcDir(project.files(task.generatedSrcMainDirectory).builtBy(task))
}
+
+/**
+ * Helper to register [task] as the java source generating task.
+ */
+private fun BaseVariant.registerIconGenerationTask(
+ task: IconGenerationTask
+) {
+ registerJavaGeneratingTask(task, task.generatedSrcMainDirectory)
+}
diff --git a/compose/material/material/icons/generator/src/main/kotlin/androidx/compose/material/icons/generator/tasks/IconTestingGenerationTask.kt b/compose/material/material/icons/generator/src/main/kotlin/androidx/compose/material/icons/generator/tasks/IconTestingGenerationTask.kt
index 74cc076..cd9ec7c 100644
--- a/compose/material/material/icons/generator/src/main/kotlin/androidx/compose/material/icons/generator/tasks/IconTestingGenerationTask.kt
+++ b/compose/material/material/icons/generator/src/main/kotlin/androidx/compose/material/icons/generator/tasks/IconTestingGenerationTask.kt
@@ -64,9 +64,7 @@
variant.registerGeneratedResFolders(
project.files(task.generatedResourceDirectory).builtBy(task)
)
- val sourceSet = project.getMultiplatformSourceSet("androidAndroidTest")
- sourceSet.kotlin
- .srcDir(project.files(task.generatedSrcAndroidTestDirectory).builtBy(task))
+ variant.registerJavaGeneratingTask(task, task.generatedSrcAndroidTestDirectory)
}
}
}
diff --git a/compose/material/material/integration-tests/material-demos/build.gradle b/compose/material/material/integration-tests/material-demos/build.gradle
index 587547e..6771f58 100644
--- a/compose/material/material/integration-tests/material-demos/build.gradle
+++ b/compose/material/material/integration-tests/material-demos/build.gradle
@@ -11,7 +11,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
implementation project(":compose:androidview:androidview")
diff --git a/compose/material/material/integration-tests/material-studies/build.gradle b/compose/material/material/integration-tests/material-studies/build.gradle
index d1b3805..e688a05 100644
--- a/compose/material/material/integration-tests/material-studies/build.gradle
+++ b/compose/material/material/integration-tests/material-studies/build.gradle
@@ -26,7 +26,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
diff --git a/compose/material/material/samples/build.gradle b/compose/material/material/samples/build.gradle
index 22da08b..ee6c0fd 100644
--- a/compose/material/material/samples/build.gradle
+++ b/compose/material/material/samples/build.gradle
@@ -29,7 +29,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/ListItem.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/ListItem.kt
index a854c50..249ae34 100644
--- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/ListItem.kt
+++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/ListItem.kt
@@ -345,14 +345,10 @@
content: @Composable () -> Unit
) {
Layout(content, modifier) { measurables, constraints ->
- val childConstraints = constraints.copy(
- minWidth = 0,
- minHeight = 0,
- maxHeight = Constraints.Infinity
- )
+ val childConstraints = constraints.copy(minHeight = 0, maxHeight = Constraints.Infinity)
val placeables = measurables.map { it.measure(childConstraints) }
- val containerWidth = placeables.fold(constraints.minWidth) { maxWidth, placeable ->
+ val containerWidth = placeables.fold(0) { maxWidth, placeable ->
max(maxWidth, placeable.width)
}
val y = Array(placeables.size) { 0 }
diff --git a/compose/navigation/navigation/build.gradle b/compose/navigation/navigation/build.gradle
index 73e594b..8d38d54 100644
--- a/compose/navigation/navigation/build.gradle
+++ b/compose/navigation/navigation/build.gradle
@@ -30,7 +30,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
api project(":compose:runtime:runtime")
diff --git a/compose/navigation/navigation/integration-tests/navigation-demos/build.gradle b/compose/navigation/navigation/integration-tests/navigation-demos/build.gradle
index da56a02..998e6c7 100644
--- a/compose/navigation/navigation/integration-tests/navigation-demos/build.gradle
+++ b/compose/navigation/navigation/integration-tests/navigation-demos/build.gradle
@@ -28,7 +28,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
implementation project(":compose:integration-tests:demos:common")
diff --git a/compose/navigation/navigation/samples/build.gradle b/compose/navigation/navigation/samples/build.gradle
index fc3d7af..a3c5d15 100644
--- a/compose/navigation/navigation/samples/build.gradle
+++ b/compose/navigation/navigation/samples/build.gradle
@@ -30,7 +30,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
implementation project(":annotation:annotation-sampled")
diff --git a/compose/runtime/runtime-dispatch/build.gradle b/compose/runtime/runtime-dispatch/build.gradle
index 992e6b7..a8c1554 100644
--- a/compose/runtime/runtime-dispatch/build.gradle
+++ b/compose/runtime/runtime-dispatch/build.gradle
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+
+import androidx.build.AndroidXUiPlugin
import androidx.build.LibraryGroups
import androidx.build.LibraryVersions
import androidx.build.Publish
@@ -25,47 +27,77 @@
id("AndroidXPlugin")
id("AndroidXUiPlugin")
id("com.android.library")
- id("kotlin-multiplatform")
}
-kotlin {
- android()
- jvm("desktop")
+AndroidXUiPlugin.applyAndConfigureKotlinPlugin(project)
- sourceSets {
- commonMain.dependencies {
- implementation(KOTLIN_STDLIB_COMMON)
- api(KOTLIN_COROUTINES_CORE)
- }
- jvmMain.dependencies {
- implementation(KOTLIN_STDLIB)
- api(KOTLIN_COROUTINES_CORE)
- }
- androidMain {
- dependencies {
- api "androidx.annotation:annotation:1.1.0"
- implementation("androidx.core:core-ktx:1.1.0")
- implementation(KOTLIN_COROUTINES_ANDROID)
+if(!AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ dependencies {
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block below
+ */
+
+ api(KOTLIN_COROUTINES_CORE)
+ api "androidx.annotation:annotation:1.1.0"
+
+ implementation(KOTLIN_STDLIB_COMMON)
+ implementation(KOTLIN_STDLIB)
+ implementation("androidx.core:core-ktx:1.1.0")
+ implementation(KOTLIN_COROUTINES_ANDROID)
+
+ androidTestImplementation(ANDROIDX_TEST_RULES)
+ androidTestImplementation(ANDROIDX_TEST_RUNNER)
+ androidTestImplementation(ANDROIDX_TEST_EXT_KTX)
+ androidTestImplementation(ANDROIDX_TEST_UIAUTOMATOR)
+ androidTestImplementation(JUNIT)
+ }
+}
+
+if(AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ kotlin {
+ android()
+ jvm("desktop")
+
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block above
+ */
+ sourceSets {
+ commonMain.dependencies {
+ implementation(KOTLIN_STDLIB_COMMON)
+ api(KOTLIN_COROUTINES_CORE)
}
- dependsOn jvmMain
- }
+ jvmMain.dependencies {
+ implementation(KOTLIN_STDLIB)
+ api(KOTLIN_COROUTINES_CORE)
+ }
+ androidMain {
+ dependencies {
+ api "androidx.annotation:annotation:1.1.0"
+ implementation("androidx.core:core-ktx:1.1.0")
+ implementation(KOTLIN_COROUTINES_ANDROID)
+ }
+ dependsOn jvmMain
+ }
- androidTest.dependencies {
- implementation(ANDROIDX_TEST_RULES)
- implementation(ANDROIDX_TEST_RUNNER)
- implementation(JUNIT)
- }
+ androidTest.dependencies {
+ implementation(ANDROIDX_TEST_RULES)
+ implementation(ANDROIDX_TEST_RUNNER)
+ implementation(JUNIT)
+ }
- androidAndroidTest.dependencies {
- implementation(ANDROIDX_TEST_RULES)
- implementation(ANDROIDX_TEST_RUNNER)
- implementation(ANDROIDX_TEST_EXT_KTX)
- implementation(ANDROIDX_TEST_UIAUTOMATOR)
- implementation(JUNIT)
- }
+ androidAndroidTest.dependencies {
+ implementation(ANDROIDX_TEST_RULES)
+ implementation(ANDROIDX_TEST_RUNNER)
+ implementation(ANDROIDX_TEST_EXT_KTX)
+ implementation(ANDROIDX_TEST_UIAUTOMATOR)
+ implementation(JUNIT)
+ }
- desktopMain {
- dependsOn jvmMain
+ desktopMain {
+ dependsOn jvmMain
+ }
}
}
}
@@ -94,7 +126,7 @@
tasks.withType(KotlinCompile).configureEach {
kotlinOptions {
freeCompilerArgs += [
- "-Xuse-experimental=kotlin.Experimental"
+ "-Xuse-experimental=kotlin.Experimental"
]
useIR = true
}
diff --git a/compose/runtime/runtime-livedata/build.gradle b/compose/runtime/runtime-livedata/build.gradle
index bc93400..b06349d 100644
--- a/compose/runtime/runtime-livedata/build.gradle
+++ b/compose/runtime/runtime-livedata/build.gradle
@@ -29,7 +29,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
diff --git a/compose/runtime/runtime-livedata/samples/build.gradle b/compose/runtime/runtime-livedata/samples/build.gradle
index 866bed1..9d48856 100644
--- a/compose/runtime/runtime-livedata/samples/build.gradle
+++ b/compose/runtime/runtime-livedata/samples/build.gradle
@@ -29,7 +29,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
implementation project(":annotation:annotation-sampled")
diff --git a/compose/runtime/runtime-rxjava2/build.gradle b/compose/runtime/runtime-rxjava2/build.gradle
index 290cb51..1f70a33 100644
--- a/compose/runtime/runtime-rxjava2/build.gradle
+++ b/compose/runtime/runtime-rxjava2/build.gradle
@@ -29,7 +29,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
diff --git a/compose/runtime/runtime-rxjava2/samples/build.gradle b/compose/runtime/runtime-rxjava2/samples/build.gradle
index 85ff46c4..ed359a2 100644
--- a/compose/runtime/runtime-rxjava2/samples/build.gradle
+++ b/compose/runtime/runtime-rxjava2/samples/build.gradle
@@ -29,7 +29,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
implementation project(":annotation:annotation-sampled")
diff --git a/compose/runtime/runtime-saved-instance-state/build.gradle b/compose/runtime/runtime-saved-instance-state/build.gradle
index 99f2908..a622449 100644
--- a/compose/runtime/runtime-saved-instance-state/build.gradle
+++ b/compose/runtime/runtime-saved-instance-state/build.gradle
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+
+import androidx.build.AndroidXUiPlugin
import androidx.build.LibraryGroups
import androidx.build.LibraryVersions
import androidx.build.Publish
@@ -25,52 +27,89 @@
id("AndroidXPlugin")
id("com.android.library")
id("AndroidXUiPlugin")
- id("kotlin-multiplatform")
}
+AndroidXUiPlugin.applyAndConfigureKotlinPlugin(project)
+
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
+
+ if(!AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ /* When updating dependencies, make sure to make the an an analogous update in the
+ corresponding block below */
+ api project(":compose:runtime:runtime")
+ api "androidx.annotation:annotation:1.1.0"
+
+ implementation project(":compose:ui:ui-util")
+ implementation(KOTLIN_STDLIB)
+
+ testImplementation(JUNIT)
+ testImplementation(TRUTH)
+ testImplementation(ANDROIDX_TEST_CORE)
+ testImplementation(ANDROIDX_TEST_RULES)
+
+ androidTestImplementation project(':compose:ui:ui')
+ androidTestImplementation project(':ui:ui-test')
+ androidTestImplementation "androidx.fragment:fragment:1.3.0-alpha05"
+ androidTestImplementation(ANDROIDX_TEST_UIAUTOMATOR)
+ androidTestImplementation(ANDROIDX_TEST_CORE)
+ androidTestImplementation(ANDROIDX_TEST_RULES)
+ androidTestImplementation(ANDROIDX_TEST_RUNNER)
+ androidTestImplementation(ESPRESSO_CORE)
+ androidTestImplementation(JUNIT)
+ androidTestImplementation(TRUTH)
+ androidTestImplementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy)
+ // DexMaker has it"s own MockMaker
+ androidTestImplementation(MOCKITO_CORE, libs.exclude_bytebuddy)
+ // DexMaker has it"s own MockMaker
+ }
}
-kotlin {
- android()
- jvm("desktop")
+if(AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ kotlin {
+ android()
+ jvm("desktop")
- sourceSets {
- commonMain.dependencies {
- implementation(KOTLIN_STDLIB_COMMON)
+ /* When updating dependencies, make sure to make the an an analogous update in the
+ corresponding block above */
+ sourceSets {
+ commonMain.dependencies {
+ implementation(KOTLIN_STDLIB_COMMON)
- api project(":compose:runtime:runtime")
- implementation project(":compose:ui:ui-util")
+ api project(":compose:runtime:runtime")
+ implementation project(":compose:ui:ui-util")
- }
+ }
- androidMain.dependencies {
- implementation(KOTLIN_STDLIB)
- api "androidx.annotation:annotation:1.1.0"
- }
+ androidMain.dependencies {
+ implementation(KOTLIN_STDLIB)
+ api "androidx.annotation:annotation:1.1.0"
+ }
- androidTest.dependencies {
- implementation(ANDROIDX_TEST_RULES)
- implementation(ANDROIDX_TEST_RUNNER)
- implementation(JUNIT)
- implementation(TRUTH)
- }
+ androidTest.dependencies {
+ implementation(ANDROIDX_TEST_RULES)
+ implementation(ANDROIDX_TEST_RUNNER)
+ implementation(JUNIT)
+ implementation(TRUTH)
+ }
- androidAndroidTest.dependencies {
- implementation project(':compose:ui:ui')
- implementation project(':ui:ui-test')
- implementation "androidx.fragment:fragment:1.3.0-alpha05"
- implementation(ANDROIDX_TEST_UIAUTOMATOR)
- implementation(ANDROIDX_TEST_CORE)
- implementation(ANDROIDX_TEST_RULES)
- implementation(ANDROIDX_TEST_RUNNER)
- implementation(ESPRESSO_CORE)
- implementation(JUNIT)
- implementation(TRUTH)
- implementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
- implementation(MOCKITO_CORE, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
+ androidAndroidTest.dependencies {
+ implementation project(':compose:ui:ui')
+ implementation project(':ui:ui-test')
+ implementation "androidx.fragment:fragment:1.3.0-alpha05"
+ implementation(ANDROIDX_TEST_UIAUTOMATOR)
+ implementation(ANDROIDX_TEST_CORE)
+ implementation(ANDROIDX_TEST_RULES)
+ implementation(ANDROIDX_TEST_RUNNER)
+ implementation(ESPRESSO_CORE)
+ implementation(JUNIT)
+ implementation(TRUTH)
+ implementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy)
+ // DexMaker has it"s own MockMaker
+ implementation(MOCKITO_CORE, libs.exclude_bytebuddy)
+ // DexMaker has it"s own MockMaker
+ }
}
}
}
diff --git a/compose/runtime/runtime-saved-instance-state/samples/build.gradle b/compose/runtime/runtime-saved-instance-state/samples/build.gradle
index 5d6f5d8..9b5b52a 100644
--- a/compose/runtime/runtime-saved-instance-state/samples/build.gradle
+++ b/compose/runtime/runtime-saved-instance-state/samples/build.gradle
@@ -29,7 +29,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
diff --git a/compose/runtime/runtime/build.gradle b/compose/runtime/runtime/build.gradle
index e8559f3..d70e3f2 100644
--- a/compose/runtime/runtime/build.gradle
+++ b/compose/runtime/runtime/build.gradle
@@ -15,6 +15,7 @@
*/
+import androidx.build.AndroidXUiPlugin
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import static androidx.build.dependencies.DependenciesKt.*
@@ -26,53 +27,91 @@
id("AndroidXPlugin")
id("AndroidXUiPlugin")
id("com.android.library")
- id("kotlin-multiplatform")
}
+
+AndroidXUiPlugin.applyAndConfigureKotlinPlugin(project)
+
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
+
+ if(!AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block below
+ */
+
+ api project(':compose:runtime:runtime-dispatch')
+ api(KOTLIN_COROUTINES_ANDROID)
+
+ implementation "androidx.annotation:annotation:1.1.0"
+ implementation "org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3"
+ implementation("androidx.core:core-ktx:1.1.0")
+ implementation(KOTLIN_REFLECT)
+ implementation(KOTLIN_STDLIB)
+
+ testImplementation KOTLIN_TEST_JUNIT
+ testImplementation(JUNIT)
+ testImplementation(ROBOLECTRIC)
+
+ androidTestImplementation KOTLIN_TEST_JUNIT
+ androidTestImplementation project(':compose:ui:ui')
+ androidTestImplementation project(':ui:ui-test')
+ androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
+ androidTestImplementation(ANDROIDX_TEST_RULES)
+ androidTestImplementation(ANDROIDX_TEST_RUNNER)
+ androidTestImplementation(JUNIT)
+ androidTestImplementation(TRUTH)
+ }
}
-kotlin {
- android()
- jvm("desktop")
- sourceSets {
- commonMain.dependencies {
- implementation(KOTLIN_STDLIB_COMMON)
- implementation(KOTLIN_COROUTINES_CORE)
- api project(':compose:runtime:runtime-dispatch')
- }
- jvmMain.dependencies {
- implementation(KOTLIN_STDLIB)
- api(KOTLIN_COROUTINES_CORE)
- implementation "org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3"
- }
- androidMain {
- dependencies {
- api(KOTLIN_COROUTINES_ANDROID)
- api "androidx.annotation:annotation:1.1.0"
+if(AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ kotlin {
+ android()
+ jvm("desktop")
- implementation("androidx.core:core-ktx:1.1.0")
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block above
+ */
+ sourceSets {
+ commonMain.dependencies {
+ implementation(KOTLIN_STDLIB_COMMON)
+ implementation(KOTLIN_COROUTINES_CORE)
+ api project(':compose:runtime:runtime-dispatch')
}
- dependsOn jvmMain
- }
- desktopMain {
- dependencies {
- api(KOTLIN_COROUTINES_SWING)
+ jvmMain.dependencies {
+ implementation(KOTLIN_STDLIB)
+ api(KOTLIN_COROUTINES_CORE)
+ implementation "org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3"
}
- dependsOn jvmMain
- }
+ androidMain {
+ dependencies {
+ api(KOTLIN_COROUTINES_ANDROID)
+ api "androidx.annotation:annotation:1.1.0"
- commonTest.dependencies {
- implementation kotlin("test-junit")
- implementation project(":compose:ui:ui")
- }
- androidAndroidTest.dependencies {
- implementation(ANDROIDX_TEST_EXT_JUNIT)
- implementation(ANDROIDX_TEST_RULES)
- implementation(ANDROIDX_TEST_RUNNER)
- implementation(TRUTH)
- implementation project(':compose:ui:ui')
- implementation project(':ui:ui-test')
+ implementation("androidx.core:core-ktx:1.1.0")
+ }
+ dependsOn jvmMain
+ }
+ desktopMain {
+ dependencies {
+ api(KOTLIN_COROUTINES_SWING)
+ }
+ dependsOn jvmMain
+ }
+
+ commonTest.dependencies {
+ implementation kotlin("test-junit")
+ implementation project(":compose:ui:ui")
+ }
+ androidAndroidTest.dependencies {
+ implementation(ANDROIDX_TEST_EXT_JUNIT)
+ implementation(ANDROIDX_TEST_RULES)
+ implementation(ANDROIDX_TEST_RUNNER)
+ implementation(TRUTH)
+ implementation project(':compose:ui:ui')
+ implementation project(':ui:ui-test')
+ }
}
}
}
diff --git a/compose/runtime/runtime/compose-runtime-benchmark/build.gradle b/compose/runtime/runtime/compose-runtime-benchmark/build.gradle
index c3c8206..4b8b312 100644
--- a/compose/runtime/runtime/compose-runtime-benchmark/build.gradle
+++ b/compose/runtime/runtime/compose-runtime-benchmark/build.gradle
@@ -45,7 +45,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
androidTestImplementation(project("::compose:ui:ui"))
androidTestImplementation(project(":compose:foundation:foundation"))
diff --git a/compose/runtime/runtime/samples/build.gradle b/compose/runtime/runtime/samples/build.gradle
index 79b6d05..b942a92 100644
--- a/compose/runtime/runtime/samples/build.gradle
+++ b/compose/runtime/runtime/samples/build.gradle
@@ -29,7 +29,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
diff --git a/compose/test-utils/build.gradle b/compose/test-utils/build.gradle
index 7c10786..316de68 100644
--- a/compose/test-utils/build.gradle
+++ b/compose/test-utils/build.gradle
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+
+import androidx.build.AndroidXUiPlugin
import androidx.build.Publish
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
@@ -23,39 +25,71 @@
id("AndroidXPlugin")
id("com.android.library")
id("AndroidXUiPlugin")
- id("kotlin-multiplatform")
}
+AndroidXUiPlugin.applyAndConfigureKotlinPlugin(project)
+
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
+
+ if(!AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block below
+ */
+
+ api "androidx.activity:activity:1.2.0-alpha02"
+
+ implementation(KOTLIN_STDLIB_COMMON)
+ implementation project(":benchmark:benchmark-junit4")
+ implementation project(":compose:runtime:runtime")
+ implementation project(":compose:ui:ui")
+ implementation project(":ui:ui-test")
+ implementation(ANDROIDX_TEST_RULES)
+
+ // This has stub APIs for access to legacy Android APIs, so we don't want
+ // any dependency on this module.
+ compileOnly project(":compose:ui:ui-android-stubs")
+
+ testImplementation(TRUTH)
+
+ androidTestImplementation(TRUTH)
+ androidTestImplementation project(':compose:material:material')
+ }
}
-kotlin {
- android()
- sourceSets {
- commonMain.dependencies {
- implementation(KOTLIN_STDLIB_COMMON)
- implementation project(":benchmark:benchmark-junit4")
- implementation project(":compose:runtime:runtime")
- implementation project(":compose:ui:ui")
- implementation project(":ui:ui-test")
- }
+if (AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ kotlin {
+ android()
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block above
+ */
+ sourceSets {
+ commonMain.dependencies {
+ implementation(KOTLIN_STDLIB_COMMON)
+ implementation project(":benchmark:benchmark-junit4")
+ implementation project(":compose:runtime:runtime")
+ implementation project(":compose:ui:ui")
+ implementation project(":ui:ui-test")
+ }
- androidMain.dependencies {
- api "androidx.activity:activity:1.2.0-alpha02"
- // This has stub APIs for access to legacy Android APIs, so we don't want
- // any dependency on this module.
- compileOnly project(":compose:ui:ui-android-stubs")
- implementation(ANDROIDX_TEST_RULES)
- }
+ androidMain.dependencies {
+ api "androidx.activity:activity:1.2.0-alpha02"
+ // This has stub APIs for access to legacy Android APIs, so we don't want
+ // any dependency on this module.
+ compileOnly project(":compose:ui:ui-android-stubs")
+ implementation(ANDROIDX_TEST_RULES)
+ }
- test.dependencies {
- implementation(TRUTH)
- }
+ test.dependencies {
+ implementation(TRUTH)
+ }
- androidAndroidTest.dependencies {
- implementation(TRUTH)
- implementation project(':compose:material:material')
+ androidAndroidTest.dependencies {
+ implementation(TRUTH)
+ implementation project(':compose:material:material')
+ }
}
}
}
diff --git a/compose/ui/ui-geometry/build.gradle b/compose/ui/ui-geometry/build.gradle
index 2e5c5e4..7b9b41e 100644
--- a/compose/ui/ui-geometry/build.gradle
+++ b/compose/ui/ui-geometry/build.gradle
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+
+import androidx.build.AndroidXUiPlugin
import androidx.build.LibraryGroups
import androidx.build.LibraryVersions
import androidx.build.Publish
@@ -25,29 +27,55 @@
id("AndroidXPlugin")
id("com.android.library")
id("AndroidXUiPlugin")
- id("kotlin-multiplatform")
}
-kotlin {
- android()
- jvm("desktop")
+AndroidXUiPlugin.applyAndConfigureKotlinPlugin(project)
- sourceSets {
- commonMain.dependencies {
- implementation(KOTLIN_STDLIB_COMMON)
+if(!AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ dependencies {
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block below
+ */
- implementation project(":compose:runtime:runtime")
- implementation project(":compose:ui:ui-util")
- }
- jvmMain.dependencies {
- implementation(KOTLIN_STDLIB)
- }
- androidMain.dependencies {
- api "androidx.annotation:annotation:1.1.0"
- }
+ api "androidx.annotation:annotation:1.1.0"
- commonTest.dependencies {
- implementation kotlin("test-junit")
+ implementation project(":compose:runtime:runtime")
+ implementation project(":compose:ui:ui-util")
+ implementation(KOTLIN_STDLIB)
+
+ testImplementation(JUNIT)
+ testImplementation(TRUTH)
+ testImplementation(KOTLIN_TEST)
+ }
+}
+
+if(AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ kotlin {
+ android()
+ jvm("desktop")
+
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block above
+ */
+ sourceSets {
+ commonMain.dependencies {
+ implementation(KOTLIN_STDLIB_COMMON)
+
+ implementation project(":compose:runtime:runtime")
+ implementation project(":compose:ui:ui-util")
+ }
+ jvmMain.dependencies {
+ implementation(KOTLIN_STDLIB)
+ }
+ androidMain.dependencies {
+ api "androidx.annotation:annotation:1.1.0"
+ }
+
+ commonTest.dependencies {
+ implementation kotlin("test-junit")
+ }
}
}
}
diff --git a/compose/ui/ui-graphics/build.gradle b/compose/ui/ui-graphics/build.gradle
index 152e552..b56fe137 100644
--- a/compose/ui/ui-graphics/build.gradle
+++ b/compose/ui/ui-graphics/build.gradle
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+import androidx.build.AndroidXUiPlugin
import androidx.build.LibraryGroups
import androidx.build.LibraryVersions
import androidx.build.Publish
@@ -25,54 +26,91 @@
id("AndroidXPlugin")
id("com.android.library")
id("AndroidXUiPlugin")
- id("kotlin-multiplatform")
}
-kotlin {
- android()
- jvm("desktop")
+AndroidXUiPlugin.applyAndConfigureKotlinPlugin(project)
- sourceSets {
- commonMain.dependencies {
- implementation(KOTLIN_STDLIB_COMMON)
+if(!AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ dependencies {
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block below
+ */
- api project(":compose:ui:ui-unit")
- implementation project(":compose:runtime:runtime")
- implementation project(":compose:ui:ui-util")
- }
+ api "androidx.annotation:annotation:1.1.0"
+ api project(":compose:ui:ui-unit")
- androidMain.dependencies {
- api "androidx.annotation:annotation:1.1.0"
- }
+ implementation project(":compose:runtime:runtime")
+ implementation project(":compose:ui:ui-util")
+ implementation(KOTLIN_STDLIB_COMMON)
- desktopMain.dependencies {
- implementation(KOTLIN_STDLIB)
- implementation(SKIKO)
- }
+ testImplementation(ANDROIDX_TEST_RULES)
+ testImplementation(ANDROIDX_TEST_RUNNER)
+ testImplementation(JUNIT)
+ testImplementation(TRUTH)
- androidTest.dependencies {
- implementation(ANDROIDX_TEST_RULES)
- implementation(ANDROIDX_TEST_RUNNER)
- implementation(JUNIT)
- implementation(TRUTH)
- }
+ androidTestImplementation project(":compose:ui:ui-graphics:ui-graphics-samples")
+ androidTestImplementation project(":ui:ui-test")
+ androidTestImplementation(ANDROIDX_TEST_RULES)
+ androidTestImplementation(ANDROIDX_TEST_RUNNER)
+ androidTestImplementation(ESPRESSO_CORE)
+ androidTestImplementation(JUNIT)
+ androidTestImplementation(TRUTH)
+ }
+}
- androidAndroidTest.dependencies {
- implementation project(":compose:ui:ui-graphics:ui-graphics-samples")
- implementation project(":ui:ui-test")
- implementation(ANDROIDX_TEST_RULES)
- implementation(ANDROIDX_TEST_RUNNER)
- implementation(ESPRESSO_CORE)
- implementation(JUNIT)
- }
+if(AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ kotlin {
+ android()
+ jvm("desktop")
- desktopTest {
- resources.srcDirs += "src/desktopTest/res"
- dependencies {
- implementation project(":ui:ui-test")
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block above
+ */
+
+ sourceSets {
+ commonMain.dependencies {
+ implementation(KOTLIN_STDLIB_COMMON)
+
+ api project(":compose:ui:ui-unit")
+ implementation project(":compose:runtime:runtime")
+ implementation project(":compose:ui:ui-util")
+ }
+
+ androidMain.dependencies {
+ api "androidx.annotation:annotation:1.1.0"
+ }
+
+ desktopMain.dependencies {
+ implementation(KOTLIN_STDLIB)
+ implementation(SKIKO)
+ }
+
+ androidTest.dependencies {
+ implementation(ANDROIDX_TEST_RULES)
+ implementation(ANDROIDX_TEST_RUNNER)
implementation(JUNIT)
implementation(TRUTH)
- implementation(SKIKO_CURRENT_OS)
+ }
+
+ androidAndroidTest.dependencies {
+ implementation project(":compose:ui:ui-graphics:ui-graphics-samples")
+ implementation project(":ui:ui-test")
+ implementation(ANDROIDX_TEST_RULES)
+ implementation(ANDROIDX_TEST_RUNNER)
+ implementation(ESPRESSO_CORE)
+ implementation(JUNIT)
+ }
+
+ desktopTest {
+ resources.srcDirs += "src/desktopTest/res"
+ dependencies {
+ implementation project(":ui:ui-test")
+ implementation(JUNIT)
+ implementation(TRUTH)
+ implementation(SKIKO_CURRENT_OS)
+ }
}
}
}
@@ -88,8 +126,10 @@
legacyDisableKotlinStrictApiMode = true
}
-tasks.findByName("desktopTest").configure {
- systemProperties['GOLDEN_PATH'] = project.rootDir.absolutePath + "/../../../golden"
+if(AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ tasks.findByName("desktopTest").configure {
+ systemProperties['GOLDEN_PATH'] = project.rootDir.absolutePath + "/../../../golden"
+ }
}
tasks.withType(KotlinCompile).configureEach {
diff --git a/compose/ui/ui-graphics/samples/build.gradle b/compose/ui/ui-graphics/samples/build.gradle
index cbf59f9..2bd0916 100644
--- a/compose/ui/ui-graphics/samples/build.gradle
+++ b/compose/ui/ui-graphics/samples/build.gradle
@@ -29,7 +29,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
diff --git a/compose/ui/ui-text-android/lint-baseline.xml b/compose/ui/ui-text-android/lint-baseline.xml
index 31fbebd..705f8a4 100644
--- a/compose/ui/ui-text-android/lint-baseline.xml
+++ b/compose/ui/ui-text-android/lint-baseline.xml
@@ -8,7 +8,7 @@
errorLine2=" ~~~~~~">
<location
file="src/main/java/androidx/compose/ui/text/android/style/FontSpan.kt"
- line="52"
+ line="46"
column="25"/>
</issue>
diff --git a/compose/ui/ui-text/api/current.txt b/compose/ui/ui-text/api/current.txt
index 5749445..d0156749 100644
--- a/compose/ui/ui-text/api/current.txt
+++ b/compose/ui/ui-text/api/current.txt
@@ -1132,7 +1132,6 @@
public enum TextOverflow {
enum_constant public static final androidx.compose.ui.text.style.TextOverflow Clip;
enum_constant public static final androidx.compose.ui.text.style.TextOverflow Ellipsis;
- enum_constant public static final androidx.compose.ui.text.style.TextOverflow None;
}
}
diff --git a/compose/ui/ui-text/api/public_plus_experimental_current.txt b/compose/ui/ui-text/api/public_plus_experimental_current.txt
index 5749445..d0156749 100644
--- a/compose/ui/ui-text/api/public_plus_experimental_current.txt
+++ b/compose/ui/ui-text/api/public_plus_experimental_current.txt
@@ -1132,7 +1132,6 @@
public enum TextOverflow {
enum_constant public static final androidx.compose.ui.text.style.TextOverflow Clip;
enum_constant public static final androidx.compose.ui.text.style.TextOverflow Ellipsis;
- enum_constant public static final androidx.compose.ui.text.style.TextOverflow None;
}
}
diff --git a/compose/ui/ui-text/api/restricted_current.txt b/compose/ui/ui-text/api/restricted_current.txt
index 5749445..d0156749 100644
--- a/compose/ui/ui-text/api/restricted_current.txt
+++ b/compose/ui/ui-text/api/restricted_current.txt
@@ -1132,7 +1132,6 @@
public enum TextOverflow {
enum_constant public static final androidx.compose.ui.text.style.TextOverflow Clip;
enum_constant public static final androidx.compose.ui.text.style.TextOverflow Ellipsis;
- enum_constant public static final androidx.compose.ui.text.style.TextOverflow None;
}
}
diff --git a/compose/ui/ui-text/build.gradle b/compose/ui/ui-text/build.gradle
index 0571113..29d7def 100644
--- a/compose/ui/ui-text/build.gradle
+++ b/compose/ui/ui-text/build.gradle
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+
+import androidx.build.AndroidXUiPlugin
import androidx.build.LibraryGroups
import androidx.build.LibraryVersions
import androidx.build.Publish
@@ -25,67 +27,123 @@
id("AndroidXPlugin")
id("com.android.library")
id("AndroidXUiPlugin")
- id("kotlin-multiplatform")
}
-kotlin {
- android()
- jvm("desktop")
+AndroidXUiPlugin.applyAndConfigureKotlinPlugin(project)
- sourceSets {
- commonMain.dependencies {
- implementation(KOTLIN_STDLIB_COMMON)
+if(!AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ dependencies {
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block below
+ */
+ implementation(KOTLIN_STDLIB_COMMON)
- api project(":compose:ui:ui-graphics")
- api project(":compose:ui:ui-unit")
+ api project(":compose:ui:ui-graphics")
+ api project(":compose:ui:ui-unit")
+ api "androidx.annotation:annotation:1.1.0"
- implementation project(":compose:runtime:runtime")
- implementation project(":compose:runtime:runtime-saved-instance-state")
- implementation project(":compose:ui:ui-util")
+ implementation project(":compose:runtime:runtime")
+ implementation project(":compose:runtime:runtime-saved-instance-state")
+ implementation project(":compose:ui:ui-util")
+ implementation(KOTLIN_STDLIB)
+ implementation "androidx.collection:collection:1.1.0"
+ implementation "androidx.core:core:1.5.0-alpha01"
+ implementation project(":compose:ui:ui-text-android")
+
+ testImplementation project(":compose:ui:ui-test-font")
+ testImplementation(ANDROIDX_TEST_RULES)
+ testImplementation(ANDROIDX_TEST_RUNNER)
+ testImplementation(JUNIT)
+ testImplementation(MOCKITO_CORE)
+ testImplementation(TRUTH)
+ testImplementation(KOTLIN_REFLECT)
+ testImplementation MOCKITO_KOTLIN, {
+ exclude group: 'org.mockito' // to keep control on the mockito version
}
- jvmMain.dependencies {
- implementation(KOTLIN_STDLIB)
+ androidTestImplementation project(":compose:ui:ui-test-font")
+ androidTestImplementation(ANDROIDX_TEST_RULES)
+ androidTestImplementation(ANDROIDX_TEST_RUNNER)
+ androidTestImplementation(ESPRESSO_CORE)
+ androidTestImplementation(JUNIT)
+ androidTestImplementation project(":ui:ui-test")
+ androidTestImplementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy)
+ // DexMaker has it"s own MockMaker
+ androidTestImplementation(MOCKITO_CORE, libs.exclude_bytebuddy)
+ androidTestImplementation(TRUTH)
+ androidTestImplementation MOCKITO_KOTLIN, {
+ exclude group: 'org.mockito' // to keep control on the mockito version
}
- desktopMain.dependencies {
- implementation(SKIKO)
- }
+ }
+}
- desktopMain.dependsOn jvmMain
+if(AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ kotlin {
+ android()
+ jvm("desktop")
- androidMain.dependencies {
- api "androidx.annotation:annotation:1.1.0"
- implementation "androidx.collection:collection:1.1.0"
- implementation "androidx.core:core:1.5.0-alpha01"
- implementation project(":compose:ui:ui-text-android")
- }
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block below
+ */
+ sourceSets {
+ commonMain.dependencies {
+ implementation(KOTLIN_STDLIB_COMMON)
- androidTest.dependencies {
- implementation project(":compose:ui:ui-test-font")
- implementation(ANDROIDX_TEST_RULES)
- implementation(ANDROIDX_TEST_RUNNER)
- implementation(JUNIT)
- implementation(MOCKITO_CORE)
- implementation(TRUTH)
- implementation(KOTLIN_REFLECT)
- implementation MOCKITO_KOTLIN, {
- exclude group: 'org.mockito' // to keep control on the mockito version
+ api project(":compose:ui:ui-graphics")
+ api project(":compose:ui:ui-unit")
+
+ implementation project(":compose:runtime:runtime")
+ implementation project(":compose:runtime:runtime-saved-instance-state")
+ implementation project(":compose:ui:ui-util")
}
- }
- androidAndroidTest.dependencies {
- implementation project(":compose:ui:ui-test-font")
- implementation(ANDROIDX_TEST_RULES)
- implementation(ANDROIDX_TEST_RUNNER)
- implementation(ESPRESSO_CORE)
- implementation(JUNIT)
- implementation project(":ui:ui-test")
- implementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
- implementation(MOCKITO_CORE, libs.exclude_bytebuddy)
- implementation(TRUTH)
- implementation MOCKITO_KOTLIN, {
- exclude group: 'org.mockito' // to keep control on the mockito version
+ jvmMain.dependencies {
+ implementation(KOTLIN_STDLIB)
+ }
+
+ desktopMain.dependencies {
+ implementation(SKIKO)
+ }
+
+ desktopMain.dependsOn jvmMain
+
+ androidMain.dependencies {
+ api "androidx.annotation:annotation:1.1.0"
+ implementation "androidx.collection:collection:1.1.0"
+ implementation "androidx.core:core:1.5.0-alpha01"
+ implementation project(":compose:ui:ui-text-android")
+ }
+
+ androidTest.dependencies {
+ implementation project(":compose:ui:ui-test-font")
+ implementation(ANDROIDX_TEST_RULES)
+ implementation(ANDROIDX_TEST_RUNNER)
+ implementation(JUNIT)
+ implementation(MOCKITO_CORE)
+ implementation(TRUTH)
+ implementation(KOTLIN_REFLECT)
+ implementation MOCKITO_KOTLIN, {
+ exclude group: 'org.mockito' // to keep control on the mockito version
+ }
+ }
+
+ androidAndroidTest.dependencies {
+ implementation project(":compose:ui:ui-test-font")
+ implementation(ANDROIDX_TEST_RULES)
+ implementation(ANDROIDX_TEST_RUNNER)
+ implementation(ESPRESSO_CORE)
+ implementation(JUNIT)
+ implementation project(":ui:ui-test")
+ implementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy)
+ // DexMaker has it"s own MockMaker
+ implementation(MOCKITO_CORE, libs.exclude_bytebuddy)
+ implementation(TRUTH)
+ implementation MOCKITO_KOTLIN, {
+ exclude group: 'org.mockito' // to keep control on the mockito version
+ }
}
}
}
diff --git a/compose/ui/ui-text/lint-baseline.xml b/compose/ui/ui-text/lint-baseline.xml
index 9f6fc74..53bc744 100644
--- a/compose/ui/ui-text/lint-baseline.xml
+++ b/compose/ui/ui-text/lint-baseline.xml
@@ -8,7 +8,7 @@
errorLine2=" ~~~~~~">
<location
file="src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidDefaultTypeface.kt"
- line="43"
+ line="44"
column="22"/>
</issue>
@@ -19,7 +19,7 @@
errorLine2=" ~~~~~~">
<location
file="src/androidMain/kotlin/androidx/compose/ui/text/platform/AndroidGenericFontFamilyTypeface.kt"
- line="73"
+ line="75"
column="22"/>
</issue>
@@ -52,7 +52,7 @@
errorLine2=" ~~~~~~~~~~~">
<location
file="src/androidMain/kotlin/androidx/compose/ui/text/platform/extensions/TextPaintExtensions.kt"
- line="62"
+ line="58"
column="13"/>
</issue>
diff --git a/compose/ui/ui-text/samples/build.gradle b/compose/ui/ui-text/samples/build.gradle
index 1d49f3e..fcb64b7 100644
--- a/compose/ui/ui-text/samples/build.gradle
+++ b/compose/ui/ui-text/samples/build.gradle
@@ -29,7 +29,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
diff --git a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/TextDelegateIntegrationTest.kt b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/TextDelegateIntegrationTest.kt
index 0c9a0d2..3d7a03d 100644
--- a/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/TextDelegateIntegrationTest.kt
+++ b/compose/ui/ui-text/src/androidAndroidTest/kotlin/androidx/compose/ui/text/TextDelegateIntegrationTest.kt
@@ -24,7 +24,6 @@
import androidx.compose.ui.text.FontTestData.Companion.BASIC_MEASURE_FONT
import androidx.compose.ui.text.font.asFontFamily
import androidx.compose.ui.text.matchers.assertThat
-import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.Constraints
import androidx.compose.ui.unit.Density
import androidx.compose.ui.unit.LayoutDirection
@@ -390,7 +389,7 @@
val constraintsFirstLayout = Constraints.fixed(width, heightFirstLayout)
val resultFirstLayout = textDelegate.layout(constraintsFirstLayout, LayoutDirection.Ltr)
- assertThat(resultFirstLayout.size.height).isLessThan(heightFirstLayout)
+ assertThat(resultFirstLayout.size.height).isEqualTo(heightFirstLayout)
val constraintsSecondLayout = Constraints.fixed(width, heightSecondLayout)
val resultSecondLayout = textDelegate.layout(
@@ -398,199 +397,8 @@
LayoutDirection.Ltr,
resultFirstLayout
)
- assertThat(resultSecondLayout.size.height).isEqualTo(resultFirstLayout.size.height)
+ assertThat(resultSecondLayout.size.height).isEqualTo(heightSecondLayout)
}
-
- @Test
- fun textReportSize_minWidth_largerThanNeeded() {
- for (overflow in TextOverflow.values()) {
- val textDelegate = TextDelegate(
- text = AnnotatedString(text = "Hello World!"),
- style = TextStyle.Default,
- overflow = overflow,
- density = density,
- resourceLoader = resourceLoader
- )
- textDelegate.layoutIntrinsics(LayoutDirection.Ltr)
- val intrinsicWidth = textDelegate.maxIntrinsicWidth
- val width = 2 * intrinsicWidth
- val textLayoutResult = textDelegate.layout(
- Constraints(minWidth = width),
- LayoutDirection.Ltr
- )
-
- assertThat(textLayoutResult.size.width).isEqualTo(intrinsicWidth)
- }
- }
-
- @Test
- fun textReportSize_minHeight_largerThanNeeded() {
- for (overflow in TextOverflow.values()) {
- val text = "Hello World!"
- val textDelegate = TextDelegate(
- text = AnnotatedString(text),
- style = TextStyle.Default,
- density = density,
- resourceLoader = resourceLoader
- )
-
- val intrinsicHeight = computeIntrinsicHeight(textDelegate)
- val height = intrinsicHeight * 2
- val textLayoutResult = textDelegate.layout(
- constraints = Constraints(minHeight = height),
- LayoutDirection.Ltr
- )
- assertThat(textLayoutResult.size.height).isEqualTo(intrinsicHeight)
- }
- }
-
- @Test
- fun textOverflow_clip_maxWidth_smallerThanNeeded() {
- val textDelegate = TextDelegate(
- text = AnnotatedString(text = "Hello World!"),
- style = TextStyle.Default,
- overflow = TextOverflow.Clip,
- density = density,
- resourceLoader = resourceLoader
- )
- textDelegate.layoutIntrinsics(LayoutDirection.Ltr)
- val intrinsicWidth = textDelegate.maxIntrinsicWidth
- val width = intrinsicWidth / 2
- val textLayoutResult = textDelegate.layout(
- constraints = Constraints(maxWidth = width),
- LayoutDirection.Ltr
- )
-
- assertThat(textLayoutResult.size.width).isEqualTo(width)
- }
-
- @Test
- fun textOverflow_ellipsis_maxWidth_smallerThanNeeded() {
- val textDelegate = TextDelegate(
- text = AnnotatedString(text = "Hello World!"),
- style = TextStyle.Default,
- overflow = TextOverflow.Ellipsis,
- softWrap = false,
- density = density,
- resourceLoader = resourceLoader
- )
- textDelegate.layoutIntrinsics(LayoutDirection.Ltr)
- val intrinsicWidth = textDelegate.maxIntrinsicWidth
- val width = intrinsicWidth / 2
- val textLayoutResult = textDelegate.layout(
- constraints = Constraints(maxWidth = width),
- LayoutDirection.Ltr
- )
-
- assertThat(textLayoutResult.size.width).isEqualTo(width)
- }
-
- @Test
- fun textOverflow_null_maxWidth_smallerThanNeeded() {
- val textDelegate = TextDelegate(
- text = AnnotatedString(text = "Hello World!"),
- style = TextStyle.Default,
- overflow = TextOverflow.None,
- softWrap = false,
- density = density,
- resourceLoader = resourceLoader
- )
- textDelegate.layoutIntrinsics(LayoutDirection.Ltr)
- val intrinsicWidth = textDelegate.maxIntrinsicWidth
- val width = intrinsicWidth / 2
- val textLayoutResult = textDelegate.layout(
- constraints = Constraints(maxWidth = width),
- LayoutDirection.Ltr
- )
-
- assertThat(textLayoutResult.size.width).isEqualTo(intrinsicWidth)
- }
-
- @Test
- fun textOverflow_clip_maxHeight_smallerThanNeeded() {
- val text = "Hello World!"
- val textDelegate = TextDelegate(
- text = AnnotatedString(text),
- style = TextStyle.Default,
- overflow = TextOverflow.Clip,
- density = density,
- resourceLoader = resourceLoader
- )
-
- val intrinsicHeight = computeIntrinsicHeight(textDelegate)
- val height = intrinsicHeight / 2
- val textLayoutResult = textDelegate.layout(
- constraints = Constraints(maxHeight = height),
- LayoutDirection.Ltr
- )
- assertThat(textLayoutResult.size.height).isEqualTo(height)
- }
-
- @Test
- fun textOverflow_ellipsis_maxHeight_smallerThanNeeded() {
- val text = "Hello World!"
- val maxLines = 2
- val textDelegate = TextDelegate(
- text = AnnotatedString(text),
- style = TextStyle.Default,
- overflow = TextOverflow.Ellipsis,
- maxLines = maxLines,
- density = density,
- resourceLoader = resourceLoader
- )
-
- textDelegate.layoutIntrinsics(LayoutDirection.Ltr)
- // Set the width so that text exceeds maxLines.
- val width = textDelegate.maxIntrinsicWidth / (maxLines + 1)
-
- // Height is only enough for 1 line.
- val height = computeIntrinsicHeight(textDelegate)
- // In this case, ellipsis is applied and there will be only 2 lines.
- // But maxHeight constraints it to be 1 line only.
- // Text should still be clipped as the fallback behavior of "ellipsis by height".
- val textLayoutResult = textDelegate.layout(
- constraints = Constraints(maxWidth = width, maxHeight = height),
- LayoutDirection.Ltr
- )
-
- // Gut check that the last line is ellipsized.
- assertThat(textLayoutResult.isLineEllipsized(maxLines - 1)).isTrue()
- assertThat(textLayoutResult.size.height).isEqualTo(height)
- }
-
- @Test
- fun textOverflow_null_maxHeight_smallerThanNeeded() {
- val text = "Hello World!"
- val textDelegate = TextDelegate(
- text = AnnotatedString(text),
- style = TextStyle.Default,
- overflow = TextOverflow.None,
- density = density,
- resourceLoader = resourceLoader
- )
-
- val intrinsicHeight = computeIntrinsicHeight(textDelegate)
- val height = intrinsicHeight / 2
- val textLayoutResult = textDelegate.layout(
- constraints = Constraints(maxHeight = height),
- LayoutDirection.Ltr
- )
- assertThat(textLayoutResult.size.height).isEqualTo(intrinsicHeight)
- }
-}
-
-@OptIn(InternalTextApi::class)
-private fun computeIntrinsicHeight(
- textDelegate: TextDelegate,
- width: Float = Float.MAX_VALUE
-): Int {
- return Paragraph(
- text = textDelegate.text.text,
- style = resolveDefaults(textDelegate.style, LayoutDirection.Ltr),
- width = width,
- density = textDelegate.density,
- resourceLoader = textDelegate.resourceLoader
- ).height.toInt()
}
private fun TextLayoutResult.toBitmap() = Bitmap.createBitmap(
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/TextDelegate.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/TextDelegate.kt
index a782889..497b31e 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/TextDelegate.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/TextDelegate.kt
@@ -27,6 +27,7 @@
import androidx.compose.ui.unit.Density
import androidx.compose.ui.unit.IntSize
import androidx.compose.ui.unit.LayoutDirection
+import androidx.compose.ui.unit.constrain
import androidx.compose.ui.util.annotation.VisibleForTesting
import kotlin.math.ceil
@@ -131,7 +132,7 @@
* Computes the visual position of the glyphs for painting the text.
*
* The text will layout with a width that's as close to its max intrinsic width as possible
- * while still being greater than or equal to [minWidth] and less than or equal to [maxWidth].
+ * while still being greater than or equal to `minWidth` and less than or equal to `maxWidth`.
*/
private fun layoutText(minWidth: Float, maxWidth: Float, layoutDirection: LayoutDirection):
MultiParagraph {
@@ -162,25 +163,9 @@
fun layout(
constraints: Constraints,
layoutDirection: LayoutDirection,
- prevResult: TextLayoutResult? = null,
- respectMinConstraints: Boolean = false
+ prevResult: TextLayoutResult? = null
): TextLayoutResult {
- /**
- * minWidth is only respected if it's required, where respectMinConstraints is true, or
- * [TextAlign.Justify] is specified.
- * In the other cases, minWidth will be ignored so that CoreText can report its actual
- * size to the parent node. This tells the parent that the input text is too short, and
- * CoreText is not able to meet the minWidth requirement.
- * Notice that respectMinConstraints == true is reserved for TextField, where minWidth acts
- * like a placeholder. This is especially useful when TextField is empty.
- * TODO(haoyuchang): Consider break down this method into pieces and separate the
- * measurement logic for TextField from TextDelegate.
- */
- val minWidth = if (respectMinConstraints || style.textAlign == TextAlign.Justify) {
- constraints.minWidth.toFloat()
- } else {
- 0f
- }
+ val minWidth = constraints.minWidth.toFloat()
val widthMatters = softWrap || overflow == TextOverflow.Ellipsis
val maxWidth = if (widthMatters && constraints.hasBoundedWidth) {
constraints.maxWidth.toFloat()
@@ -199,7 +184,12 @@
style = style,
constraints = constraints
),
- size = computeLayoutSize(constraints, multiParagraph, respectMinConstraints)
+ size = constraints.constrain(
+ IntSize(
+ ceil(multiParagraph.width).toInt(),
+ ceil(multiParagraph.height).toInt()
+ )
+ )
)
}
}
@@ -210,7 +200,13 @@
layoutDirection
)
- val size = computeLayoutSize(constraints, multiParagraph, respectMinConstraints)
+ val size = constraints.constrain(
+ IntSize(
+ ceil(multiParagraph.width).toInt(),
+ ceil(multiParagraph.height).toInt()
+ )
+ )
+
return TextLayoutResult(
TextLayoutInput(
text,
@@ -229,47 +225,6 @@
)
}
- /**
- * Determine the size of the Layout based on the input [constraints], [multiParagraph] size and
- * [TextOverflow] settings.
- */
- private fun computeLayoutSize(
- constraints: Constraints,
- multiParagraph: MultiParagraph,
- respectMinConstraints: Boolean
- ): IntSize {
- val width = ceil(multiParagraph.width).toInt().let {
- if (respectMinConstraints) {
- it.coerceAtLeast(constraints.minWidth)
- } else {
- it
- }
- }
- val height = ceil(multiParagraph.height).toInt().let {
- if (respectMinConstraints) {
- it.coerceAtLeast(constraints.minHeight)
- } else {
- it
- }
- }
- return when (overflow) {
- // CoreText won't handle overflow. Layout will determine how to handle it.
- TextOverflow.None ->
- IntSize(width, height)
- // When overflow is clip: CoreText will clip the CoreText to be the max available size.
- // When overflow is ellipsis: If line count doesn't exceed maxLines but height
- // exceeds the maxHeight, it will also clip.
- // TODO(haoyuchang): support ellipsis with height, or its fallback behavior that
- // only cuts the exceeding lines but doesn't show '...'.
- TextOverflow.Clip, TextOverflow.Ellipsis -> {
- IntSize(
- width.coerceAtMost(constraints.maxWidth),
- height.coerceAtMost(constraints.maxHeight)
- )
- }
- }
- }
-
companion object {
/**
* Paints the text onto the given canvas.
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/TextLayoutHelper.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/TextLayoutHelper.kt
index 8d08a2e..4d31915 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/TextLayoutHelper.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/TextLayoutHelper.kt
@@ -64,12 +64,10 @@
}
// Check the given constraints can produces the same result.
- if (constraints.minWidth != layoutInput.constraints.minWidth) {
- return false
- }
+ if (constraints.minWidth != layoutInput.constraints.minWidth) return false
if (!(softWrap || overflow == TextOverflow.Ellipsis)) {
- // If width does not matter, we can result the same layout.
+ // If width does not mattter, we can result the same layout.
return true
}
return constraints.maxWidth == layoutInput.constraints.maxWidth
diff --git a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/style/TextOverflow.kt b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/style/TextOverflow.kt
index 9f116a1..8061c84 100644
--- a/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/style/TextOverflow.kt
+++ b/compose/ui/ui-text/src/commonMain/kotlin/androidx/compose/ui/text/style/TextOverflow.kt
@@ -18,9 +18,6 @@
/** How overflowing text should be handled. */
enum class TextOverflow {
- /** Won't handle overflow, and report the needed size to the parent. **/
- None,
-
/** Clip the overflowing text to fix its container. */
Clip,
diff --git a/compose/ui/ui-unit/build.gradle b/compose/ui/ui-unit/build.gradle
index fab9b27..d96b5f9 100644
--- a/compose/ui/ui-unit/build.gradle
+++ b/compose/ui/ui-unit/build.gradle
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+
+import androidx.build.AndroidXUiPlugin
import androidx.build.LibraryGroups
import androidx.build.LibraryVersions
import androidx.build.Publish
@@ -25,39 +27,71 @@
id("AndroidXPlugin")
id("com.android.library")
id("AndroidXUiPlugin")
- id("kotlin-multiplatform")
}
-kotlin {
- android()
- jvm("desktop")
+AndroidXUiPlugin.applyAndConfigureKotlinPlugin(project)
- sourceSets {
- commonMain.dependencies {
- implementation(KOTLIN_STDLIB_COMMON)
- api project(":compose:ui:ui-geometry")
+if(!AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ dependencies {
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block below
+ */
- implementation project(":compose:runtime:runtime")
- implementation project(":compose:ui:ui-util")
- }
- jvmMain.dependencies {
- implementation(KOTLIN_STDLIB)
- }
- androidMain.dependencies {
- api "androidx.annotation:annotation:1.1.0"
- }
+ api project(":compose:ui:ui-geometry")
+ api "androidx.annotation:annotation:1.1.0"
- commonTest.dependencies {
- implementation kotlin("test-junit")
- }
+ implementation(KOTLIN_STDLIB)
+ implementation project(":compose:runtime:runtime")
+ implementation project(":compose:ui:ui-util")
- androidTest.dependencies {
- implementation(TRUTH)
- }
- androidAndroidTest.dependencies {
- implementation(ANDROIDX_TEST_RULES)
- implementation(ANDROIDX_TEST_RUNNER)
- implementation(ESPRESSO_CORE)
+ testImplementation(JUNIT)
+ testImplementation(TRUTH)
+
+ androidTestImplementation(ANDROIDX_TEST_RULES)
+ androidTestImplementation(ANDROIDX_TEST_RUNNER)
+ androidTestImplementation(ESPRESSO_CORE)
+ androidTestImplementation(TRUTH)
+ androidTestImplementation(KOTLIN_TEST)
+ }
+}
+
+if(AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ kotlin {
+ android()
+ jvm("desktop")
+
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block above
+ */
+ sourceSets {
+ commonMain.dependencies {
+ implementation(KOTLIN_STDLIB_COMMON)
+ api project(":compose:ui:ui-geometry")
+
+ implementation project(":compose:runtime:runtime")
+ implementation project(":compose:ui:ui-util")
+ }
+ jvmMain.dependencies {
+ implementation(KOTLIN_STDLIB)
+ }
+ androidMain.dependencies {
+ api "androidx.annotation:annotation:1.1.0"
+ }
+
+ commonTest.dependencies {
+ implementation kotlin("test-junit")
+ }
+
+ androidTest.dependencies {
+ implementation(TRUTH)
+ }
+ androidAndroidTest.dependencies {
+ implementation(ANDROIDX_TEST_RULES)
+ implementation(ANDROIDX_TEST_RUNNER)
+ implementation(ESPRESSO_CORE)
+ }
}
}
}
diff --git a/compose/ui/ui-unit/samples/build.gradle b/compose/ui/ui-unit/samples/build.gradle
index fda1f1c..600d99b 100644
--- a/compose/ui/ui-unit/samples/build.gradle
+++ b/compose/ui/ui-unit/samples/build.gradle
@@ -29,7 +29,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
diff --git a/compose/ui/ui-util/build.gradle b/compose/ui/ui-util/build.gradle
index 523cbf8..c4d321e 100644
--- a/compose/ui/ui-util/build.gradle
+++ b/compose/ui/ui-util/build.gradle
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+
+import androidx.build.AndroidXUiPlugin
import androidx.build.LibraryGroups
import androidx.build.LibraryVersions
import androidx.build.Publish
@@ -25,36 +27,61 @@
id("AndroidXPlugin")
id("com.android.library")
id("AndroidXUiPlugin")
- id("kotlin-multiplatform")
}
-kotlin {
- android()
- jvm("desktop")
+AndroidXUiPlugin.applyAndConfigureKotlinPlugin(project)
- sourceSets {
- commonMain.dependencies {
- implementation(KOTLIN_STDLIB_COMMON)
+if(!AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ dependencies {
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block below
+ */
- implementation project(":compose:runtime:runtime")
- }
+ api "androidx.annotation:annotation:1.1.0"
- jvmMain.dependencies {
- implementation(KOTLIN_STDLIB)
- }
+ implementation(KOTLIN_STDLIB)
+ implementation project(":compose:runtime:runtime")
- androidMain.dependencies {
- api "androidx.annotation:annotation:1.1.0"
- }
+ testImplementation(JUNIT)
+ testImplementation(TRUTH)
+ testImplementation(KOTLIN_TEST)
+ }
+}
- desktopMain.dependsOn jvmMain
+if(AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ kotlin {
+ android()
+ jvm("desktop")
- commonTest.dependencies {
- implementation kotlin("test-junit")
- }
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block above
+ */
+ sourceSets {
+ commonMain.dependencies {
+ implementation(KOTLIN_STDLIB_COMMON)
- androidTest.dependencies {
- implementation(TRUTH)
+ implementation project(":compose:runtime:runtime")
+ }
+
+ jvmMain.dependencies {
+ implementation(KOTLIN_STDLIB)
+ }
+
+ androidMain.dependencies {
+ api "androidx.annotation:annotation:1.1.0"
+ }
+
+ desktopMain.dependsOn jvmMain
+
+ commonTest.dependencies {
+ implementation kotlin("test-junit")
+ }
+
+ androidTest.dependencies {
+ implementation(TRUTH)
+ }
}
}
}
diff --git a/compose/ui/ui-viewbinding/build.gradle b/compose/ui/ui-viewbinding/build.gradle
index d1eec6f..1ab1a3c 100644
--- a/compose/ui/ui-viewbinding/build.gradle
+++ b/compose/ui/ui-viewbinding/build.gradle
@@ -29,7 +29,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
implementation project(":compose:ui:ui")
diff --git a/compose/ui/ui-viewbinding/samples/build.gradle b/compose/ui/ui-viewbinding/samples/build.gradle
index aaaca49..54a8130 100644
--- a/compose/ui/ui-viewbinding/samples/build.gradle
+++ b/compose/ui/ui-viewbinding/samples/build.gradle
@@ -29,7 +29,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
implementation project(":annotation:annotation-sampled")
diff --git a/compose/ui/ui/build.gradle b/compose/ui/ui/build.gradle
index fd05442..326e1a0 100644
--- a/compose/ui/ui/build.gradle
+++ b/compose/ui/ui/build.gradle
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+
+import androidx.build.AndroidXUiPlugin
import androidx.build.LibraryGroups
import androidx.build.LibraryVersions
import androidx.build.Publish
@@ -25,109 +27,187 @@
id("AndroidXPlugin")
id("com.android.library")
id("AndroidXUiPlugin")
- id("kotlin-multiplatform")
}
+AndroidXUiPlugin.applyAndConfigureKotlinPlugin(project)
+
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
+
+ if(!AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block below
+ */
+ implementation(KOTLIN_STDLIB_COMMON)
+ implementation(KOTLIN_COROUTINES_CORE)
+
+ // TODO: b/160602714 create a lower level module to avoid this dependency on the
+ // animation group
+ api project(":compose:animation:animation-core")
+ api project(":compose:runtime:runtime-saved-instance-state")
+ api project(":compose:ui:ui-geometry")
+ api project(":compose:ui:ui-graphics")
+ api project(":compose:ui:ui-text")
+ api project(":compose:ui:ui-unit")
+ api "androidx.annotation:annotation:1.1.0"
+ api "androidx.activity:activity:1.2.0-alpha02"
+
+ // This has stub APIs for access to legacy Android APIs, so we don't want
+ // any dependency on this module.
+ compileOnly project(":compose:ui:ui-android-stubs")
+
+ implementation project(":compose:runtime:runtime")
+ implementation project(":compose:ui:ui-util")
+ implementation(KOTLIN_STDLIB)
+ implementation "androidx.autofill:autofill:1.0.0"
+ implementation(KOTLIN_COROUTINES_ANDROID)
+
+ // we don't use these dependencies but we need to ensure at least these versions are
+ // used if the user adds these dependencies as otherwise AppCompatActivity and Fragment
+ // will not propagate ViewTree*Owners we are relying on and we will crash.
+ // TODO: remove these dependencies at some point: b/161814404
+ implementation "androidx.fragment:fragment:1.3.0-alpha07"
+ implementation "androidx.appcompat:appcompat:1.3.0-alpha01"
+
+ testImplementation(ANDROIDX_TEST_RULES)
+ testImplementation(ANDROIDX_TEST_RUNNER)
+ testImplementation(JUNIT)
+ testImplementation(TRUTH)
+ testImplementation(MOCKITO_CORE)
+ testImplementation MOCKITO_KOTLIN, {
+ exclude group: 'org.mockito' // to keep control on the mockito version
+ }
+ testImplementation(ROBOLECTRIC)
+ testImplementation project(":ui:ui-test")
+ testImplementation project(":compose:test-utils")
+
+ androidTestImplementation "androidx.fragment:fragment:1.2.4"
+ androidTestImplementation "androidx.appcompat:appcompat:1.1.0"
+ androidTestImplementation(ANDROIDX_TEST_UIAUTOMATOR)
+ androidTestImplementation(ANDROIDX_TEST_RULES)
+ androidTestImplementation(ANDROIDX_TEST_RUNNER)
+ androidTestImplementation(ESPRESSO_CORE)
+ androidTestImplementation(JUNIT)
+ androidTestImplementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy)
+ // DexMaker has it"s own MockMaker
+ androidTestImplementation(MOCKITO_CORE, libs.exclude_bytebuddy)
+ // DexMaker has it"s own MockMaker
+ androidTestImplementation(TRUTH)
+ androidTestImplementation MOCKITO_KOTLIN, {
+ exclude group: 'org.mockito' // to keep control on the mockito version
+ }
+ androidTestImplementation project(":compose:foundation:foundation")
+ androidTestImplementation project(":compose:foundation:foundation-layout")
+ androidTestImplementation project(":compose:test-utils")
+ androidTestImplementation project(":compose:ui:ui-test-font")
+ androidTestImplementation project(":ui:ui-test")
+ }
}
-kotlin {
- android()
- jvm("desktop")
+if(AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ kotlin {
+ android()
+ jvm("desktop")
- sourceSets {
- commonMain.dependencies {
- implementation(KOTLIN_STDLIB_COMMON)
- implementation(KOTLIN_COROUTINES_CORE)
+ /*
+ * When updating dependencies, make sure to make the an an analogous update in the
+ * corresponding block above
+ */
+ sourceSets {
+ commonMain.dependencies {
+ implementation(KOTLIN_STDLIB_COMMON)
+ implementation(KOTLIN_COROUTINES_CORE)
- // TODO: b/160602714 create a lower level module to avoid this dependency on the
- // animation group
- api project(":compose:animation:animation-core")
- api project(":compose:runtime:runtime-saved-instance-state")
- api project(":compose:ui:ui-geometry")
- api project(":compose:ui:ui-graphics")
- api project(":compose:ui:ui-text")
- api project(":compose:ui:ui-unit")
- implementation project(":compose:runtime:runtime")
- implementation project(":compose:ui:ui-util")
- }
-
- androidMain.dependencies {
- implementation(KOTLIN_STDLIB)
- // This has stub APIs for access to legacy Android APIs, so we don't want
- // any dependency on this module.
- compileOnly project(":compose:ui:ui-android-stubs")
- api "androidx.annotation:annotation:1.1.0"
- api "androidx.activity:activity:1.2.0-alpha02"
- implementation "androidx.autofill:autofill:1.0.0"
- implementation(KOTLIN_COROUTINES_ANDROID)
-
- // we don't use these dependencies but we need to ensure at least these versions are
- // used if the user adds these dependencies as otherwise AppCompatActivity and Fragment
- // will not propagate ViewTree*Owners we are relying on and we will crash.
- // TODO: remove these dependencies at some point: b/161814404
- implementation "androidx.fragment:fragment:1.3.0-alpha07"
- implementation "androidx.appcompat:appcompat:1.3.0-alpha01"
- }
-
- jvmMain.dependencies {
- implementation(KOTLIN_STDLIB)
- }
-
- desktopMain.dependencies {
- implementation(SKIKO)
- }
-
- androidMain.dependsOn jvmMain
- desktopMain.dependsOn jvmMain
-
- test.dependencies {
- implementation(ANDROIDX_TEST_RULES)
- implementation(ANDROIDX_TEST_RUNNER)
- implementation(JUNIT)
- implementation(TRUTH)
- implementation(MOCKITO_CORE)
- implementation MOCKITO_KOTLIN, {
- exclude group: 'org.mockito' // to keep control on the mockito version
+ // TODO: b/160602714 create a lower level module to avoid this dependency on the
+ // animation group
+ api project(":compose:animation:animation-core")
+ api project(":compose:runtime:runtime-saved-instance-state")
+ api project(":compose:ui:ui-geometry")
+ api project(":compose:ui:ui-graphics")
+ api project(":compose:ui:ui-text")
+ api project(":compose:ui:ui-unit")
+ implementation project(":compose:runtime:runtime")
+ implementation project(":compose:ui:ui-util")
}
- implementation(ROBOLECTRIC)
- implementation project(":ui:ui-test")
- implementation project(":compose:test-utils")
- }
- androidAndroidTest.dependencies {
- implementation "androidx.fragment:fragment:1.2.4"
- implementation "androidx.appcompat:appcompat:1.1.0"
- implementation(ANDROIDX_TEST_UIAUTOMATOR)
- implementation(ANDROIDX_TEST_RULES)
- implementation(ANDROIDX_TEST_RUNNER)
- implementation(ESPRESSO_CORE)
- implementation(JUNIT)
- implementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
- implementation(MOCKITO_CORE, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
- implementation(TRUTH)
- implementation MOCKITO_KOTLIN, {
- exclude group: 'org.mockito' // to keep control on the mockito version
- }
- implementation project(":compose:foundation:foundation")
- implementation project(":compose:foundation:foundation-layout")
- implementation project(":compose:test-utils")
- implementation project(":compose:ui:ui-test-font")
- implementation project(":ui:ui-test")
- }
+ androidMain.dependencies {
+ implementation(KOTLIN_STDLIB)
+ // This has stub APIs for access to legacy Android APIs, so we don't want
+ // any dependency on this module.
+ compileOnly project(":compose:ui:ui-android-stubs")
+ api "androidx.annotation:annotation:1.1.0"
+ api "androidx.activity:activity:1.2.0-alpha02"
+ implementation "androidx.autofill:autofill:1.0.0"
+ implementation(KOTLIN_COROUTINES_ANDROID)
- desktopTest.dependencies {
- implementation project(':ui:ui-test')
- implementation(TRUTH)
- implementation(JUNIT)
- implementation(MOCKITO_CORE)
- implementation MOCKITO_KOTLIN, {
- exclude group: 'org.mockito' // to keep control on the mockito version
+ // we don't use these dependencies but we need to ensure at least these versions are
+ // used if the user adds these dependencies as otherwise AppCompatActivity and Fragment
+ // will not propagate ViewTree*Owners we are relying on and we will crash.
+ // TODO: remove these dependencies at some point: b/161814404
+ implementation "androidx.fragment:fragment:1.3.0-alpha07"
+ implementation "androidx.appcompat:appcompat:1.3.0-alpha01"
}
- implementation(SKIKO_CURRENT_OS)
- implementation project(":compose:foundation:foundation")
- implementation project(":ui:ui-test")
+
+ jvmMain.dependencies {
+ implementation(KOTLIN_STDLIB)
+ }
+
+ desktopMain.dependencies {
+ implementation(SKIKO)
+ }
+
+ androidMain.dependsOn jvmMain
+ desktopMain.dependsOn jvmMain
+
+ test.dependencies {
+ implementation(ANDROIDX_TEST_RULES)
+ implementation(ANDROIDX_TEST_RUNNER)
+ implementation(JUNIT)
+ implementation(TRUTH)
+ implementation(MOCKITO_CORE)
+ implementation MOCKITO_KOTLIN, {
+ exclude group: 'org.mockito' // to keep control on the mockito version
+ }
+ implementation(ROBOLECTRIC)
+ implementation project(":ui:ui-test")
+ implementation project(":compose:test-utils")
+ }
+
+ androidAndroidTest.dependencies {
+ implementation "androidx.fragment:fragment:1.2.4"
+ implementation "androidx.appcompat:appcompat:1.1.0"
+ implementation(ANDROIDX_TEST_UIAUTOMATOR)
+ implementation(ANDROIDX_TEST_RULES)
+ implementation(ANDROIDX_TEST_RUNNER)
+ implementation(ESPRESSO_CORE)
+ implementation(JUNIT)
+ implementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy)
+ // DexMaker has it"s own MockMaker
+ implementation(MOCKITO_CORE, libs.exclude_bytebuddy)
+ // DexMaker has it"s own MockMaker
+ implementation(TRUTH)
+ implementation MOCKITO_KOTLIN, {
+ exclude group: 'org.mockito' // to keep control on the mockito version
+ }
+ implementation project(":compose:foundation:foundation")
+ implementation project(":compose:foundation:foundation-layout")
+ implementation project(":compose:test-utils")
+ implementation project(":compose:ui:ui-test-font")
+ implementation project(":ui:ui-test")
+ }
+
+ desktopTest.dependencies {
+ implementation(TRUTH)
+ implementation(JUNIT)
+ implementation(MOCKITO_CORE)
+ implementation MOCKITO_KOTLIN, {
+ exclude group: 'org.mockito' // to keep control on the mockito version
+ }
+ implementation(SKIKO_CURRENT_OS)
+ implementation project(":compose:foundation:foundation")
+ implementation project(":ui:ui-test")
+ }
}
}
}
@@ -142,8 +222,10 @@
legacyDisableKotlinStrictApiMode = true
}
-tasks.findByName("desktopTest").configure {
- systemProperties['GOLDEN_PATH'] = project.rootDir.absolutePath + "/../../../golden"
+if(AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ tasks.findByName("desktopTest").configure {
+ systemProperties['GOLDEN_PATH'] = project.rootDir.absolutePath + "/../../../golden"
+ }
}
tasks.withType(KotlinCompile).configureEach {
@@ -168,23 +250,26 @@
}
}
-// An ugly hack to workaround b/159426957 causing MPP+AGP to conflict.
-// See also: https://youtrack.jetbrains.com/issue/KT-34650
-// See also: https://youtrack.jetbrains.com/issue/KT-39712
-afterEvaluate {
- ["Api", "Implementation", "CompileOnly", "RuntimeOnly"].each { scope ->
- def erroneousExtendsFrom = [
- "androidTest$scope",
- "androidTestDebug$scope",
+if(AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ // An ugly hack to workaround b/159426957
+ // causing MPP+AGP to conflict.
+ // See also: https://youtrack.jetbrains.com/issue/KT-34650
+ // See also: https://youtrack.jetbrains.com/issue/KT-39712
+ afterEvaluate {
+ ["Api", "Implementation", "CompileOnly", "RuntimeOnly"].each { scope ->
+ def erroneousExtendsFrom = [
+ "androidTest$scope",
+ "androidTestDebug$scope",
].collect { configurations[it] }
- [
- "androidDebugUnitTest$scope",
- "test$scope",
- "testDebug$scope",
- "testRelease$scope"
+ [
+ "androidDebugUnitTest$scope",
+ "test$scope",
+ "testDebug$scope",
+ "testRelease$scope"
].each {
def configuration = configurations[it]
configuration.setExtendsFrom(configuration.extendsFrom - erroneousExtendsFrom)
+ }
}
}
}
diff --git a/compose/ui/ui/integration-tests/ui-demos/build.gradle b/compose/ui/ui/integration-tests/ui-demos/build.gradle
index 962cd5a..c1c9621 100644
--- a/compose/ui/ui/integration-tests/ui-demos/build.gradle
+++ b/compose/ui/ui/integration-tests/ui-demos/build.gradle
@@ -10,7 +10,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
diff --git a/compose/ui/ui/lint-baseline.xml b/compose/ui/ui/lint-baseline.xml
index 24412c1..af65ba6 100644
--- a/compose/ui/ui/lint-baseline.xml
+++ b/compose/ui/ui/lint-baseline.xml
@@ -8,7 +8,7 @@
errorLine2="~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/androidMain/kotlin/androidx/compose/ui/platform/AndroidComposeView.kt"
- line="122"
+ line="98"
column="1"/>
</issue>
@@ -103,7 +103,7 @@
<issue
id="UnsafeNewApiCall"
message="This call is to a method from API 23, the call containing class androidx.compose.ui.autofill.AndroidAutofillKt is not annotated with @RequiresApi(x) where x is at least 23. Either annotate the containing class with at least @RequiresApi(23) or move the call to a static method in a wrapper class annotated with at least @RequiresApi(23)."
- errorLine1=" setDimens(left, top, 0, 0, width(), height()) }"
+ errorLine1=" setDimens(left, top, 0, 0, width(), height())"
errorLine2=" ~~~~~~~~~">
<location
file="src/androidMain/kotlin/androidx/compose/ui/autofill/AndroidAutofill.kt"
@@ -118,7 +118,7 @@
errorLine2=" ~~~~~~">
<location
file="src/androidMain/kotlin/androidx/compose/ui/autofill/AndroidAutofill.kt"
- line="104"
+ line="105"
column="19"/>
</issue>
@@ -129,7 +129,7 @@
errorLine2=" ~~~~~~~~~">
<location
file="src/androidMain/kotlin/androidx/compose/ui/autofill/AndroidAutofill.kt"
- line="104"
+ line="105"
column="72"/>
</issue>
@@ -140,7 +140,7 @@
errorLine2=" ~~~~~~">
<location
file="src/androidMain/kotlin/androidx/compose/ui/autofill/AndroidAutofill.kt"
- line="105"
+ line="106"
column="19"/>
</issue>
@@ -151,7 +151,7 @@
errorLine2=" ~~~~~~">
<location
file="src/androidMain/kotlin/androidx/compose/ui/autofill/AndroidAutofill.kt"
- line="106"
+ line="107"
column="19"/>
</issue>
@@ -162,7 +162,7 @@
errorLine2=" ~~~~~~~~">
<location
file="src/androidMain/kotlin/androidx/compose/ui/autofill/AndroidAutofill.kt"
- line="107"
+ line="108"
column="19"/>
</issue>
@@ -195,7 +195,7 @@
errorLine2=" ~~~~~~~~~">
<location
file="src/androidMain/kotlin/androidx/compose/ui/platform/AndroidComposeView.kt"
- line="238"
+ line="226"
column="13"/>
</issue>
@@ -206,7 +206,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/androidMain/kotlin/androidx/compose/ui/platform/AndroidComposeView.kt"
- line="240"
+ line="228"
column="13"/>
</issue>
@@ -217,7 +217,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~">
<location
file="src/androidMain/kotlin/androidx/compose/ui/platform/AndroidComposeViewAccessibilityDelegateCompat.kt"
- line="278"
+ line="351"
column="27"/>
</issue>
@@ -228,7 +228,7 @@
errorLine2=" ~~~~~~~~~~~~~~~">
<location
file="src/androidMain/kotlin/androidx/compose/ui/platform/AndroidTextToolbar.kt"
- line="52"
+ line="53"
column="31"/>
</issue>
@@ -261,19 +261,19 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/androidMain/kotlin/androidx/compose/ui/platform/RenderNodeLayer.kt"
- line="160"
+ line="164"
column="31"/>
</issue>
<issue
id="UnsafeNewApiCall"
message="This call is to a method from API 29, the call containing class androidx.compose.ui.platform.WrapperKt is not annotated with @RequiresApi(x) where x is at least 29. Either annotate the containing class with at least @RequiresApi(29) or move the call to a static method in a wrapper class annotated with at least @RequiresApi(29)."
- errorLine1=" owner.view.attributeSourceResourceMap.isNotEmpty()"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ errorLine1=" owner.view.attributeSourceResourceMap.isNotEmpty()"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/androidMain/kotlin/androidx/compose/ui/platform/Wrapper.kt"
- line="355"
- column="24"/>
+ line="319"
+ column="20"/>
</issue>
</issues>
diff --git a/compose/ui/ui/samples/build.gradle b/compose/ui/ui/samples/build.gradle
index 8aa9f78..596582b 100644
--- a/compose/ui/ui/samples/build.gradle
+++ b/compose/ui/ui/samples/build.gradle
@@ -29,7 +29,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/AndroidAccessibilityTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/AndroidAccessibilityTest.kt
index 5fa8eb6..5e41547 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/AndroidAccessibilityTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/AndroidAccessibilityTest.kt
@@ -56,7 +56,7 @@
import androidx.core.os.BuildCompat
import androidx.core.view.ViewCompat
import androidx.core.view.accessibility.AccessibilityNodeInfoCompat
-import androidx.test.filters.MediumTest
+import androidx.test.filters.LargeTest
import androidx.test.filters.SdkSuppress
import androidx.test.platform.app.InstrumentationRegistry
import androidx.ui.test.SemanticsMatcher
@@ -91,7 +91,7 @@
import java.util.concurrent.CountDownLatch
import java.util.concurrent.TimeUnit
-@MediumTest
+@LargeTest
@RunWith(JUnit4::class)
@OptIn(
ExperimentalFoundationApi::class,
@@ -275,7 +275,7 @@
textFieldSelectionOneLatch = CountDownLatch(1)
provider.performAction(textFieldNode.id, ACTION_SET_SELECTION, argument)
}
- if (!textFieldSelectionOneLatch.await(1, TimeUnit.SECONDS)) {
+ if (!textFieldSelectionOneLatch.await(5, TimeUnit.SECONDS)) {
throw AssertionError("Failed to wait for text selection change.")
}
rule.onNodeWithTag(TextFieldTag)
@@ -302,7 +302,7 @@
argument
)
}
- if (!textFieldSelectionZeroLatch.await(1, TimeUnit.SECONDS)) {
+ if (!textFieldSelectionZeroLatch.await(5, TimeUnit.SECONDS)) {
throw AssertionError("Failed to wait for text selection change.")
}
rule.onNodeWithTag(TextFieldTag)
diff --git a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/PointerInteropFilterTest.kt b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/PointerInteropFilterTest.kt
index bf78f93..eb19be8 100644
--- a/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/PointerInteropFilterTest.kt
+++ b/compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/input/pointer/PointerInteropFilterTest.kt
@@ -667,7 +667,7 @@
val aMove2 = aMove1.moveTo(13.milliseconds, 3f, 4f)
val bUpConsumed = bDown.up(13.milliseconds).apply { consumeDownChange() }
- val expected: MotionEvent =
+ val expected =
MotionEvent(
13,
ACTION_CANCEL,
@@ -1496,7 +1496,7 @@
}
@Test
- fun onPointerEvent_downThenMoveViewRetsFalseThenMoveThenUp_noDispatchAfterRetFalse() {
+ fun onPointerEvent_downThenMoveViewRetsFalseThenMove_moveDispatched() {
val down = down(1, 2.milliseconds, 3f, 4f)
val motionEvent1 =
MotionEvent(
@@ -1530,17 +1530,6 @@
arrayOf(PointerCoords(11f, 12f))
)
- val up = move2.up(15.milliseconds)
- val motionEvent4 =
- MotionEvent(
- 15,
- ACTION_UP,
- 1,
- 0,
- arrayOf(PointerProperties(0)),
- arrayOf(PointerCoords(11f, 12f))
- )
-
pointerInteropFilter.pointerInputFilter::onPointerEvent.invokeOverAllPasses(
pointerEventOf(down, motionEvent = motionEvent1)
)
@@ -1552,15 +1541,235 @@
pointerInteropFilter.pointerInputFilter::onPointerEvent.invokeOverAllPasses(
pointerEventOf(move2, motionEvent = motionEvent3)
)
- pointerInteropFilter.pointerInputFilter::onPointerEvent.invokeOverAllPasses(
- pointerEventOf(up, motionEvent = motionEvent4)
- )
- assertThat(dispatchedMotionEvents).hasSize(0)
+ assertThat(dispatchedMotionEvents).hasSize(1)
+ assertThat(dispatchedMotionEvents[0]).isSameInstanceAs(motionEvent3)
}
@Test
- fun onPointerEvent_down1ThenDown2ViewRetsFalseThenMoveThenUp1ThenUp2_noDispatchAfterRetFalse() {
+ fun onPointerEvent_downThenMoveViewRetsFalseThenUp_upDispatched() {
+ val down = down(1, 2.milliseconds, 3f, 4f)
+ val motionEvent1 =
+ MotionEvent(
+ 2,
+ ACTION_DOWN,
+ 1,
+ 0,
+ arrayOf(PointerProperties(0)),
+ arrayOf(PointerCoords(3f, 4f))
+ )
+
+ val move1 = down.moveTo(5.milliseconds, 6f, 7f)
+ val motionEvent2 =
+ MotionEvent(
+ 5,
+ ACTION_MOVE,
+ 1,
+ 0,
+ arrayOf(PointerProperties(0)),
+ arrayOf(PointerCoords(6f, 47f))
+ )
+
+ val up = move1.up(10.milliseconds)
+ val motionEvent3 =
+ MotionEvent(
+ 10,
+ ACTION_UP,
+ 1,
+ 0,
+ arrayOf(PointerProperties(0)),
+ arrayOf(PointerCoords(6f, 47f))
+ )
+
+ pointerInteropFilter.pointerInputFilter::onPointerEvent.invokeOverAllPasses(
+ pointerEventOf(down, motionEvent = motionEvent1)
+ )
+ retVal = false
+ pointerInteropFilter.pointerInputFilter::onPointerEvent.invokeOverAllPasses(
+ pointerEventOf(move1, motionEvent = motionEvent2)
+ )
+ dispatchedMotionEvents.clear()
+ pointerInteropFilter.pointerInputFilter::onPointerEvent.invokeOverAllPasses(
+ pointerEventOf(up, motionEvent = motionEvent3)
+ )
+
+ assertThat(dispatchedMotionEvents).hasSize(1)
+ assertThat(dispatchedMotionEvents[0]).isSameInstanceAs(motionEvent3)
+ }
+
+ @Test
+ fun onPointerEvent_down1ThenDown2ViewRetsFalseThenMove_moveIsDispatched() {
+ // Arrange
+
+ val aDown = down(1, 2.milliseconds, 3f, 4f)
+ val motionEvent1 =
+ MotionEvent(
+ 2,
+ ACTION_DOWN,
+ 1,
+ 0,
+ arrayOf(PointerProperties(0)),
+ arrayOf(PointerCoords(3f, 4f))
+ )
+
+ val aMove1 = aDown.moveTo(11.milliseconds, 3f, 4f)
+ val bDown = down(21, 11.milliseconds, 23f, 24f)
+ val motionEvent2 =
+ MotionEvent(
+ 11,
+ ACTION_POINTER_DOWN,
+ 2,
+ 2,
+ arrayOf(PointerProperties(0), PointerProperties(1)),
+ arrayOf(PointerCoords(3f, 4f), PointerCoords(23f, 24f))
+ )
+
+ val aMove2 = aMove1.moveTo(21.milliseconds, 31f, 32f)
+ val bMove = bDown.moveTo(21.milliseconds, 33f, 34f)
+ val motionEvent3 =
+ MotionEvent(
+ 21,
+ ACTION_MOVE,
+ 2,
+ 0,
+ arrayOf(PointerProperties(0), PointerProperties(1)),
+ arrayOf(PointerCoords(31f, 32f), PointerCoords(33f, 34f))
+ )
+
+ // Act
+ pointerInteropFilter.pointerInputFilter::onPointerEvent.invokeOverAllPasses(
+ pointerEventOf(aDown, motionEvent = motionEvent1)
+ )
+ retVal = false
+ pointerInteropFilter.pointerInputFilter::onPointerEvent.invokeOverAllPasses(
+ pointerEventOf(aMove1, bDown, motionEvent = motionEvent2)
+ )
+ dispatchedMotionEvents.clear()
+ pointerInteropFilter.pointerInputFilter::onPointerEvent.invokeOverAllPasses(
+ pointerEventOf(aMove2, bMove, motionEvent = motionEvent3)
+ )
+
+ // Assert
+ assertThat(dispatchedMotionEvents).hasSize(1)
+ assertThat(dispatchedMotionEvents[0]).isSameInstanceAs(motionEvent3)
+ }
+
+ @Test
+ fun onPointerEvent_down1ThenDown2ViewRetsFalseThenUp1_up1IsDispatched() {
+ // Arrange
+
+ val aDown = down(1, 2.milliseconds, 3f, 4f)
+ val motionEvent1 =
+ MotionEvent(
+ 2,
+ ACTION_DOWN,
+ 1,
+ 0,
+ arrayOf(PointerProperties(0)),
+ arrayOf(PointerCoords(3f, 4f))
+ )
+
+ val aMove1 = aDown.moveTo(11.milliseconds, 3f, 4f)
+ val bDown = down(21, 11.milliseconds, 23f, 24f)
+ val motionEvent2 =
+ MotionEvent(
+ 11,
+ ACTION_POINTER_DOWN,
+ 2,
+ 2,
+ arrayOf(PointerProperties(0), PointerProperties(1)),
+ arrayOf(PointerCoords(3f, 4f), PointerCoords(23f, 24f))
+ )
+
+ val aMove2 = aMove1.moveTo(21.milliseconds, 3f, 4f)
+ val bUp = bDown.up(21.milliseconds)
+ val motionEvent3 =
+ MotionEvent(
+ 21,
+ ACTION_POINTER_UP,
+ 2,
+ 1,
+ arrayOf(PointerProperties(0), PointerProperties(1)),
+ arrayOf(PointerCoords(3f, 4f), PointerCoords(23f, 24f))
+ )
+
+ // Act
+ pointerInteropFilter.pointerInputFilter::onPointerEvent.invokeOverAllPasses(
+ pointerEventOf(aDown, motionEvent = motionEvent1)
+ )
+ retVal = false
+ pointerInteropFilter.pointerInputFilter::onPointerEvent.invokeOverAllPasses(
+ pointerEventOf(aMove1, bDown, motionEvent = motionEvent2)
+ )
+ dispatchedMotionEvents.clear()
+ pointerInteropFilter.pointerInputFilter::onPointerEvent.invokeOverAllPasses(
+ pointerEventOf(aMove2, bUp, motionEvent = motionEvent3)
+ )
+
+ // Assert
+ assertThat(dispatchedMotionEvents).hasSize(1)
+ assertThat(dispatchedMotionEvents[0]).isSameInstanceAs(motionEvent3)
+ }
+
+ @Test
+ fun onPointerEvent_down1ThenDown2ViewRetsFalseThenUp2_up2Dispatched() {
+ // Arrange
+
+ val aDown = down(1, 2.milliseconds, 3f, 4f)
+ val motionEvent1 =
+ MotionEvent(
+ 2,
+ ACTION_DOWN,
+ 1,
+ 0,
+ arrayOf(PointerProperties(0)),
+ arrayOf(PointerCoords(3f, 4f))
+ )
+
+ val aMove1 = aDown.moveTo(11.milliseconds, 3f, 4f)
+ val bDown = down(21, 11.milliseconds, 23f, 24f)
+ val motionEvent2 =
+ MotionEvent(
+ 11,
+ ACTION_POINTER_DOWN,
+ 2,
+ 2,
+ arrayOf(PointerProperties(0), PointerProperties(1)),
+ arrayOf(PointerCoords(3f, 4f), PointerCoords(23f, 24f))
+ )
+
+ val aUp = aMove1.up(31.milliseconds)
+ val bMove = bDown.moveTo(31.milliseconds)
+ val motionEvent3 =
+ MotionEvent(
+ 31,
+ ACTION_POINTER_UP,
+ 2,
+ 0,
+ arrayOf(PointerProperties(0), PointerProperties(1)),
+ arrayOf(PointerCoords(3f, 4f), PointerCoords(23f, 24f))
+ )
+
+ // Act
+ pointerInteropFilter.pointerInputFilter::onPointerEvent.invokeOverAllPasses(
+ pointerEventOf(aDown, motionEvent = motionEvent1)
+ )
+ retVal = false
+ pointerInteropFilter.pointerInputFilter::onPointerEvent.invokeOverAllPasses(
+ pointerEventOf(aMove1, bDown, motionEvent = motionEvent2)
+ )
+ dispatchedMotionEvents.clear()
+ pointerInteropFilter.pointerInputFilter::onPointerEvent.invokeOverAllPasses(
+ pointerEventOf(aUp, bMove, motionEvent = motionEvent3)
+ )
+
+ // Assert
+ assertThat(dispatchedMotionEvents).hasSize(1)
+ assertThat(dispatchedMotionEvents[0]).isSameInstanceAs(motionEvent3)
+ }
+
+ @Test
+ fun onPointerEvent_down1ThenDown2ViewRetsFalseThenMoveThenUp1ThenUp2_allFollowingDispatched() {
// Arrange
val aDown = down(1, 2.milliseconds, 3f, 4f)
@@ -1641,7 +1850,10 @@
)
// Assert
- assertThat(dispatchedMotionEvents).hasSize(0)
+ assertThat(dispatchedMotionEvents).hasSize(3)
+ assertThat(dispatchedMotionEvents[0]).isSameInstanceAs(motionEvent3)
+ assertThat(dispatchedMotionEvents[1]).isSameInstanceAs(motionEvent4)
+ assertThat(dispatchedMotionEvents[2]).isSameInstanceAs(motionEvent5)
}
@Test
@@ -1836,7 +2048,7 @@
}
@Test
- fun onPointerEvent_1PointerUpViewRetsFalse_nothingConsumed() {
+ fun onPointerEvent_1PointerUpViewRetsFalse_everythingConsumed() {
val down = down(1, 2.milliseconds, 3f, 4f)
val motionEvent1 =
MotionEvent(
@@ -1848,7 +2060,6 @@
arrayOf(PointerCoords(3f, 4f))
)
val upActual = down.up(5.milliseconds)
- val upExpected = upActual.deepCopy()
val motionEvent2 =
MotionEvent(
5,
@@ -1862,6 +2073,7 @@
pointerInteropFilter.pointerInputFilter::onPointerEvent.invokeOverAllPasses(
pointerEventOf(down, motionEvent = motionEvent1)
)
+ val upExpected = upActual.deepCopy().apply { consumeAllChanges() }
retVal = false
pointerInteropFilter.pointerInputFilter::onPointerEvent.invokeOverAllPasses(
@@ -1908,7 +2120,7 @@
}
@Test
- fun onPointerEvent_2PointersDownViewRetsFalse_nothingConsumed() {
+ fun onPointerEvent_2PointersDownViewRetsFalse_everythingConsumed() {
// Arrange
@@ -1937,7 +2149,10 @@
retVal = true
- val expected = listOf(aMove.deepCopy(), bDown.deepCopy())
+ val expected = listOf(
+ aMove.deepCopy().apply { consumeAllChanges() },
+ bDown.deepCopy().apply { consumeAllChanges() }
+ )
pointerInteropFilter.pointerInputFilter::onPointerEvent.invokeOverAllPasses(
pointerEventOf(aDown, motionEvent = motionEvent1)
@@ -2007,7 +2222,7 @@
}
@Test
- fun onPointerEvent_2Pointers1UpViewRetsFalse_nothingConsumed() {
+ fun onPointerEvent_2Pointers1UpViewRetsFalse_everythingConsumed() {
// Arrange
@@ -2048,7 +2263,10 @@
retVal = true
- val expected = listOf(aMove2.deepCopy(), bUp.deepCopy())
+ val expected = listOf(
+ aMove2.deepCopy().apply { consumeAllChanges() },
+ bUp.deepCopy().apply { consumeAllChanges() }
+ )
pointerInteropFilter.pointerInputFilter::onPointerEvent.invokeOverAllPasses(
pointerEventOf(aDown, motionEvent = motionEvent1)
@@ -2135,7 +2353,7 @@
}
@Test
- fun onPointerEvent_1PointerMoveViewRetsFalse_nothingConsumed() {
+ fun onPointerEvent_1PointerMoveViewRetsFalse_everythingConsumed() {
val down = down(1, 2.milliseconds, 3f, 4f)
val motionEvent1 =
MotionEvent(
@@ -2147,7 +2365,7 @@
arrayOf(PointerCoords(3f, 4f))
)
val move = down.moveTo(7.milliseconds, 8f, 9f)
- val expected = move.deepCopy()
+ val expected = move.deepCopy().apply { consumeAllChanges() }
val motionEvent2 =
MotionEvent(
7,
@@ -2206,7 +2424,7 @@
}
@Test
- fun onPointerEvent_2PointersMoveViewRetsFalse_nothingConsumed() {
+ fun onPointerEvent_2PointersMoveViewRetsFalse_everythingConsumed() {
// Arrange
@@ -2259,7 +2477,11 @@
retVal = true
- val expected = listOf(aMove2.deepCopy(), bMove1.deepCopy())
+ val expected =
+ listOf(
+ aMove2.deepCopy().apply { consumeAllChanges() },
+ bMove1.deepCopy().apply { consumeAllChanges() }
+ )
pointerInteropFilter.pointerInputFilter::onPointerEvent.invokeOverAllPasses(
pointerEventOf(aDown, motionEvent = motionEvent1)
@@ -3034,7 +3256,7 @@
}
@Test
- fun onPointerEvent_down1ViewRetsFalseThenViewRestsTrueDown2ThenUp1ThenDown3_down3NotConsumed() {
+ fun onPointerEvent_down1ViewRetsFalseThenViewRetsTrueDown2ThenUp1ThenDown3_down3NotConsumed() {
val aDown = down(1, 2.milliseconds, 3f, 4f)
val motionEvent1 =
MotionEvent(
@@ -3103,220 +3325,6 @@
assertThat(listOf(bMove2, cDown)).isEqualTo(expected)
}
- @Test
- fun onPointerEvent_downThenMoveViewRetsFalseThenViewRetsTrueMove_moveNotConsumed() {
- val down = down(1, 2.milliseconds, 3f, 4f)
- val motionEvent1 =
- MotionEvent(
- 2,
- ACTION_DOWN,
- 1,
- 0,
- arrayOf(PointerProperties(0)),
- arrayOf(PointerCoords(3f, 4f))
- )
- val move1 = down.moveTo(5.milliseconds, 6f, 7f)
- val motionEvent2 =
- MotionEvent(
- 5,
- ACTION_MOVE,
- 1,
- 0,
- arrayOf(PointerProperties(0)),
- arrayOf(PointerCoords(6f, 47f))
- )
- val move2 = move1.moveTo(10.milliseconds, 11f, 12f)
- val motionEvent3 =
- MotionEvent(
- 10,
- ACTION_MOVE,
- 1,
- 0,
- arrayOf(PointerProperties(0)),
- arrayOf(PointerCoords(11f, 12f))
- )
- val expected = move2.deepCopy()
-
- pointerInteropFilter.pointerInputFilter::onPointerEvent.invokeOverAllPasses(
- pointerEventOf(down, motionEvent = motionEvent1)
- )
- retVal = false
- pointerInteropFilter.pointerInputFilter::onPointerEvent.invokeOverAllPasses(
- pointerEventOf(move1, motionEvent = motionEvent2)
- )
- retVal = true
- pointerInteropFilter.pointerInputFilter::onPointerEvent.invokeOverAllPasses(
- pointerEventOf(move2, motionEvent = motionEvent3)
- )
-
- assertThat(move2).isEqualTo(expected)
- }
-
- @Test
- fun onPointerEvent_downThenMoveViewRetsFalseThenViewRetsTrueThenUp_UpNotConsumed() {
- val down = down(1, 2.milliseconds, 3f, 4f)
- val motionEvent1 =
- MotionEvent(
- 2,
- ACTION_DOWN,
- 1,
- 0,
- arrayOf(PointerProperties(0)),
- arrayOf(PointerCoords(3f, 4f))
- )
- val move1 = down.moveTo(5.milliseconds, 6f, 7f)
- val motionEvent2 =
- MotionEvent(
- 5,
- ACTION_MOVE,
- 1,
- 0,
- arrayOf(PointerProperties(0)),
- arrayOf(PointerCoords(6f, 47f))
- )
- val up = move1.up(10.milliseconds)
- val motionEvent3 =
- MotionEvent(
- 10,
- ACTION_UP,
- 1,
- 0,
- arrayOf(PointerProperties(0)),
- arrayOf(PointerCoords(6f, 47f))
- )
- val expected = up.deepCopy()
-
- pointerInteropFilter.pointerInputFilter::onPointerEvent.invokeOverAllPasses(
- pointerEventOf(down, motionEvent = motionEvent1)
- )
- retVal = false
- pointerInteropFilter.pointerInputFilter::onPointerEvent.invokeOverAllPasses(
- pointerEventOf(move1, motionEvent = motionEvent2)
- )
- retVal = true
- pointerInteropFilter.pointerInputFilter::onPointerEvent.invokeOverAllPasses(
- pointerEventOf(up, motionEvent = motionEvent3)
- )
-
- assertThat(up).isEqualTo(expected)
- }
-
- @Test
- fun onPointerEvent_down1ThenDown2ViewRetsFalseThenViewRetsTrueMove_moveNotConsumed() {
- // Arrange
-
- val aDown = down(1, 2.milliseconds, 3f, 4f)
- val motionEvent1 =
- MotionEvent(
- 2,
- ACTION_DOWN,
- 1,
- 0,
- arrayOf(PointerProperties(0)),
- arrayOf(PointerCoords(3f, 4f))
- )
-
- val aMove1 = aDown.moveTo(11.milliseconds, 3f, 4f)
- val bDown = down(21, 11.milliseconds, 23f, 24f)
- val motionEvent2 =
- MotionEvent(
- 11,
- ACTION_POINTER_DOWN,
- 2,
- 2,
- arrayOf(PointerProperties(0), PointerProperties(1)),
- arrayOf(PointerCoords(3f, 4f), PointerCoords(23f, 24f))
- )
-
- val aMove2 = aMove1.moveTo(31.milliseconds, 31f, 32f)
- val bMove = bDown.moveTo(31.milliseconds, 33f, 34f)
- val motionEvent3 =
- MotionEvent(
- 31,
- ACTION_MOVE,
- 2,
- 0,
- arrayOf(PointerProperties(0), PointerProperties(1)),
- arrayOf(PointerCoords(31f, 32f), PointerCoords(33f, 34f))
- )
-
- val expected = listOf(aMove2.deepCopy(), bMove.deepCopy())
-
- // Act
- pointerInteropFilter.pointerInputFilter::onPointerEvent.invokeOverAllPasses(
- pointerEventOf(aDown, motionEvent = motionEvent1)
- )
- retVal = false
- pointerInteropFilter.pointerInputFilter::onPointerEvent.invokeOverAllPasses(
- pointerEventOf(aMove1, bDown, motionEvent = motionEvent2)
- )
- retVal = true
- pointerInteropFilter.pointerInputFilter::onPointerEvent.invokeOverAllPasses(
- pointerEventOf(aMove2, bMove, motionEvent = motionEvent3)
- )
-
- // Assert
- assertThat(listOf(aMove2, bMove)).isEqualTo(expected)
- }
-
- @Test
- fun onPointerEvent_down1ThenDown2ViewRetsFalseThenViewRetsTrueUp2_moveNotConsumed() {
- // Arrange
-
- val aDown = down(1, 2.milliseconds, 3f, 4f)
- val motionEvent1 =
- MotionEvent(
- 2,
- ACTION_DOWN,
- 1,
- 0,
- arrayOf(PointerProperties(0)),
- arrayOf(PointerCoords(3f, 4f))
- )
-
- val aMove1 = aDown.moveTo(11.milliseconds, 3f, 4f)
- val bDown = down(21, 11.milliseconds, 23f, 24f)
- val motionEvent2 =
- MotionEvent(
- 11,
- ACTION_POINTER_DOWN,
- 2,
- 2,
- arrayOf(PointerProperties(0), PointerProperties(1)),
- arrayOf(PointerCoords(3f, 4f), PointerCoords(23f, 24f))
- )
-
- val aMove2 = aMove1.moveTo(31.milliseconds, 31f, 32f)
- val bUp = bDown.up(31.milliseconds)
- val motionEvent3 =
- MotionEvent(
- 31,
- ACTION_POINTER_UP,
- 2,
- 2,
- arrayOf(PointerProperties(0), PointerProperties(1)),
- arrayOf(PointerCoords(3f, 4f), PointerCoords(23f, 24f))
- )
-
- val expected = listOf(aMove2.deepCopy(), bUp.deepCopy())
-
- // Act
- pointerInteropFilter.pointerInputFilter::onPointerEvent.invokeOverAllPasses(
- pointerEventOf(aDown, motionEvent = motionEvent1)
- )
- retVal = false
- pointerInteropFilter.pointerInputFilter::onPointerEvent.invokeOverAllPasses(
- pointerEventOf(aMove1, bDown, motionEvent = motionEvent2)
- )
- retVal = true
- pointerInteropFilter.pointerInputFilter::onPointerEvent.invokeOverAllPasses(
- pointerEventOf(aMove2, bUp, motionEvent = motionEvent3)
- )
-
- // Assert
- assertThat(listOf(aMove2, bUp)).isEqualTo(expected)
- }
-
// Verification of correct passes being used
@Test
diff --git a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/input/pointer/PointerInteropFilter.kt b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/input/pointer/PointerInteropFilter.kt
index d642399..6e1811f 100644
--- a/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/input/pointer/PointerInteropFilter.kt
+++ b/compose/ui/ui/src/androidMain/kotlin/androidx/compose/ui/input/pointer/PointerInteropFilter.kt
@@ -260,10 +260,18 @@
this.layoutCoordinates?.localToRoot(Offset.Zero)
?: error("layoutCoordinates not set")
) { motionEvent ->
- state = if (onTouchEvent(motionEvent)) {
- DispatchToViewState.Dispatching
+ if (motionEvent.actionMasked == MotionEvent.ACTION_DOWN) {
+ // If the action is ACTION_DOWN, we care about the return value of
+ // onTouchEvent and use it to set our initial dispatching state.
+ state = if (onTouchEvent(motionEvent)) {
+ DispatchToViewState.Dispatching
+ } else {
+ DispatchToViewState.NotDispatching
+ }
} else {
- DispatchToViewState.NotDispatching
+ // Otherwise, we don't care about the return value. This is intended
+ // to be in accordance with how the Android View system works.
+ onTouchEvent(motionEvent)
}
}
if (state === DispatchToViewState.Dispatching) {
diff --git a/development/build_log_simplifier/messages.ignore b/development/build_log_simplifier/messages.ignore
index d9fb129..7e3eaaa 100644
--- a/development/build_log_simplifier/messages.ignore
+++ b/development/build_log_simplifier/messages.ignore
@@ -1200,6 +1200,10 @@
# > Task :wear:wear-input:compileDebugUnitTestJavaWithJavac
Note: \$SUPPORT/wear/wear\-input/src/test/java/androidx/wear/input/WearableButtonsTest\.java uses or overrides a deprecated API\.
# > Task :lifecycle:integration-tests:incrementality:compileTestKotlin
+\$OUT_DIR\/\.gradle\/wrapper\/dists\/gradle\-[0-9]+\.[0-9]+\.[0-9]+\-bin\/[0-9]+jxfl[0-9]+bpr[0-9]+n[0-9]+ie[0-9]+t[0-9]+mbogjj\/gradle\-[0-9]+\.[0-9]+\.[0-9]+\/lib\/kotlin\-stdlib\-[0-9]+\.[0-9]+\.[0-9]+\.jar \(version [0-9]+\.[0-9]+\)
+\$OUT_DIR\/\.gradle\/wrapper\/dists\/gradle\-[0-9]+\.[0-9]+\.[0-9]+\-bin\/[0-9]+jxfl[0-9]+bpr[0-9]+n[0-9]+ie[0-9]+t[0-9]+mbogjj\/gradle\-[0-9]+\.[0-9]+\.[0-9]+\/lib\/kotlin\-stdlib\-common\-[0-9]+\.[0-9]+\.[0-9]+\.jar \(version [0-9]+\.[0-9]+\)
+\$OUT_DIR\/\.gradle\/wrapper\/dists\/gradle\-[0-9]+\.[0-9]+\.[0-9]+\-bin\/[0-9]+jxfl[0-9]+bpr[0-9]+n[0-9]+ie[0-9]+t[0-9]+mbogjj\/gradle\-[0-9]+\.[0-9]+\.[0-9]+\/lib\/kotlin\-stdlib\-jdk[0-9]+\-[0-9]+\.[0-9]+\.[0-9]+\.jar \(version [0-9]+\.[0-9]+\)
+\$OUT_DIR\/\.gradle\/wrapper\/dists\/gradle\-[0-9]+\.[0-9]+\.[0-9]+\-bin\/[0-9]+jxfl[0-9]+bpr[0-9]+n[0-9]+ie[0-9]+t[0-9]+mbogjj\/gradle\-[0-9]+\.[0-9]+\.[0-9]+\/lib\/kotlin\-reflect\-[0-9]+\.[0-9]+\.[0-9]+\.jar \(version [0-9]+\.[0-9]+\)
\$OUT_DIR\/\.gradle\/wrapper\/dists\/gradle\-[0-9]+\.[0-9]+\.[0-9]+\-bin\/[0-9]+hg[0-9]+cwdjis[0-9]+evrsfeibqx[0-9]+\/gradle\-[0-9]+\.[0-9]+\.[0-9]+\/lib\/kotlin\-stdlib\-[0-9]+\.[0-9]+\.[0-9]+\.jar \(version [0-9]+\.[0-9]+\)
\$OUT_DIR\/\.gradle\/wrapper\/dists\/gradle\-[0-9]+\.[0-9]+\.[0-9]+\-bin\/[0-9]+hg[0-9]+cwdjis[0-9]+evrsfeibqx[0-9]+\/gradle\-[0-9]+\.[0-9]+\.[0-9]+\/lib\/kotlin\-stdlib\-common\-[0-9]+\.[0-9]+\.[0-9]+\.jar \(version [0-9]+\.[0-9]+\)
\$OUT_DIR\/\.gradle\/wrapper\/dists\/gradle\-[0-9]+\.[0-9]+\.[0-9]+\-bin\/[0-9]+hg[0-9]+cwdjis[0-9]+evrsfeibqx[0-9]+\/gradle\-[0-9]+\.[0-9]+\.[0-9]+\/lib\/kotlin\-stdlib\-jdk[0-9]+\-[0-9]+\.[0-9]+\.[0-9]+\.jar \(version [0-9]+\.[0-9]+\)
@@ -1225,4 +1229,9 @@
Note\: \$SUPPORT\/wear\/wear\-watchface\-complications\-rendering\/src\/test\/java\/androidx\/wear\/watchface\/complications\/rendering\/RoundedDrawableTest\.java uses or overrides a deprecated API\.
# > Task :wear:wear-watchface:testDebugUnitTest
System\.logW\: A resource was acquired at attached stack trace but never released\. See java\.io\.Closeable for information on avoiding resource leaks\.java\.lang\.Throwable\: Explicit termination method \'dispose\' not called
-System\.logW\: A resource was acquired at attached stack trace but never released\. See java\.io\.Closeable for information on avoiding resource leaks\.java\.lang\.Throwable\: Explicit termination method \'release\' not called
\ No newline at end of file
+System\.logW\: A resource was acquired at attached stack trace but never released\. See java\.io\.Closeable for information on avoiding resource leaks\.java\.lang\.Throwable\: Explicit termination method \'release\' not called
+# > Task :compose:animation:animation-core:testDebugUnitTest
+androidx\.compose\.animation\.core\.AnimationClockTest \> testSubscriptionDuringFrameCallback FAILED
+kotlin\.UninitializedPropertyAccessException at AnimationClockTest\.kt\:[0-9]+
+[0-9]+ tests completed\, [0-9]+ failed
+There were failing tests\. See the report at\: file\:\/\/\$OUT_DIR\/ui\/compose\/animation\/animation\-core\/build\/reports\/tests\/testDebugUnitTest\/index\.html
\ No newline at end of file
diff --git a/fragment/.idea/codeStyles/Project.xml b/fragment/.idea/codeStyles/Project.xml
new file mode 120000
index 0000000..b52b28c
--- /dev/null
+++ b/fragment/.idea/codeStyles/Project.xml
@@ -0,0 +1 @@
+../../../.idea/codeStyles/Project.xml
\ No newline at end of file
diff --git a/fragment/.idea/codeStyles/codeStyleConfig.xml b/fragment/.idea/codeStyles/codeStyleConfig.xml
new file mode 120000
index 0000000..19c4848
--- /dev/null
+++ b/fragment/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1 @@
+../../../.idea/codeStyles/codeStyleConfig.xml
\ No newline at end of file
diff --git a/fragment/.idea/copyright/AndroidCopyright.xml b/fragment/.idea/copyright/AndroidCopyright.xml
new file mode 120000
index 0000000..afbbd04
--- /dev/null
+++ b/fragment/.idea/copyright/AndroidCopyright.xml
@@ -0,0 +1 @@
+../../../.idea/copyright/AndroidCopyright.xml
\ No newline at end of file
diff --git a/fragment/.idea/copyright/profiles_settings.xml b/fragment/.idea/copyright/profiles_settings.xml
new file mode 120000
index 0000000..5996ccd
--- /dev/null
+++ b/fragment/.idea/copyright/profiles_settings.xml
@@ -0,0 +1 @@
+../../../.idea/copyright/profiles_settings.xml
\ No newline at end of file
diff --git a/fragment/.idea/inspectionProfiles/Project_Default.xml b/fragment/.idea/inspectionProfiles/Project_Default.xml
new file mode 120000
index 0000000..a7481f4
--- /dev/null
+++ b/fragment/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1 @@
+../../../.idea/inspectionProfiles/Project_Default.xml
\ No newline at end of file
diff --git a/fragment/.idea/scopes/Ignore_API_Files.xml b/fragment/.idea/scopes/Ignore_API_Files.xml
new file mode 120000
index 0000000..3361ee1
--- /dev/null
+++ b/fragment/.idea/scopes/Ignore_API_Files.xml
@@ -0,0 +1 @@
+../../../.idea/scopes/Ignore_API_Files.xml
\ No newline at end of file
diff --git a/fragment/.idea/scopes/buildSrc.xml b/fragment/.idea/scopes/buildSrc.xml
new file mode 120000
index 0000000..25b7d3b
--- /dev/null
+++ b/fragment/.idea/scopes/buildSrc.xml
@@ -0,0 +1 @@
+../../../.idea/scopes/buildSrc.xml
\ No newline at end of file
diff --git a/fragment/fragment-ktx/api/1.3.0-beta02.txt b/fragment/fragment-ktx/api/1.3.0-beta02.txt
new file mode 100644
index 0000000..64ef804
--- /dev/null
+++ b/fragment/fragment-ktx/api/1.3.0-beta02.txt
@@ -0,0 +1,34 @@
+// Signature format: 4.0
+package androidx.fragment.app {
+
+ public final class FragmentKt {
+ method public static void clearFragmentResult(androidx.fragment.app.Fragment, String requestKey);
+ method public static void clearFragmentResultListener(androidx.fragment.app.Fragment, String requestKey);
+ method public static void setFragmentResult(androidx.fragment.app.Fragment, String requestKey, android.os.Bundle result);
+ method public static void setFragmentResultListener(androidx.fragment.app.Fragment, String requestKey, kotlin.jvm.functions.Function2<? super java.lang.String,? super android.os.Bundle,kotlin.Unit> listener);
+ }
+
+ public final class FragmentManagerKt {
+ method public static inline void commit(androidx.fragment.app.FragmentManager, optional boolean allowStateLoss, kotlin.jvm.functions.Function1<? super androidx.fragment.app.FragmentTransaction,kotlin.Unit> body);
+ method public static inline void commitNow(androidx.fragment.app.FragmentManager, optional boolean allowStateLoss, kotlin.jvm.functions.Function1<? super androidx.fragment.app.FragmentTransaction,kotlin.Unit> body);
+ method @Deprecated public static inline void transaction(androidx.fragment.app.FragmentManager, optional boolean now, optional boolean allowStateLoss, kotlin.jvm.functions.Function1<? super androidx.fragment.app.FragmentTransaction,kotlin.Unit> body);
+ }
+
+ public final class FragmentTransactionKt {
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.FragmentTransaction! add(androidx.fragment.app.FragmentTransaction, @IdRes int containerViewId, optional String tag, optional android.os.Bundle? args);
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.FragmentTransaction! add(androidx.fragment.app.FragmentTransaction, String tag, optional android.os.Bundle? args);
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.FragmentTransaction! replace(androidx.fragment.app.FragmentTransaction, @IdRes int containerViewId, optional String tag, optional android.os.Bundle? args);
+ }
+
+ public final class FragmentViewModelLazyKt {
+ method @MainThread public static inline <reified VM extends androidx.lifecycle.ViewModel> kotlin.Lazy<? extends VM>! activityViewModels(androidx.fragment.app.Fragment, optional kotlin.jvm.functions.Function0<? extends androidx.lifecycle.ViewModelProvider.Factory>? factoryProducer);
+ method @MainThread public static <VM extends androidx.lifecycle.ViewModel> kotlin.Lazy<VM> createViewModelLazy(androidx.fragment.app.Fragment, kotlin.reflect.KClass<VM> viewModelClass, kotlin.jvm.functions.Function0<? extends androidx.lifecycle.ViewModelStore> storeProducer, optional kotlin.jvm.functions.Function0<? extends androidx.lifecycle.ViewModelProvider.Factory>? factoryProducer);
+ method @MainThread public static inline <reified VM extends androidx.lifecycle.ViewModel> kotlin.Lazy<? extends VM>! viewModels(androidx.fragment.app.Fragment, optional kotlin.jvm.functions.Function0<? extends androidx.lifecycle.ViewModelStoreOwner> ownerProducer, optional kotlin.jvm.functions.Function0<? extends androidx.lifecycle.ViewModelProvider.Factory>? factoryProducer);
+ }
+
+ public final class ViewKt {
+ method public static <F extends androidx.fragment.app.Fragment> F findFragment(android.view.View);
+ }
+
+}
+
diff --git a/fragment/fragment-ktx/api/public_plus_experimental_1.3.0-beta02.txt b/fragment/fragment-ktx/api/public_plus_experimental_1.3.0-beta02.txt
new file mode 100644
index 0000000..64ef804
--- /dev/null
+++ b/fragment/fragment-ktx/api/public_plus_experimental_1.3.0-beta02.txt
@@ -0,0 +1,34 @@
+// Signature format: 4.0
+package androidx.fragment.app {
+
+ public final class FragmentKt {
+ method public static void clearFragmentResult(androidx.fragment.app.Fragment, String requestKey);
+ method public static void clearFragmentResultListener(androidx.fragment.app.Fragment, String requestKey);
+ method public static void setFragmentResult(androidx.fragment.app.Fragment, String requestKey, android.os.Bundle result);
+ method public static void setFragmentResultListener(androidx.fragment.app.Fragment, String requestKey, kotlin.jvm.functions.Function2<? super java.lang.String,? super android.os.Bundle,kotlin.Unit> listener);
+ }
+
+ public final class FragmentManagerKt {
+ method public static inline void commit(androidx.fragment.app.FragmentManager, optional boolean allowStateLoss, kotlin.jvm.functions.Function1<? super androidx.fragment.app.FragmentTransaction,kotlin.Unit> body);
+ method public static inline void commitNow(androidx.fragment.app.FragmentManager, optional boolean allowStateLoss, kotlin.jvm.functions.Function1<? super androidx.fragment.app.FragmentTransaction,kotlin.Unit> body);
+ method @Deprecated public static inline void transaction(androidx.fragment.app.FragmentManager, optional boolean now, optional boolean allowStateLoss, kotlin.jvm.functions.Function1<? super androidx.fragment.app.FragmentTransaction,kotlin.Unit> body);
+ }
+
+ public final class FragmentTransactionKt {
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.FragmentTransaction! add(androidx.fragment.app.FragmentTransaction, @IdRes int containerViewId, optional String tag, optional android.os.Bundle? args);
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.FragmentTransaction! add(androidx.fragment.app.FragmentTransaction, String tag, optional android.os.Bundle? args);
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.FragmentTransaction! replace(androidx.fragment.app.FragmentTransaction, @IdRes int containerViewId, optional String tag, optional android.os.Bundle? args);
+ }
+
+ public final class FragmentViewModelLazyKt {
+ method @MainThread public static inline <reified VM extends androidx.lifecycle.ViewModel> kotlin.Lazy<? extends VM>! activityViewModels(androidx.fragment.app.Fragment, optional kotlin.jvm.functions.Function0<? extends androidx.lifecycle.ViewModelProvider.Factory>? factoryProducer);
+ method @MainThread public static <VM extends androidx.lifecycle.ViewModel> kotlin.Lazy<VM> createViewModelLazy(androidx.fragment.app.Fragment, kotlin.reflect.KClass<VM> viewModelClass, kotlin.jvm.functions.Function0<? extends androidx.lifecycle.ViewModelStore> storeProducer, optional kotlin.jvm.functions.Function0<? extends androidx.lifecycle.ViewModelProvider.Factory>? factoryProducer);
+ method @MainThread public static inline <reified VM extends androidx.lifecycle.ViewModel> kotlin.Lazy<? extends VM>! viewModels(androidx.fragment.app.Fragment, optional kotlin.jvm.functions.Function0<? extends androidx.lifecycle.ViewModelStoreOwner> ownerProducer, optional kotlin.jvm.functions.Function0<? extends androidx.lifecycle.ViewModelProvider.Factory>? factoryProducer);
+ }
+
+ public final class ViewKt {
+ method public static <F extends androidx.fragment.app.Fragment> F findFragment(android.view.View);
+ }
+
+}
+
diff --git a/fragment/fragment-ktx/api/res-1.3.0-beta02.txt b/fragment/fragment-ktx/api/res-1.3.0-beta02.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/fragment/fragment-ktx/api/res-1.3.0-beta02.txt
diff --git a/fragment/fragment-ktx/api/restricted_1.3.0-beta02.txt b/fragment/fragment-ktx/api/restricted_1.3.0-beta02.txt
new file mode 100644
index 0000000..64ef804
--- /dev/null
+++ b/fragment/fragment-ktx/api/restricted_1.3.0-beta02.txt
@@ -0,0 +1,34 @@
+// Signature format: 4.0
+package androidx.fragment.app {
+
+ public final class FragmentKt {
+ method public static void clearFragmentResult(androidx.fragment.app.Fragment, String requestKey);
+ method public static void clearFragmentResultListener(androidx.fragment.app.Fragment, String requestKey);
+ method public static void setFragmentResult(androidx.fragment.app.Fragment, String requestKey, android.os.Bundle result);
+ method public static void setFragmentResultListener(androidx.fragment.app.Fragment, String requestKey, kotlin.jvm.functions.Function2<? super java.lang.String,? super android.os.Bundle,kotlin.Unit> listener);
+ }
+
+ public final class FragmentManagerKt {
+ method public static inline void commit(androidx.fragment.app.FragmentManager, optional boolean allowStateLoss, kotlin.jvm.functions.Function1<? super androidx.fragment.app.FragmentTransaction,kotlin.Unit> body);
+ method public static inline void commitNow(androidx.fragment.app.FragmentManager, optional boolean allowStateLoss, kotlin.jvm.functions.Function1<? super androidx.fragment.app.FragmentTransaction,kotlin.Unit> body);
+ method @Deprecated public static inline void transaction(androidx.fragment.app.FragmentManager, optional boolean now, optional boolean allowStateLoss, kotlin.jvm.functions.Function1<? super androidx.fragment.app.FragmentTransaction,kotlin.Unit> body);
+ }
+
+ public final class FragmentTransactionKt {
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.FragmentTransaction! add(androidx.fragment.app.FragmentTransaction, @IdRes int containerViewId, optional String tag, optional android.os.Bundle? args);
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.FragmentTransaction! add(androidx.fragment.app.FragmentTransaction, String tag, optional android.os.Bundle? args);
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.FragmentTransaction! replace(androidx.fragment.app.FragmentTransaction, @IdRes int containerViewId, optional String tag, optional android.os.Bundle? args);
+ }
+
+ public final class FragmentViewModelLazyKt {
+ method @MainThread public static inline <reified VM extends androidx.lifecycle.ViewModel> kotlin.Lazy<? extends VM>! activityViewModels(androidx.fragment.app.Fragment, optional kotlin.jvm.functions.Function0<? extends androidx.lifecycle.ViewModelProvider.Factory>? factoryProducer);
+ method @MainThread public static <VM extends androidx.lifecycle.ViewModel> kotlin.Lazy<VM> createViewModelLazy(androidx.fragment.app.Fragment, kotlin.reflect.KClass<VM> viewModelClass, kotlin.jvm.functions.Function0<? extends androidx.lifecycle.ViewModelStore> storeProducer, optional kotlin.jvm.functions.Function0<? extends androidx.lifecycle.ViewModelProvider.Factory>? factoryProducer);
+ method @MainThread public static inline <reified VM extends androidx.lifecycle.ViewModel> kotlin.Lazy<? extends VM>! viewModels(androidx.fragment.app.Fragment, optional kotlin.jvm.functions.Function0<? extends androidx.lifecycle.ViewModelStoreOwner> ownerProducer, optional kotlin.jvm.functions.Function0<? extends androidx.lifecycle.ViewModelProvider.Factory>? factoryProducer);
+ }
+
+ public final class ViewKt {
+ method public static <F extends androidx.fragment.app.Fragment> F findFragment(android.view.View);
+ }
+
+}
+
diff --git a/fragment/fragment-ktx/build.gradle b/fragment/fragment-ktx/build.gradle
index 9932a5c..88435eb 100644
--- a/fragment/fragment-ktx/build.gradle
+++ b/fragment/fragment-ktx/build.gradle
@@ -27,7 +27,7 @@
dependencies {
api(project(":fragment:fragment"))
- api(project(":activity:activity-ktx")) {
+ api(projectOrArtifact(":activity:activity-ktx")) {
because 'Mirror fragment dependency graph for -ktx artifacts'
}
api("androidx.core:core-ktx:1.1.0") {
@@ -36,11 +36,11 @@
api("androidx.collection:collection-ktx:1.1.0") {
because 'Mirror fragment dependency graph for -ktx artifacts'
}
- api(project(":lifecycle:lifecycle-livedata-core-ktx")) {
+ api(projectOrArtifact(":lifecycle:lifecycle-livedata-core-ktx")) {
because 'Mirror fragment dependency graph for -ktx artifacts'
}
- api(project(":lifecycle:lifecycle-viewmodel-ktx"))
- api(project(":savedstate:savedstate-ktx")) {
+ api(projectOrArtifact(":lifecycle:lifecycle-viewmodel-ktx"))
+ api(projectOrArtifact(":savedstate:savedstate-ktx")) {
because 'Mirror fragment dependency graph for -ktx artifacts'
}
api(KOTLIN_STDLIB)
diff --git a/fragment/fragment-testing/api/1.3.0-beta02.txt b/fragment/fragment-testing/api/1.3.0-beta02.txt
new file mode 100644
index 0000000..4838040
--- /dev/null
+++ b/fragment/fragment-testing/api/1.3.0-beta02.txt
@@ -0,0 +1,59 @@
+// Signature format: 4.0
+package androidx.fragment.app.testing {
+
+ public final class FragmentScenario<F extends androidx.fragment.app.Fragment> {
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, @StyleRes int themeResId, androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, optional androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, @StyleRes int themeResId, androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, optional androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass);
+ method public androidx.fragment.app.testing.FragmentScenario<F> moveToState(androidx.lifecycle.Lifecycle.State newState);
+ method public androidx.fragment.app.testing.FragmentScenario<F> onFragment(androidx.fragment.app.testing.FragmentScenario.FragmentAction<F> action);
+ method public androidx.fragment.app.testing.FragmentScenario<F> recreate();
+ field public static final androidx.fragment.app.testing.FragmentScenario.Companion Companion;
+ }
+
+ public static final class FragmentScenario.Companion {
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, @StyleRes int themeResId, androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, optional androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, @StyleRes int themeResId, androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, optional androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass);
+ }
+
+ public static fun interface FragmentScenario.FragmentAction<F extends androidx.fragment.app.Fragment> {
+ method public void perform(F fragment);
+ }
+
+ public final class FragmentScenarioKt {
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F>! launchFragment(optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.fragment.app.FragmentFactory? factory);
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F>! launchFragment(optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, kotlin.jvm.functions.Function0<? extends F> instantiate);
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F>! launchFragment(optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, optional androidx.fragment.app.FragmentFactory? factory);
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F>! launchFragment(optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, kotlin.jvm.functions.Function0<? extends F> instantiate);
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F>! launchFragmentInContainer(optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.fragment.app.FragmentFactory? factory);
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F>! launchFragmentInContainer(optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, kotlin.jvm.functions.Function0<? extends F> instantiate);
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F>! launchFragmentInContainer(optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, optional androidx.fragment.app.FragmentFactory? factory);
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F>! launchFragmentInContainer(optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, kotlin.jvm.functions.Function0<? extends F> instantiate);
+ method public static inline <reified F extends androidx.fragment.app.Fragment, T> T! withFragment(androidx.fragment.app.testing.FragmentScenario<F>, kotlin.jvm.functions.Function1<? super F,? extends T> block);
+ }
+
+}
+
diff --git a/fragment/fragment-testing/api/current.ignore b/fragment/fragment-testing/api/current.ignore
new file mode 100644
index 0000000..aff4f36
--- /dev/null
+++ b/fragment/fragment-testing/api/current.ignore
@@ -0,0 +1,27 @@
+// Baseline format: 1.0
+ChangedType: androidx.fragment.app.testing.FragmentScenario#launch(Class<F>):
+ Method androidx.fragment.app.testing.FragmentScenario.launch has changed return type from androidx.fragment.app.testing.FragmentScenario<F!> to androidx.fragment.app.testing.FragmentScenario<F>
+ChangedType: androidx.fragment.app.testing.FragmentScenario#launch(Class<F>, android.os.Bundle):
+ Method androidx.fragment.app.testing.FragmentScenario.launch has changed return type from androidx.fragment.app.testing.FragmentScenario<F!> to androidx.fragment.app.testing.FragmentScenario<F>
+ChangedType: androidx.fragment.app.testing.FragmentScenario#launch(Class<F>, android.os.Bundle, androidx.fragment.app.FragmentFactory):
+ Method androidx.fragment.app.testing.FragmentScenario.launch has changed return type from androidx.fragment.app.testing.FragmentScenario<F!> to androidx.fragment.app.testing.FragmentScenario<F>
+ChangedType: androidx.fragment.app.testing.FragmentScenario#launch(Class<F>, android.os.Bundle, int, androidx.fragment.app.FragmentFactory):
+ Method androidx.fragment.app.testing.FragmentScenario.launch has changed return type from androidx.fragment.app.testing.FragmentScenario<F!> to androidx.fragment.app.testing.FragmentScenario<F>
+ChangedType: androidx.fragment.app.testing.FragmentScenario#launch(Class<F>, android.os.Bundle, int, androidx.lifecycle.Lifecycle.State, androidx.fragment.app.FragmentFactory):
+ Method androidx.fragment.app.testing.FragmentScenario.launch has changed return type from androidx.fragment.app.testing.FragmentScenario<F!> to androidx.fragment.app.testing.FragmentScenario<F>
+ChangedType: androidx.fragment.app.testing.FragmentScenario#launchInContainer(Class<F>):
+ Method androidx.fragment.app.testing.FragmentScenario.launchInContainer has changed return type from androidx.fragment.app.testing.FragmentScenario<F!> to androidx.fragment.app.testing.FragmentScenario<F>
+ChangedType: androidx.fragment.app.testing.FragmentScenario#launchInContainer(Class<F>, android.os.Bundle):
+ Method androidx.fragment.app.testing.FragmentScenario.launchInContainer has changed return type from androidx.fragment.app.testing.FragmentScenario<F!> to androidx.fragment.app.testing.FragmentScenario<F>
+ChangedType: androidx.fragment.app.testing.FragmentScenario#launchInContainer(Class<F>, android.os.Bundle, androidx.fragment.app.FragmentFactory):
+ Method androidx.fragment.app.testing.FragmentScenario.launchInContainer has changed return type from androidx.fragment.app.testing.FragmentScenario<F!> to androidx.fragment.app.testing.FragmentScenario<F>
+ChangedType: androidx.fragment.app.testing.FragmentScenario#launchInContainer(Class<F>, android.os.Bundle, int, androidx.fragment.app.FragmentFactory):
+ Method androidx.fragment.app.testing.FragmentScenario.launchInContainer has changed return type from androidx.fragment.app.testing.FragmentScenario<F!> to androidx.fragment.app.testing.FragmentScenario<F>
+ChangedType: androidx.fragment.app.testing.FragmentScenario#launchInContainer(Class<F>, android.os.Bundle, int, androidx.lifecycle.Lifecycle.State, androidx.fragment.app.FragmentFactory):
+ Method androidx.fragment.app.testing.FragmentScenario.launchInContainer has changed return type from androidx.fragment.app.testing.FragmentScenario<F!> to androidx.fragment.app.testing.FragmentScenario<F>
+ChangedType: androidx.fragment.app.testing.FragmentScenario#moveToState(androidx.lifecycle.Lifecycle.State):
+ Method androidx.fragment.app.testing.FragmentScenario.moveToState has changed return type from androidx.fragment.app.testing.FragmentScenario<F!> to androidx.fragment.app.testing.FragmentScenario<F>
+ChangedType: androidx.fragment.app.testing.FragmentScenario#onFragment(androidx.fragment.app.testing.FragmentScenario.FragmentAction<F>):
+ Method androidx.fragment.app.testing.FragmentScenario.onFragment has changed return type from androidx.fragment.app.testing.FragmentScenario<F!> to androidx.fragment.app.testing.FragmentScenario<F>
+ChangedType: androidx.fragment.app.testing.FragmentScenario#recreate():
+ Method androidx.fragment.app.testing.FragmentScenario.recreate has changed return type from androidx.fragment.app.testing.FragmentScenario<F!> to androidx.fragment.app.testing.FragmentScenario<F>
diff --git a/fragment/fragment-testing/api/current.txt b/fragment/fragment-testing/api/current.txt
index 5486858..4838040 100644
--- a/fragment/fragment-testing/api/current.txt
+++ b/fragment/fragment-testing/api/current.txt
@@ -2,23 +2,45 @@
package androidx.fragment.app.testing {
public final class FragmentScenario<F extends androidx.fragment.app.Fragment> {
- method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F!> launch(Class<F!>);
- method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F!> launch(Class<F!>, android.os.Bundle?);
- method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F!> launch(Class<F!>, android.os.Bundle?, androidx.fragment.app.FragmentFactory?);
- method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F!> launch(Class<F!>, android.os.Bundle?, @StyleRes int, androidx.fragment.app.FragmentFactory?);
- method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F!> launch(Class<F!>, android.os.Bundle?, @StyleRes int, androidx.lifecycle.Lifecycle.State, androidx.fragment.app.FragmentFactory?);
- method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F!> launchInContainer(Class<F!>);
- method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F!> launchInContainer(Class<F!>, android.os.Bundle?);
- method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F!> launchInContainer(Class<F!>, android.os.Bundle?, androidx.fragment.app.FragmentFactory?);
- method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F!> launchInContainer(Class<F!>, android.os.Bundle?, @StyleRes int, androidx.fragment.app.FragmentFactory?);
- method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F!> launchInContainer(Class<F!>, android.os.Bundle?, @StyleRes int, androidx.lifecycle.Lifecycle.State, androidx.fragment.app.FragmentFactory?);
- method public androidx.fragment.app.testing.FragmentScenario<F!> moveToState(androidx.lifecycle.Lifecycle.State);
- method public androidx.fragment.app.testing.FragmentScenario<F!> onFragment(androidx.fragment.app.testing.FragmentScenario.FragmentAction<F!>);
- method public androidx.fragment.app.testing.FragmentScenario<F!> recreate();
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, @StyleRes int themeResId, androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, optional androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, @StyleRes int themeResId, androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, optional androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass);
+ method public androidx.fragment.app.testing.FragmentScenario<F> moveToState(androidx.lifecycle.Lifecycle.State newState);
+ method public androidx.fragment.app.testing.FragmentScenario<F> onFragment(androidx.fragment.app.testing.FragmentScenario.FragmentAction<F> action);
+ method public androidx.fragment.app.testing.FragmentScenario<F> recreate();
+ field public static final androidx.fragment.app.testing.FragmentScenario.Companion Companion;
}
- public static interface FragmentScenario.FragmentAction<F extends androidx.fragment.app.Fragment> {
- method public void perform(F);
+ public static final class FragmentScenario.Companion {
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, @StyleRes int themeResId, androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, optional androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, @StyleRes int themeResId, androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, optional androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass);
+ }
+
+ public static fun interface FragmentScenario.FragmentAction<F extends androidx.fragment.app.Fragment> {
+ method public void perform(F fragment);
}
public final class FragmentScenarioKt {
diff --git a/fragment/fragment-testing/api/public_plus_experimental_1.3.0-beta02.txt b/fragment/fragment-testing/api/public_plus_experimental_1.3.0-beta02.txt
new file mode 100644
index 0000000..4838040
--- /dev/null
+++ b/fragment/fragment-testing/api/public_plus_experimental_1.3.0-beta02.txt
@@ -0,0 +1,59 @@
+// Signature format: 4.0
+package androidx.fragment.app.testing {
+
+ public final class FragmentScenario<F extends androidx.fragment.app.Fragment> {
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, @StyleRes int themeResId, androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, optional androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, @StyleRes int themeResId, androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, optional androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass);
+ method public androidx.fragment.app.testing.FragmentScenario<F> moveToState(androidx.lifecycle.Lifecycle.State newState);
+ method public androidx.fragment.app.testing.FragmentScenario<F> onFragment(androidx.fragment.app.testing.FragmentScenario.FragmentAction<F> action);
+ method public androidx.fragment.app.testing.FragmentScenario<F> recreate();
+ field public static final androidx.fragment.app.testing.FragmentScenario.Companion Companion;
+ }
+
+ public static final class FragmentScenario.Companion {
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, @StyleRes int themeResId, androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, optional androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, @StyleRes int themeResId, androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, optional androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass);
+ }
+
+ public static fun interface FragmentScenario.FragmentAction<F extends androidx.fragment.app.Fragment> {
+ method public void perform(F fragment);
+ }
+
+ public final class FragmentScenarioKt {
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F>! launchFragment(optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.fragment.app.FragmentFactory? factory);
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F>! launchFragment(optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, kotlin.jvm.functions.Function0<? extends F> instantiate);
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F>! launchFragment(optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, optional androidx.fragment.app.FragmentFactory? factory);
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F>! launchFragment(optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, kotlin.jvm.functions.Function0<? extends F> instantiate);
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F>! launchFragmentInContainer(optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.fragment.app.FragmentFactory? factory);
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F>! launchFragmentInContainer(optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, kotlin.jvm.functions.Function0<? extends F> instantiate);
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F>! launchFragmentInContainer(optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, optional androidx.fragment.app.FragmentFactory? factory);
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F>! launchFragmentInContainer(optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, kotlin.jvm.functions.Function0<? extends F> instantiate);
+ method public static inline <reified F extends androidx.fragment.app.Fragment, T> T! withFragment(androidx.fragment.app.testing.FragmentScenario<F>, kotlin.jvm.functions.Function1<? super F,? extends T> block);
+ }
+
+}
+
diff --git a/fragment/fragment-testing/api/public_plus_experimental_current.txt b/fragment/fragment-testing/api/public_plus_experimental_current.txt
index 5486858..4838040 100644
--- a/fragment/fragment-testing/api/public_plus_experimental_current.txt
+++ b/fragment/fragment-testing/api/public_plus_experimental_current.txt
@@ -2,23 +2,45 @@
package androidx.fragment.app.testing {
public final class FragmentScenario<F extends androidx.fragment.app.Fragment> {
- method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F!> launch(Class<F!>);
- method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F!> launch(Class<F!>, android.os.Bundle?);
- method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F!> launch(Class<F!>, android.os.Bundle?, androidx.fragment.app.FragmentFactory?);
- method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F!> launch(Class<F!>, android.os.Bundle?, @StyleRes int, androidx.fragment.app.FragmentFactory?);
- method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F!> launch(Class<F!>, android.os.Bundle?, @StyleRes int, androidx.lifecycle.Lifecycle.State, androidx.fragment.app.FragmentFactory?);
- method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F!> launchInContainer(Class<F!>);
- method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F!> launchInContainer(Class<F!>, android.os.Bundle?);
- method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F!> launchInContainer(Class<F!>, android.os.Bundle?, androidx.fragment.app.FragmentFactory?);
- method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F!> launchInContainer(Class<F!>, android.os.Bundle?, @StyleRes int, androidx.fragment.app.FragmentFactory?);
- method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F!> launchInContainer(Class<F!>, android.os.Bundle?, @StyleRes int, androidx.lifecycle.Lifecycle.State, androidx.fragment.app.FragmentFactory?);
- method public androidx.fragment.app.testing.FragmentScenario<F!> moveToState(androidx.lifecycle.Lifecycle.State);
- method public androidx.fragment.app.testing.FragmentScenario<F!> onFragment(androidx.fragment.app.testing.FragmentScenario.FragmentAction<F!>);
- method public androidx.fragment.app.testing.FragmentScenario<F!> recreate();
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, @StyleRes int themeResId, androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, optional androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, @StyleRes int themeResId, androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, optional androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass);
+ method public androidx.fragment.app.testing.FragmentScenario<F> moveToState(androidx.lifecycle.Lifecycle.State newState);
+ method public androidx.fragment.app.testing.FragmentScenario<F> onFragment(androidx.fragment.app.testing.FragmentScenario.FragmentAction<F> action);
+ method public androidx.fragment.app.testing.FragmentScenario<F> recreate();
+ field public static final androidx.fragment.app.testing.FragmentScenario.Companion Companion;
}
- public static interface FragmentScenario.FragmentAction<F extends androidx.fragment.app.Fragment> {
- method public void perform(F);
+ public static final class FragmentScenario.Companion {
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, @StyleRes int themeResId, androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, optional androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, @StyleRes int themeResId, androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, optional androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass);
+ }
+
+ public static fun interface FragmentScenario.FragmentAction<F extends androidx.fragment.app.Fragment> {
+ method public void perform(F fragment);
}
public final class FragmentScenarioKt {
diff --git a/fragment/fragment-testing/api/res-1.3.0-beta02.txt b/fragment/fragment-testing/api/res-1.3.0-beta02.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/fragment/fragment-testing/api/res-1.3.0-beta02.txt
diff --git a/fragment/fragment-testing/api/restricted_1.3.0-beta02.txt b/fragment/fragment-testing/api/restricted_1.3.0-beta02.txt
new file mode 100644
index 0000000..4838040
--- /dev/null
+++ b/fragment/fragment-testing/api/restricted_1.3.0-beta02.txt
@@ -0,0 +1,59 @@
+// Signature format: 4.0
+package androidx.fragment.app.testing {
+
+ public final class FragmentScenario<F extends androidx.fragment.app.Fragment> {
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, @StyleRes int themeResId, androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, optional androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, @StyleRes int themeResId, androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, optional androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass);
+ method public androidx.fragment.app.testing.FragmentScenario<F> moveToState(androidx.lifecycle.Lifecycle.State newState);
+ method public androidx.fragment.app.testing.FragmentScenario<F> onFragment(androidx.fragment.app.testing.FragmentScenario.FragmentAction<F> action);
+ method public androidx.fragment.app.testing.FragmentScenario<F> recreate();
+ field public static final androidx.fragment.app.testing.FragmentScenario.Companion Companion;
+ }
+
+ public static final class FragmentScenario.Companion {
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, @StyleRes int themeResId, androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, optional androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, @StyleRes int themeResId, androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, optional androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass);
+ }
+
+ public static fun interface FragmentScenario.FragmentAction<F extends androidx.fragment.app.Fragment> {
+ method public void perform(F fragment);
+ }
+
+ public final class FragmentScenarioKt {
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F>! launchFragment(optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.fragment.app.FragmentFactory? factory);
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F>! launchFragment(optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, kotlin.jvm.functions.Function0<? extends F> instantiate);
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F>! launchFragment(optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, optional androidx.fragment.app.FragmentFactory? factory);
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F>! launchFragment(optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, kotlin.jvm.functions.Function0<? extends F> instantiate);
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F>! launchFragmentInContainer(optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.fragment.app.FragmentFactory? factory);
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F>! launchFragmentInContainer(optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, kotlin.jvm.functions.Function0<? extends F> instantiate);
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F>! launchFragmentInContainer(optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, optional androidx.fragment.app.FragmentFactory? factory);
+ method public static inline <reified F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F>! launchFragmentInContainer(optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, kotlin.jvm.functions.Function0<? extends F> instantiate);
+ method public static inline <reified F extends androidx.fragment.app.Fragment, T> T! withFragment(androidx.fragment.app.testing.FragmentScenario<F>, kotlin.jvm.functions.Function1<? super F,? extends T> block);
+ }
+
+}
+
diff --git a/fragment/fragment-testing/api/restricted_current.ignore b/fragment/fragment-testing/api/restricted_current.ignore
new file mode 100644
index 0000000..aff4f36
--- /dev/null
+++ b/fragment/fragment-testing/api/restricted_current.ignore
@@ -0,0 +1,27 @@
+// Baseline format: 1.0
+ChangedType: androidx.fragment.app.testing.FragmentScenario#launch(Class<F>):
+ Method androidx.fragment.app.testing.FragmentScenario.launch has changed return type from androidx.fragment.app.testing.FragmentScenario<F!> to androidx.fragment.app.testing.FragmentScenario<F>
+ChangedType: androidx.fragment.app.testing.FragmentScenario#launch(Class<F>, android.os.Bundle):
+ Method androidx.fragment.app.testing.FragmentScenario.launch has changed return type from androidx.fragment.app.testing.FragmentScenario<F!> to androidx.fragment.app.testing.FragmentScenario<F>
+ChangedType: androidx.fragment.app.testing.FragmentScenario#launch(Class<F>, android.os.Bundle, androidx.fragment.app.FragmentFactory):
+ Method androidx.fragment.app.testing.FragmentScenario.launch has changed return type from androidx.fragment.app.testing.FragmentScenario<F!> to androidx.fragment.app.testing.FragmentScenario<F>
+ChangedType: androidx.fragment.app.testing.FragmentScenario#launch(Class<F>, android.os.Bundle, int, androidx.fragment.app.FragmentFactory):
+ Method androidx.fragment.app.testing.FragmentScenario.launch has changed return type from androidx.fragment.app.testing.FragmentScenario<F!> to androidx.fragment.app.testing.FragmentScenario<F>
+ChangedType: androidx.fragment.app.testing.FragmentScenario#launch(Class<F>, android.os.Bundle, int, androidx.lifecycle.Lifecycle.State, androidx.fragment.app.FragmentFactory):
+ Method androidx.fragment.app.testing.FragmentScenario.launch has changed return type from androidx.fragment.app.testing.FragmentScenario<F!> to androidx.fragment.app.testing.FragmentScenario<F>
+ChangedType: androidx.fragment.app.testing.FragmentScenario#launchInContainer(Class<F>):
+ Method androidx.fragment.app.testing.FragmentScenario.launchInContainer has changed return type from androidx.fragment.app.testing.FragmentScenario<F!> to androidx.fragment.app.testing.FragmentScenario<F>
+ChangedType: androidx.fragment.app.testing.FragmentScenario#launchInContainer(Class<F>, android.os.Bundle):
+ Method androidx.fragment.app.testing.FragmentScenario.launchInContainer has changed return type from androidx.fragment.app.testing.FragmentScenario<F!> to androidx.fragment.app.testing.FragmentScenario<F>
+ChangedType: androidx.fragment.app.testing.FragmentScenario#launchInContainer(Class<F>, android.os.Bundle, androidx.fragment.app.FragmentFactory):
+ Method androidx.fragment.app.testing.FragmentScenario.launchInContainer has changed return type from androidx.fragment.app.testing.FragmentScenario<F!> to androidx.fragment.app.testing.FragmentScenario<F>
+ChangedType: androidx.fragment.app.testing.FragmentScenario#launchInContainer(Class<F>, android.os.Bundle, int, androidx.fragment.app.FragmentFactory):
+ Method androidx.fragment.app.testing.FragmentScenario.launchInContainer has changed return type from androidx.fragment.app.testing.FragmentScenario<F!> to androidx.fragment.app.testing.FragmentScenario<F>
+ChangedType: androidx.fragment.app.testing.FragmentScenario#launchInContainer(Class<F>, android.os.Bundle, int, androidx.lifecycle.Lifecycle.State, androidx.fragment.app.FragmentFactory):
+ Method androidx.fragment.app.testing.FragmentScenario.launchInContainer has changed return type from androidx.fragment.app.testing.FragmentScenario<F!> to androidx.fragment.app.testing.FragmentScenario<F>
+ChangedType: androidx.fragment.app.testing.FragmentScenario#moveToState(androidx.lifecycle.Lifecycle.State):
+ Method androidx.fragment.app.testing.FragmentScenario.moveToState has changed return type from androidx.fragment.app.testing.FragmentScenario<F!> to androidx.fragment.app.testing.FragmentScenario<F>
+ChangedType: androidx.fragment.app.testing.FragmentScenario#onFragment(androidx.fragment.app.testing.FragmentScenario.FragmentAction<F>):
+ Method androidx.fragment.app.testing.FragmentScenario.onFragment has changed return type from androidx.fragment.app.testing.FragmentScenario<F!> to androidx.fragment.app.testing.FragmentScenario<F>
+ChangedType: androidx.fragment.app.testing.FragmentScenario#recreate():
+ Method androidx.fragment.app.testing.FragmentScenario.recreate has changed return type from androidx.fragment.app.testing.FragmentScenario<F!> to androidx.fragment.app.testing.FragmentScenario<F>
diff --git a/fragment/fragment-testing/api/restricted_current.txt b/fragment/fragment-testing/api/restricted_current.txt
index 5486858..4838040 100644
--- a/fragment/fragment-testing/api/restricted_current.txt
+++ b/fragment/fragment-testing/api/restricted_current.txt
@@ -2,23 +2,45 @@
package androidx.fragment.app.testing {
public final class FragmentScenario<F extends androidx.fragment.app.Fragment> {
- method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F!> launch(Class<F!>);
- method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F!> launch(Class<F!>, android.os.Bundle?);
- method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F!> launch(Class<F!>, android.os.Bundle?, androidx.fragment.app.FragmentFactory?);
- method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F!> launch(Class<F!>, android.os.Bundle?, @StyleRes int, androidx.fragment.app.FragmentFactory?);
- method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F!> launch(Class<F!>, android.os.Bundle?, @StyleRes int, androidx.lifecycle.Lifecycle.State, androidx.fragment.app.FragmentFactory?);
- method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F!> launchInContainer(Class<F!>);
- method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F!> launchInContainer(Class<F!>, android.os.Bundle?);
- method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F!> launchInContainer(Class<F!>, android.os.Bundle?, androidx.fragment.app.FragmentFactory?);
- method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F!> launchInContainer(Class<F!>, android.os.Bundle?, @StyleRes int, androidx.fragment.app.FragmentFactory?);
- method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F!> launchInContainer(Class<F!>, android.os.Bundle?, @StyleRes int, androidx.lifecycle.Lifecycle.State, androidx.fragment.app.FragmentFactory?);
- method public androidx.fragment.app.testing.FragmentScenario<F!> moveToState(androidx.lifecycle.Lifecycle.State);
- method public androidx.fragment.app.testing.FragmentScenario<F!> onFragment(androidx.fragment.app.testing.FragmentScenario.FragmentAction<F!>);
- method public androidx.fragment.app.testing.FragmentScenario<F!> recreate();
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, @StyleRes int themeResId, androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, optional androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, @StyleRes int themeResId, androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, optional androidx.fragment.app.FragmentFactory? factory);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs);
+ method public static <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass);
+ method public androidx.fragment.app.testing.FragmentScenario<F> moveToState(androidx.lifecycle.Lifecycle.State newState);
+ method public androidx.fragment.app.testing.FragmentScenario<F> onFragment(androidx.fragment.app.testing.FragmentScenario.FragmentAction<F> action);
+ method public androidx.fragment.app.testing.FragmentScenario<F> recreate();
+ field public static final androidx.fragment.app.testing.FragmentScenario.Companion Companion;
}
- public static interface FragmentScenario.FragmentAction<F extends androidx.fragment.app.Fragment> {
- method public void perform(F);
+ public static final class FragmentScenario.Companion {
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, @StyleRes int themeResId, androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, optional androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launch(Class<F> fragmentClass);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, android.os.Bundle? fragmentArgs, @StyleRes int themeResId, androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState, optional androidx.fragment.app.FragmentFactory? factory);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId, optional androidx.lifecycle.Lifecycle.State initialState);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs, optional @StyleRes int themeResId);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass, optional android.os.Bundle? fragmentArgs);
+ method public <F extends androidx.fragment.app.Fragment> androidx.fragment.app.testing.FragmentScenario<F> launchInContainer(Class<F> fragmentClass);
+ }
+
+ public static fun interface FragmentScenario.FragmentAction<F extends androidx.fragment.app.Fragment> {
+ method public void perform(F fragment);
}
public final class FragmentScenarioKt {
diff --git a/fragment/fragment-testing/src/main/java/androidx/fragment/app/testing/FragmentScenario.java b/fragment/fragment-testing/src/main/java/androidx/fragment/app/testing/FragmentScenario.java
deleted file mode 100644
index 64ff90b..0000000
--- a/fragment/fragment-testing/src/main/java/androidx/fragment/app/testing/FragmentScenario.java
+++ /dev/null
@@ -1,464 +0,0 @@
-/*
- * Copyright (C) 2018 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package androidx.fragment.app.testing;
-
-import static androidx.annotation.RestrictTo.Scope.LIBRARY;
-import static androidx.core.util.Preconditions.checkNotNull;
-import static androidx.core.util.Preconditions.checkState;
-import static androidx.test.core.app.ApplicationProvider.getApplicationContext;
-
-import android.annotation.SuppressLint;
-import android.content.ComponentName;
-import android.content.Intent;
-import android.os.Bundle;
-
-import androidx.annotation.IdRes;
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.annotation.RestrictTo;
-import androidx.annotation.StyleRes;
-import androidx.core.util.Preconditions;
-import androidx.fragment.app.Fragment;
-import androidx.fragment.app.FragmentActivity;
-import androidx.fragment.app.FragmentFactory;
-import androidx.fragment.testing.R;
-import androidx.lifecycle.Lifecycle;
-import androidx.lifecycle.Lifecycle.State;
-import androidx.lifecycle.ViewModel;
-import androidx.lifecycle.ViewModelProvider;
-import androidx.test.core.app.ActivityScenario;
-
-/**
- * FragmentScenario provides API to start and drive a Fragment's lifecycle state for testing. It
- * works with arbitrary fragments and works consistently across different versions of the Android
- * framework.
- * <p>
- * FragmentScenario only supports {@link Fragment androidx.fragment.app.Fragment}. If you are using
- * a deprecated fragment class such as {@code android.support.v4.app.Fragment} or
- * {@link android.app.Fragment android.app.Fragment}, please update your code to
- * {@link Fragment androidx.fragment.app.Fragment}.
- * <p>
- * If your testing Fragment has a dependency to specific theme such as {@code Theme.AppCompat},
- * use the theme ID parameter in {@link #launch} method.
- *
- * @param <F> The Fragment class being tested
- *
- * @see ActivityScenario a scenario API for Activity
- */
-public final class FragmentScenario<F extends Fragment> {
-
- private static final String FRAGMENT_TAG = "FragmentScenario_Fragment_Tag";
- @SuppressWarnings("WeakerAccess") /* synthetic access */
- final Class<F> mFragmentClass;
- private final ActivityScenario<EmptyFragmentActivity> mActivityScenario;
-
- /**
- * An empty activity inheriting FragmentActivity. This Activity is used to host Fragment in
- * FragmentScenario.
- *
- * @hide
- */
- @RestrictTo(LIBRARY)
- public static class EmptyFragmentActivity extends FragmentActivity {
-
- @NonNull
- public static final String THEME_EXTRAS_BUNDLE_KEY =
- "androidx.fragment.app.testing.FragmentScenario.EmptyFragmentActivity"
- + ".THEME_EXTRAS_BUNDLE_KEY";
-
- @Override
- @SuppressLint("RestrictedApi")
- protected void onCreate(@Nullable Bundle savedInstanceState) {
- setTheme(getIntent().getIntExtra(THEME_EXTRAS_BUNDLE_KEY,
- R.style.FragmentScenarioEmptyFragmentActivityTheme));
-
- // Checks if we have a custom FragmentFactory and set it.
- FragmentFactory factory = FragmentFactoryHolderViewModel.getInstance(this)
- .getFragmentFactory();
- if (factory != null) {
- getSupportFragmentManager().setFragmentFactory(factory);
- }
-
- // FragmentFactory needs to be set before calling the super.onCreate, otherwise the
- // Activity crashes when it is recreating and there is a fragment which has no
- // default constructor.
- super.onCreate(savedInstanceState);
- }
- }
-
- /**
- * A view-model to hold a fragment factory.
- *
- * @hide
- */
- @RestrictTo(LIBRARY)
- public static class FragmentFactoryHolderViewModel extends ViewModel {
-
- private static final ViewModelProvider.Factory FACTORY = new ViewModelProvider.Factory() {
- @NonNull
- @Override
- @SuppressWarnings("unchecked")
- public <T extends ViewModel> T create(@NonNull Class<T> modelClass) {
- FragmentFactoryHolderViewModel viewModel = new FragmentFactoryHolderViewModel();
- return (T) viewModel;
- }
- };
-
- @NonNull
- static FragmentFactoryHolderViewModel getInstance(@NonNull FragmentActivity activity) {
- ViewModelProvider viewModelProvider = new ViewModelProvider(activity, FACTORY);
- return viewModelProvider.get(FragmentFactoryHolderViewModel.class);
- }
-
- @Nullable private FragmentFactory mFragmentFactory;
-
- void setFragmentFactory(@Nullable FragmentFactory factory) {
- mFragmentFactory = factory;
- }
-
- @Nullable
- FragmentFactory getFragmentFactory() {
- return mFragmentFactory;
- }
-
- @Override
- protected void onCleared() {
- super.onCleared();
- mFragmentFactory = null;
- }
- }
-
- private FragmentScenario(
- @NonNull Class<F> fragmentClass,
- @NonNull ActivityScenario<EmptyFragmentActivity> activityScenario) {
- this.mFragmentClass = fragmentClass;
- this.mActivityScenario = activityScenario;
- }
-
- /**
- * Launches a Fragment hosted by an empty {@link FragmentActivity} and waits for it to reach
- * the resumed state.
- *
- * @param fragmentClass a fragment class to instantiate
- */
- @NonNull
- public static <F extends Fragment> FragmentScenario<F> launch(
- @NonNull Class<F> fragmentClass) {
- return launch(fragmentClass, /*fragmentArgs=*/ null);
- }
-
- /**
- * Launches a Fragment with given arguments hosted by an empty {@link FragmentActivity} and
- * waits for it to reach the resumed state.
- * <p>
- * This method cannot be called from the main thread.
- *
- * @param fragmentClass a fragment class to instantiate
- * @param fragmentArgs a bundle to passed into fragment
- */
- @NonNull
- public static <F extends Fragment> FragmentScenario<F> launch(
- @NonNull Class<F> fragmentClass, @Nullable Bundle fragmentArgs) {
- return launch(fragmentClass, fragmentArgs, /*factory=*/null);
- }
-
- /**
- * Launches a Fragment with given arguments hosted by an empty {@link FragmentActivity} using
- * the given {@link FragmentFactory} and waits for it to reach the resumed state.
- * <p>
- * This method cannot be called from the main thread.
- *
- * @param fragmentClass a fragment class to instantiate
- * @param fragmentArgs a bundle to passed into fragment
- * @param factory a fragment factory to use or null to use default factory
- */
- @NonNull
- public static <F extends Fragment> FragmentScenario<F> launch(
- @NonNull Class<F> fragmentClass, @Nullable Bundle fragmentArgs,
- @Nullable FragmentFactory factory) {
- return launch(fragmentClass, fragmentArgs,
- R.style.FragmentScenarioEmptyFragmentActivityTheme, factory);
- }
-
- /**
- * Launches a Fragment with given arguments hosted by an empty {@link FragmentActivity} themed
- * by {@code themeResId}, using the given {@link FragmentFactory} and waits for it to reach the
- * resumed state.
- * <p>
- * This method cannot be called from the main thread.
- *
- * @param fragmentClass a fragment class to instantiate
- * @param fragmentArgs a bundle to passed into fragment
- * @param themeResId a style resource id to be set to the host activity's theme
- * @param factory a fragment factory to use or null to use default factory
- */
- @NonNull
- public static <F extends Fragment> FragmentScenario<F> launch(
- @NonNull Class<F> fragmentClass, @Nullable Bundle fragmentArgs,
- @StyleRes int themeResId, @Nullable FragmentFactory factory) {
- return launch(fragmentClass, fragmentArgs, themeResId, Lifecycle.State.RESUMED,
- factory);
- }
-
- /**
- * Launches a Fragment with given arguments hosted by an empty {@link FragmentActivity} themed
- * by {@code themeResId}, using the given {@link FragmentFactory} and waits for it to reach
- * {@code initialState}.
- * <p>
- * This method cannot be called from the main thread.
- *
- * @param fragmentClass a fragment class to instantiate
- * @param fragmentArgs a bundle to passed into fragment
- * @param themeResId a style resource id to be set to the host activity's theme
- * @param initialState The initial {@link Lifecycle.State}. This must be one of
- * {@link State#CREATED CREATED}, {@link State#STARTED STARTED}, and
- * {@link State#RESUMED RESUMED}.
- * @param factory a fragment factory to use or null to use default factory
- */
- @NonNull
- public static <F extends Fragment> FragmentScenario<F> launch(
- @NonNull Class<F> fragmentClass, @Nullable Bundle fragmentArgs,
- @StyleRes int themeResId, @NonNull Lifecycle.State initialState,
- @Nullable FragmentFactory factory) {
- return internalLaunch(fragmentClass, fragmentArgs, themeResId, initialState, factory,
- /*containerViewId=*/ 0);
- }
-
- /**
- * Launches a Fragment in the Activity's root view container {@code android.R.id.content},
- * hosted by an empty {@link FragmentActivity} and waits for it to reach the resumed state.
- * <p>
- * This method cannot be called from the main thread.
- *
- * @param fragmentClass a fragment class to instantiate
- */
- @NonNull
- public static <F extends Fragment> FragmentScenario<F> launchInContainer(
- @NonNull Class<F> fragmentClass) {
- return launchInContainer(fragmentClass, /*fragmentArgs=*/ null);
- }
-
- /**
- * Launches a Fragment in the Activity's root view container {@code android.R.id.content}, with
- * given arguments hosted by an empty {@link FragmentActivity} and waits for it to reach the
- * resumed state.
- * <p>
- * This method cannot be called from the main thread.
- *
- * @param fragmentClass a fragment class to instantiate
- * @param fragmentArgs a bundle to passed into fragment
- */
- @NonNull
- public static <F extends Fragment> FragmentScenario<F> launchInContainer(
- @NonNull Class<F> fragmentClass, @Nullable Bundle fragmentArgs) {
- return launchInContainer(fragmentClass, fragmentArgs, /*factory=*/null);
- }
-
- /**
- * Launches a Fragment in the Activity's root view container {@code android.R.id.content}, with
- * given arguments hosted by an empty {@link FragmentActivity} using the given
- * {@link FragmentFactory} and waits for it to reach the resumed state.
- * <p>
- * This method cannot be called from the main thread.
- *
- * @param fragmentClass a fragment class to instantiate
- * @param fragmentArgs a bundle to passed into fragment
- * @param factory a fragment factory to use or null to use default factory
- */
- @NonNull
- public static <F extends Fragment> FragmentScenario<F> launchInContainer(
- @NonNull Class<F> fragmentClass, @Nullable Bundle fragmentArgs,
- @Nullable FragmentFactory factory) {
- return launchInContainer(fragmentClass, fragmentArgs,
- R.style.FragmentScenarioEmptyFragmentActivityTheme, factory);
- }
-
- /**
- * Launches a Fragment in the Activity's root view container {@code android.R.id.content}, with
- * given arguments hosted by an empty {@link FragmentActivity} themed by {@code themeResId},
- * using the given {@link FragmentFactory} and waits for it to reach the resumed state.
- * <p>
- * This method cannot be called from the main thread.
- *
- * @param fragmentClass a fragment class to instantiate
- * @param fragmentArgs a bundle to passed into fragment
- * @param themeResId a style resource id to be set to the host activity's theme
- * @param factory a fragment factory to use or null to use default factory
- */
- @NonNull
- public static <F extends Fragment> FragmentScenario<F> launchInContainer(
- @NonNull Class<F> fragmentClass, @Nullable Bundle fragmentArgs,
- @StyleRes int themeResId, @Nullable FragmentFactory factory) {
- return launchInContainer(fragmentClass, fragmentArgs, themeResId, Lifecycle.State.RESUMED,
- factory);
- }
-
- /**
- * Launches a Fragment in the Activity's root view container {@code android.R.id.content}, with
- * given arguments hosted by an empty {@link FragmentActivity} themed by {@code themeResId},
- * using the given {@link FragmentFactory} and waits for it to reach {@code initialState}.
- * <p>
- * This method cannot be called from the main thread.
- *
- * @param fragmentClass a fragment class to instantiate
- * @param fragmentArgs a bundle to passed into fragment
- * @param themeResId a style resource id to be set to the host activity's theme
- * @param initialState The initial {@link Lifecycle.State}. This must be one of
- * {@link State#CREATED CREATED}, {@link State#STARTED STARTED}, and
- * {@link State#RESUMED RESUMED}.
- * @param factory a fragment factory to use or null to use default factory
- */
- @NonNull
- public static <F extends Fragment> FragmentScenario<F> launchInContainer(
- @NonNull Class<F> fragmentClass, @Nullable Bundle fragmentArgs,
- @StyleRes int themeResId, @NonNull Lifecycle.State initialState,
- @Nullable FragmentFactory factory) {
- return internalLaunch(
- fragmentClass, fragmentArgs, themeResId, initialState, factory,
- android.R.id.content);
- }
-
- @NonNull
- @SuppressLint("RestrictedApi")
- private static <F extends Fragment> FragmentScenario<F> internalLaunch(
- @NonNull final Class<F> fragmentClass, final @Nullable Bundle fragmentArgs,
- @StyleRes int themeResId, @NonNull Lifecycle.State initialState,
- @Nullable final FragmentFactory factory,
- @IdRes final int containerViewId) {
- Intent startActivityIntent =
- Intent.makeMainActivity(
- new ComponentName(getApplicationContext(),
- EmptyFragmentActivity.class))
- .putExtra(EmptyFragmentActivity.THEME_EXTRAS_BUNDLE_KEY, themeResId);
- FragmentScenario<F> scenario = new FragmentScenario<>(
- fragmentClass,
- ActivityScenario.launch(startActivityIntent));
- scenario.mActivityScenario.onActivity(activity -> {
- if (factory != null) {
- FragmentFactoryHolderViewModel.getInstance(activity)
- .setFragmentFactory(factory);
- activity.getSupportFragmentManager().setFragmentFactory(factory);
- }
- Fragment fragment = activity.getSupportFragmentManager()
- .getFragmentFactory().instantiate(
- Preconditions.checkNotNull(fragmentClass.getClassLoader()),
- fragmentClass.getName());
- fragment.setArguments(fragmentArgs);
- activity.getSupportFragmentManager()
- .beginTransaction()
- .add(containerViewId, fragment, FRAGMENT_TAG)
- .setMaxLifecycle(fragment, initialState)
- .commitNow();
- });
- return scenario;
- }
-
- /**
- * Moves Fragment state to a new state.
- * <p> If a new state and current state are the same, this method does nothing. It accepts
- * {@link State#CREATED CREATED}, {@link State#STARTED STARTED}, {@link State#RESUMED RESUMED},
- * and {@link State#DESTROYED DESTROYED}. {@link State#DESTROYED DESTROYED} is a terminal state.
- * You cannot move to any other state after the Fragment reaches that state.
- * <p> This method cannot be called from the main thread.
- */
- @NonNull
- public FragmentScenario<F> moveToState(@NonNull State newState) {
- if (newState == State.DESTROYED) {
- mActivityScenario.onActivity(activity -> {
- Fragment fragment =
- activity.getSupportFragmentManager().findFragmentByTag(
- FRAGMENT_TAG);
- // Null means the fragment has been destroyed already.
- if (fragment != null) {
- activity
- .getSupportFragmentManager()
- .beginTransaction()
- .remove(fragment)
- .commitNow();
- }
- });
- } else {
- mActivityScenario.onActivity(activity -> {
- Fragment fragment =
- activity.getSupportFragmentManager().findFragmentByTag(
- FRAGMENT_TAG);
- checkNotNull(fragment,
- "The fragment has been removed from FragmentManager already.");
- activity.getSupportFragmentManager()
- .beginTransaction()
- .setMaxLifecycle(fragment, newState)
- .commitNow();
- });
- }
- return this;
- }
-
- /**
- * Recreates the host Activity.
- * <p>
- * After this method call, it is ensured that the Fragment state goes back to the same state
- * as its previous state.
- * <p>
- * This method cannot be called from the main thread.
- */
- @NonNull
- public FragmentScenario<F> recreate() {
- mActivityScenario.recreate();
- return this;
- }
-
- /**
- * FragmentAction interface should be implemented by any class whose instances are intended to
- * be executed by the main thread. A Fragment that is instrumented by the FragmentScenario is
- * passed to {@link FragmentAction#perform} method.
- * <p>
- * You should never keep the Fragment reference as it will lead to unpredictable behaviour.
- * It should only be accessed in {@link FragmentAction#perform} scope.
- */
- public interface FragmentAction<F extends Fragment> {
- /**
- * This method is invoked on the main thread with the reference to the Fragment.
- *
- * @param fragment a Fragment instrumented by the FragmentScenario.
- */
- void perform(@NonNull F fragment);
- }
-
- /**
- * Runs a given {@code action} on the current Activity's main thread.
- * <p>
- * Note that you should never keep Fragment reference passed into your {@code action}
- * because it can be recreated at anytime during state transitions.
- * <p>
- * Throwing an exception from {@code action} makes the host Activity crash. You can
- * inspect the exception in logcat outputs.
- * <p>
- * This method cannot be called from the main thread.
- */
- @NonNull
- public FragmentScenario<F> onFragment(@NonNull final FragmentAction<F> action) {
- mActivityScenario.onActivity(activity -> {
- Fragment fragment = activity.getSupportFragmentManager().findFragmentByTag(
- FRAGMENT_TAG);
- checkNotNull(fragment,
- "The fragment has been removed from FragmentManager already.");
- checkState(mFragmentClass.isInstance(fragment));
- action.perform(Preconditions.checkNotNull(mFragmentClass.cast(fragment)));
- });
- return this;
- }
-}
diff --git a/fragment/fragment-testing/src/main/java/androidx/fragment/app/testing/FragmentScenario.kt b/fragment/fragment-testing/src/main/java/androidx/fragment/app/testing/FragmentScenario.kt
index d8694ad..89eeee7 100644
--- a/fragment/fragment-testing/src/main/java/androidx/fragment/app/testing/FragmentScenario.kt
+++ b/fragment/fragment-testing/src/main/java/androidx/fragment/app/testing/FragmentScenario.kt
@@ -16,13 +16,25 @@
package androidx.fragment.app.testing
+import android.annotation.SuppressLint
+import android.content.ComponentName
+import android.content.Intent
import android.os.Bundle
+import androidx.activity.viewModels
+import androidx.annotation.IdRes
+import androidx.annotation.RestrictTo
import androidx.annotation.StyleRes
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.fragment.app.FragmentFactory
+import androidx.fragment.app.commitNow
+import androidx.fragment.app.testing.FragmentScenario.Companion.launch
import androidx.fragment.testing.R
import androidx.lifecycle.Lifecycle
+import androidx.lifecycle.ViewModel
+import androidx.lifecycle.ViewModelProvider
+import androidx.test.core.app.ActivityScenario
+import androidx.test.core.app.ApplicationProvider
@Deprecated(
"Superseded by launchFragment that takes an initialState",
@@ -91,7 +103,7 @@
@StyleRes themeResId: Int = R.style.FragmentScenarioEmptyFragmentActivityTheme,
initialState: Lifecycle.State = Lifecycle.State.RESUMED,
factory: FragmentFactory? = null
-): FragmentScenario<F> = FragmentScenario.launch(
+): FragmentScenario<F> = launch(
F::class.java, fragmentArgs, themeResId, initialState,
factory
)
@@ -113,7 +125,7 @@
@StyleRes themeResId: Int = R.style.FragmentScenarioEmptyFragmentActivityTheme,
initialState: Lifecycle.State = Lifecycle.State.RESUMED,
crossinline instantiate: () -> F
-): FragmentScenario<F> = FragmentScenario.launch(
+): FragmentScenario<F> = launch(
F::class.java, fragmentArgs, themeResId, initialState,
object : FragmentFactory() {
override fun instantiate(
@@ -202,3 +214,392 @@
err?.let { throw it }
return value
}
+
+/**
+ * FragmentScenario provides API to start and drive a Fragment's lifecycle state for testing. It
+ * works with arbitrary fragments and works consistently across different versions of the Android
+ * framework.
+ *
+ * FragmentScenario only supports [androidx.fragment.app.Fragment][Fragment]. If you are using
+ * a deprecated fragment class such as `android.support.v4.app.Fragment` or
+ * [android.app.Fragment], please update your code to
+ * [androidx.fragment.app.Fragment][Fragment].
+ *
+ * If your testing Fragment has a dependency to specific theme such as `Theme.AppCompat`,
+ * use the theme ID parameter in [launch] method.
+ *
+ * @param <F> The Fragment class being tested
+ *
+ * @see ActivityScenario a scenario API for Activity
+ */
+public class FragmentScenario<F : Fragment> private constructor(
+ @Suppress("MemberVisibilityCanBePrivate") /* synthetic access */
+ internal val fragmentClass: Class<F>,
+ private val activityScenario: ActivityScenario<EmptyFragmentActivity>
+) {
+
+ /**
+ * An empty activity inheriting FragmentActivity. This Activity is used to host Fragment in
+ * FragmentScenario.
+ *
+ * @hide
+ */
+ @RestrictTo(RestrictTo.Scope.LIBRARY)
+ internal class EmptyFragmentActivity : FragmentActivity() {
+ @SuppressLint("RestrictedApi")
+ override fun onCreate(savedInstanceState: Bundle?) {
+ setTheme(
+ intent.getIntExtra(
+ THEME_EXTRAS_BUNDLE_KEY,
+ R.style.FragmentScenarioEmptyFragmentActivityTheme
+ )
+ )
+
+ // Checks if we have a custom FragmentFactory and set it.
+ val factory = FragmentFactoryHolderViewModel.getInstance(this).fragmentFactory
+ if (factory != null) {
+ supportFragmentManager.fragmentFactory = factory
+ }
+
+ // FragmentFactory needs to be set before calling the super.onCreate, otherwise the
+ // Activity crashes when it is recreating and there is a fragment which has no
+ // default constructor.
+ super.onCreate(savedInstanceState)
+ }
+
+ companion object {
+ const val THEME_EXTRAS_BUNDLE_KEY = "androidx.fragment.app.testing.FragmentScenario" +
+ ".EmptyFragmentActivity.THEME_EXTRAS_BUNDLE_KEY"
+ }
+ }
+
+ /**
+ * A view-model to hold a fragment factory.
+ *
+ * @hide
+ */
+ @RestrictTo(RestrictTo.Scope.LIBRARY)
+ internal class FragmentFactoryHolderViewModel : ViewModel() {
+ var fragmentFactory: FragmentFactory? = null
+
+ override fun onCleared() {
+ super.onCleared()
+ fragmentFactory = null
+ }
+
+ companion object {
+ @Suppress("MemberVisibilityCanBePrivate")
+ internal val FACTORY: ViewModelProvider.Factory =
+ object : ViewModelProvider.Factory {
+ @Suppress("UNCHECKED_CAST")
+ override fun <T : ViewModel?> create(modelClass: Class<T>): T {
+ val viewModel =
+ FragmentFactoryHolderViewModel()
+ return viewModel as T
+ }
+ }
+
+ fun getInstance(activity: FragmentActivity): FragmentFactoryHolderViewModel {
+ val viewModel: FragmentFactoryHolderViewModel by activity.viewModels { FACTORY }
+ return viewModel
+ }
+ }
+ }
+
+ /**
+ * Moves Fragment state to a new state.
+ *
+ * If a new state and current state are the same, this method does nothing. It accepts
+ * [CREATED][Lifecycle.State.CREATED], [STARTED][Lifecycle.State.STARTED],
+ * [RESUMED][Lifecycle.State.RESUMED], and [DESTROYED][Lifecycle.State.DESTROYED].
+ * [DESTROYED][Lifecycle.State.DESTROYED] is a terminal state.
+ * You cannot move to any other state after the Fragment reaches that state.
+ *
+ * This method cannot be called from the main thread.
+ */
+ public fun moveToState(newState: Lifecycle.State): FragmentScenario<F> {
+ if (newState == Lifecycle.State.DESTROYED) {
+ activityScenario.onActivity { activity ->
+ val fragment = activity.supportFragmentManager
+ .findFragmentByTag(FRAGMENT_TAG)
+ // Null means the fragment has been destroyed already.
+ if (fragment != null) {
+ activity.supportFragmentManager.commitNow {
+ remove(fragment)
+ }
+ }
+ }
+ } else {
+ activityScenario.onActivity { activity ->
+ val fragment = requireNotNull(
+ activity.supportFragmentManager.findFragmentByTag(FRAGMENT_TAG)
+ ) {
+ "The fragment has been removed from the FragmentManager already."
+ }
+ activity.supportFragmentManager.commitNow {
+ setMaxLifecycle(fragment, newState)
+ }
+ }
+ }
+ return this
+ }
+
+ /**
+ * Recreates the host Activity.
+ *
+ * After this method call, it is ensured that the Fragment state goes back to the same state
+ * as its previous state.
+ *
+ * This method cannot be called from the main thread.
+ */
+ public fun recreate(): FragmentScenario<F> {
+ activityScenario.recreate()
+ return this
+ }
+
+ /**
+ * FragmentAction interface should be implemented by any class whose instances are intended to
+ * be executed by the main thread. A Fragment that is instrumented by the FragmentScenario is
+ * passed to [FragmentAction.perform] method.
+ *
+ * You should never keep the Fragment reference as it will lead to unpredictable behaviour.
+ * It should only be accessed in [FragmentAction.perform] scope.
+ */
+ public fun interface FragmentAction<F : Fragment> {
+ /**
+ * This method is invoked on the main thread with the reference to the Fragment.
+ *
+ * @param fragment a Fragment instrumented by the FragmentScenario.
+ */
+ public fun perform(fragment: F)
+ }
+
+ /**
+ * Runs a given [action] on the current Activity's main thread.
+ *
+ * Note that you should never keep Fragment reference passed into your [action]
+ * because it can be recreated at anytime during state transitions.
+ *
+ * Throwing an exception from [action] makes the host Activity crash. You can
+ * inspect the exception in logcat outputs.
+ *
+ * This method cannot be called from the main thread.
+ */
+ public fun onFragment(action: FragmentAction<F>): FragmentScenario<F> {
+ activityScenario.onActivity { activity ->
+ val fragment = requireNotNull(
+ activity.supportFragmentManager.findFragmentByTag(FRAGMENT_TAG)
+ ) {
+ "The fragment has been removed from the FragmentManager already."
+ }
+ check(fragmentClass.isInstance(fragment))
+ action.perform(requireNotNull(fragmentClass.cast(fragment)))
+ }
+ return this
+ }
+
+ public companion object {
+ private const val FRAGMENT_TAG = "FragmentScenario_Fragment_Tag"
+
+ /**
+ * Launches a Fragment with given arguments hosted by an empty [FragmentActivity] using
+ * the given [FragmentFactory] and waits for it to reach the resumed state.
+ *
+ *
+ * This method cannot be called from the main thread.
+ *
+ * @param fragmentClass a fragment class to instantiate
+ * @param fragmentArgs a bundle to passed into fragment
+ * @param factory a fragment factory to use or null to use default factory
+ */
+ @JvmStatic
+ public fun <F : Fragment> launch(
+ fragmentClass: Class<F>,
+ fragmentArgs: Bundle?,
+ factory: FragmentFactory?
+ ): FragmentScenario<F> = launch(
+ fragmentClass,
+ fragmentArgs,
+ R.style.FragmentScenarioEmptyFragmentActivityTheme,
+ Lifecycle.State.RESUMED,
+ factory
+ )
+
+ /**
+ * Launches a Fragment with given arguments hosted by an empty [FragmentActivity] themed
+ * by [themeResId], using the given [FragmentFactory] and waits for it to reach the
+ * resumed state.
+ *
+ * This method cannot be called from the main thread.
+ *
+ * @param fragmentClass a fragment class to instantiate
+ * @param fragmentArgs a bundle to passed into fragment
+ * @param themeResId a style resource id to be set to the host activity's theme
+ * @param factory a fragment factory to use or null to use default factory
+ */
+ @JvmStatic
+ public fun <F : Fragment> launch(
+ fragmentClass: Class<F>,
+ fragmentArgs: Bundle?,
+ @StyleRes themeResId: Int,
+ factory: FragmentFactory?
+ ): FragmentScenario<F> = launch(
+ fragmentClass,
+ fragmentArgs,
+ themeResId,
+ Lifecycle.State.RESUMED,
+ factory
+ )
+
+ /**
+ * Launches a Fragment with given arguments hosted by an empty [FragmentActivity] themed
+ * by [themeResId], using the given [FragmentFactory] and waits for it to reach
+ * [initialState].
+ *
+ * This method cannot be called from the main thread.
+ *
+ * @param fragmentClass a fragment class to instantiate
+ * @param fragmentArgs a bundle to passed into fragment
+ * @param themeResId a style resource id to be set to the host activity's theme
+ * @param initialState The initial [Lifecycle.State]. This must be one of
+ * [CREATED][Lifecycle.State.CREATED], [STARTED][Lifecycle.State.STARTED], and
+ * [RESUMED][Lifecycle.State.RESUMED].
+ * @param factory a fragment factory to use or null to use default factory
+ */
+ @JvmOverloads
+ @JvmStatic
+ public fun <F : Fragment> launch(
+ fragmentClass: Class<F>,
+ fragmentArgs: Bundle? = null,
+ @StyleRes themeResId: Int = R.style.FragmentScenarioEmptyFragmentActivityTheme,
+ initialState: Lifecycle.State = Lifecycle.State.RESUMED,
+ factory: FragmentFactory? = null
+ ): FragmentScenario<F> = internalLaunch(
+ fragmentClass,
+ fragmentArgs,
+ themeResId,
+ initialState,
+ factory,
+ 0 /*containerViewId=*/
+ )
+
+ /**
+ * Launches a Fragment in the Activity's root view container `android.R.id.content`, with
+ * given arguments hosted by an empty [FragmentActivity] using the given
+ * [FragmentFactory] and waits for it to reach the resumed state.
+ *
+ * This method cannot be called from the main thread.
+ *
+ * @param fragmentClass a fragment class to instantiate
+ * @param fragmentArgs a bundle to passed into fragment
+ * @param factory a fragment factory to use or null to use default factory
+ */
+ @JvmStatic
+ public fun <F : Fragment> launchInContainer(
+ fragmentClass: Class<F>,
+ fragmentArgs: Bundle?,
+ factory: FragmentFactory?
+ ): FragmentScenario<F> = launchInContainer(
+ fragmentClass,
+ fragmentArgs,
+ R.style.FragmentScenarioEmptyFragmentActivityTheme,
+ Lifecycle.State.RESUMED,
+ factory
+ )
+
+ /**
+ * Launches a Fragment in the Activity's root view container `android.R.id.content`, with
+ * given arguments hosted by an empty [FragmentActivity] themed by [themeResId],
+ * using the given [FragmentFactory] and waits for it to reach the resumed state.
+ *
+ * This method cannot be called from the main thread.
+ *
+ * @param fragmentClass a fragment class to instantiate
+ * @param fragmentArgs a bundle to passed into fragment
+ * @param themeResId a style resource id to be set to the host activity's theme
+ * @param factory a fragment factory to use or null to use default factory
+ */
+ @JvmStatic
+ public fun <F : Fragment> launchInContainer(
+ fragmentClass: Class<F>,
+ fragmentArgs: Bundle?,
+ @StyleRes themeResId: Int,
+ factory: FragmentFactory?
+ ): FragmentScenario<F> = launchInContainer(
+ fragmentClass,
+ fragmentArgs,
+ themeResId,
+ Lifecycle.State.RESUMED,
+ factory
+ )
+
+ /**
+ * Launches a Fragment in the Activity's root view container `android.R.id.content`, with
+ * given arguments hosted by an empty [FragmentActivity] themed by [themeResId],
+ * using the given [FragmentFactory] and waits for it to reach [initialState].
+ *
+ * This method cannot be called from the main thread.
+ *
+ * @param fragmentClass a fragment class to instantiate
+ * @param fragmentArgs a bundle to passed into fragment
+ * @param themeResId a style resource id to be set to the host activity's theme
+ * @param initialState The initial [Lifecycle.State]. This must be one of
+ * [CREATED][Lifecycle.State.CREATED], [STARTED][Lifecycle.State.STARTED], and
+ * [RESUMED][Lifecycle.State.RESUMED].
+ * @param factory a fragment factory to use or null to use default factory
+ */
+ @JvmOverloads
+ @JvmStatic
+ public fun <F : Fragment> launchInContainer(
+ fragmentClass: Class<F>,
+ fragmentArgs: Bundle? = null,
+ @StyleRes themeResId: Int = R.style.FragmentScenarioEmptyFragmentActivityTheme,
+ initialState: Lifecycle.State = Lifecycle.State.RESUMED,
+ factory: FragmentFactory? = null
+ ): FragmentScenario<F> = internalLaunch(
+ fragmentClass,
+ fragmentArgs,
+ themeResId,
+ initialState,
+ factory,
+ android.R.id.content
+ )
+
+ @SuppressLint("RestrictedApi")
+ internal fun <F : Fragment> internalLaunch(
+ fragmentClass: Class<F>,
+ fragmentArgs: Bundle?,
+ @StyleRes themeResId: Int,
+ initialState: Lifecycle.State,
+ factory: FragmentFactory?,
+ @IdRes containerViewId: Int
+ ): FragmentScenario<F> {
+ val componentName = ComponentName(
+ ApplicationProvider.getApplicationContext(),
+ EmptyFragmentActivity::class.java
+ )
+ val startActivityIntent = Intent.makeMainActivity(componentName)
+ .putExtra(EmptyFragmentActivity.THEME_EXTRAS_BUNDLE_KEY, themeResId)
+ val scenario = FragmentScenario(
+ fragmentClass,
+ ActivityScenario.launch(
+ startActivityIntent
+ )
+ )
+ scenario.activityScenario.onActivity { activity ->
+ if (factory != null) {
+ FragmentFactoryHolderViewModel.getInstance(activity).fragmentFactory = factory
+ activity.supportFragmentManager.fragmentFactory = factory
+ }
+ val fragment = activity.supportFragmentManager.fragmentFactory
+ .instantiate(requireNotNull(fragmentClass.classLoader), fragmentClass.name)
+ fragment.arguments = fragmentArgs
+ activity.supportFragmentManager.commitNow {
+ add(containerViewId, fragment, FRAGMENT_TAG)
+ setMaxLifecycle(fragment, initialState)
+ }
+ }
+ return scenario
+ }
+ }
+}
diff --git a/fragment/fragment/api/1.3.0-beta02.txt b/fragment/fragment/api/1.3.0-beta02.txt
new file mode 100644
index 0000000..83e3c66
--- /dev/null
+++ b/fragment/fragment/api/1.3.0-beta02.txt
@@ -0,0 +1,450 @@
+// Signature format: 4.0
+package androidx.fragment.app {
+
+ public class DialogFragment extends androidx.fragment.app.Fragment implements android.content.DialogInterface.OnCancelListener android.content.DialogInterface.OnDismissListener {
+ ctor public DialogFragment();
+ ctor public DialogFragment(@LayoutRes int);
+ method public void dismiss();
+ method public void dismissAllowingStateLoss();
+ method public android.app.Dialog? getDialog();
+ method public boolean getShowsDialog();
+ method @StyleRes public int getTheme();
+ method public boolean isCancelable();
+ method public void onCancel(android.content.DialogInterface);
+ method @MainThread public android.app.Dialog onCreateDialog(android.os.Bundle?);
+ method public void onDismiss(android.content.DialogInterface);
+ method public final android.app.Dialog requireDialog();
+ method public void setCancelable(boolean);
+ method public void setShowsDialog(boolean);
+ method public void setStyle(int, @StyleRes int);
+ method public void show(androidx.fragment.app.FragmentManager, String?);
+ method public int show(androidx.fragment.app.FragmentTransaction, String?);
+ method public void showNow(androidx.fragment.app.FragmentManager, String?);
+ field public static final int STYLE_NORMAL = 0; // 0x0
+ field public static final int STYLE_NO_FRAME = 2; // 0x2
+ field public static final int STYLE_NO_INPUT = 3; // 0x3
+ field public static final int STYLE_NO_TITLE = 1; // 0x1
+ }
+
+ public class Fragment implements androidx.activity.result.ActivityResultCaller android.content.ComponentCallbacks androidx.lifecycle.HasDefaultViewModelProviderFactory androidx.lifecycle.LifecycleOwner androidx.savedstate.SavedStateRegistryOwner android.view.View.OnCreateContextMenuListener androidx.lifecycle.ViewModelStoreOwner {
+ ctor public Fragment();
+ ctor @ContentView public Fragment(@LayoutRes int);
+ method public void dump(String, java.io.FileDescriptor?, java.io.PrintWriter, String![]?);
+ method public final boolean equals(Object?);
+ method public final androidx.fragment.app.FragmentActivity? getActivity();
+ method public boolean getAllowEnterTransitionOverlap();
+ method public boolean getAllowReturnTransitionOverlap();
+ method public final android.os.Bundle? getArguments();
+ method public final androidx.fragment.app.FragmentManager getChildFragmentManager();
+ method public android.content.Context? getContext();
+ method public androidx.lifecycle.ViewModelProvider.Factory getDefaultViewModelProviderFactory();
+ method public Object? getEnterTransition();
+ method public Object? getExitTransition();
+ method @Deprecated public final androidx.fragment.app.FragmentManager? getFragmentManager();
+ method public final Object? getHost();
+ method public final int getId();
+ method public final android.view.LayoutInflater getLayoutInflater();
+ method public androidx.lifecycle.Lifecycle getLifecycle();
+ method @Deprecated public androidx.loader.app.LoaderManager getLoaderManager();
+ method public final androidx.fragment.app.Fragment? getParentFragment();
+ method public final androidx.fragment.app.FragmentManager getParentFragmentManager();
+ method public Object? getReenterTransition();
+ method public final android.content.res.Resources getResources();
+ method @Deprecated public final boolean getRetainInstance();
+ method public Object? getReturnTransition();
+ method public final androidx.savedstate.SavedStateRegistry getSavedStateRegistry();
+ method public Object? getSharedElementEnterTransition();
+ method public Object? getSharedElementReturnTransition();
+ method public final String getString(@StringRes int);
+ method public final String getString(@StringRes int, java.lang.Object!...);
+ method public final String? getTag();
+ method @Deprecated public final androidx.fragment.app.Fragment? getTargetFragment();
+ method @Deprecated public final int getTargetRequestCode();
+ method public final CharSequence getText(@StringRes int);
+ method @Deprecated public boolean getUserVisibleHint();
+ method public android.view.View? getView();
+ method @MainThread public androidx.lifecycle.LifecycleOwner getViewLifecycleOwner();
+ method public androidx.lifecycle.LiveData<androidx.lifecycle.LifecycleOwner!> getViewLifecycleOwnerLiveData();
+ method public androidx.lifecycle.ViewModelStore getViewModelStore();
+ method public final int hashCode();
+ method @Deprecated public static androidx.fragment.app.Fragment instantiate(android.content.Context, String);
+ method @Deprecated public static androidx.fragment.app.Fragment instantiate(android.content.Context, String, android.os.Bundle?);
+ method public final boolean isAdded();
+ method public final boolean isDetached();
+ method public final boolean isHidden();
+ method public final boolean isInLayout();
+ method public final boolean isRemoving();
+ method public final boolean isResumed();
+ method public final boolean isStateSaved();
+ method public final boolean isVisible();
+ method @Deprecated @CallSuper @MainThread public void onActivityCreated(android.os.Bundle?);
+ method @Deprecated public void onActivityResult(int, int, android.content.Intent?);
+ method @CallSuper @MainThread public void onAttach(android.content.Context);
+ method @Deprecated @CallSuper @MainThread public void onAttach(android.app.Activity);
+ method @Deprecated @MainThread public void onAttachFragment(androidx.fragment.app.Fragment);
+ method @CallSuper public void onConfigurationChanged(android.content.res.Configuration);
+ method @MainThread public boolean onContextItemSelected(android.view.MenuItem);
+ method @CallSuper @MainThread public void onCreate(android.os.Bundle?);
+ method @MainThread public android.view.animation.Animation? onCreateAnimation(int, boolean, int);
+ method @MainThread public android.animation.Animator? onCreateAnimator(int, boolean, int);
+ method @MainThread public void onCreateContextMenu(android.view.ContextMenu, android.view.View, android.view.ContextMenu.ContextMenuInfo?);
+ method @MainThread public void onCreateOptionsMenu(android.view.Menu, android.view.MenuInflater);
+ method @MainThread public android.view.View? onCreateView(android.view.LayoutInflater, android.view.ViewGroup?, android.os.Bundle?);
+ method @CallSuper @MainThread public void onDestroy();
+ method @MainThread public void onDestroyOptionsMenu();
+ method @CallSuper @MainThread public void onDestroyView();
+ method @CallSuper @MainThread public void onDetach();
+ method public android.view.LayoutInflater onGetLayoutInflater(android.os.Bundle?);
+ method @MainThread public void onHiddenChanged(boolean);
+ method @CallSuper @UiThread public void onInflate(android.content.Context, android.util.AttributeSet, android.os.Bundle?);
+ method @Deprecated @CallSuper @UiThread public void onInflate(android.app.Activity, android.util.AttributeSet, android.os.Bundle?);
+ method @CallSuper @MainThread public void onLowMemory();
+ method public void onMultiWindowModeChanged(boolean);
+ method @MainThread public boolean onOptionsItemSelected(android.view.MenuItem);
+ method @MainThread public void onOptionsMenuClosed(android.view.Menu);
+ method @CallSuper @MainThread public void onPause();
+ method public void onPictureInPictureModeChanged(boolean);
+ method @MainThread public void onPrepareOptionsMenu(android.view.Menu);
+ method @MainThread public void onPrimaryNavigationFragmentChanged(boolean);
+ method @Deprecated public void onRequestPermissionsResult(int, String![], int[]);
+ method @CallSuper @MainThread public void onResume();
+ method @MainThread public void onSaveInstanceState(android.os.Bundle);
+ method @CallSuper @MainThread public void onStart();
+ method @CallSuper @MainThread public void onStop();
+ method @MainThread public void onViewCreated(android.view.View, android.os.Bundle?);
+ method @CallSuper @MainThread public void onViewStateRestored(android.os.Bundle?);
+ method public void postponeEnterTransition();
+ method public final void postponeEnterTransition(long, java.util.concurrent.TimeUnit);
+ method @MainThread public final <I, O> androidx.activity.result.ActivityResultLauncher<I!> registerForActivityResult(androidx.activity.result.contract.ActivityResultContract<I!,O!>, androidx.activity.result.ActivityResultCallback<O!>);
+ method @MainThread public final <I, O> androidx.activity.result.ActivityResultLauncher<I!> registerForActivityResult(androidx.activity.result.contract.ActivityResultContract<I!,O!>, androidx.activity.result.ActivityResultRegistry, androidx.activity.result.ActivityResultCallback<O!>);
+ method public void registerForContextMenu(android.view.View);
+ method @Deprecated public final void requestPermissions(String![], int);
+ method public final androidx.fragment.app.FragmentActivity requireActivity();
+ method public final android.os.Bundle requireArguments();
+ method public final android.content.Context requireContext();
+ method @Deprecated public final androidx.fragment.app.FragmentManager requireFragmentManager();
+ method public final Object requireHost();
+ method public final androidx.fragment.app.Fragment requireParentFragment();
+ method public final android.view.View requireView();
+ method public void setAllowEnterTransitionOverlap(boolean);
+ method public void setAllowReturnTransitionOverlap(boolean);
+ method public void setArguments(android.os.Bundle?);
+ method public void setEnterSharedElementCallback(androidx.core.app.SharedElementCallback?);
+ method public void setEnterTransition(Object?);
+ method public void setExitSharedElementCallback(androidx.core.app.SharedElementCallback?);
+ method public void setExitTransition(Object?);
+ method public void setHasOptionsMenu(boolean);
+ method public void setInitialSavedState(androidx.fragment.app.Fragment.SavedState?);
+ method public void setMenuVisibility(boolean);
+ method public void setReenterTransition(Object?);
+ method @Deprecated public void setRetainInstance(boolean);
+ method public void setReturnTransition(Object?);
+ method public void setSharedElementEnterTransition(Object?);
+ method public void setSharedElementReturnTransition(Object?);
+ method @Deprecated public void setTargetFragment(androidx.fragment.app.Fragment?, int);
+ method @Deprecated public void setUserVisibleHint(boolean);
+ method public boolean shouldShowRequestPermissionRationale(String);
+ method public void startActivity(android.content.Intent!);
+ method public void startActivity(android.content.Intent!, android.os.Bundle?);
+ method @Deprecated public void startActivityForResult(android.content.Intent!, int);
+ method @Deprecated public void startActivityForResult(android.content.Intent!, int, android.os.Bundle?);
+ method @Deprecated public void startIntentSenderForResult(android.content.IntentSender!, int, android.content.Intent?, int, int, int, android.os.Bundle?) throws android.content.IntentSender.SendIntentException;
+ method public void startPostponedEnterTransition();
+ method public void unregisterForContextMenu(android.view.View);
+ }
+
+ public static class Fragment.InstantiationException extends java.lang.RuntimeException {
+ ctor public Fragment.InstantiationException(String, Exception?);
+ }
+
+ public static class Fragment.SavedState implements android.os.Parcelable {
+ method public int describeContents();
+ method public void writeToParcel(android.os.Parcel, int);
+ field public static final android.os.Parcelable.Creator<androidx.fragment.app.Fragment.SavedState!> CREATOR;
+ }
+
+ public class FragmentActivity extends androidx.activity.ComponentActivity implements androidx.core.app.ActivityCompat.OnRequestPermissionsResultCallback androidx.lifecycle.LifecycleOwner {
+ ctor public FragmentActivity();
+ ctor @ContentView public FragmentActivity(@LayoutRes int);
+ method public androidx.fragment.app.FragmentManager getSupportFragmentManager();
+ method @Deprecated public androidx.loader.app.LoaderManager getSupportLoaderManager();
+ method @Deprecated @MainThread public void onAttachFragment(androidx.fragment.app.Fragment);
+ method @CallSuper public void onMultiWindowModeChanged(boolean);
+ method @CallSuper public void onPictureInPictureModeChanged(boolean);
+ method protected void onResumeFragments();
+ method public void onStateNotSaved();
+ method public void setEnterSharedElementCallback(androidx.core.app.SharedElementCallback?);
+ method public void setExitSharedElementCallback(androidx.core.app.SharedElementCallback?);
+ method public void startActivityFromFragment(androidx.fragment.app.Fragment, android.content.Intent!, int);
+ method public void startActivityFromFragment(androidx.fragment.app.Fragment, android.content.Intent!, int, android.os.Bundle?);
+ method @Deprecated public void startIntentSenderFromFragment(androidx.fragment.app.Fragment, android.content.IntentSender!, int, android.content.Intent?, int, int, int, android.os.Bundle?) throws android.content.IntentSender.SendIntentException;
+ method public void supportFinishAfterTransition();
+ method @Deprecated public void supportInvalidateOptionsMenu();
+ method public void supportPostponeEnterTransition();
+ method public void supportStartPostponedEnterTransition();
+ method @Deprecated public final void validateRequestPermissionsRequestCode(int);
+ }
+
+ public abstract class FragmentContainer {
+ ctor public FragmentContainer();
+ method @Deprecated public androidx.fragment.app.Fragment instantiate(android.content.Context, String, android.os.Bundle?);
+ method public abstract android.view.View? onFindViewById(@IdRes int);
+ method public abstract boolean onHasView();
+ }
+
+ public final class FragmentContainerView extends android.widget.FrameLayout {
+ ctor public FragmentContainerView(android.content.Context);
+ ctor public FragmentContainerView(android.content.Context, android.util.AttributeSet?);
+ ctor public FragmentContainerView(android.content.Context, android.util.AttributeSet?, int);
+ }
+
+ public class FragmentController {
+ method public void attachHost(androidx.fragment.app.Fragment?);
+ method public static androidx.fragment.app.FragmentController createController(androidx.fragment.app.FragmentHostCallback<?>);
+ method public void dispatchActivityCreated();
+ method public void dispatchConfigurationChanged(android.content.res.Configuration);
+ method public boolean dispatchContextItemSelected(android.view.MenuItem);
+ method public void dispatchCreate();
+ method public boolean dispatchCreateOptionsMenu(android.view.Menu, android.view.MenuInflater);
+ method public void dispatchDestroy();
+ method public void dispatchDestroyView();
+ method public void dispatchLowMemory();
+ method public void dispatchMultiWindowModeChanged(boolean);
+ method public boolean dispatchOptionsItemSelected(android.view.MenuItem);
+ method public void dispatchOptionsMenuClosed(android.view.Menu);
+ method public void dispatchPause();
+ method public void dispatchPictureInPictureModeChanged(boolean);
+ method public boolean dispatchPrepareOptionsMenu(android.view.Menu);
+ method @Deprecated public void dispatchReallyStop();
+ method public void dispatchResume();
+ method public void dispatchStart();
+ method public void dispatchStop();
+ method @Deprecated public void doLoaderDestroy();
+ method @Deprecated public void doLoaderRetain();
+ method @Deprecated public void doLoaderStart();
+ method @Deprecated public void doLoaderStop(boolean);
+ method @Deprecated public void dumpLoaders(String, java.io.FileDescriptor?, java.io.PrintWriter, String![]?);
+ method public boolean execPendingActions();
+ method public androidx.fragment.app.Fragment? findFragmentByWho(String);
+ method public java.util.List<androidx.fragment.app.Fragment!> getActiveFragments(java.util.List<androidx.fragment.app.Fragment!>!);
+ method public int getActiveFragmentsCount();
+ method public androidx.fragment.app.FragmentManager getSupportFragmentManager();
+ method @Deprecated public androidx.loader.app.LoaderManager! getSupportLoaderManager();
+ method public void noteStateNotSaved();
+ method public android.view.View? onCreateView(android.view.View?, String, android.content.Context, android.util.AttributeSet);
+ method @Deprecated public void reportLoaderStart();
+ method @Deprecated public void restoreAllState(android.os.Parcelable?, java.util.List<androidx.fragment.app.Fragment!>?);
+ method @Deprecated public void restoreAllState(android.os.Parcelable?, androidx.fragment.app.FragmentManagerNonConfig?);
+ method @Deprecated public void restoreLoaderNonConfig(androidx.collection.SimpleArrayMap<java.lang.String!,androidx.loader.app.LoaderManager!>!);
+ method public void restoreSaveState(android.os.Parcelable?);
+ method @Deprecated public androidx.collection.SimpleArrayMap<java.lang.String!,androidx.loader.app.LoaderManager!>? retainLoaderNonConfig();
+ method @Deprecated public androidx.fragment.app.FragmentManagerNonConfig? retainNestedNonConfig();
+ method @Deprecated public java.util.List<androidx.fragment.app.Fragment!>? retainNonConfig();
+ method public android.os.Parcelable? saveAllState();
+ }
+
+ public class FragmentFactory {
+ ctor public FragmentFactory();
+ method public androidx.fragment.app.Fragment instantiate(ClassLoader, String);
+ method public static Class<? extends androidx.fragment.app.Fragment> loadFragmentClass(ClassLoader, String);
+ }
+
+ public abstract class FragmentHostCallback<E> extends androidx.fragment.app.FragmentContainer {
+ ctor public FragmentHostCallback(android.content.Context, android.os.Handler, int);
+ method public void onDump(String, java.io.FileDescriptor?, java.io.PrintWriter, String![]?);
+ method public android.view.View? onFindViewById(int);
+ method public abstract E? onGetHost();
+ method public android.view.LayoutInflater onGetLayoutInflater();
+ method public int onGetWindowAnimations();
+ method public boolean onHasView();
+ method public boolean onHasWindowAnimations();
+ method @Deprecated public void onRequestPermissionsFromFragment(androidx.fragment.app.Fragment, String![], int);
+ method public boolean onShouldSaveFragmentState(androidx.fragment.app.Fragment);
+ method public boolean onShouldShowRequestPermissionRationale(String);
+ method public void onStartActivityFromFragment(androidx.fragment.app.Fragment, android.content.Intent!, int);
+ method public void onStartActivityFromFragment(androidx.fragment.app.Fragment, android.content.Intent!, int, android.os.Bundle?);
+ method @Deprecated public void onStartIntentSenderFromFragment(androidx.fragment.app.Fragment, android.content.IntentSender!, int, android.content.Intent?, int, int, int, android.os.Bundle?) throws android.content.IntentSender.SendIntentException;
+ method public void onSupportInvalidateOptionsMenu();
+ }
+
+ public abstract class FragmentManager implements androidx.fragment.app.FragmentResultOwner {
+ ctor public FragmentManager();
+ method public void addFragmentOnAttachListener(androidx.fragment.app.FragmentOnAttachListener);
+ method public void addOnBackStackChangedListener(androidx.fragment.app.FragmentManager.OnBackStackChangedListener);
+ method public androidx.fragment.app.FragmentTransaction beginTransaction();
+ method public final void clearFragmentResult(String);
+ method public final void clearFragmentResultListener(String);
+ method public void dump(String, java.io.FileDescriptor?, java.io.PrintWriter, String![]?);
+ method @Deprecated public static void enableDebugLogging(boolean);
+ method public boolean executePendingTransactions();
+ method public static <F extends androidx.fragment.app.Fragment> F findFragment(android.view.View);
+ method public androidx.fragment.app.Fragment? findFragmentById(@IdRes int);
+ method public androidx.fragment.app.Fragment? findFragmentByTag(String?);
+ method public androidx.fragment.app.FragmentManager.BackStackEntry getBackStackEntryAt(int);
+ method public int getBackStackEntryCount();
+ method public androidx.fragment.app.Fragment? getFragment(android.os.Bundle, String);
+ method public androidx.fragment.app.FragmentFactory getFragmentFactory();
+ method public java.util.List<androidx.fragment.app.Fragment!> getFragments();
+ method public androidx.fragment.app.Fragment? getPrimaryNavigationFragment();
+ method public boolean isDestroyed();
+ method public boolean isStateSaved();
+ method public void popBackStack();
+ method public void popBackStack(String?, int);
+ method public void popBackStack(int, int);
+ method public boolean popBackStackImmediate();
+ method public boolean popBackStackImmediate(String?, int);
+ method public boolean popBackStackImmediate(int, int);
+ method public void putFragment(android.os.Bundle, String, androidx.fragment.app.Fragment);
+ method public void registerFragmentLifecycleCallbacks(androidx.fragment.app.FragmentManager.FragmentLifecycleCallbacks, boolean);
+ method public void removeFragmentOnAttachListener(androidx.fragment.app.FragmentOnAttachListener);
+ method public void removeOnBackStackChangedListener(androidx.fragment.app.FragmentManager.OnBackStackChangedListener);
+ method public androidx.fragment.app.Fragment.SavedState? saveFragmentInstanceState(androidx.fragment.app.Fragment);
+ method public void setFragmentFactory(androidx.fragment.app.FragmentFactory);
+ method public final void setFragmentResult(String, android.os.Bundle);
+ method public final void setFragmentResultListener(String, androidx.lifecycle.LifecycleOwner, androidx.fragment.app.FragmentResultListener);
+ method public void unregisterFragmentLifecycleCallbacks(androidx.fragment.app.FragmentManager.FragmentLifecycleCallbacks);
+ field public static final int POP_BACK_STACK_INCLUSIVE = 1; // 0x1
+ }
+
+ public static interface FragmentManager.BackStackEntry {
+ method @Deprecated public CharSequence? getBreadCrumbShortTitle();
+ method @Deprecated @StringRes public int getBreadCrumbShortTitleRes();
+ method @Deprecated public CharSequence? getBreadCrumbTitle();
+ method @Deprecated @StringRes public int getBreadCrumbTitleRes();
+ method public int getId();
+ method public String? getName();
+ }
+
+ public abstract static class FragmentManager.FragmentLifecycleCallbacks {
+ ctor public FragmentManager.FragmentLifecycleCallbacks();
+ method @Deprecated public void onFragmentActivityCreated(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment, android.os.Bundle?);
+ method public void onFragmentAttached(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment, android.content.Context);
+ method public void onFragmentCreated(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment, android.os.Bundle?);
+ method public void onFragmentDestroyed(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment);
+ method public void onFragmentDetached(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment);
+ method public void onFragmentPaused(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment);
+ method public void onFragmentPreAttached(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment, android.content.Context);
+ method public void onFragmentPreCreated(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment, android.os.Bundle?);
+ method public void onFragmentResumed(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment);
+ method public void onFragmentSaveInstanceState(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment, android.os.Bundle);
+ method public void onFragmentStarted(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment);
+ method public void onFragmentStopped(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment);
+ method public void onFragmentViewCreated(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment, android.view.View, android.os.Bundle?);
+ method public void onFragmentViewDestroyed(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment);
+ }
+
+ public static interface FragmentManager.OnBackStackChangedListener {
+ method @MainThread public void onBackStackChanged();
+ }
+
+ @Deprecated public class FragmentManagerNonConfig {
+ }
+
+ public interface FragmentOnAttachListener {
+ method @MainThread public void onAttachFragment(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment);
+ }
+
+ @Deprecated public abstract class FragmentPagerAdapter extends androidx.viewpager.widget.PagerAdapter {
+ ctor @Deprecated public FragmentPagerAdapter(androidx.fragment.app.FragmentManager);
+ ctor @Deprecated public FragmentPagerAdapter(androidx.fragment.app.FragmentManager, int);
+ method @Deprecated public abstract androidx.fragment.app.Fragment getItem(int);
+ method @Deprecated public long getItemId(int);
+ method @Deprecated public boolean isViewFromObject(android.view.View, Object);
+ field @Deprecated public static final int BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT = 1; // 0x1
+ field @Deprecated public static final int BEHAVIOR_SET_USER_VISIBLE_HINT = 0; // 0x0
+ }
+
+ public interface FragmentResultListener {
+ method public void onFragmentResult(String, android.os.Bundle);
+ }
+
+ public interface FragmentResultOwner {
+ method public void clearFragmentResult(String);
+ method public void clearFragmentResultListener(String);
+ method public void setFragmentResult(String, android.os.Bundle);
+ method public void setFragmentResultListener(String, androidx.lifecycle.LifecycleOwner, androidx.fragment.app.FragmentResultListener);
+ }
+
+ @Deprecated public abstract class FragmentStatePagerAdapter extends androidx.viewpager.widget.PagerAdapter {
+ ctor @Deprecated public FragmentStatePagerAdapter(androidx.fragment.app.FragmentManager);
+ ctor @Deprecated public FragmentStatePagerAdapter(androidx.fragment.app.FragmentManager, int);
+ method @Deprecated public abstract androidx.fragment.app.Fragment getItem(int);
+ method @Deprecated public boolean isViewFromObject(android.view.View, Object);
+ field @Deprecated public static final int BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT = 1; // 0x1
+ field @Deprecated public static final int BEHAVIOR_SET_USER_VISIBLE_HINT = 0; // 0x0
+ }
+
+ @Deprecated public class FragmentTabHost extends android.widget.TabHost implements android.widget.TabHost.OnTabChangeListener {
+ ctor @Deprecated public FragmentTabHost(android.content.Context);
+ ctor @Deprecated public FragmentTabHost(android.content.Context, android.util.AttributeSet?);
+ method @Deprecated public void addTab(android.widget.TabHost.TabSpec, Class<?>, android.os.Bundle?);
+ method @Deprecated public void onTabChanged(String?);
+ method @Deprecated public void setup(android.content.Context, androidx.fragment.app.FragmentManager);
+ method @Deprecated public void setup(android.content.Context, androidx.fragment.app.FragmentManager, int);
+ }
+
+ public abstract class FragmentTransaction {
+ ctor @Deprecated public FragmentTransaction();
+ method public final androidx.fragment.app.FragmentTransaction add(Class<? extends androidx.fragment.app.Fragment>, android.os.Bundle?, String?);
+ method public androidx.fragment.app.FragmentTransaction add(androidx.fragment.app.Fragment, String?);
+ method public final androidx.fragment.app.FragmentTransaction add(@IdRes int, Class<? extends androidx.fragment.app.Fragment>, android.os.Bundle?);
+ method public androidx.fragment.app.FragmentTransaction add(@IdRes int, androidx.fragment.app.Fragment);
+ method public final androidx.fragment.app.FragmentTransaction add(@IdRes int, Class<? extends androidx.fragment.app.Fragment>, android.os.Bundle?, String?);
+ method public androidx.fragment.app.FragmentTransaction add(@IdRes int, androidx.fragment.app.Fragment, String?);
+ method public androidx.fragment.app.FragmentTransaction addSharedElement(android.view.View, String);
+ method public androidx.fragment.app.FragmentTransaction addToBackStack(String?);
+ method public androidx.fragment.app.FragmentTransaction attach(androidx.fragment.app.Fragment);
+ method public abstract int commit();
+ method public abstract int commitAllowingStateLoss();
+ method public abstract void commitNow();
+ method public abstract void commitNowAllowingStateLoss();
+ method public androidx.fragment.app.FragmentTransaction detach(androidx.fragment.app.Fragment);
+ method public androidx.fragment.app.FragmentTransaction disallowAddToBackStack();
+ method public androidx.fragment.app.FragmentTransaction hide(androidx.fragment.app.Fragment);
+ method public boolean isAddToBackStackAllowed();
+ method public boolean isEmpty();
+ method public androidx.fragment.app.FragmentTransaction remove(androidx.fragment.app.Fragment);
+ method public final androidx.fragment.app.FragmentTransaction replace(@IdRes int, Class<? extends androidx.fragment.app.Fragment>, android.os.Bundle?);
+ method public androidx.fragment.app.FragmentTransaction replace(@IdRes int, androidx.fragment.app.Fragment);
+ method public final androidx.fragment.app.FragmentTransaction replace(@IdRes int, Class<? extends androidx.fragment.app.Fragment>, android.os.Bundle?, String?);
+ method public androidx.fragment.app.FragmentTransaction replace(@IdRes int, androidx.fragment.app.Fragment, String?);
+ method public androidx.fragment.app.FragmentTransaction runOnCommit(Runnable);
+ method @Deprecated public androidx.fragment.app.FragmentTransaction setAllowOptimization(boolean);
+ method @Deprecated public androidx.fragment.app.FragmentTransaction setBreadCrumbShortTitle(@StringRes int);
+ method @Deprecated public androidx.fragment.app.FragmentTransaction setBreadCrumbShortTitle(CharSequence?);
+ method @Deprecated public androidx.fragment.app.FragmentTransaction setBreadCrumbTitle(@StringRes int);
+ method @Deprecated public androidx.fragment.app.FragmentTransaction setBreadCrumbTitle(CharSequence?);
+ method public androidx.fragment.app.FragmentTransaction setCustomAnimations(@AnimRes @AnimatorRes int, @AnimRes @AnimatorRes int);
+ method public androidx.fragment.app.FragmentTransaction setCustomAnimations(@AnimRes @AnimatorRes int, @AnimRes @AnimatorRes int, @AnimRes @AnimatorRes int, @AnimRes @AnimatorRes int);
+ method public androidx.fragment.app.FragmentTransaction setMaxLifecycle(androidx.fragment.app.Fragment, androidx.lifecycle.Lifecycle.State);
+ method public androidx.fragment.app.FragmentTransaction setPrimaryNavigationFragment(androidx.fragment.app.Fragment?);
+ method public androidx.fragment.app.FragmentTransaction setReorderingAllowed(boolean);
+ method public androidx.fragment.app.FragmentTransaction setTransition(int);
+ method @Deprecated public androidx.fragment.app.FragmentTransaction setTransitionStyle(@StyleRes int);
+ method public androidx.fragment.app.FragmentTransaction show(androidx.fragment.app.Fragment);
+ field public static final int TRANSIT_ENTER_MASK = 4096; // 0x1000
+ field public static final int TRANSIT_EXIT_MASK = 8192; // 0x2000
+ field public static final int TRANSIT_FRAGMENT_CLOSE = 8194; // 0x2002
+ field public static final int TRANSIT_FRAGMENT_FADE = 4099; // 0x1003
+ field public static final int TRANSIT_FRAGMENT_OPEN = 4097; // 0x1001
+ field public static final int TRANSIT_NONE = 0; // 0x0
+ field public static final int TRANSIT_UNSET = -1; // 0xffffffff
+ }
+
+ public class ListFragment extends androidx.fragment.app.Fragment {
+ ctor public ListFragment();
+ method public android.widget.ListAdapter? getListAdapter();
+ method public android.widget.ListView getListView();
+ method public long getSelectedItemId();
+ method public int getSelectedItemPosition();
+ method public void onListItemClick(android.widget.ListView, android.view.View, int, long);
+ method public final android.widget.ListAdapter requireListAdapter();
+ method public void setEmptyText(CharSequence?);
+ method public void setListAdapter(android.widget.ListAdapter?);
+ method public void setListShown(boolean);
+ method public void setListShownNoAnimation(boolean);
+ method public void setSelection(int);
+ }
+
+}
+
diff --git a/fragment/fragment/api/public_plus_experimental_1.3.0-beta02.txt b/fragment/fragment/api/public_plus_experimental_1.3.0-beta02.txt
new file mode 100644
index 0000000..4644e32
--- /dev/null
+++ b/fragment/fragment/api/public_plus_experimental_1.3.0-beta02.txt
@@ -0,0 +1,454 @@
+// Signature format: 4.0
+package androidx.fragment.app {
+
+ public class DialogFragment extends androidx.fragment.app.Fragment implements android.content.DialogInterface.OnCancelListener android.content.DialogInterface.OnDismissListener {
+ ctor public DialogFragment();
+ ctor public DialogFragment(@LayoutRes int);
+ method public void dismiss();
+ method public void dismissAllowingStateLoss();
+ method public android.app.Dialog? getDialog();
+ method public boolean getShowsDialog();
+ method @StyleRes public int getTheme();
+ method public boolean isCancelable();
+ method public void onCancel(android.content.DialogInterface);
+ method @MainThread public android.app.Dialog onCreateDialog(android.os.Bundle?);
+ method public void onDismiss(android.content.DialogInterface);
+ method public final android.app.Dialog requireDialog();
+ method public void setCancelable(boolean);
+ method public void setShowsDialog(boolean);
+ method public void setStyle(int, @StyleRes int);
+ method public void show(androidx.fragment.app.FragmentManager, String?);
+ method public int show(androidx.fragment.app.FragmentTransaction, String?);
+ method public void showNow(androidx.fragment.app.FragmentManager, String?);
+ field public static final int STYLE_NORMAL = 0; // 0x0
+ field public static final int STYLE_NO_FRAME = 2; // 0x2
+ field public static final int STYLE_NO_INPUT = 3; // 0x3
+ field public static final int STYLE_NO_TITLE = 1; // 0x1
+ }
+
+ public class Fragment implements androidx.activity.result.ActivityResultCaller android.content.ComponentCallbacks androidx.lifecycle.HasDefaultViewModelProviderFactory androidx.lifecycle.LifecycleOwner androidx.savedstate.SavedStateRegistryOwner android.view.View.OnCreateContextMenuListener androidx.lifecycle.ViewModelStoreOwner {
+ ctor public Fragment();
+ ctor @ContentView public Fragment(@LayoutRes int);
+ method public void dump(String, java.io.FileDescriptor?, java.io.PrintWriter, String![]?);
+ method public final boolean equals(Object?);
+ method public final androidx.fragment.app.FragmentActivity? getActivity();
+ method public boolean getAllowEnterTransitionOverlap();
+ method public boolean getAllowReturnTransitionOverlap();
+ method public final android.os.Bundle? getArguments();
+ method public final androidx.fragment.app.FragmentManager getChildFragmentManager();
+ method public android.content.Context? getContext();
+ method public androidx.lifecycle.ViewModelProvider.Factory getDefaultViewModelProviderFactory();
+ method public Object? getEnterTransition();
+ method public Object? getExitTransition();
+ method @Deprecated public final androidx.fragment.app.FragmentManager? getFragmentManager();
+ method public final Object? getHost();
+ method public final int getId();
+ method public final android.view.LayoutInflater getLayoutInflater();
+ method public androidx.lifecycle.Lifecycle getLifecycle();
+ method @Deprecated public androidx.loader.app.LoaderManager getLoaderManager();
+ method public final androidx.fragment.app.Fragment? getParentFragment();
+ method public final androidx.fragment.app.FragmentManager getParentFragmentManager();
+ method public Object? getReenterTransition();
+ method public final android.content.res.Resources getResources();
+ method @Deprecated public final boolean getRetainInstance();
+ method public Object? getReturnTransition();
+ method public final androidx.savedstate.SavedStateRegistry getSavedStateRegistry();
+ method public Object? getSharedElementEnterTransition();
+ method public Object? getSharedElementReturnTransition();
+ method public final String getString(@StringRes int);
+ method public final String getString(@StringRes int, java.lang.Object!...);
+ method public final String? getTag();
+ method @Deprecated public final androidx.fragment.app.Fragment? getTargetFragment();
+ method @Deprecated public final int getTargetRequestCode();
+ method public final CharSequence getText(@StringRes int);
+ method @Deprecated public boolean getUserVisibleHint();
+ method public android.view.View? getView();
+ method @MainThread public androidx.lifecycle.LifecycleOwner getViewLifecycleOwner();
+ method public androidx.lifecycle.LiveData<androidx.lifecycle.LifecycleOwner!> getViewLifecycleOwnerLiveData();
+ method public androidx.lifecycle.ViewModelStore getViewModelStore();
+ method public final int hashCode();
+ method @Deprecated public static androidx.fragment.app.Fragment instantiate(android.content.Context, String);
+ method @Deprecated public static androidx.fragment.app.Fragment instantiate(android.content.Context, String, android.os.Bundle?);
+ method public final boolean isAdded();
+ method public final boolean isDetached();
+ method public final boolean isHidden();
+ method public final boolean isInLayout();
+ method public final boolean isRemoving();
+ method public final boolean isResumed();
+ method public final boolean isStateSaved();
+ method public final boolean isVisible();
+ method @Deprecated @CallSuper @MainThread public void onActivityCreated(android.os.Bundle?);
+ method @Deprecated public void onActivityResult(int, int, android.content.Intent?);
+ method @CallSuper @MainThread public void onAttach(android.content.Context);
+ method @Deprecated @CallSuper @MainThread public void onAttach(android.app.Activity);
+ method @Deprecated @MainThread public void onAttachFragment(androidx.fragment.app.Fragment);
+ method @CallSuper public void onConfigurationChanged(android.content.res.Configuration);
+ method @MainThread public boolean onContextItemSelected(android.view.MenuItem);
+ method @CallSuper @MainThread public void onCreate(android.os.Bundle?);
+ method @MainThread public android.view.animation.Animation? onCreateAnimation(int, boolean, int);
+ method @MainThread public android.animation.Animator? onCreateAnimator(int, boolean, int);
+ method @MainThread public void onCreateContextMenu(android.view.ContextMenu, android.view.View, android.view.ContextMenu.ContextMenuInfo?);
+ method @MainThread public void onCreateOptionsMenu(android.view.Menu, android.view.MenuInflater);
+ method @MainThread public android.view.View? onCreateView(android.view.LayoutInflater, android.view.ViewGroup?, android.os.Bundle?);
+ method @CallSuper @MainThread public void onDestroy();
+ method @MainThread public void onDestroyOptionsMenu();
+ method @CallSuper @MainThread public void onDestroyView();
+ method @CallSuper @MainThread public void onDetach();
+ method public android.view.LayoutInflater onGetLayoutInflater(android.os.Bundle?);
+ method @MainThread public void onHiddenChanged(boolean);
+ method @CallSuper @UiThread public void onInflate(android.content.Context, android.util.AttributeSet, android.os.Bundle?);
+ method @Deprecated @CallSuper @UiThread public void onInflate(android.app.Activity, android.util.AttributeSet, android.os.Bundle?);
+ method @CallSuper @MainThread public void onLowMemory();
+ method public void onMultiWindowModeChanged(boolean);
+ method @MainThread public boolean onOptionsItemSelected(android.view.MenuItem);
+ method @MainThread public void onOptionsMenuClosed(android.view.Menu);
+ method @CallSuper @MainThread public void onPause();
+ method public void onPictureInPictureModeChanged(boolean);
+ method @MainThread public void onPrepareOptionsMenu(android.view.Menu);
+ method @MainThread public void onPrimaryNavigationFragmentChanged(boolean);
+ method @Deprecated public void onRequestPermissionsResult(int, String![], int[]);
+ method @CallSuper @MainThread public void onResume();
+ method @MainThread public void onSaveInstanceState(android.os.Bundle);
+ method @CallSuper @MainThread public void onStart();
+ method @CallSuper @MainThread public void onStop();
+ method @MainThread public void onViewCreated(android.view.View, android.os.Bundle?);
+ method @CallSuper @MainThread public void onViewStateRestored(android.os.Bundle?);
+ method public void postponeEnterTransition();
+ method public final void postponeEnterTransition(long, java.util.concurrent.TimeUnit);
+ method @MainThread public final <I, O> androidx.activity.result.ActivityResultLauncher<I!> registerForActivityResult(androidx.activity.result.contract.ActivityResultContract<I!,O!>, androidx.activity.result.ActivityResultCallback<O!>);
+ method @MainThread public final <I, O> androidx.activity.result.ActivityResultLauncher<I!> registerForActivityResult(androidx.activity.result.contract.ActivityResultContract<I!,O!>, androidx.activity.result.ActivityResultRegistry, androidx.activity.result.ActivityResultCallback<O!>);
+ method public void registerForContextMenu(android.view.View);
+ method @Deprecated public final void requestPermissions(String![], int);
+ method public final androidx.fragment.app.FragmentActivity requireActivity();
+ method public final android.os.Bundle requireArguments();
+ method public final android.content.Context requireContext();
+ method @Deprecated public final androidx.fragment.app.FragmentManager requireFragmentManager();
+ method public final Object requireHost();
+ method public final androidx.fragment.app.Fragment requireParentFragment();
+ method public final android.view.View requireView();
+ method public void setAllowEnterTransitionOverlap(boolean);
+ method public void setAllowReturnTransitionOverlap(boolean);
+ method public void setArguments(android.os.Bundle?);
+ method public void setEnterSharedElementCallback(androidx.core.app.SharedElementCallback?);
+ method public void setEnterTransition(Object?);
+ method public void setExitSharedElementCallback(androidx.core.app.SharedElementCallback?);
+ method public void setExitTransition(Object?);
+ method public void setHasOptionsMenu(boolean);
+ method public void setInitialSavedState(androidx.fragment.app.Fragment.SavedState?);
+ method public void setMenuVisibility(boolean);
+ method public void setReenterTransition(Object?);
+ method @Deprecated public void setRetainInstance(boolean);
+ method public void setReturnTransition(Object?);
+ method public void setSharedElementEnterTransition(Object?);
+ method public void setSharedElementReturnTransition(Object?);
+ method @Deprecated public void setTargetFragment(androidx.fragment.app.Fragment?, int);
+ method @Deprecated public void setUserVisibleHint(boolean);
+ method public boolean shouldShowRequestPermissionRationale(String);
+ method public void startActivity(android.content.Intent!);
+ method public void startActivity(android.content.Intent!, android.os.Bundle?);
+ method @Deprecated public void startActivityForResult(android.content.Intent!, int);
+ method @Deprecated public void startActivityForResult(android.content.Intent!, int, android.os.Bundle?);
+ method @Deprecated public void startIntentSenderForResult(android.content.IntentSender!, int, android.content.Intent?, int, int, int, android.os.Bundle?) throws android.content.IntentSender.SendIntentException;
+ method public void startPostponedEnterTransition();
+ method public void unregisterForContextMenu(android.view.View);
+ }
+
+ public static class Fragment.InstantiationException extends java.lang.RuntimeException {
+ ctor public Fragment.InstantiationException(String, Exception?);
+ }
+
+ public static class Fragment.SavedState implements android.os.Parcelable {
+ method public int describeContents();
+ method public void writeToParcel(android.os.Parcel, int);
+ field public static final android.os.Parcelable.Creator<androidx.fragment.app.Fragment.SavedState!> CREATOR;
+ }
+
+ public class FragmentActivity extends androidx.activity.ComponentActivity implements androidx.core.app.ActivityCompat.OnRequestPermissionsResultCallback androidx.core.app.ActivityCompat.RequestPermissionsRequestCodeValidator {
+ ctor public FragmentActivity();
+ ctor @ContentView public FragmentActivity(@LayoutRes int);
+ method public androidx.fragment.app.FragmentManager getSupportFragmentManager();
+ method @Deprecated public androidx.loader.app.LoaderManager getSupportLoaderManager();
+ method @Deprecated @MainThread public void onAttachFragment(androidx.fragment.app.Fragment);
+ method @CallSuper public void onMultiWindowModeChanged(boolean);
+ method @CallSuper public void onPictureInPictureModeChanged(boolean);
+ method protected void onResumeFragments();
+ method public void onStateNotSaved();
+ method public void setEnterSharedElementCallback(androidx.core.app.SharedElementCallback?);
+ method public void setExitSharedElementCallback(androidx.core.app.SharedElementCallback?);
+ method public void startActivityFromFragment(androidx.fragment.app.Fragment, android.content.Intent!, int);
+ method public void startActivityFromFragment(androidx.fragment.app.Fragment, android.content.Intent!, int, android.os.Bundle?);
+ method @Deprecated public void startIntentSenderFromFragment(androidx.fragment.app.Fragment, android.content.IntentSender!, int, android.content.Intent?, int, int, int, android.os.Bundle?) throws android.content.IntentSender.SendIntentException;
+ method public void supportFinishAfterTransition();
+ method @Deprecated public void supportInvalidateOptionsMenu();
+ method public void supportPostponeEnterTransition();
+ method public void supportStartPostponedEnterTransition();
+ method @Deprecated public final void validateRequestPermissionsRequestCode(int);
+ }
+
+ public abstract class FragmentContainer {
+ ctor public FragmentContainer();
+ method @Deprecated public androidx.fragment.app.Fragment instantiate(android.content.Context, String, android.os.Bundle?);
+ method public abstract android.view.View? onFindViewById(@IdRes int);
+ method public abstract boolean onHasView();
+ }
+
+ public final class FragmentContainerView extends android.widget.FrameLayout {
+ ctor public FragmentContainerView(android.content.Context);
+ ctor public FragmentContainerView(android.content.Context, android.util.AttributeSet?);
+ ctor public FragmentContainerView(android.content.Context, android.util.AttributeSet?, int);
+ }
+
+ public class FragmentController {
+ method public void attachHost(androidx.fragment.app.Fragment?);
+ method public static androidx.fragment.app.FragmentController createController(androidx.fragment.app.FragmentHostCallback<?>);
+ method public void dispatchActivityCreated();
+ method public void dispatchConfigurationChanged(android.content.res.Configuration);
+ method public boolean dispatchContextItemSelected(android.view.MenuItem);
+ method public void dispatchCreate();
+ method public boolean dispatchCreateOptionsMenu(android.view.Menu, android.view.MenuInflater);
+ method public void dispatchDestroy();
+ method public void dispatchDestroyView();
+ method public void dispatchLowMemory();
+ method public void dispatchMultiWindowModeChanged(boolean);
+ method public boolean dispatchOptionsItemSelected(android.view.MenuItem);
+ method public void dispatchOptionsMenuClosed(android.view.Menu);
+ method public void dispatchPause();
+ method public void dispatchPictureInPictureModeChanged(boolean);
+ method public boolean dispatchPrepareOptionsMenu(android.view.Menu);
+ method @Deprecated public void dispatchReallyStop();
+ method public void dispatchResume();
+ method public void dispatchStart();
+ method public void dispatchStop();
+ method @Deprecated public void doLoaderDestroy();
+ method @Deprecated public void doLoaderRetain();
+ method @Deprecated public void doLoaderStart();
+ method @Deprecated public void doLoaderStop(boolean);
+ method @Deprecated public void dumpLoaders(String, java.io.FileDescriptor?, java.io.PrintWriter, String![]?);
+ method public boolean execPendingActions();
+ method public androidx.fragment.app.Fragment? findFragmentByWho(String);
+ method public java.util.List<androidx.fragment.app.Fragment!> getActiveFragments(java.util.List<androidx.fragment.app.Fragment!>!);
+ method public int getActiveFragmentsCount();
+ method public androidx.fragment.app.FragmentManager getSupportFragmentManager();
+ method @Deprecated public androidx.loader.app.LoaderManager! getSupportLoaderManager();
+ method public void noteStateNotSaved();
+ method public android.view.View? onCreateView(android.view.View?, String, android.content.Context, android.util.AttributeSet);
+ method @Deprecated public void reportLoaderStart();
+ method @Deprecated public void restoreAllState(android.os.Parcelable?, java.util.List<androidx.fragment.app.Fragment!>?);
+ method @Deprecated public void restoreAllState(android.os.Parcelable?, androidx.fragment.app.FragmentManagerNonConfig?);
+ method @Deprecated public void restoreLoaderNonConfig(androidx.collection.SimpleArrayMap<java.lang.String!,androidx.loader.app.LoaderManager!>!);
+ method public void restoreSaveState(android.os.Parcelable?);
+ method @Deprecated public androidx.collection.SimpleArrayMap<java.lang.String!,androidx.loader.app.LoaderManager!>? retainLoaderNonConfig();
+ method @Deprecated public androidx.fragment.app.FragmentManagerNonConfig? retainNestedNonConfig();
+ method @Deprecated public java.util.List<androidx.fragment.app.Fragment!>? retainNonConfig();
+ method public android.os.Parcelable? saveAllState();
+ }
+
+ public class FragmentFactory {
+ ctor public FragmentFactory();
+ method public androidx.fragment.app.Fragment instantiate(ClassLoader, String);
+ method public static Class<? extends androidx.fragment.app.Fragment> loadFragmentClass(ClassLoader, String);
+ }
+
+ public abstract class FragmentHostCallback<E> extends androidx.fragment.app.FragmentContainer {
+ ctor public FragmentHostCallback(android.content.Context, android.os.Handler, int);
+ method public void onDump(String, java.io.FileDescriptor?, java.io.PrintWriter, String![]?);
+ method public android.view.View? onFindViewById(int);
+ method public abstract E? onGetHost();
+ method public android.view.LayoutInflater onGetLayoutInflater();
+ method public int onGetWindowAnimations();
+ method public boolean onHasView();
+ method public boolean onHasWindowAnimations();
+ method @Deprecated public void onRequestPermissionsFromFragment(androidx.fragment.app.Fragment, String![], int);
+ method public boolean onShouldSaveFragmentState(androidx.fragment.app.Fragment);
+ method public boolean onShouldShowRequestPermissionRationale(String);
+ method public void onStartActivityFromFragment(androidx.fragment.app.Fragment, android.content.Intent!, int);
+ method public void onStartActivityFromFragment(androidx.fragment.app.Fragment, android.content.Intent!, int, android.os.Bundle?);
+ method @Deprecated public void onStartIntentSenderFromFragment(androidx.fragment.app.Fragment, android.content.IntentSender!, int, android.content.Intent?, int, int, int, android.os.Bundle?) throws android.content.IntentSender.SendIntentException;
+ method public void onSupportInvalidateOptionsMenu();
+ }
+
+ public abstract class FragmentManager implements androidx.fragment.app.FragmentResultOwner {
+ ctor public FragmentManager();
+ method public void addFragmentOnAttachListener(androidx.fragment.app.FragmentOnAttachListener);
+ method public void addOnBackStackChangedListener(androidx.fragment.app.FragmentManager.OnBackStackChangedListener);
+ method public androidx.fragment.app.FragmentTransaction beginTransaction();
+ method public final void clearFragmentResult(String);
+ method public final void clearFragmentResultListener(String);
+ method public void dump(String, java.io.FileDescriptor?, java.io.PrintWriter, String![]?);
+ method @Deprecated public static void enableDebugLogging(boolean);
+ method @androidx.fragment.app.FragmentStateManagerControl public static void enableNewStateManager(boolean);
+ method public boolean executePendingTransactions();
+ method public static <F extends androidx.fragment.app.Fragment> F findFragment(android.view.View);
+ method public androidx.fragment.app.Fragment? findFragmentById(@IdRes int);
+ method public androidx.fragment.app.Fragment? findFragmentByTag(String?);
+ method public androidx.fragment.app.FragmentManager.BackStackEntry getBackStackEntryAt(int);
+ method public int getBackStackEntryCount();
+ method public androidx.fragment.app.Fragment? getFragment(android.os.Bundle, String);
+ method public androidx.fragment.app.FragmentFactory getFragmentFactory();
+ method public java.util.List<androidx.fragment.app.Fragment!> getFragments();
+ method public androidx.fragment.app.Fragment? getPrimaryNavigationFragment();
+ method public boolean isDestroyed();
+ method public boolean isStateSaved();
+ method public void popBackStack();
+ method public void popBackStack(String?, int);
+ method public void popBackStack(int, int);
+ method public boolean popBackStackImmediate();
+ method public boolean popBackStackImmediate(String?, int);
+ method public boolean popBackStackImmediate(int, int);
+ method public void putFragment(android.os.Bundle, String, androidx.fragment.app.Fragment);
+ method public void registerFragmentLifecycleCallbacks(androidx.fragment.app.FragmentManager.FragmentLifecycleCallbacks, boolean);
+ method public void removeFragmentOnAttachListener(androidx.fragment.app.FragmentOnAttachListener);
+ method public void removeOnBackStackChangedListener(androidx.fragment.app.FragmentManager.OnBackStackChangedListener);
+ method public androidx.fragment.app.Fragment.SavedState? saveFragmentInstanceState(androidx.fragment.app.Fragment);
+ method public void setFragmentFactory(androidx.fragment.app.FragmentFactory);
+ method public final void setFragmentResult(String, android.os.Bundle);
+ method public final void setFragmentResultListener(String, androidx.lifecycle.LifecycleOwner, androidx.fragment.app.FragmentResultListener);
+ method public void unregisterFragmentLifecycleCallbacks(androidx.fragment.app.FragmentManager.FragmentLifecycleCallbacks);
+ field public static final int POP_BACK_STACK_INCLUSIVE = 1; // 0x1
+ }
+
+ public static interface FragmentManager.BackStackEntry {
+ method @Deprecated public CharSequence? getBreadCrumbShortTitle();
+ method @Deprecated @StringRes public int getBreadCrumbShortTitleRes();
+ method @Deprecated public CharSequence? getBreadCrumbTitle();
+ method @Deprecated @StringRes public int getBreadCrumbTitleRes();
+ method public int getId();
+ method public String? getName();
+ }
+
+ public abstract static class FragmentManager.FragmentLifecycleCallbacks {
+ ctor public FragmentManager.FragmentLifecycleCallbacks();
+ method @Deprecated public void onFragmentActivityCreated(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment, android.os.Bundle?);
+ method public void onFragmentAttached(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment, android.content.Context);
+ method public void onFragmentCreated(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment, android.os.Bundle?);
+ method public void onFragmentDestroyed(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment);
+ method public void onFragmentDetached(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment);
+ method public void onFragmentPaused(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment);
+ method public void onFragmentPreAttached(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment, android.content.Context);
+ method public void onFragmentPreCreated(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment, android.os.Bundle?);
+ method public void onFragmentResumed(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment);
+ method public void onFragmentSaveInstanceState(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment, android.os.Bundle);
+ method public void onFragmentStarted(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment);
+ method public void onFragmentStopped(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment);
+ method public void onFragmentViewCreated(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment, android.view.View, android.os.Bundle?);
+ method public void onFragmentViewDestroyed(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment);
+ }
+
+ public static interface FragmentManager.OnBackStackChangedListener {
+ method @MainThread public void onBackStackChanged();
+ }
+
+ @Deprecated public class FragmentManagerNonConfig {
+ }
+
+ public interface FragmentOnAttachListener {
+ method @MainThread public void onAttachFragment(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment);
+ }
+
+ @Deprecated public abstract class FragmentPagerAdapter extends androidx.viewpager.widget.PagerAdapter {
+ ctor @Deprecated public FragmentPagerAdapter(androidx.fragment.app.FragmentManager);
+ ctor @Deprecated public FragmentPagerAdapter(androidx.fragment.app.FragmentManager, int);
+ method @Deprecated public abstract androidx.fragment.app.Fragment getItem(int);
+ method @Deprecated public long getItemId(int);
+ method @Deprecated public boolean isViewFromObject(android.view.View, Object);
+ field @Deprecated public static final int BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT = 1; // 0x1
+ field @Deprecated public static final int BEHAVIOR_SET_USER_VISIBLE_HINT = 0; // 0x0
+ }
+
+ public interface FragmentResultListener {
+ method public void onFragmentResult(String, android.os.Bundle);
+ }
+
+ public interface FragmentResultOwner {
+ method public void clearFragmentResult(String);
+ method public void clearFragmentResultListener(String);
+ method public void setFragmentResult(String, android.os.Bundle);
+ method public void setFragmentResultListener(String, androidx.lifecycle.LifecycleOwner, androidx.fragment.app.FragmentResultListener);
+ }
+
+ @experimental.Experimental(level=androidx.annotation.experimental.Experimental.Level.WARNING) @java.lang.annotation.Retention(java.lang.annotation.RetentionPolicy.CLASS) @java.lang.annotation.Target({java.lang.annotation.ElementType.METHOD}) public @interface FragmentStateManagerControl {
+ }
+
+ @Deprecated public abstract class FragmentStatePagerAdapter extends androidx.viewpager.widget.PagerAdapter {
+ ctor @Deprecated public FragmentStatePagerAdapter(androidx.fragment.app.FragmentManager);
+ ctor @Deprecated public FragmentStatePagerAdapter(androidx.fragment.app.FragmentManager, int);
+ method @Deprecated public abstract androidx.fragment.app.Fragment getItem(int);
+ method @Deprecated public boolean isViewFromObject(android.view.View, Object);
+ field @Deprecated public static final int BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT = 1; // 0x1
+ field @Deprecated public static final int BEHAVIOR_SET_USER_VISIBLE_HINT = 0; // 0x0
+ }
+
+ @Deprecated public class FragmentTabHost extends android.widget.TabHost implements android.widget.TabHost.OnTabChangeListener {
+ ctor @Deprecated public FragmentTabHost(android.content.Context);
+ ctor @Deprecated public FragmentTabHost(android.content.Context, android.util.AttributeSet?);
+ method @Deprecated public void addTab(android.widget.TabHost.TabSpec, Class<?>, android.os.Bundle?);
+ method @Deprecated public void onTabChanged(String?);
+ method @Deprecated public void setup(android.content.Context, androidx.fragment.app.FragmentManager);
+ method @Deprecated public void setup(android.content.Context, androidx.fragment.app.FragmentManager, int);
+ }
+
+ public abstract class FragmentTransaction {
+ ctor @Deprecated public FragmentTransaction();
+ method public final androidx.fragment.app.FragmentTransaction add(Class<? extends androidx.fragment.app.Fragment>, android.os.Bundle?, String?);
+ method public androidx.fragment.app.FragmentTransaction add(androidx.fragment.app.Fragment, String?);
+ method public final androidx.fragment.app.FragmentTransaction add(@IdRes int, Class<? extends androidx.fragment.app.Fragment>, android.os.Bundle?);
+ method public androidx.fragment.app.FragmentTransaction add(@IdRes int, androidx.fragment.app.Fragment);
+ method public final androidx.fragment.app.FragmentTransaction add(@IdRes int, Class<? extends androidx.fragment.app.Fragment>, android.os.Bundle?, String?);
+ method public androidx.fragment.app.FragmentTransaction add(@IdRes int, androidx.fragment.app.Fragment, String?);
+ method public androidx.fragment.app.FragmentTransaction addSharedElement(android.view.View, String);
+ method public androidx.fragment.app.FragmentTransaction addToBackStack(String?);
+ method public androidx.fragment.app.FragmentTransaction attach(androidx.fragment.app.Fragment);
+ method public abstract int commit();
+ method public abstract int commitAllowingStateLoss();
+ method public abstract void commitNow();
+ method public abstract void commitNowAllowingStateLoss();
+ method public androidx.fragment.app.FragmentTransaction detach(androidx.fragment.app.Fragment);
+ method public androidx.fragment.app.FragmentTransaction disallowAddToBackStack();
+ method public androidx.fragment.app.FragmentTransaction hide(androidx.fragment.app.Fragment);
+ method public boolean isAddToBackStackAllowed();
+ method public boolean isEmpty();
+ method public androidx.fragment.app.FragmentTransaction remove(androidx.fragment.app.Fragment);
+ method public final androidx.fragment.app.FragmentTransaction replace(@IdRes int, Class<? extends androidx.fragment.app.Fragment>, android.os.Bundle?);
+ method public androidx.fragment.app.FragmentTransaction replace(@IdRes int, androidx.fragment.app.Fragment);
+ method public final androidx.fragment.app.FragmentTransaction replace(@IdRes int, Class<? extends androidx.fragment.app.Fragment>, android.os.Bundle?, String?);
+ method public androidx.fragment.app.FragmentTransaction replace(@IdRes int, androidx.fragment.app.Fragment, String?);
+ method public androidx.fragment.app.FragmentTransaction runOnCommit(Runnable);
+ method @Deprecated public androidx.fragment.app.FragmentTransaction setAllowOptimization(boolean);
+ method @Deprecated public androidx.fragment.app.FragmentTransaction setBreadCrumbShortTitle(@StringRes int);
+ method @Deprecated public androidx.fragment.app.FragmentTransaction setBreadCrumbShortTitle(CharSequence?);
+ method @Deprecated public androidx.fragment.app.FragmentTransaction setBreadCrumbTitle(@StringRes int);
+ method @Deprecated public androidx.fragment.app.FragmentTransaction setBreadCrumbTitle(CharSequence?);
+ method public androidx.fragment.app.FragmentTransaction setCustomAnimations(@AnimRes @AnimatorRes int, @AnimRes @AnimatorRes int);
+ method public androidx.fragment.app.FragmentTransaction setCustomAnimations(@AnimRes @AnimatorRes int, @AnimRes @AnimatorRes int, @AnimRes @AnimatorRes int, @AnimRes @AnimatorRes int);
+ method public androidx.fragment.app.FragmentTransaction setMaxLifecycle(androidx.fragment.app.Fragment, androidx.lifecycle.Lifecycle.State);
+ method public androidx.fragment.app.FragmentTransaction setPrimaryNavigationFragment(androidx.fragment.app.Fragment?);
+ method public androidx.fragment.app.FragmentTransaction setReorderingAllowed(boolean);
+ method public androidx.fragment.app.FragmentTransaction setTransition(int);
+ method @Deprecated public androidx.fragment.app.FragmentTransaction setTransitionStyle(@StyleRes int);
+ method public androidx.fragment.app.FragmentTransaction show(androidx.fragment.app.Fragment);
+ field public static final int TRANSIT_ENTER_MASK = 4096; // 0x1000
+ field public static final int TRANSIT_EXIT_MASK = 8192; // 0x2000
+ field public static final int TRANSIT_FRAGMENT_CLOSE = 8194; // 0x2002
+ field public static final int TRANSIT_FRAGMENT_FADE = 4099; // 0x1003
+ field public static final int TRANSIT_FRAGMENT_OPEN = 4097; // 0x1001
+ field public static final int TRANSIT_NONE = 0; // 0x0
+ field public static final int TRANSIT_UNSET = -1; // 0xffffffff
+ }
+
+ public class ListFragment extends androidx.fragment.app.Fragment {
+ ctor public ListFragment();
+ method public android.widget.ListAdapter? getListAdapter();
+ method public android.widget.ListView getListView();
+ method public long getSelectedItemId();
+ method public int getSelectedItemPosition();
+ method public void onListItemClick(android.widget.ListView, android.view.View, int, long);
+ method public final android.widget.ListAdapter requireListAdapter();
+ method public void setEmptyText(CharSequence?);
+ method public void setListAdapter(android.widget.ListAdapter?);
+ method public void setListShown(boolean);
+ method public void setListShownNoAnimation(boolean);
+ method public void setSelection(int);
+ }
+
+}
+
diff --git a/fragment/fragment/api/res-1.3.0-beta02.txt b/fragment/fragment/api/res-1.3.0-beta02.txt
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/fragment/fragment/api/res-1.3.0-beta02.txt
diff --git a/fragment/fragment/api/restricted_1.3.0-beta02.txt b/fragment/fragment/api/restricted_1.3.0-beta02.txt
new file mode 100644
index 0000000..afa0e61
--- /dev/null
+++ b/fragment/fragment/api/restricted_1.3.0-beta02.txt
@@ -0,0 +1,480 @@
+// Signature format: 4.0
+package androidx.fragment.app {
+
+ public class DialogFragment extends androidx.fragment.app.Fragment implements android.content.DialogInterface.OnCancelListener android.content.DialogInterface.OnDismissListener {
+ ctor public DialogFragment();
+ ctor public DialogFragment(@LayoutRes int);
+ method public void dismiss();
+ method public void dismissAllowingStateLoss();
+ method public android.app.Dialog? getDialog();
+ method public boolean getShowsDialog();
+ method @StyleRes public int getTheme();
+ method public boolean isCancelable();
+ method public void onCancel(android.content.DialogInterface);
+ method @MainThread public android.app.Dialog onCreateDialog(android.os.Bundle?);
+ method public void onDismiss(android.content.DialogInterface);
+ method public final android.app.Dialog requireDialog();
+ method public void setCancelable(boolean);
+ method public void setShowsDialog(boolean);
+ method public void setStyle(int, @StyleRes int);
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public void setupDialog(android.app.Dialog, int);
+ method public void show(androidx.fragment.app.FragmentManager, String?);
+ method public int show(androidx.fragment.app.FragmentTransaction, String?);
+ method public void showNow(androidx.fragment.app.FragmentManager, String?);
+ field public static final int STYLE_NORMAL = 0; // 0x0
+ field public static final int STYLE_NO_FRAME = 2; // 0x2
+ field public static final int STYLE_NO_INPUT = 3; // 0x3
+ field public static final int STYLE_NO_TITLE = 1; // 0x1
+ }
+
+ public class Fragment implements androidx.activity.result.ActivityResultCaller android.content.ComponentCallbacks androidx.lifecycle.HasDefaultViewModelProviderFactory androidx.lifecycle.LifecycleOwner androidx.savedstate.SavedStateRegistryOwner android.view.View.OnCreateContextMenuListener androidx.lifecycle.ViewModelStoreOwner {
+ ctor public Fragment();
+ ctor @ContentView public Fragment(@LayoutRes int);
+ method public void dump(String, java.io.FileDescriptor?, java.io.PrintWriter, String![]?);
+ method public final boolean equals(Object?);
+ method public final androidx.fragment.app.FragmentActivity? getActivity();
+ method public boolean getAllowEnterTransitionOverlap();
+ method public boolean getAllowReturnTransitionOverlap();
+ method public final android.os.Bundle? getArguments();
+ method public final androidx.fragment.app.FragmentManager getChildFragmentManager();
+ method public android.content.Context? getContext();
+ method public androidx.lifecycle.ViewModelProvider.Factory getDefaultViewModelProviderFactory();
+ method public Object? getEnterTransition();
+ method public Object? getExitTransition();
+ method @Deprecated public final androidx.fragment.app.FragmentManager? getFragmentManager();
+ method public final Object? getHost();
+ method public final int getId();
+ method public final android.view.LayoutInflater getLayoutInflater();
+ method @Deprecated @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public android.view.LayoutInflater getLayoutInflater(android.os.Bundle?);
+ method public androidx.lifecycle.Lifecycle getLifecycle();
+ method @Deprecated public androidx.loader.app.LoaderManager getLoaderManager();
+ method public final androidx.fragment.app.Fragment? getParentFragment();
+ method public final androidx.fragment.app.FragmentManager getParentFragmentManager();
+ method public Object? getReenterTransition();
+ method public final android.content.res.Resources getResources();
+ method @Deprecated public final boolean getRetainInstance();
+ method public Object? getReturnTransition();
+ method public final androidx.savedstate.SavedStateRegistry getSavedStateRegistry();
+ method public Object? getSharedElementEnterTransition();
+ method public Object? getSharedElementReturnTransition();
+ method public final String getString(@StringRes int);
+ method public final String getString(@StringRes int, java.lang.Object!...);
+ method public final String? getTag();
+ method @Deprecated public final androidx.fragment.app.Fragment? getTargetFragment();
+ method @Deprecated public final int getTargetRequestCode();
+ method public final CharSequence getText(@StringRes int);
+ method @Deprecated public boolean getUserVisibleHint();
+ method public android.view.View? getView();
+ method @MainThread public androidx.lifecycle.LifecycleOwner getViewLifecycleOwner();
+ method public androidx.lifecycle.LiveData<androidx.lifecycle.LifecycleOwner!> getViewLifecycleOwnerLiveData();
+ method public androidx.lifecycle.ViewModelStore getViewModelStore();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public final boolean hasOptionsMenu();
+ method public final int hashCode();
+ method @Deprecated public static androidx.fragment.app.Fragment instantiate(android.content.Context, String);
+ method @Deprecated public static androidx.fragment.app.Fragment instantiate(android.content.Context, String, android.os.Bundle?);
+ method public final boolean isAdded();
+ method public final boolean isDetached();
+ method public final boolean isHidden();
+ method public final boolean isInLayout();
+ method @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public final boolean isMenuVisible();
+ method public final boolean isRemoving();
+ method public final boolean isResumed();
+ method public final boolean isStateSaved();
+ method public final boolean isVisible();
+ method @Deprecated @CallSuper @MainThread public void onActivityCreated(android.os.Bundle?);
+ method @Deprecated public void onActivityResult(int, int, android.content.Intent?);
+ method @CallSuper @MainThread public void onAttach(android.content.Context);
+ method @Deprecated @CallSuper @MainThread public void onAttach(android.app.Activity);
+ method @Deprecated @MainThread public void onAttachFragment(androidx.fragment.app.Fragment);
+ method @CallSuper public void onConfigurationChanged(android.content.res.Configuration);
+ method @MainThread public boolean onContextItemSelected(android.view.MenuItem);
+ method @CallSuper @MainThread public void onCreate(android.os.Bundle?);
+ method @MainThread public android.view.animation.Animation? onCreateAnimation(int, boolean, int);
+ method @MainThread public android.animation.Animator? onCreateAnimator(int, boolean, int);
+ method @MainThread public void onCreateContextMenu(android.view.ContextMenu, android.view.View, android.view.ContextMenu.ContextMenuInfo?);
+ method @MainThread public void onCreateOptionsMenu(android.view.Menu, android.view.MenuInflater);
+ method @MainThread public android.view.View? onCreateView(android.view.LayoutInflater, android.view.ViewGroup?, android.os.Bundle?);
+ method @CallSuper @MainThread public void onDestroy();
+ method @MainThread public void onDestroyOptionsMenu();
+ method @CallSuper @MainThread public void onDestroyView();
+ method @CallSuper @MainThread public void onDetach();
+ method public android.view.LayoutInflater onGetLayoutInflater(android.os.Bundle?);
+ method @MainThread public void onHiddenChanged(boolean);
+ method @CallSuper @UiThread public void onInflate(android.content.Context, android.util.AttributeSet, android.os.Bundle?);
+ method @Deprecated @CallSuper @UiThread public void onInflate(android.app.Activity, android.util.AttributeSet, android.os.Bundle?);
+ method @CallSuper @MainThread public void onLowMemory();
+ method public void onMultiWindowModeChanged(boolean);
+ method @MainThread public boolean onOptionsItemSelected(android.view.MenuItem);
+ method @MainThread public void onOptionsMenuClosed(android.view.Menu);
+ method @CallSuper @MainThread public void onPause();
+ method public void onPictureInPictureModeChanged(boolean);
+ method @MainThread public void onPrepareOptionsMenu(android.view.Menu);
+ method @MainThread public void onPrimaryNavigationFragmentChanged(boolean);
+ method @Deprecated public void onRequestPermissionsResult(int, String![], int[]);
+ method @CallSuper @MainThread public void onResume();
+ method @MainThread public void onSaveInstanceState(android.os.Bundle);
+ method @CallSuper @MainThread public void onStart();
+ method @CallSuper @MainThread public void onStop();
+ method @MainThread public void onViewCreated(android.view.View, android.os.Bundle?);
+ method @CallSuper @MainThread public void onViewStateRestored(android.os.Bundle?);
+ method public void postponeEnterTransition();
+ method public final void postponeEnterTransition(long, java.util.concurrent.TimeUnit);
+ method @MainThread public final <I, O> androidx.activity.result.ActivityResultLauncher<I!> registerForActivityResult(androidx.activity.result.contract.ActivityResultContract<I!,O!>, androidx.activity.result.ActivityResultCallback<O!>);
+ method @MainThread public final <I, O> androidx.activity.result.ActivityResultLauncher<I!> registerForActivityResult(androidx.activity.result.contract.ActivityResultContract<I!,O!>, androidx.activity.result.ActivityResultRegistry, androidx.activity.result.ActivityResultCallback<O!>);
+ method public void registerForContextMenu(android.view.View);
+ method @Deprecated public final void requestPermissions(String![], int);
+ method public final androidx.fragment.app.FragmentActivity requireActivity();
+ method public final android.os.Bundle requireArguments();
+ method public final android.content.Context requireContext();
+ method @Deprecated public final androidx.fragment.app.FragmentManager requireFragmentManager();
+ method public final Object requireHost();
+ method public final androidx.fragment.app.Fragment requireParentFragment();
+ method public final android.view.View requireView();
+ method public void setAllowEnterTransitionOverlap(boolean);
+ method public void setAllowReturnTransitionOverlap(boolean);
+ method public void setArguments(android.os.Bundle?);
+ method public void setEnterSharedElementCallback(androidx.core.app.SharedElementCallback?);
+ method public void setEnterTransition(Object?);
+ method public void setExitSharedElementCallback(androidx.core.app.SharedElementCallback?);
+ method public void setExitTransition(Object?);
+ method public void setHasOptionsMenu(boolean);
+ method public void setInitialSavedState(androidx.fragment.app.Fragment.SavedState?);
+ method public void setMenuVisibility(boolean);
+ method public void setReenterTransition(Object?);
+ method @Deprecated public void setRetainInstance(boolean);
+ method public void setReturnTransition(Object?);
+ method public void setSharedElementEnterTransition(Object?);
+ method public void setSharedElementReturnTransition(Object?);
+ method @Deprecated public void setTargetFragment(androidx.fragment.app.Fragment?, int);
+ method @Deprecated public void setUserVisibleHint(boolean);
+ method public boolean shouldShowRequestPermissionRationale(String);
+ method public void startActivity(android.content.Intent!);
+ method public void startActivity(android.content.Intent!, android.os.Bundle?);
+ method @Deprecated public void startActivityForResult(android.content.Intent!, int);
+ method @Deprecated public void startActivityForResult(android.content.Intent!, int, android.os.Bundle?);
+ method @Deprecated public void startIntentSenderForResult(android.content.IntentSender!, int, android.content.Intent?, int, int, int, android.os.Bundle?) throws android.content.IntentSender.SendIntentException;
+ method public void startPostponedEnterTransition();
+ method public void unregisterForContextMenu(android.view.View);
+ }
+
+ public static class Fragment.InstantiationException extends java.lang.RuntimeException {
+ ctor public Fragment.InstantiationException(String, Exception?);
+ }
+
+ public static class Fragment.SavedState implements android.os.Parcelable {
+ method public int describeContents();
+ method public void writeToParcel(android.os.Parcel, int);
+ field public static final android.os.Parcelable.Creator<androidx.fragment.app.Fragment.SavedState!> CREATOR;
+ }
+
+ public class FragmentActivity extends androidx.activity.ComponentActivity implements androidx.core.app.ActivityCompat.OnRequestPermissionsResultCallback androidx.core.app.ActivityCompat.RequestPermissionsRequestCodeValidator {
+ ctor public FragmentActivity();
+ ctor @ContentView public FragmentActivity(@LayoutRes int);
+ method public androidx.fragment.app.FragmentManager getSupportFragmentManager();
+ method @Deprecated public androidx.loader.app.LoaderManager getSupportLoaderManager();
+ method @Deprecated @MainThread public void onAttachFragment(androidx.fragment.app.Fragment);
+ method @CallSuper public void onMultiWindowModeChanged(boolean);
+ method @CallSuper public void onPictureInPictureModeChanged(boolean);
+ method @Deprecated @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) protected boolean onPrepareOptionsPanel(android.view.View?, android.view.Menu);
+ method protected void onResumeFragments();
+ method public void onStateNotSaved();
+ method public void setEnterSharedElementCallback(androidx.core.app.SharedElementCallback?);
+ method public void setExitSharedElementCallback(androidx.core.app.SharedElementCallback?);
+ method public void startActivityFromFragment(androidx.fragment.app.Fragment, android.content.Intent!, int);
+ method public void startActivityFromFragment(androidx.fragment.app.Fragment, android.content.Intent!, int, android.os.Bundle?);
+ method @Deprecated public void startIntentSenderFromFragment(androidx.fragment.app.Fragment, android.content.IntentSender!, int, android.content.Intent?, int, int, int, android.os.Bundle?) throws android.content.IntentSender.SendIntentException;
+ method public void supportFinishAfterTransition();
+ method @Deprecated public void supportInvalidateOptionsMenu();
+ method public void supportPostponeEnterTransition();
+ method public void supportStartPostponedEnterTransition();
+ method @Deprecated public final void validateRequestPermissionsRequestCode(int);
+ }
+
+ public abstract class FragmentContainer {
+ ctor public FragmentContainer();
+ method @Deprecated public androidx.fragment.app.Fragment instantiate(android.content.Context, String, android.os.Bundle?);
+ method public abstract android.view.View? onFindViewById(@IdRes int);
+ method public abstract boolean onHasView();
+ }
+
+ public final class FragmentContainerView extends android.widget.FrameLayout {
+ ctor public FragmentContainerView(android.content.Context);
+ ctor public FragmentContainerView(android.content.Context, android.util.AttributeSet?);
+ ctor public FragmentContainerView(android.content.Context, android.util.AttributeSet?, int);
+ }
+
+ public class FragmentController {
+ method public void attachHost(androidx.fragment.app.Fragment?);
+ method public static androidx.fragment.app.FragmentController createController(androidx.fragment.app.FragmentHostCallback<?>);
+ method public void dispatchActivityCreated();
+ method public void dispatchConfigurationChanged(android.content.res.Configuration);
+ method public boolean dispatchContextItemSelected(android.view.MenuItem);
+ method public void dispatchCreate();
+ method public boolean dispatchCreateOptionsMenu(android.view.Menu, android.view.MenuInflater);
+ method public void dispatchDestroy();
+ method public void dispatchDestroyView();
+ method public void dispatchLowMemory();
+ method public void dispatchMultiWindowModeChanged(boolean);
+ method public boolean dispatchOptionsItemSelected(android.view.MenuItem);
+ method public void dispatchOptionsMenuClosed(android.view.Menu);
+ method public void dispatchPause();
+ method public void dispatchPictureInPictureModeChanged(boolean);
+ method public boolean dispatchPrepareOptionsMenu(android.view.Menu);
+ method @Deprecated public void dispatchReallyStop();
+ method public void dispatchResume();
+ method public void dispatchStart();
+ method public void dispatchStop();
+ method @Deprecated public void doLoaderDestroy();
+ method @Deprecated public void doLoaderRetain();
+ method @Deprecated public void doLoaderStart();
+ method @Deprecated public void doLoaderStop(boolean);
+ method @Deprecated public void dumpLoaders(String, java.io.FileDescriptor?, java.io.PrintWriter, String![]?);
+ method public boolean execPendingActions();
+ method public androidx.fragment.app.Fragment? findFragmentByWho(String);
+ method public java.util.List<androidx.fragment.app.Fragment!> getActiveFragments(java.util.List<androidx.fragment.app.Fragment!>!);
+ method public int getActiveFragmentsCount();
+ method public androidx.fragment.app.FragmentManager getSupportFragmentManager();
+ method @Deprecated public androidx.loader.app.LoaderManager! getSupportLoaderManager();
+ method public void noteStateNotSaved();
+ method public android.view.View? onCreateView(android.view.View?, String, android.content.Context, android.util.AttributeSet);
+ method @Deprecated public void reportLoaderStart();
+ method @Deprecated public void restoreAllState(android.os.Parcelable?, java.util.List<androidx.fragment.app.Fragment!>?);
+ method @Deprecated public void restoreAllState(android.os.Parcelable?, androidx.fragment.app.FragmentManagerNonConfig?);
+ method @Deprecated public void restoreLoaderNonConfig(androidx.collection.SimpleArrayMap<java.lang.String!,androidx.loader.app.LoaderManager!>!);
+ method public void restoreSaveState(android.os.Parcelable?);
+ method @Deprecated public androidx.collection.SimpleArrayMap<java.lang.String!,androidx.loader.app.LoaderManager!>? retainLoaderNonConfig();
+ method @Deprecated public androidx.fragment.app.FragmentManagerNonConfig? retainNestedNonConfig();
+ method @Deprecated public java.util.List<androidx.fragment.app.Fragment!>? retainNonConfig();
+ method public android.os.Parcelable? saveAllState();
+ }
+
+ public class FragmentFactory {
+ ctor public FragmentFactory();
+ method public androidx.fragment.app.Fragment instantiate(ClassLoader, String);
+ method public static Class<? extends androidx.fragment.app.Fragment> loadFragmentClass(ClassLoader, String);
+ }
+
+ public abstract class FragmentHostCallback<E> extends androidx.fragment.app.FragmentContainer {
+ ctor public FragmentHostCallback(android.content.Context, android.os.Handler, int);
+ method public void onDump(String, java.io.FileDescriptor?, java.io.PrintWriter, String![]?);
+ method public android.view.View? onFindViewById(int);
+ method public abstract E? onGetHost();
+ method public android.view.LayoutInflater onGetLayoutInflater();
+ method public int onGetWindowAnimations();
+ method public boolean onHasView();
+ method public boolean onHasWindowAnimations();
+ method @Deprecated public void onRequestPermissionsFromFragment(androidx.fragment.app.Fragment, String![], int);
+ method public boolean onShouldSaveFragmentState(androidx.fragment.app.Fragment);
+ method public boolean onShouldShowRequestPermissionRationale(String);
+ method public void onStartActivityFromFragment(androidx.fragment.app.Fragment, android.content.Intent!, int);
+ method public void onStartActivityFromFragment(androidx.fragment.app.Fragment, android.content.Intent!, int, android.os.Bundle?);
+ method @Deprecated public void onStartIntentSenderFromFragment(androidx.fragment.app.Fragment, android.content.IntentSender!, int, android.content.Intent?, int, int, int, android.os.Bundle?) throws android.content.IntentSender.SendIntentException;
+ method public void onSupportInvalidateOptionsMenu();
+ }
+
+ public abstract class FragmentManager implements androidx.fragment.app.FragmentResultOwner {
+ ctor public FragmentManager();
+ method public void addFragmentOnAttachListener(androidx.fragment.app.FragmentOnAttachListener);
+ method public void addOnBackStackChangedListener(androidx.fragment.app.FragmentManager.OnBackStackChangedListener);
+ method public androidx.fragment.app.FragmentTransaction beginTransaction();
+ method public final void clearFragmentResult(String);
+ method public final void clearFragmentResultListener(String);
+ method public void dump(String, java.io.FileDescriptor?, java.io.PrintWriter, String![]?);
+ method @Deprecated public static void enableDebugLogging(boolean);
+ method public boolean executePendingTransactions();
+ method public static <F extends androidx.fragment.app.Fragment> F findFragment(android.view.View);
+ method public androidx.fragment.app.Fragment? findFragmentById(@IdRes int);
+ method public androidx.fragment.app.Fragment? findFragmentByTag(String?);
+ method public androidx.fragment.app.FragmentManager.BackStackEntry getBackStackEntryAt(int);
+ method public int getBackStackEntryCount();
+ method public androidx.fragment.app.Fragment? getFragment(android.os.Bundle, String);
+ method public androidx.fragment.app.FragmentFactory getFragmentFactory();
+ method public java.util.List<androidx.fragment.app.Fragment!> getFragments();
+ method public androidx.fragment.app.Fragment? getPrimaryNavigationFragment();
+ method public boolean isDestroyed();
+ method public boolean isStateSaved();
+ method @Deprecated @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public androidx.fragment.app.FragmentTransaction openTransaction();
+ method public void popBackStack();
+ method public void popBackStack(String?, int);
+ method public void popBackStack(int, int);
+ method public boolean popBackStackImmediate();
+ method public boolean popBackStackImmediate(String?, int);
+ method public boolean popBackStackImmediate(int, int);
+ method public void putFragment(android.os.Bundle, String, androidx.fragment.app.Fragment);
+ method public void registerFragmentLifecycleCallbacks(androidx.fragment.app.FragmentManager.FragmentLifecycleCallbacks, boolean);
+ method public void removeFragmentOnAttachListener(androidx.fragment.app.FragmentOnAttachListener);
+ method public void removeOnBackStackChangedListener(androidx.fragment.app.FragmentManager.OnBackStackChangedListener);
+ method public androidx.fragment.app.Fragment.SavedState? saveFragmentInstanceState(androidx.fragment.app.Fragment);
+ method public void setFragmentFactory(androidx.fragment.app.FragmentFactory);
+ method public final void setFragmentResult(String, android.os.Bundle);
+ method public final void setFragmentResultListener(String, androidx.lifecycle.LifecycleOwner, androidx.fragment.app.FragmentResultListener);
+ method public void unregisterFragmentLifecycleCallbacks(androidx.fragment.app.FragmentManager.FragmentLifecycleCallbacks);
+ field public static final int POP_BACK_STACK_INCLUSIVE = 1; // 0x1
+ }
+
+ public static interface FragmentManager.BackStackEntry {
+ method @Deprecated public CharSequence? getBreadCrumbShortTitle();
+ method @Deprecated @StringRes public int getBreadCrumbShortTitleRes();
+ method @Deprecated public CharSequence? getBreadCrumbTitle();
+ method @Deprecated @StringRes public int getBreadCrumbTitleRes();
+ method public int getId();
+ method public String? getName();
+ }
+
+ public abstract static class FragmentManager.FragmentLifecycleCallbacks {
+ ctor public FragmentManager.FragmentLifecycleCallbacks();
+ method @Deprecated public void onFragmentActivityCreated(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment, android.os.Bundle?);
+ method public void onFragmentAttached(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment, android.content.Context);
+ method public void onFragmentCreated(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment, android.os.Bundle?);
+ method public void onFragmentDestroyed(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment);
+ method public void onFragmentDetached(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment);
+ method public void onFragmentPaused(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment);
+ method public void onFragmentPreAttached(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment, android.content.Context);
+ method public void onFragmentPreCreated(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment, android.os.Bundle?);
+ method public void onFragmentResumed(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment);
+ method public void onFragmentSaveInstanceState(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment, android.os.Bundle);
+ method public void onFragmentStarted(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment);
+ method public void onFragmentStopped(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment);
+ method public void onFragmentViewCreated(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment, android.view.View, android.os.Bundle?);
+ method public void onFragmentViewDestroyed(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment);
+ }
+
+ public static interface FragmentManager.OnBackStackChangedListener {
+ method @MainThread public void onBackStackChanged();
+ }
+
+ @Deprecated public class FragmentManagerNonConfig {
+ }
+
+ public interface FragmentOnAttachListener {
+ method @MainThread public void onAttachFragment(androidx.fragment.app.FragmentManager, androidx.fragment.app.Fragment);
+ }
+
+ @Deprecated public abstract class FragmentPagerAdapter extends androidx.viewpager.widget.PagerAdapter {
+ ctor @Deprecated public FragmentPagerAdapter(androidx.fragment.app.FragmentManager);
+ ctor @Deprecated public FragmentPagerAdapter(androidx.fragment.app.FragmentManager, int);
+ method @Deprecated public abstract androidx.fragment.app.Fragment getItem(int);
+ method @Deprecated public long getItemId(int);
+ method @Deprecated public boolean isViewFromObject(android.view.View, Object);
+ field @Deprecated public static final int BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT = 1; // 0x1
+ field @Deprecated public static final int BEHAVIOR_SET_USER_VISIBLE_HINT = 0; // 0x0
+ }
+
+ public interface FragmentResultListener {
+ method public void onFragmentResult(String, android.os.Bundle);
+ }
+
+ public interface FragmentResultOwner {
+ method public void clearFragmentResult(String);
+ method public void clearFragmentResultListener(String);
+ method public void setFragmentResult(String, android.os.Bundle);
+ method public void setFragmentResultListener(String, androidx.lifecycle.LifecycleOwner, androidx.fragment.app.FragmentResultListener);
+ }
+
+ @Deprecated public abstract class FragmentStatePagerAdapter extends androidx.viewpager.widget.PagerAdapter {
+ ctor @Deprecated public FragmentStatePagerAdapter(androidx.fragment.app.FragmentManager);
+ ctor @Deprecated public FragmentStatePagerAdapter(androidx.fragment.app.FragmentManager, int);
+ method @Deprecated public abstract androidx.fragment.app.Fragment getItem(int);
+ method @Deprecated public boolean isViewFromObject(android.view.View, Object);
+ field @Deprecated public static final int BEHAVIOR_RESUME_ONLY_CURRENT_FRAGMENT = 1; // 0x1
+ field @Deprecated public static final int BEHAVIOR_SET_USER_VISIBLE_HINT = 0; // 0x0
+ }
+
+ @Deprecated public class FragmentTabHost extends android.widget.TabHost implements android.widget.TabHost.OnTabChangeListener {
+ ctor @Deprecated public FragmentTabHost(android.content.Context);
+ ctor @Deprecated public FragmentTabHost(android.content.Context, android.util.AttributeSet?);
+ method @Deprecated public void addTab(android.widget.TabHost.TabSpec, Class<?>, android.os.Bundle?);
+ method @Deprecated public void onTabChanged(String?);
+ method @Deprecated public void setup(android.content.Context, androidx.fragment.app.FragmentManager);
+ method @Deprecated public void setup(android.content.Context, androidx.fragment.app.FragmentManager, int);
+ }
+
+ public abstract class FragmentTransaction {
+ ctor @Deprecated public FragmentTransaction();
+ method public final androidx.fragment.app.FragmentTransaction add(Class<? extends androidx.fragment.app.Fragment>, android.os.Bundle?, String?);
+ method public androidx.fragment.app.FragmentTransaction add(androidx.fragment.app.Fragment, String?);
+ method public final androidx.fragment.app.FragmentTransaction add(@IdRes int, Class<? extends androidx.fragment.app.Fragment>, android.os.Bundle?);
+ method public androidx.fragment.app.FragmentTransaction add(@IdRes int, androidx.fragment.app.Fragment);
+ method public final androidx.fragment.app.FragmentTransaction add(@IdRes int, Class<? extends androidx.fragment.app.Fragment>, android.os.Bundle?, String?);
+ method public androidx.fragment.app.FragmentTransaction add(@IdRes int, androidx.fragment.app.Fragment, String?);
+ method public androidx.fragment.app.FragmentTransaction addSharedElement(android.view.View, String);
+ method public androidx.fragment.app.FragmentTransaction addToBackStack(String?);
+ method public androidx.fragment.app.FragmentTransaction attach(androidx.fragment.app.Fragment);
+ method public abstract int commit();
+ method public abstract int commitAllowingStateLoss();
+ method public abstract void commitNow();
+ method public abstract void commitNowAllowingStateLoss();
+ method public androidx.fragment.app.FragmentTransaction detach(androidx.fragment.app.Fragment);
+ method public androidx.fragment.app.FragmentTransaction disallowAddToBackStack();
+ method public androidx.fragment.app.FragmentTransaction hide(androidx.fragment.app.Fragment);
+ method public boolean isAddToBackStackAllowed();
+ method public boolean isEmpty();
+ method public androidx.fragment.app.FragmentTransaction remove(androidx.fragment.app.Fragment);
+ method public final androidx.fragment.app.FragmentTransaction replace(@IdRes int, Class<? extends androidx.fragment.app.Fragment>, android.os.Bundle?);
+ method public androidx.fragment.app.FragmentTransaction replace(@IdRes int, androidx.fragment.app.Fragment);
+ method public final androidx.fragment.app.FragmentTransaction replace(@IdRes int, Class<? extends androidx.fragment.app.Fragment>, android.os.Bundle?, String?);
+ method public androidx.fragment.app.FragmentTransaction replace(@IdRes int, androidx.fragment.app.Fragment, String?);
+ method public androidx.fragment.app.FragmentTransaction runOnCommit(Runnable);
+ method @Deprecated public androidx.fragment.app.FragmentTransaction setAllowOptimization(boolean);
+ method @Deprecated public androidx.fragment.app.FragmentTransaction setBreadCrumbShortTitle(@StringRes int);
+ method @Deprecated public androidx.fragment.app.FragmentTransaction setBreadCrumbShortTitle(CharSequence?);
+ method @Deprecated public androidx.fragment.app.FragmentTransaction setBreadCrumbTitle(@StringRes int);
+ method @Deprecated public androidx.fragment.app.FragmentTransaction setBreadCrumbTitle(CharSequence?);
+ method public androidx.fragment.app.FragmentTransaction setCustomAnimations(@AnimRes @AnimatorRes int, @AnimRes @AnimatorRes int);
+ method public androidx.fragment.app.FragmentTransaction setCustomAnimations(@AnimRes @AnimatorRes int, @AnimRes @AnimatorRes int, @AnimRes @AnimatorRes int, @AnimRes @AnimatorRes int);
+ method public androidx.fragment.app.FragmentTransaction setMaxLifecycle(androidx.fragment.app.Fragment, androidx.lifecycle.Lifecycle.State);
+ method public androidx.fragment.app.FragmentTransaction setPrimaryNavigationFragment(androidx.fragment.app.Fragment?);
+ method public androidx.fragment.app.FragmentTransaction setReorderingAllowed(boolean);
+ method public androidx.fragment.app.FragmentTransaction setTransition(int);
+ method @Deprecated public androidx.fragment.app.FragmentTransaction setTransitionStyle(@StyleRes int);
+ method public androidx.fragment.app.FragmentTransaction show(androidx.fragment.app.Fragment);
+ field public static final int TRANSIT_ENTER_MASK = 4096; // 0x1000
+ field public static final int TRANSIT_EXIT_MASK = 8192; // 0x2000
+ field public static final int TRANSIT_FRAGMENT_CLOSE = 8194; // 0x2002
+ field public static final int TRANSIT_FRAGMENT_FADE = 4099; // 0x1003
+ field public static final int TRANSIT_FRAGMENT_OPEN = 4097; // 0x1001
+ field public static final int TRANSIT_NONE = 0; // 0x0
+ field public static final int TRANSIT_UNSET = -1; // 0xffffffff
+ }
+
+ @RestrictTo(androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP_PREFIX) public abstract class FragmentTransitionImpl {
+ ctor public FragmentTransitionImpl();
+ method public abstract void addTarget(Object!, android.view.View!);
+ method public abstract void addTargets(Object!, java.util.ArrayList<android.view.View!>!);
+ method public abstract void beginDelayedTransition(android.view.ViewGroup!, Object!);
+ method protected static void bfsAddViewChildren(java.util.List<android.view.View!>!, android.view.View!);
+ method public abstract boolean canHandle(Object!);
+ method public abstract Object! cloneTransition(Object!);
+ method protected void getBoundsOnScreen(android.view.View!, android.graphics.Rect!);
+ method protected static boolean isNullOrEmpty(java.util.List!);
+ method public abstract Object! mergeTransitionsInSequence(Object!, Object!, Object!);
+ method public abstract Object! mergeTransitionsTogether(Object!, Object!, Object!);
+ method public abstract void removeTarget(Object!, android.view.View!);
+ method public abstract void replaceTargets(Object!, java.util.ArrayList<android.view.View!>!, java.util.ArrayList<android.view.View!>!);
+ method public abstract void scheduleHideFragmentView(Object!, android.view.View!, java.util.ArrayList<android.view.View!>!);
+ method public abstract void scheduleRemoveTargets(Object!, Object!, java.util.ArrayList<android.view.View!>!, Object!, java.util.ArrayList<android.view.View!>!, Object!, java.util.ArrayList<android.view.View!>!);
+ method public abstract void setEpicenter(Object!, android.view.View!);
+ method public abstract void setEpicenter(Object!, android.graphics.Rect!);
+ method public void setListenerForTransitionEnd(androidx.fragment.app.Fragment, Object, androidx.core.os.CancellationSignal, Runnable);
+ method public abstract void setSharedElementTargets(Object!, android.view.View!, java.util.ArrayList<android.view.View!>!);
+ method public abstract void swapSharedElementTargets(Object!, java.util.ArrayList<android.view.View!>!, java.util.ArrayList<android.view.View!>!);
+ method public abstract Object! wrapTransitionInSet(Object!);
+ }
+
+ public class ListFragment extends androidx.fragment.app.Fragment {
+ ctor public ListFragment();
+ method public android.widget.ListAdapter? getListAdapter();
+ method public android.widget.ListView getListView();
+ method public long getSelectedItemId();
+ method public int getSelectedItemPosition();
+ method public void onListItemClick(android.widget.ListView, android.view.View, int, long);
+ method public final android.widget.ListAdapter requireListAdapter();
+ method public void setEmptyText(CharSequence?);
+ method public void setListAdapter(android.widget.ListAdapter?);
+ method public void setListShown(boolean);
+ method public void setListShownNoAnimation(boolean);
+ method public void setSelection(int);
+ }
+
+}
+
diff --git a/fragment/fragment/build.gradle b/fragment/fragment/build.gradle
index 83e2701..a6c2996 100644
--- a/fragment/fragment/build.gradle
+++ b/fragment/fragment/build.gradle
@@ -37,11 +37,11 @@
api("androidx.collection:collection:1.1.0")
api("androidx.viewpager:viewpager:1.0.0")
api("androidx.loader:loader:1.0.0")
- api(project(":activity:activity"))
- api(project(":lifecycle:lifecycle-livedata-core"))
- api(project(":lifecycle:lifecycle-viewmodel"))
- api(project(":lifecycle:lifecycle-viewmodel-savedstate"))
- api(project(":savedstate:savedstate"))
+ api(projectOrArtifact(":activity:activity"))
+ api(projectOrArtifact(":lifecycle:lifecycle-livedata-core"))
+ api(projectOrArtifact(":lifecycle:lifecycle-viewmodel"))
+ api(projectOrArtifact(":lifecycle:lifecycle-viewmodel-savedstate"))
+ api(projectOrArtifact(":savedstate:savedstate"))
api("androidx.annotation:annotation-experimental:1.0.0")
androidTestImplementation("androidx.appcompat:appcompat:1.1.0", {
diff --git a/fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentAnimatorTest.kt b/fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentAnimatorTest.kt
index 9967219..0e89bd8b 100644
--- a/fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentAnimatorTest.kt
+++ b/fragment/fragment/src/androidTest/java/androidx/fragment/app/FragmentAnimatorTest.kt
@@ -71,6 +71,44 @@
assertEnterPopExit(fragment)
}
+ // Ensure Fragments using default transits make it to resumed
+ @Test
+ fun defaultTransitionAddReorderedTrue() {
+ val fm = activityRule.activity.supportFragmentManager
+
+ val fragment = AnimatorFragment()
+ fm.beginTransaction()
+ .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
+ .add(R.id.fragmentContainer, fragment)
+ .addToBackStack(null)
+ .setReorderingAllowed(true)
+ .commit()
+ activityRule.waitForExecution()
+
+ assertThat(fragment.resumeLatch.await(1000, TimeUnit.MILLISECONDS)).isTrue()
+ assertThat(fragment.mView.visibility).isEqualTo(View.VISIBLE)
+ assertThat(fragment.mView.alpha).isEqualTo(1f)
+ }
+
+ // Ensure Fragments using default transits make it to resumed
+ @Test
+ fun defaultTransitionAddReorderedFalse() {
+ val fm = activityRule.activity.supportFragmentManager
+
+ val fragment = AnimatorFragment()
+ fm.beginTransaction()
+ .setTransition(FragmentTransaction.TRANSIT_FRAGMENT_OPEN)
+ .add(R.id.fragmentContainer, fragment)
+ .addToBackStack(null)
+ .setReorderingAllowed(false)
+ .commit()
+ activityRule.waitForExecution()
+
+ assertThat(fragment.resumeLatch.await(1000, TimeUnit.MILLISECONDS)).isTrue()
+ assertThat(fragment.mView.visibility).isEqualTo(View.VISIBLE)
+ assertThat(fragment.mView.alpha).isEqualTo(1f)
+ }
+
// Ensure that removing and popping a Fragment uses the exit and popEnter animators
@Test
fun removeAnimators() {
@@ -650,6 +688,7 @@
var wasStarted: Boolean = false
lateinit var cancelLatch: CountDownLatch
lateinit var endLatch: CountDownLatch
+ var resumeLatch = CountDownLatch(1)
var initialized: Boolean = false
override fun onCreateAnimator(
@@ -682,6 +721,11 @@
baseAnimator = this
initialized = true
}
+
+ override fun onResume() {
+ super.onResume()
+ resumeLatch.countDown()
+ }
}
companion object {
diff --git a/fragment/gradle b/fragment/gradle
new file mode 120000
index 0000000..1c936b3
--- /dev/null
+++ b/fragment/gradle
@@ -0,0 +1 @@
+../playground-common/gradle
\ No newline at end of file
diff --git a/fragment/gradle.properties b/fragment/gradle.properties
new file mode 120000
index 0000000..d952fb0
--- /dev/null
+++ b/fragment/gradle.properties
@@ -0,0 +1 @@
+../playground-common/androidx-shared.properties
\ No newline at end of file
diff --git a/fragment/gradlew b/fragment/gradlew
new file mode 120000
index 0000000..05b75179
--- /dev/null
+++ b/fragment/gradlew
@@ -0,0 +1 @@
+../playground-common/gradlew
\ No newline at end of file
diff --git a/fragment/gradlew.bat b/fragment/gradlew.bat
new file mode 120000
index 0000000..b20877e
--- /dev/null
+++ b/fragment/gradlew.bat
@@ -0,0 +1 @@
+../playground-common/gradlew.bat
\ No newline at end of file
diff --git a/fragment/settings.gradle b/fragment/settings.gradle
new file mode 100644
index 0000000..c70eef1
--- /dev/null
+++ b/fragment/settings.gradle
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// see ../playground-common/README.md for details on how this works
+rootProject.name = "paging-playground"
+apply from: "../playground-common/playground-include-settings.gradle"
+setupPlayground(this, "..")
+selectProjectsFromAndroidX({ name ->
+ if (name.startsWith(":fragment")) return true
+ if (name.startsWith(":internal-testutils-runtime")) return true
+ if (name.startsWith(":internal-testutils-truth")) return true
+ return false
+})
diff --git a/media/media/api/current.txt b/media/media/api/current.txt
index 5826322..a898f72 100644
--- a/media/media/api/current.txt
+++ b/media/media/api/current.txt
@@ -709,6 +709,8 @@
package androidx.media.utils {
public final class MediaConstants {
+ field public static final String BROWSER_ROOT_HINTS_KEY_ROOT_CHILDREN_LIMIT = "androidx.media.MediaBrowserCompat.Extras.KEY_ROOT_CHILDREN_LIMIT";
+ field public static final String BROWSER_ROOT_HINTS_KEY_ROOT_CHILDREN_SUPPORTED_FLAGS = "androidx.media.MediaBrowserCompat.Extras.KEY_ROOT_CHILDREN_SUPPORTED_FLAGS";
field public static final String METADATA_KEY_CONTENT_ID = "androidx.media.MediaMetadatCompat.METADATA_KEY_CONTENT_ID";
field public static final String PLAYBACK_STATE_EXTRAS_KEY_MEDIA_ID = "androidx.media.PlaybackStateCompat.Extras.KEY_MEDIA_ID";
field public static final String SESSION_EXTRAS_KEY_ACCOUNT_NAME = "androidx.media.MediaSessionCompat.Extras.KEY_ACCOUNT_NAME";
diff --git a/media/media/api/public_plus_experimental_current.txt b/media/media/api/public_plus_experimental_current.txt
index 33eca6b..e38ab5e 100644
--- a/media/media/api/public_plus_experimental_current.txt
+++ b/media/media/api/public_plus_experimental_current.txt
@@ -709,6 +709,8 @@
package androidx.media.utils {
public final class MediaConstants {
+ field public static final String BROWSER_ROOT_HINTS_KEY_ROOT_CHILDREN_LIMIT = "androidx.media.MediaBrowserCompat.Extras.KEY_ROOT_CHILDREN_LIMIT";
+ field public static final String BROWSER_ROOT_HINTS_KEY_ROOT_CHILDREN_SUPPORTED_FLAGS = "androidx.media.MediaBrowserCompat.Extras.KEY_ROOT_CHILDREN_SUPPORTED_FLAGS";
field public static final String METADATA_KEY_CONTENT_ID = "androidx.media.MediaMetadatCompat.METADATA_KEY_CONTENT_ID";
field public static final String PLAYBACK_STATE_EXTRAS_KEY_MEDIA_ID = "androidx.media.PlaybackStateCompat.Extras.KEY_MEDIA_ID";
field public static final String SESSION_EXTRAS_KEY_ACCOUNT_NAME = "androidx.media.MediaSessionCompat.Extras.KEY_ACCOUNT_NAME";
diff --git a/media/media/api/restricted_current.txt b/media/media/api/restricted_current.txt
index 9d6f904..dc43398 100644
--- a/media/media/api/restricted_current.txt
+++ b/media/media/api/restricted_current.txt
@@ -741,6 +741,8 @@
package androidx.media.utils {
public final class MediaConstants {
+ field public static final String BROWSER_ROOT_HINTS_KEY_ROOT_CHILDREN_LIMIT = "androidx.media.MediaBrowserCompat.Extras.KEY_ROOT_CHILDREN_LIMIT";
+ field public static final String BROWSER_ROOT_HINTS_KEY_ROOT_CHILDREN_SUPPORTED_FLAGS = "androidx.media.MediaBrowserCompat.Extras.KEY_ROOT_CHILDREN_SUPPORTED_FLAGS";
field public static final String METADATA_KEY_CONTENT_ID = "androidx.media.MediaMetadatCompat.METADATA_KEY_CONTENT_ID";
field public static final String PLAYBACK_STATE_EXTRAS_KEY_MEDIA_ID = "androidx.media.PlaybackStateCompat.Extras.KEY_MEDIA_ID";
field public static final String SESSION_EXTRAS_KEY_ACCOUNT_NAME = "androidx.media.MediaSessionCompat.Extras.KEY_ACCOUNT_NAME";
diff --git a/media/media/src/main/java/androidx/media/utils/MediaConstants.java b/media/media/src/main/java/androidx/media/utils/MediaConstants.java
index 55275d9..a5e88a5 100644
--- a/media/media/src/main/java/androidx/media/utils/MediaConstants.java
+++ b/media/media/src/main/java/androidx/media/utils/MediaConstants.java
@@ -19,21 +19,25 @@
import static androidx.annotation.RestrictTo.Scope.LIBRARY;
import android.annotation.SuppressLint;
+import android.content.ComponentName;
+import android.content.Context;
+import android.os.Bundle;
+import android.support.v4.media.MediaBrowserCompat;
+import android.support.v4.media.MediaBrowserCompat.ConnectionCallback;
import android.support.v4.media.MediaMetadataCompat;
import android.support.v4.media.session.MediaControllerCompat;
import android.support.v4.media.session.MediaSessionCompat;
import android.support.v4.media.session.PlaybackStateCompat;
import androidx.annotation.RestrictTo;
+import androidx.media.MediaBrowserServiceCompat;
-/**
- * Media constants for sharing constants between media provider and consumer apps
- */
+/** Media constants for sharing constants between media provider and consumer apps */
public final class MediaConstants {
/**
* Bundle key used for the account name in {@link MediaSessionCompat session} extras.
*
- * <p>TYPE: String</p>
+ * <p>TYPE: String
*
* @see MediaControllerCompat#getExtras
* @see MediaSessionCompat#setExtras
@@ -42,10 +46,10 @@
public static final String SESSION_EXTRAS_KEY_ACCOUNT_NAME =
"androidx.media.MediaSessionCompat.Extras.KEY_ACCOUNT_NAME";
/**
- * Bundle key used for the account type in {@link MediaSessionCompat session} extras.
- * The value would vary across media applications.
+ * Bundle key used for the account type in {@link MediaSessionCompat session} extras. The value
+ * would vary across media applications.
*
- * <p>TYPE: String</p>
+ * <p>TYPE: String
*
* @see MediaControllerCompat#getExtras
* @see MediaSessionCompat#setExtras
@@ -55,10 +59,9 @@
"androidx.media.MediaSessionCompat.Extras.KEY_ACCOUNT_TYPE";
/**
* Bundle key used for the account auth token value in {@link MediaSessionCompat session}
- * extras.
- * The value would vary across media applications.
+ * extras. The value would vary across media applications.
*
- * <p>TYPE: byte[]</p>
+ * <p>TYPE: byte[]
*
* @see MediaControllerCompat#getExtras
* @see MediaSessionCompat#setExtras
@@ -74,7 +77,7 @@
* for associating the playback state with the media being played so the value is expected to be
* same with {@link MediaMetadataCompat#METADATA_KEY_MEDIA_ID media id} of the current metadata.
*
- * <p>TYPE: String</p>
+ * <p>TYPE: String
*
* @see PlaybackStateCompat#getExtras
* @see PlaybackStateCompat.Builder#setExtras
@@ -86,10 +89,10 @@
/**
* Bundle key used for media content id in {@link MediaMetadataCompat metadata}, should contain
* the same ID provided to Media Actions Catalog in reference to this title (e.g., episode,
- * movie). Google uses this information to allow users to resume watching this title on your
- * app across the supported surfaces (e.g., Android TV's Play Next row)
+ * movie). Google uses this information to allow users to resume watching this title on your app
+ * across the supported surfaces (e.g., Android TV's Play Next row)
*
- * <p>TYPE: String</p>
+ * <p>TYPE: String
*
* @see MediaMetadataCompat
*/
@@ -97,5 +100,40 @@
public static final String METADATA_KEY_CONTENT_ID =
"androidx.media.MediaMetadatCompat.METADATA_KEY_CONTENT_ID";
+ /**
+ * Bundle key passed through root hints to the {@link MediaBrowserServiceCompat} to indicate the
+ * maximum number of children of the root node that can be supported by the hosting {@link
+ * MediaBrowserCompat}. Excess root children may be omitted or made less discoverable by the
+ * host.
+ *
+ * <p>TYPE: int
+ *
+ * @see MediaBrowserServiceCompat#onGetRoot(String, int, Bundle)
+ * @see MediaBrowserServiceCompat#getBrowserRootHints()
+ * @see MediaBrowserCompat#MediaBrowserCompat(Context,ComponentName,ConnectionCallback,Bundle)
+ */
+ @SuppressLint("IntentName")
+ public static final String BROWSER_ROOT_HINTS_KEY_ROOT_CHILDREN_LIMIT =
+ "androidx.media.MediaBrowserCompat.Extras.KEY_ROOT_CHILDREN_LIMIT";
+
+ /**
+ * Bundle key passed through root hints to the {@link MediaBrowserServiceCompat} to indicate
+ * which flags exposed by {@link MediaBrowserCompat.MediaItem#getFlags()} from children of the
+ * root node are supported by the hosting {@link MediaBrowserCompat}. Root children with
+ * unsupported flags may be omitted or made less discoverable by the host.
+ *
+ * <p>TYPE: int, a bit field which can be used as a mask. For example, if the value masked
+ * (using bitwise AND) with {@link MediaBrowserCompat.MediaItem#FLAG_BROWSABLE} is nonzero, then
+ * the host supports browsable root children. Conversely, if the masked result is zero, then the
+ * host does not support them.
+ *
+ * @see MediaBrowserServiceCompat#onGetRoot(String, int, Bundle)
+ * @see MediaBrowserServiceCompat#getBrowserRootHints()
+ * @see MediaBrowserCompat#MediaBrowserCompat(Context,ComponentName,ConnectionCallback,Bundle)
+ */
+ @SuppressLint("IntentName")
+ public static final String BROWSER_ROOT_HINTS_KEY_ROOT_CHILDREN_SUPPORTED_FLAGS =
+ "androidx.media.MediaBrowserCompat.Extras.KEY_ROOT_CHILDREN_SUPPORTED_FLAGS";
+
private MediaConstants() {}
}
diff --git a/navigation/.idea/codeStyles/Project.xml b/navigation/.idea/codeStyles/Project.xml
new file mode 120000
index 0000000..b52b28c
--- /dev/null
+++ b/navigation/.idea/codeStyles/Project.xml
@@ -0,0 +1 @@
+../../../.idea/codeStyles/Project.xml
\ No newline at end of file
diff --git a/navigation/.idea/codeStyles/codeStyleConfig.xml b/navigation/.idea/codeStyles/codeStyleConfig.xml
new file mode 120000
index 0000000..19c4848
--- /dev/null
+++ b/navigation/.idea/codeStyles/codeStyleConfig.xml
@@ -0,0 +1 @@
+../../../.idea/codeStyles/codeStyleConfig.xml
\ No newline at end of file
diff --git a/navigation/.idea/copyright/AndroidCopyright.xml b/navigation/.idea/copyright/AndroidCopyright.xml
new file mode 120000
index 0000000..afbbd04
--- /dev/null
+++ b/navigation/.idea/copyright/AndroidCopyright.xml
@@ -0,0 +1 @@
+../../../.idea/copyright/AndroidCopyright.xml
\ No newline at end of file
diff --git a/navigation/.idea/copyright/profiles_settings.xml b/navigation/.idea/copyright/profiles_settings.xml
new file mode 120000
index 0000000..5996ccd
--- /dev/null
+++ b/navigation/.idea/copyright/profiles_settings.xml
@@ -0,0 +1 @@
+../../../.idea/copyright/profiles_settings.xml
\ No newline at end of file
diff --git a/navigation/.idea/inspectionProfiles/Project_Default.xml b/navigation/.idea/inspectionProfiles/Project_Default.xml
new file mode 120000
index 0000000..a7481f4
--- /dev/null
+++ b/navigation/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1 @@
+../../../.idea/inspectionProfiles/Project_Default.xml
\ No newline at end of file
diff --git a/navigation/.idea/scopes/Ignore_API_Files.xml b/navigation/.idea/scopes/Ignore_API_Files.xml
new file mode 120000
index 0000000..3361ee1
--- /dev/null
+++ b/navigation/.idea/scopes/Ignore_API_Files.xml
@@ -0,0 +1 @@
+../../../.idea/scopes/Ignore_API_Files.xml
\ No newline at end of file
diff --git a/navigation/.idea/scopes/buildSrc.xml b/navigation/.idea/scopes/buildSrc.xml
new file mode 120000
index 0000000..25b7d3b
--- /dev/null
+++ b/navigation/.idea/scopes/buildSrc.xml
@@ -0,0 +1 @@
+../../../.idea/scopes/buildSrc.xml
\ No newline at end of file
diff --git a/navigation/benchmark/build.gradle b/navigation/benchmark/build.gradle
index 556e758..1bf4bf51 100644
--- a/navigation/benchmark/build.gradle
+++ b/navigation/benchmark/build.gradle
@@ -26,7 +26,7 @@
}
dependencies {
- androidTestImplementation(project(":benchmark:benchmark-junit4"))
+ androidTestImplementation(projectOrArtifact(":benchmark:benchmark-junit4"))
androidTestImplementation(project(":navigation:navigation-runtime"))
androidTestImplementation(project(":internal-testutils-navigation"))
androidTestImplementation(JUNIT)
diff --git a/navigation/gradle b/navigation/gradle
new file mode 120000
index 0000000..1c936b3
--- /dev/null
+++ b/navigation/gradle
@@ -0,0 +1 @@
+../playground-common/gradle
\ No newline at end of file
diff --git a/navigation/gradle.properties b/navigation/gradle.properties
new file mode 120000
index 0000000..d952fb0
--- /dev/null
+++ b/navigation/gradle.properties
@@ -0,0 +1 @@
+../playground-common/androidx-shared.properties
\ No newline at end of file
diff --git a/navigation/gradlew b/navigation/gradlew
new file mode 120000
index 0000000..05b75179
--- /dev/null
+++ b/navigation/gradlew
@@ -0,0 +1 @@
+../playground-common/gradlew
\ No newline at end of file
diff --git a/navigation/gradlew.bat b/navigation/gradlew.bat
new file mode 120000
index 0000000..b20877e
--- /dev/null
+++ b/navigation/gradlew.bat
@@ -0,0 +1 @@
+../playground-common/gradlew.bat
\ No newline at end of file
diff --git a/navigation/navigation-fragment-ktx/build.gradle b/navigation/navigation-fragment-ktx/build.gradle
index d7c0ce4..545ac3e 100644
--- a/navigation/navigation-fragment-ktx/build.gradle
+++ b/navigation/navigation-fragment-ktx/build.gradle
@@ -33,7 +33,7 @@
api("androidx.fragment:fragment-ktx:1.2.4")
api("androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0")
api(KOTLIN_STDLIB)
- androidTestImplementation(project(":fragment:fragment-testing"))
+ androidTestImplementation(projectOrArtifact(":fragment:fragment-testing"))
androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
androidTestImplementation(ANDROIDX_TEST_CORE)
androidTestImplementation(ANDROIDX_TEST_RUNNER)
diff --git a/navigation/navigation-runtime/build.gradle b/navigation/navigation-runtime/build.gradle
index 92fb7b6..718f4f9 100644
--- a/navigation/navigation-runtime/build.gradle
+++ b/navigation/navigation-runtime/build.gradle
@@ -34,7 +34,7 @@
api("androidx.savedstate:savedstate:1.0.0")
api("androidx.lifecycle:lifecycle-viewmodel-savedstate:2.2.0")
- androidTestImplementation(project(":lifecycle:lifecycle-runtime-testing"))
+ androidTestImplementation(projectOrArtifact(":lifecycle:lifecycle-runtime-testing"))
androidTestImplementation(project(":internal-testutils-navigation"))
androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
androidTestImplementation(ANDROIDX_TEST_CORE)
diff --git a/navigation/settings.gradle b/navigation/settings.gradle
new file mode 100644
index 0000000..fdeeda2
--- /dev/null
+++ b/navigation/settings.gradle
@@ -0,0 +1,28 @@
+/*
+ * Copyright 2020 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// see ../playground-common/README.md for details on how this works
+rootProject.name = "navigation-playground"
+apply from: "../playground-common/playground-include-settings.gradle"
+setupPlayground(this, "..")
+selectProjectsFromAndroidX({ name ->
+ if (name.startsWith(":navigation")) return true
+ if (name.startsWith(":internal-testutils-navigation")) return true
+ if (name.startsWith(":internal-testutils-runtime")) return true
+ if (name.startsWith(":internal-testutils-truth")) return true
+ return false
+})
+
diff --git a/preference/preference/res/layout/preference_widget_seekbar_material.xml b/preference/preference/res/layout/preference_widget_seekbar_material.xml
index 1850267..a900b2d 100644
--- a/preference/preference/res/layout/preference_widget_seekbar_material.xml
+++ b/preference/preference/res/layout/preference_widget_seekbar_material.xml
@@ -49,6 +49,7 @@
<TextView
android:id="@android:id/title"
+ android:labelFor="@id/seekbar"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:singleLine="true"
diff --git a/room/compiler/src/main/kotlin/androidx/room/processor/DaoProcessor.kt b/room/compiler/src/main/kotlin/androidx/room/processor/DaoProcessor.kt
index 848239d..d6769c1 100644
--- a/room/compiler/src/main/kotlin/androidx/room/processor/DaoProcessor.kt
+++ b/room/compiler/src/main/kotlin/androidx/room/processor/DaoProcessor.kt
@@ -142,14 +142,21 @@
).process()
}
- // TODO (b/169950251): avoid going through the matching logic if the interface does not
- // extend another one
+ // Only try to find kotlin boxed delegating methods when the dao extends a class or
+ // implements an interface since otherwise there are no duplicated method generated by
+ // Kotlin.
val unannotatedMethods = methods[Any::class] ?: emptyList<XMethodElement>()
- val allAnnotatedMethods = methods.values.flatten() - unannotatedMethods
- val delegatingMethods = matchKotlinBoxedPrimitiveMethods(
- unannotatedMethods,
- annotatedMethods = allAnnotatedMethods
- )
+ val delegatingMethods =
+ if (element.superType != null ||
+ element.getSuperInterfaceElements().isNotEmpty()
+ ) {
+ matchKotlinBoxedPrimitiveMethods(
+ unannotatedMethods,
+ methods.values.flatten() - unannotatedMethods
+ )
+ } else {
+ emptyList()
+ }
val kotlinDefaultMethodDelegates = if (element.isInterface()) {
val allProcessedMethods =
@@ -181,16 +188,16 @@
null
}
- (unannotatedMethods - delegatingMethods.map { it.element }).forEach { method ->
- context.logger.e(method, ProcessorErrors.INVALID_ANNOTATION_COUNT_IN_DAO_METHOD)
- }
-
val type = declaredType.typeName
context.checker.notUnbound(
type, element,
ProcessorErrors.CANNOT_USE_UNBOUND_GENERICS_IN_DAO_CLASSES
)
+ (unannotatedMethods - delegatingMethods.map { it.element }).forEach { method ->
+ context.logger.e(method, ProcessorErrors.INVALID_ANNOTATION_COUNT_IN_DAO_METHOD)
+ }
+
return Dao(
element = element,
type = declaredType,
diff --git a/settings.gradle b/settings.gradle
index 66066f8..c5a0424 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -90,6 +90,7 @@
includeProject(":benchmark:benchmark-gradle-plugin", "benchmark/gradle-plugin")
includeProject(":benchmark:benchmark-junit4", "benchmark/junit4")
includeProject(":benchmark:benchmark-macro", "benchmark/macro")
+includeProject(":benchmark:benchmark-macro-runtime", "benchmark/benchmark-macro-runtime")
includeProject(":benchmark:benchmark-perfetto", "benchmark/perfetto")
includeProject(":benchmark:integration-tests:dry-run-benchmark", "benchmark/integration-tests/dry-run-benchmark")
includeProject(":benchmark:integration-tests:startup-benchmark", "benchmark/integration-tests/startup-benchmark")
diff --git a/ui/settings.gradle b/ui/settings.gradle
index 927eed9..b4866b9 100644
--- a/ui/settings.gradle
+++ b/ui/settings.gradle
@@ -34,6 +34,12 @@
project(name).projectDir = file
}
+def isMultiplatformEnabled() {
+ def mppParameter = startParameter.projectProperties.get("androidx.compose.multiplatformEnabled")
+ if (mppParameter == null) return false
+ return Boolean.parseBoolean(mppParameter)
+}
+
includeProject(":annotation", "../annotation")
includeProject(":annotation:annotation-experimental", "../annotation/annotation-experimental")
includeProject(":annotation:annotation-experimental-lint", "../annotation/annotation-experimental-lint")
@@ -55,7 +61,7 @@
includeProject(":compose:compiler:compiler", "../compose/compiler/compiler")
includeProject(":compose:compiler:compiler-hosted", "../compose/compiler/compiler-hosted")
includeProject(":compose:compiler:compiler-hosted:integration-tests", "../compose/compiler/compiler-hosted/integration-tests")
-if (!startParameter.projectProperties.containsKey('compose.desktop.disable')) {
+if (isMultiplatformEnabled()) {
includeProject(":compose:desktop", "../compose/desktop")
includeProject(":compose:desktop:desktop", "../compose/desktop/desktop")
includeProject(":compose:desktop:desktop:desktop-samples", "../compose/desktop/desktop/samples")
diff --git a/ui/ui-test/build.gradle b/ui/ui-test/build.gradle
index e37d1f853..ba9ef2b 100644
--- a/ui/ui-test/build.gradle
+++ b/ui/ui-test/build.gradle
@@ -14,6 +14,8 @@
* limitations under the License.
*/
+
+import androidx.build.AndroidXUiPlugin
import androidx.build.LibraryGroups
import androidx.build.LibraryVersions
import androidx.build.Publish
@@ -25,77 +27,125 @@
id("AndroidXPlugin")
id("com.android.library")
id("AndroidXUiPlugin")
- id("kotlin-multiplatform")
}
+AndroidXUiPlugin.applyAndConfigureKotlinPlugin(project)
+
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
+
+ if(!AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ api project(":compose:animation:animation-core")
+ api project(":compose:runtime:runtime-dispatch")
+ api project(":compose:ui:ui")
+ api project(":compose:ui:ui-geometry")
+ api project(":compose:ui:ui-text")
+ api project(":compose:ui:ui-unit")
+ api project(":compose:ui:ui-util")
+ api "androidx.activity:activity:1.2.0-alpha02"
+ api(ANDROIDX_TEST_EXT_JUNIT)
+ api(JUNIT)
+ api(ANDROIDX_TEST_EXT_JUNIT)
+ api "androidx.activity:activity:1.2.0-alpha02"
+ api project(":compose:runtime:runtime")
+ api project(":compose:ui:ui-graphics")
+ api project(":compose:ui:ui")
+
+ implementation(KOTLIN_STDLIB)
+ implementation(ANDROIDX_TEST_RULES)
+ implementation(ANDROIDX_TEST_RUNNER)
+ implementation(ESPRESSO_CORE)
+ implementation(JUNIT)
+ implementation "androidx.collection:collection:1.1.0"
+ implementation(JUNIT)
+ implementation project(":compose:runtime:runtime")
+ implementation project(":compose:animation:animation")
+ implementation project(":compose:foundation:foundation")
+ implementation project(":compose:foundation:foundation-layout")
+ implementation project(":compose:ui:ui-util")
+ implementation project(":compose:foundation:foundation-text")
+ implementation project(":compose:runtime:runtime-saved-instance-state")
+
+ testImplementation(TRUTH)
+
+ androidTestImplementation(TRUTH)
+ androidTestImplementation project(":compose:ui:ui")
+ androidTestImplementation project(':compose:material:material')
+ androidTestImplementation(MOCKITO_CORE, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
+ androidTestImplementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
+ androidTestImplementation MOCKITO_KOTLIN, {
+ exclude group: 'org.mockito' // to keep control on the mockito version
+ }
+ }
}
-kotlin {
- android()
- jvm("desktop")
- sourceSets {
- commonMain.dependencies {
- api project(":compose:animation:animation-core")
- api project(":compose:runtime:runtime-dispatch")
- api project(":compose:ui:ui")
- api project(":compose:ui:ui-geometry")
- api project(":compose:ui:ui-text")
- api project(":compose:ui:ui-unit")
- api project(":compose:ui:ui-util")
+if(AndroidXUiPlugin.isMultiplatformEnabled(project)) {
+ kotlin {
+ android()
+ jvm("desktop")
- implementation(KOTLIN_STDLIB_COMMON)
- implementation project(":compose:animation:animation")
- implementation project(":compose:foundation:foundation")
- implementation project(":compose:foundation:foundation-layout")
- implementation project(":compose:foundation:foundation-text")
- implementation project(":compose:runtime:runtime")
- implementation project(":compose:runtime:runtime-saved-instance-state")
- }
+ sourceSets {
+ commonMain.dependencies {
+ api project(":compose:animation:animation-core")
+ api project(":compose:runtime:runtime-dispatch")
+ api project(":compose:ui:ui")
+ api project(":compose:ui:ui-geometry")
+ api project(":compose:ui:ui-text")
+ api project(":compose:ui:ui-unit")
+ api project(":compose:ui:ui-util")
- jvmMain.dependencies {
- implementation "androidx.collection:collection:1.1.0"
- implementation(JUNIT)
- }
-
- androidMain.dependencies {
- api(JUNIT)
- api(ANDROIDX_TEST_EXT_JUNIT)
- api "androidx.activity:activity:1.2.0-alpha02"
- api project(":compose:runtime:runtime")
- api project(":compose:ui:ui-graphics")
-
- implementation(ANDROIDX_TEST_RULES)
- implementation(ANDROIDX_TEST_RUNNER)
- implementation(ESPRESSO_CORE)
- }
-
- test.dependencies {
- implementation(TRUTH)
- }
-
- androidAndroidTest.dependencies {
- implementation(TRUTH)
- implementation project(':compose:material:material')
- implementation project(":compose:ui:ui")
-
- implementation(MOCKITO_CORE, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
- implementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
- implementation MOCKITO_KOTLIN, {
- exclude group: 'org.mockito' // to keep control on the mockito version
+ implementation(KOTLIN_STDLIB_COMMON)
+ implementation project(":compose:animation:animation")
+ implementation project(":compose:foundation:foundation")
+ implementation project(":compose:foundation:foundation-layout")
+ implementation project(":compose:foundation:foundation-text")
+ implementation project(":compose:runtime:runtime")
+ implementation project(":compose:runtime:runtime-saved-instance-state")
}
- }
- desktopMain.dependencies {
- implementation(JUNIT)
- implementation(TRUTH)
- implementation(SKIKO)
- }
+ jvmMain.dependencies {
+ implementation "androidx.collection:collection:1.1.0"
+ implementation(JUNIT)
+ }
- desktopMain.dependsOn jvmMain
- jvmMain.dependsOn commonMain
+ androidMain.dependencies {
+ api(JUNIT)
+ api(ANDROIDX_TEST_EXT_JUNIT)
+ api "androidx.activity:activity:1.2.0-alpha02"
+ api project(":compose:runtime:runtime")
+ api project(":compose:ui:ui-graphics")
+
+ implementation(ANDROIDX_TEST_RULES)
+ implementation(ANDROIDX_TEST_RUNNER)
+ implementation(ESPRESSO_CORE)
+ }
+
+ test.dependencies {
+ implementation(TRUTH)
+ }
+
+ androidAndroidTest.dependencies {
+ implementation(TRUTH)
+ implementation project(':compose:material:material')
+ implementation project(":compose:ui:ui")
+
+ implementation(MOCKITO_CORE, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
+ implementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
+ implementation MOCKITO_KOTLIN, {
+ exclude group: 'org.mockito' // to keep control on the mockito version
+ }
+ }
+
+ desktopMain.dependencies {
+ implementation(JUNIT)
+ implementation(TRUTH)
+ implementation(SKIKO)
+ }
+
+ desktopMain.dependsOn jvmMain
+ jvmMain.dependsOn commonMain
+ }
}
}
diff --git a/ui/ui-tooling/build.gradle b/ui/ui-tooling/build.gradle
index e6c2c1c..1d482fd 100644
--- a/ui/ui-tooling/build.gradle
+++ b/ui/ui-tooling/build.gradle
@@ -29,7 +29,7 @@
}
dependencies {
- kotlinPlugin project(path: ":compose:compiler:compiler")
+ kotlinPlugin project(":compose:compiler:compiler")
implementation(KOTLIN_STDLIB)
diff --git a/ui/ui-tooling/src/androidTest/java/androidx/ui/tooling/inspector/ParameterFactoryTest.kt b/ui/ui-tooling/src/androidTest/java/androidx/ui/tooling/inspector/ParameterFactoryTest.kt
index 6000d3a..dbbd2a5 100644
--- a/ui/ui-tooling/src/androidTest/java/androidx/ui/tooling/inspector/ParameterFactoryTest.kt
+++ b/ui/ui-tooling/src/androidTest/java/androidx/ui/tooling/inspector/ParameterFactoryTest.kt
@@ -405,13 +405,14 @@
parameter("width", ParameterType.DimensionDp, 5.0f)
}
parameter("padding", ParameterType.DimensionDp, 2.0f)
- parameter("fillMaxWidth", ParameterType.String, "")
+ parameter("fillMaxWidth", ParameterType.String, "") {
+ parameter("fraction", ParameterType.Float, 1.0f)
+ }
parameter("wrapContentHeight", ParameterType.String, "") {
- parameter("alignment", ParameterType.String, "Bottom")
+ parameter("align", ParameterType.String, "Bottom")
+ parameter("unbounded", ParameterType.Boolean, false)
}
- parameter("preferredWidth", ParameterType.DimensionDp, 30.0f) {
- parameter("width", ParameterType.DimensionDp, 30.0f)
- }
+ parameter("preferredWidth", ParameterType.DimensionDp, 30.0f)
parameter("paint", ParameterType.String, "") {
parameter("alignment", ParameterType.String, "Center")
parameter("alpha", ParameterType.Float, 1.0f)