aboutsummaryrefslogtreecommitdiffstats
path: root/layoutlib_api/src/com/android/ide/common/rendering
diff options
context:
space:
mode:
Diffstat (limited to 'layoutlib_api/src/com/android/ide/common/rendering')
-rw-r--r--layoutlib_api/src/com/android/ide/common/rendering/api/DensityBasedResourceValue.java3
-rw-r--r--layoutlib_api/src/com/android/ide/common/rendering/api/IProjectCallback.java4
-rw-r--r--layoutlib_api/src/com/android/ide/common/rendering/api/RenderResources.java21
-rw-r--r--layoutlib_api/src/com/android/ide/common/rendering/api/ResourceValue.java15
-rw-r--r--layoutlib_api/src/com/android/ide/common/rendering/api/StyleResourceValue.java6
5 files changed, 25 insertions, 24 deletions
diff --git a/layoutlib_api/src/com/android/ide/common/rendering/api/DensityBasedResourceValue.java b/layoutlib_api/src/com/android/ide/common/rendering/api/DensityBasedResourceValue.java
index 4d0d51f..12bd57c 100644
--- a/layoutlib_api/src/com/android/ide/common/rendering/api/DensityBasedResourceValue.java
+++ b/layoutlib_api/src/com/android/ide/common/rendering/api/DensityBasedResourceValue.java
@@ -17,13 +17,14 @@
package com.android.ide.common.rendering.api;
import com.android.layoutlib.api.IDensityBasedResourceValue;
+import com.android.resources.ResourceType;
@SuppressWarnings("deprecation")
public class DensityBasedResourceValue extends ResourceValue implements IDensityBasedResourceValue {
private com.android.resources.Density mDensity;
- public DensityBasedResourceValue(String type, String name, String value,
+ public DensityBasedResourceValue(ResourceType type, String name, String value,
com.android.resources.Density density, boolean isFramework) {
super(type, name, value, isFramework);
mDensity = density;
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 67e082e..aebc5a5 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
@@ -16,6 +16,8 @@
package com.android.ide.common.rendering.api;
+import com.android.resources.ResourceType;
+
/**
* Callback for project information needed by the Layout Library.
* Classes implementing this interface provide methods giving access to some project data, like
@@ -69,6 +71,6 @@ 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(String type, String name);
+ Integer getResourceValue(ResourceType type, String name);
}
diff --git a/layoutlib_api/src/com/android/ide/common/rendering/api/RenderResources.java b/layoutlib_api/src/com/android/ide/common/rendering/api/RenderResources.java
index ce86c9a..ea572bc 100644
--- a/layoutlib_api/src/com/android/ide/common/rendering/api/RenderResources.java
+++ b/layoutlib_api/src/com/android/ide/common/rendering/api/RenderResources.java
@@ -16,6 +16,8 @@
package com.android.ide.common.rendering.api;
+import com.android.resources.ResourceType;
+
/**
* A class containing all the resources needed to do a rendering.
* <p/>
@@ -24,21 +26,10 @@ package com.android.ide.common.rendering.api;
*/
public class RenderResources {
- public final static String RES_ANIMATOR = "animator";
- public final static String RES_STYLE = "style";
- public final static String RES_ATTR = "attr";
- public final static String RES_DIMEN = "dimen";
- public final static String RES_DRAWABLE = "drawable";
- public final static String RES_COLOR = "color";
- public final static String RES_LAYOUT = "layout";
- public final static String RES_STRING = "string";
- public final static String RES_ID = "id";
-
public final static String REFERENCE_NULL = "@null";
-
public static class FrameworkResourceIdProvider {
- public Integer getId(String resType, String resName) {
+ public Integer getId(ResourceType resType, String resName) {
return null;
}
}
@@ -83,7 +74,7 @@ public class RenderResources {
* @param resourceType the type of the resource
* @param resourceName the name of the resource
*/
- public ResourceValue getFrameworkResource(String resourceType, String resourceName) {
+ public ResourceValue getFrameworkResource(ResourceType resourceType, String resourceName) {
return null;
}
@@ -92,7 +83,7 @@ public class RenderResources {
* @param resourceType the type of the resource
* @param resourceName the name of the resource
*/
- public ResourceValue getProjectResource(String resourceType, String resourceName) {
+ public ResourceValue getProjectResource(ResourceType resourceType, String resourceName) {
return null;
}
@@ -165,7 +156,7 @@ public class RenderResources {
*
* @return the resolved resource value or <code>null</code> if it failed to resolve it.
*/
- public ResourceValue resolveValue(String type, String name, String value,
+ public ResourceValue resolveValue(ResourceType type, String name, String value,
boolean isFrameworkValue) {
return null;
}
diff --git a/layoutlib_api/src/com/android/ide/common/rendering/api/ResourceValue.java b/layoutlib_api/src/com/android/ide/common/rendering/api/ResourceValue.java
index f59f3c3..76561c8 100644
--- a/layoutlib_api/src/com/android/ide/common/rendering/api/ResourceValue.java
+++ b/layoutlib_api/src/com/android/ide/common/rendering/api/ResourceValue.java
@@ -17,35 +17,41 @@
package com.android.ide.common.rendering.api;
import com.android.layoutlib.api.IResourceValue;
+import com.android.resources.ResourceType;
/**
* Represents an android resource with a name and a string value.
*/
@SuppressWarnings("deprecation")
public class ResourceValue implements IResourceValue {
- private final String mType;
+ private final ResourceType mType;
private final String mName;
private String mValue = null;
private final boolean mIsFramwork;
- public ResourceValue(String type, String name, boolean isFramwork) {
+ public ResourceValue(ResourceType type, String name, boolean isFramwork) {
mType = type;
mName = name;
mIsFramwork = isFramwork;
}
- public ResourceValue(String type, String name, String value, boolean isFramework) {
+ public ResourceValue(ResourceType type, String name, String value, boolean isFramework) {
mType = type;
mName = name;
mValue = value;
mIsFramwork = isFramework;
}
+ public ResourceType getResourceType() {
+ return mType;
+ }
+
/**
* Returns the type of the resource. For instance "drawable", "color", etc...
+ * @deprecated use {@link #getResourceType()} instead.
*/
public String getType() {
- return mType;
+ return mType.getName();
}
/**
@@ -70,7 +76,6 @@ public class ResourceValue implements IResourceValue {
return mIsFramwork;
}
-
/**
* Sets the value of the resource.
* @param value the new value
diff --git a/layoutlib_api/src/com/android/ide/common/rendering/api/StyleResourceValue.java b/layoutlib_api/src/com/android/ide/common/rendering/api/StyleResourceValue.java
index a9f499f..429bd26 100644
--- a/layoutlib_api/src/com/android/ide/common/rendering/api/StyleResourceValue.java
+++ b/layoutlib_api/src/com/android/ide/common/rendering/api/StyleResourceValue.java
@@ -18,6 +18,7 @@ package com.android.ide.common.rendering.api;
import com.android.layoutlib.api.IResourceValue;
import com.android.layoutlib.api.IStyleResourceValue;
+import com.android.resources.ResourceType;
import java.util.HashMap;
@@ -30,11 +31,12 @@ public final class StyleResourceValue extends ResourceValue implements IStyleRes
private String mParentStyle = null;
private HashMap<String, ResourceValue> mItems = new HashMap<String, ResourceValue>();
- public StyleResourceValue(String type, String name, boolean isFramework) {
+ public StyleResourceValue(ResourceType type, String name, boolean isFramework) {
super(type, name, isFramework);
}
- public StyleResourceValue(String type, String name, String parentStyle, boolean isFramework) {
+ public StyleResourceValue(ResourceType type, String name, String parentStyle,
+ boolean isFramework) {
super(type, name, isFramework);
mParentStyle = parentStyle;
}