Xavier Ducrohet | 8d74c97 | 2010-12-07 12:10:51 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2010 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.animation; |
| 18 | |
| 19 | import com.android.layoutlib.bridge.impl.DelegateManager; |
Xavier Ducrohet | 9a4fe29 | 2011-02-09 17:17:49 -0800 | [diff] [blame] | 20 | import com.android.tools.layoutlib.annotations.LayoutlibDelegate; |
Xavier Ducrohet | 8d74c97 | 2010-12-07 12:10:51 -0800 | [diff] [blame] | 21 | |
| 22 | /** |
| 23 | * Delegate implementing the native methods of android.animation.PropertyValuesHolder |
| 24 | * |
| 25 | * Through the layoutlib_create tool, the original native methods of PropertyValuesHolder have been |
| 26 | * replaced by calls to methods of the same name in this delegate class. |
| 27 | * |
| 28 | * Because it's a stateless class to start with, there's no need to keep a {@link DelegateManager} |
| 29 | * around to map int to instance of the delegate. |
| 30 | * |
| 31 | * The main goal of this class' methods are to provide a native way to access setters and getters |
| 32 | * on some object. In this case we want to default to using Java reflection instead so the native |
| 33 | * methods do nothing. |
| 34 | * |
| 35 | */ |
| 36 | /*package*/ class PropertyValuesHolder_Delegate { |
| 37 | |
Xavier Ducrohet | 9a4fe29 | 2011-02-09 17:17:49 -0800 | [diff] [blame] | 38 | @LayoutlibDelegate |
Ashok Bhat | 0141e88 | 2014-01-17 16:44:27 +0000 | [diff] [blame] | 39 | /*package*/ static long nGetIntMethod(Class<?> targetClass, String methodName) { |
Xavier Ducrohet | 8d74c97 | 2010-12-07 12:10:51 -0800 | [diff] [blame] | 40 | // return 0 to force PropertyValuesHolder to use Java reflection. |
| 41 | return 0; |
| 42 | } |
| 43 | |
Xavier Ducrohet | 9a4fe29 | 2011-02-09 17:17:49 -0800 | [diff] [blame] | 44 | @LayoutlibDelegate |
Ashok Bhat | 0141e88 | 2014-01-17 16:44:27 +0000 | [diff] [blame] | 45 | /*package*/ static long nGetFloatMethod(Class<?> targetClass, String methodName) { |
Xavier Ducrohet | 8d74c97 | 2010-12-07 12:10:51 -0800 | [diff] [blame] | 46 | // return 0 to force PropertyValuesHolder to use Java reflection. |
| 47 | return 0; |
| 48 | } |
| 49 | |
Xavier Ducrohet | 9a4fe29 | 2011-02-09 17:17:49 -0800 | [diff] [blame] | 50 | @LayoutlibDelegate |
Ashok Bhat | 0141e88 | 2014-01-17 16:44:27 +0000 | [diff] [blame] | 51 | /*package*/ static void nCallIntMethod(Object target, long methodID, int arg) { |
Xavier Ducrohet | 8d74c97 | 2010-12-07 12:10:51 -0800 | [diff] [blame] | 52 | // do nothing |
| 53 | } |
| 54 | |
Xavier Ducrohet | 9a4fe29 | 2011-02-09 17:17:49 -0800 | [diff] [blame] | 55 | @LayoutlibDelegate |
Ashok Bhat | 0141e88 | 2014-01-17 16:44:27 +0000 | [diff] [blame] | 56 | /*package*/ static void nCallFloatMethod(Object target, long methodID, float arg) { |
Xavier Ducrohet | 8d74c97 | 2010-12-07 12:10:51 -0800 | [diff] [blame] | 57 | // do nothing |
| 58 | } |
| 59 | } |