OSDN Git Service

Reset the ProjectCallback when the rendering target changes.
authorXavier Ducrohet <xav@android.com>
Mon, 17 Jan 2011 03:33:41 +0000 (19:33 -0800)
committerXavier Ducrohet <xav@android.com>
Mon, 17 Jan 2011 03:36:23 +0000 (19:36 -0800)
This is only done if the layout has custom views. This is
because ProjectCallback caches classes, but they are loaded
using the layoutlib classloader for type provided by the
layoutlib.

Since the rendering target changed, the layoutlib changed,
and we need a version of the custom view classes that uses
the base types of the new layoutlib jar.

Change-Id: Ia3e2a8f65d73dab2769d8c7686f970e647432ed3
http://code.google.com/p/android/issues/detail?id=14061

eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java

index 73ad04a..6cadd05 100644 (file)
@@ -1683,6 +1683,12 @@ public class GraphicalEditorPart extends EditorPart
             }
         }
 
+        // also remove the ProjectCallback as it caches custom views which must be reloaded
+        // with the classloader of the new LayoutLib.
+        if (mProjectCallback != null && mProjectCallback.isUsed()) {
+            mProjectCallback = null;
+        }
+
         // FIXME: get rid of the current LayoutScene if any.
     }