diff options
author | Xavier Ducrohet <xav@android.com> | 2011-01-28 15:18:32 -0800 |
---|---|---|
committer | Xavier Ducrohet <xav@android.com> | 2011-01-28 16:45:05 -0800 |
commit | 1f72cb7cb032538b79e79d6fc7ff3905e9766ce1 (patch) | |
tree | 65cc57954e239cd9cd3c9e302b4e6ad574667a78 | |
parent | 2e97908089f76b4c270f018cbd2e1762511df183 (diff) | |
download | sdk-1f72cb7cb032538b79e79d6fc7ff3905e9766ce1.zip sdk-1f72cb7cb032538b79e79d6fc7ff3905e9766ce1.tar.gz sdk-1f72cb7cb032538b79e79d6fc7ff3905e9766ce1.tar.bz2 |
Move Pair and annoatations into resources.jar now renamed as common.jar
Move all the resource query methods that returned an array of 2 Strings
to return a pair of ResourceType and String.
Change-Id: I6b8447aa27005de786e2defef81ad88a72363523
69 files changed, 134 insertions, 120 deletions
diff --git a/resources/.classpath b/common/.classpath index fb50116..fb50116 100644 --- a/resources/.classpath +++ b/common/.classpath diff --git a/resources/.gitignore b/common/.gitignore index fe99505..fe99505 100644 --- a/resources/.gitignore +++ b/common/.gitignore diff --git a/resources/.project b/common/.project index 36b452a..3a7717d 100644 --- a/resources/.project +++ b/common/.project @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="UTF-8"?> <projectDescription> - <name>resources</name> + <name>common</name> <comment></comment> <projects> </projects> diff --git a/resources/Android.mk b/common/Android.mk index 5027a01..aa2ba8e 100644 --- a/resources/Android.mk +++ b/common/Android.mk @@ -20,7 +20,7 @@ LOCAL_SRC_FILES := $(call all-java-files-under,src) LOCAL_JAVA_LIBRARIES := \ -LOCAL_MODULE := resources +LOCAL_MODULE := common LOCAL_MODULE_TAGS := optional diff --git a/common/README.txt b/common/README.txt new file mode 100644 index 0000000..d4c6232 --- /dev/null +++ b/common/README.txt @@ -0,0 +1,14 @@ +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 diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/annotations/Nullable.java b/common/src/com/android/annotations/Nullable.java index 3b5e955..0de1b6f 100755 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/annotations/Nullable.java +++ b/common/src/com/android/annotations/Nullable.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.sdklib.annotations; +package com.android.annotations; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/annotations/VisibleForTesting.java b/common/src/com/android/annotations/VisibleForTesting.java index 86d1c99..6741d93 100755 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/annotations/VisibleForTesting.java +++ b/common/src/com/android/annotations/VisibleForTesting.java @@ -14,7 +14,7 @@ * limitations under the License. */ -package com.android.sdklib.annotations; +package com.android.annotations; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; diff --git a/resources/src/com/android/resources/Density.java b/common/src/com/android/resources/Density.java index c1d7e3f..c1d7e3f 100644 --- a/resources/src/com/android/resources/Density.java +++ b/common/src/com/android/resources/Density.java diff --git a/resources/src/com/android/resources/DockMode.java b/common/src/com/android/resources/DockMode.java index bbae6bf..bbae6bf 100644 --- a/resources/src/com/android/resources/DockMode.java +++ b/common/src/com/android/resources/DockMode.java diff --git a/resources/src/com/android/resources/Keyboard.java b/common/src/com/android/resources/Keyboard.java index eb99f9b..eb99f9b 100644 --- a/resources/src/com/android/resources/Keyboard.java +++ b/common/src/com/android/resources/Keyboard.java diff --git a/resources/src/com/android/resources/KeyboardState.java b/common/src/com/android/resources/KeyboardState.java index e3333f5..e3333f5 100644 --- a/resources/src/com/android/resources/KeyboardState.java +++ b/common/src/com/android/resources/KeyboardState.java diff --git a/resources/src/com/android/resources/Navigation.java b/common/src/com/android/resources/Navigation.java index d5d9541..d5d9541 100644 --- a/resources/src/com/android/resources/Navigation.java +++ b/common/src/com/android/resources/Navigation.java diff --git a/resources/src/com/android/resources/NavigationState.java b/common/src/com/android/resources/NavigationState.java index 266d9da..266d9da 100644 --- a/resources/src/com/android/resources/NavigationState.java +++ b/common/src/com/android/resources/NavigationState.java diff --git a/resources/src/com/android/resources/NightMode.java b/common/src/com/android/resources/NightMode.java index 2d64316..2d64316 100644 --- a/resources/src/com/android/resources/NightMode.java +++ b/common/src/com/android/resources/NightMode.java diff --git a/resources/src/com/android/resources/ResourceEnum.java b/common/src/com/android/resources/ResourceEnum.java index 7f4e16a..7f4e16a 100644 --- a/resources/src/com/android/resources/ResourceEnum.java +++ b/common/src/com/android/resources/ResourceEnum.java diff --git a/resources/src/com/android/resources/ResourceType.java b/common/src/com/android/resources/ResourceType.java index f5f7063..f5f7063 100644 --- a/resources/src/com/android/resources/ResourceType.java +++ b/common/src/com/android/resources/ResourceType.java diff --git a/resources/src/com/android/resources/ScreenOrientation.java b/common/src/com/android/resources/ScreenOrientation.java index 56f907b..56f907b 100644 --- a/resources/src/com/android/resources/ScreenOrientation.java +++ b/common/src/com/android/resources/ScreenOrientation.java diff --git a/resources/src/com/android/resources/ScreenRatio.java b/common/src/com/android/resources/ScreenRatio.java index 2794b6e..2794b6e 100644 --- a/resources/src/com/android/resources/ScreenRatio.java +++ b/common/src/com/android/resources/ScreenRatio.java diff --git a/resources/src/com/android/resources/ScreenSize.java b/common/src/com/android/resources/ScreenSize.java index b6ffc50..b6ffc50 100644 --- a/resources/src/com/android/resources/ScreenSize.java +++ b/common/src/com/android/resources/ScreenSize.java diff --git a/resources/src/com/android/resources/TouchScreen.java b/common/src/com/android/resources/TouchScreen.java index 7ee1f0f..7ee1f0f 100644 --- a/resources/src/com/android/resources/TouchScreen.java +++ b/common/src/com/android/resources/TouchScreen.java diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/util/Pair.java b/common/src/com/android/util/Pair.java index e07381c..8817cd7 100644 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/util/Pair.java +++ b/common/src/com/android/util/Pair.java @@ -14,7 +14,7 @@ * 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 diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/.classpath b/eclipse/plugins/com.android.ide.eclipse.adt/.classpath index 0e42f20..7a693db 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/.classpath +++ b/eclipse/plugins/com.android.ide.eclipse.adt/.classpath @@ -12,7 +12,7 @@ <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"/> diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF b/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF index 0409880..bea92fe 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF +++ b/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF @@ -13,7 +13,7 @@ Bundle-ClassPath: ., 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, @@ -47,7 +47,8 @@ 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", @@ -110,7 +111,6 @@ Export-Package: com.android.ide.common.api;x-friends:="com.android.ide.eclipse.t 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", @@ -128,6 +128,7 @@ Export-Package: com.android.ide.common.api;x-friends:="com.android.ide.eclipse.t 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", diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/build.properties b/eclipse/plugins/com.android.ide.eclipse.adt/build.properties index 9eb0d29..96d191e 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/build.properties +++ b/eclipse/plugins/com.android.ide.eclipse.adt/build.properties @@ -7,7 +7,8 @@ bin.includes = plugin.xml,\ libs/,\ about.properties,\ NOTICE,\ - about.html + about.html,\ + libs/common.jar source.. = src/ output.. = bin/ bin.excludes = libs/.gitignore diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/api/IClientRulesEngine.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/api/IClientRulesEngine.java index 6a01e8a..4f91552 100755 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/api/IClientRulesEngine.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/api/IClientRulesEngine.java @@ -17,7 +17,7 @@ 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 diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/api/MenuAction.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/api/MenuAction.java index d82049d..e4d7ebf 100755 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/api/MenuAction.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/api/MenuAction.java @@ -16,7 +16,7 @@ package com.android.ide.common.api; -import com.android.sdklib.annotations.Nullable; +import com.android.annotations.Nullable; import java.util.Map; diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/AbsoluteLayoutRule.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/AbsoluteLayoutRule.java index f0005cc..2fa20ea 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/AbsoluteLayoutRule.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/AbsoluteLayoutRule.java @@ -28,7 +28,7 @@ import com.android.ide.common.api.INodeHandler; 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; diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/BaseLayoutRule.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/BaseLayoutRule.java index 69548c3..91110cb 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/BaseLayoutRule.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/BaseLayoutRule.java @@ -32,7 +32,7 @@ import com.android.ide.common.api.Point; 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; diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/FrameLayoutRule.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/FrameLayoutRule.java index ef0be13..1054c56 100755 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/FrameLayoutRule.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/FrameLayoutRule.java @@ -26,7 +26,7 @@ import com.android.ide.common.api.INodeHandler; 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; diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/RelativeLayoutRule.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/RelativeLayoutRule.java index 194ac41..b80f2ec 100755 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/RelativeLayoutRule.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/RelativeLayoutRule.java @@ -50,7 +50,7 @@ import com.android.ide.common.api.Point; 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; diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/ProjectCallback.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/ProjectCallback.java index 824d0e1..976dfaf 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/ProjectCallback.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/ProjectCallback.java @@ -18,7 +18,7 @@ package com.android.ide.eclipse.adt.internal.editors.layout; 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; @@ -27,6 +27,7 @@ import com.android.ide.eclipse.adt.internal.resources.manager.ProjectResources; 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; @@ -41,7 +42,7 @@ import java.util.TreeSet; * <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>(); @@ -205,7 +206,7 @@ public final class ProjectCallback implements ILegacyCallback { return mNamespace; } - public String[] resolveResourceValue(int id) { + public Pair<ResourceType, String> resolveResourceId(int id) { if (mProjectRes != null) { return mProjectRes.resolveResourceValue(id); } @@ -213,7 +214,7 @@ public final class ProjectCallback implements ILegacyCallback { return null; } - public String resolveResourceValue(int[] id) { + public String resolveResourceId(int[] id) { if (mProjectRes != null) { return mProjectRes.resolveResourceValue(id); } @@ -221,14 +222,7 @@ public final class ProjectCallback implements ILegacyCallback { 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); } diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ExtractIncludeAction.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ExtractIncludeAction.java index 46ec8f3..8c2c956 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ExtractIncludeAction.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/ExtractIncludeAction.java @@ -41,7 +41,7 @@ import com.android.ide.eclipse.adt.internal.editors.layout.uimodel.UiViewElement 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; diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/IncludeFinder.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/IncludeFinder.java index e7a7fdf..9ca5ae7 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/IncludeFinder.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/IncludeFinder.java @@ -20,11 +20,13 @@ import static com.android.ide.eclipse.adt.AndroidConstants.EXT_XML; 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; @@ -37,7 +39,6 @@ import com.android.ide.eclipse.adt.internal.resources.manager.ResourceManager.IR 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; diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/IncludeOverlay.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/IncludeOverlay.java index e201c14..84f3e01 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/IncludeOverlay.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/IncludeOverlay.java @@ -16,7 +16,7 @@ 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; diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/OutlinePage.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/OutlinePage.java index 4870894..d7bc412 100755 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/OutlinePage.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/OutlinePage.java @@ -21,8 +21,10 @@ import static com.android.ide.common.layout.LayoutConstants.ATTR_SRC; 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; @@ -37,8 +39,7 @@ import com.android.ide.eclipse.adt.internal.editors.layout.gre.NodeProxy; 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; diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PaletteControl.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PaletteControl.java index fbf7167..fdc559d 100755 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PaletteControl.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PaletteControl.java @@ -50,7 +50,7 @@ import com.android.ide.eclipse.adt.internal.sdk.AndroidTargetData; 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; diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PlayAnimationMenu.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PlayAnimationMenu.java index 79c68d9..3fcae86 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PlayAnimationMenu.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PlayAnimationMenu.java @@ -27,7 +27,7 @@ import com.android.ide.eclipse.adt.AdtPlugin; 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; diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PreviewIconFactory.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PreviewIconFactory.java index a93c81e..2fb2ebe 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PreviewIconFactory.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/PreviewIconFactory.java @@ -36,7 +36,7 @@ import com.android.ide.eclipse.adt.internal.editors.layout.gre.ViewMetadataRepos 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; diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gre/ViewMetadataRepository.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gre/ViewMetadataRepository.java index 049ac64..589ad2d 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gre/ViewMetadataRepository.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gre/ViewMetadataRepository.java @@ -27,7 +27,7 @@ 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.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; diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/xml/Hyperlinks.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/xml/Hyperlinks.java index 5225911..c6ca95e 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/xml/Hyperlinks.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/xml/Hyperlinks.java @@ -32,6 +32,7 @@ import static com.android.sdklib.xml.AndroidManifest.ATTRIBUTE_PACKAGE; 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; @@ -51,9 +52,8 @@ import com.android.ide.eclipse.adt.io.IFileWrapper; 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; diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/CompiledResourcesMonitor.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/CompiledResourcesMonitor.java index 2233cab..295fd4c 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/CompiledResourcesMonitor.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/CompiledResourcesMonitor.java @@ -24,6 +24,7 @@ import com.android.ide.eclipse.adt.internal.resources.manager.GlobalProjectMonit 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; @@ -150,8 +151,8 @@ public final class CompiledResourcesMonitor implements IFileListener, IProjectLi // 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>(); @@ -181,7 +182,8 @@ public final class CompiledResourcesMonitor implements IFileListener, IProjectLi * @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 { @@ -205,8 +207,7 @@ public final class CompiledResourcesMonitor implements IFileListener, IProjectLi 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; diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/ProjectResources.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/ProjectResources.java index f0939da..64a36e1 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/ProjectResources.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/ProjectResources.java @@ -28,6 +28,7 @@ import com.android.ide.eclipse.adt.internal.sdk.Sdk; 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; @@ -62,7 +63,7 @@ public class ProjectResources implements IResourceRepository { /** 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; @@ -522,7 +523,7 @@ public class ProjectResources implements IResourceRepository { * @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); } @@ -922,7 +923,7 @@ public class ProjectResources implements IResourceRepository { * @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; diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newxmlfile/NewXmlFileCreationPage.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newxmlfile/NewXmlFileCreationPage.java index b20da44..03aed88 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newxmlfile/NewXmlFileCreationPage.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newxmlfile/NewXmlFileCreationPage.java @@ -38,7 +38,7 @@ import com.android.ide.eclipse.adt.internal.ui.ConfigurationSelector.Configurati 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; diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/.classpath b/eclipse/plugins/com.android.ide.eclipse.tests/.classpath index b9a72c4..28377f7 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/.classpath +++ b/eclipse/plugins/com.android.ide.eclipse.tests/.classpath @@ -13,6 +13,6 @@ <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> diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java index 3e66649..13d9a49 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java +++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java @@ -39,12 +39,11 @@ import com.android.ide.eclipse.adt.internal.resources.manager.ProjectResources; 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; @@ -52,6 +51,7 @@ import com.android.resources.TouchScreen; 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; @@ -68,7 +68,7 @@ import javax.imageio.ImageIO; 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 { @@ -94,7 +94,8 @@ public class ApiDemosRenderingTest extends SdkTestCase { // 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; @@ -103,18 +104,6 @@ public class ApiDemosRenderingTest extends SdkTestCase { 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 { @@ -122,11 +111,17 @@ public class ApiDemosRenderingTest extends SdkTestCase { 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; } diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/BaseLayoutRuleTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/BaseLayoutRuleTest.java index 8fac515..f914e5f 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/BaseLayoutRuleTest.java +++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/BaseLayoutRuleTest.java @@ -23,7 +23,7 @@ import com.android.ide.common.api.IDragElement; 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; diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/RelativeLayoutRuleTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/RelativeLayoutRuleTest.java index 8ccbb25..c0fa548 100644 --- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/RelativeLayoutRuleTest.java +++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/RelativeLayoutRuleTest.java @@ -21,7 +21,7 @@ import static com.android.ide.common.layout.LayoutConstants.ANDROID_URI; 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; diff --git a/eclipse/scripts/create_adt_symlinks.sh b/eclipse/scripts/create_adt_symlinks.sh index 6b70bf4..949362e 100755 --- a/eclipse/scripts/create_adt_symlinks.sh +++ b/eclipse/scripts/create_adt_symlinks.sh @@ -16,7 +16,7 @@ BACK=`echo $DEST | sed 's@[^/]*@..@g'` 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." diff --git a/ide_common/.classpath b/ide_common/.classpath index 9d91c20..89ce2dd 100644 --- a/ide_common/.classpath +++ b/ide_common/.classpath @@ -4,6 +4,6 @@ <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> diff --git a/ide_common/Android.mk b/ide_common/Android.mk index 2cb3f84..5316703 100644 --- a/ide_common/Android.mk +++ b/ide_common/Android.mk @@ -20,7 +20,7 @@ LOCAL_SRC_FILES := $(call all-java-files-under,src) LOCAL_JAVA_LIBRARIES := \ layoutlib_api \ - resources \ + common \ kxml2-2.3.0 LOCAL_MODULE := ide_common diff --git a/ide_common/src/com/android/ide/common/rendering/LayoutLibrary.java b/ide_common/src/com/android/ide/common/rendering/LayoutLibrary.java index 6fe7f10..e7ea32e 100644 --- a/ide_common/src/com/android/ide/common/rendering/LayoutLibrary.java +++ b/ide_common/src/com/android/ide/common/rendering/LayoutLibrary.java @@ -28,7 +28,7 @@ import com.android.ide.common.rendering.api.Result; 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; @@ -65,7 +65,7 @@ import java.util.Map.Entry; * 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. */ diff --git a/ide_common/src/com/android/ide/common/rendering/legacy/ILegacyCallback.java b/ide_common/src/com/android/ide/common/rendering/legacy/LegacyCallback.java index 000c7c5..f4bc15a 100644 --- a/ide_common/src/com/android/ide/common/rendering/legacy/ILegacyCallback.java +++ b/ide_common/src/com/android/ide/common/rendering/legacy/LegacyCallback.java @@ -17,15 +17,36 @@ 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); + } + + // ------ } diff --git a/layoutlib_api/.classpath b/layoutlib_api/.classpath index bae87a9..4095535 100644 --- a/layoutlib_api/.classpath +++ b/layoutlib_api/.classpath @@ -3,6 +3,6 @@ <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> diff --git a/layoutlib_api/Android.mk b/layoutlib_api/Android.mk index 4ebf1f6..30ce41b 100644 --- a/layoutlib_api/Android.mk +++ b/layoutlib_api/Android.mk @@ -19,7 +19,7 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES := $(call all-java-files-under,src) LOCAL_JAVA_LIBRARIES := \ - resources \ + common \ kxml2-2.3.0 LOCAL_MODULE := layoutlib_api diff --git a/layoutlib_api/src/com/android/ide/common/rendering/api/IProjectCallback.java b/layoutlib_api/src/com/android/ide/common/rendering/api/IProjectCallback.java index aebc5a5..0ec214f 100644 --- a/layoutlib_api/src/com/android/ide/common/rendering/api/IProjectCallback.java +++ b/layoutlib_api/src/com/android/ide/common/rendering/api/IProjectCallback.java @@ -17,6 +17,7 @@ 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. @@ -49,10 +50,10 @@ public interface IProjectCallback { * <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[] @@ -61,7 +62,7 @@ public interface IProjectCallback { * @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. @@ -71,6 +72,5 @@ public interface IProjectCallback { * @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); } diff --git a/resources/README.txt b/resources/README.txt deleted file mode 100644 index 9b90814..0000000 --- a/resources/README.txt +++ /dev/null @@ -1,16 +0,0 @@ -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 diff --git a/sdkmanager/app/etc/manifest.txt b/sdkmanager/app/etc/manifest.txt index 50f3e66..51845c7 100644 --- a/sdkmanager/app/etc/manifest.txt +++ b/sdkmanager/app/etc/manifest.txt @@ -1,2 +1,2 @@ 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 diff --git a/sdkmanager/libs/sdklib/.classpath b/sdkmanager/libs/sdklib/.classpath index b3528a4..174a804 100644 --- a/sdkmanager/libs/sdklib/.classpath +++ b/sdkmanager/libs/sdklib/.classpath @@ -6,6 +6,6 @@ <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> diff --git a/sdkmanager/libs/sdklib/src/Android.mk b/sdkmanager/libs/sdklib/src/Android.mk index 3c91e88..37eda21 100644 --- a/sdkmanager/libs/sdklib/src/Android.mk +++ b/sdkmanager/libs/sdklib/src/Android.mk @@ -21,7 +21,7 @@ LOCAL_JAVA_RESOURCE_DIRS := . LOCAL_JAR_MANIFEST := ../manifest.txt LOCAL_JAVA_LIBRARIES := \ androidprefs \ - resources \ + common \ commons-compress-1.0 LOCAL_MODULE := sdklib diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkManager.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkManager.java index 2920674..767e582 100644 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkManager.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/SdkManager.java @@ -21,7 +21,7 @@ import com.android.prefs.AndroidLocation.AndroidLocationException; 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; diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/AddonPackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/AddonPackage.java index ab27561..9a90b2c 100755 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/AddonPackage.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/AddonPackage.java @@ -16,13 +16,13 @@ package com.android.sdklib.internal.repository;
+import com.android.annotations.VisibleForTesting;
+import com.android.annotations.VisibleForTesting.Visibility;
import com.android.sdklib.AndroidVersion;
import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.SdkConstants;
import com.android.sdklib.SdkManager;
import com.android.sdklib.IAndroidTarget.IOptionalLibrary;
-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;
import com.android.sdklib.repository.SdkRepoConstants;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/AddonsListFetcher.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/AddonsListFetcher.java index fcef972..9b8d808 100755 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/AddonsListFetcher.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/AddonsListFetcher.java @@ -16,8 +16,8 @@ package com.android.sdklib.internal.repository;
-import com.android.sdklib.annotations.VisibleForTesting;
-import com.android.sdklib.annotations.VisibleForTesting.Visibility;
+import com.android.annotations.VisibleForTesting;
+import com.android.annotations.VisibleForTesting.Visibility;
import com.android.sdklib.repository.SdkAddonsListConstants;
import org.w3c.dom.Document;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/LocalSdkParser.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/LocalSdkParser.java index e0a6b21..9a2bf46 100755 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/LocalSdkParser.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/LocalSdkParser.java @@ -22,7 +22,7 @@ import com.android.sdklib.SdkConstants; import com.android.sdklib.SdkManager;
import com.android.sdklib.internal.repository.Archive.Arch;
import com.android.sdklib.internal.repository.Archive.Os;
-import com.android.sdklib.util.Pair;
+import com.android.util.Pair;
import java.io.File;
import java.io.FileInputStream;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/PlatformPackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/PlatformPackage.java index b8a8623..8dee635 100755 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/PlatformPackage.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/PlatformPackage.java @@ -16,12 +16,12 @@ package com.android.sdklib.internal.repository;
+import com.android.annotations.VisibleForTesting;
+import com.android.annotations.VisibleForTesting.Visibility;
import com.android.sdklib.AndroidVersion;
import com.android.sdklib.IAndroidTarget;
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;
import com.android.sdklib.repository.SdkRepoConstants;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/PlatformToolPackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/PlatformToolPackage.java index c31325f..860d703 100755 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/PlatformToolPackage.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/PlatformToolPackage.java @@ -16,10 +16,10 @@ 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; diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SdkAddonSource.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SdkAddonSource.java index 049dad8..b79cc90 100755 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SdkAddonSource.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SdkAddonSource.java @@ -16,7 +16,7 @@ package com.android.sdklib.internal.repository;
-import com.android.sdklib.annotations.Nullable;
+import com.android.annotations.Nullable;
import com.android.sdklib.repository.SdkAddonConstants;
import org.w3c.dom.Document;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SdkRepoSource.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SdkRepoSource.java index 9b63be3..43e49e3 100755 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SdkRepoSource.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SdkRepoSource.java @@ -16,7 +16,7 @@ package com.android.sdklib.internal.repository;
-import com.android.sdklib.annotations.Nullable;
+import com.android.annotations.Nullable;
import com.android.sdklib.internal.repository.Archive.Arch;
import com.android.sdklib.internal.repository.Archive.Os;
import com.android.sdklib.repository.RepoConstants;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SdkSource.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SdkSource.java index 2a917a1..77eb981 100755 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SdkSource.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/SdkSource.java @@ -16,9 +16,9 @@ package com.android.sdklib.internal.repository;
-import com.android.sdklib.annotations.Nullable;
-import com.android.sdklib.annotations.VisibleForTesting;
-import com.android.sdklib.annotations.VisibleForTesting.Visibility;
+import com.android.annotations.Nullable;
+import com.android.annotations.VisibleForTesting;
+import com.android.annotations.VisibleForTesting.Visibility;
import com.android.sdklib.repository.RepoConstants;
import com.android.sdklib.repository.SdkAddonConstants;
import com.android.sdklib.repository.SdkRepoConstants;
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/ToolPackage.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/ToolPackage.java index 73ddc24..6e53dd7 100755 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/ToolPackage.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/internal/repository/ToolPackage.java @@ -16,10 +16,10 @@ 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;
import com.android.sdklib.repository.SdkRepoConstants;
|