diff options
author | Xavier Ducrohet <xav@android.com> | 2010-11-04 17:15:54 -0700 |
---|---|---|
committer | Xavier Ducrohet <xav@android.com> | 2010-11-08 18:38:12 -0800 |
commit | 7f7752439543db6e13c599bdd10cb10254c24528 (patch) | |
tree | 8161d572cce9194745972fc3fde670a6c6412614 /tools/layoutlib/create/src | |
parent | c9f32f23327cbeeb50f0d494d01c8d6784720bc6 (diff) | |
download | frameworks_base-7f7752439543db6e13c599bdd10cb10254c24528.zip frameworks_base-7f7752439543db6e13c599bdd10cb10254c24528.tar.gz frameworks_base-7f7752439543db6e13c599bdd10cb10254c24528.tar.bz2 |
Layoutlib: Load fragments
This change does the following:
- Make the bridge context extend Activity instead of Context
so that it can act as a view factory. This is needed because
the Activity is used as factory for Fragment objects.
- Override the default Fragment.instantiate(...) method
through a delegate. This is done to load the Fragment
classes located in the project (similar to custom views).
Change-Id: If62e7c9ff2b7585677077ad825aa1c3591d1b5e0
Diffstat (limited to 'tools/layoutlib/create/src')
-rw-r--r-- | tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java | 1 | ||||
-rw-r--r-- | tools/layoutlib/create/src/com/android/tools/layoutlib/create/Main.java | 5 |
2 files changed, 5 insertions, 1 deletions
diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java index 8e05c31..1c95400 100644 --- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java +++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/CreateInfo.java @@ -94,6 +94,7 @@ public final class CreateInfo implements ICreateInfo { * The list of methods to rewrite as delegates. */ private final static String[] DELEGATE_METHODS = new String[] { + "android.app.Fragment#instantiate", //(Landroid/content/Context;Ljava/lang/String;Landroid/os/Bundle;)Landroid/app/Fragment;", // TODO: comment out once DelegateClass is working // "android.view.View#isInEditMode", // "android.content.res.Resources$Theme#obtainStyledAttributes", diff --git a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/Main.java b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/Main.java index 43f2971..ce48069 100644 --- a/tools/layoutlib/create/src/com/android/tools/layoutlib/create/Main.java +++ b/tools/layoutlib/create/src/com/android/tools/layoutlib/create/Main.java @@ -66,7 +66,10 @@ public class Main { AsmGenerator agen = new AsmGenerator(log, osDestJar[0], new CreateInfo()); AsmAnalyzer aa = new AsmAnalyzer(log, osJarPath, agen, - new String[] { "android.view.View" }, // derived from + new String[] { // derived from + "android.view.View", + "android.app.Fragment" + }, new String[] { // include classes "android.*", // for android.R "android.util.*", |