diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-10-05 03:18:55 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2023-10-05 03:18:55 +0000 |
commit | e7cc2a098cbf1a557e49b60f3b057b05d981e3be (patch) | |
tree | 2bc3ff341f59555bc17f3f90de282af749c267e8 | |
parent | f5b69afb2a10ebbd1d2ee43c4de23389a43021f3 (diff) | |
parent | 2aad4bb7a40586aa62188c285afa34e4ed09e102 (diff) | |
download | layoutlib-e7cc2a098cbf1a557e49b60f3b057b05d981e3be.tar.gz |
Snap for 10903783 from 2aad4bb7a40586aa62188c285afa34e4ed09e102 to 24Q1-release
Change-Id: I2a72bc0d60de67eaee99bbcd04c7db1b07e4f9ce
3 files changed, 8 insertions, 1 deletions
diff --git a/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java b/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java index ec775b2ec9..de7f651bab 100644 --- a/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java +++ b/bridge/src/com/android/layoutlib/bridge/impl/RenderSessionImpl.java @@ -91,6 +91,7 @@ import java.util.ArrayList; import java.util.IdentityHashMap; import java.util.List; import java.util.Map; +import java.util.function.Consumer; import java.util.function.Function; import static android.os._Original_Build.VERSION.SDK_INT; @@ -590,6 +591,11 @@ public class RenderSessionImpl extends RenderAction<SessionParams> { mSystemViewInfoList = visitAllChildren(mViewRoot, 0, 0, params, false); + Consumer<BufferedImage> imageTransformation = getParams().getImageTransformation(); + if (imageTransformation != null) { + imageTransformation.accept(mImage); + } + boolean enableLayoutValidation = Boolean.TRUE.equals(params.getFlag(RenderParamsFlags.FLAG_ENABLE_LAYOUT_VALIDATOR)); boolean enableLayoutValidationImageCheck = Boolean.TRUE.equals( params.getFlag(RenderParamsFlags.FLAG_ENABLE_LAYOUT_VALIDATOR_IMAGE_CHECK)); diff --git a/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java b/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java index 4200537f40..358795f256 100644 --- a/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java +++ b/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java @@ -111,7 +111,7 @@ import static android.content.res.AssetManager.ACCESS_STREAMING; public final class ResourceHelper { private static final Key<Set<ResourceValue>> KEY_GET_DRAWABLE = Key.create("ResourceHelper.getDrawable"); - private static final Pattern sFloatPattern = Pattern.compile("(-?[0-9]*(?:\\.[0-9]+)?)(.*)"); + private static final Pattern sFloatPattern = Pattern.compile("(-?[0-9]*(?:\\.[0-9]*)?)(.*)"); private static final float[] sFloatOut = new float[1]; private static final TypedValue mValue = new TypedValue(); diff --git a/bridge/tests/src/android/content/res/BridgeTypedArrayTest.java b/bridge/tests/src/android/content/res/BridgeTypedArrayTest.java index 39759279a3..dba0f76ee8 100644 --- a/bridge/tests/src/android/content/res/BridgeTypedArrayTest.java +++ b/bridge/tests/src/android/content/res/BridgeTypedArrayTest.java @@ -52,6 +52,7 @@ public class BridgeTypedArrayTest { assertEquals(TYPE_STRING, BridgeTypedArray.getType("#notacolor")); assertEquals(TYPE_DIMENSION, BridgeTypedArray.getType("16dp")); assertEquals(TYPE_DIMENSION, BridgeTypedArray.getType(".16dp")); + assertEquals(TYPE_DIMENSION, BridgeTypedArray.getType("9999.dp")); assertEquals(TYPE_STRING, BridgeTypedArray.getType("16notaunit")); assertEquals(TYPE_INT_DEC, BridgeTypedArray.getType("98543")); assertEquals(TYPE_FLOAT, BridgeTypedArray.getType("43.364")); |