diff options
author | Xavier Ducrohet <xav@android.com> | 2010-12-14 12:03:21 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-12-14 12:03:21 -0800 |
commit | d28378c903cf800882889619c7771f060d85b712 (patch) | |
tree | ebdf40bd997f3e02d55425275ad3708828f4affe /tools | |
parent | e7018262d1475a826af9419cba2a4bc51bb449c8 (diff) | |
parent | 90c6b7e639921e264ac65699439578bcbdbf583a (diff) | |
download | frameworks_base-d28378c903cf800882889619c7771f060d85b712.zip frameworks_base-d28378c903cf800882889619c7771f060d85b712.tar.gz frameworks_base-d28378c903cf800882889619c7771f060d85b712.tar.bz2 |
Merge "LayoutLib: Use the new ninepatch API to suppor density."
Diffstat (limited to 'tools')
4 files changed, 11 insertions, 8 deletions
diff --git a/tools/layoutlib/bridge/.classpath b/tools/layoutlib/bridge/.classpath index 7204ace..2102eb1 100644 --- a/tools/layoutlib/bridge/.classpath +++ b/tools/layoutlib/bridge/.classpath @@ -6,7 +6,7 @@ <classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/3"/> <classpathentry kind="var" path="ANDROID_PLAT_SRC/prebuilt/common/layoutlib_api/layoutlib_api-prebuilt.jar"/> <classpathentry kind="var" path="ANDROID_PLAT_SRC/prebuilt/common/kxml2/kxml2-2.3.0.jar" sourcepath="/ANDROID_PLAT_SRC/dalvik/libcore/xml/src/main/java"/> - <classpathentry kind="var" path="ANDROID_PLAT_OUT_FRAMEWORK/ninepatch.jar" sourcepath="/ANDROID_PLAT_SRC/development/tools/ninepatch/src"/> <classpathentry kind="var" path="ANDROID_PLAT_SRC/out/host/common/obj/JAVA_LIBRARIES/temp_layoutlib_intermediates/javalib.jar" sourcepath="/ANDROID_PLAT_SRC/frameworks/base"/> + <classpathentry kind="var" path="ANDROID_PLAT_SRC/prebuilt/common/ninepatch/ninepatch-prebuilt.jar"/> <classpathentry kind="output" path="bin"/> </classpath> diff --git a/tools/layoutlib/bridge/Android.mk b/tools/layoutlib/bridge/Android.mk index b7a602a..9b7bc5f 100644 --- a/tools/layoutlib/bridge/Android.mk +++ b/tools/layoutlib/bridge/Android.mk @@ -21,7 +21,7 @@ LOCAL_SRC_FILES := $(call all-java-files-under,src) LOCAL_JAVA_LIBRARIES := \ kxml2-2.3.0 \ layoutlib_api-prebuilt \ - ninepatch + ninepatch-prebuilt LOCAL_STATIC_JAVA_LIBRARIES := temp_layoutlib diff --git a/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java b/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java index a6c6dfd..95663ec 100644 --- a/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java +++ b/tools/layoutlib/bridge/src/android/graphics/NinePatch_Delegate.java @@ -167,7 +167,7 @@ public class NinePatch_Delegate { try { chunkObject.draw(bitmap_delegate.getImage(), graphics, - left, top, right - left, bottom - top); + left, top, right - left, bottom - top, destDensity, srcDensity); } finally { if (paint_delegate != null) { graphics.dispose(); diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java index 13f0f4a..f03931f 100644 --- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java +++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/impl/ResourceHelper.java @@ -48,7 +48,7 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; /** - * Helper class to provide various convertion method used in handling android resources. + * Helper class to provide various conversion method used in handling android resources. */ public final class ResourceHelper { @@ -133,7 +133,8 @@ public final class ResourceHelper { // if either chunk or bitmap is null, then we reload the 9-patch file. if (chunk == null || bitmap == null) { try { - NinePatch ninePatch = NinePatch.load(file.toURL(), false /* convert */); + NinePatch ninePatch = NinePatch.load(file.toURI().toURL(), + false /* convert */); if (ninePatch != null) { if (chunk == null) { chunk = ninePatch.getChunk(); @@ -161,6 +162,7 @@ public final class ResourceHelper { // URL is wrong, we'll return null below } catch (IOException e) { // failed to read the file, we'll return null below. + Bridge.getLog().error(null, e); } } @@ -176,7 +178,7 @@ public final class ResourceHelper { return null; } else if (lowerCaseValue.endsWith(".xml")) { - // create a blockparser for the file + // create a block parser for the file File f = new File(stringValue); if (f.isFile()) { try { @@ -220,7 +222,7 @@ public final class ResourceHelper { return new BitmapDrawable(context.getResources(), bitmap); } catch (IOException e) { // we'll return null below - // TODO: log the error. + Bridge.getLog().error(null, e); } } else { // attempt to get a color from the value @@ -229,7 +231,8 @@ public final class ResourceHelper { return new ColorDrawable(color); } catch (NumberFormatException e) { // we'll return null below. - // TODO: log the error + Bridge.getLog().error(null, + "failed to convert " + stringValue + " into a drawable"); } } } |