From 5b9be33274c2896edf5bf510f49f46bc0030d6d4 Mon Sep 17 00:00:00 2001 From: Summers Pittman Date: Wed, 4 Sep 2024 17:14:32 -0400 Subject: [PATCH 1/2] This commit performs minor maintenance and a bug fix updating gradle updating AGP DragAndDropRichContentReceiverFragment is marked as requiresApi 31 --- gradle/libs.versions.toml | 2 +- gradle/wrapper/gradle-wrapper.properties | 2 +- samples/README.md | 2 +- .../user-interface/draganddrop/src/main/AndroidManifest.xml | 3 +-- .../ui/draganddrop/DragAndDropRichContentReceiverFragment.kt | 1 + .../example/platform/ui/draganddrop/DragAndDropWithHelper.kt | 1 + .../example/platform/ui/draganddrop/DragAndDropWithViews.kt | 1 + 7 files changed, 7 insertions(+), 5 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 244e8c09..4d421fed 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -18,7 +18,7 @@ accompanist = "0.32.0" androidx-datastore = "1.0.0" androidx-navigation = "2.7.7" androidx-window = "1.2.0" -agp = "8.2.2" +agp = "8.5.2" casa = "0.5.1" coil = "2.4.0" ksp = "1.9.22-1.0.17" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 3ce71f6b..6c2244bb 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -17,6 +17,6 @@ #Wed Dec 07 13:21:03 CET 2022 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/samples/README.md b/samples/README.md index 3c26a020..b0148535 100644 --- a/samples/README.md +++ b/samples/README.md @@ -53,7 +53,7 @@ Shows various vibration effects. - [Hyphenation](user-interface/text/src/main/java/com/example/platform/ui/text/Hyphenation.kt): Demonstrates different options for the `android:hyphenationFrequency` attribute - [Image Capture](camera/camera2/src/main/java/com/example/platform/camera/imagecapture/Camera2ImageCapture.kt): -This sample demonstrates how to capture and image using Camera2 and encode it +This sample demonstrates how to capture an image using Camera2 and encode it - [Immersive mode](user-interface/window-insets/src/main/java/com/example/platform/ui/insets/ImmersiveMode.kt): Immersive mode enables your app to display full-screen by hiding system bars. - [LineBreak](user-interface/text/src/main/java/com/example/platform/ui/text/LineBreak.kt): diff --git a/samples/user-interface/draganddrop/src/main/AndroidManifest.xml b/samples/user-interface/draganddrop/src/main/AndroidManifest.xml index 99416cee..cfb70945 100644 --- a/samples/user-interface/draganddrop/src/main/AndroidManifest.xml +++ b/samples/user-interface/draganddrop/src/main/AndroidManifest.xml @@ -16,8 +16,7 @@ - - + diff --git a/samples/user-interface/draganddrop/src/main/java/com/example/platform/ui/draganddrop/DragAndDropRichContentReceiverFragment.kt b/samples/user-interface/draganddrop/src/main/java/com/example/platform/ui/draganddrop/DragAndDropRichContentReceiverFragment.kt index 748ea645..4b29a417 100644 --- a/samples/user-interface/draganddrop/src/main/java/com/example/platform/ui/draganddrop/DragAndDropRichContentReceiverFragment.kt +++ b/samples/user-interface/draganddrop/src/main/java/com/example/platform/ui/draganddrop/DragAndDropRichContentReceiverFragment.kt @@ -49,6 +49,7 @@ import java.io.FileOutputStream description = "Using RichContentReceiverInterface for implementing Drop for rich data types", documentation = "https://developer.android.com/develop/ui/views/receive-rich-content", ) +@RequiresApi(Build.VERSION_CODES.S) class DragAndDropRichContentReceiverFragment : Fragment(R.layout.fragment_dnd_richcontent) { private val TAG = DragAndDropRichContentReceiverFragment::class.java.simpleName private lateinit var binding: FragmentDndRichcontentBinding diff --git a/samples/user-interface/draganddrop/src/main/java/com/example/platform/ui/draganddrop/DragAndDropWithHelper.kt b/samples/user-interface/draganddrop/src/main/java/com/example/platform/ui/draganddrop/DragAndDropWithHelper.kt index f124cf73..0e0187c3 100644 --- a/samples/user-interface/draganddrop/src/main/java/com/example/platform/ui/draganddrop/DragAndDropWithHelper.kt +++ b/samples/user-interface/draganddrop/src/main/java/com/example/platform/ui/draganddrop/DragAndDropWithHelper.kt @@ -39,6 +39,7 @@ import com.google.android.catalog.framework.annotations.Sample description = "Drag and Drop using the DragHelper and DropHelper from DragAndDropHelper library", documentation = "https://developer.android.com/develop/ui/views/touch-and-input/drag-drop#drophelper", ) +@RequiresApi(Build.VERSION_CODES.N) class DragAndDropWithHelper : Fragment(R.layout.fragment_drag_and_drop_with_helper) { private lateinit var binding: FragmentDragAndDropWithHelperBinding diff --git a/samples/user-interface/draganddrop/src/main/java/com/example/platform/ui/draganddrop/DragAndDropWithViews.kt b/samples/user-interface/draganddrop/src/main/java/com/example/platform/ui/draganddrop/DragAndDropWithViews.kt index ebbdb6db..f9f25961 100644 --- a/samples/user-interface/draganddrop/src/main/java/com/example/platform/ui/draganddrop/DragAndDropWithViews.kt +++ b/samples/user-interface/draganddrop/src/main/java/com/example/platform/ui/draganddrop/DragAndDropWithViews.kt @@ -37,6 +37,7 @@ import com.google.android.catalog.framework.annotations.Sample description = "Drag and Drop using the views", documentation = "https://developer.android.com/develop/ui/views/touch-and-input/drag-drop/view", ) +@RequiresApi(Build.VERSION_CODES.N) class DragAndDropWithViews : Fragment(R.layout.fragment_drag_and_drop_with_views) { val TAG = "DragAndDropWithViews" From ada3ddc8dc5db1296c1c444d8f7c74e912199e60 Mon Sep 17 00:00:00 2001 From: Yacine Rezgui Date: Wed, 4 Sep 2024 16:19:30 +0200 Subject: [PATCH 2/2] Fix failing Ultra HDR sample on emulator --- .../graphics/ultrahdr/opengl/UltraHDRWithOpenGL.kt | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/samples/graphics/ultrahdr/src/main/java/com/example/platform/graphics/ultrahdr/opengl/UltraHDRWithOpenGL.kt b/samples/graphics/ultrahdr/src/main/java/com/example/platform/graphics/ultrahdr/opengl/UltraHDRWithOpenGL.kt index 212bf6fb..becc8c74 100644 --- a/samples/graphics/ultrahdr/src/main/java/com/example/platform/graphics/ultrahdr/opengl/UltraHDRWithOpenGL.kt +++ b/samples/graphics/ultrahdr/src/main/java/com/example/platform/graphics/ultrahdr/opengl/UltraHDRWithOpenGL.kt @@ -182,8 +182,11 @@ class UltraHDRWithOpenGL : Fragment(), } override fun onAttach(context: Context) { - requireActivity().display - ?.registerHdrSdrRatioChangedListener(Runnable::run, updateHdrSdrRatio) + requireActivity().display?.let { display -> + if (display.isHdrSdrRatioAvailable) { + display.registerHdrSdrRatioChangedListener(Runnable::run, updateHdrSdrRatio) + } + } super.onAttach(context) }