From d50c45bbd9e0d031c6fd86e92a78ffc3f8550b23 Mon Sep 17 00:00:00 2001 From: Tor Norbye Date: Thu, 7 Jul 2011 11:44:18 -0700 Subject: [PATCH] When using prerelease SDK versions, use codename instead of API level The New Project wizard now automatically fills in the Minimum SDK text field based on the selection in the SDK target chooser. However, it was hardcoded to always pick the API level number. That's not correct when using SDK versions with a code name; for example, when used with a dev SDK build the minimum SDK version should be "AOSP". Change-Id: I28273007be7e56f3a34b683f01234d5d1046aa0a --- .../wizards/newproject/NewProjectCreationPage.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/NewProjectCreationPage.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/NewProjectCreationPage.java index 6b6ade0ec..3b1b59eac 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/NewProjectCreationPage.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/NewProjectCreationPage.java @@ -31,11 +31,12 @@ import com.android.ide.eclipse.adt.internal.project.AndroidManifestHelper; import com.android.ide.eclipse.adt.internal.sdk.Sdk; import com.android.ide.eclipse.adt.internal.sdk.Sdk.ITargetChangeListener; import com.android.ide.eclipse.adt.internal.wizards.newproject.NewTestProjectCreationPage.TestInfo; +import com.android.sdklib.AndroidVersion; import com.android.sdklib.IAndroidTarget; import com.android.sdklib.SdkConstants; import com.android.sdklib.internal.project.ProjectProperties; -import com.android.sdklib.internal.project.ProjectPropertiesWorkingCopy; import com.android.sdklib.internal.project.ProjectProperties.PropertyType; +import com.android.sdklib.internal.project.ProjectPropertiesWorkingCopy; import com.android.sdklib.xml.AndroidManifest; import com.android.sdklib.xml.ManifestData; import com.android.sdklib.xml.ManifestData.Activity; @@ -1032,7 +1033,8 @@ public class NewProjectCreationPage extends WizardPage { // We do if one of two conditions are met: if (target != null) { boolean setMinSdk = false; - int apiLevel = target.getVersion().getApiLevel(); + AndroidVersion version = target.getVersion(); + int apiLevel = version.getApiLevel(); // 1. Has the user not manually edited the SDK field yet? If so, keep // updating it to the selected value. if (!mMinSdkModifiedByUser) { @@ -1053,9 +1055,15 @@ public class NewProjectCreationPage extends WizardPage { } } if (setMinSdk) { + String minSdk; + if (version.isPreview()) { + minSdk = version.getCodename(); + } else { + minSdk = Integer.toString(apiLevel); + } try { mInternalMinSdkUpdate = true; - mMinSdkVersionField.setText(Integer.toString(apiLevel)); + mMinSdkVersionField.setText(minSdk); } finally { mInternalMinSdkUpdate = false; } -- 2.11.0