Merge "Revert "Move Compose Macrobenchmarks to a self-instrumenting test module."" into androidx-main
diff --git a/appsearch/appsearch-local-storage/src/androidTest/java/androidx/appsearch/localstorage/AppSearchLoggerTest.java b/appsearch/appsearch-local-storage/src/androidTest/java/androidx/appsearch/localstorage/AppSearchLoggerTest.java
index 6d82c68..25303d8 100644
--- a/appsearch/appsearch-local-storage/src/androidTest/java/androidx/appsearch/localstorage/AppSearchLoggerTest.java
+++ b/appsearch/appsearch-local-storage/src/androidTest/java/androidx/appsearch/localstorage/AppSearchLoggerTest.java
@@ -154,7 +154,6 @@
.setDocumentSize(nativeDocumentSize)
.setTokenizationStats(PutDocumentStatsProto.TokenizationStats.newBuilder()
.setNumTokensIndexed(nativeNumTokensIndexed)
- .setExceededMaxTokenNum(nativeExceededMaxNumTokens)
.build())
.build();
PutDocumentStats.Builder pBuilder = new PutDocumentStats.Builder(PACKAGE_NAME, DATABASE);
@@ -170,7 +169,6 @@
nativeIndexMergeLatencyMillis);
assertThat(pStats.getNativeDocumentSizeBytes()).isEqualTo(nativeDocumentSize);
assertThat(pStats.getNativeNumTokensIndexed()).isEqualTo(nativeNumTokensIndexed);
- assertThat(pStats.getNativeExceededMaxNumTokens()).isEqualTo(nativeExceededMaxNumTokens);
}
@Test
diff --git a/appsearch/appsearch-local-storage/src/androidTest/java/androidx/appsearch/localstorage/stats/AppSearchStatsTest.java b/appsearch/appsearch-local-storage/src/androidTest/java/androidx/appsearch/localstorage/stats/AppSearchStatsTest.java
index 3d23c0a..c4f6d6c 100644
--- a/appsearch/appsearch-local-storage/src/androidTest/java/androidx/appsearch/localstorage/stats/AppSearchStatsTest.java
+++ b/appsearch/appsearch-local-storage/src/androidTest/java/androidx/appsearch/localstorage/stats/AppSearchStatsTest.java
@@ -96,8 +96,7 @@
.setNativeIndexLatencyMillis(nativeIndexLatencyMillis)
.setNativeIndexMergeLatencyMillis(nativeIndexMergeLatencyMillis)
.setNativeDocumentSizeBytes(nativeDocumentSize)
- .setNativeNumTokensIndexed(nativeNumTokensIndexed)
- .setNativeExceededMaxNumTokens(nativeExceededMaxNumTokens);
+ .setNativeNumTokensIndexed(nativeNumTokensIndexed);
final PutDocumentStats pStats = pStatsBuilder.build();
@@ -118,7 +117,6 @@
nativeIndexMergeLatencyMillis);
assertThat(pStats.getNativeDocumentSizeBytes()).isEqualTo(nativeDocumentSize);
assertThat(pStats.getNativeNumTokensIndexed()).isEqualTo(nativeNumTokensIndexed);
- assertThat(pStats.getNativeExceededMaxNumTokens()).isEqualTo(nativeExceededMaxNumTokens);
}
@Test
diff --git a/appsearch/appsearch-local-storage/src/main/java/androidx/appsearch/localstorage/AppSearchLoggerHelper.java b/appsearch/appsearch-local-storage/src/main/java/androidx/appsearch/localstorage/AppSearchLoggerHelper.java
index 5f19263..514b0aa 100644
--- a/appsearch/appsearch-local-storage/src/main/java/androidx/appsearch/localstorage/AppSearchLoggerHelper.java
+++ b/appsearch/appsearch-local-storage/src/main/java/androidx/appsearch/localstorage/AppSearchLoggerHelper.java
@@ -64,9 +64,7 @@
.setNativeIndexMergeLatencyMillis(fromNativeStats.getIndexMergeLatencyMs())
.setNativeDocumentSizeBytes(fromNativeStats.getDocumentSize())
.setNativeNumTokensIndexed(
- fromNativeStats.getTokenizationStats().getNumTokensIndexed())
- .setNativeExceededMaxNumTokens(
- fromNativeStats.getTokenizationStats().getExceededMaxTokenNum());
+ fromNativeStats.getTokenizationStats().getNumTokensIndexed());
}
/**
diff --git a/appsearch/appsearch-local-storage/src/main/java/androidx/appsearch/localstorage/stats/PutDocumentStats.java b/appsearch/appsearch-local-storage/src/main/java/androidx/appsearch/localstorage/stats/PutDocumentStats.java
index 3bcc5cb..c8bc687 100644
--- a/appsearch/appsearch-local-storage/src/main/java/androidx/appsearch/localstorage/stats/PutDocumentStats.java
+++ b/appsearch/appsearch-local-storage/src/main/java/androidx/appsearch/localstorage/stats/PutDocumentStats.java
@@ -65,12 +65,6 @@
/** Number of tokens added to the index. */
private final int mNativeNumTokensIndexed;
- /**
- * Whether the number of tokens to be indexed exceeded the max number of tokens per
- * document.
- */
- private final boolean mNativeExceededMaxNumTokens;
-
PutDocumentStats(@NonNull Builder builder) {
Preconditions.checkNotNull(builder);
mPackageName = builder.mPackageName;
@@ -85,7 +79,6 @@
mNativeIndexMergeLatencyMillis = builder.mNativeIndexMergeLatencyMillis;
mNativeDocumentSizeBytes = builder.mNativeDocumentSizeBytes;
mNativeNumTokensIndexed = builder.mNativeNumTokensIndexed;
- mNativeExceededMaxNumTokens = builder.mNativeExceededMaxNumTokens;
}
/** Returns calling package name. */
@@ -151,14 +144,6 @@
return mNativeNumTokensIndexed;
}
- /**
- * Returns whether the number of tokens to be indexed exceeded the max number of tokens per
- * document.
- */
- public boolean getNativeExceededMaxNumTokens() {
- return mNativeExceededMaxNumTokens;
- }
-
/** Builder for {@link PutDocumentStats}. */
public static class Builder {
@NonNull
@@ -176,7 +161,6 @@
int mNativeIndexMergeLatencyMillis;
int mNativeDocumentSizeBytes;
int mNativeNumTokensIndexed;
- boolean mNativeExceededMaxNumTokens;
/** Builder for {@link PutDocumentStats} */
public Builder(@NonNull String packageName, @NonNull String database) {
@@ -259,16 +243,6 @@
}
/**
- * Sets whether the number of tokens to be indexed exceeded the max number of tokens per
- * document.
- */
- @NonNull
- public Builder setNativeExceededMaxNumTokens(boolean nativeExceededMaxNumTokens) {
- mNativeExceededMaxNumTokens = nativeExceededMaxNumTokens;
- return this;
- }
-
- /**
* Creates a new {@link PutDocumentStats} object from the contents of this
* {@link Builder} instance.
*/
diff --git a/buildSrc/public/src/main/kotlin/androidx/build/LibraryVersions.kt b/buildSrc/public/src/main/kotlin/androidx/build/LibraryVersions.kt
index 62284db..7d1a689 100644
--- a/buildSrc/public/src/main/kotlin/androidx/build/LibraryVersions.kt
+++ b/buildSrc/public/src/main/kotlin/androidx/build/LibraryVersions.kt
@@ -53,7 +53,7 @@
val CORE_GOOGLE_SHORTCUTS = Version("1.1.0-alpha02")
val CORE_REMOTEVIEWS = Version("1.0.0-alpha01")
val CORE_ROLE = Version("1.1.0-alpha02")
- val CORE_SPLASHSCREEN = Version("1.0.0-alpha01")
+ val CORE_SPLASHSCREEN = Version("1.0.0-alpha02")
val CURSORADAPTER = Version("1.1.0-alpha01")
val CUSTOMVIEW = Version("1.2.0-alpha01")
val DATASTORE = Version("1.1.0-alpha01")
diff --git a/camera/camera-camera2-pipe-integration/lint-baseline.xml b/camera/camera-camera2-pipe-integration/lint-baseline.xml
new file mode 100644
index 0000000..740583b
--- /dev/null
+++ b/camera/camera-camera2-pipe-integration/lint-baseline.xml
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<issues format="6" by="lint 7.1.0-dev" type="baseline" client="gradle" dependencies="false" name="AGP (7.1.0-dev)" variant="all" version="7.1.0-dev">
+
+ <issue
+ id="SupportAnnotationUsage"
+ message="Did you mean `@get:VisibleForTesting` ? Without `get:` this annotates the constructor parameter itself instead of the associated getter."
+ errorLine1=" @VisibleForTesting"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/main/java/androidx/camera/camera2/pipe/integration/interop/Camera2CameraControl.kt"
+ line="54"
+ column="5"/>
+ </issue>
+
+</issues>
diff --git a/camera/camera-core/lint-baseline.xml b/camera/camera-core/lint-baseline.xml
index debefae..2b345ec 100644
--- a/camera/camera-core/lint-baseline.xml
+++ b/camera/camera-core/lint-baseline.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<issues format="6" by="lint 7.1.0-alpha02" type="baseline" client="cli" name="Lint" variant="all" version="7.1.0-alpha02">
+<issues format="6" by="lint 7.1.0-dev" type="baseline" client="gradle" dependencies="false" name="AGP (7.1.0-dev)" variant="all" version="7.1.0-dev">
<issue
id="NewApi"
@@ -8,7 +8,7 @@
errorLine2=" ~~~~~~~~">
<location
file="src/test/java/androidx/camera/core/impl/utils/ExifTest.java"
- line="159"
+ line="160"
column="46"/>
</issue>
@@ -19,7 +19,7 @@
errorLine2=" ~~~~~~~~">
<location
file="src/test/java/androidx/camera/core/impl/utils/ExifTest.java"
- line="162"
+ line="163"
column="46"/>
</issue>
@@ -47,6 +47,17 @@
<issue
id="NewApi"
+ message="Call requires API level 26 (current min is 21): `newInstance`"
+ errorLine1=" TEST_MAX_IMAGES, TEST_IMAGE_FORMAT);"
+ errorLine2=" ~~~~~~~~~~~~~~~">
+ <location
+ file="src/test/java/androidx/camera/core/internal/compat/ImageWriterCompatTest.java"
+ line="60"
+ column="17"/>
+ </issue>
+
+ <issue
+ id="NewApi"
message="Call requires API level 22 (current min is 21): `android.os.Message#isAsynchronous`"
errorLine1=" boolean isAsyncBeforeSending = message.isAsynchronous();"
errorLine2=" ~~~~~~~~~~~~~~">
@@ -503,7 +514,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/main/java/androidx/camera/core/impl/CaptureConfig.java"
- line="302"
+ line="310"
column="17"/>
</issue>
diff --git a/camera/camera-core/src/androidTest/java/androidx/camera/core/ImageYuvToRgbConverterTest.java b/camera/camera-core/src/androidTest/java/androidx/camera/core/ImageProcessingUtilTest.java
similarity index 91%
rename from camera/camera-core/src/androidTest/java/androidx/camera/core/ImageYuvToRgbConverterTest.java
rename to camera/camera-core/src/androidTest/java/androidx/camera/core/ImageProcessingUtilTest.java
index d3d6615..1ddc65d 100644
--- a/camera/camera-core/src/androidTest/java/androidx/camera/core/ImageYuvToRgbConverterTest.java
+++ b/camera/camera-core/src/androidTest/java/androidx/camera/core/ImageProcessingUtilTest.java
@@ -35,7 +35,7 @@
@SmallTest
@RunWith(AndroidJUnit4.class)
-public class ImageYuvToRgbConverterTest {
+public class ImageProcessingUtilTest {
private static final int WIDTH = 8;
private static final int HEIGHT = 8;
@@ -81,7 +81,7 @@
/*incrementValue=*/false));
// Act.
- ImageProxy rgbImageProxy = ImageYuvToRgbConverter.convertYUVToRGB(mYUVImageProxy,
+ ImageProxy rgbImageProxy = ImageProcessingUtil.convertYUVToRGB(mYUVImageProxy,
mRGBImageReaderProxy, /*onePixelShiftRequested=*/false);
// Assert.
@@ -101,7 +101,7 @@
/*incrementValue=*/false));
// Act.
- ImageProxy rgbImageProxy = ImageYuvToRgbConverter.convertYUVToRGB(mYUVImageProxy,
+ ImageProxy rgbImageProxy = ImageProcessingUtil.convertYUVToRGB(mYUVImageProxy,
mRGBImageReaderProxy, /*onePixelShiftRequested=*/false);
// Assert.
@@ -121,7 +121,7 @@
/*incrementValue=*/false));
// Act.
- ImageProxy rgbImageProxy = ImageYuvToRgbConverter.convertYUVToRGB(mYUVImageProxy,
+ ImageProxy rgbImageProxy = ImageProcessingUtil.convertYUVToRGB(mYUVImageProxy,
mRGBImageReaderProxy, /*onePixelShiftRequested=*/false);
// Assert.
@@ -146,7 +146,7 @@
assertThat(mYUVImageProxy.getPlanes()[2].getBuffer().get(0)).isEqualTo(1);
// Act.
- boolean result = ImageYuvToRgbConverter.applyPixelShiftForYUV(mYUVImageProxy);
+ boolean result = ImageProcessingUtil.applyPixelShiftForYUV(mYUVImageProxy);
// Assert.
assertThat(result).isTrue();
@@ -167,7 +167,7 @@
/*incrementValue=*/false));
// Act.
- ImageProxy rgbImageProxy = ImageYuvToRgbConverter.convertYUVToRGB(mYUVImageProxy,
+ ImageProxy rgbImageProxy = ImageProcessingUtil.convertYUVToRGB(mYUVImageProxy,
mRGBImageReaderProxy, /*onePixelShiftRequested=*/false);
// Assert.
diff --git a/camera/camera-core/src/main/cpp/CMakeLists.txt b/camera/camera-core/src/main/cpp/CMakeLists.txt
index 8b3b2dd..ae2cb0b 100644
--- a/camera/camera-core/src/main/cpp/CMakeLists.txt
+++ b/camera/camera-core/src/main/cpp/CMakeLists.txt
@@ -18,12 +18,12 @@
project(camera_core_jni)
add_library(
- yuv_to_rgb_jni
+ image_processing_util_jni
SHARED
- yuv_to_rgb_jni.cc)
+ image_processing_util_jni.cc)
find_library(log-lib log)
find_library(android-lib android)
find_package(libyuv REQUIRED)
-target_link_libraries(yuv_to_rgb_jni PRIVATE ${log-lib} ${android-lib} libyuv::yuv)
+target_link_libraries(image_processing_util_jni PRIVATE ${log-lib} ${android-lib} libyuv::yuv)
diff --git a/camera/camera-core/src/main/cpp/yuv_to_rgb_jni.cc b/camera/camera-core/src/main/cpp/image_processing_util_jni.cc
similarity index 97%
rename from camera/camera-core/src/main/cpp/yuv_to_rgb_jni.cc
rename to camera/camera-core/src/main/cpp/image_processing_util_jni.cc
index 09b4799..51f20e8 100644
--- a/camera/camera-core/src/main/cpp/yuv_to_rgb_jni.cc
+++ b/camera/camera-core/src/main/cpp/image_processing_util_jni.cc
@@ -12,7 +12,7 @@
#define LOGE(...) __android_log_print(ANDROID_LOG_ERROR, "YuvToRgbJni", __VA_ARGS__)
extern "C" {
-JNIEXPORT jint Java_androidx_camera_core_ImageYuvToRgbConverter_shiftPixel(
+JNIEXPORT jint Java_androidx_camera_core_ImageProcessingUtil_shiftPixel(
JNIEnv* env,
jclass,
jobject src_y,
@@ -70,7 +70,7 @@
return 0;
}
-JNIEXPORT jint Java_androidx_camera_core_ImageYuvToRgbConverter_convertAndroid420ToABGR(
+JNIEXPORT jint Java_androidx_camera_core_ImageProcessingUtil_convertAndroid420ToABGR(
JNIEnv* env,
jclass,
jobject src_y,
diff --git a/camera/camera-core/src/main/java/androidx/camera/core/ImageAnalysisAbstractAnalyzer.java b/camera/camera-core/src/main/java/androidx/camera/core/ImageAnalysisAbstractAnalyzer.java
index 80a944e..d7dc3f1 100644
--- a/camera/camera-core/src/main/java/androidx/camera/core/ImageAnalysisAbstractAnalyzer.java
+++ b/camera/camera-core/src/main/java/androidx/camera/core/ImageAnalysisAbstractAnalyzer.java
@@ -17,8 +17,8 @@
package androidx.camera.core;
import static androidx.camera.core.ImageAnalysis.OUTPUT_IMAGE_FORMAT_RGBA_8888;
-import static androidx.camera.core.ImageYuvToRgbConverter.applyPixelShiftForYUV;
-import static androidx.camera.core.ImageYuvToRgbConverter.convertYUVToRGB;
+import static androidx.camera.core.ImageProcessingUtil.applyPixelShiftForYUV;
+import static androidx.camera.core.ImageProcessingUtil.convertYUVToRGB;
import androidx.annotation.GuardedBy;
import androidx.annotation.NonNull;
diff --git a/camera/camera-core/src/main/java/androidx/camera/core/ImageYuvToRgbConverter.java b/camera/camera-core/src/main/java/androidx/camera/core/ImageProcessingUtil.java
similarity index 94%
rename from camera/camera-core/src/main/java/androidx/camera/core/ImageYuvToRgbConverter.java
rename to camera/camera-core/src/main/java/androidx/camera/core/ImageProcessingUtil.java
index 6c4a1d4..415f150 100644
--- a/camera/camera-core/src/main/java/androidx/camera/core/ImageYuvToRgbConverter.java
+++ b/camera/camera-core/src/main/java/androidx/camera/core/ImageProcessingUtil.java
@@ -27,12 +27,12 @@
import java.nio.ByteBuffer;
/** Utility class to convert an {@link Image} from YUV to RGB. */
-final class ImageYuvToRgbConverter {
+final class ImageProcessingUtil {
- private static final String TAG = "ImageYuvToRgbConverter";
+ private static final String TAG = "ImageProcessingUtil";
static {
- System.loadLibrary("yuv_to_rgb_jni");
+ System.loadLibrary("image_processing_util_jni");
}
enum Result {
@@ -42,7 +42,7 @@
ERROR_CONVERSION, // Native conversion error.
}
- private ImageYuvToRgbConverter() {
+ private ImageProcessingUtil() {
}
/**
@@ -62,13 +62,13 @@
@NonNull ImageProxy imageProxy,
@NonNull ImageReaderProxy rgbImageReaderProxy,
boolean onePixelShiftEnabled) {
- if (!ImageYuvToRgbConverter.isSupportedYUVFormat(imageProxy)) {
+ if (!ImageProcessingUtil.isSupportedYUVFormat(imageProxy)) {
Logger.e(TAG, "Unsupported format for YUV to RGB");
return null;
}
// Convert YUV To RGB and write data to surface
- ImageYuvToRgbConverter.Result result = convertYUVToRGBInternal(
+ ImageProcessingUtil.Result result = convertYUVToRGBInternal(
imageProxy, rgbImageReaderProxy.getSurface(), onePixelShiftEnabled);
if (result == Result.ERROR_CONVERSION) {
@@ -105,12 +105,12 @@
* @return true if one pixel shift is applied successfully, otherwise false.
*/
public static boolean applyPixelShiftForYUV(@NonNull ImageProxy imageProxy) {
- if (!ImageYuvToRgbConverter.isSupportedYUVFormat(imageProxy)) {
+ if (!ImageProcessingUtil.isSupportedYUVFormat(imageProxy)) {
Logger.e(TAG, "Unsupported format for YUV to RGB");
return false;
}
- ImageYuvToRgbConverter.Result result = applyPixelShiftInternal(imageProxy);
+ ImageProcessingUtil.Result result = applyPixelShiftInternal(imageProxy);
if (result == Result.ERROR_CONVERSION) {
Logger.e(TAG, "YUV to RGB conversion failure");
diff --git a/compose/integration-tests/macrobenchmark/lint-baseline.xml b/compose/integration-tests/macrobenchmark/lint-baseline.xml
index 86830d6..b620a2b5 100644
--- a/compose/integration-tests/macrobenchmark/lint-baseline.xml
+++ b/compose/integration-tests/macrobenchmark/lint-baseline.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<issues format="6" by="lint 7.1.0-alpha02" type="baseline" client="cli" name="Lint" variant="all" version="7.1.0-alpha02">
+<issues format="6" by="lint 7.1.0-dev" type="baseline" client="gradle" dependencies="false" name="AGP (7.1.0-dev)" variant="all" version="7.1.0-dev">
<issue
id="NewApi"
@@ -47,6 +47,17 @@
<issue
id="NewApi"
+ message="Call requires API level 29 (current min is 28): `measureRepeated`"
+ errorLine1=" iterations = 10,"
+ errorLine2=" ~~">
+ <location
+ file="src/androidTest/java/androidx/compose/integration/macrobenchmark/NestedListsScrollBenchmark.kt"
+ line="58"
+ column="26"/>
+ </issue>
+
+ <issue
+ id="NewApi"
message="Call requires API level 29 (current min is 28): `MacrobenchmarkRule`"
errorLine1=" val benchmarkRule = MacrobenchmarkRule()"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
@@ -91,6 +102,17 @@
<issue
id="NewApi"
+ message="Call requires API level 29 (current min is 28): `measureRepeated`"
+ errorLine1=" iterations = 10,"
+ errorLine2=" ~~">
+ <location
+ file="src/androidTest/java/androidx/compose/integration/macrobenchmark/TrivialListScrollBenchmark.kt"
+ line="58"
+ column="26"/>
+ </issue>
+
+ <issue
+ id="NewApi"
message="Call requires API level 29 (current min is 28): `MacrobenchmarkRule`"
errorLine1=" val benchmarkRule = MacrobenchmarkRule()"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
diff --git a/compose/integration-tests/material-catalog/OWNERS b/compose/integration-tests/material-catalog/OWNERS
new file mode 100644
index 0000000..5c55131
--- /dev/null
+++ b/compose/integration-tests/material-catalog/OWNERS
@@ -0,0 +1 @@
[email protected]
diff --git a/compose/material/material/integration-tests/material-catalog/README.md b/compose/integration-tests/material-catalog/README.md
similarity index 100%
rename from compose/material/material/integration-tests/material-catalog/README.md
rename to compose/integration-tests/material-catalog/README.md
diff --git a/compose/integration-tests/material-catalog/build.gradle b/compose/integration-tests/material-catalog/build.gradle
new file mode 100644
index 0000000..5e0a273
--- /dev/null
+++ b/compose/integration-tests/material-catalog/build.gradle
@@ -0,0 +1,81 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+import androidx.build.BuildOnServerKt
+import androidx.build.BuildServerConfigurationKt
+import androidx.build.Publish
+
+plugins {
+ id("AndroidXPlugin")
+ id("com.android.application")
+ id("AndroidXComposePlugin")
+ id("org.jetbrains.kotlin.android")
+}
+
+android {
+ defaultConfig {
+ applicationId "androidx.compose.material.catalog"
+ versionCode 1001
+ versionName "1.0.1"
+ }
+ buildTypes {
+ release {
+ minifyEnabled true
+ shrinkResources true
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt')
+ }
+ }
+}
+
+dependencies {
+ kotlinPlugin project(":compose:compiler:compiler")
+ implementation(libs.kotlinStdlib)
+ implementation project(":compose:runtime:runtime")
+ implementation project(":compose:ui:ui")
+ implementation project(":compose:material:material")
+ implementation project(":compose:material3:material3")
+ implementation project(":compose:material:material:integration-tests:material-catalog")
+ implementation project(":compose:material3:material3:integration-tests:material3-catalog")
+ implementation "androidx.activity:activity-compose:1.3.1"
+ implementation project(":navigation:navigation-compose")
+ implementation "com.google.accompanist:accompanist-insets:0.18.0"
+}
+
+// We want to publish a release APK of this project for the Compose Material Catalog
+def copyReleaseApk = tasks.register("copyReleaseApk", Copy) { task ->
+ android.applicationVariants.all { variant ->
+ if (variant.buildType.name == "release") {
+ task.from(variant.packageApplicationProvider.get().outputDirectory)
+ }
+ }
+ task.include("*.apk")
+ task.rename { fileName ->
+ "${project.path.substring(1).replace(':', '-')}_$fileName"
+ }
+ task.destinationDir =
+ new File(BuildServerConfigurationKt.getDistributionDirectory(project), "apks")
+ task.dependsOn(project.path + ":assembleRelease")
+}
+
+BuildOnServerKt.addToBuildOnServer(project, copyReleaseApk)
+
+androidx {
+ name = "Compose Material Catalog app"
+ publish = Publish.NONE
+ inceptionYear = "2021"
+ description = "This is a project for the Compose Material Catalog app."
+}
diff --git a/compose/material/material/integration-tests/material-catalog/icon.png b/compose/integration-tests/material-catalog/icon.png
similarity index 100%
rename from compose/material/material/integration-tests/material-catalog/icon.png
rename to compose/integration-tests/material-catalog/icon.png
Binary files differ
diff --git a/compose/integration-tests/material-catalog/src/main/AndroidManifest.xml b/compose/integration-tests/material-catalog/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..4034da7
--- /dev/null
+++ b/compose/integration-tests/material-catalog/src/main/AndroidManifest.xml
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2021 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+
+<manifest
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ package="androidx.compose.material.catalog">
+
+ <application
+ android:label="@string/compose_material_catalog"
+ android:icon="@mipmap/ic_launcher"
+ android:theme="@style/Theme.Catalog">
+ <activity android:name=".CatalogActivity" android:exported="true">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+</manifest>
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/CatalogActivity.kt b/compose/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/CatalogActivity.kt
similarity index 100%
rename from compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/CatalogActivity.kt
rename to compose/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/CatalogActivity.kt
diff --git a/compose/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/CatalogApp.kt b/compose/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/CatalogApp.kt
new file mode 100644
index 0000000..9f0ae0f
--- /dev/null
+++ b/compose/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/CatalogApp.kt
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.material.catalog
+
+import androidx.compose.material.catalog.ui.theme.CatalogTheme
+import androidx.compose.runtime.Composable
+import com.google.accompanist.insets.ProvideWindowInsets
+
+@Composable
+fun CatalogApp() {
+ ProvideWindowInsets {
+ CatalogTheme {
+ NavGraph()
+ }
+ }
+}
diff --git a/compose/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/NavGraph.kt b/compose/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/NavGraph.kt
new file mode 100644
index 0000000..21bee2a
--- /dev/null
+++ b/compose/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/NavGraph.kt
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.material.catalog
+
+import androidx.compose.material.catalog.library.MaterialCatalogApp
+import androidx.compose.material.catalog.library.MaterialRoute
+import androidx.compose.material.catalog.model.MaterialSpecification
+import androidx.compose.material.catalog.model.Material3Specification
+import androidx.compose.material.catalog.model.Specifications
+import androidx.compose.material.catalog.ui.specification.Specification
+import androidx.compose.material3.catalog.library.Material3CatalogApp
+import androidx.compose.material3.catalog.library.Material3Route
+import androidx.compose.runtime.Composable
+import androidx.navigation.compose.NavHost
+import androidx.navigation.compose.composable
+import androidx.navigation.compose.rememberNavController
+
+@Composable
+fun NavGraph() {
+ val navController = rememberNavController()
+ NavHost(
+ navController = navController,
+ startDestination = SpecificationRoute
+ ) {
+ composable(SpecificationRoute) {
+ Specification(
+ specifications = Specifications,
+ onSpecificationClick = { specification ->
+ when (specification) {
+ MaterialSpecification -> navController.navigate(MaterialRoute)
+ Material3Specification -> navController.navigate(Material3Route)
+ else -> throw IllegalArgumentException("Unknown specification")
+ }
+ }
+ )
+ }
+ composable(MaterialRoute) { MaterialCatalogApp() }
+ composable(Material3Route) { Material3CatalogApp() }
+ }
+}
+
+private const val SpecificationRoute = "specification"
diff --git a/compose/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/model/Specifications.kt b/compose/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/model/Specifications.kt
new file mode 100644
index 0000000..9c26923
--- /dev/null
+++ b/compose/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/model/Specifications.kt
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.material.catalog.model
+
+data class Specification(
+ val id: Int,
+ val name: String
+)
+
+private const val MaterialTitle = "Material"
+val MaterialSpecification = Specification(
+ id = 1,
+ name = MaterialTitle
+)
+
+private const val Material3Title = "Material You"
+val Material3Specification = Specification(
+ id = 2,
+ name = Material3Title
+)
+
+val Specifications = listOf(
+ MaterialSpecification,
+ Material3Specification
+)
diff --git a/compose/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/specification/Specification.kt b/compose/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/specification/Specification.kt
new file mode 100644
index 0000000..7e4df39
--- /dev/null
+++ b/compose/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/specification/Specification.kt
@@ -0,0 +1,58 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.material.catalog.ui.specification
+
+import androidx.compose.foundation.ExperimentalFoundationApi
+import androidx.compose.foundation.layout.BoxWithConstraints
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.lazy.LazyColumn
+import androidx.compose.foundation.lazy.items
+import androidx.compose.material.catalog.R
+import androidx.compose.material.catalog.model.Specification
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.res.stringResource
+import com.google.accompanist.insets.LocalWindowInsets
+import com.google.accompanist.insets.rememberInsetsPaddingValues
+
+// TODO: Use components/values from Material3 when available
+@Composable
+@OptIn(ExperimentalFoundationApi::class)
+fun Specification(
+ specifications: List<Specification>,
+ onSpecificationClick: (specification: Specification) -> Unit
+) {
+ SpecificationScaffold(
+ topBarTitle = stringResource(id = R.string.compose_material_catalog)
+ ) { paddingValues ->
+ BoxWithConstraints(modifier = Modifier.padding(paddingValues)) {
+ LazyColumn(
+ content = {
+ items(specifications) { specification ->
+ SpecificationItem(
+ specification = specification,
+ onClick = onSpecificationClick
+ )
+ }
+ },
+ contentPadding = rememberInsetsPaddingValues(
+ insets = LocalWindowInsets.current.navigationBars
+ )
+ )
+ }
+ }
+}
diff --git a/compose/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/specification/SpecificationItem.kt b/compose/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/specification/SpecificationItem.kt
new file mode 100644
index 0000000..da3c9e9
--- /dev/null
+++ b/compose/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/specification/SpecificationItem.kt
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.material.catalog.ui.specification
+
+import androidx.compose.foundation.clickable
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.padding
+import androidx.compose.material.MaterialTheme
+import androidx.compose.material.Text
+import androidx.compose.material.catalog.model.Specification
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Alignment
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.unit.dp
+
+// TODO: Use components/values from Material3 when available
+@Composable
+fun SpecificationItem(
+ specification: Specification,
+ onClick: (specification: Specification) -> Unit
+) {
+ Box(
+ modifier = Modifier
+ .fillMaxWidth()
+ .height(SpecificationItemHeight)
+ .clickable { onClick(specification) }
+ .padding(SpecificationItemPadding),
+ contentAlignment = Alignment.CenterStart
+ ) {
+ Text(
+ text = specification.name,
+ style = MaterialTheme.typography.body1
+ )
+ }
+}
+
+private val SpecificationItemHeight = 56.dp
+private val SpecificationItemPadding = 16.dp
diff --git a/compose/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/specification/SpecificationScaffold.kt b/compose/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/specification/SpecificationScaffold.kt
new file mode 100644
index 0000000..997d450
--- /dev/null
+++ b/compose/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/specification/SpecificationScaffold.kt
@@ -0,0 +1,35 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.material.catalog.ui.specification
+
+import androidx.compose.foundation.layout.PaddingValues
+import androidx.compose.material.ExperimentalMaterialApi
+import androidx.compose.material.Scaffold
+import androidx.compose.runtime.Composable
+
+// TODO: Use components/values from Material3 when available
+@OptIn(ExperimentalMaterialApi::class)
+@Composable
+fun SpecificationScaffold(
+ topBarTitle: String,
+ content: @Composable (PaddingValues) -> Unit
+) {
+ Scaffold(
+ topBar = { SpecificationTopAppBar(title = topBarTitle) },
+ content = content
+ )
+}
diff --git a/compose/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/specification/SpecificationTopAppBar.kt b/compose/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/specification/SpecificationTopAppBar.kt
new file mode 100644
index 0000000..78e8987
--- /dev/null
+++ b/compose/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/specification/SpecificationTopAppBar.kt
@@ -0,0 +1,57 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.material.catalog.ui.specification
+
+import androidx.compose.material.AppBarDefaults
+import androidx.compose.material.MaterialTheme
+import androidx.compose.material.Surface
+import androidx.compose.material.Text
+import androidx.compose.material.TopAppBar
+import androidx.compose.material.primarySurface
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.text.style.TextOverflow
+import androidx.compose.ui.unit.dp
+import com.google.accompanist.insets.navigationBarsPadding
+import com.google.accompanist.insets.statusBarsPadding
+
+// TODO: Use components/values from Material3 when available
+@Composable
+fun SpecificationTopAppBar(title: String) {
+ // Wrapping in a Surface to handle window insets
+ // https://issuetracker.google.com/issues/183161866
+ Surface(
+ color = MaterialTheme.colors.primarySurface,
+ elevation = AppBarDefaults.TopAppBarElevation
+ ) {
+ TopAppBar(
+ title = {
+ Text(
+ text = title,
+ maxLines = 1,
+ overflow = TextOverflow.Ellipsis
+ )
+ },
+ backgroundColor = Color.Transparent,
+ elevation = 0.dp,
+ modifier = Modifier
+ .statusBarsPadding()
+ .navigationBarsPadding(bottom = false)
+ )
+ }
+}
diff --git a/compose/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/theme/Theme.kt b/compose/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/theme/Theme.kt
new file mode 100644
index 0000000..48fd160a
--- /dev/null
+++ b/compose/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/theme/Theme.kt
@@ -0,0 +1,34 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.material.catalog.ui.theme
+
+import androidx.compose.foundation.isSystemInDarkTheme
+import androidx.compose.material.MaterialTheme
+import androidx.compose.material.darkColors
+import androidx.compose.material.lightColors
+import androidx.compose.runtime.Composable
+
+// TODO: Use components/values from Material3 when available
+@Composable
+fun CatalogTheme(content: @Composable () -> Unit) {
+ val darkTheme = isSystemInDarkTheme()
+ val colors = if (!darkTheme) lightColors() else darkColors()
+ MaterialTheme(
+ colors = colors,
+ content = content
+ )
+}
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/res/drawable/ic_launcher_foreground.xml b/compose/integration-tests/material-catalog/src/main/res/drawable/ic_launcher_foreground.xml
similarity index 100%
rename from compose/material/material/integration-tests/material-catalog/src/main/res/drawable/ic_launcher_foreground.xml
rename to compose/integration-tests/material-catalog/src/main/res/drawable/ic_launcher_foreground.xml
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/compose/integration-tests/material-catalog/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
similarity index 100%
rename from compose/material/material/integration-tests/material-catalog/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
rename to compose/integration-tests/material-catalog/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/res/mipmap-hdpi/ic_launcher.png b/compose/integration-tests/material-catalog/src/main/res/mipmap-hdpi/ic_launcher.png
similarity index 100%
rename from compose/material/material/integration-tests/material-catalog/src/main/res/mipmap-hdpi/ic_launcher.png
rename to compose/integration-tests/material-catalog/src/main/res/mipmap-hdpi/ic_launcher.png
Binary files differ
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/res/mipmap-mdpi/ic_launcher.png b/compose/integration-tests/material-catalog/src/main/res/mipmap-mdpi/ic_launcher.png
similarity index 100%
rename from compose/material/material/integration-tests/material-catalog/src/main/res/mipmap-mdpi/ic_launcher.png
rename to compose/integration-tests/material-catalog/src/main/res/mipmap-mdpi/ic_launcher.png
Binary files differ
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/res/mipmap-xhdpi/ic_launcher.png b/compose/integration-tests/material-catalog/src/main/res/mipmap-xhdpi/ic_launcher.png
similarity index 100%
rename from compose/material/material/integration-tests/material-catalog/src/main/res/mipmap-xhdpi/ic_launcher.png
rename to compose/integration-tests/material-catalog/src/main/res/mipmap-xhdpi/ic_launcher.png
Binary files differ
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/res/mipmap-xxhdpi/ic_launcher.png b/compose/integration-tests/material-catalog/src/main/res/mipmap-xxhdpi/ic_launcher.png
similarity index 100%
rename from compose/material/material/integration-tests/material-catalog/src/main/res/mipmap-xxhdpi/ic_launcher.png
rename to compose/integration-tests/material-catalog/src/main/res/mipmap-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/compose/integration-tests/material-catalog/src/main/res/mipmap-xxxhdpi/ic_launcher.png
similarity index 100%
rename from compose/material/material/integration-tests/material-catalog/src/main/res/mipmap-xxxhdpi/ic_launcher.png
rename to compose/integration-tests/material-catalog/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Binary files differ
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/res/values-night/themes.xml b/compose/integration-tests/material-catalog/src/main/res/values-night/themes.xml
similarity index 100%
rename from compose/material/material/integration-tests/material-catalog/src/main/res/values-night/themes.xml
rename to compose/integration-tests/material-catalog/src/main/res/values-night/themes.xml
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/res/values/colors.xml b/compose/integration-tests/material-catalog/src/main/res/values/colors.xml
similarity index 100%
rename from compose/material/material/integration-tests/material-catalog/src/main/res/values/colors.xml
rename to compose/integration-tests/material-catalog/src/main/res/values/colors.xml
diff --git a/core/core-splashscreen/samples/src/main/res/drawable/foreground.xml b/compose/integration-tests/material-catalog/src/main/res/values/donottranslate-strings.xml
similarity index 75%
copy from core/core-splashscreen/samples/src/main/res/drawable/foreground.xml
copy to compose/integration-tests/material-catalog/src/main/res/values/donottranslate-strings.xml
index c46194a..bde9dc6 100644
--- a/core/core-splashscreen/samples/src/main/res/drawable/foreground.xml
+++ b/compose/integration-tests/material-catalog/src/main/res/values/donottranslate-strings.xml
@@ -1,4 +1,5 @@
-<?xml version="1.0" encoding="utf-8"?><!--
+<?xml version="1.0" encoding="utf-8"?>
+<!--
Copyright 2021 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,7 +15,8 @@
limitations under the License.
-->
-<inset xmlns:android="http://schemas.android.com/apk/res/android"
- android:drawable="@drawable/android"
- android:inset="25%">
-</inset>
\ No newline at end of file
+<resources>
+
+ <string name="compose_material_catalog">Compose Material Catalog</string>
+
+</resources>
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/res/values/themes.xml b/compose/integration-tests/material-catalog/src/main/res/values/themes.xml
similarity index 100%
rename from compose/material/material/integration-tests/material-catalog/src/main/res/values/themes.xml
rename to compose/integration-tests/material-catalog/src/main/res/values/themes.xml
diff --git a/compose/material/material/integration-tests/material-catalog/build.gradle b/compose/material/material/integration-tests/material-catalog/build.gradle
index 2d43135..e7d62f0 100644
--- a/compose/material/material/integration-tests/material-catalog/build.gradle
+++ b/compose/material/material/integration-tests/material-catalog/build.gradle
@@ -15,60 +15,27 @@
*/
-import androidx.build.BuildOnServerKt
-import androidx.build.BuildServerConfigurationKt
import androidx.build.Publish
plugins {
id("AndroidXPlugin")
- id("com.android.application")
+ id("com.android.library")
id("AndroidXComposePlugin")
id("org.jetbrains.kotlin.android")
}
-android {
- defaultConfig {
- applicationId "androidx.compose.material.catalog"
- versionCode 1001
- versionName "1.0.1"
- }
- buildTypes {
- release {
- minifyEnabled true
- shrinkResources true
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt')
- }
- }
-}
-
dependencies {
kotlinPlugin project(":compose:compiler:compiler")
implementation(libs.kotlinStdlib)
+ implementation project(":core:core")
+ implementation project(":compose:runtime:runtime")
implementation project(":compose:ui:ui")
implementation project(":compose:material:material")
implementation project(":compose:material:material:material-samples")
- implementation "androidx.activity:activity-compose:1.3.1"
implementation project(":navigation:navigation-compose")
+ implementation "com.google.accompanist:accompanist-insets:0.18.0"
}
-// We want to publish a release APK of this project for the Compose Material Catalog
-def copyReleaseApk = tasks.register("copyReleaseApk", Copy) { task ->
- android.applicationVariants.all { variant ->
- if (variant.buildType.name == "release") {
- task.from(variant.packageApplicationProvider.get().outputDirectory)
- }
- }
- task.include("*.apk")
- task.rename { fileName ->
- "${project.path.substring(1).replace(':', '-')}_$fileName"
- }
- task.destinationDir =
- new File(BuildServerConfigurationKt.getDistributionDirectory(project), "apks")
- task.dependsOn(project.path + ":assembleRelease")
-}
-
-BuildOnServerKt.addToBuildOnServer(project, copyReleaseApk)
-
androidx {
name = "Compose Material Catalog"
publish = Publish.NONE
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/AndroidManifest.xml b/compose/material/material/integration-tests/material-catalog/src/main/AndroidManifest.xml
index 4034da7..a3ef31f 100644
--- a/compose/material/material/integration-tests/material-catalog/src/main/AndroidManifest.xml
+++ b/compose/material/material/integration-tests/material-catalog/src/main/AndroidManifest.xml
@@ -15,19 +15,4 @@
~ limitations under the License
-->
-<manifest
- xmlns:android="http://schemas.android.com/apk/res/android"
- package="androidx.compose.material.catalog">
-
- <application
- android:label="@string/compose_material_catalog"
- android:icon="@mipmap/ic_launcher"
- android:theme="@style/Theme.Catalog">
- <activity android:name=".CatalogActivity" android:exported="true">
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </activity>
- </application>
-</manifest>
+<manifest package="androidx.compose.material.catalog.library" />
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/insets/Insets.kt b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/insets/Insets.kt
deleted file mode 100644
index 0fb5516..0000000
--- a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/insets/Insets.kt
+++ /dev/null
@@ -1,640 +0,0 @@
-/*
- * Copyright 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * TODO: Move to depending on Accompanist with prebuilts when we hit a stable version
- * https://github.com/google/accompanist/blob/main/insets/src/main/java/com/google/accompanist
- * /insets/Insets.kt
- */
-
-@file:Suppress("NOTHING_TO_INLINE", "unused", "PropertyName")
-
-@file:JvmName("ComposeInsets")
-@file:JvmMultifileClass
-
-package androidx.compose.material.catalog.insets
-
-import android.annotation.SuppressLint
-import android.view.View
-import android.view.WindowInsetsAnimation
-import androidx.annotation.FloatRange
-import androidx.annotation.IntRange
-import androidx.compose.runtime.Composable
-import androidx.compose.runtime.CompositionLocalProvider
-import androidx.compose.runtime.DisposableEffect
-import androidx.compose.runtime.Stable
-import androidx.compose.runtime.getValue
-import androidx.compose.runtime.mutableStateOf
-import androidx.compose.runtime.remember
-import androidx.compose.runtime.setValue
-import androidx.compose.runtime.staticCompositionLocalOf
-import androidx.compose.ui.platform.LocalView
-import androidx.core.view.ViewCompat
-import androidx.core.view.WindowInsetsAnimationCompat
-import androidx.core.view.WindowInsetsCompat
-
-/**
- * Main holder of our inset values.
- */
-@Stable
-class WindowInsets {
- /**
- * Inset values which match [WindowInsetsCompat.Type.systemBars]
- */
- val systemBars: InsetsType = InsetsType()
-
- /**
- * Inset values which match [WindowInsetsCompat.Type.systemGestures]
- */
- val systemGestures: InsetsType = InsetsType()
-
- /**
- * Inset values which match [WindowInsetsCompat.Type.navigationBars]
- */
- val navigationBars: InsetsType = InsetsType()
-
- /**
- * Inset values which match [WindowInsetsCompat.Type.statusBars]
- */
- val statusBars: InsetsType = InsetsType()
-
- /**
- * Inset values which match [WindowInsetsCompat.Type.ime]
- */
- val ime: InsetsType = InsetsType()
-}
-
-/**
- * Represents the values for a type of insets, and stores information about the layout insets,
- * animating insets, and visibility of the insets.
- *
- * [InsetsType] instances are commonly stored in a [WindowInsets] instance.
- */
-@Stable
-@Suppress("MemberVisibilityCanBePrivate")
-class InsetsType : Insets {
- private var ongoingAnimationsCount by mutableStateOf(0)
- internal val _layoutInsets = MutableInsets()
- internal val _animatedInsets = MutableInsets()
-
- /**
- * The layout insets for this [InsetsType]. These are the insets which are defined from the
- * current window layout.
- *
- * You should not normally need to use this directly, and instead use [left], [top],
- * [right], and [bottom] to return the correct value for the current state.
- */
- val layoutInsets: Insets
- get() = _layoutInsets
-
- /**
- * The animated insets for this [InsetsType]. These are the insets which are updated from
- * any on-going animations. If there are no animations in progress, the returned [Insets] will
- * be empty.
- *
- * You should not normally need to use this directly, and instead use [left], [top],
- * [right], and [bottom] to return the correct value for the current state.
- */
- val animatedInsets: Insets
- get() = _animatedInsets
-
- /**
- * The left dimension of the insets in pixels.
- */
- override val left: Int
- get() = (if (animationInProgress) animatedInsets else layoutInsets).left
-
- /**
- * The top dimension of the insets in pixels.
- */
- override val top: Int
- get() = (if (animationInProgress) animatedInsets else layoutInsets).top
-
- /**
- * The right dimension of the insets in pixels.
- */
- override val right: Int
- get() = (if (animationInProgress) animatedInsets else layoutInsets).right
-
- /**
- * The bottom dimension of the insets in pixels.
- */
- override val bottom: Int
- get() = (if (animationInProgress) animatedInsets else layoutInsets).bottom
-
- /**
- * Whether the insets are currently visible.
- */
- var isVisible by mutableStateOf(true)
- internal set
-
- /**
- * Whether this insets type is being animated at this moment.
- */
- val animationInProgress: Boolean
- get() = ongoingAnimationsCount > 0
-
- /**
- * The progress of any ongoing animations, in the range of 0 to 1.
- * If there is no animation in progress, this will return 0.
- */
- @get:FloatRange(from = 0.0, to = 1.0)
- var animationFraction by mutableStateOf(0f)
- internal set
-
- internal fun onAnimationStart() {
- ongoingAnimationsCount++
- }
-
- internal fun onAnimationEnd() {
- ongoingAnimationsCount--
-
- if (ongoingAnimationsCount == 0) {
- // If there are no on-going animations, clear out the animated insets
- _animatedInsets.reset()
- animationFraction = 0f
- }
- }
-}
-
-@Stable
-interface Insets {
- /**
- * The left dimension of these insets in pixels.
- */
- @get:IntRange(from = 0)
- val left: Int
-
- /**
- * The top dimension of these insets in pixels.
- */
- @get:IntRange(from = 0)
- val top: Int
-
- /**
- * The right dimension of these insets in pixels.
- */
- @get:IntRange(from = 0)
- val right: Int
-
- /**
- * The bottom dimension of these insets in pixels.
- */
- @get:IntRange(from = 0)
- val bottom: Int
-
- fun copy(
- left: Int = this.left,
- top: Int = this.top,
- right: Int = this.right,
- bottom: Int = this.bottom,
- ): Insets = MutableInsets(left, top, right, bottom)
-
- operator fun minus(other: Insets): Insets = copy(
- left = this.left - other.left,
- top = this.top - other.top,
- right = this.right - other.right,
- bottom = this.bottom - other.bottom,
- )
-
- operator fun plus(other: Insets): Insets = copy(
- left = this.left + other.left,
- top = this.top + other.top,
- right = this.right + other.right,
- bottom = this.bottom + other.bottom,
- )
-}
-
-internal class MutableInsets(
- left: Int = 0,
- top: Int = 0,
- right: Int = 0,
- bottom: Int = 0,
-) : Insets {
- override var left by mutableStateOf(left)
- internal set
-
- override var top by mutableStateOf(top)
- internal set
-
- override var right by mutableStateOf(right)
- internal set
-
- override var bottom by mutableStateOf(bottom)
- internal set
-
- fun reset() {
- left = 0
- top = 0
- right = 0
- bottom = 0
- }
-}
-
-/**
- * Composition local containing the current [WindowInsets].
- */
-val LocalWindowInsets = staticCompositionLocalOf { WindowInsets() }
-
-/**
- * This class sets up the necessary listeners on the given [view] to be able to observe
- * [WindowInsetsCompat] instances dispatched by the system.
- *
- * This class is useful for when you prefer to handle the ownership of the [WindowInsets]
- * yourself. One example of this is if you find yourself using [ProvideWindowInsets] in fragments.
- *
- * It is convenient to use [ProvideWindowInsets] in fragments, but that can result in a
- * delay in the initial inset update, which results in a visual flicker.
- * See [this issue](https://github.com/google/accompanist/issues/155) for more information.
- *
- * The alternative is for fragments to manage the [WindowInsets] themselves, like so:
- *
- * ```
- * override fun onCreateView(
- * inflater: LayoutInflater,
- * container: ViewGroup?,
- * savedInstanceState: Bundle?
- * ): View = ComposeView(requireContext()).apply {
- * layoutParams = LayoutParams(MATCH_PARENT, MATCH_PARENT)
- *
- * // Create an ViewWindowInsetObserver using this view
- * val observer = ViewWindowInsetObserver(this)
- *
- * // Call start() to start listening now.
- * // The WindowInsets instance is returned to us.
- * val windowInsets = observer.start()
- *
- * setContent {
- * // Instead of calling ProvideWindowInsets, we use CompositionLocalProvider to provide
- * // the WindowInsets instance from above to LocalWindowInsets
- * CompositionLocalProvider(LocalWindowInsets provides windowInsets) {
- * /* Content */
- * }
- * }
- * }
- * ```
- *
- * @param view The view to observe [WindowInsetsCompat]s from.
- */
-class ViewWindowInsetObserver(private val view: View) {
- private val attachListener = object : View.OnAttachStateChangeListener {
- override fun onViewAttachedToWindow(v: View) = v.requestApplyInsets()
- override fun onViewDetachedFromWindow(v: View) = Unit
- }
-
- /**
- * Whether this [ViewWindowInsetObserver] is currently observing.
- */
- @Suppress("MemberVisibilityCanBePrivate")
- var isObserving: Boolean = false
- private set
-
- /**
- * Start observing window insets from [view]. Make sure to call [stop] if required.
- *
- * @param consumeWindowInsets Whether to consume any [WindowInsetsCompat]s which are
- * dispatched to the host view. Defaults to `true`.
- */
- fun start(
- consumeWindowInsets: Boolean = true
- ): WindowInsets {
- return WindowInsets().apply {
- observeInto(
- windowInsets = this,
- consumeWindowInsets = consumeWindowInsets,
- windowInsetsAnimationsEnabled = false
- )
- }
- }
-
- /**
- * Start observing window insets from [view]. Make sure to call [stop] if required.
- *
- * @param windowInsetsAnimationsEnabled Whether to listen for [WindowInsetsAnimation]s, such as
- * IME animations.
- * @param consumeWindowInsets Whether to consume any [WindowInsetsCompat]s which are
- * dispatched to the host view. Defaults to `true`.
- */
- @ExperimentalAnimatedInsets
- fun start(
- windowInsetsAnimationsEnabled: Boolean,
- consumeWindowInsets: Boolean = true,
- ): WindowInsets {
- return WindowInsets().apply {
- observeInto(
- windowInsets = this,
- consumeWindowInsets = consumeWindowInsets,
- windowInsetsAnimationsEnabled = windowInsetsAnimationsEnabled
- )
- }
- }
-
- internal fun observeInto(
- windowInsets: WindowInsets,
- consumeWindowInsets: Boolean,
- windowInsetsAnimationsEnabled: Boolean,
- ) {
- require(!isObserving) {
- "start() called, but this ViewWindowInsetObserver is already observing"
- }
-
- ViewCompat.setOnApplyWindowInsetsListener(view) { _, wic ->
- // Go through each inset type and update its layoutInsets from the
- // WindowInsetsCompat values
- windowInsets.statusBars.run {
- _layoutInsets.updateFrom(wic.getInsets(WindowInsetsCompat.Type.statusBars()))
- isVisible = wic.isVisible(WindowInsetsCompat.Type.statusBars())
- }
- windowInsets.navigationBars.run {
- _layoutInsets.updateFrom(wic.getInsets(WindowInsetsCompat.Type.navigationBars()))
- isVisible = wic.isVisible(WindowInsetsCompat.Type.navigationBars())
- }
- windowInsets.systemBars.run {
- _layoutInsets.updateFrom(wic.getInsets(WindowInsetsCompat.Type.systemBars()))
- isVisible = wic.isVisible(WindowInsetsCompat.Type.systemBars())
- }
- windowInsets.systemGestures.run {
- _layoutInsets.updateFrom(wic.getInsets(WindowInsetsCompat.Type.systemGestures()))
- isVisible = wic.isVisible(WindowInsetsCompat.Type.systemGestures())
- }
- windowInsets.ime.run {
- _layoutInsets.updateFrom(wic.getInsets(WindowInsetsCompat.Type.ime()))
- isVisible = wic.isVisible(WindowInsetsCompat.Type.ime())
- }
-
- if (consumeWindowInsets) WindowInsetsCompat.CONSUMED else wic
- }
-
- // Add an OnAttachStateChangeListener to request an inset pass each time we're attached
- // to the window
- view.addOnAttachStateChangeListener(attachListener)
-
- if (windowInsetsAnimationsEnabled) {
- ViewCompat.setWindowInsetsAnimationCallback(
- view,
- InnerWindowInsetsAnimationCallback(windowInsets)
- )
- } else {
- ViewCompat.setWindowInsetsAnimationCallback(view, null)
- }
-
- if (view.isAttachedToWindow) {
- // If the view is already attached, we can request an inset pass now
- view.requestApplyInsets()
- }
-
- isObserving = true
- }
-
- /**
- * Removes any listeners from the [view] so that we no longer observe inset changes.
- *
- * This is only required to be called from hosts which have a shorter lifetime than the [view].
- * For example, if you're using [ViewWindowInsetObserver] from a `@Composable` function,
- * you should call [stop] from an `onDispose` block, like so:
- *
- * ```
- * DisposableEffect(view) {
- * val observer = ViewWindowInsetObserver(view)
- * // ...
- * onDispose {
- * observer.stop()
- * }
- * }
- * ```
- *
- * Whereas if you're using this class from a fragment (or similar), it is not required to
- * call this function since it will live as least as longer as the view.
- */
- fun stop() {
- require(isObserving) {
- "stop() called, but this ViewWindowInsetObserver is not currently observing"
- }
- view.removeOnAttachStateChangeListener(attachListener)
- ViewCompat.setOnApplyWindowInsetsListener(view, null)
- isObserving = false
- }
-}
-
-/**
- * Applies any [WindowInsetsCompat] values to [LocalWindowInsets], which are then available
- * within [content].
- *
- * If you're using this in fragments, you may wish to take a look at
- * [ViewWindowInsetObserver] for a more optimal solution.
- *
- * @param consumeWindowInsets Whether to consume any [WindowInsetsCompat]s which are dispatched to
- * the host view. Defaults to `true`.
- */
-@SuppressLint("UnnecessaryLambdaCreation")
-@Composable
-fun ProvideWindowInsets(
- consumeWindowInsets: Boolean = true,
- content: @Composable () -> Unit,
-) {
- val view = LocalView.current
- val windowInsets = LocalWindowInsets.current
-
- DisposableEffect(view) {
- val observer = ViewWindowInsetObserver(view)
- observer.observeInto(
- windowInsets = windowInsets,
- consumeWindowInsets = consumeWindowInsets,
- windowInsetsAnimationsEnabled = false
- )
- onDispose {
- observer.stop()
- }
- }
-
- CompositionLocalProvider(LocalWindowInsets provides windowInsets) {
- content()
- }
-}
-
-/**
- * Applies any [WindowInsetsCompat] values to [LocalWindowInsets], which are then available
- * within [content].
- *
- * If you're using this in fragments, you may wish to take a look at
- * [ViewWindowInsetObserver] for a more optimal solution.
- *
- * @param windowInsetsAnimationsEnabled Whether to listen for [WindowInsetsAnimation]s, such as
- * IME animations.
- * @param consumeWindowInsets Whether to consume any [WindowInsetsCompat]s which are dispatched to
- * the host view. Defaults to `true`.
- */
-@SuppressLint("UnnecessaryLambdaCreation")
-@ExperimentalAnimatedInsets
-@Composable
-fun ProvideWindowInsets(
- windowInsetsAnimationsEnabled: Boolean,
- consumeWindowInsets: Boolean = true,
- content: @Composable () -> Unit
-) {
- val view = LocalView.current
- val windowInsets = remember { WindowInsets() }
-
- DisposableEffect(view) {
- val observer = ViewWindowInsetObserver(view)
- observer.observeInto(
- windowInsets = windowInsets,
- consumeWindowInsets = consumeWindowInsets,
- windowInsetsAnimationsEnabled = windowInsetsAnimationsEnabled
- )
- onDispose {
- observer.stop()
- }
- }
-
- CompositionLocalProvider(LocalWindowInsets provides windowInsets) {
- content()
- }
-}
-
-private class InnerWindowInsetsAnimationCallback(
- private val windowInsets: WindowInsets,
-) : WindowInsetsAnimationCompat.Callback(DISPATCH_MODE_STOP) {
- override fun onPrepare(animation: WindowInsetsAnimationCompat) {
- // Go through each type and flag that an animation has started
- if (animation.typeMask and WindowInsetsCompat.Type.ime() != 0) {
- windowInsets.ime.onAnimationStart()
- }
- if (animation.typeMask and WindowInsetsCompat.Type.statusBars() != 0) {
- windowInsets.statusBars.onAnimationStart()
- }
- if (animation.typeMask and WindowInsetsCompat.Type.navigationBars() != 0) {
- windowInsets.navigationBars.onAnimationStart()
- }
- if (animation.typeMask and WindowInsetsCompat.Type.systemBars() != 0) {
- windowInsets.systemBars.onAnimationStart()
- }
- if (animation.typeMask and WindowInsetsCompat.Type.systemGestures() != 0) {
- windowInsets.systemGestures.onAnimationStart()
- }
- }
-
- override fun onProgress(
- platformInsets: WindowInsetsCompat,
- runningAnimations: List<WindowInsetsAnimationCompat>
- ): WindowInsetsCompat {
- // Update each inset type with the given parameters
- windowInsets.ime.updateAnimation(
- platformInsets = platformInsets,
- runningAnimations = runningAnimations,
- type = WindowInsetsCompat.Type.ime()
- )
- windowInsets.statusBars.updateAnimation(
- platformInsets = platformInsets,
- runningAnimations = runningAnimations,
- type = WindowInsetsCompat.Type.statusBars()
- )
- windowInsets.navigationBars.updateAnimation(
- platformInsets = platformInsets,
- runningAnimations = runningAnimations,
- type = WindowInsetsCompat.Type.navigationBars()
- )
- windowInsets.systemBars.updateAnimation(
- platformInsets = platformInsets,
- runningAnimations = runningAnimations,
- type = WindowInsetsCompat.Type.systemBars()
- )
- windowInsets.systemBars.updateAnimation(
- platformInsets = platformInsets,
- runningAnimations = runningAnimations,
- type = WindowInsetsCompat.Type.systemGestures()
- )
- return platformInsets
- }
-
- private inline fun InsetsType.updateAnimation(
- platformInsets: WindowInsetsCompat,
- runningAnimations: List<WindowInsetsAnimationCompat>,
- type: Int,
- ) {
- // If there are animations of the given type...
- if (runningAnimations.any { it.typeMask or type != 0 }) {
- // Update our animated inset values
- _animatedInsets.updateFrom(platformInsets.getInsets(type))
- // And update the animation fraction. We use the maximum animation progress of any
- // ongoing animations for this type.
- animationFraction = runningAnimations.maxOf { it.fraction }
- }
- }
-
- override fun onEnd(animation: WindowInsetsAnimationCompat) {
- // Go through each type and flag that an animation has ended
- if (animation.typeMask and WindowInsetsCompat.Type.ime() != 0) {
- windowInsets.ime.onAnimationEnd()
- }
- if (animation.typeMask and WindowInsetsCompat.Type.statusBars() != 0) {
- windowInsets.statusBars.onAnimationEnd()
- }
- if (animation.typeMask and WindowInsetsCompat.Type.navigationBars() != 0) {
- windowInsets.navigationBars.onAnimationEnd()
- }
- if (animation.typeMask and WindowInsetsCompat.Type.systemBars() != 0) {
- windowInsets.systemBars.onAnimationEnd()
- }
- if (animation.typeMask and WindowInsetsCompat.Type.systemGestures() != 0) {
- windowInsets.systemGestures.onAnimationEnd()
- }
- }
-}
-
-/**
- * Updates our mutable state backed [InsetsType] from an Android system insets.
- */
-private fun MutableInsets.updateFrom(insets: androidx.core.graphics.Insets) {
- left = insets.left
- top = insets.top
- right = insets.right
- bottom = insets.bottom
-}
-
-/**
- * Ensures that each dimension is not less than corresponding dimension in the
- * specified [minimumValue].
- *
- * @return this if every dimension is greater than or equal to the corresponding
- * dimension value in [minimumValue], otherwise a copy of this with each dimension coerced with the
- * corresponding dimension value in [minimumValue].
- */
-fun InsetsType.coerceEachDimensionAtLeast(minimumValue: InsetsType): Insets {
- // Fast path, no need to copy if: this >= minimumValue
- if (left >= minimumValue.left && top >= minimumValue.top &&
- right >= minimumValue.right && bottom >= minimumValue.bottom
- ) {
- return this
- }
- return MutableInsets(
- left = left.coerceAtLeast(minimumValue.left),
- top = top.coerceAtLeast(minimumValue.top),
- right = right.coerceAtLeast(minimumValue.right),
- bottom = bottom.coerceAtLeast(minimumValue.bottom),
- )
-}
-
-enum class HorizontalSide { Left, Right }
-enum class VerticalSide { Top, Bottom }
-
-@RequiresOptIn(
- message = "Animated Insets support is experimental. The API may be changed in the " +
- "future."
-)
-@Retention(AnnotationRetention.BINARY)
-@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION)
-annotation class ExperimentalAnimatedInsets
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/insets/Padding.kt b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/insets/Padding.kt
deleted file mode 100644
index c3fcfe6..0000000
--- a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/insets/Padding.kt
+++ /dev/null
@@ -1,248 +0,0 @@
-/*
- * Copyright 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * TODO: Move to depending on Accompanist with prebuilts when we hit a stable version
- * https://github.com/google/accompanist/blob/main/insets/src/main/java/com/google/accompanist
- * /insets/Padding.kt
- */
-
-@file:Suppress("NOTHING_TO_INLINE", "unused")
-
-@file:JvmName("ComposeInsets")
-@file:JvmMultifileClass
-
-package androidx.compose.material.catalog.insets
-
-import android.annotation.SuppressLint
-import androidx.compose.foundation.layout.PaddingValues
-import androidx.compose.runtime.Composable
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.composed
-import androidx.compose.ui.layout.LayoutModifier
-import androidx.compose.ui.layout.Measurable
-import androidx.compose.ui.layout.MeasureResult
-import androidx.compose.ui.layout.MeasureScope
-import androidx.compose.ui.platform.LocalDensity
-import androidx.compose.ui.platform.LocalLayoutDirection
-import androidx.compose.ui.unit.Constraints
-import androidx.compose.ui.unit.Dp
-import androidx.compose.ui.unit.LayoutDirection
-import androidx.compose.ui.unit.dp
-import androidx.compose.ui.unit.offset
-
-/**
- * Selectively apply additional space which matches the width/height of any system bars present
- * on the respective edges of the screen.
- *
- * @param enabled Whether to apply padding using the system bars dimensions on the respective edges.
- * Defaults to `true`.
- */
-@SuppressLint("ModifierInspectorInfo")
-fun Modifier.systemBarsPadding(
- enabled: Boolean = true
-): Modifier = composed {
- InsetsPaddingModifier(
- insetsType = LocalWindowInsets.current.systemBars,
- applyLeft = enabled,
- applyTop = enabled,
- applyRight = enabled,
- applyBottom = enabled
- )
-}
-
-/**
- * Apply additional space which matches the height of the status bars height along the top edge
- * of the content.
- */
-@SuppressLint("ModifierInspectorInfo")
-fun Modifier.statusBarsPadding(): Modifier = composed {
- InsetsPaddingModifier(
- insetsType = LocalWindowInsets.current.statusBars,
- applyTop = true
- )
-}
-
-/**
- * Apply additional space which matches the height of the navigation bars height
- * along the [bottom] edge of the content, and additional space which matches the width of
- * the navigation bars on the respective [left] and [right] edges.
- *
- * @param bottom Whether to apply padding to the bottom edge, which matches the navigation bars
- * height (if present) at the bottom edge of the screen. Defaults to `true`.
- * @param left Whether to apply padding to the left edge, which matches the navigation bars width
- * (if present) on the left edge of the screen. Defaults to `true`.
- * @param right Whether to apply padding to the right edge, which matches the navigation bars width
- * (if present) on the right edge of the screen. Defaults to `true`.
- */
-@SuppressLint("ModifierInspectorInfo")
-fun Modifier.navigationBarsPadding(
- bottom: Boolean = true,
- left: Boolean = true,
- right: Boolean = true
-): Modifier = composed {
- InsetsPaddingModifier(
- insetsType = LocalWindowInsets.current.navigationBars,
- applyLeft = left,
- applyRight = right,
- applyBottom = bottom
- )
-}
-
-/**
- * Apply additional space which matches the height of the [WindowInsets.ime] (on-screen keyboard)
- * height along the bottom edge of the content.
- *
- * This method has no special handling for the [WindowInsets.navigationBars], which usually
- * intersect the [WindowInsets.ime]. Most apps will usually want to use the
- * [Modifier.navigationBarsWithImePadding] modifier.
- */
-@SuppressLint("ModifierInspectorInfo")
-fun Modifier.imePadding(): Modifier = composed {
- InsetsPaddingModifier(
- insetsType = LocalWindowInsets.current.ime,
- applyLeft = true,
- applyRight = true,
- applyBottom = true,
- )
-}
-
-/**
- * Apply additional space which matches the height of the [WindowInsets.ime] (on-screen keyboard)
- * height and [WindowInsets.navigationBars]. This is what apps should use to handle any insets
- * at the bottom of the screen.
- */
-@SuppressLint("ModifierInspectorInfo")
-fun Modifier.navigationBarsWithImePadding(): Modifier = composed {
- InsetsPaddingModifier(
- insetsType = LocalWindowInsets.current.ime,
- minimumInsetsType = LocalWindowInsets.current.navigationBars,
- applyLeft = true,
- applyRight = true,
- applyBottom = true,
- )
-}
-
-private data class InsetsPaddingModifier(
- private val insetsType: InsetsType,
- private val minimumInsetsType: InsetsType? = null,
- private val applyLeft: Boolean = false,
- private val applyTop: Boolean = false,
- private val applyRight: Boolean = false,
- private val applyBottom: Boolean = false,
-) : LayoutModifier {
- override fun MeasureScope.measure(
- measurable: Measurable,
- constraints: Constraints
- ): MeasureResult {
- val transformedInsets = if (minimumInsetsType != null) {
- // If we have a minimum insets, coerce each dimensions
- insetsType.coerceEachDimensionAtLeast(minimumInsetsType)
- } else insetsType
-
- val left = if (applyLeft) transformedInsets.left else 0
- val top = if (applyTop) transformedInsets.top else 0
- val right = if (applyRight) transformedInsets.right else 0
- val bottom = if (applyBottom) transformedInsets.bottom else 0
- val horizontal = left + right
- val vertical = top + bottom
-
- val placeable = measurable.measure(constraints.offset(-horizontal, -vertical))
-
- val width = (placeable.width + horizontal)
- .coerceIn(constraints.minWidth, constraints.maxWidth)
- val height = (placeable.height + vertical)
- .coerceIn(constraints.minHeight, constraints.maxHeight)
- return layout(width, height) {
- placeable.place(left, top)
- }
- }
-}
-
-/**
- * Returns the current insets converted into a [PaddingValues].
- *
- * @param start Whether to apply the inset on the start dimension.
- * @param top Whether to apply the inset on the top dimension.
- * @param end Whether to apply the inset on the end dimension.
- * @param bottom Whether to apply the inset on the bottom dimension.
- * @param additionalHorizontal Value to add to the start and end dimensions.
- * @param additionalVertical Value to add to the top and bottom dimensions.
- */
-@Composable
-inline fun InsetsType.toPaddingValues(
- start: Boolean = true,
- top: Boolean = true,
- end: Boolean = true,
- bottom: Boolean = true,
- additionalHorizontal: Dp = 0.dp,
- additionalVertical: Dp = 0.dp,
-) = toPaddingValues(
- start = start,
- top = top,
- end = end,
- bottom = bottom,
- additionalStart = additionalHorizontal,
- additionalTop = additionalVertical,
- additionalEnd = additionalHorizontal,
- additionalBottom = additionalVertical
-)
-
-/**
- * Returns the current insets converted into a [PaddingValues].
- *
- * @param start Whether to apply the inset on the start dimension.
- * @param top Whether to apply the inset on the top dimension.
- * @param end Whether to apply the inset on the end dimension.
- * @param bottom Whether to apply the inset on the bottom dimension.
- * @param additionalStart Value to add to the start dimension.
- * @param additionalTop Value to add to the top dimension.
- * @param additionalEnd Value to add to the end dimension.
- * @param additionalBottom Value to add to the bottom dimension.
- */
-@Composable
-fun InsetsType.toPaddingValues(
- start: Boolean = true,
- top: Boolean = true,
- end: Boolean = true,
- bottom: Boolean = true,
- additionalStart: Dp = 0.dp,
- additionalTop: Dp = 0.dp,
- additionalEnd: Dp = 0.dp,
- additionalBottom: Dp = 0.dp,
-): PaddingValues = with(LocalDensity.current) {
- val layoutDirection = LocalLayoutDirection.current
- PaddingValues(
- start = additionalStart + when {
- start && layoutDirection == LayoutDirection.Ltr -> [email protected]()
- start && layoutDirection == LayoutDirection.Rtl -> [email protected]()
- else -> 0.dp
- },
- top = additionalTop + when {
- top -> [email protected]()
- else -> 0.dp
- },
- end = additionalEnd + when {
- end && layoutDirection == LayoutDirection.Ltr -> [email protected]()
- end && layoutDirection == LayoutDirection.Rtl -> [email protected]()
- else -> 0.dp
- },
- bottom = additionalBottom + when {
- bottom -> [email protected]()
- else -> 0.dp
- }
- )
-}
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/insets/Size.kt b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/insets/Size.kt
deleted file mode 100644
index 115014d..0000000
--- a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/insets/Size.kt
+++ /dev/null
@@ -1,270 +0,0 @@
-/*
- * Copyright 2021 The Android Open Source Project
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-/**
- * TODO: Move to depending on Accompanist with prebuilts when we hit a stable version
- * https://github.com/google/accompanist/blob/main/insets/src/main/java/com/google/accompanist
- * /insets/Size.kt
- */
-
-@file:Suppress("NOTHING_TO_INLINE", "unused")
-
-@file:JvmName("ComposeInsets")
-@file:JvmMultifileClass
-
-package androidx.compose.material.catalog.insets
-
-import android.annotation.SuppressLint
-import androidx.compose.foundation.layout.height
-import androidx.compose.ui.Modifier
-import androidx.compose.ui.composed
-import androidx.compose.ui.layout.IntrinsicMeasurable
-import androidx.compose.ui.layout.IntrinsicMeasureScope
-import androidx.compose.ui.layout.LayoutModifier
-import androidx.compose.ui.layout.Measurable
-import androidx.compose.ui.layout.MeasureResult
-import androidx.compose.ui.layout.MeasureScope
-import androidx.compose.ui.unit.Constraints
-import androidx.compose.ui.unit.Density
-import androidx.compose.ui.unit.Dp
-import androidx.compose.ui.unit.dp
-
-/**
- * Declare the height of the content to match the height of the status bars exactly.
- *
- * This is very handy when used with `Spacer` to push content below the status bars:
- * ```
- * Column {
- * Spacer(Modifier.statusBarHeight())
- *
- * // Content to be drawn below status bars (y-axis)
- * }
- * ```
- *
- * It's also useful when used to draw a scrim which matches the status bars:
- * ```
- * Spacer(
- * Modifier.statusBarHeight()
- * .fillMaxWidth()
- * .drawBackground(MaterialTheme.colors.background.copy(alpha = 0.3f)
- * )
- * ```
- *
- * Internally this matches the behavior of the [Modifier.height] modifier.
- *
- * @param additional Any additional height to add to the status bars size.
- */
-@SuppressLint("ModifierInspectorInfo")
-fun Modifier.statusBarsHeight(
- additional: Dp = 0.dp
-): Modifier = composed {
- InsetsSizeModifier(
- insetsType = LocalWindowInsets.current.statusBars,
- heightSide = VerticalSide.Top,
- additionalHeight = additional
- )
-}
-
-/**
- * Declare the preferred height of the content to match the height of the navigation bars when
- * present at the bottom of the screen.
- *
- * This is very handy when used with `Spacer` to push content below the navigation bars:
- * ```
- * Column {
- * // Content to be drawn above status bars (y-axis)
- * Spacer(Modifier.navigationBarHeight())
- * }
- * ```
- *
- * It's also useful when used to draw a scrim which matches the navigation bars:
- * ```
- * Spacer(
- * Modifier.navigationBarHeight()
- * .fillMaxWidth()
- * .drawBackground(MaterialTheme.colors.background.copy(alpha = 0.3f)
- * )
- * ```
- *
- * Internally this matches the behavior of the [Modifier.height] modifier.
- *
- * @param additional Any additional height to add to the status bars size.
- */
-@SuppressLint("ModifierInspectorInfo")
-fun Modifier.navigationBarsHeight(
- additional: Dp = 0.dp
-): Modifier = composed {
- InsetsSizeModifier(
- insetsType = LocalWindowInsets.current.navigationBars,
- heightSide = VerticalSide.Bottom,
- additionalHeight = additional
- )
-}
-
-/**
- * Declare the preferred width of the content to match the width of the navigation bars,
- * on the given [side].
- *
- * This is very handy when used with `Spacer` to push content inside from any vertical
- * navigation bars (typically when the device is in landscape):
- * ```
- * Row {
- * Spacer(Modifier.navigationBarWidth(HorizontalSide.Left))
- *
- * // Content to be inside the navigation bars (x-axis)
- *
- * Spacer(Modifier.navigationBarWidth(HorizontalSide.Right))
- * }
- * ```
- *
- * It's also useful when used to draw a scrim which matches the navigation bars:
- * ```
- * Spacer(
- * Modifier.navigationBarWidth(HorizontalSide.Left)
- * .fillMaxHeight()
- * .drawBackground(MaterialTheme.colors.background.copy(alpha = 0.3f)
- * )
- * ```
- *
- * Internally this matches the behavior of the [Modifier.height] modifier.
- *
- * @param side The navigation bar side to use as the source for the width.
- * @param additional Any additional width to add to the status bars size.
- */
-@SuppressLint("ModifierInspectorInfo")
-fun Modifier.navigationBarsWidth(
- side: HorizontalSide,
- additional: Dp = 0.dp
-): Modifier = composed {
- InsetsSizeModifier(
- insetsType = LocalWindowInsets.current.navigationBars,
- widthSide = side,
- additionalWidth = additional
- )
-}
-
-/**
- * [Modifier] class which powers the modifiers above. This is the lower level modifier which
- * supports the functionality through a number of parameters.
- *
- * We may make this public at some point. If you need this, please let us know via the
- * issue tracker.
- */
-private data class InsetsSizeModifier(
- private val insetsType: InsetsType,
- private val widthSide: HorizontalSide? = null,
- private val additionalWidth: Dp = 0.dp,
- private val heightSide: VerticalSide? = null,
- private val additionalHeight: Dp = 0.dp
-) : LayoutModifier {
- private val Density.targetConstraints: Constraints
- get() {
- val additionalWidthPx = additionalWidth.roundToPx()
- val additionalHeightPx = additionalHeight.roundToPx()
- return Constraints(
- minWidth = additionalWidthPx + when (widthSide) {
- HorizontalSide.Left -> insetsType.left
- HorizontalSide.Right -> insetsType.right
- null -> 0
- },
- minHeight = additionalHeightPx + when (heightSide) {
- VerticalSide.Top -> insetsType.top
- VerticalSide.Bottom -> insetsType.bottom
- null -> 0
- },
- maxWidth = when (widthSide) {
- HorizontalSide.Left -> insetsType.left + additionalWidthPx
- HorizontalSide.Right -> insetsType.right + additionalWidthPx
- null -> Constraints.Infinity
- },
- maxHeight = when (heightSide) {
- VerticalSide.Top -> insetsType.top + additionalHeightPx
- VerticalSide.Bottom -> insetsType.bottom + additionalHeightPx
- null -> Constraints.Infinity
- }
- )
- }
-
- override fun MeasureScope.measure(
- measurable: Measurable,
- constraints: Constraints
- ): MeasureResult {
- val wrappedConstraints = targetConstraints.let { targetConstraints ->
- val resolvedMinWidth = if (widthSide != null) {
- targetConstraints.minWidth
- } else {
- constraints.minWidth.coerceAtMost(targetConstraints.maxWidth)
- }
- val resolvedMaxWidth = if (widthSide != null) {
- targetConstraints.maxWidth
- } else {
- constraints.maxWidth.coerceAtLeast(targetConstraints.minWidth)
- }
- val resolvedMinHeight = if (heightSide != null) {
- targetConstraints.minHeight
- } else {
- constraints.minHeight.coerceAtMost(targetConstraints.maxHeight)
- }
- val resolvedMaxHeight = if (heightSide != null) {
- targetConstraints.maxHeight
- } else {
- constraints.maxHeight.coerceAtLeast(targetConstraints.minHeight)
- }
- Constraints(
- resolvedMinWidth,
- resolvedMaxWidth,
- resolvedMinHeight,
- resolvedMaxHeight
- )
- }
- val placeable = measurable.measure(wrappedConstraints)
- return layout(placeable.width, placeable.height) {
- placeable.place(0, 0)
- }
- }
-
- override fun IntrinsicMeasureScope.minIntrinsicWidth(
- measurable: IntrinsicMeasurable,
- height: Int
- ) = measurable.minIntrinsicWidth(height).let {
- val constraints = targetConstraints
- it.coerceIn(constraints.minWidth, constraints.maxWidth)
- }
-
- override fun IntrinsicMeasureScope.maxIntrinsicWidth(
- measurable: IntrinsicMeasurable,
- height: Int
- ) = measurable.maxIntrinsicWidth(height).let {
- val constraints = targetConstraints
- it.coerceIn(constraints.minWidth, constraints.maxWidth)
- }
-
- override fun IntrinsicMeasureScope.minIntrinsicHeight(
- measurable: IntrinsicMeasurable,
- width: Int
- ) = measurable.minIntrinsicHeight(width).let {
- val constraints = targetConstraints
- it.coerceIn(constraints.minHeight, constraints.maxHeight)
- }
-
- override fun IntrinsicMeasureScope.maxIntrinsicHeight(
- measurable: IntrinsicMeasurable,
- width: Int
- ) = measurable.maxIntrinsicHeight(width).let {
- val constraints = targetConstraints
- it.coerceIn(constraints.minHeight, constraints.maxHeight)
- }
-}
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/CatalogApp.kt b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/CatalogApp.kt
similarity index 60%
rename from compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/CatalogApp.kt
rename to compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/CatalogApp.kt
index 1ffe9e4..9a7e25b 100644
--- a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/CatalogApp.kt
+++ b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/CatalogApp.kt
@@ -14,12 +14,11 @@
* limitations under the License.
*/
-package androidx.compose.material.catalog
+package androidx.compose.material.catalog.library
-import androidx.compose.material.catalog.insets.ProvideWindowInsets
-import androidx.compose.material.catalog.model.Theme
-import androidx.compose.material.catalog.model.ThemeSaver
-import androidx.compose.material.catalog.ui.theme.CatalogTheme
+import androidx.compose.material.catalog.library.model.Theme
+import androidx.compose.material.catalog.library.model.ThemeSaver
+import androidx.compose.material.catalog.library.ui.theme.CatalogTheme
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
@@ -27,14 +26,12 @@
import androidx.compose.runtime.setValue
@Composable
-fun CatalogApp() {
- ProvideWindowInsets {
- var theme by rememberSaveable(stateSaver = ThemeSaver) { mutableStateOf(Theme()) }
- CatalogTheme(theme = theme) {
- NavGraph(
- theme = theme,
- onThemeChange = { theme = it }
- )
- }
+fun MaterialCatalogApp() {
+ var theme by rememberSaveable(stateSaver = ThemeSaver) { mutableStateOf(Theme()) }
+ CatalogTheme(theme = theme) {
+ NavGraph(
+ theme = theme,
+ onThemeChange = { theme = it }
+ )
}
}
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/NavGraph.kt b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/NavGraph.kt
similarity index 79%
copy from compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/NavGraph.kt
copy to compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/NavGraph.kt
index 5c41cda..773458c 100644
--- a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/NavGraph.kt
+++ b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/NavGraph.kt
@@ -14,15 +14,14 @@
* limitations under the License.
*/
-package androidx.compose.material.catalog
+package androidx.compose.material.catalog.library
-import androidx.compose.material.catalog.model.Components
-import androidx.compose.material.catalog.model.Theme
-import androidx.compose.material.catalog.ui.component.Component
-import androidx.compose.material.catalog.ui.example.Example
-import androidx.compose.material.catalog.ui.home.Home
+import androidx.compose.material.catalog.library.model.Components
+import androidx.compose.material.catalog.library.model.Theme
+import androidx.compose.material.catalog.library.ui.component.Component
+import androidx.compose.material.catalog.library.ui.example.Example
+import androidx.compose.material.catalog.library.ui.home.Home
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.rememberUpdatedState
import androidx.navigation.NavType
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
@@ -34,10 +33,6 @@
theme: Theme,
onThemeChange: (theme: Theme) -> Unit
) {
- // Using rememberUpdatedState as hoisted state is not correctly propagated to NavHost
- // https://issuetracker.google.com/issues/177338143
- val navTheme = rememberUpdatedState(theme)
- val navOnThemeChange = rememberUpdatedState(onThemeChange)
val navController = rememberNavController()
NavHost(
navController = navController,
@@ -46,8 +41,8 @@
composable(HomeRoute) {
Home(
components = Components,
- theme = navTheme.value,
- onThemeChange = navOnThemeChange.value,
+ theme = theme,
+ onThemeChange = onThemeChange,
onComponentClick = { component ->
val componentId = component.id
val route = "$ComponentRoute/$componentId"
@@ -67,8 +62,8 @@
val component = Components.first { component -> component.id == componentId }
Component(
component = component,
- theme = navTheme.value,
- onThemeChange = navOnThemeChange.value,
+ theme = theme,
+ onThemeChange = onThemeChange,
onExampleClick = { example ->
val exampleIndex = component.examples.indexOf(example)
val route = "$ExampleRoute/$componentId/$exampleIndex"
@@ -94,14 +89,15 @@
Example(
component = component,
example = example,
- theme = navTheme.value,
- onThemeChange = navOnThemeChange.value,
+ theme = theme,
+ onThemeChange = onThemeChange,
onBackClick = { navController.popBackStack() }
)
}
}
}
+const val MaterialRoute = "material"
private const val HomeRoute = "home"
private const val ComponentRoute = "component"
private const val ExampleRoute = "example"
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/model/Components.kt b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/model/Components.kt
similarity index 96%
rename from compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/model/Components.kt
rename to compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/model/Components.kt
index fe4930ff..46f0f03 100644
--- a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/model/Components.kt
+++ b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/model/Components.kt
@@ -14,13 +14,13 @@
* limitations under the License.
*/
-package androidx.compose.material.catalog.model
+package androidx.compose.material.catalog.library.model
import androidx.annotation.DrawableRes
-import androidx.compose.material.catalog.R
-import androidx.compose.material.catalog.util.ComponentGuidelinesUrl
-import androidx.compose.material.catalog.util.DocsUrl
-import androidx.compose.material.catalog.util.MaterialSourceUrl
+import androidx.compose.material.catalog.library.R
+import androidx.compose.material.catalog.library.util.ComponentGuidelinesUrl
+import androidx.compose.material.catalog.library.util.DocsUrl
+import androidx.compose.material.catalog.library.util.MaterialSourceUrl
data class Component(
val id: Int,
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/model/Examples.kt b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/model/Examples.kt
similarity index 99%
rename from compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/model/Examples.kt
rename to compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/model/Examples.kt
index 52633d4..de07f8a 100644
--- a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/model/Examples.kt
+++ b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/model/Examples.kt
@@ -16,9 +16,9 @@
@file:Suppress("COMPOSABLE_FUNCTION_REFERENCE")
-package androidx.compose.material.catalog.model
+package androidx.compose.material.catalog.library.model
-import androidx.compose.material.catalog.util.SampleSourceUrl
+import androidx.compose.material.catalog.library.util.SampleSourceUrl
import androidx.compose.material.samples.AlertDialogSample
import androidx.compose.material.samples.BackdropScaffoldSample
import androidx.compose.material.samples.BottomDrawerSample
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/model/Themes.kt b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/model/Themes.kt
similarity index 98%
rename from compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/model/Themes.kt
rename to compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/model/Themes.kt
index 92a93c0..5f3e7bc 100644
--- a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/model/Themes.kt
+++ b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/model/Themes.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package androidx.compose.material.catalog.model
+package androidx.compose.material.catalog.library.model
import androidx.compose.foundation.shape.CornerBasedShape
import androidx.compose.foundation.shape.CutCornerShape
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/common/Border.kt b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/ui/common/Border.kt
similarity index 97%
copy from compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/common/Border.kt
copy to compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/ui/common/Border.kt
index 9d0fc08..17b94a5 100644
--- a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/common/Border.kt
+++ b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/ui/common/Border.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package androidx.compose.material.catalog.ui.common
+package androidx.compose.material.catalog.library.ui.common
import androidx.compose.material.LocalContentColor
import androidx.compose.material.MaterialTheme
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/common/CatalogScaffold.kt b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/ui/common/CatalogScaffold.kt
similarity index 82%
rename from compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/common/CatalogScaffold.kt
rename to compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/ui/common/CatalogScaffold.kt
index 74ef95d..d86161c 100644
--- a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/common/CatalogScaffold.kt
+++ b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/ui/common/CatalogScaffold.kt
@@ -14,23 +14,23 @@
* limitations under the License.
*/
-package androidx.compose.material.catalog.ui.common
+package androidx.compose.material.catalog.library.ui.common
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.material.ModalBottomSheetLayout
import androidx.compose.material.ModalBottomSheetValue
import androidx.compose.material.Scaffold
-import androidx.compose.material.catalog.model.Theme
-import androidx.compose.material.catalog.ui.theme.ThemePicker
-import androidx.compose.material.catalog.util.GuidelinesUrl
-import androidx.compose.material.catalog.util.IssueUrl
-import androidx.compose.material.catalog.util.LicensesUrl
-import androidx.compose.material.catalog.util.PrivacyUrl
-import androidx.compose.material.catalog.util.ReleasesUrl
-import androidx.compose.material.catalog.util.SourceUrl
-import androidx.compose.material.catalog.util.TermsUrl
-import androidx.compose.material.catalog.util.openUrl
+import androidx.compose.material.catalog.library.model.Theme
+import androidx.compose.material.catalog.library.ui.theme.ThemePicker
+import androidx.compose.material.catalog.library.util.GuidelinesUrl
+import androidx.compose.material.catalog.library.util.IssueUrl
+import androidx.compose.material.catalog.library.util.LicensesUrl
+import androidx.compose.material.catalog.library.util.PrivacyUrl
+import androidx.compose.material.catalog.library.util.ReleasesUrl
+import androidx.compose.material.catalog.library.util.SourceUrl
+import androidx.compose.material.catalog.library.util.TermsUrl
+import androidx.compose.material.catalog.library.util.openUrl
import androidx.compose.material.rememberModalBottomSheetState
import androidx.compose.runtime.Composable
import androidx.compose.runtime.rememberCoroutineScope
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/common/CatalogTopAppBar.kt b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/ui/common/CatalogTopAppBar.kt
similarity index 96%
rename from compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/common/CatalogTopAppBar.kt
rename to compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/ui/common/CatalogTopAppBar.kt
index 0de1657..6132c51 100644
--- a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/common/CatalogTopAppBar.kt
+++ b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/ui/common/CatalogTopAppBar.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package androidx.compose.material.catalog.ui.common
+package androidx.compose.material.catalog.library.ui.common
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
@@ -28,9 +28,7 @@
import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.material.TopAppBar
-import androidx.compose.material.catalog.R
-import androidx.compose.material.catalog.insets.navigationBarsPadding
-import androidx.compose.material.catalog.insets.statusBarsPadding
+import androidx.compose.material.catalog.library.R
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material.icons.filled.MoreVert
@@ -46,6 +44,8 @@
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
+import com.google.accompanist.insets.navigationBarsPadding
+import com.google.accompanist.insets.statusBarsPadding
@Composable
fun CatalogTopAppBar(
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/component/Component.kt b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/ui/component/Component.kt
similarity index 86%
rename from compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/component/Component.kt
rename to compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/ui/component/Component.kt
index 2fa2009..791dfa8 100644
--- a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/component/Component.kt
+++ b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/ui/component/Component.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package androidx.compose.material.catalog.ui.component
+package androidx.compose.material.catalog.library.ui.component
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Box
@@ -29,14 +29,12 @@
import androidx.compose.material.LocalContentColor
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
-import androidx.compose.material.catalog.R
-import androidx.compose.material.catalog.insets.LocalWindowInsets
-import androidx.compose.material.catalog.insets.toPaddingValues
-import androidx.compose.material.catalog.model.Component
-import androidx.compose.material.catalog.model.Example
-import androidx.compose.material.catalog.model.Theme
-import androidx.compose.material.catalog.ui.common.CatalogScaffold
-import androidx.compose.material.catalog.ui.example.ExampleItem
+import androidx.compose.material.catalog.library.R
+import androidx.compose.material.catalog.library.model.Component
+import androidx.compose.material.catalog.library.model.Example
+import androidx.compose.material.catalog.library.model.Theme
+import androidx.compose.material.catalog.library.ui.common.CatalogScaffold
+import androidx.compose.material.catalog.library.ui.example.ExampleItem
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@@ -44,6 +42,8 @@
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
+import com.google.accompanist.insets.LocalWindowInsets
+import com.google.accompanist.insets.rememberInsetsPaddingValues
@Composable
fun Component(
@@ -67,7 +67,9 @@
modifier = Modifier
.padding(paddingValues)
.padding(horizontal = ComponentPadding),
- contentPadding = LocalWindowInsets.current.navigationBars.toPaddingValues()
+ contentPadding = rememberInsetsPaddingValues(
+ insets = LocalWindowInsets.current.navigationBars
+ )
) {
item {
Box(
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/component/ComponentItem.kt b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/ui/component/ComponentItem.kt
similarity index 90%
rename from compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/component/ComponentItem.kt
rename to compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/ui/component/ComponentItem.kt
index 2eca34c..94e9f4d 100644
--- a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/component/ComponentItem.kt
+++ b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/ui/component/ComponentItem.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package androidx.compose.material.catalog.ui.component
+package androidx.compose.material.catalog.library.ui.component
import androidx.compose.foundation.Image
import androidx.compose.foundation.clickable
@@ -26,9 +26,9 @@
import androidx.compose.material.LocalContentColor
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
-import androidx.compose.material.catalog.model.Component
-import androidx.compose.material.catalog.ui.common.compositeBorderColor
-import androidx.compose.material.catalog.ui.common.gridItemBorder
+import androidx.compose.material.catalog.library.model.Component
+import androidx.compose.material.catalog.library.ui.common.compositeBorderColor
+import androidx.compose.material.catalog.library.ui.common.gridItemBorder
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/example/Example.kt b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/ui/example/Example.kt
similarity index 81%
rename from compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/example/Example.kt
rename to compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/ui/example/Example.kt
index d5e1172..d6021c3 100644
--- a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/example/Example.kt
+++ b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/ui/example/Example.kt
@@ -14,19 +14,19 @@
* limitations under the License.
*/
-package androidx.compose.material.catalog.ui.example
+package androidx.compose.material.catalog.library.ui.example
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
-import androidx.compose.material.catalog.insets.navigationBarsPadding
-import androidx.compose.material.catalog.model.Component
-import androidx.compose.material.catalog.model.Example
-import androidx.compose.material.catalog.model.Theme
-import androidx.compose.material.catalog.ui.common.CatalogScaffold
+import androidx.compose.material.catalog.library.model.Component
+import androidx.compose.material.catalog.library.model.Example
+import androidx.compose.material.catalog.library.model.Theme
+import androidx.compose.material.catalog.library.ui.common.CatalogScaffold
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
+import com.google.accompanist.insets.navigationBarsPadding
@Composable
fun Example(
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/example/ExampleItem.kt b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/ui/example/ExampleItem.kt
similarity index 91%
rename from compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/example/ExampleItem.kt
rename to compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/ui/example/ExampleItem.kt
index 874afa1..3f5b455 100644
--- a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/example/ExampleItem.kt
+++ b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/ui/example/ExampleItem.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package androidx.compose.material.catalog.ui.example
+package androidx.compose.material.catalog.library.ui.example
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.clickable
@@ -31,9 +31,9 @@
import androidx.compose.material.LocalContentAlpha
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
-import androidx.compose.material.catalog.model.Example
-import androidx.compose.material.catalog.ui.common.BorderWidth
-import androidx.compose.material.catalog.ui.common.compositeBorderColor
+import androidx.compose.material.catalog.library.model.Example
+import androidx.compose.material.catalog.library.ui.common.BorderWidth
+import androidx.compose.material.catalog.library.ui.common.compositeBorderColor
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.KeyboardArrowRight
import androidx.compose.runtime.Composable
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/home/Home.kt b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/ui/home/Home.kt
similarity index 78%
rename from compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/home/Home.kt
rename to compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/ui/home/Home.kt
index 5671c94..ff77567 100644
--- a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/home/Home.kt
+++ b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/ui/home/Home.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package androidx.compose.material.catalog.ui.home
+package androidx.compose.material.catalog.library.ui.home
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.layout.BoxWithConstraints
@@ -22,17 +22,17 @@
import androidx.compose.foundation.lazy.GridCells
import androidx.compose.foundation.lazy.LazyVerticalGrid
import androidx.compose.foundation.lazy.itemsIndexed
-import androidx.compose.material.catalog.R
-import androidx.compose.material.catalog.insets.LocalWindowInsets
-import androidx.compose.material.catalog.insets.toPaddingValues
-import androidx.compose.material.catalog.model.Component
-import androidx.compose.material.catalog.model.Theme
-import androidx.compose.material.catalog.ui.common.CatalogScaffold
-import androidx.compose.material.catalog.ui.component.ComponentItem
+import androidx.compose.material.catalog.library.R
+import androidx.compose.material.catalog.library.model.Component
+import androidx.compose.material.catalog.library.model.Theme
+import androidx.compose.material.catalog.library.ui.common.CatalogScaffold
+import androidx.compose.material.catalog.library.ui.component.ComponentItem
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
+import com.google.accompanist.insets.LocalWindowInsets
+import com.google.accompanist.insets.rememberInsetsPaddingValues
@Composable
@OptIn(ExperimentalFoundationApi::class)
@@ -63,7 +63,9 @@
)
}
},
- contentPadding = LocalWindowInsets.current.navigationBars.toPaddingValues()
+ contentPadding = rememberInsetsPaddingValues(
+ insets = LocalWindowInsets.current.navigationBars
+ )
)
}
}
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/theme/Theme.kt b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/ui/theme/Theme.kt
similarity index 87%
rename from compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/theme/Theme.kt
rename to compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/ui/theme/Theme.kt
index 36b1ad8..26974bb 100644
--- a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/theme/Theme.kt
+++ b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/ui/theme/Theme.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package androidx.compose.material.catalog.ui.theme
+package androidx.compose.material.catalog.library.ui.theme
import androidx.compose.animation.animateColorAsState
import androidx.compose.animation.core.animateDpAsState
@@ -22,13 +22,13 @@
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Shapes
import androidx.compose.material.Typography
-import androidx.compose.material.catalog.model.Theme
-import androidx.compose.material.catalog.model.getColor
-import androidx.compose.material.catalog.model.getFontFamily
-import androidx.compose.material.catalog.model.getShape
-import androidx.compose.material.catalog.util.isLightColor
-import androidx.compose.material.catalog.util.onColor
-import androidx.compose.material.catalog.util.variantColor
+import androidx.compose.material.catalog.library.model.Theme
+import androidx.compose.material.catalog.library.model.getColor
+import androidx.compose.material.catalog.library.model.getFontFamily
+import androidx.compose.material.catalog.library.model.getShape
+import androidx.compose.material.catalog.library.util.isLightColor
+import androidx.compose.material.catalog.library.util.onColor
+import androidx.compose.material.catalog.library.util.variantColor
import androidx.compose.material.darkColors
import androidx.compose.material.lightColors
import androidx.compose.material.primarySurface
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/theme/ThemePicker.kt b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/ui/theme/ThemePicker.kt
similarity index 92%
rename from compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/theme/ThemePicker.kt
rename to compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/ui/theme/ThemePicker.kt
index 918de75..48c1770 100644
--- a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/theme/ThemePicker.kt
+++ b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/ui/theme/ThemePicker.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package androidx.compose.material.catalog.ui.theme
+package androidx.compose.material.catalog.library.ui.theme
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.PaddingValues
@@ -39,19 +39,17 @@
import androidx.compose.material.Slider
import androidx.compose.material.Text
import androidx.compose.material.TextButton
-import androidx.compose.material.catalog.R
-import androidx.compose.material.catalog.insets.LocalWindowInsets
-import androidx.compose.material.catalog.insets.toPaddingValues
-import androidx.compose.material.catalog.model.DefaultTheme
-import androidx.compose.material.catalog.model.MaxLargeShapeCornerSize
-import androidx.compose.material.catalog.model.MaxMediumShapeCornerSize
-import androidx.compose.material.catalog.model.MaxSmallShapeCornerSize
-import androidx.compose.material.catalog.model.Theme
-import androidx.compose.material.catalog.model.ThemeColor
-import androidx.compose.material.catalog.model.ThemeFontFamily
-import androidx.compose.material.catalog.model.ThemeShapeCornerFamily
-import androidx.compose.material.catalog.model.getColor
-import androidx.compose.material.catalog.model.getFontFamily
+import androidx.compose.material.catalog.library.R
+import androidx.compose.material.catalog.library.model.DefaultTheme
+import androidx.compose.material.catalog.library.model.MaxLargeShapeCornerSize
+import androidx.compose.material.catalog.library.model.MaxMediumShapeCornerSize
+import androidx.compose.material.catalog.library.model.MaxSmallShapeCornerSize
+import androidx.compose.material.catalog.library.model.Theme
+import androidx.compose.material.catalog.library.model.ThemeColor
+import androidx.compose.material.catalog.library.model.ThemeFontFamily
+import androidx.compose.material.catalog.library.model.ThemeShapeCornerFamily
+import androidx.compose.material.catalog.library.model.getColor
+import androidx.compose.material.catalog.library.model.getFontFamily
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
@@ -62,6 +60,8 @@
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
+import com.google.accompanist.insets.LocalWindowInsets
+import com.google.accompanist.insets.rememberInsetsPaddingValues
@Composable
fun ThemePicker(
@@ -70,8 +70,10 @@
) {
var themeState by remember { mutableStateOf(theme) }
LazyColumn(
- contentPadding = LocalWindowInsets.current.navigationBars.toPaddingValues(
- additionalVertical = ThemePickerPadding
+ contentPadding = rememberInsetsPaddingValues(
+ insets = LocalWindowInsets.current.navigationBars,
+ additionalTop = ThemePickerPadding,
+ additionalBottom = ThemePickerPadding
)
) {
item {
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/util/Color.kt b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/util/Color.kt
similarity index 96%
rename from compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/util/Color.kt
rename to compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/util/Color.kt
index e90bedd..46070f9 100644
--- a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/util/Color.kt
+++ b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/util/Color.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package androidx.compose.material.catalog.util
+package androidx.compose.material.catalog.library.util
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.lerp
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/util/Url.kt b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/util/Url.kt
similarity index 97%
rename from compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/util/Url.kt
rename to compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/util/Url.kt
index e4dcb9f..fad3e2e 100644
--- a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/util/Url.kt
+++ b/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/library/util/Url.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package androidx.compose.material.catalog.util
+package androidx.compose.material.catalog.library.util
import android.content.Context
import android.content.Intent
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/res/values/donottranslate-strings.xml b/compose/material/material/integration-tests/material-catalog/src/main/res/values/donottranslate-strings.xml
index d87c304..81de162 100644
--- a/compose/material/material/integration-tests/material-catalog/src/main/res/values/donottranslate-strings.xml
+++ b/compose/material/material/integration-tests/material-catalog/src/main/res/values/donottranslate-strings.xml
@@ -18,7 +18,6 @@
<resources>
<string name="compose_material">Compose Material</string>
- <string name="compose_material_catalog">Compose Material Catalog</string>
<string name="description">Description</string>
<string name="examples">Examples</string>
diff --git a/compose/material/material/samples/build.gradle b/compose/material/material/samples/build.gradle
index 51de440..e5d0925 100644
--- a/compose/material/material/samples/build.gradle
+++ b/compose/material/material/samples/build.gradle
@@ -42,9 +42,9 @@
}
androidx {
- name = "AndroidX Compose UI Material Design Components Samples"
+ name = "AndroidX Compose Material Components Samples"
type = LibraryType.SAMPLES
mavenGroup = LibraryGroups.Compose.MATERIAL
inceptionYear = "2019"
- description = "Contains the sample code for the Androidx Compose UI Material Design Components"
+ description = "Contains the sample code for the AndroidX Compose Material components."
}
diff --git a/compose/material3/material3/integration-tests/material3-catalog/OWNERS b/compose/material3/material3/integration-tests/material3-catalog/OWNERS
new file mode 100644
index 0000000..5c55131
--- /dev/null
+++ b/compose/material3/material3/integration-tests/material3-catalog/OWNERS
@@ -0,0 +1 @@
[email protected]
diff --git a/compose/material3/material3/integration-tests/material3-catalog/build.gradle b/compose/material3/material3/integration-tests/material3-catalog/build.gradle
new file mode 100644
index 0000000..b2e7e22
--- /dev/null
+++ b/compose/material3/material3/integration-tests/material3-catalog/build.gradle
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import androidx.build.Publish
+
+plugins {
+ id("AndroidXPlugin")
+ id("com.android.library")
+ id("AndroidXComposePlugin")
+ id("org.jetbrains.kotlin.android")
+}
+
+dependencies {
+ kotlinPlugin project(":compose:compiler:compiler")
+ implementation(libs.kotlinStdlib)
+ implementation project(":core:core")
+ implementation project(":compose:runtime:runtime")
+ implementation project(":compose:ui:ui")
+ implementation project(":compose:material:material")
+ implementation project(":compose:material3:material3")
+ implementation project(":compose:material3:material3:material3-samples")
+ implementation project(":navigation:navigation-compose")
+ implementation "com.google.accompanist:accompanist-insets:0.18.0"
+}
+
+androidx {
+ name = "Compose Material3 Catalog"
+ publish = Publish.NONE
+ inceptionYear = "2021"
+ description = "This is a project for the Compose Material You Catalog."
+}
diff --git a/compose/material3/material3/integration-tests/material3-catalog/src/main/AndroidManifest.xml b/compose/material3/material3/integration-tests/material3-catalog/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..44b4ff8
--- /dev/null
+++ b/compose/material3/material3/integration-tests/material3-catalog/src/main/AndroidManifest.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ ~ Copyright (C) 2021 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+
+<manifest package="androidx.compose.material3.catalog.library" />
diff --git a/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/CatalogApp.kt b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/CatalogApp.kt
new file mode 100644
index 0000000..3703e65
--- /dev/null
+++ b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/CatalogApp.kt
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.material3.catalog.library
+
+import androidx.compose.material3.catalog.library.model.Theme
+import androidx.compose.material3.catalog.library.model.ThemeSaver
+import androidx.compose.material3.catalog.library.ui.theme.CatalogTheme
+import androidx.compose.runtime.Composable
+import androidx.compose.runtime.getValue
+import androidx.compose.runtime.mutableStateOf
+import androidx.compose.runtime.saveable.rememberSaveable
+import androidx.compose.runtime.setValue
+
+@Composable
+fun Material3CatalogApp() {
+ var theme by rememberSaveable(stateSaver = ThemeSaver) { mutableStateOf(Theme()) }
+ CatalogTheme(theme = theme) {
+ NavGraph(
+ theme = theme,
+ onThemeChange = { theme = it }
+ )
+ }
+}
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/NavGraph.kt b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/NavGraph.kt
similarity index 79%
rename from compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/NavGraph.kt
rename to compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/NavGraph.kt
index 5c41cda..4ee4ac02 100644
--- a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/NavGraph.kt
+++ b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/NavGraph.kt
@@ -14,15 +14,14 @@
* limitations under the License.
*/
-package androidx.compose.material.catalog
+package androidx.compose.material3.catalog.library
-import androidx.compose.material.catalog.model.Components
-import androidx.compose.material.catalog.model.Theme
-import androidx.compose.material.catalog.ui.component.Component
-import androidx.compose.material.catalog.ui.example.Example
-import androidx.compose.material.catalog.ui.home.Home
+import androidx.compose.material3.catalog.library.model.Components
+import androidx.compose.material3.catalog.library.model.Theme
+import androidx.compose.material3.catalog.library.ui.component.Component
+import androidx.compose.material3.catalog.library.ui.example.Example
+import androidx.compose.material3.catalog.library.ui.home.Home
import androidx.compose.runtime.Composable
-import androidx.compose.runtime.rememberUpdatedState
import androidx.navigation.NavType
import androidx.navigation.compose.NavHost
import androidx.navigation.compose.composable
@@ -34,10 +33,6 @@
theme: Theme,
onThemeChange: (theme: Theme) -> Unit
) {
- // Using rememberUpdatedState as hoisted state is not correctly propagated to NavHost
- // https://issuetracker.google.com/issues/177338143
- val navTheme = rememberUpdatedState(theme)
- val navOnThemeChange = rememberUpdatedState(onThemeChange)
val navController = rememberNavController()
NavHost(
navController = navController,
@@ -46,8 +41,8 @@
composable(HomeRoute) {
Home(
components = Components,
- theme = navTheme.value,
- onThemeChange = navOnThemeChange.value,
+ theme = theme,
+ onThemeChange = onThemeChange,
onComponentClick = { component ->
val componentId = component.id
val route = "$ComponentRoute/$componentId"
@@ -67,8 +62,8 @@
val component = Components.first { component -> component.id == componentId }
Component(
component = component,
- theme = navTheme.value,
- onThemeChange = navOnThemeChange.value,
+ theme = theme,
+ onThemeChange = onThemeChange,
onExampleClick = { example ->
val exampleIndex = component.examples.indexOf(example)
val route = "$ExampleRoute/$componentId/$exampleIndex"
@@ -94,14 +89,15 @@
Example(
component = component,
example = example,
- theme = navTheme.value,
- onThemeChange = navOnThemeChange.value,
+ theme = theme,
+ onThemeChange = onThemeChange,
onBackClick = { navController.popBackStack() }
)
}
}
}
+const val Material3Route = "material3"
private const val HomeRoute = "home"
private const val ComponentRoute = "component"
private const val ExampleRoute = "example"
diff --git a/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/model/Components.kt b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/model/Components.kt
new file mode 100644
index 0000000..f4f2a2c
--- /dev/null
+++ b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/model/Components.kt
@@ -0,0 +1,50 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.material3.catalog.library.model
+
+import androidx.annotation.DrawableRes
+import androidx.compose.material3.catalog.library.R
+import androidx.compose.material3.catalog.library.util.Material3SourceUrl
+
+data class Component(
+ val id: Int,
+ val name: String,
+ val description: String,
+ @DrawableRes
+ val icon: Int = R.drawable.ic_component,
+ val tintIcon: Boolean = false,
+ val guidelinesUrl: String,
+ val docsUrl: String,
+ val sourceUrl: String,
+ val examples: List<Example>
+)
+
+private val Color = Component(
+ id = 1,
+ name = "Color",
+ description = "Material You colors",
+ // No color icon
+ tintIcon = true,
+ guidelinesUrl = "", // No guidelines yet
+ docsUrl = "", // No docs yet
+ sourceUrl = "$Material3SourceUrl/ColorScheme.kt",
+ examples = ColorExamples
+)
+
+val Components = listOf(
+ Color
+)
diff --git a/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/model/Examples.kt b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/model/Examples.kt
new file mode 100644
index 0000000..a8dbda4
--- /dev/null
+++ b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/model/Examples.kt
@@ -0,0 +1,41 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+@file:Suppress("COMPOSABLE_FUNCTION_REFERENCE")
+
+package androidx.compose.material3.catalog.library.model
+
+import androidx.compose.material3.catalog.library.util.SampleSourceUrl
+import androidx.compose.material3.samples.ColorSchemeSample
+import androidx.compose.runtime.Composable
+
+data class Example(
+ val name: String,
+ val description: String,
+ val sourceUrl: String,
+ val content: @Composable () -> Unit
+)
+
+private const val ColorExampleDescription = "Color examples"
+private const val ColorExampleSourceUrl = "$SampleSourceUrl/ColorSamples.kt"
+val ColorExamples =
+ listOf(
+ Example(
+ name = ::ColorSchemeSample.name,
+ description = ColorExampleDescription,
+ sourceUrl = ColorExampleSourceUrl,
+ ) { ColorSchemeSample() },
+ )
diff --git a/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/model/Themes.kt b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/model/Themes.kt
new file mode 100644
index 0000000..710fb0d
--- /dev/null
+++ b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/model/Themes.kt
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.material3.catalog.library.model
+
+import androidx.compose.runtime.saveable.Saver
+
+data class Theme(
+ val themeMode: ThemeMode = ThemeMode.System,
+ val colorMode: ColorMode = ColorMode.SampleDynamic,
+ val fontScale: Float = 1.0f,
+ val textDirection: TextDirection = TextDirection.System,
+)
+
+/**
+ * A class for defining layout directions.
+ *
+ * A layout direction can be left-to-right (LTR) or right-to-left (RTL).
+ */
+enum class TextDirection {
+ System,
+
+ /** Horizontal layout direction is from Left to Right. */
+ Ltr,
+
+ /** Horizontal layout direction is from Right to Left. */
+ Rtl,
+}
+
+/**
+ * Determines what color scheme should be used when viewing the catalog in the Google Material 3
+ * theme.
+ */
+enum class ColorMode {
+ /**
+ * The baseline light/dark colors schemes.
+ *
+ * This is the default behavior, and the fallback if dynamic colors are not available on the
+ * current device.
+ */
+ Baseline,
+ /**
+ * Build a color scheme from a pre-selected color palette that behaves the same as a dynamic color
+ * palette.
+ *
+ * Useful for testing dynamic color schemes on devices that don't support dynamic colors.
+ */
+ SampleDynamic,
+ /**
+ * Build a color scheme from the dynamic colors taken from the Android System.
+ *
+ * If the dynamic colors are not available, the baseline color scheme will be used as a fallback.
+ */
+ TrueDynamic,
+}
+
+enum class ThemeMode {
+ System,
+ Light,
+ Dark,
+}
+
+val ThemeSaver =
+ Saver<Theme, Map<String, Int>>(
+ save = { theme ->
+ mapOf(
+ ThemeModeKey to theme.themeMode.ordinal,
+ ColorModeKey to theme.colorMode.ordinal,
+ FontScaleKey to theme.fontScale.toInt(),
+ TextDirectionKey to theme.textDirection.ordinal,
+ )
+ },
+ restore = { map ->
+ Theme(
+ themeMode = ThemeMode.values()[map.getValue(ThemeModeKey)],
+ colorMode = ColorMode.values()[map.getValue(ColorModeKey)],
+ fontScale = map.getValue(FontScaleKey).toFloat(),
+ textDirection = TextDirection.values()[map.getValue(TextDirectionKey)],
+ )
+ }
+ )
+
+private const val ThemeModeKey = "themeMode"
+private const val ColorModeKey = "colorMode"
+private const val FontScaleKey = "fontScale"
+private const val TextDirectionKey = "textDirection"
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/common/Border.kt b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/common/Border.kt
similarity index 97%
rename from compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/common/Border.kt
rename to compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/common/Border.kt
index 9d0fc08..85c458c 100644
--- a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/common/Border.kt
+++ b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/common/Border.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package androidx.compose.material.catalog.ui.common
+package androidx.compose.material3.catalog.library.ui.common
import androidx.compose.material.LocalContentColor
import androidx.compose.material.MaterialTheme
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/common/CatalogScaffold.kt b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/common/CatalogScaffold.kt
similarity index 81%
copy from compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/common/CatalogScaffold.kt
copy to compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/common/CatalogScaffold.kt
index 74ef95d..6fb21f85 100644
--- a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/common/CatalogScaffold.kt
+++ b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/common/CatalogScaffold.kt
@@ -14,30 +14,31 @@
* limitations under the License.
*/
-package androidx.compose.material.catalog.ui.common
+package androidx.compose.material3.catalog.library.ui.common
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.material.ExperimentalMaterialApi
import androidx.compose.material.ModalBottomSheetLayout
import androidx.compose.material.ModalBottomSheetValue
import androidx.compose.material.Scaffold
-import androidx.compose.material.catalog.model.Theme
-import androidx.compose.material.catalog.ui.theme.ThemePicker
-import androidx.compose.material.catalog.util.GuidelinesUrl
-import androidx.compose.material.catalog.util.IssueUrl
-import androidx.compose.material.catalog.util.LicensesUrl
-import androidx.compose.material.catalog.util.PrivacyUrl
-import androidx.compose.material.catalog.util.ReleasesUrl
-import androidx.compose.material.catalog.util.SourceUrl
-import androidx.compose.material.catalog.util.TermsUrl
-import androidx.compose.material.catalog.util.openUrl
import androidx.compose.material.rememberModalBottomSheetState
+import androidx.compose.material3.catalog.library.model.Theme
+import androidx.compose.material3.catalog.library.ui.theme.ThemePicker
+import androidx.compose.material3.catalog.library.util.GuidelinesUrl
+import androidx.compose.material3.catalog.library.util.IssueUrl
+import androidx.compose.material3.catalog.library.util.LicensesUrl
+import androidx.compose.material3.catalog.library.util.PrivacyUrl
+import androidx.compose.material3.catalog.library.util.ReleasesUrl
+import androidx.compose.material3.catalog.library.util.SourceUrl
+import androidx.compose.material3.catalog.library.util.TermsUrl
+import androidx.compose.material3.catalog.library.util.openUrl
import androidx.compose.runtime.Composable
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalContext
import kotlinx.coroutines.launch
+// TODO: Use components/values from Material3 when available
@OptIn(ExperimentalMaterialApi::class)
@Composable
fun CatalogScaffold(
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/common/CatalogTopAppBar.kt b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/common/CatalogTopAppBar.kt
similarity index 95%
copy from compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/common/CatalogTopAppBar.kt
copy to compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/common/CatalogTopAppBar.kt
index 0de1657..7d8413a 100644
--- a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/common/CatalogTopAppBar.kt
+++ b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/common/CatalogTopAppBar.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package androidx.compose.material.catalog.ui.common
+package androidx.compose.material3.catalog.library.ui.common
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.Row
@@ -28,13 +28,11 @@
import androidx.compose.material.Surface
import androidx.compose.material.Text
import androidx.compose.material.TopAppBar
-import androidx.compose.material.catalog.R
-import androidx.compose.material.catalog.insets.navigationBarsPadding
-import androidx.compose.material.catalog.insets.statusBarsPadding
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.ArrowBack
import androidx.compose.material.icons.filled.MoreVert
import androidx.compose.material.primarySurface
+import androidx.compose.material3.catalog.library.R
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
@@ -46,7 +44,10 @@
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.style.TextOverflow
import androidx.compose.ui.unit.dp
+import com.google.accompanist.insets.navigationBarsPadding
+import com.google.accompanist.insets.statusBarsPadding
+// TODO: Use components/values from Material3 when available
@Composable
fun CatalogTopAppBar(
title: String,
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/component/Component.kt b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/component/Component.kt
similarity index 85%
copy from compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/component/Component.kt
copy to compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/component/Component.kt
index 2fa2009..f372e0e 100644
--- a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/component/Component.kt
+++ b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/component/Component.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package androidx.compose.material.catalog.ui.component
+package androidx.compose.material3.catalog.library.ui.component
import androidx.compose.foundation.Image
import androidx.compose.foundation.layout.Box
@@ -29,14 +29,12 @@
import androidx.compose.material.LocalContentColor
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
-import androidx.compose.material.catalog.R
-import androidx.compose.material.catalog.insets.LocalWindowInsets
-import androidx.compose.material.catalog.insets.toPaddingValues
-import androidx.compose.material.catalog.model.Component
-import androidx.compose.material.catalog.model.Example
-import androidx.compose.material.catalog.model.Theme
-import androidx.compose.material.catalog.ui.common.CatalogScaffold
-import androidx.compose.material.catalog.ui.example.ExampleItem
+import androidx.compose.material3.catalog.library.R
+import androidx.compose.material3.catalog.library.model.Component
+import androidx.compose.material3.catalog.library.model.Example
+import androidx.compose.material3.catalog.library.model.Theme
+import androidx.compose.material3.catalog.library.ui.common.CatalogScaffold
+import androidx.compose.material3.catalog.library.ui.example.ExampleItem
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@@ -44,7 +42,10 @@
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
+import com.google.accompanist.insets.LocalWindowInsets
+import com.google.accompanist.insets.rememberInsetsPaddingValues
+// TODO: Use components/values from Material3 when available
@Composable
fun Component(
component: Component,
@@ -67,7 +68,9 @@
modifier = Modifier
.padding(paddingValues)
.padding(horizontal = ComponentPadding),
- contentPadding = LocalWindowInsets.current.navigationBars.toPaddingValues()
+ contentPadding = rememberInsetsPaddingValues(
+ insets = LocalWindowInsets.current.navigationBars
+ )
) {
item {
Box(
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/component/ComponentItem.kt b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/component/ComponentItem.kt
similarity index 88%
copy from compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/component/ComponentItem.kt
copy to compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/component/ComponentItem.kt
index 2eca34c..2303f42 100644
--- a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/component/ComponentItem.kt
+++ b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/component/ComponentItem.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package androidx.compose.material.catalog.ui.component
+package androidx.compose.material3.catalog.library.ui.component
import androidx.compose.foundation.Image
import androidx.compose.foundation.clickable
@@ -26,9 +26,9 @@
import androidx.compose.material.LocalContentColor
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
-import androidx.compose.material.catalog.model.Component
-import androidx.compose.material.catalog.ui.common.compositeBorderColor
-import androidx.compose.material.catalog.ui.common.gridItemBorder
+import androidx.compose.material3.catalog.library.model.Component
+import androidx.compose.material3.catalog.library.ui.common.compositeBorderColor
+import androidx.compose.material3.catalog.library.ui.common.gridItemBorder
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
@@ -37,6 +37,7 @@
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.unit.dp
+// TODO: Use components/values from Material3 when available
@Composable
fun ComponentItem(
component: Component,
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/example/Example.kt b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/example/Example.kt
similarity index 78%
copy from compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/example/Example.kt
copy to compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/example/Example.kt
index d5e1172..eebfb0f 100644
--- a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/example/Example.kt
+++ b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/example/Example.kt
@@ -14,20 +14,21 @@
* limitations under the License.
*/
-package androidx.compose.material.catalog.ui.example
+package androidx.compose.material3.catalog.library.ui.example
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.fillMaxSize
import androidx.compose.foundation.layout.padding
-import androidx.compose.material.catalog.insets.navigationBarsPadding
-import androidx.compose.material.catalog.model.Component
-import androidx.compose.material.catalog.model.Example
-import androidx.compose.material.catalog.model.Theme
-import androidx.compose.material.catalog.ui.common.CatalogScaffold
+import androidx.compose.material3.catalog.library.model.Component
+import androidx.compose.material3.catalog.library.model.Example
+import androidx.compose.material3.catalog.library.model.Theme
+import androidx.compose.material3.catalog.library.ui.common.CatalogScaffold
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
+import com.google.accompanist.insets.navigationBarsPadding
+// TODO: Use components/values from Material3 when available
@Composable
fun Example(
component: Component,
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/example/ExampleItem.kt b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/example/ExampleItem.kt
similarity index 89%
copy from compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/example/ExampleItem.kt
copy to compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/example/ExampleItem.kt
index 874afa1..05b8b19 100644
--- a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/example/ExampleItem.kt
+++ b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/example/ExampleItem.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package androidx.compose.material.catalog.ui.example
+package androidx.compose.material3.catalog.library.ui.example
import androidx.compose.foundation.BorderStroke
import androidx.compose.foundation.clickable
@@ -31,17 +31,18 @@
import androidx.compose.material.LocalContentAlpha
import androidx.compose.material.MaterialTheme
import androidx.compose.material.Text
-import androidx.compose.material.catalog.model.Example
-import androidx.compose.material.catalog.ui.common.BorderWidth
-import androidx.compose.material.catalog.ui.common.compositeBorderColor
import androidx.compose.material.icons.Icons
import androidx.compose.material.icons.filled.KeyboardArrowRight
+import androidx.compose.material3.catalog.library.model.Example
+import androidx.compose.material3.catalog.library.ui.common.BorderWidth
+import androidx.compose.material3.catalog.library.ui.common.compositeBorderColor
import androidx.compose.runtime.Composable
import androidx.compose.runtime.CompositionLocalProvider
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
+// TODO: Use components/values from Material3 when available
@Composable
fun ExampleItem(
example: Example,
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/home/Home.kt b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/home/Home.kt
similarity index 76%
copy from compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/home/Home.kt
copy to compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/home/Home.kt
index 5671c94..080d976 100644
--- a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/ui/home/Home.kt
+++ b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/home/Home.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package androidx.compose.material.catalog.ui.home
+package androidx.compose.material3.catalog.library.ui.home
import androidx.compose.foundation.ExperimentalFoundationApi
import androidx.compose.foundation.layout.BoxWithConstraints
@@ -22,18 +22,19 @@
import androidx.compose.foundation.lazy.GridCells
import androidx.compose.foundation.lazy.LazyVerticalGrid
import androidx.compose.foundation.lazy.itemsIndexed
-import androidx.compose.material.catalog.R
-import androidx.compose.material.catalog.insets.LocalWindowInsets
-import androidx.compose.material.catalog.insets.toPaddingValues
-import androidx.compose.material.catalog.model.Component
-import androidx.compose.material.catalog.model.Theme
-import androidx.compose.material.catalog.ui.common.CatalogScaffold
-import androidx.compose.material.catalog.ui.component.ComponentItem
+import androidx.compose.material3.catalog.library.R
+import androidx.compose.material3.catalog.library.model.Component
+import androidx.compose.material3.catalog.library.model.Theme
+import androidx.compose.material3.catalog.library.ui.common.CatalogScaffold
+import androidx.compose.material3.catalog.library.ui.component.ComponentItem
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
+import com.google.accompanist.insets.LocalWindowInsets
+import com.google.accompanist.insets.rememberInsetsPaddingValues
+// TODO: Use components/values from Material3 when available
@Composable
@OptIn(ExperimentalFoundationApi::class)
fun Home(
@@ -43,7 +44,7 @@
onComponentClick: (component: Component) -> Unit
) {
CatalogScaffold(
- topBarTitle = stringResource(id = R.string.compose_material),
+ topBarTitle = stringResource(id = R.string.compose_material_you),
theme = theme,
onThemeChange = onThemeChange
) { paddingValues ->
@@ -63,7 +64,9 @@
)
}
},
- contentPadding = LocalWindowInsets.current.navigationBars.toPaddingValues()
+ contentPadding = rememberInsetsPaddingValues(
+ insets = LocalWindowInsets.current.navigationBars
+ )
)
}
}
diff --git a/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/theme/Theme.kt b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/theme/Theme.kt
new file mode 100644
index 0000000..b10b1e1
--- /dev/null
+++ b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/theme/Theme.kt
@@ -0,0 +1,31 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.material3.catalog.library.ui.theme
+
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.catalog.library.model.Theme
+import androidx.compose.runtime.Composable
+
+// TODO: Use components/values from Material3 when available
+@Composable
+@Suppress("UNUSED_PARAMETER")
+fun CatalogTheme(
+ theme: Theme,
+ content: @Composable () -> Unit
+) {
+ MaterialTheme(content = content)
+}
diff --git a/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/theme/ThemePicker.kt b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/theme/ThemePicker.kt
new file mode 100644
index 0000000..f0fd19c
--- /dev/null
+++ b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/ui/theme/ThemePicker.kt
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.material3.catalog.library.ui.theme
+
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.lazy.LazyColumn
+import androidx.compose.material.Text
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.material3.catalog.library.R
+import androidx.compose.material3.catalog.library.model.Theme
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.unit.dp
+import com.google.accompanist.insets.LocalWindowInsets
+import com.google.accompanist.insets.rememberInsetsPaddingValues
+
+// TODO: Use components/values from Material3 when available
+@Composable
+@Suppress("UNUSED_PARAMETER")
+fun ThemePicker(
+ theme: Theme,
+ onThemeChange: (theme: Theme) -> Unit
+) {
+ LazyColumn(
+ contentPadding = rememberInsetsPaddingValues(
+ insets = LocalWindowInsets.current.navigationBars,
+ additionalTop = ThemePickerPadding,
+ additionalBottom = ThemePickerPadding
+ )
+ ) {
+ item {
+ Text(
+ text = stringResource(id = R.string.theming_options),
+ style = MaterialTheme.typography.bodyLarge,
+ modifier = Modifier.padding(horizontal = ThemePickerPadding)
+ )
+ Spacer(modifier = Modifier.height(ThemePickerPadding))
+ }
+ // TODO: Use values from Material3 theme model when available
+ item {
+ Text(
+ text = "Work in progress",
+ style = MaterialTheme.typography.bodyMedium,
+ modifier = Modifier.padding(horizontal = ThemePickerPadding)
+ )
+ Spacer(modifier = Modifier.height(ThemePickerPadding))
+ }
+ }
+}
+
+private val ThemePickerPadding = 16.dp
diff --git a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/util/Url.kt b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/util/Url.kt
similarity index 71%
copy from compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/util/Url.kt
copy to compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/util/Url.kt
index e4dcb9f..e5f729e 100644
--- a/compose/material/material/integration-tests/material-catalog/src/main/java/androidx/compose/material/catalog/util/Url.kt
+++ b/compose/material3/material3/integration-tests/material3-catalog/src/main/java/androidx/compose/material3/catalog/library/util/Url.kt
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-package androidx.compose.material.catalog.util
+package androidx.compose.material3.catalog.library.util
import android.content.Context
import android.content.Intent
@@ -26,18 +26,16 @@
}
const val GuidelinesUrl = "https://material.io"
-const val ComponentGuidelinesUrl = "https://material.io/components"
const val ReleasesUrl = "https://developer.android.com/jetpack/androidx/releases/compose-material"
-const val DocsUrl = "https://developer.android.com/reference/kotlin/androidx/compose/" +
- "material/package-summary"
const val SourceUrl = "https://cs.android.com/androidx/platform/frameworks/support/+/" +
- "androidx-main:compose/material"
-const val MaterialSourceUrl = "https://cs.android.com/androidx/platform/frameworks/support/+/" +
- "androidx-main:compose/material/" +
- "material/src/commonMain/kotlin/androidx/compose/material"
+ "androidx-main:compose/material3"
+const val Material3SourceUrl = "https://cs.android.com/androidx/platform/frameworks/support/+/" +
+ "androidx-main:compose/material3/" +
+ "material3/src/commonMain/kotlin/androidx/compose/material3"
const val SampleSourceUrl = "https://cs.android.com/androidx/platform/frameworks/support/+/" +
- "androidx-main:compose/material/" +
- "material/samples/src/main/java/androidx/compose/material/samples"
+ "androidx-main:compose/material3/" +
+ "material3/samples/src/main/java/androidx/compose/material3/samples"
+// TODO: Update issue URL for Material3 component when available
const val IssueUrl = "https://issuetracker.google.com/issues/new?component=742043"
const val TermsUrl = "https://policies.google.com/terms"
const val PrivacyUrl = "https://policies.google.com/privacy"
diff --git a/compose/material3/material3/integration-tests/material3-catalog/src/main/res/drawable/ic_component.xml b/compose/material3/material3/integration-tests/material3-catalog/src/main/res/drawable/ic_component.xml
new file mode 100644
index 0000000..84894df
--- /dev/null
+++ b/compose/material3/material3/integration-tests/material3-catalog/src/main/res/drawable/ic_component.xml
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2021 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="52dp"
+ android:height="53dp"
+ android:viewportWidth="52"
+ android:viewportHeight="53">
+ <!-- Long path to avoid Icon stroke line join bevel bug -->
+ <!-- https://issuetracker.google.com/issues/182794035 -->
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M32,0L32.0002,16.0599C32.4949,16.0202 32.9951,16 33.5,16C43.7173,16
+ 52,24.2827 52,34.5C52,44.7173 43.7173,53 33.5,53C23.2827,53 15,44.7173 15,34.5C15,33.6522
+ 15.057,32.8178 15.1675,32.0002L0,32L0,0L32,0ZM33.5,18.5C32.9944,18.5 32.4944,18.5234
+ 32.0008,18.5693L32,32L17.6941,32.0004C17.5663,32.8149 17.5,33.6497 17.5,34.5C17.5,43.3366
+ 24.6634,50.5 33.5,50.5C42.3366,50.5 49.5,43.3366 49.5,34.5C49.5,25.6634 42.3366,18.5
+ 33.5,18.5ZM29.5002,2.5L2.5,2.5L2.5,29.5L15.6835,29.5003C17.5115,22.9726 22.8306,17.9035
+ 29.5002,16.4335L29.5002,2.5ZM18.2968,29.5L29.5,29.5L29.5007,19.0039C24.2157,20.3639
+ 19.9874,24.3562 18.2968,29.5Z" />
+</vector>
diff --git a/compose/material3/material3/integration-tests/material3-catalog/src/main/res/drawable/ic_palette_24dp.xml b/compose/material3/material3/integration-tests/material3-catalog/src/main/res/drawable/ic_palette_24dp.xml
new file mode 100644
index 0000000..b9e640b
--- /dev/null
+++ b/compose/material3/material3/integration-tests/material3-catalog/src/main/res/drawable/ic_palette_24dp.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2021 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:width="24dp"
+ android:height="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24">
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M12,22C6.49,22 2,17.51 2,12S6.49,2 12,2s10,4.04 10,9c0,3.31 -2.69,6
+ -6,6h-1.77c-0.28,0 -0.5,0.22 -0.5,0.5 0,0.12 0.05,0.23 0.13,0.33 0.41,0.47 0.64,1.06
+ 0.64,1.67 0,1.38 -1.12,2.5 -2.5,2.5zM12,4c-4.41,0 -8,3.59 -8,8s3.59,8 8,8c0.28,0 0.5,-0.22
+ 0.5,-0.5 0,-0.16 -0.08,-0.28 -0.14,-0.35 -0.41,-0.46 -0.63,-1.05 -0.63,-1.65 0,-1.38
+ 1.12,-2.5 2.5,-2.5L16,15c2.21,0 4,-1.79 4,-4 0,-3.86 -3.59,-7 -8,-7z" />
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M6.5,11.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0" />
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M9.5,7.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0" />
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M14.5,7.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0" />
+ <path
+ android:fillColor="#FF000000"
+ android:pathData="M17.5,11.5m-1.5,0a1.5,1.5 0,1 1,3 0a1.5,1.5 0,1 1,-3 0" />
+</vector>
diff --git a/compose/material3/material3/integration-tests/material3-catalog/src/main/res/values/donottranslate-strings.xml b/compose/material3/material3/integration-tests/material3-catalog/src/main/res/values/donottranslate-strings.xml
new file mode 100644
index 0000000..8a20a1b
--- /dev/null
+++ b/compose/material3/material3/integration-tests/material3-catalog/src/main/res/values/donottranslate-strings.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2021 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<resources>
+
+ <string name="compose_material_you">Compose Material You</string>
+
+ <string name="description">Description</string>
+ <string name="examples">Examples</string>
+ <string name="no_examples">No examples</string>
+
+ <string name="theming_options">Theming options</string>
+
+ <string name="view_design_guidelines">View design guidelines</string>
+ <string name="view_developer_docs">View developer docs</string>
+ <string name="view_source_code">View source code</string>
+ <string name="report_an_issue">Report an issue</string>
+ <string name="terms_of_service">Terms of service</string>
+ <string name="privacy_policy">Privacy policy</string>
+ <string name="open_source_licenses">Open source licenses</string>
+
+</resources>
diff --git a/compose/material3/material3/samples/build.gradle b/compose/material3/material3/samples/build.gradle
new file mode 100644
index 0000000..58db433
--- /dev/null
+++ b/compose/material3/material3/samples/build.gradle
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2019 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+import androidx.build.LibraryGroups
+import androidx.build.LibraryType
+
+plugins {
+ id("AndroidXPlugin")
+ id("com.android.library")
+ id("AndroidXComposePlugin")
+ id("org.jetbrains.kotlin.android")
+}
+
+dependencies {
+ kotlinPlugin(project(":compose:compiler:compiler"))
+
+ implementation(libs.kotlinStdlib)
+
+ compileOnly(project(":annotation:annotation-sampled"))
+
+ implementation("androidx.compose.animation:animation:1.0.0")
+ implementation("androidx.compose.foundation:foundation:1.0.0")
+ implementation("androidx.compose.foundation:foundation-layout:1.0.0")
+ implementation(project(":compose:material:material"))
+ implementation(project(":compose:material3:material3"))
+ implementation(project(":compose:runtime:runtime"))
+ implementation("androidx.compose.ui:ui:1.0.0")
+ implementation("androidx.compose.ui:ui-text:1.0.0")
+}
+
+androidx {
+ name = "AndroidX Compose Material3 Components Samples"
+ type = LibraryType.SAMPLES
+ mavenGroup = LibraryGroups.Compose.MATERIAL3
+ inceptionYear = "2021"
+ description = "Contains the sample code for the AndroidX Compose Material You components."
+}
diff --git a/compose/material3/material3/samples/src/main/AndroidManifest.xml b/compose/material3/material3/samples/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..ed44259
--- /dev/null
+++ b/compose/material3/material3/samples/src/main/AndroidManifest.xml
@@ -0,0 +1,17 @@
+<!--
+ ~ Copyright (C) 2019 The Android Open Source Project
+ ~
+ ~ Licensed under the Apache License, Version 2.0 (the "License");
+ ~ you may not use this file except in compliance with the License.
+ ~ You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License
+ -->
+
+<manifest package="androidx.compose.material3.samples" />
diff --git a/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/ColorSamples.kt b/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/ColorSamples.kt
new file mode 100644
index 0000000..7c69291
--- /dev/null
+++ b/compose/material3/material3/samples/src/main/java/androidx/compose/material3/samples/ColorSamples.kt
@@ -0,0 +1,243 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.compose.material3.samples
+
+import androidx.compose.foundation.BorderStroke
+import androidx.compose.foundation.layout.Box
+import androidx.compose.foundation.layout.Column
+import androidx.compose.foundation.layout.Row
+import androidx.compose.foundation.layout.Spacer
+import androidx.compose.foundation.layout.fillMaxWidth
+import androidx.compose.foundation.layout.height
+import androidx.compose.foundation.layout.padding
+import androidx.compose.foundation.layout.width
+import androidx.compose.foundation.rememberScrollState
+import androidx.compose.foundation.verticalScroll
+import androidx.compose.material.Surface
+import androidx.compose.material.Text
+import androidx.compose.material3.MaterialTheme
+import androidx.compose.runtime.Composable
+import androidx.compose.ui.Modifier
+import androidx.compose.ui.graphics.Color
+import androidx.compose.ui.graphics.luminance
+import androidx.compose.ui.unit.dp
+
+@Composable
+fun ColorSchemeSample() {
+ val colorScheme = MaterialTheme.colorScheme
+ Row(
+ modifier = Modifier.padding(8.dp),
+ ) {
+ Column(Modifier.weight(1f).verticalScroll(rememberScrollState())) {
+ Text("Surfaces", style = MaterialTheme.typography.bodyLarge)
+ ColorTile(
+ text = "On Background",
+ color = colorScheme.onBackground,
+ )
+ ColorTile(
+ text = "Background",
+ color = colorScheme.background,
+ )
+ Spacer(modifier = Modifier.height(16.dp))
+ DoubleTile(
+ leftTile = {
+ ColorTile(
+ text = "On Surface",
+ color = colorScheme.onSurface,
+ )
+ },
+ rightTile = {
+ ColorTile(
+ text = "On Surface Variant",
+ color = colorScheme.onSurfaceVariant,
+ )
+ },
+ )
+ ColorTile(text = "Surface 0", color = colorScheme.surface)
+ ColorTile(text = "Surface 1", color = colorScheme.surface1)
+ ColorTile(text = "Surface 2", color = colorScheme.surface2)
+ ColorTile(text = "Surface 3", color = colorScheme.surface3)
+ ColorTile(text = "Surface 4", color = colorScheme.surface4)
+ ColorTile(text = "Surface 5", color = colorScheme.surface5)
+ Spacer(modifier = Modifier.height(16.dp))
+ DoubleTile(
+ leftTile = {
+ ColorTile(
+ text = "Inverse Primary",
+ color = colorScheme.inversePrimary,
+ )
+ },
+ rightTile = {
+ ColorTile(
+ text = "Inverse On Surface",
+ color = colorScheme.inverseOnSurface,
+ )
+ },
+ )
+ DoubleTile(
+ leftTile = {
+ ColorTile(
+ text = "Surface Variant",
+ color = colorScheme.surfaceVariant,
+ )
+ },
+ rightTile = {
+ ColorTile(
+ text = "Inverse Surface",
+ color = colorScheme.inverseSurface,
+ )
+ },
+ )
+ }
+ Spacer(modifier = Modifier.width(24.dp))
+ Column(Modifier.weight(1f).verticalScroll(rememberScrollState())) {
+ Text("Content", style = MaterialTheme.typography.bodyLarge)
+ DoubleTile(
+ leftTile = {
+ ColorTile(
+ text = "On Primary Container",
+ color = colorScheme.onPrimaryContainer,
+ )
+ },
+ rightTile = {
+ ColorTile(
+ text = "On Primary",
+ color = colorScheme.onPrimary,
+ )
+ },
+ )
+ DoubleTile(
+ leftTile = {
+ ColorTile(
+ text = "Primary Container",
+ color = colorScheme.primaryContainer,
+ )
+ },
+ rightTile = {
+ ColorTile(
+ text = "Primary",
+ color = colorScheme.primary,
+ )
+ },
+ )
+ Spacer(modifier = Modifier.height(16.dp))
+ DoubleTile(
+ leftTile = {
+ ColorTile(
+ text = "On Secondary Container",
+ color = colorScheme.onSecondaryContainer,
+ )
+ },
+ rightTile = {
+ ColorTile(
+ text = "On Secondary",
+ color = colorScheme.onSecondary,
+ )
+ },
+ )
+ DoubleTile(
+ leftTile = {
+ ColorTile(
+ text = "Secondary Container",
+ color = colorScheme.secondaryContainer,
+ )
+ },
+ rightTile = {
+ ColorTile(
+ text = "Secondary",
+ color = colorScheme.secondary,
+ )
+ },
+ )
+ Spacer(modifier = Modifier.height(16.dp))
+ DoubleTile(
+ leftTile = {
+ ColorTile(
+ text = "On Tertiary Container",
+ color = colorScheme.onTertiaryContainer,
+ )
+ },
+ rightTile = { Box(Modifier.fillMaxWidth()) },
+ )
+ DoubleTile(
+ leftTile = {
+ ColorTile(
+ text = "Tertiary Container",
+ color = colorScheme.tertiaryContainer,
+ )
+ },
+ rightTile = { Box(Modifier.fillMaxWidth()) },
+ )
+ Spacer(modifier = Modifier.height(16.dp))
+ Text("Utility", style = MaterialTheme.typography.bodyLarge)
+ DoubleTile(
+ leftTile = {
+ ColorTile(
+ text = "On Error",
+ color = colorScheme.onError,
+ )
+ },
+ rightTile = {
+ ColorTile(
+ text = "Outline",
+ color = colorScheme.outline,
+ )
+ }
+ )
+ DoubleTile(
+ leftTile = {
+ ColorTile(
+ text = "Error",
+ color = colorScheme.error,
+ )
+ },
+ rightTile = { Box(Modifier.fillMaxWidth()) },
+ )
+ }
+ }
+}
+
+@Composable
+private fun DoubleTile(leftTile: @Composable () -> Unit, rightTile: @Composable () -> Unit) {
+ Row(modifier = Modifier.fillMaxWidth()) {
+ Box(modifier = Modifier.weight(1f)) { leftTile() }
+ Box(modifier = Modifier.weight(1f)) { rightTile() }
+ }
+}
+
+@Composable
+private fun ColorTile(text: String, color: Color) {
+ var borderColor = Color.Transparent
+ if (color == Color.Black) {
+ borderColor = Color.White
+ } else if (color == Color.White) borderColor = Color.Black
+
+ Surface(
+ modifier = Modifier.height(48.dp).fillMaxWidth(),
+ color = color,
+ border = BorderStroke(1.dp, borderColor),
+ ) {
+ Text(
+ text,
+ Modifier.padding(4.dp),
+ style =
+ MaterialTheme.typography.bodyMedium.copy(
+ if (color.luminance() < .25) Color.White else Color.Black
+ )
+ )
+ }
+}
diff --git a/compose/ui/ui-test/lint-baseline.xml b/compose/ui/ui-test/lint-baseline.xml
index 249b7e8..bb13e19 100644
--- a/compose/ui/ui-test/lint-baseline.xml
+++ b/compose/ui/ui-test/lint-baseline.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<issues format="6" by="lint 7.1.0-dev" type="baseline" client="gradle" dependencies="false" name="AGP (7.1.0-dev)" variant="all" version="7.1.0-dev">
+<issues format="6" by="lint 7.2.0-dev" type="baseline" client="gradle" dependencies="false" name="AGP (7.2.0-dev)" variant="all" version="7.2.0-dev">
<issue
id="VisibleForTests"
@@ -52,18 +52,29 @@
errorLine2=" ~~~~">
<location
file="src/androidMain/kotlin/androidx/compose/ui/test/AndroidInputDispatcher.android.kt"
- line="40"
+ line="48"
column="21"/>
</issue>
<issue
id="VisibleForTests"
message="This method should only be accessed from tests or within private scope"
+ errorLine1=" it.view.getLocationOnScreen(array)"
+ errorLine2=" ~~~~">
+ <location
+ file="src/androidMain/kotlin/androidx/compose/ui/test/AndroidInputDispatcher.android.kt"
+ line="183"
+ column="20"/>
+ </issue>
+
+ <issue
+ id="VisibleForTests"
+ message="This method should only be accessed from tests or within private scope"
errorLine1=" root.view.getLocationOnScreen(array)"
errorLine2=" ~~~~">
<location
file="src/androidMain/kotlin/androidx/compose/ui/test/AndroidInputDispatcher.android.kt"
- line="120"
+ line="254"
column="22"/>
</issue>
diff --git a/compose/ui/ui/lint-baseline.xml b/compose/ui/ui/lint-baseline.xml
index e85b753..8406726 100644
--- a/compose/ui/ui/lint-baseline.xml
+++ b/compose/ui/ui/lint-baseline.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<issues format="6" by="lint 7.1.0-alpha02" type="baseline" client="cli" name="Lint" variant="all" version="7.1.0-alpha02">
+<issues format="6" by="lint 7.1.0-dev" type="baseline" client="gradle" dependencies="false" name="AGP (7.1.0-dev)" variant="all" version="7.1.0-dev">
<issue
id="NewApi"
@@ -25,6 +25,17 @@
<issue
id="NewApi"
+ message="Call requires API level 29 (current min is 21): `setCameraDistance`"
+ errorLine1=" this.cameraDistance = cameraDistance"
+ errorLine2=" ~~~~~~~~~~~~~~">
+ <location
+ file="src/androidAndroidTest/kotlin/androidx/compose/ui/AndroidLayoutDrawTest.kt"
+ line="225"
+ column="18"/>
+ </issue>
+
+ <issue
+ id="NewApi"
message="Call requires API level 29 (current min is 21): `dumpRenderNodeData`"
errorLine1=" }.dumpRenderNodeData().cameraDistance == cameraDistance"
errorLine2=" ~~~~~~~~~~~~~~~~~~">
@@ -47,6 +58,17 @@
<issue
id="NewApi"
+ message="Call requires API level 23 (current min is 21): `setCameraDistance`"
+ errorLine1=" this.cameraDistance = cameraDistance"
+ errorLine2=" ~~~~~~~~~~~~~~">
+ <location
+ file="src/androidAndroidTest/kotlin/androidx/compose/ui/AndroidLayoutDrawTest.kt"
+ line="232"
+ column="18"/>
+ </issue>
+
+ <issue
+ id="NewApi"
message="Call requires API level 23 (current min is 21): `dumpRenderNodeData`"
errorLine1=" }.dumpRenderNodeData().cameraDistance == -cameraDistance // Camera distance is negative"
errorLine2=" ~~~~~~~~~~~~~~~~~~">
@@ -63,7 +85,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~">
<location
file="src/androidAndroidTest/kotlin/androidx/compose/ui/AndroidLayoutDrawTest.kt"
- line="3707"
+ line="3758"
column="18"/>
</issue>
@@ -223,6 +245,17 @@
<issue
id="NewApi"
+ message="Call requires API level 26 (current min is 21): `setAutofillType`"
+ errorLine1=" setAutofillType(View.AUTOFILL_TYPE_TEXT)"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/test/kotlin/androidx/compose/ui/autofill/AndroidPopulateViewStructureTest.kt"
+ line="87"
+ column="41"/>
+ </issue>
+
+ <issue
+ id="NewApi"
message="Call requires API level 26 (current min is 21): `setAutofillHints`"
errorLine1=" setAutofillHints(arrayOf(AUTOFILL_HINT_PERSON_NAME))"
errorLine2=" ~~~~~~~~~~~~~~~~">
@@ -234,6 +267,17 @@
<issue
id="NewApi"
+ message="Call requires API level 26 (current min is 21): `setAutofillHints`"
+ errorLine1=" setAutofillHints(arrayOf(AUTOFILL_HINT_PERSON_NAME))"
+ errorLine2=" ~~~~~~~">
+ <location
+ file="src/test/kotlin/androidx/compose/ui/autofill/AndroidPopulateViewStructureTest.kt"
+ line="88"
+ column="42"/>
+ </issue>
+
+ <issue
+ id="NewApi"
message="Call requires API level 26 (current min is 21): `setDimens`"
errorLine1=" setDimens(0, 0, 0, 0, 0, 0)"
errorLine2=" ~~~~~~~~~">
@@ -300,6 +344,17 @@
<issue
id="NewApi"
+ message="Call requires API level 26 (current min is 21): `setAutofillType`"
+ errorLine1=" setAutofillType(View.AUTOFILL_TYPE_TEXT)"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/test/kotlin/androidx/compose/ui/autofill/AndroidPopulateViewStructureTest.kt"
+ line="124"
+ column="41"/>
+ </issue>
+
+ <issue
+ id="NewApi"
message="Call requires API level 26 (current min is 21): `setAutofillHints`"
errorLine1=" setAutofillHints(arrayOf(AUTOFILL_HINT_PERSON_NAME))"
errorLine2=" ~~~~~~~~~~~~~~~~">
@@ -311,6 +366,17 @@
<issue
id="NewApi"
+ message="Call requires API level 26 (current min is 21): `setAutofillHints`"
+ errorLine1=" setAutofillHints(arrayOf(AUTOFILL_HINT_PERSON_NAME))"
+ errorLine2=" ~~~~~~~">
+ <location
+ file="src/test/kotlin/androidx/compose/ui/autofill/AndroidPopulateViewStructureTest.kt"
+ line="125"
+ column="42"/>
+ </issue>
+
+ <issue
+ id="NewApi"
message="Call requires API level 26 (current min is 21): `setDimens`"
errorLine1=" setDimens(0, 0, 0, 0, 0, 0)"
errorLine2=" ~~~~~~~~~">
@@ -344,6 +410,17 @@
<issue
id="NewApi"
+ message="Call requires API level 26 (current min is 21): `setAutofillType`"
+ errorLine1=" setAutofillType(View.AUTOFILL_TYPE_TEXT)"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/test/kotlin/androidx/compose/ui/autofill/AndroidPopulateViewStructureTest.kt"
+ line="133"
+ column="41"/>
+ </issue>
+
+ <issue
+ id="NewApi"
message="Call requires API level 26 (current min is 21): `setAutofillHints`"
errorLine1=" setAutofillHints(arrayOf(View.AUTOFILL_HINT_EMAIL_ADDRESS))"
errorLine2=" ~~~~~~~~~~~~~~~~">
@@ -355,6 +432,17 @@
<issue
id="NewApi"
+ message="Call requires API level 26 (current min is 21): `setAutofillHints`"
+ errorLine1=" setAutofillHints(arrayOf(View.AUTOFILL_HINT_EMAIL_ADDRESS))"
+ errorLine2=" ~~~~~~~">
+ <location
+ file="src/test/kotlin/androidx/compose/ui/autofill/AndroidPopulateViewStructureTest.kt"
+ line="134"
+ column="42"/>
+ </issue>
+
+ <issue
+ id="NewApi"
message="Call requires API level 26 (current min is 21): `setDimens`"
errorLine1=" setDimens(0, 0, 0, 0, 0, 0)"
errorLine2=" ~~~~~~~~~">
@@ -492,7 +580,7 @@
errorLine2=" ~~~~~~~~~~~~~~">
<location
file="src/androidAndroidTest/kotlin/androidx/compose/ui/draw/DrawModifierTest.kt"
- line="638"
+ line="632"
column="54"/>
</issue>
@@ -514,7 +602,7 @@
errorLine2=" ~~~~~~~~~~~~~~">
<location
file="src/androidAndroidTest/kotlin/androidx/compose/ui/draw/PainterModifierTest.kt"
- line="720"
+ line="755"
column="27"/>
</issue>
@@ -536,7 +624,7 @@
errorLine2=" ~~~~~~~~~~~~~~">
<location
file="src/androidAndroidTest/kotlin/androidx/compose/ui/graphics/vector/VectorTest.kt"
- line="481"
+ line="590"
column="36"/>
</issue>
diff --git a/core/core-appdigest/lint-baseline.xml b/core/core-appdigest/lint-baseline.xml
index 425cdb0..0ca1950 100644
--- a/core/core-appdigest/lint-baseline.xml
+++ b/core/core-appdigest/lint-baseline.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<issues format="6" by="lint 7.1.0-alpha03" type="baseline" client="gradle" name="AGP (7.1.0-alpha03)" variant="all" version="7.1.0-alpha03">
+<issues format="6" by="lint 7.2.0-dev" type="baseline" client="gradle" dependencies="false" name="AGP (7.2.0-dev)" variant="all" version="7.2.0-dev">
<issue
id="NewApi"
@@ -8,7 +8,7 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/androidTest/java/androidx/core/appdigest/ChecksumsTest.java"
- line="621"
+ line="1032"
column="31"/>
</issue>
@@ -19,216 +19,63 @@
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/androidTest/java/androidx/core/appdigest/ChecksumsTest.java"
- line="637"
- column="35"/>
- </issue>
-
- <issue
- id="WrongConstant"
- message="Must be one or more of: Checksum.TYPE_WHOLE_MERKLE_ROOT_4K_SHA256, Checksum.TYPE_WHOLE_MD5, Checksum.TYPE_WHOLE_SHA1, Checksum.TYPE_WHOLE_SHA256, Checksum.TYPE_WHOLE_SHA512, Checksum.TYPE_PARTIAL_MERKLE_ROOT_1M_SHA256, Checksum.TYPE_PARTIAL_MERKLE_ROOT_1M_SHA512"
- errorLine1=" apkChecksum.getType(), apkChecksum.getValue(),"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/main/java/androidx/core/appdigest/Checksums.java"
- line="204"
- column="45"/>
- </issue>
- <issue
- id="NewApi"
- message="Field requires API level S (current min is 14): `android.content.pm.PackageManager#TRUST_ALL`"
- errorLine1=" trustedInstallers = PackageManager.TRUST_ALL;"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/main/java/androidx/core/appdigest/Checksums.java"
- line="180"
- column="37"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Field requires API level S (current min is 14): `android.content.pm.PackageManager#TRUST_NONE`"
- errorLine1=" trustedInstallers = PackageManager.TRUST_NONE;"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/main/java/androidx/core/appdigest/Checksums.java"
- line="182"
- column="37"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level S (current min is 14): `android.content.pm.PackageManager#requestChecksums`"
- errorLine1=" context.getPackageManager().requestChecksums(packageName, includeSplits, required,"
- errorLine2=" ~~~~~~~~~~~~~~~~">
- <location
- file="src/main/java/androidx/core/appdigest/Checksums.java"
- line="189"
- column="41"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Cast to `OnChecksumsReadyListener` requires API level 31 (current min is 14)"
- errorLine1=" trustedInstallers, new PackageManager.OnChecksumsReadyListener() {"
- errorLine2=" ^">
- <location
- file="src/main/java/androidx/core/appdigest/Checksums.java"
- line="190"
- column="40"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Class requires API level S (current min is 14): `android.content.pm.PackageManager.OnChecksumsReadyListener`"
- errorLine1=" trustedInstallers, new PackageManager.OnChecksumsReadyListener() {"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/main/java/androidx/core/appdigest/Checksums.java"
- line="190"
- column="44"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level S (current min is 14): `android.content.pm.ApkChecksum#getSplitName`"
- errorLine1=" checksums[i] = new Checksum(apkChecksum.getSplitName(),"
- errorLine2=" ~~~~~~~~~~~~">
- <location
- file="src/main/java/androidx/core/appdigest/Checksums.java"
- line="203"
- column="77"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level S (current min is 14): `android.content.pm.ApkChecksum#getType`"
- errorLine1=" apkChecksum.getType(), apkChecksum.getValue(),"
- errorLine2=" ~~~~~~~">
- <location
- file="src/main/java/androidx/core/appdigest/Checksums.java"
- line="204"
- column="57"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level S (current min is 14): `android.content.pm.ApkChecksum#getValue`"
- errorLine1=" apkChecksum.getType(), apkChecksum.getValue(),"
- errorLine2=" ~~~~~~~~">
- <location
- file="src/main/java/androidx/core/appdigest/Checksums.java"
- line="204"
- column="80"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level S (current min is 14): `android.content.pm.ApkChecksum#getInstallerPackageName`"
- errorLine1=" apkChecksum.getInstallerPackageName(),"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/main/java/androidx/core/appdigest/Checksums.java"
- line="205"
- column="57"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level S (current min is 14): `android.content.pm.ApkChecksum#getInstallerCertificate`"
- errorLine1=" apkChecksum.getInstallerCertificate());"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/main/java/androidx/core/appdigest/Checksums.java"
- line="206"
- column="57"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 29 (current min is 24): `android.app.UiAutomation#adoptShellPermissionIdentity`"
- errorLine1=" getUiAutomation().adoptShellPermissionIdentity(Manifest.permission.INSTALL_PACKAGES);"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/core/appdigest/ChecksumsTest.java"
- line="621"
- column="31"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 29 (current min is 24): `android.app.UiAutomation#dropShellPermissionIdentity`"
- errorLine1=" getUiAutomation().dropShellPermissionIdentity();"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/core/appdigest/ChecksumsTest.java"
- line="637"
+ line="1048"
column="35"/>
</issue>
<issue
id="ClassVerificationFailure"
- message="This call references a method added in API level 31; however, the containing class androidx.core.appdigest.Checksums.ApiSImpl is reachable from earlier API levels and will fail run-time class verification."
- errorLine1=" context.getPackageManager().requestChecksums(packageName, includeSplits, required,"
- errorLine2=" ~~~~~~~~~~~~~~~~">
+ message="This call references a method added in API level 31; however, the containing class null is reachable from earlier API levels and will fail run-time class verification."
+ errorLine1=" checksums[i] = new Checksum(apkChecksum.getSplitName(),"
+ errorLine2=" ~~~~~~~~~~~~">
<location
- file="src/main/java/androidx/core/appdigest/Checksums.java"
- line="189"
- column="41"/>
+ file="src/main/java/androidx/core/appdigest/ChecksumsApiSImpl.java"
+ line="121"
+ column="73"/>
</issue>
<issue
id="ClassVerificationFailure"
message="This call references a method added in API level 31; however, the containing class null is reachable from earlier API levels and will fail run-time class verification."
- errorLine1=" checksums[i] = new Checksum(apkChecksum.getSplitName(),"
- errorLine2=" ~~~~~~~~~~~~">
+ errorLine1=" apkChecksum.getType(), apkChecksum.getValue(),"
+ errorLine2=" ~~~~~~~">
<location
- file="src/main/java/androidx/core/appdigest/Checksums.java"
- line="203"
- column="77"/>
+ file="src/main/java/androidx/core/appdigest/ChecksumsApiSImpl.java"
+ line="122"
+ column="53"/>
</issue>
<issue
id="ClassVerificationFailure"
message="This call references a method added in API level 31; however, the containing class null is reachable from earlier API levels and will fail run-time class verification."
- errorLine1=" apkChecksum.getType(), apkChecksum.getValue(),"
- errorLine2=" ~~~~~~~">
+ errorLine1=" apkChecksum.getType(), apkChecksum.getValue(),"
+ errorLine2=" ~~~~~~~~">
<location
- file="src/main/java/androidx/core/appdigest/Checksums.java"
- line="204"
- column="57"/>
+ file="src/main/java/androidx/core/appdigest/ChecksumsApiSImpl.java"
+ line="122"
+ column="76"/>
</issue>
<issue
id="ClassVerificationFailure"
message="This call references a method added in API level 31; however, the containing class null is reachable from earlier API levels and will fail run-time class verification."
- errorLine1=" apkChecksum.getType(), apkChecksum.getValue(),"
- errorLine2=" ~~~~~~~~">
+ errorLine1=" apkChecksum.getInstallerPackageName(),"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~">
<location
- file="src/main/java/androidx/core/appdigest/Checksums.java"
- line="204"
- column="80"/>
+ file="src/main/java/androidx/core/appdigest/ChecksumsApiSImpl.java"
+ line="123"
+ column="53"/>
</issue>
<issue
id="ClassVerificationFailure"
message="This call references a method added in API level 31; however, the containing class null is reachable from earlier API levels and will fail run-time class verification."
- errorLine1=" apkChecksum.getInstallerPackageName(),"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~">
+ errorLine1=" apkChecksum.getInstallerCertificate());"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~">
<location
- file="src/main/java/androidx/core/appdigest/Checksums.java"
- line="205"
- column="57"/>
- </issue>
-
- <issue
- id="ClassVerificationFailure"
- message="This call references a method added in API level 31; however, the containing class null is reachable from earlier API levels and will fail run-time class verification."
- errorLine1=" apkChecksum.getInstallerCertificate());"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/main/java/androidx/core/appdigest/Checksums.java"
- line="206"
- column="57"/>
+ file="src/main/java/androidx/core/appdigest/ChecksumsApiSImpl.java"
+ line="124"
+ column="53"/>
</issue>
</issues>
diff --git a/core/core-splashscreen/api/res-current.txt b/core/core-splashscreen/api/res-current.txt
index f751c82..6227062 100644
--- a/core/core-splashscreen/api/res-current.txt
+++ b/core/core-splashscreen/api/res-current.txt
@@ -2,4 +2,6 @@
attr windowSplashScreenAnimatedIcon
attr windowSplashScreenAnimationDuration
attr windowSplashScreenBackground
+dimen splashscreen_icon_size
style Theme_SplashScreen
+style Theme_SplashScreen_IconBackground
diff --git a/core/core-splashscreen/build.gradle b/core/core-splashscreen/build.gradle
index d70c8a7b..d4aeb10 100644
--- a/core/core-splashscreen/build.gradle
+++ b/core/core-splashscreen/build.gradle
@@ -36,13 +36,13 @@
implementation("androidx.annotation:annotation:1.2.0")
- androidTestImplementation(project(":test:screenshot:screenshot"))
androidTestImplementation(libs.testExtJunit)
androidTestImplementation(libs.testRunner)
androidTestImplementation(libs.testRules)
androidTestImplementation(libs.testUiautomator)
androidTestImplementation(libs.truth)
androidTestImplementation(project(":appcompat:appcompat"))
+ androidTestImplementation(project(":test:screenshot:screenshot"))
}
androidx {
diff --git a/core/core-splashscreen/samples/src/main/AndroidManifest.xml b/core/core-splashscreen/samples/src/main/AndroidManifest.xml
index 935b220..d3d7463 100644
--- a/core/core-splashscreen/samples/src/main/AndroidManifest.xml
+++ b/core/core-splashscreen/samples/src/main/AndroidManifest.xml
@@ -20,6 +20,7 @@
android:icon="@drawable/ic_launcher"
android:theme="@style/Theme.App.Starting"
android:label="@string/app_name">
+
<activity android:name=".SplashScreenSampleActivity"
android:exported="true">
<intent-filter>
diff --git a/core/core-splashscreen/samples/src/main/res/drawable-v26/ic_launcher.xml b/core/core-splashscreen/samples/src/main/res/drawable-v26/ic_launcher.xml
index d4d3966..0738dc1 100644
--- a/core/core-splashscreen/samples/src/main/res/drawable-v26/ic_launcher.xml
+++ b/core/core-splashscreen/samples/src/main/res/drawable-v26/ic_launcher.xml
@@ -16,5 +16,5 @@
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/logo_background" />
- <foreground android:drawable="@drawable/foreground" />
+ <foreground android:drawable="@drawable/android" />
</adaptive-icon>
\ No newline at end of file
diff --git a/core/core-splashscreen/samples/src/main/res/drawable-v31/splashscreen_icon.xml b/core/core-splashscreen/samples/src/main/res/drawable-v31/splashscreen_icon.xml
index f37aee7..d52d941 100644
--- a/core/core-splashscreen/samples/src/main/res/drawable-v31/splashscreen_icon.xml
+++ b/core/core-splashscreen/samples/src/main/res/drawable-v31/splashscreen_icon.xml
@@ -20,12 +20,36 @@
<vector
android:width="108dp"
android:height="108dp"
- android:viewportHeight="1200"
- android:viewportWidth="1200">
+ android:viewportHeight="800"
+ android:viewportWidth="800">
+ <!-- DEBUG GROUP (Uncomment to check if the icon fits within the bounds)
<group
- android:translateX="200"
- android:translateY="200">
+ android:scaleY="0.6667"
+ android:scaleX="0.6667"
+ android:translateX="133"
+ android:translateY="133">
+ <path
+ android:fillColor="#0000FF"
+ android:pathData="m 0 0, 0 800, 800 0, 0 -800" />
+ <path
+ android:fillColor="#00FF00"
+ android:pathData="
+ M 0, 400
+ a 400, 400 0 1,0 800, 0
+ a 400, 400 0 1,0 -800, 0" />
+ </group>
+ END DEBUG GROUP -->
+
+ <!--
+ Scale down the icon and translate if to fit
+ within the inner 2/3 (scale <= 0.67) or the viewport.
+ -->
+ <group
+ android:translateX="160"
+ android:translateY="130"
+ android:scaleX="0.60"
+ android:scaleY="0.60">
<clip-path android:pathData="m596.328,310.906c22.484,-39.699 46.513,-78.699 68.084,-118.812 4.258,-14.364 -17.654,-23.707 -25.102,-10.703 -22.603,38.973 -45.139,77.986 -67.716,116.974 -107.224,-48.772 -235.192,-48.772 -342.415,0 -23.491,-39.715 -45.567,-80.447 -69.895,-119.56 -10.384,-10.813 -29.373,3.556 -21.753,16.461 22.277,38.562 44.614,77.091 66.914,115.64C88.641,372.042 9.442,494.721 0,625c266.667,0 533.333,0 800,0C790.261,494.557 711.967,372.81 596.328,310.906ZM216.039,511.17c-24.214,1.092 -41.724,-28.29 -29.21,-49.016 10.591,-21.768 44.808,-23.114 57.082,-2.246 14.575,21.206 -2.056,51.902 -27.872,51.263zM584.348,511.17c-24.214,1.092 -41.724,-28.29 -29.21,-49.016 10.591,-21.768 44.808,-23.114 57.082,-2.246 14.575,21.206 -2.055,51.902 -27.872,51.263z" />
<path
android:fillColor="#3ddc84"
diff --git a/core/core-splashscreen/samples/src/main/res/drawable/android.xml b/core/core-splashscreen/samples/src/main/res/drawable/android.xml
index a0207f8..6c557e1 100644
--- a/core/core-splashscreen/samples/src/main/res/drawable/android.xml
+++ b/core/core-splashscreen/samples/src/main/res/drawable/android.xml
@@ -15,12 +15,21 @@
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="72dp"
- android:height="72dp"
- android:viewportHeight="800"
- android:viewportWidth="800">
- <path
- android:fillColor="#3ddc84"
- android:pathData="m596.328,310.906c22.484,-39.699 46.513,-78.699 68.084,-118.812 4.258,-14.364 -17.654,-23.707 -25.102,-10.703 -22.603,38.973 -45.139,77.986 -67.716,116.974 -107.224,-48.772 -235.192,-48.772 -342.415,0 -23.491,-39.715 -45.567,-80.447 -69.895,-119.56 -10.384,-10.813 -29.373,3.556 -21.753,16.461 22.277,38.562 44.614,77.091 66.914,115.64C88.641,372.042 9.442,494.721 -0,625c266.667,0 533.333,0 800,0C790.261,494.557 711.967,372.81 596.328,310.906ZM216.039,511.17c-24.214,1.092 -41.724,-28.29 -29.21,-49.016 10.591,-21.768 44.808,-23.114 57.082,-2.246 14.575,21.206 -2.056,51.902 -27.872,51.263zM584.348,511.17c-24.214,1.092 -41.724,-28.29 -29.21,-49.016 10.591,-21.768 44.808,-23.114 57.082,-2.246 14.575,21.206 -2.055,51.902 -27.872,51.263z"
- android:strokeWidth="1.93078" />
+ android:width="160dp"
+ android:height="160dp"
+ android:viewportHeight="432"
+ android:viewportWidth="432">
+
+ <!-- Safe zone = 66dp => 432 * (66 / 108) = 432 * 0.61 -->
+ <group
+ android:translateX="84"
+ android:translateY="84"
+ android:scaleX="0.61"
+ android:scaleY="0.61">
+
+ <path
+ android:fillColor="#3ddc84"
+ android:pathData="m322.02,167.89c12.141,-21.437 25.117,-42.497 36.765,-64.158 2.2993,-7.7566 -9.5332,-12.802 -13.555,-5.7796 -12.206,21.045 -24.375,42.112 -36.567,63.166 -57.901,-26.337 -127.00,-26.337 -184.90,0.0 -12.685,-21.446 -24.606,-43.441 -37.743,-64.562 -5.6074,-5.8390 -15.861,1.9202 -11.747,8.8889 12.030,20.823 24.092,41.629 36.134,62.446C47.866,200.90 5.0987,267.15 0.0,337.5c144.00,0.0 288.00,0.0 432.0,0.0C426.74,267.06 384.46,201.32 322.02,167.89ZM116.66,276.03c-13.076,0.58968 -22.531,-15.277 -15.773,-26.469 5.7191,-11.755 24.196,-12.482 30.824,-1.2128 7.8705,11.451 -1.1102,28.027 -15.051,27.682zM315.55,276.03c-13.076,0.58968 -22.531,-15.277 -15.773,-26.469 5.7191,-11.755 24.196,-12.482 30.824,-1.2128 7.8705,11.451 -1.1097,28.027 -15.051,27.682z"
+ android:strokeWidth="2" />
+ </group>
</vector>
\ No newline at end of file
diff --git a/core/core-splashscreen/samples/src/main/res/drawable/ic_launcher.xml b/core/core-splashscreen/samples/src/main/res/drawable/ic_launcher.xml
index 59296dc..0bccb83 100644
--- a/core/core-splashscreen/samples/src/main/res/drawable/ic_launcher.xml
+++ b/core/core-splashscreen/samples/src/main/res/drawable/ic_launcher.xml
@@ -16,5 +16,5 @@
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/logo_background" />
- <item android:drawable="@drawable/foreground" />
+ <item android:drawable="@drawable/android" />
</layer-list>
\ No newline at end of file
diff --git a/core/core-splashscreen/samples/src/main/res/drawable/splashscreen_icon.xml b/core/core-splashscreen/samples/src/main/res/drawable/splashscreen_icon.xml
deleted file mode 100644
index a8c4e96..0000000
--- a/core/core-splashscreen/samples/src/main/res/drawable/splashscreen_icon.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<!--
- Copyright 2021 The Android Open Source Project
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="108dp"
- android:height="108dp"
- android:viewportHeight="800"
- android:viewportWidth="800">
-
- <path
- android:fillColor="#3ddc84"
- android:pathData="m596.328,310.906c22.484,-39.699 46.513,-78.699 68.084,-118.812 4.258,-14.364 -17.654,-23.707 -25.102,-10.703 -22.603,38.973 -45.139,77.986 -67.716,116.974 -107.224,-48.772 -235.192,-48.772 -342.415,0 -23.491,-39.715 -45.567,-80.447 -69.895,-119.56 -10.384,-10.813 -29.373,3.556 -21.753,16.461 22.277,38.562 44.614,77.091 66.914,115.64C88.641,372.042 9.442,494.721 -0,625c266.667,0 533.333,0 800,0C790.261,494.557 711.967,372.81 596.328,310.906ZM216.039,511.17c-24.214,1.092 -41.724,-28.29 -29.21,-49.016 10.591,-21.768 44.808,-23.114 57.082,-2.246 14.575,21.206 -2.056,51.902 -27.872,51.263zM584.348,511.17c-24.214,1.092 -41.724,-28.29 -29.21,-49.016 10.591,-21.768 44.808,-23.114 57.082,-2.246 14.575,21.206 -2.055,51.902 -27.872,51.263z"
- android:strokeWidth="2" />
-
-</vector>
-
diff --git a/core/core-splashscreen/samples/src/main/res/drawable/foreground.xml b/core/core-splashscreen/samples/src/main/res/values/aliases.xml
similarity index 81%
rename from core/core-splashscreen/samples/src/main/res/drawable/foreground.xml
rename to core/core-splashscreen/samples/src/main/res/values/aliases.xml
index c46194a..d3e0bdd 100644
--- a/core/core-splashscreen/samples/src/main/res/drawable/foreground.xml
+++ b/core/core-splashscreen/samples/src/main/res/values/aliases.xml
@@ -14,7 +14,6 @@
limitations under the License.
-->
-<inset xmlns:android="http://schemas.android.com/apk/res/android"
- android:drawable="@drawable/android"
- android:inset="25%">
-</inset>
\ No newline at end of file
+<resources>
+ <drawable name="splashscreen_icon">@drawable/android</drawable>
+</resources>
\ No newline at end of file
diff --git a/core/core-splashscreen/samples/src/main/res/values/colors.xml b/core/core-splashscreen/samples/src/main/res/values/colors.xml
index da0c8fc..27c80d69 100644
--- a/core/core-splashscreen/samples/src/main/res/values/colors.xml
+++ b/core/core-splashscreen/samples/src/main/res/values/colors.xml
@@ -19,4 +19,5 @@
<color name="logo_background">#3C3C3C</color>
<color name="windowBackground">#CFCFCF</color>
<color name="splashScreenBackground">#474747</color>
+ <color name="splashscreen_icon_background">#BEC7B8</color>
</resources>
\ No newline at end of file
diff --git a/core/core-splashscreen/samples/src/main/res/values/styles.xml b/core/core-splashscreen/samples/src/main/res/values/styles.xml
index fafcea9..06982bf 100644
--- a/core/core-splashscreen/samples/src/main/res/values/styles.xml
+++ b/core/core-splashscreen/samples/src/main/res/values/styles.xml
@@ -23,10 +23,11 @@
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
</style>
- <style name="Theme.App.Starting" parent="Theme.SplashScreen">
+ <style name="Theme.App.Starting" parent="Theme.SplashScreen.IconBackground">
<item name="windowSplashScreenBackground">@color/splashScreenBackground</item>
<item name="windowSplashScreenAnimatedIcon">@drawable/splashscreen_icon</item>
<item name="windowSplashScreenAnimationDuration">2000</item>
+ <item name="windowSplashScreenIconBackgroundColor">@color/splashscreen_icon_background</item>
<item name="postSplashScreenTheme">@style/Theme.App</item>
</style>
</resources>
\ No newline at end of file
diff --git a/core/core-splashscreen/src/androidTest/AndroidManifest.xml b/core/core-splashscreen/src/androidTest/AndroidManifest.xml
index 0253fc4..e1fabc9 100644
--- a/core/core-splashscreen/src/androidTest/AndroidManifest.xml
+++ b/core/core-splashscreen/src/androidTest/AndroidManifest.xml
@@ -31,10 +31,13 @@
android:name=".SplashScreenAppCompatTestActivity"
android:exported="true"
android:theme="@style/Theme.Test.Starting.AppCompat">
- <intent-filter>
- <category android:name="android.intent.category.LAUNCHER" />
- <action android:name="android.intent.action.MAIN" />
- </intent-filter>
</activity>
+
+ <activity
+ android:name=".SplashScreenWithIconBgTestActivity"
+ android:exported="true"
+ android:theme="@style/Theme.Test.Starting.IconBackground">
+ </activity>
+
</application>
</manifest>
diff --git a/core/core-splashscreen/src/androidTest/java/androidx/core/splashscreen/test/SplashScreenTestActivities.kt b/core/core-splashscreen/src/androidTest/java/androidx/core/splashscreen/test/SplashScreenTestActivities.kt
index b46d910..adf7e72 100644
--- a/core/core-splashscreen/src/androidTest/java/androidx/core/splashscreen/test/SplashScreenTestActivities.kt
+++ b/core/core-splashscreen/src/androidTest/java/androidx/core/splashscreen/test/SplashScreenTestActivities.kt
@@ -19,7 +19,7 @@
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
-public class SplashScreenTestActivity : Activity(), SplashScreenTestControllerHolder {
+open class SplashScreenTestActivity : Activity(), SplashScreenTestControllerHolder {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
@@ -30,7 +30,9 @@
override lateinit var controller: SplashScreenTestController
}
-public class SplashScreenAppCompatTestActivity :
+class SplashScreenWithIconBgTestActivity : SplashScreenTestActivity()
+
+class SplashScreenAppCompatTestActivity :
AppCompatActivity(), SplashScreenTestControllerHolder {
override fun onCreate(savedInstanceState: Bundle?) {
diff --git a/core/core-splashscreen/src/androidTest/java/androidx/core/splashscreen/test/SplashScreenTestController.kt b/core/core-splashscreen/src/androidTest/java/androidx/core/splashscreen/test/SplashScreenTestController.kt
index 453da24..071fb7f 100644
--- a/core/core-splashscreen/src/androidTest/java/androidx/core/splashscreen/test/SplashScreenTestController.kt
+++ b/core/core-splashscreen/src/androidTest/java/androidx/core/splashscreen/test/SplashScreenTestController.kt
@@ -18,13 +18,15 @@
import android.app.Activity
import android.graphics.Bitmap
+import android.graphics.drawable.Drawable
import android.util.TypedValue
+import android.view.View
import androidx.appcompat.app.AppCompatActivity
import androidx.core.splashscreen.SplashScreen.Companion.installSplashScreen
-import androidx.core.splashscreen.R as SR
import androidx.test.runner.screenshot.Screenshot
import java.util.concurrent.CountDownLatch
import java.util.concurrent.atomic.AtomicBoolean
+import androidx.core.splashscreen.R as SR
internal const val EXTRA_ANIMATION_LISTENER = "AnimationListener"
internal const val EXTRA_SPLASHSCREEN_WAIT = "splashscreen_wait"
@@ -40,9 +42,13 @@
public var splashScreenScreenshot: Bitmap? = null
public var splashscreenIconId: Int = 0
public var splashscreenBackgroundId: Int = 0
+ public var splashscreenIconBackgroundId: Int = 0
public var finalAppTheme: Int = 0
public var duration: Int = 0
public var exitAnimationListenerLatch: CountDownLatch = CountDownLatch(1)
+ public var splashScreenView: View? = null
+ public var splashScreenIconView: View? = null
+ public var splashScreenIconViewBackground: Drawable? = null
public var drawnLatch: CountDownLatch = CountDownLatch(1)
public val isCompatActivity: Boolean
get() = activity is AppCompatActivity
@@ -68,6 +74,9 @@
theme.resolveAttribute(SR.attr.windowSplashScreenBackground, tv, true)
splashscreenBackgroundId = tv.resourceId
+ theme.resolveAttribute(SR.attr.windowSplashScreenIconBackgroundColor, tv, true)
+ splashscreenIconBackgroundId = tv.resourceId
+
theme.resolveAttribute(SR.attr.postSplashScreenTheme, tv, true)
finalAppTheme = tv.resourceId
@@ -90,11 +99,22 @@
if (useListener) {
splashScreen.setOnExitAnimationListener { splashScreenViewProvider ->
+ splashScreenView = splashScreenViewProvider.view
+ splashScreenIconView = splashScreenViewProvider.iconView
+ splashScreenIconViewBackground = splashScreenViewProvider.iconView.background
if (takeScreenShot) {
- splashScreenViewScreenShot = Screenshot.capture().bitmap
+ splashScreenViewProvider.view.postDelayed(
+ {
+ splashScreenViewScreenShot = Screenshot.capture().bitmap
+ splashScreenViewProvider.remove()
+ exitAnimationListenerLatch.countDown()
+ },
+ 100
+ )
+ } else {
+ splashScreenViewProvider.remove()
+ exitAnimationListenerLatch.countDown()
}
- exitAnimationListenerLatch.countDown()
- splashScreenViewProvider.remove()
}
}
diff --git a/core/core-splashscreen/src/androidTest/java/androidx/core/splashscreen/test/SplashScreenTestUtils.kt b/core/core-splashscreen/src/androidTest/java/androidx/core/splashscreen/test/SplashScreenTestUtils.kt
new file mode 100644
index 0000000..4d9d38d
--- /dev/null
+++ b/core/core-splashscreen/src/androidTest/java/androidx/core/splashscreen/test/SplashScreenTestUtils.kt
@@ -0,0 +1,102 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.core.splashscreen.test
+
+import android.app.Instrumentation
+import android.content.ComponentName
+import android.content.Context
+import android.content.Intent
+import android.os.Bundle
+import androidx.test.core.app.ApplicationProvider
+import androidx.test.platform.app.InstrumentationRegistry
+import androidx.test.uiautomator.By
+import androidx.test.uiautomator.UiDevice
+import androidx.test.uiautomator.Until
+import org.hamcrest.core.IsNull
+import org.junit.Assert
+import kotlin.reflect.KClass
+
+private const val SPLASH_SCREEN_STYLE_ICON = 1
+private const val KEY_SPLASH_SCREEN_STYLE: String = "android.activity.splashScreenStyle"
+private const val BASIC_SAMPLE_PACKAGE: String = "androidx.core.splashscreen.test"
+private const val LAUNCH_TIMEOUT: Long = 5000
+
+/**
+ * Start an activity simulating a launch from the launcher
+ * to ensure the splash screen is shown
+ */
+fun startActivityWithSplashScreen(
+ activityClass: KClass<out SplashScreenTestControllerHolder>,
+ device: UiDevice,
+ intentModifier: ((Intent) -> Unit)? = null
+): SplashScreenTestController {
+ // Start from the home screen
+ device.pressHome()
+
+ // Wait for launcher
+ val launcherPackage: String = device.launcherPackageName
+ Assert.assertThat(launcherPackage, IsNull.notNullValue())
+ device.wait(
+ Until.hasObject(By.pkg(launcherPackage).depth(0)),
+ LAUNCH_TIMEOUT
+ )
+
+ // Launch the app
+ val context = ApplicationProvider.getApplicationContext<Context>()
+ val baseIntent = context.packageManager.getLaunchIntentForPackage(
+ BASIC_SAMPLE_PACKAGE
+ )
+ val intent = Intent(baseIntent).apply {
+ component = ComponentName(BASIC_SAMPLE_PACKAGE, activityClass.qualifiedName!!)
+ intentModifier?.invoke(this)
+ }
+
+ val monitor = object : Instrumentation.ActivityMonitor(
+ activityClass.qualifiedName!!,
+ Instrumentation.ActivityResult(0, Intent()), false
+ ) {
+ override fun onStartActivity(intent: Intent?): Instrumentation.ActivityResult? {
+ return if (intent?.component?.packageName == BASIC_SAMPLE_PACKAGE) {
+ Instrumentation.ActivityResult(0, Intent())
+ } else {
+ null
+ }
+ }
+ }
+ InstrumentationRegistry.getInstrumentation().addMonitor(monitor)
+
+ context.startActivity(
+ intent,
+ // Force the splash screen to be shown with an icon
+ Bundle().apply { putInt(KEY_SPLASH_SCREEN_STYLE, SPLASH_SCREEN_STYLE_ICON) }
+ )
+ Assert.assertTrue(
+ device.wait(
+ Until.hasObject(By.pkg(BASIC_SAMPLE_PACKAGE).depth(0)),
+ LAUNCH_TIMEOUT
+ )
+ )
+ val splashScreenTestActivity =
+ monitor.waitForActivityWithTimeout(LAUNCH_TIMEOUT) as SplashScreenTestControllerHolder?
+ if (splashScreenTestActivity == null) {
+ Assert.fail(
+ activityClass.simpleName!! + " was not launched after " +
+ "$LAUNCH_TIMEOUT ms"
+ )
+ }
+ return splashScreenTestActivity!!.controller
+}
diff --git a/core/core-splashscreen/src/androidTest/java/androidx/core/splashscreen/test/SplashScreenTests.kt b/core/core-splashscreen/src/androidTest/java/androidx/core/splashscreen/test/SplashScreenTests.kt
new file mode 100644
index 0000000..fb9f042
--- /dev/null
+++ b/core/core-splashscreen/src/androidTest/java/androidx/core/splashscreen/test/SplashScreenTests.kt
@@ -0,0 +1,56 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.core.splashscreen.test
+
+import androidx.test.filters.LargeTest
+import androidx.test.internal.runner.junit4.AndroidJUnit4ClassRunner
+import androidx.test.platform.app.InstrumentationRegistry
+import androidx.test.uiautomator.UiDevice
+import com.google.common.truth.Truth
+import org.junit.Before
+import org.junit.Test
+import org.junit.runner.RunWith
+
+@LargeTest
+@RunWith(AndroidJUnit4ClassRunner::class)
+class SplashScreenTests {
+
+ private lateinit var device: UiDevice
+
+ @Before
+ fun setUp() {
+ device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation())
+ }
+
+ @Test
+ fun iconBackgroundSetForIconTheme() {
+ val splashScreen =
+ startActivityWithSplashScreen(SplashScreenWithIconBgTestActivity::class, device) {
+ it.putExtra(EXTRA_ANIMATION_LISTENER, true)
+ }
+ Truth.assertThat(splashScreen.splashScreenIconViewBackground).isNotNull()
+ }
+
+ @Test
+ fun noIconBackgroundOnDefaultTheme() {
+ val splashScreen =
+ startActivityWithSplashScreen(SplashScreenTestActivity::class, device) {
+ it.putExtra(EXTRA_ANIMATION_LISTENER, true)
+ }
+ Truth.assertThat(splashScreen.splashScreenIconViewBackground).isNull()
+ }
+}
\ No newline at end of file
diff --git a/core/core-splashscreen/src/androidTest/java/androidx/core/splashscreen/test/SplashscreenTest.kt b/core/core-splashscreen/src/androidTest/java/androidx/core/splashscreen/test/SplashscreenParametrizedTest.kt
similarity index 72%
rename from core/core-splashscreen/src/androidTest/java/androidx/core/splashscreen/test/SplashscreenTest.kt
rename to core/core-splashscreen/src/androidTest/java/androidx/core/splashscreen/test/SplashscreenParametrizedTest.kt
index f5b5e4e..acecf31 100644
--- a/core/core-splashscreen/src/androidTest/java/androidx/core/splashscreen/test/SplashscreenTest.kt
+++ b/core/core-splashscreen/src/androidTest/java/androidx/core/splashscreen/test/SplashscreenParametrizedTest.kt
@@ -16,23 +16,17 @@
package androidx.core.splashscreen.test
-import android.app.Instrumentation
-import android.content.ComponentName
-import android.content.Context
import android.content.Intent
import android.graphics.Bitmap
import android.os.Bundle
-import androidx.test.core.app.ApplicationProvider
import androidx.test.filters.LargeTest
+import androidx.test.filters.SdkSuppress
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.screenshot.matchers.MSSIMMatcher
-import androidx.test.uiautomator.By
import androidx.test.uiautomator.UiDevice
-import androidx.test.uiautomator.Until
-import org.hamcrest.core.IsNull.notNullValue
import org.junit.Assert.assertEquals
import org.junit.Assert.assertFalse
-import org.junit.Assert.assertThat
+import org.junit.Assert.assertNull
import org.junit.Assert.assertTrue
import org.junit.Assert.fail
import org.junit.Before
@@ -45,14 +39,9 @@
import java.util.concurrent.TimeUnit
import kotlin.reflect.KClass
-private const val SPLASH_SCREEN_STYLE_ICON = 1
-private const val KEY_SPLASH_SCREEN_STYLE: String = "android.activity.splashScreenStyle"
-private const val BASIC_SAMPLE_PACKAGE: String = "androidx.core.splashscreen.test"
-private const val LAUNCH_TIMEOUT: Long = 5000
-
@LargeTest
@RunWith(Parameterized::class)
-public class SplashscreenTest(
+public class SplashscreenParametrizedTest(
public val name: String,
public val activityClass: KClass<out SplashScreenTestControllerHolder>
) {
@@ -64,7 +53,7 @@
@JvmStatic
public fun data(): Iterable<Array<Any>> {
return listOf(
- arrayOf("Platform", SplashScreenTestActivity::class),
+ arrayOf("Platform", SplashScreenWithIconBgTestActivity::class),
arrayOf("AppCompat", SplashScreenAppCompatTestActivity::class)
)
}
@@ -134,6 +123,23 @@
}
@Test
+ public fun splashScreenViewRemoved() {
+ val activity = startActivityWithSplashScreen {
+ // Clear out any previous instances
+ it.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK)
+ it.putExtra(EXTRA_ANIMATION_LISTENER, true)
+ }
+ activity.exitAnimationListenerLatch.await(2, TimeUnit.SECONDS)
+ assertNull(
+ "Splash screen view was not removed from its parent",
+ activity.splashScreenView!!.parent
+ )
+ }
+
+ // The vector drawable of the starting window isn't scaled
+ // correctly pre 23
+ @SdkSuppress(minSdkVersion = 23)
+ @Test
public fun splashscreenViewScreenshotComparison() {
val activity = startActivityWithSplashScreen {
// Clear out any previous instances
@@ -165,7 +171,7 @@
afterScreenshot.width, afterScreenshot.height
)
- val matcher = MSSIMMatcher(0.90).compareBitmaps(
+ val matcher = MSSIMMatcher(0.99).compareBitmaps(
beforeBuffer, afterBuffer, afterScreenshot.width,
afterScreenshot.height
)
@@ -229,60 +235,8 @@
private fun startActivityWithSplashScreen(
intentModifier: ((Intent) -> Unit)? = null
): SplashScreenTestController {
- // Start from the home screen
- device.pressHome()
-
- // Wait for launcher
- val launcherPackage: String = device.launcherPackageName
- assertThat(launcherPackage, notNullValue())
- device.wait(
- Until.hasObject(By.pkg(launcherPackage).depth(0)),
- LAUNCH_TIMEOUT
+ return startActivityWithSplashScreen(
+ activityClass, device, intentModifier
)
-
- // Launch the app
- val context = ApplicationProvider.getApplicationContext<Context>()
- val baseIntent = context.packageManager.getLaunchIntentForPackage(
- BASIC_SAMPLE_PACKAGE
- )
- val intent = Intent(baseIntent).apply {
- component = ComponentName(BASIC_SAMPLE_PACKAGE, activityClass.qualifiedName!!)
- intentModifier?.invoke(this)
- }
-
- val monitor = object : Instrumentation.ActivityMonitor(
- activityClass.qualifiedName!!,
- Instrumentation.ActivityResult(0, Intent()), false
- ) {
- override fun onStartActivity(intent: Intent?): Instrumentation.ActivityResult? {
- return if (intent?.component?.packageName == BASIC_SAMPLE_PACKAGE) {
- Instrumentation.ActivityResult(0, Intent())
- } else {
- null
- }
- }
- }
- InstrumentationRegistry.getInstrumentation().addMonitor(monitor)
-
- context.startActivity(
- intent,
- // Force the splash screen to be shown with an icon
- Bundle().apply { putInt(KEY_SPLASH_SCREEN_STYLE, SPLASH_SCREEN_STYLE_ICON) }
- )
- assertTrue(
- device.wait(
- Until.hasObject(By.pkg(BASIC_SAMPLE_PACKAGE).depth(0)),
- LAUNCH_TIMEOUT
- )
- )
- val splashScreenTestActivity =
- monitor.waitForActivityWithTimeout(LAUNCH_TIMEOUT) as SplashScreenTestControllerHolder?
- if (splashScreenTestActivity == null) {
- fail(
- activityClass.simpleName!! + " was not launched after " +
- "$LAUNCH_TIMEOUT ms"
- )
- }
- return splashScreenTestActivity!!.controller
}
}
\ No newline at end of file
diff --git a/core/core-splashscreen/src/androidTest/res/drawable/android.xml b/core/core-splashscreen/src/androidTest/res/drawable/android.xml
index 822d8e7..c6d4fe2 100644
--- a/core/core-splashscreen/src/androidTest/res/drawable/android.xml
+++ b/core/core-splashscreen/src/androidTest/res/drawable/android.xml
@@ -15,12 +15,17 @@
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
- android:width="72dp"
- android:height="72dp"
- android:viewportHeight="100"
- android:viewportWidth="100">
+ android:width="200px"
+ android:height="200px"
+ android:viewportHeight="200"
+ android:viewportWidth="200">
<path
- android:fillColor="#3ddc84"
- android:pathData="m0 0 L 0 100 100 100 100 0z"
+ android:fillColor="#0000FF"
+ android:pathData="m50 50 L 50 150 150 150 150 50z"
+ android:strokeWidth="1" />
+
+ <path
+ android:fillColor="#FF0000"
+ android:pathData="m100 100 L 100 101 101 101 101 100z"
android:strokeWidth="1" />
</vector>
\ No newline at end of file
diff --git a/core/core-splashscreen/src/androidTest/res/values/colors.xml b/core/core-splashscreen/src/androidTest/res/values/colors.xml
index 306e151..c204347 100644
--- a/core/core-splashscreen/src/androidTest/res/values/colors.xml
+++ b/core/core-splashscreen/src/androidTest/res/values/colors.xml
@@ -17,4 +17,5 @@
<resources>
<color name="bg_launcher">#15FFFF</color>
+ <color name="icon_bg">#FFFF00</color>
</resources>
\ No newline at end of file
diff --git a/core/core-splashscreen/src/androidTest/res/values/styles.xml b/core/core-splashscreen/src/androidTest/res/values/styles.xml
index 743d243..d028ccc 100644
--- a/core/core-splashscreen/src/androidTest/res/values/styles.xml
+++ b/core/core-splashscreen/src/androidTest/res/values/styles.xml
@@ -21,6 +21,7 @@
<item name="android:fitsSystemWindows">false</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
+ <item name="android:windowLightStatusBar">false</item>
</style>
<style name="Theme.Test.Starting" parent="Theme.SplashScreen">
@@ -30,6 +31,14 @@
<item name="postSplashScreenTheme">@style/Theme.Test</item>
</style>
+ <style name="Theme.Test.Starting.IconBackground" parent="Theme.SplashScreen.IconBackground">
+ <item name="windowSplashScreenBackground">@color/bg_launcher</item>
+ <item name="windowSplashScreenAnimatedIcon">@drawable/android</item>
+ <item name="windowSplashScreenAnimationDuration">1234</item>
+ <item name="windowSplashScreenIconBackgroundColor">@color/icon_bg</item>
+ <item name="postSplashScreenTheme">@style/Theme.Test</item>
+ </style>
+
<!-- Themes for AppCompat Tests -->
<style name="Theme.Test.AppCompat" parent="Theme.AppCompat.Light.NoActionBar">
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
@@ -44,4 +53,5 @@
<item name="windowSplashScreenAnimationDuration">1234</item>
<item name="postSplashScreenTheme">@style/Theme.Test.AppCompat</item>
</style>
+
</resources>
\ No newline at end of file
diff --git a/core/core-splashscreen/src/main/java/androidx/core/splashscreen/MaskedDrawable.kt b/core/core-splashscreen/src/main/java/androidx/core/splashscreen/MaskedDrawable.kt
new file mode 100644
index 0000000..149d225
--- /dev/null
+++ b/core/core-splashscreen/src/main/java/androidx/core/splashscreen/MaskedDrawable.kt
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2021 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package androidx.core.splashscreen
+
+import android.graphics.Canvas
+import android.graphics.ColorFilter
+import android.graphics.Path
+import android.graphics.Rect
+import android.graphics.drawable.Drawable
+
+/**
+ * A wrapper around a `drawable` that clip it to fit in a circle of diameter `maskDiameter`.
+ * @param drawable The drawable to clip
+ * @param maskDiameter The diameter of the mask used to clip the drawable.
+ */
+internal class MaskedDrawable(
+ private val drawable: Drawable,
+ private val maskDiameter: Float
+) : Drawable() {
+ private val mask = Path().apply {
+ val radius = maskDiameter / 2f
+ addCircle(0f, 0f, radius, Path.Direction.CW)
+ }
+
+ override fun draw(canvas: Canvas) {
+ canvas.clipPath(mask)
+ drawable.draw(canvas)
+ }
+
+ override fun setAlpha(alpha: Int) {
+ drawable.alpha = alpha
+ }
+
+ override fun setColorFilter(colorFilter: ColorFilter?) {
+ drawable.colorFilter = colorFilter
+ }
+
+ @Suppress("DEPRECATION")
+ override fun getOpacity() = drawable.opacity
+
+ override fun onBoundsChange(bounds: Rect?) {
+ super.onBoundsChange(bounds)
+ bounds ?: return
+ drawable.bounds = bounds
+ mask.offset(bounds.exactCenterX(), bounds.exactCenterY())
+ }
+}
\ No newline at end of file
diff --git a/core/core-splashscreen/src/main/java/androidx/core/splashscreen/SplashScreen.kt b/core/core-splashscreen/src/main/java/androidx/core/splashscreen/SplashScreen.kt
index 94c0b67..618384e 100644
--- a/core/core-splashscreen/src/main/java/androidx/core/splashscreen/SplashScreen.kt
+++ b/core/core-splashscreen/src/main/java/androidx/core/splashscreen/SplashScreen.kt
@@ -19,6 +19,8 @@
import android.annotation.SuppressLint
import android.app.Activity
import android.content.res.Resources
+import android.graphics.drawable.Drawable
+import android.os.Build
import android.os.Build.VERSION.PREVIEW_SDK_INT
import android.os.Build.VERSION.SDK_INT
import android.util.TypedValue
@@ -49,12 +51,13 @@
private val impl = when {
SDK_INT >= 31 -> Impl31(activity)
SDK_INT == 30 && PREVIEW_SDK_INT > 0 -> Impl31(activity)
- SDK_INT >= 23 -> Impl23(activity)
else -> Impl(activity)
}
public companion object {
+ private const val MASK_FACTOR = 2 / 3f
+
/**
* Creates a [SplashScreen] instance associated with this [Activity] and handles
* setting the theme to [R.attr.postSplashScreenTheme].
@@ -161,7 +164,8 @@
var finalThemeId: Int = 0
var backgroundResId: Int? = null
var backgroundColor: Int? = null
- var icon: Int = 0
+ var icon: Drawable? = null
+ var hasBackground: Boolean = false
var splashScreenWaitPredicate = KeepOnScreenCondition { false }
private var animationListener: OnExitAnimationListener? = null
@@ -185,7 +189,12 @@
true
)
) {
- icon = typedValue.resourceId
+ icon = currentTheme.getDrawable(typedValue.resourceId)
+ }
+
+ if (currentTheme.resolveAttribute(R.attr.splashScreenIconSize, typedValue, true)) {
+ hasBackground =
+ typedValue.resourceId == R.dimen.splashscreen_icon_size_with_background
}
setPostSplashScreenTheme(currentTheme, typedValue)
}
@@ -199,11 +208,6 @@
if (finalThemeId != 0) {
activity.setTheme(finalThemeId)
}
- } else {
- throw Resources.NotFoundException(
- "Cannot set AppTheme. No theme value defined for attribute " +
- activity.resources.getResourceName(R.attr.postSplashScreenTheme)
- )
}
}
@@ -229,18 +233,19 @@
val splashScreenViewProvider = SplashScreenViewProvider(activity)
val finalBackgroundResId = backgroundResId
val finalBackgroundColor = backgroundColor
+ val splashScreenView = splashScreenViewProvider.view
+
if (finalBackgroundResId != null && finalBackgroundResId != Resources.ID_NULL) {
- splashScreenViewProvider.view.setBackgroundResource(finalBackgroundResId)
+ splashScreenView.setBackgroundResource(finalBackgroundResId)
} else if (finalBackgroundColor != null) {
- splashScreenViewProvider.view.setBackgroundColor(finalBackgroundColor)
+ splashScreenView.setBackgroundColor(finalBackgroundColor)
} else {
- splashScreenViewProvider.view.background = activity.window.decorView.background
+ splashScreenView.background = activity.window.decorView.background
}
- splashScreenViewProvider.view.findViewById<ImageView>(R.id.splashscreen_icon_view)
- .setBackgroundResource(icon)
+ icon?.let { displaySplashScreenIcon(splashScreenView, it) }
- splashScreenViewProvider.view.addOnLayoutChangeListener(
+ splashScreenView.addOnLayoutChangeListener(
object : OnLayoutChangeListener {
override fun onLayoutChange(
view: View,
@@ -253,7 +258,6 @@
oldRight: Int,
oldBottom: Int
) {
- adjustInsets(view, splashScreenViewProvider)
if (!view.isAttachedToWindow) {
return
}
@@ -268,6 +272,31 @@
})
}
+ private fun displaySplashScreenIcon(splashScreenView: View, icon: Drawable) {
+ val iconView = splashScreenView.findViewById<ImageView>(R.id.splashscreen_icon_view)
+ iconView.apply {
+ val maskSize: Float
+ if (hasBackground) {
+ // If the splash screen has an icon background we need to mask both the
+ // background and foreground.
+ val iconBackgroundDrawable = context.getDrawable(R.drawable.icon_background)
+
+ val iconSize =
+ resources.getDimension(R.dimen.splashscreen_icon_size_with_background)
+ maskSize = iconSize * MASK_FACTOR
+
+ if (iconBackgroundDrawable != null) {
+ background = MaskedDrawable(iconBackgroundDrawable, maskSize)
+ }
+ } else {
+ val iconSize =
+ resources.getDimension(R.dimen.splashscreen_icon_size_no_background)
+ maskSize = iconSize * MASK_FACTOR
+ }
+ setImageDrawable(MaskedDrawable(icon, maskSize))
+ }
+ }
+
fun dispatchOnExitAnimation(splashScreenViewProvider: SplashScreenViewProvider) {
val finalListener = animationListener ?: return
animationListener = null
@@ -275,35 +304,9 @@
finalListener.onSplashScreenExit(splashScreenViewProvider)
}
}
-
- /**
- * Adjust the insets to avoid any jump between the actual splash screen and the
- * SplashScreen View
- */
- open fun adjustInsets(
- view: View,
- splashScreenViewProvider: SplashScreenViewProvider
- ) {
- // No-op
- }
}
- @Suppress("DEPRECATION")
- @RequiresApi(23)
- private class Impl23(activity: Activity) : Impl(activity) {
- override fun adjustInsets(
- view: View,
- splashScreenViewProvider: SplashScreenViewProvider
- ) {
- // Offset the icon if the insets have changed
- val rootWindowInsets = view.rootWindowInsets
- val ty =
- rootWindowInsets.systemWindowInsetTop - rootWindowInsets.systemWindowInsetBottom
- splashScreenViewProvider.iconView.translationY = -ty.toFloat() / 2f
- }
- }
-
- @RequiresApi(31) // TODO(188897399) Update to "S" once finalized
+ @RequiresApi(Build.VERSION_CODES.S)
private class Impl31(activity: Activity) : Impl(activity) {
var preDrawListener: OnPreDrawListener? = null
diff --git a/core/core-splashscreen/src/main/java/androidx/core/splashscreen/SplashScreenViewProvider.kt b/core/core-splashscreen/src/main/java/androidx/core/splashscreen/SplashScreenViewProvider.kt
index 11eda6d..a0c4e5b 100644
--- a/core/core-splashscreen/src/main/java/androidx/core/splashscreen/SplashScreenViewProvider.kt
+++ b/core/core-splashscreen/src/main/java/androidx/core/splashscreen/SplashScreenViewProvider.kt
@@ -50,6 +50,8 @@
Build.VERSION.SDK_INT >= 31 -> ViewImpl31(ctx)
Build.VERSION.SDK_INT == 30 && Build.VERSION.PREVIEW_SDK_INT > 0 -> ViewImpl31(ctx)
else -> ViewImpl(ctx)
+ }.apply {
+ createSplashScreenView()
}
/**
@@ -98,23 +100,28 @@
) as ViewGroup
}
- init {
+ open fun createSplashScreenView() {
val content = activity.findViewById<ViewGroup>(android.R.id.content)
- content.addView(_splashScreenView)
+ (content.rootView as? ViewGroup)?.addView(_splashScreenView)
}
open val splashScreenView: ViewGroup get() = _splashScreenView
open val iconView: View get() = splashScreenView.findViewById(R.id.splashscreen_icon_view)
open val iconAnimationStartMillis: Long get() = 0
open val iconAnimationDurationMillis: Long get() = 0
- open fun remove() =
- activity.findViewById<ViewGroup>(android.R.id.content).removeView(splashScreenView)
+ open fun remove() {
+ (splashScreenView.parent as? ViewGroup)?.removeView(splashScreenView)
+ }
}
@RequiresApi(31)
private class ViewImpl31(activity: Activity) : ViewImpl(activity) {
lateinit var platformView: SplashScreenView
+ override fun createSplashScreenView() {
+ // Do nothing
+ }
+
override val splashScreenView get() = platformView
override val iconView get() = platformView.iconView!!
diff --git a/core/core-splashscreen/src/main/res/drawable-v23/compat_splash_screen.xml b/core/core-splashscreen/src/main/res/drawable-v23/compat_splash_screen.xml
index 30562b0..a74589d 100644
--- a/core/core-splashscreen/src/main/res/drawable-v23/compat_splash_screen.xml
+++ b/core/core-splashscreen/src/main/res/drawable-v23/compat_splash_screen.xml
@@ -19,8 +19,26 @@
<color android:color="?attr/windowSplashScreenBackground" />
</item>
<item
- android:drawable="?attr/windowSplashScreenAnimatedIcon"
android:gravity="center"
- android:width="@dimen/splashscreen_icon_size"
- android:height="@dimen/splashscreen_icon_size" />
+ android:width="@dimen/splashscreen_icon_size_with_background"
+ android:height="@dimen/splashscreen_icon_size_with_background"
+ android:drawable="@drawable/icon_background">
+ </item>
+ <item
+ android:drawable="?windowSplashScreenAnimatedIcon"
+ android:gravity="center"
+ android:width="@dimen/splashscreen_icon_size_with_background"
+ android:height="@dimen/splashscreen_icon_size_with_background" />
+
+ <!-- We mask the outer bounds of the icon like we do on Android 12 -->
+ <item
+ android:gravity="center"
+ android:width="@dimen/splashscreen_icon_mask_size_with_background"
+ android:height="@dimen/splashscreen_icon_mask_size_with_background">
+ <shape android:shape="oval">
+ <stroke
+ android:width="@dimen/splashscreen_icon_mask_stroke_with_background"
+ android:color="?windowSplashScreenBackground" />
+ </shape>
+ </item>
</layer-list>
\ No newline at end of file
diff --git a/core/core-splashscreen/src/main/res/drawable-v23/compat_splash_screen_no_icon_background.xml b/core/core-splashscreen/src/main/res/drawable-v23/compat_splash_screen_no_icon_background.xml
new file mode 100644
index 0000000..74a5d25
--- /dev/null
+++ b/core/core-splashscreen/src/main/res/drawable-v23/compat_splash_screen_no_icon_background.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="utf-8"?><!--
+ Copyright 2021 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+ -->
+
+<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
+ <item android:gravity="fill">
+ <color android:color="?attr/windowSplashScreenBackground" />
+ </item>
+ <item
+ android:drawable="?windowSplashScreenAnimatedIcon"
+ android:gravity="center"
+ android:width="@dimen/splashscreen_icon_size_no_background"
+ android:height="@dimen/splashscreen_icon_size_no_background" />
+
+ <!-- We mask the outer bounds of the icon like we do on Android 12 -->
+ <item
+ android:gravity="center"
+ android:width="@dimen/splashscreen_icon_mask_size_no_background"
+ android:height="@dimen/splashscreen_icon_mask_size_no_background">
+ <shape android:shape="oval">
+ <stroke
+ android:width="@dimen/splashscreen_icon_mask_stroke_no_background"
+ android:color="?windowSplashScreenBackground"/>
+ </shape>
+ </item>
+</layer-list>
\ No newline at end of file
diff --git a/core/core-splashscreen/samples/src/main/res/drawable/foreground.xml b/core/core-splashscreen/src/main/res/drawable/compat_splash_screen_no_icon_background.xml
similarity index 81%
copy from core/core-splashscreen/samples/src/main/res/drawable/foreground.xml
copy to core/core-splashscreen/src/main/res/drawable/compat_splash_screen_no_icon_background.xml
index c46194a..28bd4d5 100644
--- a/core/core-splashscreen/samples/src/main/res/drawable/foreground.xml
+++ b/core/core-splashscreen/src/main/res/drawable/compat_splash_screen_no_icon_background.xml
@@ -14,7 +14,5 @@
limitations under the License.
-->
-<inset xmlns:android="http://schemas.android.com/apk/res/android"
- android:drawable="@drawable/android"
- android:inset="25%">
-</inset>
\ No newline at end of file
+<color xmlns:android="http://schemas.android.com/apk/res/android"
+ android:color="?attr/windowSplashScreenBackground" />
\ No newline at end of file
diff --git a/core/core-splashscreen/samples/src/main/res/drawable/foreground.xml b/core/core-splashscreen/src/main/res/drawable/icon_background.xml
similarity index 78%
copy from core/core-splashscreen/samples/src/main/res/drawable/foreground.xml
copy to core/core-splashscreen/src/main/res/drawable/icon_background.xml
index c46194a..3015067 100644
--- a/core/core-splashscreen/samples/src/main/res/drawable/foreground.xml
+++ b/core/core-splashscreen/src/main/res/drawable/icon_background.xml
@@ -13,8 +13,6 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
-<inset xmlns:android="http://schemas.android.com/apk/res/android"
- android:drawable="@drawable/android"
- android:inset="25%">
-</inset>
\ No newline at end of file
+<shape android:shape="oval" xmlns:android="http://schemas.android.com/apk/res/android">
+ <solid android:color="?attr/windowSplashScreenIconBackgroundColor" />
+</shape>
\ No newline at end of file
diff --git a/core/core-splashscreen/src/main/res/layout/splash_screen_view.xml b/core/core-splashscreen/src/main/res/layout/splash_screen_view.xml
index 44ab5e19..76ba5f2 100644
--- a/core/core-splashscreen/src/main/res/layout/splash_screen_view.xml
+++ b/core/core-splashscreen/src/main/res/layout/splash_screen_view.xml
@@ -17,12 +17,13 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
- android:layout_height="match_parent">
+ android:layout_height="match_parent"
+ android:fitsSystemWindows="false">
<ImageView
android:id="@+id/splashscreen_icon_view"
- android:layout_width="@dimen/splashscreen_icon_size"
- android:layout_height="@dimen/splashscreen_icon_size"
- android:layout_gravity="center" />
+ android:layout_width="?attr/splashScreenIconSize"
+ android:layout_height="?attr/splashScreenIconSize"
+ android:layout_gravity="center"/>
</FrameLayout>
\ No newline at end of file
diff --git a/core/core-splashscreen/src/main/res/values-v31/styles.xml b/core/core-splashscreen/src/main/res/values-v31/styles.xml
index 7f04b15..90b4c18 100644
--- a/core/core-splashscreen/src/main/res/values-v31/styles.xml
+++ b/core/core-splashscreen/src/main/res/values-v31/styles.xml
@@ -22,5 +22,12 @@
<item name="android:windowSplashScreenAnimationDuration">
?windowSplashScreenAnimationDuration
</item>
+ <item name="android:windowSplashScreenIconBackgroundColor">@android:color/transparent</item>
+ </style>
+
+ <style name="Theme.SplashScreen.IconBackground" parent="Theme.SplashScreen">
+ <item name="android:windowSplashScreenIconBackgroundColor">
+ ?windowSplashScreenIconBackgroundColor
+ </item>
</style>
</resources>
\ No newline at end of file
diff --git a/core/core-splashscreen/src/main/res/values/attrs.xml b/core/core-splashscreen/src/main/res/values/attrs.xml
index 5bbfaa3..b7531b5 100644
--- a/core/core-splashscreen/src/main/res/values/attrs.xml
+++ b/core/core-splashscreen/src/main/res/values/attrs.xml
@@ -1,5 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!--
+<?xml version="1.0" encoding="utf-8"?><!--
Copyright 2021 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
@@ -22,6 +21,9 @@
directory Defaults to @drawable/ic_launcher. -->
<attr name="windowSplashScreenAnimatedIcon" format="reference" />
+ <!-- Optional color to be displayed below the icon -->
+ <attr name="windowSplashScreenIconBackgroundColor" format="color" />
+
<!-- Background color of the splash screen. Defaults to the theme's windowBackground-->
<attr name="windowSplashScreenBackground" format="color" />
@@ -30,4 +32,8 @@
<!-- Theme to apply to the Activity once the splash screen is dismissed-->
<attr name="postSplashScreenTheme" format="reference" />
+
+ <!-- The size of the splash screen icon. It varies depending on the
+ presence or not of an icon background-->
+ <attr name="splashScreenIconSize" format="dimension" />
</resources>
\ No newline at end of file
diff --git a/core/core-splashscreen/src/main/res/values/dimens.xml b/core/core-splashscreen/src/main/res/values/dimens.xml
index 7c5b998..5ceca01 100644
--- a/core/core-splashscreen/src/main/res/values/dimens.xml
+++ b/core/core-splashscreen/src/main/res/values/dimens.xml
@@ -15,6 +15,17 @@
-->
<resources>
- <dimen name="splashscreen_icon_size">160dp</dimen>
+ <!-- The size of the splash screen icon. The size varies whether
+ the windowSplashScreenIconBackgroundColor attribute is set-->
+ <dimen name="splashscreen_icon_size">?splashScreenIconSize</dimen>
+
+ <dimen name="splashscreen_icon_size_no_background">288dp</dimen>
+ <dimen name="splashscreen_icon_mask_size_no_background">410dp</dimen>
+ <dimen name="splashscreen_icon_mask_stroke_no_background">109dp</dimen>
+
+ <dimen name="splashscreen_icon_size_with_background">240dp</dimen>
+ <dimen name="splashscreen_icon_mask_size_with_background">342dp</dimen>
+ <dimen name="splashscreen_icon_mask_stroke_with_background">92dp</dimen>
+
<integer name="default_icon_animation_duration">10000</integer>
</resources>
\ No newline at end of file
diff --git a/core/core-splashscreen/src/main/res/values/public.xml b/core/core-splashscreen/src/main/res/values/public.xml
index f90eec9..cd917e9 100644
--- a/core/core-splashscreen/src/main/res/values/public.xml
+++ b/core/core-splashscreen/src/main/res/values/public.xml
@@ -19,4 +19,6 @@
<public name="windowSplashScreenAnimationDuration" type="attr" />
<public name="postSplashScreenTheme" type="attr" />
<public name="Theme.SplashScreen" type="style" />
+ <public name="Theme.SplashScreen.IconBackground" type="style" />
+ <public name="splashscreen_icon_size" type="dimen" />
</resources>
diff --git a/core/core-splashscreen/src/main/res/values/styles.xml b/core/core-splashscreen/src/main/res/values/styles.xml
index ec205a7..52335ac 100644
--- a/core/core-splashscreen/src/main/res/values/styles.xml
+++ b/core/core-splashscreen/src/main/res/values/styles.xml
@@ -17,12 +17,15 @@
<resources>
<style name="Theme.SplashScreenBase" parent="android:Theme.NoTitleBar">
- <item name="android:windowBackground">@drawable/compat_splash_screen</item>
+ <item name="android:windowBackground">
+ @drawable/compat_splash_screen_no_icon_background
+ </item>
<item name="android:opacity">opaque</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:fitsSystemWindows">false</item>
<item name="android:statusBarColor">@android:color/transparent</item>
<item name="android:navigationBarColor">@android:color/transparent</item>
+ <item name="splashScreenIconSize">@dimen/splashscreen_icon_size_no_background</item>
</style>
<style name="Theme.SplashScreen" parent="Theme.SplashScreenBase">
@@ -32,5 +35,11 @@
</item>
<item name="windowSplashScreenBackground">@android:color/background_light</item>
<item name="windowSplashScreenAnimatedIcon">@android:drawable/sym_def_app_icon</item>
+
+ </style>
+
+ <style name="Theme.SplashScreen.IconBackground" parent="Theme.SplashScreen">
+ <item name="android:windowBackground">@drawable/compat_splash_screen</item>
+ <item name="splashScreenIconSize">@dimen/splashscreen_icon_size_with_background</item>
</style>
</resources>
\ No newline at end of file
diff --git a/core/core/src/androidTest/java/androidx/core/view/MenuHostHelperTest.kt b/core/core/src/androidTest/java/androidx/core/view/MenuHostHelperTest.kt
index 62c526b3..344edf4 100644
--- a/core/core/src/androidTest/java/androidx/core/view/MenuHostHelperTest.kt
+++ b/core/core/src/androidTest/java/androidx/core/view/MenuHostHelperTest.kt
@@ -78,6 +78,27 @@
}
@Test
+ fun addRemoveReAddMenuProviderWithLifecycle() {
+ with(ActivityScenario.launch(TestActivityWithLifecycle::class.java)) {
+ val toolbar = Toolbar(context)
+ val menuHost = TestMenuHost(toolbar.menu, withActivity { menuInflater })
+ val lifecycleOwner = TestLifecycleOwner(Lifecycle.State.STARTED)
+
+ menuHost.addMenuProvider(menuProvider, lifecycleOwner)
+ assertThat(toolbar.menu.findItem(R.id.item1)).isNotNull()
+ assertThat(toolbar.menu.findItem(R.id.item2)).isNotNull()
+
+ menuHost.removeMenuProvider(menuProvider)
+
+ menuHost.addMenuProvider(menuProvider, lifecycleOwner)
+
+ lifecycleOwner.currentState = Lifecycle.State.DESTROYED
+ assertThat(toolbar.menu.findItem(R.id.item1)).isNull()
+ assertThat(toolbar.menu.findItem(R.id.item2)).isNull()
+ }
+ }
+
+ @Test
fun addMenuProviderWithLifecycleAndState() {
with(ActivityScenario.launch(TestActivityWithLifecycle::class.java)) {
val toolbar = Toolbar(context)
@@ -99,6 +120,35 @@
}
@Test
+ fun addMenuProviderWithLifecycleAndStateSTOPPEDAndSTARTED() {
+ with(ActivityScenario.launch(TestActivityWithLifecycle::class.java)) {
+ val toolbar = Toolbar(context)
+ val menuHost = TestMenuHost(toolbar.menu, withActivity { menuInflater })
+ val lifecycleOwner = TestLifecycleOwner(Lifecycle.State.CREATED)
+
+ menuHost.addMenuProvider(menuProvider, lifecycleOwner, Lifecycle.State.STARTED)
+ assertThat(toolbar.menu.findItem(R.id.item1)).isNull()
+ assertThat(toolbar.menu.findItem(R.id.item2)).isNull()
+
+ lifecycleOwner.currentState = Lifecycle.State.STARTED
+ assertThat(toolbar.menu.findItem(R.id.item1)).isNotNull()
+ assertThat(toolbar.menu.findItem(R.id.item2)).isNotNull()
+
+ lifecycleOwner.currentState = Lifecycle.State.CREATED
+ assertThat(toolbar.menu.findItem(R.id.item1)).isNull()
+ assertThat(toolbar.menu.findItem(R.id.item2)).isNull()
+
+ lifecycleOwner.currentState = Lifecycle.State.STARTED
+ assertThat(toolbar.menu.findItem(R.id.item1)).isNotNull()
+ assertThat(toolbar.menu.findItem(R.id.item2)).isNotNull()
+
+ lifecycleOwner.currentState = Lifecycle.State.DESTROYED
+ assertThat(toolbar.menu.findItem(R.id.item1)).isNull()
+ assertThat(toolbar.menu.findItem(R.id.item2)).isNull()
+ }
+ }
+
+ @Test
fun removeMenuProvider() {
with(ActivityScenario.launch(TestActivityWithLifecycle::class.java)) {
val toolbar = Toolbar(context)
@@ -115,6 +165,27 @@
}
@Test
+ fun removeMenuProviderWithLifecycle() {
+ with(ActivityScenario.launch(TestActivityWithLifecycle::class.java)) {
+ val toolbar = Toolbar(context)
+ val menuHost = TestMenuHost(toolbar.menu, withActivity { menuInflater })
+ val lifecycleOwner = TestLifecycleOwner(Lifecycle.State.STARTED)
+
+ menuHost.addMenuProvider(menuProvider, lifecycleOwner)
+ assertThat(toolbar.menu.findItem(R.id.item1)).isNotNull()
+ assertThat(toolbar.menu.findItem(R.id.item2)).isNotNull()
+
+ menuHost.removeMenuProvider(menuProvider)
+ assertThat(menuHost.invalidateCount).isEqualTo(2)
+
+ lifecycleOwner.currentState = Lifecycle.State.DESTROYED
+ assertThat(toolbar.menu.findItem(R.id.item1)).isNull()
+ assertThat(toolbar.menu.findItem(R.id.item2)).isNull()
+ assertThat(menuHost.invalidateCount).isEqualTo(2)
+ }
+ }
+
+ @Test
fun multipleMenuProviders() {
with(ActivityScenario.launch(TestActivityWithLifecycle::class.java)) {
val toolbar = Toolbar(context)
diff --git a/core/core/src/androidTest/java/androidx/core/view/MenuHostTest.kt b/core/core/src/androidTest/java/androidx/core/view/MenuHostTest.kt
index b732c7b..5beb280 100644
--- a/core/core/src/androidTest/java/androidx/core/view/MenuHostTest.kt
+++ b/core/core/src/androidTest/java/androidx/core/view/MenuHostTest.kt
@@ -67,7 +67,11 @@
}
class TestMenuHost(private val menu: Menu, private val menuInflater: MenuInflater) : MenuHost {
- private val menuHostHelper = MenuHostHelper { invalidateMenu() }
+ var invalidateCount = 0
+ private val menuHostHelper = MenuHostHelper {
+ invalidateMenu()
+ invalidateCount++
+ }
private fun onCreateMenu() {
menuHostHelper.onCreateMenu(menu, menuInflater)
diff --git a/core/core/src/main/java/androidx/core/view/MenuHostHelper.java b/core/core/src/main/java/androidx/core/view/MenuHostHelper.java
index c9ed575..ba76e000 100644
--- a/core/core/src/main/java/androidx/core/view/MenuHostHelper.java
+++ b/core/core/src/main/java/androidx/core/view/MenuHostHelper.java
@@ -26,6 +26,8 @@
import androidx.lifecycle.LifecycleEventObserver;
import androidx.lifecycle.LifecycleOwner;
+import java.util.HashMap;
+import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
/**
@@ -35,6 +37,8 @@
private final Runnable mOnInvalidateMenuCallback;
private final CopyOnWriteArrayList<MenuProvider> mMenuProviders = new CopyOnWriteArrayList<>();
+ private final Map<MenuProvider, LifecycleContainer> mProviderToLifecycleContainers =
+ new HashMap<>();
/**
* Construct a new MenuHostHelper.
@@ -98,11 +102,16 @@
public void addMenuProvider(@NonNull MenuProvider provider, @NonNull LifecycleOwner owner) {
addMenuProvider(provider);
Lifecycle lifecycle = owner.getLifecycle();
- lifecycle.addObserver((LifecycleEventObserver) (source, event) -> {
+ LifecycleContainer lifecycleContainer = mProviderToLifecycleContainers.remove(provider);
+ if (lifecycleContainer != null) {
+ lifecycleContainer.clearObservers();
+ }
+ LifecycleEventObserver observer = (source, event) -> {
if (event == Lifecycle.Event.ON_DESTROY) {
removeMenuProvider(provider);
}
- });
+ };
+ mProviderToLifecycleContainers.put(provider, new LifecycleContainer(lifecycle, observer));
}
/**
@@ -121,15 +130,21 @@
public void addMenuProvider(@NonNull MenuProvider provider, @NonNull LifecycleOwner owner,
@NonNull Lifecycle.State state) {
Lifecycle lifecycle = owner.getLifecycle();
- lifecycle.addObserver((LifecycleEventObserver) (source, event) -> {
+ LifecycleContainer lifecycleContainer = mProviderToLifecycleContainers.remove(provider);
+ if (lifecycleContainer != null) {
+ lifecycleContainer.clearObservers();
+ }
+ LifecycleEventObserver observer = (source, event) -> {
if (event == Lifecycle.Event.upTo(state)) {
addMenuProvider(provider);
} else if (event == Lifecycle.Event.ON_DESTROY) {
removeMenuProvider(provider);
} else if (event == Lifecycle.Event.downFrom(state)) {
- removeMenuProvider(provider);
+ mMenuProviders.remove(provider);
+ mOnInvalidateMenuCallback.run();
}
- });
+ };
+ mProviderToLifecycleContainers.put(provider, new LifecycleContainer(lifecycle, observer));
}
/**
@@ -139,6 +154,26 @@
*/
public void removeMenuProvider(@NonNull MenuProvider provider) {
mMenuProviders.remove(provider);
+ LifecycleContainer lifecycleContainer = mProviderToLifecycleContainers.remove(provider);
+ if (lifecycleContainer != null) {
+ lifecycleContainer.clearObservers();
+ }
mOnInvalidateMenuCallback.run();
}
+
+ private static class LifecycleContainer {
+ final Lifecycle mLifecycle;
+ private LifecycleEventObserver mObserver;
+
+ LifecycleContainer(@NonNull Lifecycle lifecycle, @NonNull LifecycleEventObserver observer) {
+ mLifecycle = lifecycle;
+ mObserver = observer;
+ mLifecycle.addObserver(observer);
+ }
+
+ void clearObservers() {
+ mLifecycle.removeObserver(mObserver);
+ mObserver = null;
+ }
+ }
}
diff --git a/health/health-services-client/lint-baseline.xml b/health/health-services-client/lint-baseline.xml
index c44cc29..1f39e14 100644
--- a/health/health-services-client/lint-baseline.xml
+++ b/health/health-services-client/lint-baseline.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<issues format="6" by="lint 7.1.0-alpha08" type="baseline" client="gradle" dependencies="false" name="AGP (7.1.0-alpha08)" variant="all" version="7.1.0-alpha08">
+<issues format="6" by="lint 7.1.0-dev" type="baseline" client="gradle" dependencies="false" name="AGP (7.1.0-dev)" variant="all" version="7.1.0-dev">
<issue
id="BanKeepAnnotation"
@@ -101,6 +101,17 @@
</issue>
<issue
+ id="VisibleForTests"
+ message="This method should only be accessed from tests or within private scope"
+ errorLine1=" get() = ServiceBackedMeasureClient.getClient(applicationContext)"
+ errorLine2=" ~~~~~~~~~">
+ <location
+ file="src/main/java/androidx/health/services/client/impl/ServiceBackedHealthServicesClient.kt"
+ line="51"
+ column="44"/>
+ </issue>
+
+ <issue
id="SyntheticAccessor"
message="Access to `private` field `mCurrentVersion` of class `Client` requires synthetic accessor"
errorLine1=" mCurrentVersion ="
diff --git a/navigation/navigation-compose/src/androidTest/java/androidx/navigation/compose/NavHostTest.kt b/navigation/navigation-compose/src/androidTest/java/androidx/navigation/compose/NavHostTest.kt
index 49bb74d..d7f6d91 100644
--- a/navigation/navigation-compose/src/androidTest/java/androidx/navigation/compose/NavHostTest.kt
+++ b/navigation/navigation-compose/src/androidTest/java/androidx/navigation/compose/NavHostTest.kt
@@ -485,6 +485,13 @@
composeTestRule.onNodeWithText(first).assertExists()
composeTestRule.onNodeWithText(second).assertExists()
+ assertThat(navController.visibleEntries.value)
+ .containsExactly(
+ firstEntry,
+ navController.currentBackStackEntry
+ )
+ .inOrder()
+
composeTestRule.mainClock.autoAdvance = true
composeTestRule.runOnIdle {
diff --git a/navigation/navigation-runtime/api/current.txt b/navigation/navigation-runtime/api/current.txt
index 9499aad..1b18046 100644
--- a/navigation/navigation-runtime/api/current.txt
+++ b/navigation/navigation-runtime/api/current.txt
@@ -104,6 +104,7 @@
method public androidx.navigation.NavigatorProvider getNavigatorProvider();
method public androidx.navigation.NavBackStackEntry? getPreviousBackStackEntry();
method public androidx.lifecycle.ViewModelStoreOwner getViewModelStoreOwner(@IdRes int navGraphId);
+ method public final kotlinx.coroutines.flow.StateFlow<java.util.List<androidx.navigation.NavBackStackEntry>> getVisibleEntries();
method @MainThread public boolean handleDeepLink(android.content.Intent? intent);
method @MainThread public void navigate(@IdRes int resId);
method @MainThread public void navigate(@IdRes int resId, android.os.Bundle? args);
@@ -142,6 +143,7 @@
property public androidx.navigation.NavInflater navInflater;
property public androidx.navigation.NavigatorProvider navigatorProvider;
property public androidx.navigation.NavBackStackEntry? previousBackStackEntry;
+ property public final kotlinx.coroutines.flow.StateFlow<java.util.List<androidx.navigation.NavBackStackEntry>> visibleEntries;
field public static final androidx.navigation.NavController.Companion Companion;
field public static final String KEY_DEEP_LINK_INTENT = "android-support-nav:controller:deepLinkIntent";
}
diff --git a/navigation/navigation-runtime/api/public_plus_experimental_current.txt b/navigation/navigation-runtime/api/public_plus_experimental_current.txt
index 9499aad..1b18046 100644
--- a/navigation/navigation-runtime/api/public_plus_experimental_current.txt
+++ b/navigation/navigation-runtime/api/public_plus_experimental_current.txt
@@ -104,6 +104,7 @@
method public androidx.navigation.NavigatorProvider getNavigatorProvider();
method public androidx.navigation.NavBackStackEntry? getPreviousBackStackEntry();
method public androidx.lifecycle.ViewModelStoreOwner getViewModelStoreOwner(@IdRes int navGraphId);
+ method public final kotlinx.coroutines.flow.StateFlow<java.util.List<androidx.navigation.NavBackStackEntry>> getVisibleEntries();
method @MainThread public boolean handleDeepLink(android.content.Intent? intent);
method @MainThread public void navigate(@IdRes int resId);
method @MainThread public void navigate(@IdRes int resId, android.os.Bundle? args);
@@ -142,6 +143,7 @@
property public androidx.navigation.NavInflater navInflater;
property public androidx.navigation.NavigatorProvider navigatorProvider;
property public androidx.navigation.NavBackStackEntry? previousBackStackEntry;
+ property public final kotlinx.coroutines.flow.StateFlow<java.util.List<androidx.navigation.NavBackStackEntry>> visibleEntries;
field public static final androidx.navigation.NavController.Companion Companion;
field public static final String KEY_DEEP_LINK_INTENT = "android-support-nav:controller:deepLinkIntent";
}
diff --git a/navigation/navigation-runtime/api/restricted_current.txt b/navigation/navigation-runtime/api/restricted_current.txt
index 9499aad..1b18046 100644
--- a/navigation/navigation-runtime/api/restricted_current.txt
+++ b/navigation/navigation-runtime/api/restricted_current.txt
@@ -104,6 +104,7 @@
method public androidx.navigation.NavigatorProvider getNavigatorProvider();
method public androidx.navigation.NavBackStackEntry? getPreviousBackStackEntry();
method public androidx.lifecycle.ViewModelStoreOwner getViewModelStoreOwner(@IdRes int navGraphId);
+ method public final kotlinx.coroutines.flow.StateFlow<java.util.List<androidx.navigation.NavBackStackEntry>> getVisibleEntries();
method @MainThread public boolean handleDeepLink(android.content.Intent? intent);
method @MainThread public void navigate(@IdRes int resId);
method @MainThread public void navigate(@IdRes int resId, android.os.Bundle? args);
@@ -142,6 +143,7 @@
property public androidx.navigation.NavInflater navInflater;
property public androidx.navigation.NavigatorProvider navigatorProvider;
property public androidx.navigation.NavBackStackEntry? previousBackStackEntry;
+ property public final kotlinx.coroutines.flow.StateFlow<java.util.List<androidx.navigation.NavBackStackEntry>> visibleEntries;
field public static final androidx.navigation.NavController.Companion Companion;
field public static final String KEY_DEEP_LINK_INTENT = "android-support-nav:controller:deepLinkIntent";
}
diff --git a/navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavBackStackEntryLifecycleTest.kt b/navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavBackStackEntryLifecycleTest.kt
index 3010d9a..c77a771 100644
--- a/navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavBackStackEntryLifecycleTest.kt
+++ b/navigation/navigation-runtime/src/androidTest/java/androidx/navigation/NavBackStackEntryLifecycleTest.kt
@@ -31,6 +31,11 @@
import androidx.testutils.TestNavigator
import androidx.testutils.test
import com.google.common.truth.Truth.assertWithMessage
+import kotlinx.coroutines.flow.collect
+import kotlinx.coroutines.flow.onEach
+import kotlinx.coroutines.flow.take
+import kotlinx.coroutines.flow.withIndex
+import kotlinx.coroutines.runBlocking
import org.junit.Test
import org.junit.runner.RunWith
import org.mockito.Mockito.inOrder
@@ -102,6 +107,33 @@
.isEqualTo(Lifecycle.State.DESTROYED)
}
+ @UiThreadTest
+ @Test
+ @Suppress("DEPRECATION", "EXPERIMENTAL_API_USAGE")
+ fun visibleEntriesFlow() = runBlocking {
+ val navController = createNavController()
+ navController.graph = navController.createGraph(startDestination = 1) {
+ test(1)
+ test(2)
+ test(3)
+ }
+
+ navController.visibleEntries
+ .take(navController.graph.count())
+ .withIndex()
+ .onEach { (index, list) ->
+ val expectedDestination = index + 1
+ assertWithMessage("Flow emitted unexpected back stack entry (wrong destination)")
+ .that(list)
+ .containsExactly(navController.currentBackStackEntry)
+
+ if (expectedDestination < navController.graph.count()) {
+ navController.navigate(expectedDestination + 1)
+ }
+ }
+ .collect()
+ }
+
/**
* Test that navigating from a sibling to a FloatingWindow sibling leaves the previous
* destination started.
diff --git a/navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt b/navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
index 36d5ee2..5cc2805 100644
--- a/navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
+++ b/navigation/navigation-runtime/src/main/java/androidx/navigation/NavController.kt
@@ -40,12 +40,14 @@
import androidx.lifecycle.ViewModelStore
import androidx.lifecycle.ViewModelStoreOwner
import androidx.navigation.NavDestination.Companion.createRoute
-import androidx.navigation.NavDestination.Companion.hierarchy
import androidx.navigation.NavGraph.Companion.findStartDestination
import kotlinx.coroutines.channels.BufferOverflow
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.MutableSharedFlow
+import kotlinx.coroutines.flow.MutableStateFlow
+import kotlinx.coroutines.flow.StateFlow
import kotlinx.coroutines.flow.asSharedFlow
+import kotlinx.coroutines.flow.asStateFlow
import java.util.concurrent.CopyOnWriteArrayList
import java.util.concurrent.atomic.AtomicInteger
@@ -109,6 +111,30 @@
*/
@get:RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)
public open val backQueue: ArrayDeque<NavBackStackEntry> = ArrayDeque()
+
+ private val _visibleEntries: MutableStateFlow<List<NavBackStackEntry>> =
+ MutableStateFlow(emptyList())
+
+ /**
+ * A [StateFlow] that will emit the currently visible [NavBackStackEntries][NavBackStackEntry]
+ * whenever they change. If there is no visible [NavBackStackEntry], this will be set to an
+ * empty list.
+ *
+ * - `CREATED` entries are listed first and include all entries that have been popped from
+ * the back stack and are in the process of completing their exit transition
+ * - `STARTED` entries on the back stack are next and include all entries that are running
+ * their enter transition and entries whose destination is partially covered by a
+ * `FloatingWindow` destination
+ * - The last entry in the list is the topmost entry in the back stack and is in the `RESUMED`
+ * state only if its enter transition has completed. Otherwise it too will be `STARTED`.
+ *
+ * Note that the `Lifecycle` of any entry cannot be higher than the containing
+ * Activity/Fragment - if the Activity is not `RESUMED`, no entry will be `RESUMED`, no matter
+ * what the transition state is.
+ */
+ public val visibleEntries: StateFlow<List<NavBackStackEntry>> =
+ _visibleEntries.asStateFlow()
+
private val childToParentEntries = mutableMapOf<NavBackStackEntry, NavBackStackEntry>()
private val parentToChildCount = mutableMapOf<NavBackStackEntry, AtomicInteger>()
@@ -315,8 +341,10 @@
viewModel?.clear(entry.id)
}
updateBackStackLifecycle()
+ _visibleEntries.tryEmit(populateVisibleEntries())
} else if ([email protected]) {
updateBackStackLifecycle()
+ _visibleEntries.tryEmit(populateVisibleEntries())
}
// else, updateBackStackLifecycle() will be called after any ongoing navigate() call
// completes
@@ -866,6 +894,7 @@
}
_currentBackStackEntryFlow.tryEmit(backStackEntry)
}
+ _visibleEntries.tryEmit(populateVisibleEntries())
}
return lastBackStackEntry != null
}
@@ -950,6 +979,26 @@
}
}
+ internal fun populateVisibleEntries(): List<NavBackStackEntry> {
+ val entries = mutableListOf<NavBackStackEntry>()
+ // Add any transitioning entries that are not at least STARTED
+ navigatorState.values.forEach { state ->
+ entries += state.transitionsInProgress.value.filter { entry ->
+ !entries.contains(entry) &&
+ !entry.lifecycle.currentState.isAtLeast(Lifecycle.State.STARTED)
+ }
+ }
+ // Add any STARTED entries from the backQueue. This will include the topmost
+ // non-FloatingWindow destination plus every FloatingWindow destination above it.
+ entries += backQueue.filter { entry ->
+ !entries.contains(entry) &&
+ entry.lifecycle.currentState.isAtLeast(Lifecycle.State.STARTED)
+ }
+ return entries.filter {
+ it.destination !is NavGraph
+ }
+ }
+
/**
* The [inflater][NavInflater] for this controller.
*
diff --git a/paging/paging-common/lint-baseline.xml b/paging/paging-common/lint-baseline.xml
new file mode 100644
index 0000000..271727a
--- /dev/null
+++ b/paging/paging-common/lint-baseline.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<issues format="6" by="lint 7.1.0-dev" type="baseline" client="gradle" dependencies="false" name="AGP (7.1.0-dev)" variant="all" version="7.1.0-dev">
+
+ <issue
+ id="SupportAnnotationUsage"
+ message="Did you mean `@get:VisibleForTesting` ? Without `get:` this annotates the constructor parameter itself instead of the associated getter."
+ errorLine1=" @VisibleForTesting(otherwise = VisibleForTesting.PRIVATE)"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/main/kotlin/androidx/paging/PageFetcher.kt"
+ line="212"
+ column="9"/>
+ </issue>
+
+ <issue
+ id="SupportAnnotationUsage"
+ message="Did you mean `@get:RestrictTo` ? Without `get:` this annotates the constructor parameter itself instead of the associated getter."
+ errorLine1=" @RestrictTo(RestrictTo.Scope.LIBRARY_GROUP)"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/main/kotlin/androidx/paging/PagedList.kt"
+ line="125"
+ column="5"/>
+ </issue>
+
+</issues>
diff --git a/settings.gradle b/settings.gradle
index 992bb5a..e46bed5 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -322,6 +322,7 @@
includeProject(":compose:integration-tests:docs-snippets", "compose/integration-tests/docs-snippets", [BuildType.COMPOSE])
includeProject(":compose:integration-tests:macrobenchmark", "compose/integration-tests/macrobenchmark", [BuildType.COMPOSE])
includeProject(":compose:integration-tests:macrobenchmark-target", "compose/integration-tests/macrobenchmark-target", [BuildType.COMPOSE])
+includeProject(":compose:integration-tests:material-catalog", "compose/integration-tests/material-catalog", [BuildType.COMPOSE])
includeProject(":compose:lint", "compose/lint", [BuildType.COMPOSE])
includeProject(":compose:lint:internal-lint-checks", "compose/lint/internal-lint-checks", [BuildType.COMPOSE, BuildType.MAIN])
includeProject(":compose:lint:common", "compose/lint/common", [BuildType.COMPOSE, BuildType.MAIN])
@@ -343,7 +344,9 @@
includeProject(":compose:material:material:icons:generator", "compose/material/material/icons/generator", [BuildType.COMPOSE])
includeProject(":compose:material:material:integration-tests:material-demos", "compose/material/material/integration-tests/material-demos", [BuildType.COMPOSE])
includeProject(":compose:material:material:integration-tests:material-catalog", "compose/material/material/integration-tests/material-catalog", [BuildType.COMPOSE])
+includeProject(":compose:material3:material3:integration-tests:material3-catalog", "compose/material3/material3/integration-tests/material3-catalog", [BuildType.COMPOSE])
includeProject(":compose:material:material:material-samples", "compose/material/material/samples", [BuildType.COMPOSE])
+includeProject(":compose:material3:material3:material3-samples", "compose/material3/material3/samples", [BuildType.COMPOSE])
includeProject(":compose:runtime", "compose/runtime", [BuildType.COMPOSE, BuildType.MAIN])
includeProject(":compose:runtime:runtime", "compose/runtime/runtime", [BuildType.COMPOSE, BuildType.MAIN])
includeProject(":compose:runtime:runtime-lint", "compose/runtime/runtime-lint", [BuildType.COMPOSE, BuildType.MAIN])
diff --git a/sharetarget/sharetarget/lint-baseline.xml b/sharetarget/sharetarget/lint-baseline.xml
index d9a42bd..cfec7b7 100644
--- a/sharetarget/sharetarget/lint-baseline.xml
+++ b/sharetarget/sharetarget/lint-baseline.xml
@@ -1,5 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
-<issues format="6" by="lint 7.1.0-alpha02" type="baseline" client="cli" name="Lint" variant="all" version="7.1.0-alpha02">
+<issues format="6" by="lint 7.1.0-dev" type="baseline" client="gradle" dependencies="false" name="AGP (7.1.0-dev)" variant="all" version="7.1.0-dev">
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 19 (current min is 14): `ShortcutInfoCompatSaverImpl`"
+ errorLine1=" mShortcutSaver = mock(ShortcutInfoCompatSaverImpl.class);"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/androidTest/java/androidx/sharetarget/ChooserTargetServiceCompatTest.java"
+ line="62"
+ column="31"/>
+ </issue>
<issue
id="NewApi"
diff --git a/textclassifier/integration-tests/testapp/lint-baseline.xml b/textclassifier/integration-tests/testapp/lint-baseline.xml
index d36e58b..c4374a1 100644
--- a/textclassifier/integration-tests/testapp/lint-baseline.xml
+++ b/textclassifier/integration-tests/testapp/lint-baseline.xml
@@ -1,5 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
-<issues format="6" by="lint 7.1.0-alpha02" type="baseline" client="cli" name="Lint" variant="all" version="7.1.0-alpha02">
+<issues format="6" by="lint 7.1.0-dev" type="baseline" client="gradle" dependencies="false" name="AGP (7.1.0-dev)" variant="all" version="7.1.0-dev">
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 23 (current min is 19): `MainActivity`"
+ errorLine1=" new ActivityTestRule<>(MainActivity.class);"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/androidTest/java/androidx/textclassifier/integration/testapp/MainActivityTest.java"
+ line="43"
+ column="36"/>
+ </issue>
<issue
id="SyntheticAccessor"
diff --git a/vectordrawable/integration-tests/testapp/lint-baseline.xml b/vectordrawable/integration-tests/testapp/lint-baseline.xml
index b8cad8e..497c209 100644
--- a/vectordrawable/integration-tests/testapp/lint-baseline.xml
+++ b/vectordrawable/integration-tests/testapp/lint-baseline.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<issues format="6" by="lint 7.1.0-alpha02" type="baseline" client="cli" name="Lint" variant="all" version="7.1.0-alpha02">
+<issues format="6" by="lint 7.1.0-dev" type="baseline" client="gradle" dependencies="false" name="AGP (7.1.0-dev)" variant="all" version="7.1.0-dev">
<issue
id="NewApi"
diff --git a/wear/watchface/watchface-client-guava/lint-baseline.xml b/wear/watchface/watchface-client-guava/lint-baseline.xml
new file mode 100644
index 0000000..abf1c65
--- /dev/null
+++ b/wear/watchface/watchface-client-guava/lint-baseline.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<issues format="6" by="lint 7.1.0-dev" type="baseline" client="gradle" dependencies="false" name="AGP (7.1.0-dev)" variant="all" version="7.1.0-dev">
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 27 (current min is 26): `WatchFaceControlService`"
+ errorLine1=" private val realService = object : WatchFaceControlService() {"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/androidTest/java/androidx/wear/watchface/client/guava/ListenableWatchFaceMetadataClientTest.kt"
+ line="46"
+ column="31"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 27 (current min is 26): `WatchFaceControlService`"
+ errorLine1=" private val realService = object : WatchFaceControlService() {"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/androidTest/java/androidx/wear/watchface/client/guava/ListenableWatchFaceMetadataClientTest.kt"
+ line="46"
+ column="40"/>
+ </issue>
+
+</issues>
diff --git a/wear/watchface/watchface-client/lint-baseline.xml b/wear/watchface/watchface-client/lint-baseline.xml
index 5bbd3e0..ca89a15 100644
--- a/wear/watchface/watchface-client/lint-baseline.xml
+++ b/wear/watchface/watchface-client/lint-baseline.xml
@@ -1,103 +1,59 @@
<?xml version="1.0" encoding="UTF-8"?>
-<issues format="6" by="lint 7.1.0-alpha02" type="baseline" client="cli" name="Lint" variant="all" version="7.1.0-alpha02">
+<issues format="6" by="lint 7.1.0-dev" type="baseline" client="gradle" dependencies="false" name="AGP (7.1.0-dev)" variant="all" version="7.1.0-dev">
<issue
id="NewApi"
- message="Call requires API level 26 (current min is 25): `java.util.Base64#getDecoder`"
- errorLine1=" val bytes = Base64.getDecoder().decode(String(resource.readBytes()))"
- errorLine2=" ~~~~~~~~~~">
+ message="Call requires API level 30 (current min is 26): `WatchFaceId`"
+ errorLine1=" WatchFaceId(watchFaceInstanceId ?: ""),"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
- file="src/androidTest/java/androidx/wear/watchface/client/test/SerializationTest.kt"
- line="59"
- column="28"/>
+ file="src/main/java/androidx/wear/watchface/client/EditorState.kt"
+ line="94"
+ column="9"/>
</issue>
<issue
id="NewApi"
- message="Call requires API level 26 (current min is 25): `java.util.Base64.Decoder#decode`"
- errorLine1=" val bytes = Base64.getDecoder().decode(String(resource.readBytes()))"
- errorLine2=" ~~~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/client/test/SerializationTest.kt"
- line="59"
- column="41"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 27 (current min is 25): `renderWatchFaceToBitmap`"
- errorLine1=" val bitmap = headlessInstance.renderWatchFaceToBitmap("
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/client/test/WatchFaceControlClientTest.kt"
- line="216"
- column="39"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 27 (current min is 25): `renderWatchFaceToBitmap`"
- errorLine1=" val bitmap = headlessInstance.renderWatchFaceToBitmap("
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/client/test/WatchFaceControlClientTest.kt"
- line="245"
- column="39"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 27 (current min is 25): `renderWatchFaceToBitmap`"
- errorLine1=" val bitmap = headlessInstance.renderWatchFaceToBitmap("
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/client/test/WatchFaceControlClientTest.kt"
- line="278"
- column="39"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 27 (current min is 25): `renderWatchFaceToBitmap`"
- errorLine1=" val bitmap = interactiveInstance.renderWatchFaceToBitmap("
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/client/test/WatchFaceControlClientTest.kt"
- line="411"
- column="42"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 27 (current min is 25): `renderWatchFaceToBitmap`"
- errorLine1=" val bitmap = interactiveInstance.renderWatchFaceToBitmap("
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/client/test/WatchFaceControlClientTest.kt"
- line="453"
- column="42"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 27 (current min is 25): `renderWatchFaceToBitmap`"
- errorLine1=" val bitmap = interactiveInstance.renderWatchFaceToBitmap("
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/client/test/WatchFaceControlClientTest.kt"
- line="804"
- column="42"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 27 (current min is 25): `getApiVersion`"
- errorLine1=" override fun getApiVersion(): Int = apiVersionOverride ?: super.getApiVersion()"
- errorLine2=" ~~~~~~~~~~~~~">
+ message="Call requires API level 27 (current min is 26): `WatchFaceControlService`"
+ errorLine1=" private val realService = object : WatchFaceControlService() {"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/androidTest/java/androidx/wear/watchface/client/test/WatchFaceControlTestService.kt"
- line="44"
- column="81"/>
+ line="43"
+ column="31"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 27 (current min is 26): `WatchFaceControlService`"
+ errorLine1=" private val realService = object : WatchFaceControlService() {"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/androidTest/java/androidx/wear/watchface/client/test/WatchFaceControlTestService.kt"
+ line="43"
+ column="40"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 27 (current min is 26): `IWatchFaceInstanceServiceStub`"
+ errorLine1=" object : IWatchFaceInstanceServiceStub(this, Handler(Looper.getMainLooper())) {"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/androidTest/java/androidx/wear/watchface/client/test/WatchFaceControlTestService.kt"
+ line="45"
+ column="13"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 27 (current min is 26): `IWatchFaceInstanceServiceStub`"
+ errorLine1=" object : IWatchFaceInstanceServiceStub(this, Handler(Looper.getMainLooper())) {"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/androidTest/java/androidx/wear/watchface/client/test/WatchFaceControlTestService.kt"
+ line="45"
+ column="22"/>
</issue>
</issues>
diff --git a/wear/watchface/watchface-editor/lint-baseline.xml b/wear/watchface/watchface-editor/lint-baseline.xml
index b47a5fd..79cc373 100644
--- a/wear/watchface/watchface-editor/lint-baseline.xml
+++ b/wear/watchface/watchface-editor/lint-baseline.xml
@@ -1,103 +1,48 @@
<?xml version="1.0" encoding="UTF-8"?>
-<issues format="6" by="lint 7.1.0-alpha02" type="baseline" client="cli" name="Lint" variant="all" version="7.1.0-alpha02">
+<issues format="6" by="lint 7.1.0-dev" type="baseline" client="gradle" dependencies="false" name="AGP (7.1.0-dev)" variant="all" version="7.1.0-dev">
<issue
id="NewApi"
- message="Call requires API level 30 (current min is 25): `EditorRequest`"
- errorLine1=" EditorRequest(testComponentName, testEditorPackageName, null, watchFaceId)"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ message="Call requires API level 30 (current min is 26): `getWatchFaceId`"
+ errorLine1=" watchFaceId.id"
+ errorLine2=" ~~~~~~~~~~~">
<location
- file="src/androidTest/java/androidx/wear/watchface/editor/EditingSessionTest.kt"
- line="462"
- column="17"/>
+ file="src/main/java/androidx/wear/watchface/editor/EditorSession.kt"
+ line="510"
+ column="21"/>
</issue>
<issue
id="NewApi"
- message="Call requires API level 30 (current min is 25): `watchFaceId`"
- errorLine1=" assertThat(result.watchFaceId.id).isEqualTo(testInstanceId.id)"
- errorLine2=" ~~~~~~~~~~~">
+ message="Call requires API level 30 (current min is 26): `getWatchFaceId`"
+ errorLine1=" watchFaceId.id,"
+ errorLine2=" ~~~~~~~~~~~">
<location
- file="src/androidTest/java/androidx/wear/watchface/editor/EditingSessionTest.kt"
- line="1164"
- column="27"/>
+ file="src/main/java/androidx/wear/watchface/editor/EditorSession.kt"
+ line="697"
+ column="29"/>
</issue>
<issue
id="NewApi"
- message="Call requires API level 30 (current min is 25): `watchFaceId`"
- errorLine1=" assertThat(result.watchFaceId.id).isEmpty()"
- errorLine2=" ~~~~~~~~~~~">
+ message="Call requires API level 30 (current min is 26): `getWatchFaceId`"
+ errorLine1=" assertThat(it.editorSession.watchFaceId.id).isEqualTo(testInstanceId.id)"
+ errorLine2=" ~~~~~~~~~~~">
<location
- file="src/androidTest/java/androidx/wear/watchface/editor/EditingSessionTest.kt"
- line="1219"
- column="27"/>
+ file="src/androidTest/java/androidx/wear/watchface/editor/EditorSessionTest.kt"
+ line="668"
+ column="41"/>
</issue>
<issue
id="NewApi"
- message="Call requires API level 30 (current min is 25): `EditorRequest`"
- errorLine1=" EditorRequest(testComponentName, testEditorPackageName, null, testInstanceId)"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ message="Call requires API level 30 (current min is 26): `getWatchFaceId`"
+ errorLine1=" assertThat(activity.editorSession.watchFaceId.id).isEqualTo(testInstanceId.id)"
+ errorLine2=" ~~~~~~~~~~~">
<location
- file="src/androidTest/java/androidx/wear/watchface/editor/EditingSessionTest.kt"
- line="1346"
- column="17"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 30 (current min is 25): `EditorRequest`"
- errorLine1=" EditorRequest("
- errorLine2=" ^">
- <location
- file="src/androidTest/java/androidx/wear/watchface/editor/EditingSessionTest.kt"
- line="1399"
- column="17"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 30 (current min is 25): `EditorRequest`"
- errorLine1=" EditorRequest(testComponentName, testEditorPackageName, null, watchFaceId)"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/editor/EditingSessionTest.kt"
- line="1545"
- column="17"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 28 (current min is 25): `android.graphics.drawable.Icon#getType`"
- errorLine1=" assertThat(actual.icon.type).isEqualTo(expected.icon.type)"
- errorLine2=" ~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/editor/EditingSessionTest.kt"
- line="1624"
- column="36"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 28 (current min is 25): `android.graphics.drawable.Icon#getType`"
- errorLine1=" assertThat(actual.icon.type).isEqualTo(expected.icon.type)"
- errorLine2=" ~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/editor/EditingSessionTest.kt"
- line="1624"
- column="66"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 30 (current min is 25): `EditorRequest`"
- errorLine1=" EditorRequest(testComponentName, testEditorPackageName, null, watchFaceId)"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/editor/EditorSessionGuavaTest.kt"
- line="137"
- column="17"/>
+ file="src/androidTest/java/androidx/wear/watchface/editor/EditorSessionTest.kt"
+ line="687"
+ column="43"/>
</issue>
</issues>
diff --git a/wear/watchface/watchface-guava/lint-baseline.xml b/wear/watchface/watchface-guava/lint-baseline.xml
new file mode 100644
index 0000000..7411d6e
--- /dev/null
+++ b/wear/watchface/watchface-guava/lint-baseline.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<issues format="6" by="lint 7.1.0-dev" type="baseline" client="gradle" dependencies="false" name="AGP (7.1.0-dev)" variant="all" version="7.1.0-dev">
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 27 (current min is 26): `WatchFaceControlService`"
+ errorLine1=" private val realService = object : WatchFaceControlService() {"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/androidTest/java/androidx/wear/watchface/test/WatchFaceControlTestService.kt"
+ line="62"
+ column="31"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 27 (current min is 26): `WatchFaceControlService`"
+ errorLine1=" private val realService = object : WatchFaceControlService() {"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/androidTest/java/androidx/wear/watchface/test/WatchFaceControlTestService.kt"
+ line="62"
+ column="40"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 27 (current min is 26): `IWatchFaceInstanceServiceStub`"
+ errorLine1=" object : IWatchFaceInstanceServiceStub(this, Handler(Looper.getMainLooper())) {"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/androidTest/java/androidx/wear/watchface/test/WatchFaceControlTestService.kt"
+ line="64"
+ column="13"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 27 (current min is 26): `IWatchFaceInstanceServiceStub`"
+ errorLine1=" object : IWatchFaceInstanceServiceStub(this, Handler(Looper.getMainLooper())) {"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/androidTest/java/androidx/wear/watchface/test/WatchFaceControlTestService.kt"
+ line="64"
+ column="22"/>
+ </issue>
+
+</issues>
diff --git a/wear/watchface/watchface/lint-baseline.xml b/wear/watchface/watchface/lint-baseline.xml
index 0dbe68b..d18e470 100644
--- a/wear/watchface/watchface/lint-baseline.xml
+++ b/wear/watchface/watchface/lint-baseline.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<issues format="6" by="lint 7.1.0-alpha03" type="baseline" client="gradle" name="AGP (7.1.0-alpha03)" variant="all" version="7.1.0-alpha03">
+<issues format="6" by="lint 7.1.0-dev" type="baseline" client="gradle" dependencies="false" name="AGP (7.1.0-dev)" variant="all" version="7.1.0-dev">
<issue
id="MissingClass"
@@ -58,419 +58,23 @@
<issue
id="NewApi"
- message="Call requires API level 27 (current min is 25): `createInteractiveInstance$lint_module`"
- errorLine1=" engineWrapper.createInteractiveInstance(initParams, "test")"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
+ message="Call requires API level 27 (current min is 26): `dump`"
+ errorLine1=" HeadlessWatchFaceImpl.dump(indentingPrintWriter)"
+ errorLine2=" ~~~~">
<location
- file="src/test/java/androidx/wear/watchface/AsyncWatchFaceInitTest.kt"
- line="220"
+ file="src/main/java/androidx/wear/watchface/WatchFaceService.kt"
+ line="1845"
column="31"/>
</issue>
<issue
- id="NewApi"
- message="Call requires API level 27 (current min is 25): `getExistingInstanceOrSetPendingWallpaperInteractiveWatchFaceInstance`"
- errorLine1=" .getExistingInstanceOrSetPendingWallpaperInteractiveWatchFaceInstance("
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/test/java/androidx/wear/watchface/AsyncWatchFaceInitTest.kt"
- line="242"
- column="18"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 27 (current min is 25): `WatchFaceControlService`"
- errorLine1=" WatchFaceControlService().apply {"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/test/WatchFaceControlServiceTest.kt"
- line="111"
- column="13"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 27 (current min is 25): `setContext`"
- errorLine1=" setContext(ApplicationProvider.getApplicationContext<Context>())"
- errorLine2=" ~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/test/WatchFaceControlServiceTest.kt"
- line="112"
- column="17"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 27 (current min is 25): `onBind`"
- errorLine1=" }.onBind("
- errorLine2=" ~~~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/test/WatchFaceControlServiceTest.kt"
- line="113"
- column="15"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 27 (current min is 25): `ACTION_WATCHFACE_CONTROL_SERVICE`"
- errorLine1=" Intent(WatchFaceControlService.ACTION_WATCHFACE_CONTROL_SERVICE)"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/test/WatchFaceControlServiceTest.kt"
- line="114"
- column="48"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 27 (current min is 25): `WatchFaceControlService`"
- errorLine1=" WatchFaceControlService().apply {"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/test/WatchFaceControlServiceTest.kt"
- line="137"
- column="13"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 27 (current min is 25): `setContext`"
- errorLine1=" setContext(ApplicationProvider.getApplicationContext<Context>())"
- errorLine2=" ~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/test/WatchFaceControlServiceTest.kt"
- line="138"
- column="17"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 27 (current min is 25): `onBind`"
- errorLine1=" }.onBind("
- errorLine2=" ~~~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/test/WatchFaceControlServiceTest.kt"
- line="139"
- column="15"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 27 (current min is 25): `ACTION_WATCHFACE_CONTROL_SERVICE`"
- errorLine1=" Intent(WatchFaceControlService.ACTION_WATCHFACE_CONTROL_SERVICE)"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/test/WatchFaceControlServiceTest.kt"
- line="140"
- column="48"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 27 (current min is 25): `ashmemReadImageBundle`"
- errorLine1=" val bitmap = SharedMemoryImage.ashmemReadImageBundle("
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/test/WatchFaceControlServiceTest.kt"
- line="164"
- column="40"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 27 (current min is 25): `ashmemReadImageBundle`"
- errorLine1=" val bitmap = SharedMemoryImage.ashmemReadImageBundle("
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/test/WatchFaceControlServiceTest.kt"
- line="208"
- column="40"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 27 (current min is 25): `ashmemReadImageBundle`"
- errorLine1=" val bitmap = SharedMemoryImage.ashmemReadImageBundle("
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/test/WatchFaceControlServiceTest.kt"
- line="242"
- column="40"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 27 (current min is 25): `WatchFaceControlService`"
- errorLine1=" WatchFaceControlService().apply {"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/test/WatchFaceControlServiceTest.kt"
- line="275"
- column="13"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 27 (current min is 25): `setContext`"
- errorLine1=" setContext(ApplicationProvider.getApplicationContext<Context>())"
- errorLine2=" ~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/test/WatchFaceControlServiceTest.kt"
- line="276"
- column="17"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 27 (current min is 25): `onBind`"
- errorLine1=" }.onBind("
- errorLine2=" ~~~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/test/WatchFaceControlServiceTest.kt"
- line="277"
- column="15"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 27 (current min is 25): `ACTION_WATCHFACE_CONTROL_SERVICE`"
- errorLine1=" Intent(WatchFaceControlService.ACTION_WATCHFACE_CONTROL_SERVICE)"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/test/WatchFaceControlServiceTest.kt"
- line="278"
- column="48"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 26 (current min is 25): `android.graphics.SurfaceTexture()`"
- errorLine1=" private val surfaceTexture = SurfaceTexture(false)"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/test/WatchFaceServiceImageTest.kt"
- line="292"
- column="34"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 26 (current min is 25): `android.view.SurfaceHolder#lockHardwareCanvas`"
- errorLine1=" Mockito.`when`(surfaceHolder.lockHardwareCanvas()).thenReturn(canvas)"
- errorLine2=" ~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/test/WatchFaceServiceImageTest.kt"
- line="330"
- column="38"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 26 (current min is 25): `android.view.SurfaceHolder#lockHardwareCanvas`"
- errorLine1=" Mockito.`when`(surfaceHolder.lockHardwareCanvas()).thenReturn(canvas)"
- errorLine2=" ~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/test/WatchFaceServiceImageTest.kt"
- line="368"
- column="38"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 27 (current min is 25): `getExistingInstanceOrSetPendingWallpaperInteractiveWatchFaceInstance`"
- errorLine1=" .getExistingInstanceOrSetPendingWallpaperInteractiveWatchFaceInstance("
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/test/WatchFaceServiceImageTest.kt"
- line="413"
- column="14"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 27 (current min is 25): `setWatchUiState`"
- errorLine1=" interactiveWatchFaceInstance.setWatchUiState("
- errorLine2=" ~~~~~~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/test/WatchFaceServiceImageTest.kt"
- line="463"
- column="38"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 27 (current min is 25): `release`"
- errorLine1=" interactiveWatchFaceInstance.release()"
- errorLine2=" ~~~~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/test/WatchFaceServiceImageTest.kt"
- line="469"
- column="38"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 26 (current min is 25): `android.view.SurfaceHolder#lockHardwareCanvas`"
- errorLine1=" Mockito.`when`(surfaceHolder.lockHardwareCanvas()).thenReturn(canvas)"
- errorLine2=" ~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/wear/watchface/test/WatchFaceServiceImageTest.kt"
- line="802"
- column="38"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 27 (current min is 25): `getExistingInstanceOrSetPendingWallpaperInteractiveWatchFaceInstance`"
- errorLine1=" .getExistingInstanceOrSetPendingWallpaperInteractiveWatchFaceInstance("
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/test/java/androidx/wear/watchface/WatchFaceServiceTest.kt"
- line="434"
- column="14"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 27 (current min is 25): `getExistingInstanceOrSetPendingWallpaperInteractiveWatchFaceInstance`"
- errorLine1=" .getExistingInstanceOrSetPendingWallpaperInteractiveWatchFaceInstance("
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/test/java/androidx/wear/watchface/WatchFaceServiceTest.kt"
- line="2699"
- column="14"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 27 (current min is 25): `updateComplicationData`"
- errorLine1=" interactiveInstance!!.updateComplicationData("
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/test/java/androidx/wear/watchface/WatchFaceServiceTest.kt"
- line="2765"
- column="31"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 29 (current min is 25): `android.view.WindowInsets.Builder#setSystemWindowInsets`"
- errorLine1=" WindowInsets.Builder().setSystemWindowInsets("
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/test/java/androidx/wear/watchface/WatchFaceServiceTest.kt"
- line="2939"
- column="32"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 29 (current min is 25): `android.view.WindowInsets.Builder()`"
- errorLine1=" WindowInsets.Builder().setSystemWindowInsets("
- errorLine2=" ~~~~~~~~~">
- <location
- file="src/test/java/androidx/wear/watchface/WatchFaceServiceTest.kt"
- line="2939"
- column="22"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 29 (current min is 25): `android.graphics.Insets#of`"
- errorLine1=" Insets.of(0, 0, 0, chinHeight)"
- errorLine2=" ~~">
- <location
- file="src/test/java/androidx/wear/watchface/WatchFaceServiceTest.kt"
- line="2940"
- column="20"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 29 (current min is 25): `android.view.WindowInsets.Builder#build`"
- errorLine1=" ).build()"
- errorLine2=" ~~~~~">
- <location
- file="src/test/java/androidx/wear/watchface/WatchFaceServiceTest.kt"
- line="2941"
- column="11"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 29 (current min is 25): `android.view.WindowInsets.Builder()`"
- errorLine1=" WindowInsets.Builder().setInsets("
- errorLine2=" ~~~~~~~~~">
- <location
- file="src/test/java/androidx/wear/watchface/WatchFaceServiceTest.kt"
- line="2944"
- column="22"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 30 (current min is 25): `android.view.WindowInsets.Builder#setInsets`"
- errorLine1=" WindowInsets.Builder().setInsets("
- errorLine2=" ~~~~~~~~~">
- <location
- file="src/test/java/androidx/wear/watchface/WatchFaceServiceTest.kt"
- line="2944"
- column="32"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 30 (current min is 25): `android.view.WindowInsets.Type#systemBars`"
- errorLine1=" WindowInsets.Type.systemBars(),"
- errorLine2=" ~~~~~~~~~~">
- <location
- file="src/test/java/androidx/wear/watchface/WatchFaceServiceTest.kt"
- line="2945"
- column="31"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 29 (current min is 25): `android.graphics.Insets#of`"
- errorLine1=" Insets.of(Rect().apply { bottom = chinHeight })"
- errorLine2=" ~~">
- <location
- file="src/test/java/androidx/wear/watchface/WatchFaceServiceTest.kt"
- line="2946"
- column="20"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 29 (current min is 25): `android.view.WindowInsets.Builder#build`"
- errorLine1=" ).build()"
- errorLine2=" ~~~~~">
- <location
- file="src/test/java/androidx/wear/watchface/WatchFaceServiceTest.kt"
- line="2947"
- column="11"/>
- </issue>
-
- <issue
- id="WrongThread"
- message="Method addUserStyleChangeListener must be called from the UI thread, currently inferred thread is worker thread"
- errorLine1=" currentUserStyleRepository.addUserStyleChangeListener("
- errorLine2=" ^">
- <location
- file="src/test/java/androidx/wear/watchface/TestCommon.kt"
- line="89"
- column="9"/>
- </issue>
-
- <issue
id="WrongThread"
message="Method addTapListener must be called from the UI thread, currently inferred thread is worker thread"
errorLine1=" complicationSlotsManager.addTapListener("
errorLine2=" ^">
<location
file="src/test/java/androidx/wear/watchface/TestCommon.kt"
- line="99"
+ line="91"
column="9"/>
</issue>
@@ -481,7 +85,7 @@
errorLine2=" ~~~~~~~~~~~~">
<location
file="src/main/java/androidx/wear/watchface/WatchFace.kt"
- line="593"
+ line="601"
column="44"/>
</issue>
diff --git a/window/window/lint-baseline.xml b/window/window/lint-baseline.xml
index dee0155..46c5630 100644
--- a/window/window/lint-baseline.xml
+++ b/window/window/lint-baseline.xml
@@ -1,81 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
-<issues format="6" by="lint 7.1.0-alpha02" type="baseline" client="cli" name="Lint" variant="all" version="7.1.0-alpha02">
+<issues format="6" by="lint 7.1.0-dev" type="baseline" client="gradle" dependencies="false" name="AGP (7.1.0-dev)" variant="all" version="7.1.0-dev">
<issue
- id="NewApi"
- message="Call requires API level 24 (current min is 14): `java.util.Collection#removeIf`"
- errorLine1=" consumers.removeIf { it.callback == callback }"
- errorLine2=" ~~~~~~~~">
+ id="SupportAnnotationUsage"
+ message="Did you mean `@get:VisibleForTesting` ? Without `get:` this annotates the constructor parameter itself instead of the associated getter."
+ errorLine1=" @VisibleForTesting"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~">
<location
- file="src/androidTest/java/androidx/window/WindowInfoRepoImpTest.kt"
- line="115"
- column="23"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 30 (current min is 14): `android.view.WindowManager#getCurrentWindowMetrics`"
- errorLine1=" val windowMetricsBounds = activity.windowManager.currentWindowMetrics.bounds"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/window/WindowMetricsCalculatorCompatTest.kt"
- line="112"
- column="62"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 30 (current min is 14): `android.view.WindowMetrics#getBounds`"
- errorLine1=" val windowMetricsBounds = activity.windowManager.currentWindowMetrics.bounds"
- errorLine2=" ~~~~~~">
- <location
- file="src/androidTest/java/androidx/window/WindowMetricsCalculatorCompatTest.kt"
- line="112"
- column="83"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 30 (current min is 14): `android.view.WindowManager#getMaximumWindowMetrics`"
- errorLine1=" val windowMetricsBounds = activity.windowManager.maximumWindowMetrics.bounds"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/window/WindowMetricsCalculatorCompatTest.kt"
- line="186"
- column="62"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 30 (current min is 14): `android.view.WindowMetrics#getBounds`"
- errorLine1=" val windowMetricsBounds = activity.windowManager.maximumWindowMetrics.bounds"
- errorLine2=" ~~~~~~">
- <location
- file="src/androidTest/java/androidx/window/WindowMetricsCalculatorCompatTest.kt"
- line="186"
- column="83"/>
- </issue>
-
- <issue
- id="SyntheticAccessor"
- message="Access to `private` method `toggleState` of class `Companion` requires synthetic accessor"
- errorLine1=" lock.withLock { state = toggleState(state) }"
- errorLine2=" ~~~~~~~~~~~">
- <location
- file="src/testUtil/java/androidx/window/SwitchOnUnregisterExtensionInterfaceCompat.kt"
- line="52"
- column="33"/>
- </issue>
-
- <issue
- id="SyntheticAccessor"
- message="Access to `private` method `toggleState` of class `Companion` requires synthetic accessor"
- errorLine1=" lock.withLock { state = toggleState(state) }"
- errorLine2=" ~~~~~~~~~~~">
- <location
- file="src/testUtil/java/androidx/window/SwitchOnUnregisterExtensionInterfaceCompat.kt"
- line="52"
- column="33"/>
+ file="src/main/java/androidx/window/layout/SidecarCompat.kt"
+ line="50"
+ column="5"/>
</issue>
</issues>
diff --git a/work/work-runtime/lint-baseline.xml b/work/work-runtime/lint-baseline.xml
index 27ddc53..e0e0f58 100644
--- a/work/work-runtime/lint-baseline.xml
+++ b/work/work-runtime/lint-baseline.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<issues format="6" by="lint 7.1.0-alpha02" type="baseline" client="cli" name="Lint" variant="all" version="7.1.0-alpha02">
+<issues format="6" by="lint 7.2.0-dev" type="baseline" client="gradle" dependencies="false" name="AGP (7.2.0-dev)" variant="all" version="7.2.0-dev">
<issue
id="NewApi"
@@ -16,6 +16,17 @@
id="NewApi"
message="Call requires API level 24 (current min is 23): `getTriggeredContentAuthorities`"
errorLine1=" sTriggeredContentAuthorities = getTriggeredContentAuthorities();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/androidTest/java/androidx/work/impl/background/systemjob/SystemJobServiceTest.java"
+ line="304"
+ column="17"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 24 (current min is 23): `getTriggeredContentAuthorities`"
+ errorLine1=" sTriggeredContentAuthorities = getTriggeredContentAuthorities();"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/androidTest/java/androidx/work/impl/background/systemjob/SystemJobServiceTest.java"
@@ -27,6 +38,17 @@
id="NewApi"
message="Call requires API level 24 (current min is 23): `getTriggeredContentUris`"
errorLine1=" sTriggeredContentUris = getTriggeredContentUris();"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/androidTest/java/androidx/work/impl/background/systemjob/SystemJobServiceTest.java"
+ line="305"
+ column="17"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 24 (current min is 23): `getTriggeredContentUris`"
+ errorLine1=" sTriggeredContentUris = getTriggeredContentUris();"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~">
<location
file="src/androidTest/java/androidx/work/impl/background/systemjob/SystemJobServiceTest.java"
@@ -38,6 +60,17 @@
id="NewApi"
message="Call requires API level 28 (current min is 23): `getNetwork`"
errorLine1=" sNetwork = getNetwork();"
+ errorLine2=" ~~~~~~~~">
+ <location
+ file="src/androidTest/java/androidx/work/impl/background/systemjob/SystemJobServiceTest.java"
+ line="325"
+ column="17"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 28 (current min is 23): `getNetwork`"
+ errorLine1=" sNetwork = getNetwork();"
errorLine2=" ~~~~~~~~~~">
<location
file="src/androidTest/java/androidx/work/impl/background/systemjob/SystemJobServiceTest.java"
@@ -47,50 +80,6 @@
<issue
id="NewApi"
- message="Call requires API level 24 (current min is 23): `addContentUriTrigger`"
- errorLine1=" .addContentUriTrigger(testUri1, true)"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/work/impl/WorkManagerImplTest.java"
- line="367"
- column="34"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 24 (current min is 23): `addContentUriTrigger`"
- errorLine1=" .addContentUriTrigger(testUri2, false)"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/work/impl/WorkManagerImplTest.java"
- line="368"
- column="34"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 24 (current min is 23): `getContentUriTriggers`"
- errorLine1=" assertThat(constraints.getContentUriTriggers(), is(new ContentUriTriggers()));"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/work/impl/WorkManagerImplTest.java"
- line="391"
- column="36"/>
- </issue>
-
- <issue
- id="NewApi"
- message="Call requires API level 24 (current min is 23): `getContentUriTriggers`"
- errorLine1=" assertThat(constraints.getContentUriTriggers().size(), is(0));"
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/androidTest/java/androidx/work/impl/WorkManagerImplTest.java"
- line="401"
- column="32"/>
- </issue>
-
- <issue
- id="NewApi"
message="Call requires API level 24 (current min is 14): `getTriggeredContentAuthorities`"
errorLine1=" assertThat(worker.getTriggeredContentAuthorities(),"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
@@ -195,7 +184,7 @@
errorLine2=" ~~~~~~~~">
<location
file="src/main/java/androidx/work/impl/background/systemalarm/Alarms.java"
- line="128"
+ line="134"
column="30"/>
</issue>
@@ -223,39 +212,6 @@
<issue
id="ClassVerificationFailure"
- message="This call references a method added in API level 30; however, the containing class androidx.work.impl.utils.ForceStopRunnable is reachable from earlier API levels and will fail run-time class verification."
- errorLine1=" activityManager.getHistoricalProcessExitReasons("
- errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
- <location
- file="src/main/java/androidx/work/impl/utils/ForceStopRunnable.java"
- line="171"
- column="41"/>
- </issue>
-
- <issue
- id="ClassVerificationFailure"
- message="This call references a method added in API level 30; however, the containing class androidx.work.impl.utils.ForceStopRunnable is reachable from earlier API levels and will fail run-time class verification."
- errorLine1=" if (info.getReason() == REASON_USER_REQUESTED) {"
- errorLine2=" ~~~~~~~~~">
- <location
- file="src/main/java/androidx/work/impl/utils/ForceStopRunnable.java"
- line="180"
- column="34"/>
- </issue>
-
- <issue
- id="ClassVerificationFailure"
- message="This call references a method added in API level 19; however, the containing class androidx.work.impl.utils.ForceStopRunnable is reachable from earlier API levels and will fail run-time class verification."
- errorLine1=" alarmManager.setExact(RTC_WAKEUP, triggerAt, pendingIntent);"
- errorLine2=" ~~~~~~~~">
- <location
- file="src/main/java/androidx/work/impl/utils/ForceStopRunnable.java"
- line="339"
- column="30"/>
- </issue>
-
- <issue
- id="ClassVerificationFailure"
message="This call references a method added in API level 24; however, the containing class androidx.work.impl.constraints.trackers.NetworkStateTracker is reachable from earlier API levels and will fail run-time class verification."
errorLine1=" mConnectivityManager.registerDefaultNetworkCallback(mNetworkCallback);"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~">
@@ -349,7 +305,7 @@
errorLine2=" ~~~~~~~~~~~~~~">
<location
file="src/main/java/androidx/work/impl/utils/ProcessUtils.java"
- line="77"
+ line="76"
column="32"/>
</issue>
diff --git a/work/work-testing/lint-baseline.xml b/work/work-testing/lint-baseline.xml
index b84652dd..448cbb6 100644
--- a/work/work-testing/lint-baseline.xml
+++ b/work/work-testing/lint-baseline.xml
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<issues format="6" by="lint 7.1.0-alpha02" type="baseline" client="cli" name="Lint" variant="all" version="7.1.0-alpha02">
+<issues format="6" by="lint 7.1.0-dev" type="baseline" client="gradle" dependencies="false" name="AGP (7.1.0-dev)" variant="all" version="7.1.0-dev">
<issue
id="NewApi"
@@ -36,6 +36,28 @@
<issue
id="NewApi"
+ message="Call requires API level 24 (current min is 14): `getTriggeredContentAuthorities`"
+ errorLine1=" assertThat(worker.triggeredContentAuthorities, containsInAnyOrder(*authorities))"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/androidTest/java/androidx/work/testing/TestWorkerBuilderTest.kt"
+ line="109"
+ column="27"/>
+ </issue>
+
+ <issue
+ id="NewApi"
+ message="Call requires API level 24 (current min is 14): `getTriggeredContentUris`"
+ errorLine1=" assertThat(worker.triggeredContentUris, containsInAnyOrder(*contentUris))"
+ errorLine2=" ~~~~~~~~~~~~~~~~~~~~">
+ <location
+ file="src/androidTest/java/androidx/work/testing/TestWorkerBuilderTest.kt"
+ line="110"
+ column="27"/>
+ </issue>
+
+ <issue
+ id="NewApi"
message="Call requires API level 24 (current min is 14): `getTriggeredContentUris`"
errorLine1=" assertThat(worker.triggeredContentUris, containsInAnyOrder(*contentUris))"
errorLine2=" ~~~~~~~~~~~~~~~~~~~~">