blob: 224eac601ae1b32a66d39647aae2e7d271542e6c [file] [log] [blame]
Xavier Ducrohet8d74c972010-12-07 12:10:51 -08001/*
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
17package android.animation;
18
19import com.android.layoutlib.bridge.impl.DelegateManager;
Xavier Ducrohet9a4fe292011-02-09 17:17:49 -080020import com.android.tools.layoutlib.annotations.LayoutlibDelegate;
Xavier Ducrohet8d74c972010-12-07 12:10:51 -080021
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 Ducrohet9a4fe292011-02-09 17:17:49 -080038 @LayoutlibDelegate
Ashok Bhat0141e882014-01-17 16:44:27 +000039 /*package*/ static long nGetIntMethod(Class<?> targetClass, String methodName) {
Xavier Ducrohet8d74c972010-12-07 12:10:51 -080040 // return 0 to force PropertyValuesHolder to use Java reflection.
41 return 0;
42 }
43
Xavier Ducrohet9a4fe292011-02-09 17:17:49 -080044 @LayoutlibDelegate
Ashok Bhat0141e882014-01-17 16:44:27 +000045 /*package*/ static long nGetFloatMethod(Class<?> targetClass, String methodName) {
Xavier Ducrohet8d74c972010-12-07 12:10:51 -080046 // return 0 to force PropertyValuesHolder to use Java reflection.
47 return 0;
48 }
49
Xavier Ducrohet9a4fe292011-02-09 17:17:49 -080050 @LayoutlibDelegate
Ashok Bhat0141e882014-01-17 16:44:27 +000051 /*package*/ static void nCallIntMethod(Object target, long methodID, int arg) {
Xavier Ducrohet8d74c972010-12-07 12:10:51 -080052 // do nothing
53 }
54
Xavier Ducrohet9a4fe292011-02-09 17:17:49 -080055 @LayoutlibDelegate
Ashok Bhat0141e882014-01-17 16:44:27 +000056 /*package*/ static void nCallFloatMethod(Object target, long methodID, float arg) {
Xavier Ducrohet8d74c972010-12-07 12:10:51 -080057 // do nothing
58 }
59}