aboutsummaryrefslogtreecommitdiffstats
path: root/ide_common/src/com
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2011-01-26 19:24:43 -0800
committerXavier Ducrohet <xav@android.com>2011-01-26 19:27:31 -0800
commitb4f5eb9edc970809c3ef2ab4272e3fb3e24f89db (patch)
tree005fd291f49016b7db4a95d9d23db667632fe64b /ide_common/src/com
parent6aeb047ea010de8f3e820dab6625aef762418de6 (diff)
downloadsdk-b4f5eb9edc970809c3ef2ab4272e3fb3e24f89db.zip
sdk-b4f5eb9edc970809c3ef2ab4272e3fb3e24f89db.tar.gz
sdk-b4f5eb9edc970809c3ef2ab4272e3fb3e24f89db.tar.bz2
Add more theme query APIs to RenderResources
Change-Id: Iebde7536a0007898387dc7bb5d943e3767140a3c
Diffstat (limited to 'ide_common/src/com')
-rw-r--r--ide_common/src/com/android/ide/common/resources/ResourceResolver.java37
1 files changed, 36 insertions, 1 deletions
diff --git a/ide_common/src/com/android/ide/common/resources/ResourceResolver.java b/ide_common/src/com/android/ide/common/resources/ResourceResolver.java
index 4fb0d3d..ddfe2bc 100644
--- a/ide_common/src/com/android/ide/common/resources/ResourceResolver.java
+++ b/ide_common/src/com/android/ide/common/resources/ResourceResolver.java
@@ -109,11 +109,46 @@ public class ResourceResolver extends RenderResources {
}
@Override
- public StyleResourceValue getTheme() {
+ public StyleResourceValue getCurrentTheme() {
return mTheme;
}
@Override
+ public StyleResourceValue getTheme(String name, boolean frameworkTheme) {
+ ResourceValue theme = null;
+
+ if (frameworkTheme) {
+ Map<String, ResourceValue> frameworkStyleMap = mFrameworkResources.get(RES_STYLE);
+ if (frameworkStyleMap != null) {
+ theme = frameworkStyleMap.get(name);
+ }
+ } else {
+ Map<String, ResourceValue> projectStyleMap = mProjectResources.get(RES_STYLE);
+ if (projectStyleMap != null) {
+ theme = projectStyleMap.get(name);
+ }
+ }
+
+ if (theme instanceof StyleResourceValue) {
+ return (StyleResourceValue) theme;
+ }
+
+ return null;
+ }
+
+ @Override
+ public boolean themeIsParentOf(StyleResourceValue parentTheme, StyleResourceValue childTheme) {
+ do {
+ childTheme = mStyleInheritanceMap.get(childTheme);
+ if (childTheme == null) {
+ return false;
+ } else if (childTheme == parentTheme) {
+ return true;
+ }
+ } while (true);
+ }
+
+ @Override
public ResourceValue getFrameworkResource(String resourceType, String resourceName) {
return getResource(resourceType, resourceName, mFrameworkResources);
}