Loading core/java/android/view/RenderNodeAnimator.java +1 −2 Original line number Diff line number Diff line Loading @@ -200,8 +200,7 @@ public class RenderNodeAnimator extends Animator { // in mTransformationInfo instead of in RenderNode, so we need to update // it with the final value here. if (mRenderProperty == RenderNodeAnimator.ALPHA) { // Don't need null check because ViewPropertyAnimator's // ctor calls ensureTransformationInfo() mViewTarget.ensureTransformationInfo(); mViewTarget.mTransformationInfo.mAlpha = mFinalValue; } Loading core/java/android/view/View.java +2 −1 Original line number Diff line number Diff line Loading @@ -3394,7 +3394,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, float mTransitionAlpha = 1f; } TransformationInfo mTransformationInfo; /** @hide */ public TransformationInfo mTransformationInfo; /** * Current clip bounds. to which all drawing of this view are constrained. Loading core/tests/coretests/AndroidManifest.xml +7 −0 Original line number Diff line number Diff line Loading @@ -1107,6 +1107,13 @@ </intent-filter> </activity> <activity android:name="android.app.Activity" android:label="Empty Activity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" /> </intent-filter> </activity> <!-- Activity-level metadata --> <meta-data android:name="com.android.frameworks.coretests.isApp" android:value="true" /> <meta-data android:name="com.android.frameworks.coretests.string" android:value="foo" /> Loading core/tests/coretests/src/android/view/RenderNodeAnimatorTest.java 0 → 100644 +59 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 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 android.view; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import android.app.Activity; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.annotation.UiThreadTest; import android.support.test.filters.MediumTest; import android.support.test.rule.ActivityTestRule; import org.junit.Rule; import org.junit.Test; @MediumTest public class RenderNodeAnimatorTest { @Rule public ActivityTestRule<Activity> mActivityRule = new ActivityTestRule<>(Activity.class); private Context getContext() { return InstrumentationRegistry.getTargetContext(); } private Activity getActivity() { return mActivityRule.getActivity(); } @UiThreadTest @Test public void testAlphaTransformationInfo() throws Throwable { View view = new View(getContext()); // attach the view, since otherwise the RenderNodeAnimator won't accept view as target getActivity().setContentView(view); RenderNodeAnimator anim = new RenderNodeAnimator(RenderNodeAnimator.ALPHA, 0.5f); anim.setTarget(view); assertNull(view.mTransformationInfo); anim.start(); // should initialize mTransformationInfo assertNotNull(view.mTransformationInfo); } } Loading
core/java/android/view/RenderNodeAnimator.java +1 −2 Original line number Diff line number Diff line Loading @@ -200,8 +200,7 @@ public class RenderNodeAnimator extends Animator { // in mTransformationInfo instead of in RenderNode, so we need to update // it with the final value here. if (mRenderProperty == RenderNodeAnimator.ALPHA) { // Don't need null check because ViewPropertyAnimator's // ctor calls ensureTransformationInfo() mViewTarget.ensureTransformationInfo(); mViewTarget.mTransformationInfo.mAlpha = mFinalValue; } Loading
core/java/android/view/View.java +2 −1 Original line number Diff line number Diff line Loading @@ -3394,7 +3394,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, float mTransitionAlpha = 1f; } TransformationInfo mTransformationInfo; /** @hide */ public TransformationInfo mTransformationInfo; /** * Current clip bounds. to which all drawing of this view are constrained. Loading
core/tests/coretests/AndroidManifest.xml +7 −0 Original line number Diff line number Diff line Loading @@ -1107,6 +1107,13 @@ </intent-filter> </activity> <activity android:name="android.app.Activity" android:label="Empty Activity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.FRAMEWORK_INSTRUMENTATION_TEST" /> </intent-filter> </activity> <!-- Activity-level metadata --> <meta-data android:name="com.android.frameworks.coretests.isApp" android:value="true" /> <meta-data android:name="com.android.frameworks.coretests.string" android:value="foo" /> Loading
core/tests/coretests/src/android/view/RenderNodeAnimatorTest.java 0 → 100644 +59 −0 Original line number Diff line number Diff line /* * Copyright (C) 2017 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 android.view; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertNull; import android.app.Activity; import android.content.Context; import android.support.test.InstrumentationRegistry; import android.support.test.annotation.UiThreadTest; import android.support.test.filters.MediumTest; import android.support.test.rule.ActivityTestRule; import org.junit.Rule; import org.junit.Test; @MediumTest public class RenderNodeAnimatorTest { @Rule public ActivityTestRule<Activity> mActivityRule = new ActivityTestRule<>(Activity.class); private Context getContext() { return InstrumentationRegistry.getTargetContext(); } private Activity getActivity() { return mActivityRule.getActivity(); } @UiThreadTest @Test public void testAlphaTransformationInfo() throws Throwable { View view = new View(getContext()); // attach the view, since otherwise the RenderNodeAnimator won't accept view as target getActivity().setContentView(view); RenderNodeAnimator anim = new RenderNodeAnimator(RenderNodeAnimator.ALPHA, 0.5f); anim.setTarget(view); assertNull(view.mTransformationInfo); anim.start(); // should initialize mTransformationInfo assertNotNull(view.mTransformationInfo); } }