diff options
author | Xavier Ducrohet <xav@android.com> | 2010-11-09 16:18:26 -0800 |
---|---|---|
committer | Xavier Ducrohet <xav@android.com> | 2010-11-09 16:18:26 -0800 |
commit | 2d9ac49824ffc4cb6c071472f314ed30953e6c70 (patch) | |
tree | 915f42f6c61cc666455e253dc705baa45f7d460a | |
parent | 81246f966299a8580e10d7ba94f62acf1bfe620d (diff) | |
download | sdk-2d9ac49824ffc4cb6c071472f314ed30953e6c70.zip sdk-2d9ac49824ffc4cb6c071472f314ed30953e6c70.tar.gz sdk-2d9ac49824ffc4cb6c071472f314ed30953e6c70.tar.bz2 |
Fix ADT to build with the new layoutlib API.
Also make the custom cleaning of the layoutlib looper
only done through API 4. Newer bridge can do their own clean up.
Change-Id: I1ee128e09912df53e110094d8909f81bc6a788e3
3 files changed, 26 insertions, 11 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/UiElementPullParser.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/UiElementPullParser.java index f18bc6f..5f93387 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/UiElementPullParser.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/UiElementPullParser.java @@ -154,6 +154,14 @@ public final class UiElementPullParser extends BasePullParser { return getCurrentNode(); } + /** + * This implementation does nothing for now as all the embedded XML will use a normal KXML + * parser. + */ + public IXmlPullParser getParser(String layoutName) { + return null; + } + // ------------- XmlPullParser -------- public String getPositionDescription() { diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/WidgetPullParser.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/WidgetPullParser.java index 4343ce7..2d8a2b2 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/WidgetPullParser.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/WidgetPullParser.java @@ -53,6 +53,11 @@ public class WidgetPullParser extends BasePullParser { return mDescriptor; } + public IXmlPullParser getParser(String layoutName) { + // there's no embedded layout for a single widget. + return null; + } + public int getAttributeCount() { return mAttributes.length; // text attribute } diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/AndroidTargetData.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/AndroidTargetData.java index c388545..a9dc43e 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/AndroidTargetData.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/AndroidTargetData.java @@ -63,19 +63,21 @@ public class AndroidTargetData { * versions of the layoutlib. */ public void cleanUp() { - try { - Class<?> looperClass = classLoader.loadClass("android.os.Looper"); //$NON-NLS-1$ - Field threadLocalField = looperClass.getField("sThreadLocal"); //$NON-NLS-1$ - if (threadLocalField != null) { - threadLocalField.setAccessible(true); - // get object. Field is static so no need to pass an object - ThreadLocal<?> threadLocal = (ThreadLocal<?>) threadLocalField.get(null); - if (threadLocal != null) { - threadLocal.remove(); + if (apiLevel <= 4) { + try { + Class<?> looperClass = classLoader.loadClass("android.os.Looper"); //$NON-NLS-1$ + Field threadLocalField = looperClass.getField("sThreadLocal"); //$NON-NLS-1$ + if (threadLocalField != null) { + threadLocalField.setAccessible(true); + // get object. Field is static so no need to pass an object + ThreadLocal<?> threadLocal = (ThreadLocal<?>) threadLocalField.get(null); + if (threadLocal != null) { + threadLocal.remove(); + } } + } catch (Exception e) { + AdtPlugin.log(e, "Failed to clean up bridge for API level %d", apiLevel); } - } catch (Exception e) { - AdtPlugin.log(e, "Failed to clean up bridge for API level %d", apiLevel); } } } |