| 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 com.android.layoutlib.api; |
| 18 |
|
| 19 |
import com.android.ide.common.rendering.api.LayoutlibCallback; |
| 20 |
|
| 21 |
/** |
| 22 |
* @deprecated use {@link LayoutlibCallback} |
| 23 |
*/ |
| 24 |
@Deprecated |
| 25 |
public interface IProjectCallback { |
| 26 |
|
| 27 |
/** |
| 28 |
* Loads a custom view with the given constructor signature and arguments. |
| 29 |
* @param name The fully qualified name of the class. |
| 30 |
* @param constructorSignature The signature of the class to use |
| 31 |
* @param constructorArgs The arguments to use on the constructor |
| 32 |
* @return A newly instantiated android.view.View object. |
| 33 |
* @throws Exception |
| 34 |
*/ |
| 35 |
Object loadView(String name, Class[] constructorSignature, Object[] constructorArgs) |
| 36 |
throws Exception; |
| 37 |
|
| 38 |
/** |
| 39 |
* Returns the namespace of the application. |
| 40 |
* <p>This lets the Layout Lib load custom attributes for custom views. |
| 41 |
*/ |
| 42 |
String getNamespace(); |
| 43 |
|
| 44 |
/** |
| 45 |
* Resolves the id of a resource Id. |
| 46 |
* <p>The resource id is the value of a <code>R.<type>.<name></code>, and |
| 47 |
* this method will return both the type and name of the resource. |
| 48 |
* @param id the Id to resolve. |
| 49 |
* @return an array of 2 strings containing the resource name and type, or null if the id |
| 50 |
* does not match any resource. |
| 51 |
*/ |
| 52 |
String[] resolveResourceValue(int id); |
| 53 |
|
| 54 |
/** |
| 55 |
* Resolves the id of a resource Id of type int[] |
| 56 |
* <p>The resource id is the value of a R.styleable.<name>, and this method will |
| 57 |
* return the name of the resource. |
| 58 |
* @param id the Id to resolve. |
| 59 |
* @return the name of the resource or <code>null</code> if not found. |
| 60 |
*/ |
| 61 |
String resolveResourceValue(int[] id); |
| 62 |
|
| 63 |
/** |
| 64 |
* Returns the id of a resource. |
| 65 |
* <p>The provided type and name must match an existing constant defined as |
| 66 |
* <code>R.<type>.<name></code>. |
| 67 |
* @param type the type of the resource |
| 68 |
* @param name the name of the resource |
| 69 |
* @return an Integer containing the resource Id, or <code>null</code> if not found. |
| 70 |
*/ |
| 71 |
Integer getResourceValue(String type, String name); |
| 72 |
} |