1 /* 2 * Copyright (C) 2016 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package android.view; 17 18 import android.animation.TimeInterpolator; 19 20 import com.android.internal.view.animation.FallbackLUTInterpolator; 21 import com.android.internal.view.animation.NativeInterpolatorFactory; 22 import com.android.internal.view.animation.NativeInterpolatorFactoryHelper; 23 24 /** 25 * This is a helper class to get access to methods and fields needed for RenderNodeAnimatorSet 26 * that are internal or package private to android.view package. 27 * 28 * @hide 29 */ 30 public class RenderNodeAnimatorSetHelper { 31 getTarget(DisplayListCanvas recordingCanvas)32 public static RenderNode getTarget(DisplayListCanvas recordingCanvas) { 33 return recordingCanvas.mNode; 34 } 35 createNativeInterpolator(TimeInterpolator interpolator, long duration)36 public static long createNativeInterpolator(TimeInterpolator interpolator, long 37 duration) { 38 if (interpolator == null) { 39 // create LinearInterpolator 40 return NativeInterpolatorFactoryHelper.createLinearInterpolator(); 41 } else if (RenderNodeAnimator.isNativeInterpolator(interpolator)) { 42 return ((NativeInterpolatorFactory)interpolator).createNativeInterpolator(); 43 } else { 44 return FallbackLUTInterpolator.createNativeInterpolator(interpolator, duration); 45 } 46 } 47 48 } 49