aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2011-01-17 22:48:40 -0800
committerXavier Ducrohet <xav@android.com>2011-01-17 22:53:03 -0800
commitf73c2d98c0496d76b8a1284009e6bfae88cdf8ab (patch)
treeb76cc162b68df5a84ee494827f06208d4161f3fc
parent7af11a54cd5246483a4d5cbf2c84963facdf2bbe (diff)
downloadsdk-f73c2d98c0496d76b8a1284009e6bfae88cdf8ab.zip
sdk-f73c2d98c0496d76b8a1284009e6bfae88cdf8ab.tar.gz
sdk-f73c2d98c0496d76b8a1284009e6bfae88cdf8ab.tar.bz2
Add min/targetSdkVersion to the LayoutLib API.
This will allow some widgets to properly behave based on the minSdkVersion and targetSdkVersion of the project during rendering. Change-Id: I96d432b8b92fbc211ce122da51bd18049708c14f
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java2
-rw-r--r--layoutlib_api/src/com/android/ide/common/rendering/api/Params.java20
3 files changed, 23 insertions, 1 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java
index a857dc7..15d46e9 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/GraphicalEditorPart.java
@@ -1642,6 +1642,8 @@ public class GraphicalEditorPart extends EditorPart
density, xdpi, ydpi,
resolver,
mProjectCallback,
+ 1 /*minSdkVersion*/,
+ 1 /*targetSdkVersion */,
logger);
if (transparentBackground) {
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java
index 05b360f..2d6d014 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/tests/functests/layoutRendering/ApiDemosRenderingTest.java
@@ -215,6 +215,8 @@ public class ApiDemosRenderingTest extends SdkTestCase {
160, // ydpi
resolver,
projectCallBack,
+ 1, // minSdkVersion
+ 1, // targetSdkVersion
null //logger
));
diff --git a/layoutlib_api/src/com/android/ide/common/rendering/api/Params.java b/layoutlib_api/src/com/android/ide/common/rendering/api/Params.java
index 3cede41..4bb41f1 100644
--- a/layoutlib_api/src/com/android/ide/common/rendering/api/Params.java
+++ b/layoutlib_api/src/com/android/ide/common/rendering/api/Params.java
@@ -54,6 +54,8 @@ public class Params {
private final float mYdpi;
private final RenderResources mRenderResources;
private final IProjectCallback mProjectCallback;
+ private final int mMinSdkVersion;
+ private final int mTargetSdkVersion;
private final LayoutLog mLog;
private boolean mCustomBackgroundEnabled;
@@ -85,6 +87,8 @@ public class Params {
* value is the resource value.
* @param projectCallback The {@link IProjectCallback} object to get information from
* the project.
+ * @param minSdkVersion the minSdkVersion of the project
+ * @param targetSdkVersion the targetSdkVersion of the project
* @param log the object responsible for displaying warning/errors to the user.
*/
public Params(ILayoutPullParser layoutDescription,
@@ -92,7 +96,9 @@ public class Params {
int screenWidth, int screenHeight, RenderingMode renderingMode,
int density, float xdpi, float ydpi,
RenderResources renderResources,
- IProjectCallback projectCallback, LayoutLog log) {
+ IProjectCallback projectCallback,
+ int minSdkVersion, int targetSdkVersion,
+ LayoutLog log) {
mLayoutDescription = layoutDescription;
mProjectKey = projectKey;
mScreenWidth = screenWidth;
@@ -103,6 +109,8 @@ public class Params {
mYdpi = ydpi;
mRenderResources = renderResources;
mProjectCallback = projectCallback;
+ mMinSdkVersion = minSdkVersion;
+ mTargetSdkVersion = targetSdkVersion;
mLog = log;
mCustomBackgroundEnabled = false;
mTimeout = DEFAULT_TIMEOUT;
@@ -122,6 +130,8 @@ public class Params {
mYdpi = params.mYdpi;
mRenderResources = params.mRenderResources;
mProjectCallback = params.mProjectCallback;
+ mMinSdkVersion = params.mMinSdkVersion;
+ mTargetSdkVersion = params.mTargetSdkVersion;
mLog = params.mLog;
mCustomBackgroundEnabled = params.mCustomBackgroundEnabled;
mCustomBackgroundColor = params.mCustomBackgroundColor;
@@ -150,6 +160,14 @@ public class Params {
return mProjectKey;
}
+ public int getMinSdkVersion() {
+ return mMinSdkVersion;
+ }
+
+ public int getTargetSdkVersion() {
+ return mTargetSdkVersion;
+ }
+
public int getScreenWidth() {
return mScreenWidth;
}