<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>resources</name>
+ <name>common</name>
<comment></comment>
<projects>
</projects>
LOCAL_JAVA_LIBRARIES := \
-LOCAL_MODULE := resources
+LOCAL_MODULE := common
LOCAL_MODULE_TAGS := optional
--- /dev/null
+common.jar contains resource configuration enums. It is used by various tools, but also
+by layoutlib.jar
+
+Layoutlib.jar is built from frameworks/base.git and therefore is versioned with the platform.
+
+IMPORTANT NOTE REGARDING CHANGES IN common.jar:
+
+- The API must stay compatible. This is because while layoutlib.jar compiles against it,
+ the client provides the implementation and must be able to load earlier versions of layoutlib.jar.
+
+- Updated version of common should be copied to the current in-dev branch of
+ prebuilt/common/common/common-prebuilt.jar
+ The PREBUILT file in the same folder must be updated as well to reflect how to rebuild this
+ prebuilt jar file.
\ No newline at end of file
* limitations under the License.
*/
-package com.android.sdklib.annotations;
+package com.android.annotations;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
* limitations under the License.
*/
-package com.android.sdklib.annotations;
+package com.android.annotations;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
* limitations under the License.
*/
-package com.android.sdklib.util;
+package com.android.util;
/**
* A Pair class is simply a 2-tuple for use in this package. We might want to
<classpathentry kind="lib" path="libs/sdklib.jar" sourcepath="/SdkLib"/>
<classpathentry kind="lib" path="libs/sdkstats.jar" sourcepath="/SdkStatsService"/>
<classpathentry kind="lib" path="libs/sdkuilib.jar" sourcepath="/SdkUiLib"/>
- <classpathentry kind="lib" path="libs/resources.jar"/>
+ <classpathentry kind="lib" path="libs/common.jar" sourcepath="/common"/>
<classpathentry combineaccessrules="false" kind="src" path="/ddmlib"/>
<classpathentry combineaccessrules="false" kind="src" path="/ddmuilib"/>
<classpathentry kind="output" path="bin"/>
libs/kxml2-2.3.0.jar,
libs/layoutlib_api.jar,
libs/ide_common.jar,
- libs/resources.jar
+ libs/common.jar
Bundle-Activator: com.android.ide.eclipse.adt.AdtPlugin
Bundle-Vendor: The Android Open Source Project
Require-Bundle: com.android.ide.eclipse.ddms,
org.eclipse.ltk.ui.refactoring,
org.eclipse.core.expressions
Eclipse-LazyStart: true
-Export-Package: com.android.ide.common.api;x-friends:="com.android.ide.eclipse.tests",
+Export-Package: com.android.annotations;x-friends:="com.android.ide.eclipse.tests",
+ com.android.ide.common.api;x-friends:="com.android.ide.eclipse.tests",
com.android.ide.common.layout;x-friends:="com.android.ide.eclipse.tests",
com.android.ide.common.log;x-friends:="com.android.ide.eclipse.tests",
com.android.ide.common.rendering;x-friends:="com.android.ide.eclipse.tests",
com.android.prefs;x-friends:="com.android.ide.eclipse.tests",
com.android.resources;x-friends:="com.android.ide.eclipse.tests",
com.android.sdklib;x-friends:="com.android.ide.eclipse.tests",
- com.android.sdklib.annotations;x-friends:="com.android.ide.eclipse.tests",
com.android.sdklib.build;x-friends:="com.android.ide.eclipse.tests",
com.android.sdklib.internal.avd;x-friends:="com.android.ide.eclipse.tests",
com.android.sdklib.internal.build;x-friends:="com.android.ide.eclipse.tests",
com.android.sdkuilib.internal.widgets;x-friends:="com.android.ide.eclipse.tests",
com.android.sdkuilib.repository;x-friends:="com.android.ide.eclipse.tests",
com.android.sdkuilib.ui;x-friends:="com.android.ide.eclipse.tests",
+ com.android.util;x-friends:="com.android.ide.eclipse.tests",
org.apache.commons.compress.archivers;x-friends:="com.android.ide.eclipse.tests",
org.apache.commons.compress.archivers.ar;x-friends:="com.android.ide.eclipse.tests",
org.apache.commons.compress.archivers.cpio;x-friends:="com.android.ide.eclipse.tests",
libs/,\
about.properties,\
NOTICE,\
- about.html
+ about.html,\
+ libs/common.jar
source.. = src/
output.. = bin/
bin.excludes = libs/.gitignore
package com.android.ide.common.api;
-import com.android.sdklib.annotations.Nullable;
+import com.android.annotations.Nullable;
/**
* A Client Rules Engine is a set of methods that {@link IViewRule}s can use to
package com.android.ide.common.api;
-import com.android.sdklib.annotations.Nullable;
+import com.android.annotations.Nullable;
import java.util.Map;
import com.android.ide.common.api.IViewRule;
import com.android.ide.common.api.Point;
import com.android.ide.common.api.Rect;
-import com.android.sdklib.util.Pair;
+import com.android.util.Pair;
import java.util.Map;
import com.android.ide.common.api.Rect;
import com.android.ide.common.api.IAttributeInfo.Format;
import com.android.ide.common.api.IDragElement.IDragAttribute;
-import com.android.sdklib.util.Pair;
+import com.android.util.Pair;
import java.util.Arrays;
import java.util.HashMap;
import com.android.ide.common.api.IViewRule;
import com.android.ide.common.api.Point;
import com.android.ide.common.api.Rect;
-import com.android.sdklib.util.Pair;
+import com.android.util.Pair;
import java.util.Map;
import com.android.ide.common.api.Rect;
import com.android.ide.common.api.IAttributeInfo.Format;
import com.android.ide.common.api.INode.IAttribute;
-import com.android.sdklib.util.Pair;
+import com.android.util.Pair;
import java.util.ArrayList;
import java.util.Collections;
import com.android.ide.common.rendering.api.IProjectCallback;
import com.android.ide.common.rendering.api.LayoutLog;
-import com.android.ide.common.rendering.legacy.ILegacyCallback;
+import com.android.ide.common.rendering.legacy.LegacyCallback;
import com.android.ide.eclipse.adt.AdtPlugin;
import com.android.ide.eclipse.adt.AndroidConstants;
import com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper;
import com.android.resources.ResourceType;
import com.android.sdklib.SdkConstants;
import com.android.sdklib.xml.ManifestData;
+import com.android.util.Pair;
import org.eclipse.core.resources.IProject;
* <p/>This implements {@link IProjectCallback} for the old and new API through
* {@link ILegacyCallback}
*/
-public final class ProjectCallback implements ILegacyCallback {
+public final class ProjectCallback extends LegacyCallback {
private final HashMap<String, Class<?>> mLoadedClasses = new HashMap<String, Class<?>>();
private final Set<String> mMissingClasses = new TreeSet<String>();
return mNamespace;
}
- public String[] resolveResourceValue(int id) {
+ public Pair<ResourceType, String> resolveResourceId(int id) {
if (mProjectRes != null) {
return mProjectRes.resolveResourceValue(id);
}
return null;
}
- public String resolveResourceValue(int[] id) {
+ public String resolveResourceId(int[] id) {
if (mProjectRes != null) {
return mProjectRes.resolveResourceValue(id);
}
return null;
}
- /**
- * @deprecated use {@link #getResourceValue(ResourceType, String)} instead.
- */
- public Integer getResourceValue(String type, String name) {
- return getResourceValue(ResourceType.getEnum(type), name);
- }
-
- public Integer getResourceValue(ResourceType type, String name) {
+ public Integer getResourceId(ResourceType type, String name) {
if (mProjectRes != null) {
return mProjectRes.getResourceValue(type, name);
}
import com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode;
import com.android.ide.eclipse.adt.internal.preferences.AdtPrefs;
import com.android.ide.eclipse.adt.internal.wizards.newxmlfile.ResourceNameValidator;
-import com.android.sdklib.util.Pair;
+import com.android.util.Pair;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import static com.android.ide.eclipse.adt.AndroidConstants.WS_LAYOUTS;
import static com.android.ide.eclipse.adt.AndroidConstants.WS_SEP;
import static com.android.sdklib.SdkConstants.FD_LAYOUT;
+
import static org.eclipse.core.resources.IResourceDelta.ADDED;
import static org.eclipse.core.resources.IResourceDelta.CHANGED;
import static org.eclipse.core.resources.IResourceDelta.CONTENT;
import static org.eclipse.core.resources.IResourceDelta.REMOVED;
+import com.android.annotations.VisibleForTesting;
import com.android.ide.eclipse.adt.AdtPlugin;
import com.android.ide.eclipse.adt.internal.editors.layout.descriptors.LayoutDescriptors;
import com.android.ide.eclipse.adt.internal.project.BaseProjectHelper;
import com.android.ide.eclipse.adt.io.IFileWrapper;
import com.android.resources.ResourceType;
import com.android.sdklib.SdkConstants;
-import com.android.sdklib.annotations.VisibleForTesting;
import com.android.sdklib.io.IAbstractFile;
import org.eclipse.core.resources.IFile;
package com.android.ide.eclipse.adt.internal.editors.layout.gle2;
-import com.android.sdklib.annotations.VisibleForTesting;
+import com.android.annotations.VisibleForTesting;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import static com.android.ide.common.layout.LayoutConstants.ATTR_TEXT;
import static com.android.ide.common.layout.LayoutConstants.DRAWABLE_PREFIX;
import static com.android.ide.common.layout.LayoutConstants.LAYOUT_PREFIX;
+
import static org.eclipse.jface.viewers.StyledString.QUALIFIER_STYLER;
+import com.android.annotations.VisibleForTesting;
import com.android.ide.common.api.INode;
import com.android.ide.common.api.InsertType;
import com.android.ide.common.layout.BaseLayoutRule;
import com.android.ide.eclipse.adt.internal.editors.layout.uimodel.UiViewElementNode;
import com.android.ide.eclipse.adt.internal.editors.ui.ErrorImageComposite;
import com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode;
-import com.android.sdklib.annotations.VisibleForTesting;
-import com.android.sdklib.util.Pair;
+import com.android.util.Pair;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import com.android.ide.eclipse.adt.internal.sdk.Sdk;
import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.SdkConstants;
-import com.android.sdklib.util.Pair;
+import com.android.util.Pair;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import com.android.ide.eclipse.adt.internal.editors.layout.LayoutEditor;
import com.android.ide.eclipse.adt.internal.wizards.newxmlfile.NewXmlFileWizard;
import com.android.resources.ResourceType;
-import com.android.sdklib.util.Pair;
+import com.android.util.Pair;
import org.eclipse.core.resources.IProject;
import org.eclipse.jface.action.Action;
import com.android.ide.eclipse.adt.internal.editors.uimodel.UiDocumentNode;
import com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode;
import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetData;
-import com.android.sdklib.util.Pair;
+import com.android.util.Pair;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jface.resource.ImageDescriptor;
import com.android.ide.eclipse.adt.internal.editors.layout.descriptors.LayoutDescriptors;
import com.android.ide.eclipse.adt.internal.editors.layout.descriptors.ViewElementDescriptor;
import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetData;
-import com.android.sdklib.util.Pair;
+import com.android.util.Pair;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import static com.android.sdklib.xml.AndroidManifest.NODE_ACTIVITY;
import static com.android.sdklib.xml.AndroidManifest.NODE_SERVICE;
+import com.android.annotations.VisibleForTesting;
import com.android.ide.common.rendering.api.ResourceValue;
import com.android.ide.eclipse.adt.AdtPlugin;
import com.android.ide.eclipse.adt.AndroidConstants;
import com.android.resources.ResourceType;
import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.SdkConstants;
-import com.android.sdklib.annotations.VisibleForTesting;
import com.android.sdklib.io.FileWrapper;
-import com.android.sdklib.util.Pair;
+import com.android.util.Pair;
import org.apache.xerces.parsers.DOMParser;
import org.apache.xerces.xni.Augmentations;
import com.android.ide.eclipse.adt.internal.resources.manager.GlobalProjectMonitor.IProjectListener;
import com.android.resources.ResourceType;
import com.android.sdklib.xml.ManifestData;
+import com.android.util.Pair;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarkerDelta;
// create the maps to store the result of the parsing
Map<ResourceType, Map<String, Integer>> resourceValueMap =
new EnumMap<ResourceType, Map<String, Integer>>(ResourceType.class);
- Map<Integer, String[]> genericValueToNameMap =
- new HashMap<Integer, String[]>();
+ Map<Integer, Pair<ResourceType, String>> genericValueToNameMap =
+ new HashMap<Integer, Pair<ResourceType, String>>();
Map<IntArrayWrapper, String> styleableValueToNameMap =
new HashMap<IntArrayWrapper, String>();
* @param resourceValueMap
* @return True if we managed to parse the R class.
*/
- private boolean parseClass(Class<?> rClass, Map<Integer, String[]> genericValueToNameMap,
+ private boolean parseClass(Class<?> rClass,
+ Map<Integer, Pair<ResourceType, String>> genericValueToNameMap,
Map<IntArrayWrapper, String> styleableValueToNameMap, Map<ResourceType,
Map<String, Integer>> resourceValueMap) {
try {
f.getName());
} else if (type == int.class) {
Integer value = (Integer) f.get(null);
- genericValueToNameMap.put(value,
- new String[] { f.getName(), resType.getName() });
+ genericValueToNameMap.put(value, Pair.of(resType, f.getName()));
fullMap.put(f.getName(), value);
} else {
assert false;
import com.android.ide.eclipse.adt.io.IFolderWrapper;
import com.android.resources.ResourceType;
import com.android.sdklib.io.IAbstractFolder;
+import com.android.util.Pair;
import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
/** Map of (name, id) for resources of type {@link ResourceType#ID} coming from R.java */
private Map<ResourceType, Map<String, Integer>> mResourceValueMap;
/** Map of (id, [name, resType]) for all resources coming from R.java */
- private Map<Integer, String[]> mResIdValueToNameMap;
+ private Map<Integer, Pair<ResourceType, String>> mResIdValueToNameMap;
/** Map of (int[], name) for styleable resources coming from R.java */
private Map<IntArrayWrapper, String> mStyleableValueToNameMap;
* @param id
* @return an array of 2 strings { name, type } or null if the id could not be resolved
*/
- public String[] resolveResourceValue(int id) {
+ public Pair<ResourceType, String> resolveResourceValue(int id) {
if (mResIdValueToNameMap != null) {
return mResIdValueToNameMap.get(id);
}
* @param resourceValueMap a map of (name, id) for resources of type {@link ResourceType#ID}.
* The list is acquired by the {@link ProjectResources} object.
*/
- void setCompiledResources(Map<Integer, String[]> resIdValueToNameMap,
+ void setCompiledResources(Map<Integer, Pair<ResourceType, String>> resIdValueToNameMap,
Map<IntArrayWrapper, String> styleableValueMap,
Map<ResourceType, Map<String, Integer>> resourceValueMap) {
mResourceValueMap = resourceValueMap;
import com.android.ide.eclipse.adt.internal.ui.ConfigurationSelector.SelectorMode;
import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.SdkConstants;
-import com.android.sdklib.util.Pair;
+import com.android.util.Pair;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
<classpathentry kind="lib" path="/adt/libs/ninepatch.jar" sourcepath="/ninepatch"/>
<classpathentry kind="lib" path="/adt/libs/sdklib.jar" sourcepath="/SdkLib"/>
<classpathentry kind="lib" path="/adt/libs/sdkuilib.jar" sourcepath="/SdkUiLib"/>
- <classpathentry kind="lib" path="/adt/libs/resources.jar"/>
+ <classpathentry kind="lib" path="/adt/libs/common.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
import com.android.ide.eclipse.adt.internal.resources.manager.ResourceManager;
import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetData;
import com.android.ide.eclipse.tests.SdkTestCase;
-import com.android.layoutlib.api.IXmlPullParser;
-import com.android.resources.ResourceType;
import com.android.resources.Density;
import com.android.resources.Keyboard;
import com.android.resources.KeyboardState;
import com.android.resources.Navigation;
+import com.android.resources.ResourceType;
import com.android.resources.ScreenOrientation;
import com.android.resources.ScreenRatio;
import com.android.resources.ScreenSize;
import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.SdkConstants;
import com.android.sdklib.io.FolderWrapper;
+import com.android.util.Pair;
import org.kxml2.io.KXmlParser;
import org.xmlpull.v1.XmlPullParser;
public class ApiDemosRenderingTest extends SdkTestCase {
/**
- * Custom parser that implements {@link IXmlPullParser} (which itself extends
+ * Custom parser that implements {@link ILayoutPullParser} (which itself extends
* {@link XmlPullParser}).
*/
private final static class TestParser extends KXmlParser implements ILayoutPullParser {
// in some cases, the id that getResourceValue(String type, String name) returns
// will be sent back to get the type/name. This map stores the id/type/name we generate
// to be able to do the reverse resolution.
- private Map<Integer, String[]> mResourceMap = new HashMap<Integer, String[]>();
+ private Map<Integer, Pair<ResourceType, String>> mResourceMap =
+ new HashMap<Integer, Pair<ResourceType, String>>();
private boolean mCustomViewAttempt = false;
return "com.example.android.apis";
}
- public Integer getResourceValue(String type, String name) {
- Integer result = ++mIdCounter;
- mResourceMap.put(result, new String[] { name, type });
- return result;
- }
-
- public Integer getResourceValue(ResourceType type, String name) {
- Integer result = ++mIdCounter;
- mResourceMap.put(result, new String[] { name, type.getName() });
- return result;
- }
-
@SuppressWarnings("unchecked")
public Object loadView(String name, Class[] constructorSignature, Object[] constructorArgs)
throws ClassNotFoundException, Exception {
return null;
}
- public String[] resolveResourceValue(int id) {
+ public Integer getResourceId(ResourceType type, String name) {
+ Integer result = ++mIdCounter;
+ mResourceMap.put(result, Pair.of(type, name));
+ return result;
+ }
+
+ public Pair<ResourceType, String> resolveResourceId(int id) {
return mResourceMap.get(id);
}
- public String resolveResourceValue(int[] id) {
+ public String resolveResourceId(int[] id) {
return null;
}
import com.android.ide.common.api.INode;
import com.android.ide.common.api.Rect;
import com.android.ide.common.layout.BaseLayoutRule.AttributeFilter;
-import com.android.sdklib.util.Pair;
+import com.android.util.Pair;
import java.util.Arrays;
import java.util.HashMap;
import com.android.ide.common.api.INode;
import com.android.ide.common.api.Point;
import com.android.ide.common.api.Rect;
-import com.android.sdklib.util.Pair;
+import com.android.util.Pair;
import java.util.ArrayList;
import java.util.List;
mkdir -p $DEST
-LIBS="sdkstats androidprefs layoutlib_api ide_common ninepatch sdklib sdkuilib resources"
+LIBS="sdkstats androidprefs common layoutlib_api ide_common ninepatch sdklib sdkuilib"
echo "make java libs ..."
make -j3 showcommands $LIBS || die "ADT: Fail to build one of $LIBS."
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/layoutlib_api"/>
<classpathentry kind="var" path="ANDROID_SRC/prebuilt/common/kxml2/kxml2-2.3.0.jar" sourcepath="/ANDROID_SRC/dalvik/libcore/xml/src/main/java"/>
- <classpathentry combineaccessrules="false" kind="src" path="/resources"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/common"/>
<classpathentry kind="output" path="bin"/>
</classpath>
LOCAL_JAVA_LIBRARIES := \
layoutlib_api \
- resources \
+ common \
kxml2-2.3.0
LOCAL_MODULE := ide_common
import com.android.ide.common.rendering.api.ViewInfo;
import com.android.ide.common.rendering.api.Params.RenderingMode;
import com.android.ide.common.rendering.api.Result.Status;
-import com.android.ide.common.rendering.legacy.ILegacyCallback;
+import com.android.ide.common.rendering.legacy.LegacyCallback;
import com.android.ide.common.rendering.legacy.ILegacyPullParser;
import com.android.ide.common.resources.ResourceResolver;
import com.android.ide.common.sdk.LoadStatus;
* For client wanting to access both new and old (pre API level 5) layout libraries, it is
* important that the following interfaces be used:<br>
* {@link ILegacyPullParser} instead of {@link ILayoutPullParser}<br>
- * {@link ILegacyCallback} instead of{@link com.android.ide.common.rendering.api.IProjectCallback}.
+ * {@link LegacyCallback} instead of{@link com.android.ide.common.rendering.api.IProjectCallback}.
* <p/>
* These interfaces will ensure that both new and older Layout libraries can be accessed.
*/
package com.android.ide.common.rendering.legacy;
import com.android.ide.common.rendering.api.IProjectCallback;
+import com.android.resources.ResourceType;
+import com.android.util.Pair;
/**
- * Intermediary interface extending both old and new project call back from the layout lib API.
+ * Intermediary class implementing parts of both the old and new project call back from the
+ * layout lib API.
*
* Clients should use this instead of {@link IProjectCallback} to target both old and new
* Layout Libraries.
*
*/
@SuppressWarnings("deprecation")
-public interface ILegacyCallback extends com.android.ide.common.rendering.api.IProjectCallback,
+public abstract class LegacyCallback implements
+ com.android.ide.common.rendering.api.IProjectCallback,
com.android.layoutlib.api.IProjectCallback {
+
+ // ------ implementation of the old interface using the new interface.
+
+ public final Integer getResourceValue(String type, String name) {
+ return getResourceId(ResourceType.getEnum(type), name);
+ }
+
+ public final String[] resolveResourceValue(int id) {
+ Pair<ResourceType, String> info = resolveResourceId(id);
+ return new String[] { info.getSecond(), info.getFirst().getName() };
+ }
+
+ public final String resolveResourceValue(int[] id) {
+ return resolveResourceId(id);
+ }
+
+ // ------
}
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="var" path="ANDROID_SRC/prebuilt/common/kxml2/kxml2-2.3.0.jar" sourcepath="/ANDROID_SRC/dalvik/libcore/xml/src/main/java"/>
- <classpathentry combineaccessrules="false" kind="src" path="/resources"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/common"/>
<classpathentry kind="output" path="bin"/>
</classpath>
LOCAL_SRC_FILES := $(call all-java-files-under,src)
LOCAL_JAVA_LIBRARIES := \
- resources \
+ common \
kxml2-2.3.0
LOCAL_MODULE := layoutlib_api
package com.android.ide.common.rendering.api;
import com.android.resources.ResourceType;
+import com.android.util.Pair;
/**
* Callback for project information needed by the Layout Library.
* <p/>The resource id is the value of a <code>R.<type>.<name></code>, and
* this method will return both the type and name of the resource.
* @param id the Id to resolve.
- * @return an array of 2 strings containing the resource name and type, or null if the id
- * does not match any resource.
+ * @return a Pair of {@link ResourceType} and resource name, or null if the id
+ * does not match any resource.
*/
- String[] resolveResourceValue(int id);
+ Pair<ResourceType, String> resolveResourceId(int id);
/**
* Resolves the id of a resource Id of type int[]
* @param id the Id to resolve.
* @return the name of the resource or <code>null</code> if not found.
*/
- String resolveResourceValue(int[] id);
+ String resolveResourceId(int[] id);
/**
* Returns the id of a resource.
* @param name the name of the resource
* @return an Integer containing the resource Id, or <code>null</code> if not found.
*/
- Integer getResourceValue(ResourceType type, String name);
-
+ Integer getResourceId(ResourceType type, String name);
}
+++ /dev/null
-resources.jar contains resource configuration enums. It is used by various tools, but also
-by layoutlib.jar
-
-Layoutlib.jar is built from frameworks/base.git and therefore is versioned with the platform.
-
-IMPORTANT NOTE REGARDING CHANGES IN resources.jar:
-
-- The API must stay compatible. This is because while layoutlib.jar compiles against it,
- the client provides the implementation and must be able to load earlier versions of layoutlib.jar.
- This is true for all the classes under com.android.ide.common.rendering.api and
- com.android.layoutlib.api although the latter is obsolete and should not be changed at all.
-
-- Updated version of layoutlib_api should be copied to the current in-dev branch of
- prebuilt/common/resources/resources-prebuilt.jar
- The PREBUILT file in the same folder must be updated as well to reflect how to rebuild this
- prebuilt jar file.
\ No newline at end of file
Main-Class: com.android.sdkmanager.Main
-Class-Path: androidprefs.jar resources.jar sdklib.jar sdkuilib.jar org.eclipse.jface_3.4.2.M20090107-0800.jar org.eclipse.equinox.common_3.4.0.v20080421-2006.jar org.eclipse.core.commands_3.4.0.I20080509-2000.jar
+Class-Path: androidprefs.jar common.jar sdklib.jar sdkuilib.jar org.eclipse.jface_3.4.2.M20090107-0800.jar org.eclipse.equinox.common_3.4.0.v20080421-2006.jar org.eclipse.core.commands_3.4.0.I20080509-2000.jar
<classpathentry combineaccessrules="false" kind="src" path="/AndroidPrefs"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/>
<classpathentry kind="var" path="ANDROID_SRC/prebuilt/common/commons-compress/commons-compress-1.0.jar"/>
- <classpathentry combineaccessrules="false" kind="src" path="/resources"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/common"/>
<classpathentry kind="output" path="bin"/>
</classpath>
LOCAL_JAR_MANIFEST := ../manifest.txt
LOCAL_JAVA_LIBRARIES := \
androidprefs \
- resources \
+ common \
commons-compress-1.0
LOCAL_MODULE := sdklib
import com.android.sdklib.AndroidVersion.AndroidVersionException;
import com.android.sdklib.internal.project.ProjectProperties;
import com.android.sdklib.io.FileWrapper;
-import com.android.sdklib.util.Pair;
+import com.android.util.Pair;
import java.io.File;
import java.io.FileInputStream;
\r
package com.android.sdklib.internal.repository;\r
\r
+import com.android.annotations.VisibleForTesting;\r
+import com.android.annotations.VisibleForTesting.Visibility;\r
import com.android.sdklib.AndroidVersion;\r
import com.android.sdklib.IAndroidTarget;\r
import com.android.sdklib.SdkConstants;\r
import com.android.sdklib.SdkManager;\r
import com.android.sdklib.IAndroidTarget.IOptionalLibrary;\r
-import com.android.sdklib.annotations.VisibleForTesting;\r
-import com.android.sdklib.annotations.VisibleForTesting.Visibility;\r
import com.android.sdklib.internal.repository.Archive.Arch;\r
import com.android.sdklib.internal.repository.Archive.Os;\r
import com.android.sdklib.repository.SdkRepoConstants;\r
\r
package com.android.sdklib.internal.repository;\r
\r
-import com.android.sdklib.annotations.VisibleForTesting;\r
-import com.android.sdklib.annotations.VisibleForTesting.Visibility;\r
+import com.android.annotations.VisibleForTesting;\r
+import com.android.annotations.VisibleForTesting.Visibility;\r
import com.android.sdklib.repository.SdkAddonsListConstants;\r
\r
import org.w3c.dom.Document;\r
import com.android.sdklib.SdkManager;\r
import com.android.sdklib.internal.repository.Archive.Arch;\r
import com.android.sdklib.internal.repository.Archive.Os;\r
-import com.android.sdklib.util.Pair;\r
+import com.android.util.Pair;\r
\r
import java.io.File;\r
import java.io.FileInputStream;\r
\r
package com.android.sdklib.internal.repository;\r
\r
+import com.android.annotations.VisibleForTesting;\r
+import com.android.annotations.VisibleForTesting.Visibility;\r
import com.android.sdklib.AndroidVersion;\r
import com.android.sdklib.IAndroidTarget;\r
import com.android.sdklib.SdkConstants;\r
import com.android.sdklib.SdkManager;\r
-import com.android.sdklib.annotations.VisibleForTesting;\r
-import com.android.sdklib.annotations.VisibleForTesting.Visibility;\r
import com.android.sdklib.internal.repository.Archive.Arch;\r
import com.android.sdklib.internal.repository.Archive.Os;\r
import com.android.sdklib.repository.SdkRepoConstants;\r
package com.android.sdklib.internal.repository;
+import com.android.annotations.VisibleForTesting;
+import com.android.annotations.VisibleForTesting.Visibility;
import com.android.sdklib.SdkConstants;
import com.android.sdklib.SdkManager;
-import com.android.sdklib.annotations.VisibleForTesting;
-import com.android.sdklib.annotations.VisibleForTesting.Visibility;
import com.android.sdklib.internal.repository.Archive.Arch;
import com.android.sdklib.internal.repository.Archive.Os;
\r
package com.android.sdklib.internal.repository;\r
\r
-import com.android.sdklib.annotations.Nullable;\r
+import com.android.annotations.Nullable;\r
import com.android.sdklib.repository.SdkAddonConstants;\r
\r
import org.w3c.dom.Document;\r
\r
package com.android.sdklib.internal.repository;\r
\r
-import com.android.sdklib.annotations.Nullable;\r
+import com.android.annotations.Nullable;\r
import com.android.sdklib.internal.repository.Archive.Arch;\r
import com.android.sdklib.internal.repository.Archive.Os;\r
import com.android.sdklib.repository.RepoConstants;\r
\r
package com.android.sdklib.internal.repository;\r
\r
-import com.android.sdklib.annotations.Nullable;\r
-import com.android.sdklib.annotations.VisibleForTesting;\r
-import com.android.sdklib.annotations.VisibleForTesting.Visibility;\r
+import com.android.annotations.Nullable;\r
+import com.android.annotations.VisibleForTesting;\r
+import com.android.annotations.VisibleForTesting.Visibility;\r
import com.android.sdklib.repository.RepoConstants;\r
import com.android.sdklib.repository.SdkAddonConstants;\r
import com.android.sdklib.repository.SdkRepoConstants;\r
\r
package com.android.sdklib.internal.repository;\r
\r
+import com.android.annotations.VisibleForTesting;\r
+import com.android.annotations.VisibleForTesting.Visibility;\r
import com.android.sdklib.SdkConstants;\r
import com.android.sdklib.SdkManager;\r
-import com.android.sdklib.annotations.VisibleForTesting;\r
-import com.android.sdklib.annotations.VisibleForTesting.Visibility;\r
import com.android.sdklib.internal.repository.Archive.Arch;\r
import com.android.sdklib.internal.repository.Archive.Os;\r
import com.android.sdklib.repository.SdkRepoConstants;\r