aboutsummaryrefslogtreecommitdiffstats
path: root/ide_common/src/com/android/ide/common/rendering
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2011-01-28 15:18:32 -0800
committerXavier Ducrohet <xav@android.com>2011-01-28 16:45:05 -0800
commit1f72cb7cb032538b79e79d6fc7ff3905e9766ce1 (patch)
tree65cc57954e239cd9cd3c9e302b4e6ad574667a78 /ide_common/src/com/android/ide/common/rendering
parent2e97908089f76b4c270f018cbd2e1762511df183 (diff)
downloadsdk-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
Diffstat (limited to 'ide_common/src/com/android/ide/common/rendering')
-rw-r--r--ide_common/src/com/android/ide/common/rendering/LayoutLibrary.java4
-rw-r--r--ide_common/src/com/android/ide/common/rendering/legacy/LegacyCallback.java (renamed from ide_common/src/com/android/ide/common/rendering/legacy/ILegacyCallback.java)25
2 files changed, 25 insertions, 4 deletions
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);
+ }
+
+ // ------
}