Merge "Semantics no-op cleanups" into androidx-master-dev
diff --git a/appsearch/appsearch/build.gradle b/appsearch/appsearch/build.gradle
index 73bf8a8..b526ab1 100644
--- a/appsearch/appsearch/build.gradle
+++ b/appsearch/appsearch/build.gradle
@@ -15,6 +15,7 @@
*/
import androidx.build.LibraryGroups
+import androidx.build.LibraryVersions
import androidx.build.Publish
import static androidx.build.dependencies.DependenciesKt.*
@@ -24,10 +25,6 @@
id('com.android.library')
}
-configurations {
- jarjarConf
-}
-
android {
compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
@@ -39,36 +36,31 @@
'proguard-android-optimize.txt'),
'proguard-rules.pro'
}
- sourceSets {
- main.java.srcDirs += '../../../../external/icing/java/src/'
- androidTest {
- java.srcDirs += '../../../../external/icing/java/tests/instrumentation'
- }
- }
- lintOptions {
- // TODO(b/160643524): Don't do this. This temporarily disables lint
- // checks that require getters and setters to have the same return
- // and input values, respectively
- disable 'KotlinPropertyAccess'
- }
+}
+
+// Add :icing:java as jarjar dependency
+android.libraryVariants.all { variant ->
+ def variantName = variant.name
+ def suffix = variantName.capitalize()
+ def jarjarConfigName = "jarjar${suffix}"
+ def jarjarConf = configurations.register(jarjarConfigName)
+ // Treat icing-java as a local jar and package it inside the aar.
+ dependencies.add(jarjarConfigName, project.dependencies.project(
+ path: ":icing:java",
+ configuration: jarjarConfigName))
+ dependencies.add("${variantName}Implementation", files(jarjarConf))
}
dependencies {
- // Treat icing-java as a local jar and package it inside the aar.
- jarjarConf project(path: ':icing:java', configuration: 'jarjarConf')
- implementation files(configurations.jarjarConf)
- compileOnly project(path: ':icing:java', configuration: 'jarjarConf')
-
api('androidx.annotation:annotation:1.1.0')
+ implementation project(':icing:nativeLib')
implementation('androidx.collection:collection:1.1.0')
implementation('androidx.concurrent:concurrent-futures:1.0.0')
implementation('androidx.core:core:1.2.0')
- implementation project(':icing:nativeLib')
androidTestAnnotationProcessor project(':appsearch:appsearch-annotation')
androidTestImplementation(ANDROIDX_TEST_CORE)
- androidTestImplementation(ANDROIDX_TEST_EXT_JUNIT)
androidTestImplementation(ANDROIDX_TEST_RULES)
androidTestImplementation(TRUTH)
//TODO(b/149787478) upgrade and link to Dependencies.kt
@@ -90,6 +82,7 @@
name = 'AndroidX AppSearch'
publish = Publish.SNAPSHOT_AND_RELEASE
mavenGroup = LibraryGroups.APPSEARCH
+ mavenVersion = LibraryVersions.APPSEARCH
inceptionYear = '2019'
description = 'AndroidX AppSearch - App Indexing'
}
diff --git a/appsearch/appsearch/src/androidTest/java/androidx/appsearch/app/AppSearchManagerTest.java b/appsearch/appsearch/src/androidTest/java/androidx/appsearch/app/AppSearchManagerTest.java
index 3943f92..048a64a 100644
--- a/appsearch/appsearch/src/androidTest/java/androidx/appsearch/app/AppSearchManagerTest.java
+++ b/appsearch/appsearch/src/androidTest/java/androidx/appsearch/app/AppSearchManagerTest.java
@@ -781,8 +781,7 @@
Future<AppSearchBatchResult<K, V>> future) throws Exception {
AppSearchBatchResult<K, V> result = future.get();
if (!result.isSuccess()) {
- throw new AssertionFailedError(
- "AppSearchBatchResult not successful: " + result.getFailures());
+ throw new AssertionFailedError("AppSearchBatchResult not successful: " + result);
}
return result;
}
@@ -791,8 +790,7 @@
Future<AppSearchResult<ValueType>> future) throws Exception {
AppSearchResult<ValueType> result = future.get();
if (!result.isSuccess()) {
- throw new AssertionFailedError(
- "AppSearchBatchResult not successful: " + result);
+ throw new AssertionFailedError("AppSearchResult not successful: " + result);
}
return result.getResultValue();
}
diff --git a/appsearch/appsearch/src/main/java/androidx/appsearch/app/AppSearchManager.java b/appsearch/appsearch/src/main/java/androidx/appsearch/app/AppSearchManager.java
index e760af4..490e55e 100644
--- a/appsearch/appsearch/src/main/java/androidx/appsearch/app/AppSearchManager.java
+++ b/appsearch/appsearch/src/main/java/androidx/appsearch/app/AppSearchManager.java
@@ -790,6 +790,6 @@
} else {
resultCode = AppSearchResult.RESULT_UNKNOWN_ERROR;
}
- return newFailedResult(resultCode, t.getMessage());
+ return newFailedResult(resultCode, t.toString());
}
}
diff --git a/biometric/biometric/build.gradle b/biometric/biometric/build.gradle
index 300c82f..558d992 100644
--- a/biometric/biometric/build.gradle
+++ b/biometric/biometric/build.gradle
@@ -26,12 +26,12 @@
dependencies {
// Public API dependencies
api("androidx.annotation:annotation:1.1.0")
+ api("androidx.core:core:1.2.0")
api("androidx.fragment:fragment:1.2.5")
// Internal dependencies
implementation("androidx.activity:activity:1.1.0")
implementation("androidx.appcompat:appcompat:1.1.0")
- implementation("androidx.core:core:1.2.0")
implementation("androidx.lifecycle:lifecycle-livedata-core:2.2.0")
implementation("androidx.lifecycle:lifecycle-viewmodel:2.2.0")
@@ -64,6 +64,8 @@
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
+
+ testOptions.unitTests.includeAndroidResources = true
}
androidx {
diff --git a/buildSrc/src/main/kotlin/androidx/build/AndroidXExtension.kt b/buildSrc/src/main/kotlin/androidx/build/AndroidXExtension.kt
index 051a48d..75e6c63 100644
--- a/buildSrc/src/main/kotlin/androidx/build/AndroidXExtension.kt
+++ b/buildSrc/src/main/kotlin/androidx/build/AndroidXExtension.kt
@@ -86,7 +86,7 @@
// add per-project overrides here
// for example
// the following project is intended to be accessed from Java
- // ":ui:ui-internal-lint-checks" -> return true
+ // ":compose:internal-lint-checks" -> return true
// the following project is not intended to be accessed from Java
// ":annotation:annotation" -> return false
}
diff --git a/buildSrc/src/main/kotlin/androidx/build/AndroidXUiPlugin.kt b/buildSrc/src/main/kotlin/androidx/build/AndroidXUiPlugin.kt
index 510ad0a..d113801 100644
--- a/buildSrc/src/main/kotlin/androidx/build/AndroidXUiPlugin.kt
+++ b/buildSrc/src/main/kotlin/androidx/build/AndroidXUiPlugin.kt
@@ -52,7 +52,7 @@
project.dependencies.add(
"lintChecks",
project.dependencies.project(mapOf(
- "path" to ":ui:ui-internal-lint-checks", "configuration" to "shadow"
+ "path" to ":compose:internal-lint-checks", "configuration" to "shadow"
))
)
diff --git a/buildSrc/src/main/kotlin/androidx/build/LibraryGroups.kt b/buildSrc/src/main/kotlin/androidx/build/LibraryGroups.kt
index b6d7479..e5215b9 100644
--- a/buildSrc/src/main/kotlin/androidx/build/LibraryGroups.kt
+++ b/buildSrc/src/main/kotlin/androidx/build/LibraryGroups.kt
@@ -97,7 +97,6 @@
val TRACING = LibraryGroup("androidx.tracing", LibraryVersions.TRACING)
val TRANSITION = LibraryGroup("androidx.transition", LibraryVersions.TRANSITION)
val TVPROVIDER = LibraryGroup("androidx.tvprovider", LibraryVersions.TVPROVIDER)
- val UI = LibraryGroup("androidx.ui", null)
val VECTORDRAWABLE = LibraryGroup("androidx.vectordrawable", null)
val VERSIONEDPARCELABLE = LibraryGroup("androidx.versionedparcelable", null)
val VIEWPAGER = LibraryGroup("androidx.viewpager", LibraryVersions.VIEWPAGER)
diff --git a/compose/android-view/placeholder.txt b/compose/android-view/placeholder.txt
new file mode 100644
index 0000000..b8f7c1a
--- /dev/null
+++ b/compose/android-view/placeholder.txt
@@ -0,0 +1,4 @@
+This file exists to make sure the directory this is in gets created by git, so that
+settings.gradle can point to this directory and not complain about it missing.
+
+TODO: b/160233169 remove this file once the directory structure is migrated from ui/ to here.
diff --git a/compose/compose-compiler-hosted/integration-tests/build.gradle b/compose/compose-compiler-hosted/integration-tests/build.gradle
index e5aa55b..bd63a06 100644
--- a/compose/compose-compiler-hosted/integration-tests/build.gradle
+++ b/compose/compose-compiler-hosted/integration-tests/build.gradle
@@ -38,7 +38,7 @@
testImplementation(KOTLIN_STDLIB)
testImplementation(project(":compose:runtime:runtime"))
testImplementation(project(":compose:core:core"))
- testImplementation(project(":ui:ui-android-view"))
+ testImplementation(project(":compose:android-view:android-view"))
testImplementation(project(":compose:compose-compiler-hosted"))
testImplementation("androidx.core:core-ktx:1.1.0")
}
diff --git a/compose/compose-runtime/src/androidAndroidTest/kotlin/androidx/compose/test/RestartTests.kt b/compose/compose-runtime/src/androidAndroidTest/kotlin/androidx/compose/test/RestartTests.kt
index a6d6d60..d1a2f03 100644
--- a/compose/compose-runtime/src/androidAndroidTest/kotlin/androidx/compose/test/RestartTests.kt
+++ b/compose/compose-runtime/src/androidAndroidTest/kotlin/androidx/compose/test/RestartTests.kt
@@ -23,6 +23,7 @@
import androidx.compose.clearRoots
import androidx.compose.mutableStateOf
import androidx.test.ext.junit.runners.AndroidJUnit4
+import androidx.test.filters.FlakyTest
import androidx.test.filters.MediumTest
import junit.framework.TestCase
import org.junit.After
@@ -142,6 +143,7 @@
}
@Test
+ @FlakyTest(bugId = 160876771)
fun allocation_Test() {
allocationCounting {
compose {
diff --git a/compose/desktop/placeholder.txt b/compose/desktop/placeholder.txt
new file mode 100644
index 0000000..b8f7c1a
--- /dev/null
+++ b/compose/desktop/placeholder.txt
@@ -0,0 +1,4 @@
+This file exists to make sure the directory this is in gets created by git, so that
+settings.gradle can point to this directory and not complain about it missing.
+
+TODO: b/160233169 remove this file once the directory structure is migrated from ui/ to here.
diff --git a/contentaccess/contentaccess-compiler/src/main/kotlin/androidx/contentaccess/compiler/ContentAccessProcessor.kt b/contentaccess/contentaccess-compiler/src/main/kotlin/androidx/contentaccess/compiler/ContentAccessProcessor.kt
index 5bf61d4..cde30d1 100644
--- a/contentaccess/contentaccess-compiler/src/main/kotlin/androidx/contentaccess/compiler/ContentAccessProcessor.kt
+++ b/contentaccess/contentaccess-compiler/src/main/kotlin/androidx/contentaccess/compiler/ContentAccessProcessor.kt
@@ -26,10 +26,13 @@
import javax.lang.model.element.Element
import javax.annotation.processing.Processor
import com.google.auto.service.AutoService
+import net.ltgt.gradle.incap.IncrementalAnnotationProcessor
+import net.ltgt.gradle.incap.IncrementalAnnotationProcessorType.ISOLATING
import com.squareup.kotlinpoet.metadata.KotlinPoetMetadataPreview
@AutoService(Processor::class)
-// TODO(obenabde): Make this Gradle incremental
+@IncrementalAnnotationProcessor(ISOLATING)
+// TODO(obenabde): write incrementality tests.
class ContentAccessProcessor : BasicAnnotationProcessor() {
override fun initSteps(): MutableIterable<ProcessingStep>? {
diff --git a/datastore/datastore-preferences/build.gradle b/datastore/datastore-preferences/build.gradle
index e3d539e..fe865ae 100644
--- a/datastore/datastore-preferences/build.gradle
+++ b/datastore/datastore-preferences/build.gradle
@@ -34,13 +34,11 @@
testImplementation(JUNIT)
testImplementation(KOTLIN_COROUTINES_TEST)
- testImplementation(TRUTH)
- testImplementation(project(":internal-testutils-truth"))
+ testImplementation(KOTLIN_TEST)
androidTestImplementation(JUNIT)
androidTestImplementation(KOTLIN_COROUTINES_TEST)
- androidTestImplementation(TRUTH)
- androidTestImplementation(project(":internal-testutils-truth"))
+ androidTestImplementation(KOTLIN_TEST)
androidTestImplementation(ANDROIDX_TEST_RUNNER)
androidTestImplementation(ANDROIDX_TEST_CORE)
}
diff --git a/datastore/datastore-preferences/src/androidTest/java/androidx/datastore/preferences/SharedPreferencesToPreferencesTest.kt b/datastore/datastore-preferences/src/androidTest/java/androidx/datastore/preferences/SharedPreferencesToPreferencesTest.kt
index 2225719..10f9c23 100644
--- a/datastore/datastore-preferences/src/androidTest/java/androidx/datastore/preferences/SharedPreferencesToPreferencesTest.kt
+++ b/datastore/datastore-preferences/src/androidTest/java/androidx/datastore/preferences/SharedPreferencesToPreferencesTest.kt
@@ -22,7 +22,6 @@
import androidx.datastore.DataStore
import androidx.test.core.app.ApplicationProvider
import androidx.test.filters.MediumTest
-import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.flow.first
import kotlinx.coroutines.test.TestCoroutineScope
import kotlinx.coroutines.test.runBlockingTest
@@ -31,6 +30,9 @@
import org.junit.Test
import org.junit.rules.TemporaryFolder
import java.io.File
+import kotlin.test.assertEquals
+import kotlin.test.assertFalse
+import kotlin.test.assertTrue
@kotlinx.coroutines.ExperimentalCoroutinesApi
@kotlinx.coroutines.ObsoleteCoroutinesApi
@@ -53,7 +55,7 @@
sharedPrefs = context.getSharedPreferences(sharedPrefsName, Context.MODE_PRIVATE)
datastoreFile = temporaryFolder.newFile("test_file.preferences_pb")
- assertThat(sharedPrefs.edit().clear().commit()).isTrue()
+ assertTrue { sharedPrefs.edit().clear().commit() }
}
@Test
@@ -61,7 +63,7 @@
val stringKey = "string_key"
val stringValue = "string value"
- assertThat(sharedPrefs.edit().putString(stringKey, stringValue).commit()).isTrue()
+ assertTrue { sharedPrefs.edit().putString(stringKey, stringValue).commit() }
val migration = SharedPreferencesMigration(
context = context,
@@ -72,8 +74,8 @@
val prefs = preferencesStore.data.first()
- assertThat(prefs.getString(stringKey, "default_string")).isEqualTo(stringValue)
- assertThat(prefs.getAll().size).isEqualTo(1)
+ assertEquals(stringValue, prefs.getString(stringKey, "default_string"))
+ assertEquals(prefs.getAll().size, 1)
}
@Test
@@ -81,7 +83,7 @@
val stringKey = "string_key"
val stringValue = "string value"
- assertThat(sharedPrefs.edit().putString(stringKey, stringValue).commit()).isTrue()
+ assertTrue { sharedPrefs.edit().putString(stringKey, stringValue).commit() }
val migration = SharedPreferencesMigration(
context = context,
@@ -93,7 +95,7 @@
// Get data so migration is run.
preferencesStore.data.first()
- assertThat(sharedPrefs.contains(stringKey)).isFalse()
+ assertFalse(sharedPrefs.contains(stringKey))
}
@Test
@@ -101,7 +103,7 @@
val stringKey = "string_key"
val stringValue = "string_value"
- assertThat(sharedPrefs.edit().putString(stringKey, stringValue).commit()).isTrue()
+ assertTrue { sharedPrefs.edit().putString(stringKey, stringValue).commit() }
val migration = SharedPreferencesMigration(
context = context,
@@ -110,8 +112,8 @@
val preferencesStore = getDataStoreWithMigrations(listOf(migration))
val prefs = preferencesStore.data.first()
- assertThat(prefs.getString(stringKey, "default_string")).isEqualTo(stringValue)
- assertThat(prefs.getAll().size).isEqualTo(1)
+ assertEquals(stringValue, prefs.getString(stringKey, "default_string"))
+ assertEquals(prefs.getAll().size, 1)
}
@Test
@@ -119,7 +121,7 @@
val integerKey = "integer_key"
val integerValue = 123
- assertThat(sharedPrefs.edit().putInt(integerKey, integerValue).commit()).isTrue()
+ assertTrue { sharedPrefs.edit().putInt(integerKey, integerValue).commit() }
val migration = SharedPreferencesMigration(
context = context,
@@ -128,8 +130,8 @@
val preferencesStore = getDataStoreWithMigrations(listOf(migration))
val prefs = preferencesStore.data.first()
- assertThat(prefs.getInt(integerKey, -1)).isEqualTo(integerValue)
- assertThat(prefs.getAll().size).isEqualTo(1)
+ assertEquals(integerValue, prefs.getInt(integerKey, -1))
+ assertEquals(1, prefs.getAll().size)
}
@Test
@@ -137,7 +139,7 @@
val floatKey = "float_key"
val floatValue = 123.0f
- assertThat(sharedPrefs.edit().putFloat(floatKey, floatValue).commit()).isTrue()
+ assertTrue { sharedPrefs.edit().putFloat(floatKey, floatValue).commit() }
val migration = SharedPreferencesMigration(
context = context,
@@ -146,8 +148,8 @@
val preferencesStore = getDataStoreWithMigrations(listOf(migration))
val prefs = preferencesStore.data.first()
- assertThat(prefs.getFloat(floatKey, -1.0f)).isEqualTo(floatValue)
- assertThat(prefs.getAll().size).isEqualTo(1)
+ assertEquals(floatValue, prefs.getFloat(floatKey, -1.0f))
+ assertEquals(1, prefs.getAll().size)
}
@Test
@@ -155,7 +157,7 @@
val booleanKey = "boolean_key"
val booleanValue = true
- assertThat(sharedPrefs.edit().putBoolean(booleanKey, booleanValue).commit()).isTrue()
+ assertTrue { sharedPrefs.edit().putBoolean(booleanKey, booleanValue).commit() }
val migration = SharedPreferencesMigration(
context = context,
@@ -164,8 +166,8 @@
val preferencesStore = getDataStoreWithMigrations(listOf(migration))
val prefs = preferencesStore.data.first()
- assertThat(prefs.getBoolean(booleanKey, false)).isEqualTo(booleanValue)
- assertThat(prefs.getAll().size).isEqualTo(1)
+ assertEquals(booleanValue, prefs.getBoolean(booleanKey, false))
+ assertEquals(1, prefs.getAll().size)
}
@Test
@@ -173,7 +175,7 @@
val longKey = "long_key"
val longValue = 1L shr 50
- assertThat(sharedPrefs.edit().putLong(longKey, longValue).commit()).isTrue()
+ assertTrue { sharedPrefs.edit().putLong(longKey, longValue).commit() }
val migration = SharedPreferencesMigration(
context = context,
@@ -182,8 +184,8 @@
val preferencesStore = getDataStoreWithMigrations(listOf(migration))
val prefs = preferencesStore.data.first()
- assertThat(prefs.getLong(longKey, -1)).isEqualTo(longValue)
- assertThat(prefs.getAll().size).isEqualTo(1)
+ assertEquals(longValue, prefs.getLong(longKey, -1))
+ assertEquals(1, prefs.getAll().size)
}
@Test
@@ -191,7 +193,7 @@
val stringSetKey = "stringSet_key"
val stringSetValue = setOf("a", "b", "c")
- assertThat(sharedPrefs.edit().putStringSet(stringSetKey, stringSetValue).commit()).isTrue()
+ assertTrue { sharedPrefs.edit().putStringSet(stringSetKey, stringSetValue).commit() }
val migration = SharedPreferencesMigration(
context = context,
@@ -200,8 +202,8 @@
val preferencesStore = getDataStoreWithMigrations(listOf(migration))
val prefs = preferencesStore.data.first()
- assertThat(prefs.getStringSet(stringSetKey, setOf())).isEqualTo(stringSetValue)
- assertThat(prefs.getAll().size).isEqualTo(1)
+ assertEquals(stringSetValue, prefs.getStringSet(stringSetKey, setOf()))
+ assertEquals(1, prefs.getAll().size)
}
@Test
@@ -209,9 +211,9 @@
val stringSetKey = "stringSet_key"
val stringSetValue = setOf("a", "b", "c")
- assertThat(sharedPrefs.edit().putStringSet(stringSetKey, stringSetValue).commit()).isTrue()
+ assertTrue { sharedPrefs.edit().putStringSet(stringSetKey, stringSetValue).commit() }
val sharedPrefsSet = sharedPrefs.getStringSet(stringSetKey, mutableSetOf())!!
- assertThat(sharedPrefsSet).isEqualTo(stringSetValue)
+ assertEquals(stringSetValue, sharedPrefsSet)
val migration = SharedPreferencesMigration(
context = context,
@@ -225,15 +227,15 @@
// Modify the sharedPrefs string set:
sharedPrefsSet.add("d")
- assertThat(prefs.getStringSet(stringSetKey, setOf())).isEqualTo(stringSetValue)
- assertThat(prefs.getAll().size).isEqualTo(1)
+ assertEquals(stringSetValue, prefs.getStringSet(stringSetKey, setOf<String>()))
+ assertEquals(1, prefs.getAll().size)
}
@Test
fun sharedPreferencesFileDeletedIfPrefsEmpty() = runBlockingTest {
val integerKey = "integer_key"
- assertThat(sharedPrefs.edit().putInt(integerKey, 123).commit()).isTrue()
+ assertTrue { sharedPrefs.edit().putInt(integerKey, 123).commit() }
val migration = SharedPreferencesMigration(
context = context,
@@ -245,14 +247,14 @@
val preferenceStore = getDataStoreWithMigrations(listOf(migration))
preferenceStore.data.first()
- assertThat(getSharedPrefsFile(context, sharedPrefsName).exists()).isFalse()
+ assertFalse(getSharedPrefsFile(context, sharedPrefsName).exists())
}
@Test
fun sharedPreferencesFileNotDeletedIfDisabled() = runBlockingTest {
val integerKey = "integer_key"
- assertThat(sharedPrefs.edit().putInt(integerKey, 123).commit()).isTrue()
+ assertTrue { sharedPrefs.edit().putInt(integerKey, 123).commit() }
val migration = SharedPreferencesMigration(
context = context,
@@ -264,7 +266,9 @@
val preferenceStore = getDataStoreWithMigrations(listOf(migration))
preferenceStore.data.first()
- assertThat(getSharedPrefsFile(context, sharedPrefsName).exists()).isTrue()
+ assertTrue {
+ getSharedPrefsFile(context, sharedPrefsName).exists()
+ }
}
@Test
@@ -272,8 +276,9 @@
val integerKey1 = "integer_key1"
val integerKey2 = "integer_key2"
- assertThat(sharedPrefs.edit().putInt(integerKey1, 123).putInt(integerKey2, 123).commit())
- .isTrue()
+ assertTrue {
+ sharedPrefs.edit().putInt(integerKey1, 123).putInt(integerKey2, 123).commit()
+ }
val migration = SharedPreferencesMigration(
context = context,
@@ -285,7 +290,7 @@
val preferenceStore = getDataStoreWithMigrations(listOf(migration))
preferenceStore.data.first()
- assertThat(getSharedPrefsFile(context, sharedPrefsName).exists()).isTrue()
+ assertTrue { getSharedPrefsFile(context, sharedPrefsName).exists() }
}
@Test
@@ -295,9 +300,9 @@
// Write to shared preferences then create the backup file
val sharedPrefsFile = getSharedPrefsFile(context, sharedPrefsName)
val sharedPrefsBackupFile = getSharedPrefsBackup(sharedPrefsFile)
- assertThat(sharedPrefs.edit().putInt(integerKey, 123).commit()).isTrue()
- assertThat(sharedPrefsFile.exists()).isTrue()
- assertThat(sharedPrefsFile.renameTo(sharedPrefsBackupFile)).isTrue()
+ assertTrue { sharedPrefs.edit().putInt(integerKey, 123).commit() }
+ assertTrue { sharedPrefsFile.exists() }
+ assertTrue { sharedPrefsFile.renameTo(sharedPrefsBackupFile) }
val migration = SharedPreferencesMigration(
context = context,
@@ -309,7 +314,7 @@
val preferenceStore = getDataStoreWithMigrations(listOf(migration))
preferenceStore.data.first()
- assertThat(sharedPrefsBackupFile.exists()).isFalse()
+ assertFalse(sharedPrefsBackupFile.exists())
}
@Test
@@ -322,13 +327,13 @@
val intValue = 12345
val notMigratedString = "dont migrate this string"
- assertThat(
+ assertTrue {
sharedPrefs.edit()
.putString(stringKey, stringValue)
.putInt(integerKey, intValue)
.putString(keyNotMigrated, notMigratedString)
.commit()
- ).isTrue()
+ }
val migration = SharedPreferencesMigration(
context = context,
@@ -340,13 +345,11 @@
val prefs = preferencesStore.data.first()
- assertThat(prefs.getString(stringKey, "default_string"))
- .isEqualTo(stringValue)
- assertThat(prefs.getInt(integerKey, -1))
- .isEqualTo(intValue)
+ assertEquals(stringValue, prefs.getString(stringKey, "default_string"))
+ assertEquals(intValue, prefs.getInt(integerKey, -1))
- assertThat(prefs.getAll().size).isEqualTo(2)
- assertThat(sharedPrefs.getString(keyNotMigrated, "")).isEqualTo(notMigratedString)
+ assertEquals(2, prefs.getAll().size)
+ assertEquals(notMigratedString, sharedPrefs.getString(keyNotMigrated, ""))
}
@Test
@@ -362,8 +365,8 @@
val preferencesStore = getDataStoreWithMigrations(listOf(migration))
val prefs = preferencesStore.data.first()
- assertThat(prefs.contains(missingKey)).isFalse()
- assertThat(prefs.getAll()).doesNotContainKey(missingKey)
+ assertFalse(prefs.contains(missingKey))
+ assertFalse(prefs.getAll().containsKey(missingKey))
}
@Test
@@ -373,7 +376,7 @@
val integerValue = 123
- assertThat(sharedPrefs.edit().putInt(integerKey, integerValue).commit()).isTrue()
+ assertTrue { sharedPrefs.edit().putInt(integerKey, integerValue).commit() }
val migration = SharedPreferencesMigration(
context = context,
@@ -383,8 +386,8 @@
val preferencesStore = getDataStoreWithMigrations(listOf(migration))
val prefs = preferencesStore.data.first()
- assertThat(prefs.getInt(integerKey, -1)).isEqualTo(integerValue)
- assertThat(prefs.getAll().size).isEqualTo(1)
+ assertEquals(integerValue, prefs.getInt(integerKey, -1))
+ assertEquals(1, prefs.getAll().size)
}
private fun getDataStoreWithMigrations(
diff --git a/datastore/datastore-preferences/src/test/java/androidx/datastore/preferences/PreferenceDataStoreFactoryTest.kt b/datastore/datastore-preferences/src/test/java/androidx/datastore/preferences/PreferenceDataStoreFactoryTest.kt
index 7a7e43f..e200d12 100644
--- a/datastore/datastore-preferences/src/test/java/androidx/datastore/preferences/PreferenceDataStoreFactoryTest.kt
+++ b/datastore/datastore-preferences/src/test/java/androidx/datastore/preferences/PreferenceDataStoreFactoryTest.kt
@@ -18,7 +18,6 @@
import androidx.datastore.DataMigration
import androidx.datastore.handlers.ReplaceFileCorruptionHandler
-import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.FlowPreview
import kotlinx.coroutines.ObsoleteCoroutinesApi
import kotlinx.coroutines.flow.first
@@ -29,6 +28,7 @@
import org.junit.Test
import org.junit.rules.TemporaryFolder
import java.io.File
+import kotlin.test.assertEquals
@ObsoleteCoroutinesApi
@kotlinx.coroutines.ExperimentalCoroutinesApi
@@ -58,10 +58,10 @@
.setString("key", "value")
.build()
- assertThat(store.updateData {
+ assertEquals(store.updateData {
it.toBuilder().setString("key", "value").build()
- }).isEqualTo(expectedPreferences)
- assertThat(store.data.first()).isEqualTo(expectedPreferences)
+ }, expectedPreferences)
+ assertEquals(expectedPreferences, store.data.first())
}
@Test
@@ -79,7 +79,7 @@
},
scope = dataStoreScope
)
- assertThat(store.data.first()).isEqualTo(valueToReplace)
+ assertEquals(valueToReplace, store.data.first())
}
@Test
@@ -118,6 +118,6 @@
scope = dataStoreScope
)
- assertThat(store.data.first()).isEqualTo(expectedPreferences)
+ assertEquals(expectedPreferences, store.data.first())
}
}
\ No newline at end of file
diff --git a/datastore/datastore-preferences/src/test/java/androidx/datastore/preferences/PreferencesSerializerTest.kt b/datastore/datastore-preferences/src/test/java/androidx/datastore/preferences/PreferencesSerializerTest.kt
index c5bda61..836f67b 100644
--- a/datastore/datastore-preferences/src/test/java/androidx/datastore/preferences/PreferencesSerializerTest.kt
+++ b/datastore/datastore-preferences/src/test/java/androidx/datastore/preferences/PreferencesSerializerTest.kt
@@ -17,13 +17,13 @@
package androidx.datastore.preferences
import androidx.datastore.CorruptionException
-import androidx.testutils.assertThrows
-import com.google.common.truth.Truth.assertThat
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.rules.TemporaryFolder
import java.io.File
+import kotlin.test.assertEquals
+import kotlin.test.assertFailsWith
@kotlinx.coroutines.ExperimentalCoroutinesApi
@kotlinx.coroutines.ObsoleteCoroutinesApi
@@ -57,7 +57,7 @@
preferencesSerializer.readFrom(it)
}
- assertThat(readPrefs).isEqualTo(prefs)
+ assertEquals(prefs, readPrefs)
}
@Test
@@ -76,7 +76,7 @@
preferencesSerializer.readFrom(it)
}
- assertThat(readPrefs).isEqualTo(prefs)
+ assertEquals(prefs, readPrefs)
}
@Test
@@ -95,7 +95,7 @@
preferencesSerializer.readFrom(it)
}
- assertThat(readPrefs).isEqualTo(prefs)
+ assertEquals(prefs, readPrefs)
}
@Test
@@ -114,7 +114,7 @@
preferencesSerializer.readFrom(it)
}
- assertThat(readPrefs).isEqualTo(prefs)
+ assertEquals(prefs, readPrefs)
}
@Test
@@ -133,7 +133,7 @@
preferencesSerializer.readFrom(it)
}
- assertThat(readPrefs).isEqualTo(prefs)
+ assertEquals(prefs, readPrefs)
}
@Test
@@ -141,7 +141,7 @@
// Not a valid proto - protos cannot start with a 0 byte.
testFile.writeBytes(byteArrayOf(0, 1, 2, 3, 4))
- assertThrows<CorruptionException> {
+ assertFailsWith<CorruptionException> {
testFile.inputStream().use {
preferencesSerializer.readFrom(it)
}
diff --git a/datastore/datastore-preferences/src/test/java/androidx/datastore/preferences/PreferencesTest.kt b/datastore/datastore-preferences/src/test/java/androidx/datastore/preferences/PreferencesTest.kt
index fa4bb98..542a2ee 100644
--- a/datastore/datastore-preferences/src/test/java/androidx/datastore/preferences/PreferencesTest.kt
+++ b/datastore/datastore-preferences/src/test/java/androidx/datastore/preferences/PreferencesTest.kt
@@ -16,11 +16,14 @@
package androidx.datastore.preferences
-import androidx.testutils.assertThrows
-import com.google.common.truth.Truth.assertThat
import org.junit.Test
import org.junit.runner.RunWith
import org.junit.runners.JUnit4
+import kotlin.test.assertEquals
+import kotlin.test.assertFailsWith
+import kotlin.test.assertFalse
+import kotlin.test.assertNotEquals
+import kotlin.test.assertTrue
@RunWith(JUnit4::class)
class PreferencesTest {
@@ -35,14 +38,13 @@
.setBoolean(booleanKey, true)
.build()
- assertThat(prefs.contains(booleanKey)).isTrue()
- assertThat(prefs.getBoolean(booleanKey, false)).isTrue()
+ assertTrue { prefs.contains(booleanKey) }
+ assertTrue { prefs.getBoolean(booleanKey, false) }
}
@Test
fun testBooleanDefault() {
- assertThat(Preferences.empty().getBoolean("nonexistent key", false))
- .isFalse()
+ assertFalse(Preferences.empty().getBoolean("nonexistent key", false))
}
@Test
@@ -55,14 +57,13 @@
.setFloat(floatKey, 1.1f)
.build()
- assertThat(prefs.contains(floatKey)).isTrue()
- assertThat(prefs.getFloat(floatKey, 0.0f)).isEqualTo(1.1f)
+ assertTrue { prefs.contains(floatKey) }
+ assertEquals(1.1f, prefs.getFloat(floatKey, 0.0f))
}
@Test
fun testFloatDefault() {
- assertThat(Preferences.empty().getFloat("nonexistent key", 0.1f))
- .isEqualTo(0.1f)
+ assertEquals(0.1f, Preferences.empty().getFloat("nonexistent key", 0.1f))
}
@Test
@@ -75,14 +76,13 @@
.setInt(intKey, 1)
.build()
- assertThat(prefs.contains(intKey)).isTrue()
- assertThat(prefs.getInt(intKey, -1)).isEqualTo(1)
+ assertTrue { prefs.contains(intKey) }
+ assertEquals(1, prefs.getInt(intKey, -1))
}
@Test
fun testIntDefault() {
- assertThat(Preferences.empty().getInt("nonexistent key", 123))
- .isEqualTo(123)
+ assertEquals(123, Preferences.empty().getInt("nonexistent key", 123))
}
@Test
@@ -97,14 +97,13 @@
.setLong(longKey, bigLong)
.build()
- assertThat(prefs.contains(longKey)).isTrue()
- assertThat(prefs.getLong(longKey, -1)).isEqualTo(bigLong)
+ assertTrue { prefs.contains(longKey) }
+ assertEquals(bigLong, prefs.getLong(longKey, -1))
}
@Test
fun testLongDefault() {
- assertThat(Preferences.empty().getLong("nonexistent key", 123))
- .isEqualTo(123)
+ assertEquals(123, Preferences.empty().getLong("nonexistent key", 123))
}
@Test
@@ -117,15 +116,13 @@
.setString(stringKey, "string123")
.build()
- assertThat(prefs.contains(stringKey)).isTrue()
- assertThat(prefs.getString(stringKey, "default string"))
- .isEqualTo("string123")
+ assertTrue { prefs.contains(stringKey) }
+ assertEquals("string123", prefs.getString(stringKey, "default string"))
}
@Test
fun testStringDefault() {
- assertThat(Preferences.empty().getString("nonexistent key", "default val"))
- .isEqualTo("default val")
+ assertEquals("default val", Preferences.empty().getString("nonexistent key", "default val"))
}
@Test
@@ -138,23 +135,24 @@
.setStringSet(stringSetKey, setOf("string1", "string2", "string3"))
.build()
- assertThat(prefs.contains(stringSetKey)).isTrue()
- assertThat(prefs.getStringSet(stringSetKey, setOf())).isEqualTo(
+ assertTrue { prefs.contains(stringSetKey) }
+ assertEquals(
+
setOf(
"string1",
"string2",
"string3"
- )
+ ), prefs.getStringSet(stringSetKey, setOf())
)
}
@Test
fun testStringSetDefault() {
- assertThat(
- Preferences.empty().getStringSet(
+ assertEquals(
+ setOf("default set"), Preferences.empty().getStringSet(
"nonexistent key", setOf("default set")
)
- ).isEqualTo(setOf("default set"))
+ )
}
@Test
@@ -172,12 +170,13 @@
mutableReturnedSet.clear()
mutableReturnedSet.add("Original set does not contain this string")
- assertThat(prefs.getStringSet(stringSetKey, setOf())).isEqualTo(
+ assertEquals(
setOf(
"string1",
"string2",
"string3"
- )
+ ),
+ prefs.getStringSet(stringSetKey, setOf())
)
}
@@ -191,10 +190,10 @@
.setString(stringKey, "string123")
.build()
- assertThat(prefs.contains(stringKey)).isTrue()
+ assertTrue { prefs.contains(stringKey) }
// Trying to get a long where there is a string value throws a ClassCastException.
- assertThrows<ClassCastException> { prefs.getLong(stringKey, 123) }
+ assertFailsWith<ClassCastException> { prefs.getLong(stringKey, 123) }
}
@Test
@@ -210,10 +209,10 @@
.build()
val allPreferences = prefs.getAll()
- assertThat(allPreferences.size).isEqualTo(2)
+ assertEquals(2, allPreferences.size)
- assertThat(allPreferences[intKey]).isEqualTo(123)
- assertThat(allPreferences[stringSetKey]).isEqualTo(setOf("1", "2", "3"))
+ assertEquals(123, allPreferences[intKey])
+ assertEquals(setOf("1", "2", "3"), (allPreferences[stringSetKey]))
}
@Test
@@ -233,8 +232,8 @@
mutableAllPreferences[intKey] = 99999
(mutableAllPreferences[stringSetKey] as MutableSet<String>).clear()
- assertThat(prefs.getInt(intKey, -1)).isEqualTo(123)
- assertThat(prefs.getStringSet(stringSetKey, setOf())).isEqualTo(setOf("1", "2", "3"))
+ assertEquals(123, prefs.getInt(intKey, -1))
+ assertEquals(setOf("1", "2", "3"), prefs.getStringSet(stringSetKey, setOf()))
}
@Test
@@ -249,7 +248,7 @@
val emptyPrefs = prefsWithInt.toBuilder().clear().build()
- assertThat(emptyPrefs).isEqualTo(Preferences.empty())
+ assertEquals(Preferences.empty(), emptyPrefs)
}
@Test
@@ -264,14 +263,14 @@
val emptyPrefs = prefsWithInt.toBuilder().remove(intKey).build()
- assertThat(emptyPrefs).isEqualTo(Preferences.empty())
+ assertEquals(Preferences.empty(), emptyPrefs)
}
@Test
fun testBuilderPublicConstructor() {
val emptyPrefs = Preferences.Builder().build()
- assertThat(emptyPrefs).isEqualTo(Preferences.empty())
+ assertEquals(Preferences.empty(), emptyPrefs)
}
@Test
@@ -281,7 +280,7 @@
val prefs1 = Preferences.empty().toBuilder().setInt(intKey1, 123).build()
val prefs2 = Preferences.empty().toBuilder().setInt(intKey1, 123).build()
- assertThat(prefs1).isEqualTo(prefs2)
+ assertEquals(prefs1, prefs2)
}
@Test
@@ -301,7 +300,7 @@
.setInt(intKey2, 123)
.build()
- assertThat(prefs1).isNotEqualTo(prefs2)
+ assertNotEquals(prefs1, prefs2)
}
@Test
@@ -320,7 +319,7 @@
.setInt(intKey, 999)
.build()
- assertThat(prefs1).isNotEqualTo(prefs2)
+ assertNotEquals(prefs1, prefs2)
}
@Test
@@ -339,6 +338,6 @@
.setStringSet(stringSetKey, setOf("different string1", "string2"))
.build()
- assertThat(prefs1).isNotEqualTo(prefs2)
+ assertNotEquals(prefs1, prefs2)
}
}
\ No newline at end of file
diff --git a/navigation/navigation-runtime/api/2.4.0-alpha01.txt b/navigation/navigation-runtime/api/2.4.0-alpha01.txt
index c84c6c6..7cd1b49 100644
--- a/navigation/navigation-runtime/api/2.4.0-alpha01.txt
+++ b/navigation/navigation-runtime/api/2.4.0-alpha01.txt
@@ -94,12 +94,14 @@
public final class NavDeepLinkBuilder {
ctor public NavDeepLinkBuilder(android.content.Context);
method public androidx.navigation.NavDeepLinkBuilder addDestination(@IdRes int);
+ method public androidx.navigation.NavDeepLinkBuilder addDestination(@IdRes int, android.os.Bundle?);
method public android.app.PendingIntent createPendingIntent();
method public androidx.core.app.TaskStackBuilder createTaskStackBuilder();
method public androidx.navigation.NavDeepLinkBuilder setArguments(android.os.Bundle?);
method public androidx.navigation.NavDeepLinkBuilder setComponentName(Class<? extends android.app.Activity>);
method public androidx.navigation.NavDeepLinkBuilder setComponentName(android.content.ComponentName);
method public androidx.navigation.NavDeepLinkBuilder setDestination(@IdRes int);
+ method public androidx.navigation.NavDeepLinkBuilder setDestination(@IdRes int, android.os.Bundle?);
method public androidx.navigation.NavDeepLinkBuilder setGraph(@NavigationRes int);
method public androidx.navigation.NavDeepLinkBuilder setGraph(androidx.navigation.NavGraph);
}
diff --git a/navigation/navigation-runtime/api/current.txt b/navigation/navigation-runtime/api/current.txt
index c84c6c6..7cd1b49 100644
--- a/navigation/navigation-runtime/api/current.txt
+++ b/navigation/navigation-runtime/api/current.txt
@@ -94,12 +94,14 @@
public final class NavDeepLinkBuilder {
ctor public NavDeepLinkBuilder(android.content.Context);
method public androidx.navigation.NavDeepLinkBuilder addDestination(@IdRes int);
+ method public androidx.navigation.NavDeepLinkBuilder addDestination(@IdRes int, android.os.Bundle?);
method public android.app.PendingIntent createPendingIntent();
method public androidx.core.app.TaskStackBuilder createTaskStackBuilder();
method public androidx.navigation.NavDeepLinkBuilder setArguments(android.os.Bundle?);
method public androidx.navigation.NavDeepLinkBuilder setComponentName(Class<? extends android.app.Activity>);
method public androidx.navigation.NavDeepLinkBuilder setComponentName(android.content.ComponentName);
method public androidx.navigation.NavDeepLinkBuilder setDestination(@IdRes int);
+ method public androidx.navigation.NavDeepLinkBuilder setDestination(@IdRes int, android.os.Bundle?);
method public androidx.navigation.NavDeepLinkBuilder setGraph(@NavigationRes int);
method public androidx.navigation.NavDeepLinkBuilder setGraph(androidx.navigation.NavGraph);
}
diff --git a/navigation/navigation-runtime/api/public_plus_experimental_2.4.0-alpha01.txt b/navigation/navigation-runtime/api/public_plus_experimental_2.4.0-alpha01.txt
index c84c6c6..7cd1b49 100644
--- a/navigation/navigation-runtime/api/public_plus_experimental_2.4.0-alpha01.txt
+++ b/navigation/navigation-runtime/api/public_plus_experimental_2.4.0-alpha01.txt
@@ -94,12 +94,14 @@
public final class NavDeepLinkBuilder {
ctor public NavDeepLinkBuilder(android.content.Context);
method public androidx.navigation.NavDeepLinkBuilder addDestination(@IdRes int);
+ method public androidx.navigation.NavDeepLinkBuilder addDestination(@IdRes int, android.os.Bundle?);
method public android.app.PendingIntent createPendingIntent();
method public androidx.core.app.TaskStackBuilder createTaskStackBuilder();
method public androidx.navigation.NavDeepLinkBuilder setArguments(android.os.Bundle?);
method public androidx.navigation.NavDeepLinkBuilder setComponentName(Class<? extends android.app.Activity>);
method public androidx.navigation.NavDeepLinkBuilder setComponentName(android.content.ComponentName);
method public androidx.navigation.NavDeepLinkBuilder setDestination(@IdRes int);
+ method public androidx.navigation.NavDeepLinkBuilder setDestination(@IdRes int, android.os.Bundle?);
method public androidx.navigation.NavDeepLinkBuilder setGraph(@NavigationRes int);
method public androidx.navigation.NavDeepLinkBuilder setGraph(androidx.navigation.NavGraph);
}
diff --git a/navigation/navigation-runtime/api/public_plus_experimental_current.txt b/navigation/navigation-runtime/api/public_plus_experimental_current.txt
index c84c6c6..7cd1b49 100644
--- a/navigation/navigation-runtime/api/public_plus_experimental_current.txt
+++ b/navigation/navigation-runtime/api/public_plus_experimental_current.txt
@@ -94,12 +94,14 @@
public final class NavDeepLinkBuilder {
ctor public NavDeepLinkBuilder(android.content.Context);
method public androidx.navigation.NavDeepLinkBuilder addDestination(@IdRes int);
+ method public androidx.navigation.NavDeepLinkBuilder addDestination(@IdRes int, android.os.Bundle?);
method public android.app.PendingIntent createPendingIntent();
method public androidx.core.app.TaskStackBuilder createTaskStackBuilder();
method public androidx.navigation.NavDeepLinkBuilder setArguments(android.os.Bundle?);
method public androidx.navigation.NavDeepLinkBuilder setComponentName(Class<? extends android.app.Activity>);
method public androidx.navigation.NavDeepLinkBuilder setComponentName(android.content.ComponentName);
method public androidx.navigation.NavDeepLinkBuilder setDestination(@IdRes int);
+ method public androidx.navigation.NavDeepLinkBuilder setDestination(@IdRes int, android.os.Bundle?);
method public androidx.navigation.NavDeepLinkBuilder setGraph(@NavigationRes int);
method public androidx.navigation.NavDeepLinkBuilder setGraph(androidx.navigation.NavGraph);
}
diff --git a/navigation/navigation-runtime/api/restricted_2.4.0-alpha01.txt b/navigation/navigation-runtime/api/restricted_2.4.0-alpha01.txt
index c84c6c6..7cd1b49 100644
--- a/navigation/navigation-runtime/api/restricted_2.4.0-alpha01.txt
+++ b/navigation/navigation-runtime/api/restricted_2.4.0-alpha01.txt
@@ -94,12 +94,14 @@
public final class NavDeepLinkBuilder {
ctor public NavDeepLinkBuilder(android.content.Context);
method public androidx.navigation.NavDeepLinkBuilder addDestination(@IdRes int);
+ method public androidx.navigation.NavDeepLinkBuilder addDestination(@IdRes int, android.os.Bundle?);
method public android.app.PendingIntent createPendingIntent();
method public androidx.core.app.TaskStackBuilder createTaskStackBuilder();
method public androidx.navigation.NavDeepLinkBuilder setArguments(android.os.Bundle?);
method public androidx.navigation.NavDeepLinkBuilder setComponentName(Class<? extends android.app.Activity>);
method public androidx.navigation.NavDeepLinkBuilder setComponentName(android.content.ComponentName);
method public androidx.navigation.NavDeepLinkBuilder setDestination(@IdRes int);
+ method public androidx.navigation.NavDeepLinkBuilder setDestination(@IdRes int, android.os.Bundle?);
method public androidx.navigation.NavDeepLinkBuilder setGraph(@NavigationRes int);
method public androidx.navigation.NavDeepLinkBuilder setGraph(androidx.navigation.NavGraph);
}
diff --git a/navigation/navigation-runtime/api/restricted_current.txt b/navigation/navigation-runtime/api/restricted_current.txt
index c84c6c6..7cd1b49 100644
--- a/navigation/navigation-runtime/api/restricted_current.txt
+++ b/navigation/navigation-runtime/api/restricted_current.txt
@@ -94,12 +94,14 @@
public final class NavDeepLinkBuilder {
ctor public NavDeepLinkBuilder(android.content.Context);
method public androidx.navigation.NavDeepLinkBuilder addDestination(@IdRes int);
+ method public androidx.navigation.NavDeepLinkBuilder addDestination(@IdRes int, android.os.Bundle?);
method public android.app.PendingIntent createPendingIntent();
method public androidx.core.app.TaskStackBuilder createTaskStackBuilder();
method public androidx.navigation.NavDeepLinkBuilder setArguments(android.os.Bundle?);
method public androidx.navigation.NavDeepLinkBuilder setComponentName(Class<? extends android.app.Activity>);
method public androidx.navigation.NavDeepLinkBuilder setComponentName(android.content.ComponentName);
method public androidx.navigation.NavDeepLinkBuilder setDestination(@IdRes int);
+ method public androidx.navigation.NavDeepLinkBuilder setDestination(@IdRes int, android.os.Bundle?);
method public androidx.navigation.NavDeepLinkBuilder setGraph(@NavigationRes int);
method public androidx.navigation.NavDeepLinkBuilder setGraph(androidx.navigation.NavGraph);
}
diff --git a/navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerTest.kt b/navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerTest.kt
index 47fa5e4..309e049 100644
--- a/navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerTest.kt
+++ b/navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavControllerTest.kt
@@ -58,6 +58,7 @@
import org.junit.runner.RunWith
import org.mockito.ArgumentMatchers.any
import org.mockito.ArgumentMatchers.anyString
+import org.mockito.ArgumentMatchers.argThat
import org.mockito.ArgumentMatchers.eq
import org.mockito.Mockito.mock
import org.mockito.Mockito.times
@@ -1319,6 +1320,77 @@
@UiThreadTest
@Test
+ fun testHandleDeepLinkMultipleDestinationsWithArgs() {
+ val navController = createNavController()
+ navController.setGraph(R.navigation.nav_multiple_navigation)
+ val onDestinationChangedListener =
+ mock(NavController.OnDestinationChangedListener::class.java)
+ navController.addOnDestinationChangedListener(onDestinationChangedListener)
+ val startDestination = navController.findDestination(R.id.simple_child_start_test)
+ verify(onDestinationChangedListener).onDestinationChanged(
+ eq(navController),
+ eq(startDestination),
+ any())
+ val childDestination = navController.findDestination(R.id.simple_child_second_test)
+
+ val globalBundle = Bundle().apply {
+ putString("global", "global")
+ }
+ val firstBundle = Bundle().apply {
+ putString("test", "first")
+ }
+ val secondBundle = Bundle().apply {
+ putString("global", "overridden")
+ putString("test", "second")
+ }
+ val taskStackBuilder = navController.createDeepLink()
+ .setDestination(R.id.simple_child_second_test, firstBundle)
+ .addDestination(R.id.deep_link_child_second_test, secondBundle)
+ .setArguments(globalBundle)
+ .createTaskStackBuilder()
+
+ val intent = taskStackBuilder.editIntentAt(0)
+ assertNotNull(intent)
+ assertWithMessage("NavController should handle deep links to its own graph")
+ .that(navController.handleDeepLink(intent))
+ .isTrue()
+
+ // Verify that we navigated down to the deep link
+ // First to the destination added via setDestination()
+ verify(onDestinationChangedListener).onDestinationChanged(
+ eq(navController),
+ eq(startDestination),
+ argThat { args ->
+ args?.getString("global").equals("global") &&
+ args?.getString("test").equals("first")
+ })
+ verify(onDestinationChangedListener).onDestinationChanged(
+ eq(navController),
+ eq(childDestination),
+ argThat { args ->
+ args?.getString("global").equals("global") &&
+ args?.getString("test").equals("first")
+ })
+ // Then to the second destination added via addDestination()
+ verify(onDestinationChangedListener).onDestinationChanged(
+ eq(navController),
+ eq(navController.findDestination(R.id.deep_link_child_start_test)),
+ argThat { args ->
+ args?.getString("global").equals("overridden") &&
+ args?.getString("test").equals("second")
+ })
+ verify(onDestinationChangedListener).onDestinationChanged(
+ eq(navController),
+ eq(navController.findDestination(R.id.deep_link_child_second_test)),
+ argThat { args ->
+ args?.getString("global").equals("overridden") &&
+ args?.getString("test").equals("second")
+ })
+ verifyNoMoreInteractions(onDestinationChangedListener)
+ }
+
+ @UiThreadTest
+ @Test
fun testHandleDeepLinkInvalid() {
val navController = createNavController()
navController.setGraph(R.navigation.nav_simple)
diff --git a/navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavDeepLinkBuilderTest.kt b/navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavDeepLinkBuilderTest.kt
index b3b2724..190604c 100644
--- a/navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavDeepLinkBuilderTest.kt
+++ b/navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavDeepLinkBuilderTest.kt
@@ -151,4 +151,24 @@
.that(firstPendingIntent)
.isNotEqualTo(secondPendingIntent)
}
+
+ @Test
+ fun pendingIntentNotEqualsWithDifferentDestinationArgs() {
+ val deepLinkBuilder = NavDeepLinkBuilder(targetContext)
+
+ deepLinkBuilder.setGraph(R.navigation.nav_simple)
+ val args = Bundle().apply {
+ putString("test", "test")
+ }
+ deepLinkBuilder.setDestination(R.id.second_test, args)
+ val firstPendingIntent = deepLinkBuilder.createPendingIntent()
+
+ // Change the args but not the destination
+ args.putString("test", "test2")
+ val secondPendingIntent = deepLinkBuilder.createPendingIntent()
+ assertWithMessage(
+ "PendingIntents with different destination arguments should be different")
+ .that(firstPendingIntent)
+ .isNotEqualTo(secondPendingIntent)
+ }
}
diff --git a/navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.java b/navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.java
index d82b4e8..6ffbc0a 100644
--- a/navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.java
+++ b/navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.java
@@ -71,6 +71,8 @@
private static final String KEY_BACK_STACK =
"android-support-nav:controller:backStack";
static final String KEY_DEEP_LINK_IDS = "android-support-nav:controller:deepLinkIds";
+ static final String KEY_DEEP_LINK_ARGS =
+ "android-support-nav:controller:deepLinkArgs";
static final String KEY_DEEP_LINK_EXTRAS =
"android-support-nav:controller:deepLinkExtras";
static final String KEY_DEEP_LINK_HANDLED =
@@ -664,17 +666,21 @@
}
Bundle extras = intent.getExtras();
int[] deepLink = extras != null ? extras.getIntArray(KEY_DEEP_LINK_IDS) : null;
- Bundle bundle = new Bundle();
+ ArrayList<Bundle> deepLinkArgs = extras != null
+ ? extras.getParcelableArrayList(KEY_DEEP_LINK_ARGS)
+ : null;
+ Bundle globalArgs = new Bundle();
Bundle deepLinkExtras = extras != null ? extras.getBundle(KEY_DEEP_LINK_EXTRAS) : null;
if (deepLinkExtras != null) {
- bundle.putAll(deepLinkExtras);
+ globalArgs.putAll(deepLinkExtras);
}
if ((deepLink == null || deepLink.length == 0) && intent.getData() != null) {
NavDestination.DeepLinkMatch matchingDeepLink =
mGraph.matchDeepLink(new NavDeepLinkRequest(intent));
if (matchingDeepLink != null) {
deepLink = matchingDeepLink.getDestination().buildDeepLinkIds();
- bundle.putAll(matchingDeepLink.getMatchingArgs());
+ deepLinkArgs = null;
+ globalArgs.putAll(matchingDeepLink.getMatchingArgs());
}
}
if (deepLink == null || deepLink.length == 0) {
@@ -687,7 +693,19 @@
+ " in the navigation graph, ignoring the deep link from " + intent);
return false;
}
- bundle.putParcelable(KEY_DEEP_LINK_INTENT, intent);
+ globalArgs.putParcelable(KEY_DEEP_LINK_INTENT, intent);
+ Bundle[] args = new Bundle[deepLink.length];
+ for (int index = 0; index < args.length; index++) {
+ Bundle arguments = new Bundle();
+ arguments.putAll(globalArgs);
+ if (deepLinkArgs != null) {
+ Bundle deepLinkArguments = deepLinkArgs.get(index);
+ if (deepLinkArguments != null) {
+ arguments.putAll(deepLinkArguments);
+ }
+ }
+ args[index] = arguments;
+ }
int flags = intent.getFlags();
if ((flags & Intent.FLAG_ACTIVITY_NEW_TASK) != 0
&& (flags & Intent.FLAG_ACTIVITY_CLEAR_TASK) == 0) {
@@ -713,7 +731,8 @@
}
int index = 0;
while (index < deepLink.length) {
- int destinationId = deepLink[index++];
+ int destinationId = deepLink[index];
+ Bundle arguments = args[index++];
NavDestination node = findDestination(destinationId);
if (node == null) {
final String dest = NavDestination.getDisplayName(mContext, destinationId);
@@ -722,7 +741,7 @@
+ " cannot be found from the current destination "
+ getCurrentDestination());
}
- navigate(node, bundle,
+ navigate(node, arguments,
new NavOptions.Builder().setEnterAnim(0).setExitAnim(0).build(), null);
}
return true;
@@ -731,6 +750,7 @@
NavGraph graph = mGraph;
for (int i = 0; i < deepLink.length; i++) {
int destinationId = deepLink[i];
+ Bundle arguments = args[i];
NavDestination node = i == 0 ? mGraph : graph.findNode(destinationId);
if (node == null) {
final String dest = NavDestination.getDisplayName(mContext, destinationId);
@@ -750,7 +770,7 @@
}
} else {
// Navigate to the last NavDestination, clearing any existing destinations
- navigate(node, node.addInDefaultArgs(bundle), new NavOptions.Builder()
+ navigate(node, arguments, new NavOptions.Builder()
.setPopUpTo(mGraph.getId(), true)
.setEnterAnim(0).setExitAnim(0).build(), null);
}
diff --git a/navigation/navigation-runtime/src/main/java/androidx/navigation/NavDeepLinkBuilder.java b/navigation/navigation-runtime/src/main/java/androidx/navigation/NavDeepLinkBuilder.java
index 62161e9..36f1bbe 100644
--- a/navigation/navigation-runtime/src/main/java/androidx/navigation/NavDeepLinkBuilder.java
+++ b/navigation/navigation-runtime/src/main/java/androidx/navigation/NavDeepLinkBuilder.java
@@ -52,12 +52,32 @@
* using an existing {@link NavController} via {@link NavController#createDeepLink()}.
*/
public final class NavDeepLinkBuilder {
+ private static class DeepLinkDestination {
+ private final int mDestinationId;
+ @Nullable
+ private final Bundle mArguments;
+
+ DeepLinkDestination(int destinationId, @Nullable Bundle arguments) {
+ mDestinationId = destinationId;
+ mArguments = arguments;
+ }
+
+ public int getDestinationId() {
+ return mDestinationId;
+ }
+
+ @Nullable
+ public Bundle getArguments() {
+ return mArguments;
+ }
+ }
+
private final Context mContext;
private final Intent mIntent;
private NavGraph mGraph;
- private ArrayList<Integer> mDestIds = new ArrayList<>();
- private Bundle mArgs;
+ private ArrayList<DeepLinkDestination> mDestinations = new ArrayList<>();
+ private Bundle mGlobalArgs;
/**
* Construct a new NavDeepLinkBuilder.
@@ -155,8 +175,23 @@
*/
@NonNull
public NavDeepLinkBuilder setDestination(@IdRes int destId) {
- mDestIds.clear();
- mDestIds.add(destId);
+ return setDestination(destId, null);
+ }
+
+ /**
+ * Sets the destination id to deep link to. Any destinations previous added via
+ * {@link #addDestination(int)} are cleared, effectively resetting this object
+ * back to only this single destination.
+ *
+ * @param destId destination ID to deep link to.
+ * @param args Arguments to pass to this destination and any synthetic back stack created
+ * due to this destination being added.
+ * @return this object for chaining
+ */
+ @NonNull
+ public NavDeepLinkBuilder setDestination(@IdRes int destId, @Nullable Bundle args) {
+ mDestinations.clear();
+ mDestinations.add(new DeepLinkDestination(destId, args));
if (mGraph != null) {
verifyAllDestinations();
}
@@ -174,7 +209,23 @@
*/
@NonNull
public NavDeepLinkBuilder addDestination(@IdRes int destId) {
- mDestIds.add(destId);
+ return addDestination(destId, null);
+ }
+
+ /**
+ * Add a new destination id to deep link to. This builds off any previous calls to this method
+ * or calls to {@link #setDestination(int)}, building the minimal synthetic back stack of
+ * start destinations between the previous deep link destination and the newly added
+ * deep link destination.
+ *
+ * @param destId destination ID to deep link to.
+ * @param args Arguments to pass to this destination and any synthetic back stack created
+ * due to this destination being added.
+ * @return this object for chaining
+ */
+ @NonNull
+ public NavDeepLinkBuilder addDestination(@IdRes int destId, @Nullable Bundle args) {
+ mDestinations.add(new DeepLinkDestination(destId, args));
if (mGraph != null) {
verifyAllDestinations();
}
@@ -199,7 +250,8 @@
}
private void verifyAllDestinations() {
- for (Integer destId : mDestIds) {
+ for (DeepLinkDestination destination : mDestinations) {
+ int destId = destination.getDestinationId();
NavDestination node = findDestination(destId);
if (node == null) {
final String dest = NavDestination.getDisplayName(mContext, destId);
@@ -211,8 +263,11 @@
private void fillInIntent() {
ArrayList<Integer> deepLinkIds = new ArrayList<>();
+ ArrayList<Bundle> deepLinkArgs = new ArrayList<>();
NavDestination previousDestination = null;
- for (Integer destId : mDestIds) {
+ for (DeepLinkDestination destination : mDestinations) {
+ int destId = destination.getDestinationId();
+ Bundle arguments = destination.getArguments();
NavDestination node = findDestination(destId);
if (node == null) {
final String dest = NavDestination.getDisplayName(mContext, destId);
@@ -221,6 +276,7 @@
}
for (int id : node.buildDeepLinkIds(previousDestination)) {
deepLinkIds.add(id);
+ deepLinkArgs.add(arguments);
}
previousDestination = node;
}
@@ -231,6 +287,7 @@
idArray[index++] = id;
}
mIntent.putExtra(NavController.KEY_DEEP_LINK_IDS, idArray);
+ mIntent.putParcelableArrayListExtra(NavController.KEY_DEEP_LINK_ARGS, deepLinkArgs);
}
/**
@@ -240,7 +297,7 @@
*/
@NonNull
public NavDeepLinkBuilder setArguments(@Nullable Bundle args) {
- mArgs = args;
+ mGlobalArgs = args;
mIntent.putExtra(NavController.KEY_DEEP_LINK_EXTRAS, args);
return this;
}
@@ -263,7 +320,7 @@
if (mGraph == null) {
throw new IllegalStateException("You must call setGraph() "
+ "before constructing the deep link");
- } else if (mDestIds.isEmpty()) {
+ } else if (mDestinations.isEmpty()) {
throw new IllegalStateException("You must call setDestination() or addDestination() "
+ "before constructing the deep link");
}
@@ -298,14 +355,22 @@
@NonNull
public PendingIntent createPendingIntent() {
int requestCode = 0;
- if (mArgs != null) {
- for (String key: mArgs.keySet()) {
- Object value = mArgs.get(key);
+ if (mGlobalArgs != null) {
+ for (String key: mGlobalArgs.keySet()) {
+ Object value = mGlobalArgs.get(key);
requestCode = 31 * requestCode + (value != null ? value.hashCode() : 0);
}
}
- for (Integer destId : mDestIds) {
+ for (DeepLinkDestination destination : mDestinations) {
+ int destId = destination.getDestinationId();
requestCode = 31 * requestCode + destId;
+ Bundle arguments = destination.getArguments();
+ if (arguments != null) {
+ for (String key: arguments.keySet()) {
+ Object value = arguments.get(key);
+ requestCode = 31 * requestCode + (value != null ? value.hashCode() : 0);
+ }
+ }
}
return createTaskStackBuilder()
.getPendingIntent(requestCode, PendingIntent.FLAG_UPDATE_CURRENT);
diff --git a/paging/common/api/3.0.0-alpha03.txt b/paging/common/api/3.0.0-alpha03.txt
index e07b2b5..3515c9c 100644
--- a/paging/common/api/3.0.0-alpha03.txt
+++ b/paging/common/api/3.0.0-alpha03.txt
@@ -29,9 +29,7 @@
method @AnyThread public void invalidate();
method @WorkerThread public boolean isInvalid();
method public <ToValue> androidx.paging.DataSource<Key,ToValue> map(androidx.arch.core.util.Function<Value,ToValue> function);
- method public <ToValue> androidx.paging.DataSource<Key,ToValue> map(kotlin.jvm.functions.Function1<? super Value,? extends ToValue> function);
method public <ToValue> androidx.paging.DataSource<Key,ToValue> mapByPage(androidx.arch.core.util.Function<java.util.List<Value>,java.util.List<ToValue>> function);
- method public <ToValue> androidx.paging.DataSource<Key,ToValue> mapByPage(kotlin.jvm.functions.Function1<? super java.util.List<? extends Value>,? extends java.util.List<? extends ToValue>> function);
method @AnyThread public void removeInvalidatedCallback(androidx.paging.DataSource.InvalidatedCallback onInvalidatedCallback);
method @AnyThread public final void removeInvalidatedCallback(kotlin.jvm.functions.Function0<kotlin.Unit> onInvalidatedCallback);
property @WorkerThread public boolean isInvalid;
@@ -43,9 +41,7 @@
method public final kotlin.jvm.functions.Function0<androidx.paging.PagingSource<Key,Value>> asPagingSourceFactory();
method public abstract androidx.paging.DataSource<Key,Value> create();
method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> map(androidx.arch.core.util.Function<Value,ToValue> function);
- method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> map(kotlin.jvm.functions.Function1<? super Value,? extends ToValue> function);
method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> mapByPage(androidx.arch.core.util.Function<java.util.List<Value>,java.util.List<ToValue>> function);
- method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> mapByPage(kotlin.jvm.functions.Function1<? super java.util.List<? extends Value>,? extends java.util.List<? extends ToValue>> function);
}
public static interface DataSource.InvalidatedCallback {
diff --git a/paging/common/api/current.txt b/paging/common/api/current.txt
index e07b2b5..3515c9c 100644
--- a/paging/common/api/current.txt
+++ b/paging/common/api/current.txt
@@ -29,9 +29,7 @@
method @AnyThread public void invalidate();
method @WorkerThread public boolean isInvalid();
method public <ToValue> androidx.paging.DataSource<Key,ToValue> map(androidx.arch.core.util.Function<Value,ToValue> function);
- method public <ToValue> androidx.paging.DataSource<Key,ToValue> map(kotlin.jvm.functions.Function1<? super Value,? extends ToValue> function);
method public <ToValue> androidx.paging.DataSource<Key,ToValue> mapByPage(androidx.arch.core.util.Function<java.util.List<Value>,java.util.List<ToValue>> function);
- method public <ToValue> androidx.paging.DataSource<Key,ToValue> mapByPage(kotlin.jvm.functions.Function1<? super java.util.List<? extends Value>,? extends java.util.List<? extends ToValue>> function);
method @AnyThread public void removeInvalidatedCallback(androidx.paging.DataSource.InvalidatedCallback onInvalidatedCallback);
method @AnyThread public final void removeInvalidatedCallback(kotlin.jvm.functions.Function0<kotlin.Unit> onInvalidatedCallback);
property @WorkerThread public boolean isInvalid;
@@ -43,9 +41,7 @@
method public final kotlin.jvm.functions.Function0<androidx.paging.PagingSource<Key,Value>> asPagingSourceFactory();
method public abstract androidx.paging.DataSource<Key,Value> create();
method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> map(androidx.arch.core.util.Function<Value,ToValue> function);
- method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> map(kotlin.jvm.functions.Function1<? super Value,? extends ToValue> function);
method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> mapByPage(androidx.arch.core.util.Function<java.util.List<Value>,java.util.List<ToValue>> function);
- method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> mapByPage(kotlin.jvm.functions.Function1<? super java.util.List<? extends Value>,? extends java.util.List<? extends ToValue>> function);
}
public static interface DataSource.InvalidatedCallback {
diff --git a/paging/common/api/public_plus_experimental_3.0.0-alpha03.txt b/paging/common/api/public_plus_experimental_3.0.0-alpha03.txt
index 394b810..f7e5ad7 100644
--- a/paging/common/api/public_plus_experimental_3.0.0-alpha03.txt
+++ b/paging/common/api/public_plus_experimental_3.0.0-alpha03.txt
@@ -30,9 +30,7 @@
method @AnyThread public void invalidate();
method @WorkerThread public boolean isInvalid();
method public <ToValue> androidx.paging.DataSource<Key,ToValue> map(androidx.arch.core.util.Function<Value,ToValue> function);
- method public <ToValue> androidx.paging.DataSource<Key,ToValue> map(kotlin.jvm.functions.Function1<? super Value,? extends ToValue> function);
method public <ToValue> androidx.paging.DataSource<Key,ToValue> mapByPage(androidx.arch.core.util.Function<java.util.List<Value>,java.util.List<ToValue>> function);
- method public <ToValue> androidx.paging.DataSource<Key,ToValue> mapByPage(kotlin.jvm.functions.Function1<? super java.util.List<? extends Value>,? extends java.util.List<? extends ToValue>> function);
method @AnyThread public void removeInvalidatedCallback(androidx.paging.DataSource.InvalidatedCallback onInvalidatedCallback);
method @AnyThread public final void removeInvalidatedCallback(kotlin.jvm.functions.Function0<kotlin.Unit> onInvalidatedCallback);
property @WorkerThread public boolean isInvalid;
@@ -44,9 +42,7 @@
method public final kotlin.jvm.functions.Function0<androidx.paging.PagingSource<Key,Value>> asPagingSourceFactory();
method public abstract androidx.paging.DataSource<Key,Value> create();
method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> map(androidx.arch.core.util.Function<Value,ToValue> function);
- method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> map(kotlin.jvm.functions.Function1<? super Value,? extends ToValue> function);
method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> mapByPage(androidx.arch.core.util.Function<java.util.List<Value>,java.util.List<ToValue>> function);
- method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> mapByPage(kotlin.jvm.functions.Function1<? super java.util.List<? extends Value>,? extends java.util.List<? extends ToValue>> function);
}
public static interface DataSource.InvalidatedCallback {
diff --git a/paging/common/api/public_plus_experimental_current.txt b/paging/common/api/public_plus_experimental_current.txt
index 394b810..f7e5ad7 100644
--- a/paging/common/api/public_plus_experimental_current.txt
+++ b/paging/common/api/public_plus_experimental_current.txt
@@ -30,9 +30,7 @@
method @AnyThread public void invalidate();
method @WorkerThread public boolean isInvalid();
method public <ToValue> androidx.paging.DataSource<Key,ToValue> map(androidx.arch.core.util.Function<Value,ToValue> function);
- method public <ToValue> androidx.paging.DataSource<Key,ToValue> map(kotlin.jvm.functions.Function1<? super Value,? extends ToValue> function);
method public <ToValue> androidx.paging.DataSource<Key,ToValue> mapByPage(androidx.arch.core.util.Function<java.util.List<Value>,java.util.List<ToValue>> function);
- method public <ToValue> androidx.paging.DataSource<Key,ToValue> mapByPage(kotlin.jvm.functions.Function1<? super java.util.List<? extends Value>,? extends java.util.List<? extends ToValue>> function);
method @AnyThread public void removeInvalidatedCallback(androidx.paging.DataSource.InvalidatedCallback onInvalidatedCallback);
method @AnyThread public final void removeInvalidatedCallback(kotlin.jvm.functions.Function0<kotlin.Unit> onInvalidatedCallback);
property @WorkerThread public boolean isInvalid;
@@ -44,9 +42,7 @@
method public final kotlin.jvm.functions.Function0<androidx.paging.PagingSource<Key,Value>> asPagingSourceFactory();
method public abstract androidx.paging.DataSource<Key,Value> create();
method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> map(androidx.arch.core.util.Function<Value,ToValue> function);
- method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> map(kotlin.jvm.functions.Function1<? super Value,? extends ToValue> function);
method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> mapByPage(androidx.arch.core.util.Function<java.util.List<Value>,java.util.List<ToValue>> function);
- method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> mapByPage(kotlin.jvm.functions.Function1<? super java.util.List<? extends Value>,? extends java.util.List<? extends ToValue>> function);
}
public static interface DataSource.InvalidatedCallback {
diff --git a/paging/common/api/restricted_3.0.0-alpha03.txt b/paging/common/api/restricted_3.0.0-alpha03.txt
index e07b2b5..3515c9c 100644
--- a/paging/common/api/restricted_3.0.0-alpha03.txt
+++ b/paging/common/api/restricted_3.0.0-alpha03.txt
@@ -29,9 +29,7 @@
method @AnyThread public void invalidate();
method @WorkerThread public boolean isInvalid();
method public <ToValue> androidx.paging.DataSource<Key,ToValue> map(androidx.arch.core.util.Function<Value,ToValue> function);
- method public <ToValue> androidx.paging.DataSource<Key,ToValue> map(kotlin.jvm.functions.Function1<? super Value,? extends ToValue> function);
method public <ToValue> androidx.paging.DataSource<Key,ToValue> mapByPage(androidx.arch.core.util.Function<java.util.List<Value>,java.util.List<ToValue>> function);
- method public <ToValue> androidx.paging.DataSource<Key,ToValue> mapByPage(kotlin.jvm.functions.Function1<? super java.util.List<? extends Value>,? extends java.util.List<? extends ToValue>> function);
method @AnyThread public void removeInvalidatedCallback(androidx.paging.DataSource.InvalidatedCallback onInvalidatedCallback);
method @AnyThread public final void removeInvalidatedCallback(kotlin.jvm.functions.Function0<kotlin.Unit> onInvalidatedCallback);
property @WorkerThread public boolean isInvalid;
@@ -43,9 +41,7 @@
method public final kotlin.jvm.functions.Function0<androidx.paging.PagingSource<Key,Value>> asPagingSourceFactory();
method public abstract androidx.paging.DataSource<Key,Value> create();
method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> map(androidx.arch.core.util.Function<Value,ToValue> function);
- method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> map(kotlin.jvm.functions.Function1<? super Value,? extends ToValue> function);
method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> mapByPage(androidx.arch.core.util.Function<java.util.List<Value>,java.util.List<ToValue>> function);
- method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> mapByPage(kotlin.jvm.functions.Function1<? super java.util.List<? extends Value>,? extends java.util.List<? extends ToValue>> function);
}
public static interface DataSource.InvalidatedCallback {
diff --git a/paging/common/api/restricted_current.txt b/paging/common/api/restricted_current.txt
index e07b2b5..3515c9c 100644
--- a/paging/common/api/restricted_current.txt
+++ b/paging/common/api/restricted_current.txt
@@ -29,9 +29,7 @@
method @AnyThread public void invalidate();
method @WorkerThread public boolean isInvalid();
method public <ToValue> androidx.paging.DataSource<Key,ToValue> map(androidx.arch.core.util.Function<Value,ToValue> function);
- method public <ToValue> androidx.paging.DataSource<Key,ToValue> map(kotlin.jvm.functions.Function1<? super Value,? extends ToValue> function);
method public <ToValue> androidx.paging.DataSource<Key,ToValue> mapByPage(androidx.arch.core.util.Function<java.util.List<Value>,java.util.List<ToValue>> function);
- method public <ToValue> androidx.paging.DataSource<Key,ToValue> mapByPage(kotlin.jvm.functions.Function1<? super java.util.List<? extends Value>,? extends java.util.List<? extends ToValue>> function);
method @AnyThread public void removeInvalidatedCallback(androidx.paging.DataSource.InvalidatedCallback onInvalidatedCallback);
method @AnyThread public final void removeInvalidatedCallback(kotlin.jvm.functions.Function0<kotlin.Unit> onInvalidatedCallback);
property @WorkerThread public boolean isInvalid;
@@ -43,9 +41,7 @@
method public final kotlin.jvm.functions.Function0<androidx.paging.PagingSource<Key,Value>> asPagingSourceFactory();
method public abstract androidx.paging.DataSource<Key,Value> create();
method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> map(androidx.arch.core.util.Function<Value,ToValue> function);
- method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> map(kotlin.jvm.functions.Function1<? super Value,? extends ToValue> function);
method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> mapByPage(androidx.arch.core.util.Function<java.util.List<Value>,java.util.List<ToValue>> function);
- method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> mapByPage(kotlin.jvm.functions.Function1<? super java.util.List<? extends Value>,? extends java.util.List<? extends ToValue>> function);
}
public static interface DataSource.InvalidatedCallback {
diff --git a/paging/common/src/main/kotlin/androidx/paging/DataSource.kt b/paging/common/src/main/kotlin/androidx/paging/DataSource.kt
index 2556218..1ad5e07 100644
--- a/paging/common/src/main/kotlin/androidx/paging/DataSource.kt
+++ b/paging/common/src/main/kotlin/androidx/paging/DataSource.kt
@@ -184,6 +184,7 @@
* @see DataSource.map
* @see DataSource.mapByPage
*/
+ @JvmSynthetic // hidden to preserve Java source compat with arch.core.util.Function variant
open fun <ToValue : Any> map(function: (Value) -> ToValue): Factory<Key, ToValue> =
mapByPage(Function { list -> list.map(function) })
@@ -224,6 +225,7 @@
* @see DataSource.map
* @see DataSource.mapByPage
*/
+ @JvmSynthetic // hidden to preserve Java source compat with arch.core.util.Function variant
open fun <ToValue : Any> mapByPage(
function: (List<Value>) -> List<ToValue>
): Factory<Key, ToValue> = mapByPage(Function { function(it) })
@@ -270,6 +272,7 @@
* @see DataSource.Factory.map
* @see DataSource.Factory.mapByPage
*/
+ @JvmSynthetic // hidden to preserve Java source compat with arch.core.util.Function variant
open fun <ToValue : Any> mapByPage(
function: (List<Value>) -> List<ToValue>
): DataSource<Key, ToValue> = mapByPage(Function { function(it) })
@@ -307,6 +310,7 @@
* @see DataSource.Factory.map
*
*/
+ @JvmSynthetic // hidden to preserve Java source compat with arch.core.util.Function variant
open fun <ToValue : Any> map(
function: (Value) -> ToValue
): DataSource<Key, ToValue> = map(Function { function(it) })
diff --git a/ui/integration-tests/benchmark/build.gradle b/ui/integration-tests/benchmark/build.gradle
index 3166750..069444f 100644
--- a/ui/integration-tests/benchmark/build.gradle
+++ b/ui/integration-tests/benchmark/build.gradle
@@ -34,7 +34,7 @@
implementation project(":benchmark:benchmark-junit4")
implementation project(":compose:runtime:runtime")
- implementation project(":ui:integration-tests")
+ implementation project(":compose:integration-tests")
implementation project(":compose:test:test-core")
implementation project(":compose:foundation:foundation-layout")
implementation(KOTLIN_STDLIB)
@@ -54,11 +54,10 @@
}
androidx {
- name = "UI Benchmarks"
+ name = "Compose Benchmarks"
publish = Publish.NONE
- mavenGroup = LibraryGroups.UI
inceptionYear = "2019"
- description = "UI Benchmarks"
+ description = "Compose Benchmarks"
}
android.defaultConfig.minSdkVersion 21
diff --git a/ui/integration-tests/build.gradle b/ui/integration-tests/build.gradle
index 917e793..dfffac1 100644
--- a/ui/integration-tests/build.gradle
+++ b/ui/integration-tests/build.gradle
@@ -47,11 +47,10 @@
}
androidx {
- name = "UI Integration Tests"
+ name = "Compose Integration Tests"
publish = Publish.NONE
- mavenGroup = LibraryGroups.UI
inceptionYear = "2019"
- description = "UI Integration Tests"
+ description = "Compose Integration Tests"
}
android.defaultConfig.minSdkVersion 21
diff --git a/ui/integration-tests/demos/build.gradle b/ui/integration-tests/demos/build.gradle
index a0ea15b..b40f472 100644
--- a/ui/integration-tests/demos/build.gradle
+++ b/ui/integration-tests/demos/build.gradle
@@ -12,7 +12,7 @@
dependencies {
kotlinPlugin project(path: ":compose:compose-compiler")
- implementation project(":ui:ui-android-view:integration-tests:ui-android-view-demos")
+ implementation project(":compose:android-view:android-view:integration-tests:android-view-demos")
implementation project(":compose:animation:animation:integration-tests:animation-demos")
implementation project(":compose:foundation:foundation:integration-tests:foundation-demos")
implementation project(":compose:core:core:integration-tests:core-demos")
@@ -25,20 +25,20 @@
implementation(KOTLIN_STDLIB)
implementation project(":compose:runtime:runtime")
- implementation project(":ui:ui-android-view")
+ implementation project(":compose:android-view:android-view")
implementation project(":compose:core:core")
implementation project(":compose:foundation:foundation-layout")
implementation project(":compose:foundation:foundation-text")
implementation project(":compose:foundation:foundation")
implementation project(":compose:material:material")
- implementation project(":ui:integration-tests:demos:common")
+ implementation project(":compose:integration-tests:demos:common")
implementation "androidx.preference:preference-ktx:1.1.0"
androidTestImplementation project(":compose:test:test-core")
// TODO: presumably shouldn't need to specify these again? figure out why this is needed.
- androidTestImplementation project(":ui:ui-android-view:integration-tests:ui-android-view-demos")
+ androidTestImplementation project(":compose:android-view:android-view:integration-tests:android-view-demos")
androidTestImplementation project(":compose:animation:animation:integration-tests:animation-demos")
androidTestImplementation project(":compose:foundation:foundation:integration-tests:foundation-demos")
androidTestImplementation project(":compose:core:core:integration-tests:core-demos")
diff --git a/ui/settings.gradle b/ui/settings.gradle
index f425f05..2bb1deb 100644
--- a/ui/settings.gradle
+++ b/ui/settings.gradle
@@ -55,35 +55,36 @@
includeProject(":tracing", "../tracing")
includeProject(":tracing:tracing", "../tracing/tracing")
includeProject(":tracing:tracing-ktx", "../tracing/tracing-ktx")
-includeProject(":ui", "ui")
-includeProject(":ui:integration-tests:benchmark", "integration-tests/benchmark")
-includeProject(":ui:integration-tests:demos", "integration-tests/demos")
-includeProject(":ui:integration-tests:demos:common", "integration-tests/demos/common")
-includeProject(":ui:integration-tests", "integration-tests")
+includeProject(":compose:integration-tests:benchmark", "integration-tests/benchmark")
+includeProject(":compose:integration-tests:demos", "integration-tests/demos")
+includeProject(":compose:integration-tests:demos:common", "integration-tests/demos/common")
+includeProject(":compose:integration-tests", "integration-tests")
includeProject(":compose:core:core-text-android", "ui-text-android")
-includeProject(":ui:ui-android-view", "ui-android-view")
-includeProject(":ui:ui-android-view:integration-tests:ui-android-view-demos", "ui-android-view/integration-tests/android-view-demos")
-includeProject(":ui:ui-android-view:samples", "ui-android-view/samples")
+includeProject(":compose:android-view", "../compose/android-view")
+includeProject(":compose:android-view:android-view", "ui-android-view")
+includeProject(":compose:android-view:android-view:integration-tests:android-view-demos", "ui-android-view/integration-tests/android-view-demos")
+includeProject(":compose:android-view:android-view:samples", "ui-android-view/samples")
includeProject(":compose:animation", "../compose/animation")
includeProject(":compose:animation:animation", "ui-animation")
includeProject(":compose:animation:animation-core", "ui-animation-core")
includeProject(":compose:animation:animation-core:samples", "ui-animation-core/samples")
includeProject(":compose:animation:animation:integration-tests:animation-demos", "ui-animation/integration-tests/animation-demos")
includeProject(":compose:animation:animation:samples", "ui-animation/samples")
-includeProject(":ui:ui-animation-tooling-internal", "ui-animation-tooling-internal")
+includeProject(":compose:tooling:tooling-animation-internal", "ui-animation-tooling-internal")
includeProject(":compose:core:core", "ui-core")
includeProject(":compose:core:core:integration-tests:core-demos", "ui-core/integration-tests/ui-core-demos")
includeProject(":compose:core:core:samples", "ui-core/samples")
if (!startParameter.projectProperties.containsKey('compose.desktop.disable')) {
- includeProject(":ui:ui-desktop", "ui-desktop")
- includeProject(":ui:ui-desktop:android-emu", "ui-desktop/android-emu")
- includeProject(":ui:ui-desktop:samples", "ui-desktop/samples")
+ includeProject(":compose:desktop", "../compose/desktop")
+ includeProject(":compose:desktop:desktop", "ui-desktop")
+ includeProject(":compose:desktop:desktop:android-emu", "ui-desktop/android-emu")
+ includeProject(":compose:desktop:desktop:samples", "ui-desktop/samples")
}
includeProject(":compose:foundation", "../compose/foundation")
includeProject(":compose:foundation:foundation", "ui-foundation")
includeProject(":compose:foundation:foundation:integration-tests:foundation-demos", "ui-foundation/integration-tests/foundation-demos")
includeProject(":compose:foundation:foundation:samples", "ui-foundation/samples")
-includeProject(":ui:ui-internal-lint-checks", "ui-internal-lint-checks")
+includeProject(":compose:internal-lint-checks", "ui-internal-lint-checks")
includeProject(":compose:core", "../compose/core")
includeProject(":compose:core:core-geometry", "ui-geometry")
includeProject(":compose:core:core-graphics", "ui-graphics")
@@ -102,7 +103,7 @@
includeProject(":compose:material:material:icons:generator", "ui-material/icons/generator")
includeProject(":compose:test", "../compose/test")
includeProject(":compose:test:test-core", "ui-test")
-includeProject(":ui:ui-test-font", "ui-test-font")
+includeProject(":compose:core:core-test-font", "ui-test-font")
includeProject(":compose:foundation:foundation-text", "ui-text")
includeProject(":compose:foundation:foundation-text:integration-tests:foundation-text-demos", "ui-text/integration-tests/ui-text-compose-demos")
includeProject(":compose:foundation:foundation-text:samples", "ui-text/samples")
diff --git a/ui/ui-android-view/build.gradle b/ui/ui-android-view/build.gradle
index 4ffdab2..98011d1 100644
--- a/ui/ui-android-view/build.gradle
+++ b/ui/ui-android-view/build.gradle
@@ -61,10 +61,8 @@
}
androidx {
- name = "AndroidX UI View components"
+ name = "Compose View Wrappers"
publish = Publish.NONE
- mavenVersion = LibraryVersions.UI
- mavenGroup = LibraryGroups.UI
inceptionYear = "2019"
- description = "AndroidX UI View wrappers."
+ description = "Compose View Wrappers."
}
diff --git a/ui/ui-android-view/integration-tests/android-view-demos/build.gradle b/ui/ui-android-view/integration-tests/android-view-demos/build.gradle
index a9ad7fe..b39a389 100644
--- a/ui/ui-android-view/integration-tests/android-view-demos/build.gradle
+++ b/ui/ui-android-view/integration-tests/android-view-demos/build.gradle
@@ -31,8 +31,8 @@
implementation(KOTLIN_STDLIB)
implementation project(":compose:runtime:runtime")
- implementation project(":ui:integration-tests:demos:common")
- implementation project(":ui:ui-android-view")
+ implementation project(":compose:integration-tests:demos:common")
+ implementation project(":compose:android-view:android-view")
implementation project(":compose:core:core")
implementation project(":compose:foundation:foundation-layout")
implementation project(":compose:material:material")
diff --git a/ui/ui-android-view/samples/build.gradle b/ui/ui-android-view/samples/build.gradle
index 387c352..3f920f0 100644
--- a/ui/ui-android-view/samples/build.gradle
+++ b/ui/ui-android-view/samples/build.gradle
@@ -36,7 +36,7 @@
implementation project(":compose:foundation:foundation-layout")
implementation project(":compose:foundation:foundation")
implementation project(":compose:core:core-text")
- implementation project(":ui:ui-android-view")
+ implementation project(":compose:android-view:android-view")
}
android {
diff --git a/ui/ui-animation-tooling-internal/build.gradle b/ui/ui-animation-tooling-internal/build.gradle
index 4be1456..10b5114 100644
--- a/ui/ui-animation-tooling-internal/build.gradle
+++ b/ui/ui-animation-tooling-internal/build.gradle
@@ -34,6 +34,6 @@
description = "Compose Animation APIs for tooling support. Internal use only."
publish = Publish.SNAPSHOT_ONLY
mavenVersion = LibraryVersions.UI
- mavenGroup = LibraryGroups.UI
+ mavenGroup = LibraryGroups.Compose.TOOLING
generateDocs = false
}
diff --git a/ui/ui-animation/api/0.1.0-dev15.txt b/ui/ui-animation/api/0.1.0-dev15.txt
index f75f12a..efbecd3 100644
--- a/ui/ui-animation/api/0.1.0-dev15.txt
+++ b/ui/ui-animation/api/0.1.0-dev15.txt
@@ -132,6 +132,7 @@
}
public final class TransitionKt {
+ method @Deprecated @androidx.compose.Composable public static <T> void Transition(androidx.animation.TransitionDefinition<T> definition, T? toState, androidx.animation.AnimationClockObservable clock = AnimationClockAmbient.current, T? initState = toState, kotlin.jvm.functions.Function1<? super T,kotlin.Unit>? onStateChangeFinished = null, kotlin.jvm.functions.Function1<? super androidx.animation.TransitionState,kotlin.Unit> children);
method public static boolean getTransitionsEnabled();
method public static void setTransitionsEnabled(boolean p);
method @androidx.compose.Composable public static <T> androidx.animation.TransitionState transition(androidx.animation.TransitionDefinition<T> definition, T? toState, androidx.animation.AnimationClockObservable clock = AnimationClockAmbient.current, T? initState = toState, kotlin.jvm.functions.Function1<? super T,kotlin.Unit>? onStateChangeFinished = null);
diff --git a/ui/ui-animation/api/current.txt b/ui/ui-animation/api/current.txt
index f75f12a..efbecd3 100644
--- a/ui/ui-animation/api/current.txt
+++ b/ui/ui-animation/api/current.txt
@@ -132,6 +132,7 @@
}
public final class TransitionKt {
+ method @Deprecated @androidx.compose.Composable public static <T> void Transition(androidx.animation.TransitionDefinition<T> definition, T? toState, androidx.animation.AnimationClockObservable clock = AnimationClockAmbient.current, T? initState = toState, kotlin.jvm.functions.Function1<? super T,kotlin.Unit>? onStateChangeFinished = null, kotlin.jvm.functions.Function1<? super androidx.animation.TransitionState,kotlin.Unit> children);
method public static boolean getTransitionsEnabled();
method public static void setTransitionsEnabled(boolean p);
method @androidx.compose.Composable public static <T> androidx.animation.TransitionState transition(androidx.animation.TransitionDefinition<T> definition, T? toState, androidx.animation.AnimationClockObservable clock = AnimationClockAmbient.current, T? initState = toState, kotlin.jvm.functions.Function1<? super T,kotlin.Unit>? onStateChangeFinished = null);
diff --git a/ui/ui-animation/api/public_plus_experimental_0.1.0-dev15.txt b/ui/ui-animation/api/public_plus_experimental_0.1.0-dev15.txt
index f75f12a..efbecd3 100644
--- a/ui/ui-animation/api/public_plus_experimental_0.1.0-dev15.txt
+++ b/ui/ui-animation/api/public_plus_experimental_0.1.0-dev15.txt
@@ -132,6 +132,7 @@
}
public final class TransitionKt {
+ method @Deprecated @androidx.compose.Composable public static <T> void Transition(androidx.animation.TransitionDefinition<T> definition, T? toState, androidx.animation.AnimationClockObservable clock = AnimationClockAmbient.current, T? initState = toState, kotlin.jvm.functions.Function1<? super T,kotlin.Unit>? onStateChangeFinished = null, kotlin.jvm.functions.Function1<? super androidx.animation.TransitionState,kotlin.Unit> children);
method public static boolean getTransitionsEnabled();
method public static void setTransitionsEnabled(boolean p);
method @androidx.compose.Composable public static <T> androidx.animation.TransitionState transition(androidx.animation.TransitionDefinition<T> definition, T? toState, androidx.animation.AnimationClockObservable clock = AnimationClockAmbient.current, T? initState = toState, kotlin.jvm.functions.Function1<? super T,kotlin.Unit>? onStateChangeFinished = null);
diff --git a/ui/ui-animation/api/public_plus_experimental_current.txt b/ui/ui-animation/api/public_plus_experimental_current.txt
index f75f12a..efbecd3 100644
--- a/ui/ui-animation/api/public_plus_experimental_current.txt
+++ b/ui/ui-animation/api/public_plus_experimental_current.txt
@@ -132,6 +132,7 @@
}
public final class TransitionKt {
+ method @Deprecated @androidx.compose.Composable public static <T> void Transition(androidx.animation.TransitionDefinition<T> definition, T? toState, androidx.animation.AnimationClockObservable clock = AnimationClockAmbient.current, T? initState = toState, kotlin.jvm.functions.Function1<? super T,kotlin.Unit>? onStateChangeFinished = null, kotlin.jvm.functions.Function1<? super androidx.animation.TransitionState,kotlin.Unit> children);
method public static boolean getTransitionsEnabled();
method public static void setTransitionsEnabled(boolean p);
method @androidx.compose.Composable public static <T> androidx.animation.TransitionState transition(androidx.animation.TransitionDefinition<T> definition, T? toState, androidx.animation.AnimationClockObservable clock = AnimationClockAmbient.current, T? initState = toState, kotlin.jvm.functions.Function1<? super T,kotlin.Unit>? onStateChangeFinished = null);
diff --git a/ui/ui-animation/api/restricted_0.1.0-dev15.txt b/ui/ui-animation/api/restricted_0.1.0-dev15.txt
index f75f12a..efbecd3 100644
--- a/ui/ui-animation/api/restricted_0.1.0-dev15.txt
+++ b/ui/ui-animation/api/restricted_0.1.0-dev15.txt
@@ -132,6 +132,7 @@
}
public final class TransitionKt {
+ method @Deprecated @androidx.compose.Composable public static <T> void Transition(androidx.animation.TransitionDefinition<T> definition, T? toState, androidx.animation.AnimationClockObservable clock = AnimationClockAmbient.current, T? initState = toState, kotlin.jvm.functions.Function1<? super T,kotlin.Unit>? onStateChangeFinished = null, kotlin.jvm.functions.Function1<? super androidx.animation.TransitionState,kotlin.Unit> children);
method public static boolean getTransitionsEnabled();
method public static void setTransitionsEnabled(boolean p);
method @androidx.compose.Composable public static <T> androidx.animation.TransitionState transition(androidx.animation.TransitionDefinition<T> definition, T? toState, androidx.animation.AnimationClockObservable clock = AnimationClockAmbient.current, T? initState = toState, kotlin.jvm.functions.Function1<? super T,kotlin.Unit>? onStateChangeFinished = null);
diff --git a/ui/ui-animation/api/restricted_current.txt b/ui/ui-animation/api/restricted_current.txt
index f75f12a..efbecd3 100644
--- a/ui/ui-animation/api/restricted_current.txt
+++ b/ui/ui-animation/api/restricted_current.txt
@@ -132,6 +132,7 @@
}
public final class TransitionKt {
+ method @Deprecated @androidx.compose.Composable public static <T> void Transition(androidx.animation.TransitionDefinition<T> definition, T? toState, androidx.animation.AnimationClockObservable clock = AnimationClockAmbient.current, T? initState = toState, kotlin.jvm.functions.Function1<? super T,kotlin.Unit>? onStateChangeFinished = null, kotlin.jvm.functions.Function1<? super androidx.animation.TransitionState,kotlin.Unit> children);
method public static boolean getTransitionsEnabled();
method public static void setTransitionsEnabled(boolean p);
method @androidx.compose.Composable public static <T> androidx.animation.TransitionState transition(androidx.animation.TransitionDefinition<T> definition, T? toState, androidx.animation.AnimationClockObservable clock = AnimationClockAmbient.current, T? initState = toState, kotlin.jvm.functions.Function1<? super T,kotlin.Unit>? onStateChangeFinished = null);
diff --git a/ui/ui-animation/integration-tests/animation-demos/build.gradle b/ui/ui-animation/integration-tests/animation-demos/build.gradle
index c8a0485..32a8a17 100644
--- a/ui/ui-animation/integration-tests/animation-demos/build.gradle
+++ b/ui/ui-animation/integration-tests/animation-demos/build.gradle
@@ -15,7 +15,7 @@
implementation(KOTLIN_STDLIB)
implementation project(":compose:runtime:runtime")
- implementation project(":ui:integration-tests:demos:common")
+ implementation project(":compose:integration-tests:demos:common")
implementation project(":compose:core:core")
implementation project(":compose:foundation:foundation-layout")
implementation project(":compose:core:core-text")
diff --git a/ui/ui-animation/src/commonMain/kotlin/androidx/ui/animation/Transition.kt b/ui/ui-animation/src/commonMain/kotlin/androidx/ui/animation/Transition.kt
index 2b6e100..f423c6a 100644
--- a/ui/ui-animation/src/commonMain/kotlin/androidx/ui/animation/Transition.kt
+++ b/ui/ui-animation/src/commonMain/kotlin/androidx/ui/animation/Transition.kt
@@ -97,6 +97,58 @@
}
/**
+ * [Transition] composable creates a state-based transition using the animation configuration
+ * defined in [TransitionDefinition]. This can be especially useful when animating multiple
+ * values from a predefined set of values to another. For animating a single value, consider using
+ * [animatedValue], [animatedFloat], [animatedColor] or the more light-weight [animate] APIs.
+ *
+ * [Transition] starts a new animation or changes the on-going animation when the [toState]
+ * parameter is changed to a different value. It dutifully ensures that the animation will head
+ * towards new [toState] regardless of what state (or in-between state) it’s currently in: If the
+ * transition is not currently animating, having a new [toState] value will start a new animation,
+ * otherwise the in-flight animation will correct course and animate towards the new [toState]
+ * based on the interruption handling logic.
+ *
+ * [Transition] takes a transition definition, a target state and child composables.
+ * These child composables will be receiving a [TransitionState] object as an argument, which
+ * captures all the current values of the animation. Child composables should read the animation
+ * values from the [TransitionState] object, and apply the value wherever necessary.
+ *
+ * @sample androidx.ui.animation.samples.TransitionSample
+ *
+ * @param definition Transition definition that defines states and transitions
+ * @param toState New state to transition to
+ * @param clock Optional animation clock that pulses animations when time changes. By default,
+ * the system uses a choreographer based clock read from the [AnimationClockAmbient].
+ * A custom implementation of the [AnimationClockObservable] (such as a
+ * [androidx.animation.ManualAnimationClock]) can be supplied here if there’s a need to
+ * manually control the clock (for example in tests).
+ * @param initState Optional initial state for the transition. When undefined, the initial state
+ * will be set to the first [toState] seen in the transition.
+ * @param onStateChangeFinished An optional listener to get notified when state change animation
+ * has completed
+ * @param children The children composables that will be animated
+ *
+ * @see [TransitionDefinition]
+ */
+@Deprecated("Transition has been renamed to transition, which returns a TransitionState instead " +
+ "of passing it to children",
+ replaceWith = ReplaceWith(
+ "transition(definition, toState, clock, initState, onStateChangeFinished)",
+ "androidx.ui.animation.transition"))
+@Composable
+fun <T> Transition(
+ definition: TransitionDefinition<T>,
+ toState: T,
+ clock: AnimationClockObservable = AnimationClockAmbient.current,
+ initState: T = toState,
+ onStateChangeFinished: ((T) -> Unit)? = null,
+ children: @Composable (state: TransitionState) -> Unit
+) {
+ val state = transition(definition, toState, clock, initState, onStateChangeFinished)
+ children(state)
+}
+/**
* Stores the enabled state for [transition] animations. Useful for tests to disable
* animations and have reliable screenshot tests.
*/
diff --git a/ui/ui-core/build.gradle b/ui/ui-core/build.gradle
index ce206cc..47a0b16 100644
--- a/ui/ui-core/build.gradle
+++ b/ui/ui-core/build.gradle
@@ -91,7 +91,7 @@
exclude group: 'org.mockito' // to keep control on the mockito version
}
implementation project(":compose:test:test-core")
- implementation project(":ui:ui-test-font")
+ implementation project(":compose:core:core-test-font")
implementation project(":compose:foundation:foundation-layout")
implementation project(":compose:foundation:foundation")
}
diff --git a/ui/ui-core/integration-tests/ui-core-demos/build.gradle b/ui/ui-core/integration-tests/ui-core-demos/build.gradle
index a28804a..e9836f3 100644
--- a/ui/ui-core/integration-tests/ui-core-demos/build.gradle
+++ b/ui/ui-core/integration-tests/ui-core-demos/build.gradle
@@ -15,7 +15,7 @@
implementation(KOTLIN_STDLIB)
implementation project(":compose:runtime:runtime")
- implementation project(":ui:integration-tests:demos:common")
+ implementation project(":compose:integration-tests:demos:common")
implementation project(":compose:core:core")
implementation project(":compose:foundation:foundation-layout")
implementation project(":compose:core:core-text")
diff --git a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/viewinterop/ViewRef.kt b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/viewinterop/ViewRef.kt
index 3ebb69a..7d02c7b 100644
--- a/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/viewinterop/ViewRef.kt
+++ b/ui/ui-core/integration-tests/ui-core-demos/src/main/java/androidx/ui/core/demos/viewinterop/ViewRef.kt
@@ -19,7 +19,7 @@
import android.view.View
import androidx.ui.core.Ref
-// TODO(popam): this file is a subset of ViewRef.kt in ui-android-view. Deduplicate later
+// TODO(popam): this file is a subset of ViewRef.kt in android-view. Deduplicate later
/**
* A Ref is essentially a "value-holder" class that can be used with Compose to get
diff --git a/ui/ui-core/src/androidAndroidTest/kotlin/androidx/ui/core/test/DrawShadowTest.kt b/ui/ui-core/src/androidAndroidTest/kotlin/androidx/ui/core/test/DrawShadowTest.kt
index 8dcd648..0163ff7 100644
--- a/ui/ui-core/src/androidAndroidTest/kotlin/androidx/ui/core/test/DrawShadowTest.kt
+++ b/ui/ui-core/src/androidAndroidTest/kotlin/androidx/ui/core/test/DrawShadowTest.kt
@@ -59,7 +59,6 @@
private lateinit var activity: TestActivity
private lateinit var drawLatch: CountDownLatch
- // TODO move RectangleShape to ui-framework b/137222372
private val rectShape = object : Shape {
override fun createOutline(size: Size, density: Density): Outline =
Outline.Rectangle(size.toRect())
diff --git a/ui/ui-desktop/README.md b/ui/ui-desktop/README.md
index f829147..b4157da 100644
--- a/ui/ui-desktop/README.md
+++ b/ui/ui-desktop/README.md
@@ -2,4 +2,4 @@
To try:
- ./gradlew :ui:ui-desktop:samples:run
+ ./gradlew :compose:desktop:desktop:samples:run
diff --git a/ui/ui-desktop/build.gradle b/ui/ui-desktop/build.gradle
index c086fc8..9e03d56 100644
--- a/ui/ui-desktop/build.gradle
+++ b/ui/ui-desktop/build.gradle
@@ -89,7 +89,7 @@
kotlinPlugin project(path: ":compose:compose-compiler")
}
-def composeClassDir = "${project.rootProject.buildDir}/ui-desktop/compose-libs/"
+def composeClassDir = "${project.rootProject.buildDir}/desktop/compose-libs/"
kotlin {
jvm()
@@ -111,7 +111,7 @@
api "org.jetbrains.skija:skija:0.4.1"
- api project(":ui:ui-desktop:android-emu")
+ api project(":compose:desktop:desktop:android-emu")
api fileTree(composeClassDir)
@@ -138,7 +138,7 @@
}
def uiComponents = [
- ":ui:ui-android-view",
+ ":compose:android-view:android-view",
":compose:animation:animation",
":compose:animation:animation-core",
":compose:core:core",
@@ -340,7 +340,7 @@
}
}
project.tasks.register("jar", Jar).configure {
- baseName = "ui-desktop"
+ baseName = "desktop"
from { kotlin.jvm().compilations["main"].output.allOutputs }
}
@@ -349,5 +349,5 @@
}
rootProject.tasks.getByName("buildOnServer").configure {
- dependsOn(":ui:ui-desktop:jar")
+ dependsOn(":compose:desktop:desktop:jar")
}
diff --git a/ui/ui-desktop/samples/build.gradle b/ui/ui-desktop/samples/build.gradle
index 5ceffaa..4ae7390 100644
--- a/ui/ui-desktop/samples/build.gradle
+++ b/ui/ui-desktop/samples/build.gradle
@@ -26,7 +26,7 @@
kotlinPlugin project(path: ":compose:compose-compiler")
}
-def sdkDir = "${project.rootProject.buildDir}/ui-desktop/compose-libs/"
+def sdkDir = "${project.rootProject.buildDir}/desktop/compose-libs/"
kotlin {
jvm()
@@ -37,7 +37,7 @@
}
jvmMain.dependencies {
- implementation project(":ui:ui-desktop")
+ implementation project(":compose:desktop:desktop")
implementation fileTree(sdkDir)
}
}
@@ -50,7 +50,7 @@
}
task run1(type: JavaExec) {
- dependsOn(":ui:ui-desktop:jar")
+ dependsOn(":compose:desktop:desktop:jar")
main = 'androidx.ui.desktop.examples.example1.MainKt'
def compilation = kotlin.jvm().compilations["main"]
classpath =
@@ -60,7 +60,7 @@
}
task run2(type: JavaExec) {
- dependsOn(":ui:ui-desktop:jar")
+ dependsOn(":compose:desktop:desktop:jar")
main = 'androidx.ui.desktop.examples.example2.MainKt'
def compilation = kotlin.jvm().compilations["main"]
classpath =
@@ -70,7 +70,7 @@
}
task run3(type: JavaExec) {
- dependsOn(":ui:ui-desktop:jar")
+ dependsOn(":compose:desktop:desktop:jar")
main = 'androidx.ui.desktop.examples.popupexample.MainKt'
def compilation = kotlin.jvm().compilations["main"]
classpath =
diff --git a/ui/ui-foundation/integration-tests/foundation-demos/build.gradle b/ui/ui-foundation/integration-tests/foundation-demos/build.gradle
index 4f54eb9..61379eb 100644
--- a/ui/ui-foundation/integration-tests/foundation-demos/build.gradle
+++ b/ui/ui-foundation/integration-tests/foundation-demos/build.gradle
@@ -34,7 +34,7 @@
implementation(KOTLIN_STDLIB)
implementation project(":compose:runtime:runtime")
- implementation project(":ui:integration-tests:demos:common")
+ implementation project(":compose:integration-tests:demos:common")
implementation project(":compose:core:core")
implementation project(":compose:foundation:foundation")
implementation project(":compose:animation:animation")
diff --git a/ui/ui-internal-lint-checks/build.gradle b/ui/ui-internal-lint-checks/build.gradle
index 30d0ec9..070faad 100644
--- a/ui/ui-internal-lint-checks/build.gradle
+++ b/ui/ui-internal-lint-checks/build.gradle
@@ -44,10 +44,9 @@
}
androidx {
- name = "UI lint checks"
+ name = "Compose internal lint checks"
publish = Publish.NONE
toolingProject = true
- mavenGroup = LibraryGroups.UI
inceptionYear = "2019"
description = "Internal lint checks for Compose"
}
diff --git a/ui/ui-layout/integration-tests/layout-demos/build.gradle b/ui/ui-layout/integration-tests/layout-demos/build.gradle
index 56af918..10bbc5c 100644
--- a/ui/ui-layout/integration-tests/layout-demos/build.gradle
+++ b/ui/ui-layout/integration-tests/layout-demos/build.gradle
@@ -31,7 +31,7 @@
implementation(KOTLIN_STDLIB)
implementation project(":compose:runtime:runtime")
- implementation project(":ui:integration-tests:demos:common")
+ implementation project(":compose:integration-tests:demos:common")
implementation project(":compose:core:core")
implementation project(":compose:foundation:foundation-layout")
implementation project(":compose:foundation:foundation-layout:samples")
diff --git a/ui/ui-material/icons/generator/build.gradle b/ui/ui-material/icons/generator/build.gradle
index 2968f3a..286a7a6 100644
--- a/ui/ui-material/icons/generator/build.gradle
+++ b/ui/ui-material/icons/generator/build.gradle
@@ -44,7 +44,7 @@
publish = Publish.NONE
toolingProject = true
mavenVersion = LibraryVersions.UI
- mavenGroup = LibraryGroups.UI
+ mavenGroup = LibraryGroups.Compose.MATERIAL
inceptionYear = "2020"
description = "Generator module that parses XML drawables to generate programmatic " +
"representations of Material Icons."
diff --git a/ui/ui-material/integration-tests/material-demos/build.gradle b/ui/ui-material/integration-tests/material-demos/build.gradle
index 0bdb7c4..7bba715a 100644
--- a/ui/ui-material/integration-tests/material-demos/build.gradle
+++ b/ui/ui-material/integration-tests/material-demos/build.gradle
@@ -17,13 +17,13 @@
implementation(KOTLIN_STDLIB)
implementation project(":compose:runtime:runtime")
- implementation project(":ui:integration-tests:demos:common")
+ implementation project(":compose:integration-tests:demos:common")
implementation project(":compose:core:core")
implementation project(":compose:foundation:foundation")
implementation project(":compose:foundation:foundation-layout")
implementation project(":compose:material:material:samples")
implementation project(":compose:core:core-text")
- implementation project(":ui:ui-android-view")
+ implementation project(":compose:android-view:android-view")
implementation project(":compose:material:material")
}
@@ -38,8 +38,6 @@
androidx {
name = "Compose Material Demos"
publish = Publish.NONE
- mavenVersion = LibraryVersions.UI
- mavenGroup = LibraryGroups.UI
inceptionYear = "2019"
description = "This is a project for Material demos."
}
diff --git a/ui/ui-material/integration-tests/material-studies/build.gradle b/ui/ui-material/integration-tests/material-studies/build.gradle
index 016e93e..c78f3c4 100644
--- a/ui/ui-material/integration-tests/material-studies/build.gradle
+++ b/ui/ui-material/integration-tests/material-studies/build.gradle
@@ -35,7 +35,7 @@
implementation(KOTLIN_STDLIB)
implementation project(":compose:runtime:runtime")
- implementation project(":ui:integration-tests:demos:common")
+ implementation project(":compose:integration-tests:demos:common")
implementation project(":compose:core:core")
implementation project(":compose:foundation:foundation")
implementation project(":compose:foundation:foundation-layout")
diff --git a/ui/ui-test-font/build.gradle b/ui/ui-test-font/build.gradle
index 0bd8692..f51a4aa 100644
--- a/ui/ui-test-font/build.gradle
+++ b/ui/ui-test-font/build.gradle
@@ -25,10 +25,10 @@
}
androidx {
- name = "AndroidX UI Test Font resources"
+ name = "Compose Test Font resources"
publish = Publish.NONE
mavenVersion = LibraryVersions.UI
- mavenGroup = LibraryGroups.UI
+ mavenGroup = LibraryGroups.Compose.CORE
inceptionYear = "2020"
description = "Fonts designed for testing text capabilities"
}
diff --git a/ui/ui-text-android/build.gradle b/ui/ui-text-android/build.gradle
index 04322de..9d80ebf 100644
--- a/ui/ui-text-android/build.gradle
+++ b/ui/ui-text-android/build.gradle
@@ -37,7 +37,7 @@
testImplementation(JUNIT)
androidTestImplementation "androidx.core:core:1.5.0-alpha01"
- androidTestImplementation project(":ui:ui-test-font")
+ androidTestImplementation project(":compose:core:core-test-font")
androidTestImplementation(ANDROIDX_TEST_RULES)
androidTestImplementation(ANDROIDX_TEST_RUNNER)
androidTestImplementation(DEXMAKER_MOCKITO, libs.exclude_bytebuddy) // DexMaker has it"s own MockMaker
diff --git a/ui/ui-text-core/build.gradle b/ui/ui-text-core/build.gradle
index 11e4a91a..b3586fd 100644
--- a/ui/ui-text-core/build.gradle
+++ b/ui/ui-text-core/build.gradle
@@ -54,7 +54,7 @@
}
androidTest.dependencies {
- implementation project(":ui:ui-test-font")
+ implementation project(":compose:core:core-test-font")
implementation(ANDROIDX_TEST_RULES)
implementation(ANDROIDX_TEST_RUNNER)
implementation(JUNIT)
@@ -67,7 +67,7 @@
}
androidAndroidTest.dependencies {
- implementation project(":ui:ui-test-font")
+ implementation project(":compose:core:core-test-font")
implementation(ANDROIDX_TEST_RULES)
implementation(ANDROIDX_TEST_RUNNER)
implementation(ESPRESSO_CORE)
diff --git a/ui/ui-text-core/src/androidMain/kotlin/androidx/ui/text/platform/AndroidParagraph.kt b/ui/ui-text-core/src/androidMain/kotlin/androidx/ui/text/platform/AndroidParagraph.kt
index c13d22a..af00d7f 100644
--- a/ui/ui-text-core/src/androidMain/kotlin/androidx/ui/text/platform/AndroidParagraph.kt
+++ b/ui/ui-text-core/src/androidMain/kotlin/androidx/ui/text/platform/AndroidParagraph.kt
@@ -341,10 +341,10 @@
else -> DEFAULT_ALIGNMENT
}
-// TODO(b/159152328): temporary workaround for ui-desktop. remove when full support of MPP will
+// TODO(b/159152328): temporary workaround for desktop. remove when full support of MPP will
// be in-place
@Deprecated(
- "Temporary workaround. Supposed to be used only in ui-desktop before MPP",
+ "Temporary workaround. Supposed to be used only in desktop before MPP",
level = DeprecationLevel.ERROR
)
@InternalPlatformTextApi
diff --git a/ui/ui-text-core/src/androidMain/kotlin/androidx/ui/text/platform/AndroidParagraphIntrinsics.kt b/ui/ui-text-core/src/androidMain/kotlin/androidx/ui/text/platform/AndroidParagraphIntrinsics.kt
index 4a63b8d..753a0eb 100644
--- a/ui/ui-text-core/src/androidMain/kotlin/androidx/ui/text/platform/AndroidParagraphIntrinsics.kt
+++ b/ui/ui-text-core/src/androidMain/kotlin/androidx/ui/text/platform/AndroidParagraphIntrinsics.kt
@@ -100,9 +100,9 @@
}
}
-// TODO(b/159152328): temporary workaround for ui-desktop. remove when full support of MPP will be in-place
+// TODO(b/159152328): temporary workaround for desktop. remove when full support of MPP will be in-place
@Deprecated(
- "Temporary workaround. Supposed to be used only in ui-desktop before MPP",
+ "Temporary workaround. Supposed to be used only in desktop before MPP",
level = DeprecationLevel.ERROR
)
@InternalPlatformTextApi
diff --git a/ui/ui-text/build.gradle b/ui/ui-text/build.gradle
index 05bf9eb..9ec208c 100644
--- a/ui/ui-text/build.gradle
+++ b/ui/ui-text/build.gradle
@@ -62,7 +62,7 @@
androidAndroidTest.dependencies {
implementation project(":compose:test:test-core")
implementation project(":compose:foundation:foundation-layout")
- implementation project(":ui:ui-test-font")
+ implementation project(":compose:core:core-test-font")
implementation "androidx.core:core:1.5.0-alpha01"
implementation(ANDROIDX_TEST_RULES)
implementation(ANDROIDX_TEST_RUNNER)
diff --git a/ui/ui-text/integration-tests/ui-text-compose-demos/build.gradle b/ui/ui-text/integration-tests/ui-text-compose-demos/build.gradle
index 15dbd42..09ac3a3 100644
--- a/ui/ui-text/integration-tests/ui-text-compose-demos/build.gradle
+++ b/ui/ui-text/integration-tests/ui-text-compose-demos/build.gradle
@@ -15,7 +15,7 @@
implementation(KOTLIN_STDLIB)
implementation project(":compose:runtime:runtime")
- implementation project(":ui:integration-tests:demos:common")
+ implementation project(":compose:integration-tests:demos:common")
implementation project(":compose:core:core")
implementation project(":compose:foundation:foundation")
implementation project(":compose:foundation:foundation-layout")
diff --git a/ui/ui-tooling/build.gradle b/ui/ui-tooling/build.gradle
index 748acaa..235c7e8 100644
--- a/ui/ui-tooling/build.gradle
+++ b/ui/ui-tooling/build.gradle
@@ -39,8 +39,8 @@
api(project(":compose:core:core"))
implementation(project(":compose:material:material"))
- // kotlin-reflect and ui-animation-tooling-internal are provided by Studio at runtime
- compileOnly(project(":ui:ui-animation-tooling-internal"))
+ // kotlin-reflect and tooling-animation-internal are provided by Studio at runtime
+ compileOnly(project(":compose:tooling:tooling-animation-internal"))
compileOnly(KOTLIN_REFLECT)
compileOnly(KOTLIN_METADATA_JVM)
@@ -54,7 +54,7 @@
androidTestImplementation(TRUTH)
androidTestImplementation(KOTLIN_REFLECT)
androidTestImplementation(KOTLIN_METADATA_JVM)
- androidTestImplementation(project(":ui:ui-animation-tooling-internal"))
+ androidTestImplementation(project(":compose:tooling:tooling-animation-internal"))
}
// Workaround for https://youtrack.jetbrains.com/issue/KT-39813
diff --git a/ui/ui/placeholder.txt b/ui/ui/placeholder.txt
deleted file mode 100644
index ffee342..0000000
--- a/ui/ui/placeholder.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-This file exists to make sure ui/ directory this is in gets created by git, so that
-settings.gradle can point to this directory and not complain about it missing.
\ No newline at end of file