blob: d222e0739fa2cb6d458800163840ba706c0bda53 [file] [log] [blame]
Doris Liu766431a2016-02-04 22:17:11 +00001/*
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 */
16package android.view;
17
18import android.animation.TimeInterpolator;
John Reck32f140aa62018-10-04 15:08:24 -070019import android.graphics.RecordingCanvas;
20import android.graphics.RenderNode;
Aurimas Liutikas67e2ae82016-10-11 18:17:42 -070021
Doris Liu766431a2016-02-04 22:17:11 +000022import com.android.internal.view.animation.FallbackLUTInterpolator;
23import com.android.internal.view.animation.NativeInterpolatorFactory;
24import com.android.internal.view.animation.NativeInterpolatorFactoryHelper;
25
26/**
27 * This is a helper class to get access to methods and fields needed for RenderNodeAnimatorSet
28 * that are internal or package private to android.view package.
29 *
30 * @hide
31 */
32public class RenderNodeAnimatorSetHelper {
33
John Reck32f140aa62018-10-04 15:08:24 -070034 /** checkstyle @hide */
35 public static RenderNode getTarget(RecordingCanvas recordingCanvas) {
Doris Liu766431a2016-02-04 22:17:11 +000036 return recordingCanvas.mNode;
37 }
38
John Reck32f140aa62018-10-04 15:08:24 -070039 /** checkstyle @hide */
Doris Liu766431a2016-02-04 22:17:11 +000040 public static long createNativeInterpolator(TimeInterpolator interpolator, long
41 duration) {
42 if (interpolator == null) {
43 // create LinearInterpolator
44 return NativeInterpolatorFactoryHelper.createLinearInterpolator();
45 } else if (RenderNodeAnimator.isNativeInterpolator(interpolator)) {
46 return ((NativeInterpolatorFactory)interpolator).createNativeInterpolator();
47 } else {
48 return FallbackLUTInterpolator.createNativeInterpolator(interpolator, duration);
49 }
50 }
51
52}