LayoutLib: properly configure ApplicationInfo with targetSdkVersion.

Change-Id: I1bfef890206552843d1a7a8d0564741f2a37494f
This commit is contained in:
Xavier Ducrohet
2011-01-17 22:57:36 -08:00
parent f6864beca3
commit 9d0577ec0c
2 changed files with 9 additions and 3 deletions

View File

@@ -80,6 +80,7 @@ public final class BridgeContext extends Activity {
private final Object mProjectKey; private final Object mProjectKey;
private final DisplayMetrics mMetrics; private final DisplayMetrics mMetrics;
private final RenderResources mRenderResources; private final RenderResources mRenderResources;
private final ApplicationInfo mApplicationInfo;
private final Map<Object, Map<String, String>> mDefaultPropMaps = private final Map<Object, Map<String, String>> mDefaultPropMaps =
new IdentityHashMap<Object, Map<String,String>>(); new IdentityHashMap<Object, Map<String,String>>();
@@ -112,10 +113,12 @@ public final class BridgeContext extends Activity {
* value is the resource value. * value is the resource value.
* @param styleInheritanceMap * @param styleInheritanceMap
* @param projectCallback * @param projectCallback
* @param targetSdkVersion the targetSdkVersion of the application.
*/ */
public BridgeContext(Object projectKey, DisplayMetrics metrics, public BridgeContext(Object projectKey, DisplayMetrics metrics,
RenderResources renderResources, RenderResources renderResources,
IProjectCallback projectCallback) { IProjectCallback projectCallback,
int targetSdkVersion) {
mProjectKey = projectKey; mProjectKey = projectKey;
mMetrics = metrics; mMetrics = metrics;
mProjectCallback = projectCallback; mProjectCallback = projectCallback;
@@ -124,6 +127,9 @@ public final class BridgeContext extends Activity {
mFragments.mCurState = Fragment.CREATED; mFragments.mCurState = Fragment.CREATED;
mFragments.mActivity = this; mFragments.mActivity = this;
mApplicationInfo = new ApplicationInfo();
mApplicationInfo.targetSdkVersion = targetSdkVersion;
} }
/** /**
@@ -836,7 +842,7 @@ public final class BridgeContext extends Activity {
@Override @Override
public ApplicationInfo getApplicationInfo() { public ApplicationInfo getApplicationInfo() {
return new ApplicationInfo(); return mApplicationInfo;
} }
@Override @Override

View File

@@ -172,7 +172,7 @@ public class RenderSessionImpl extends FrameworkResourceIdProvider {
// build the context // build the context
mContext = new BridgeContext(mParams.getProjectKey(), metrics, resources, mContext = new BridgeContext(mParams.getProjectKey(), metrics, resources,
mParams.getProjectCallback()); mParams.getProjectCallback(), mParams.getTargetSdkVersion());
setUp(); setUp();