1282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski/*
2282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * Copyright (C) 2010 The Android Open Source Project
3282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski *
4282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * Licensed under the Apache License, Version 2.0 (the "License");
5282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * you may not use this file except in compliance with the License.
6282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * You may obtain a copy of the License at
7282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski *
8282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski *      http://www.apache.org/licenses/LICENSE-2.0
9282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski *
10282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * Unless required by applicable law or agreed to in writing, software
11282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * distributed under the License is distributed on an "AS IS" BASIS,
12282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * See the License for the specific language governing permissions and
14282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * limitations under the License.
15282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski */
16282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski
17282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinskipackage android.animation;
18282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski
19282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinskiimport com.android.layoutlib.bridge.impl.DelegateManager;
20282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinskiimport com.android.tools.layoutlib.annotations.LayoutlibDelegate;
21282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski
22282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski/**
23282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * Delegate implementing the native methods of android.animation.PropertyValuesHolder
24282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski *
25282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * Through the layoutlib_create tool, the original native methods of PropertyValuesHolder have been
26282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * replaced by calls to methods of the same name in this delegate class.
27282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski *
28282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * Because it's a stateless class to start with, there's no need to keep a {@link DelegateManager}
29282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * around to map int to instance of the delegate.
30282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski *
31282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * The main goal of this class' methods are to provide a native way to access setters and getters
32282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * on some object. In this case we want to default to using Java reflection instead so the native
33282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski * methods do nothing.
34282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski *
35282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski */
36282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski/*package*/ class PropertyValuesHolder_Delegate {
37282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski
38282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    @LayoutlibDelegate
39fbb35fb39eb74c6fa7ba6804faeaccb80483be14Ashok Bhat    /*package*/ static long nGetIntMethod(Class<?> targetClass, String methodName) {
40282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski        // return 0 to force PropertyValuesHolder to use Java reflection.
41282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski        return 0;
42282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    }
43282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski
44282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    @LayoutlibDelegate
45fbb35fb39eb74c6fa7ba6804faeaccb80483be14Ashok Bhat    /*package*/ static long nGetFloatMethod(Class<?> targetClass, String methodName) {
46282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski        // return 0 to force PropertyValuesHolder to use Java reflection.
47282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski        return 0;
48282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    }
49282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski
50282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    @LayoutlibDelegate
519be03c4e980d3058aeb3fd730da5f7d4a4a4f8a8Deepanshu Gupta    /*package*/ static long nGetMultipleIntMethod(Class<?> targetClass, String methodName,
52e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta            int numParams) {
53e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta        // TODO: return the right thing.
54e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta        return 0;
55e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta    }
56e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta
57e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta    @LayoutlibDelegate
589be03c4e980d3058aeb3fd730da5f7d4a4a4f8a8Deepanshu Gupta    /*package*/ static long nGetMultipleFloatMethod(Class<?> targetClass, String methodName,
59e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta            int numParams) {
60e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta        // TODO: return the right thing.
61e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta        return 0;
62e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta    }
63e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta
64e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta    @LayoutlibDelegate
65fbb35fb39eb74c6fa7ba6804faeaccb80483be14Ashok Bhat    /*package*/ static void nCallIntMethod(Object target, long methodID, int arg) {
66282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski        // do nothing
67282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    }
68282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski
69282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    @LayoutlibDelegate
70fbb35fb39eb74c6fa7ba6804faeaccb80483be14Ashok Bhat    /*package*/ static void nCallFloatMethod(Object target, long methodID, float arg) {
71282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski        // do nothing
72282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski    }
73e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta
74e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta    @LayoutlibDelegate
75e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta    /*package*/ static void nCallTwoIntMethod(Object target, long methodID, int arg1,
76e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta            int arg2) {
77e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta        // do nothing
78e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta    }
79e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta
80e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta    @LayoutlibDelegate
81e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta    /*package*/ static void nCallFourIntMethod(Object target, long methodID, int arg1,
82e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta            int arg2, int arg3, int arg4) {
83e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta        // do nothing
84e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta    }
85e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta
86e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta    @LayoutlibDelegate
87e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta    /*package*/ static void nCallMultipleIntMethod(Object target, long methodID,
88e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta            int[] args) {
89e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta        // do nothing
90e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta    }
91e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta
92e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta    @LayoutlibDelegate
93e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta    /*package*/ static void nCallTwoFloatMethod(Object target, long methodID, float arg1,
94e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta            float arg2) {
95e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta        // do nothing
96e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta    }
97e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta
98e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta    @LayoutlibDelegate
99e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta    /*package*/ static void nCallFourFloatMethod(Object target, long methodID, float arg1,
100e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta            float arg2, float arg3, float arg4) {
101e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta        // do nothing
102e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta    }
103e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta
104e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta    @LayoutlibDelegate
105e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta    /*package*/ static void nCallMultipleFloatMethod(Object target, long methodID,
106e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta            float[] args) {
107e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta        // do nothing
108e05bb956ce429618fd4f971a9dc708b9313c59eaDeepanshu Gupta    }
109282e181b58cf72b6ca770dc7ca5f91f135444502Adam Lesinski}
110