1 /* 2 * Copyright (C) 2022 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 17 package android.view; 18 19 import com.android.tools.layoutlib.annotations.LayoutlibDelegate; 20 21 import static android.view.VelocityTracker.VELOCITY_TRACKER_STRATEGY_IMPULSE; 22 23 public class VelocityTracker_Delegate { 24 25 @LayoutlibDelegate obtain()26 public static VelocityTracker obtain() { 27 // Default VelocityTracker tries to use ApplicationThread which is not supported 28 // by layoutlib. Specify a strategy to work around this issue. 29 return VelocityTracker.obtain(VELOCITY_TRACKER_STRATEGY_IMPULSE); 30 } 31 32 @LayoutlibDelegate obtain(String strategy)33 public static VelocityTracker obtain(String strategy) { 34 return VelocityTracker.obtain_Original(strategy); 35 } 36 37 @LayoutlibDelegate obtain(int strategy)38 public static VelocityTracker obtain(int strategy) { 39 return VelocityTracker.obtain_Original(strategy); 40 } 41 } 42