• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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;
20 import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
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 
38     @LayoutlibDelegate
nGetIntMethod(Class<?> targetClass, String methodName)39     /*package*/ static int nGetIntMethod(Class<?> targetClass, String methodName) {
40         // return 0 to force PropertyValuesHolder to use Java reflection.
41         return 0;
42     }
43 
44     @LayoutlibDelegate
nGetFloatMethod(Class<?> targetClass, String methodName)45     /*package*/ static int nGetFloatMethod(Class<?> targetClass, String methodName) {
46         // return 0 to force PropertyValuesHolder to use Java reflection.
47         return 0;
48     }
49 
50     @LayoutlibDelegate
nCallIntMethod(Object target, int methodID, int arg)51     /*package*/ static void nCallIntMethod(Object target, int methodID, int arg) {
52         // do nothing
53     }
54 
55     @LayoutlibDelegate
nCallFloatMethod(Object target, int methodID, float arg)56     /*package*/ static void nCallFloatMethod(Object target, int methodID, float arg) {
57         // do nothing
58     }
59 }
60