diff --git a/plugins/android/android.iml b/plugins/android/android.iml index 620b7ba080dc..0f7507fcc425 100644 --- a/plugins/android/android.iml +++ b/plugins/android/android.iml @@ -31,20 +31,28 @@ + + + - - - + + + + + + + + diff --git a/plugins/android/lib/common.jar b/plugins/android/lib/common.jar index ed6a975e6fbd..006c6e499694 100644 Binary files a/plugins/android/lib/common.jar and b/plugins/android/lib/common.jar differ diff --git a/plugins/android/lib/ide_common.jar b/plugins/android/lib/ide_common.jar new file mode 100644 index 000000000000..ea5e33f2bfd8 Binary files /dev/null and b/plugins/android/lib/ide_common.jar differ diff --git a/plugins/android/lib/layoutlib_api.jar b/plugins/android/lib/layoutlib_api.jar new file mode 100644 index 000000000000..4fa52af98744 Binary files /dev/null and b/plugins/android/lib/layoutlib_api.jar differ diff --git a/plugins/android/lib/ninepatch.jar b/plugins/android/lib/ninepatch.jar new file mode 100644 index 000000000000..a3ca418b94b7 Binary files /dev/null and b/plugins/android/lib/ninepatch.jar differ diff --git a/plugins/android/lib/sdklib.jar b/plugins/android/lib/sdklib.jar index f08303dbdd52..4c9d20a9fa35 100644 Binary files a/plugins/android/lib/sdklib.jar and b/plugins/android/lib/sdklib.jar differ diff --git a/plugins/android/resources/icons/zoomActual.png b/plugins/android/resources/icons/zoomActual.png new file mode 100644 index 000000000000..7d0d91fa2979 Binary files /dev/null and b/plugins/android/resources/icons/zoomActual.png differ diff --git a/plugins/android/resources/icons/zoomFit.png b/plugins/android/resources/icons/zoomFit.png new file mode 100644 index 000000000000..f88a24a999cb Binary files /dev/null and b/plugins/android/resources/icons/zoomFit.png differ diff --git a/plugins/android/resources/icons/zoomIn.png b/plugins/android/resources/icons/zoomIn.png new file mode 100644 index 000000000000..e6a7db50be22 Binary files /dev/null and b/plugins/android/resources/icons/zoomIn.png differ diff --git a/plugins/android/resources/icons/zoomOut.png b/plugins/android/resources/icons/zoomOut.png new file mode 100644 index 000000000000..8f1a570d0b7a Binary files /dev/null and b/plugins/android/resources/icons/zoomOut.png differ diff --git a/plugins/android/resources/messages/AndroidBundle.properties b/plugins/android/resources/messages/AndroidBundle.properties index 7bfc8c26727b..186420d752e9 100644 --- a/plugins/android/resources/messages/AndroidBundle.properties +++ b/plugins/android/resources/messages/AndroidBundle.properties @@ -247,4 +247,14 @@ android.import.dependencies.import.module.task.title=Import library module {0} f android.import.dependencies.dialog.title=Import Android dependencies from property files android.import.dependencies.source.roots.dialog.title=Import source roots android.import.dependencies.source.roots.dialog.label=Choose source roots to add to your project +sdk.broken.error=Cannot parse Android SDK. Please reconfigure it in Android facet settings +android.layout.preview.cannot.load.library.error=Failed to load platform rendering library +android.layout.preview.cannot.load.resources=Cannot load module resources. +android.layout.preview.editor.name=Preview +android.layout.preview.tool.window.title=Preview +android.layout.preview.default.error.message=Cannot perform rendering +android.layout.preview.zoom.in.action.text=Zoom In +android.layout.preview.zoom.out.action.text=Zoom Out +android.layout.preview.zoom.actual.action.text=Zoom to actual size +android.layout.preview.zoom.to.fit.action.text=Zoom to Fit restart.adb.fix.text=Restart ADB service and try again \ No newline at end of file diff --git a/plugins/android/src/META-INF/plugin.xml b/plugins/android/src/META-INF/plugin.xml index 3058a2ff9845..a195e93b613f 100644 --- a/plugins/android/src/META-INF/plugin.xml +++ b/plugins/android/src/META-INF/plugin.xml @@ -16,6 +16,10 @@ org.jetbrains.android.AndroidProjectComponent + + org.jetbrains.android.uipreview.AndroidLayoutPreviewToolWindowManager + + + + + + + + + + + + The "layout-devices" element is the root element of this schema. + + It must contain zero or more "device" elements that each define the configurations + available for a given device. + + These definitions are used in the Graphical Layout Editor in the + Android Development Tools (ADT) plugin for Eclipse. + + + + + + + + + + A device element must contain at most one "default" element + followed by one or more "config" elements. + + The "default" element defines all the default parameters + inherited by the following "config" elements. + Each "config" element can override the default values, if any. + + A "device" element also has a required "name" attribute that + represents the user-interface name of this device. + + + + + + + + + + + + + + + + + + + + + + + The parametersType define all the parameters that can happen either in a + "default" element or in a named "config" element. + Each parameter element can appear once at most. + + Parameters here are the same as those used to specify alternate Android + resources, as documented by + http://d.android.com/guide/topics/resources/resources-i18n.html#AlternateResources + + + + + + + + + + Specifies the configuration is for a particular Mobile Country Code. + + + + + + + + + + + + + + Specifies the configuration is for a particular Mobile Network Code. + + + + + + + + + + + + + + Specifies that the configuration is for a particular class of screen. + + + + + + + + + + + + + + + + Specifies that the configuration is for a taller/wider than traditional + screen. This is based purely on the aspect ration of the screen: QVGA, + HVGA, and VGA are notlong; WQVGA, WVGA, FWVGA are long. Note that long + may mean either wide or tall, depending on the current orientation. + + + + + + + + + + + + + + Specifies that the configuration is for a screen that is tall (port) or + wide (land). + + + + + + + + + + + + + + + Specifies the screen density the configuration is defined for. The medium + density of traditional HVGA screens (mdpi) is defined to be approximately + 160dpi; low density (ldpi) is 120, and high density (hdpi) is 240. There + is thus a 4:3 scaling factor between each density, so a 9x9 bitmap in ldpi + would be 12x12 is mdpi and 16x16 in hdpi. + The special nodpi density that can be used in resource qualifiers is not + a valid keyword here. + + + + + + + + + + + + + + + + + Specifies the touch type the configuration is defined for. + + + + + + + + + + + + + + + If your configuration uses a soft keyboard, use the keyssoft value. + If it doesn't and has a real keyboard, use keysexposed or keyshidden. + + + + + + + + + + + + + + + Specifies the primary text input method the configuration is designed for. + + + + + + + + + + + + + + + Specifies whether the primary non-touchscreen navigation control is + exposed or hidden. + + + + + + + + + + + + + + Specifies the primary non-touchscreen navigation method the configuration + is designed for. + + + + + + + + + + + + + + + + Specifies the device screen resolution, in pixels. + + + + + + + + + + + + + + + + + + + Specifies the actual density in X of the device screen. + + + + + + + + + + + + + Specifies the actual density in Y of the device screen. + + + + + + + + + + + + + + + + + The configType defines the content of a "config" element in a "device" element. + + A "config" element can have all the parameters elements defined by + "parameterType". It also has a required "name" attribute that indicates the + user-interface name for this configuration. + + + + + + + + + + + diff --git a/plugins/android/src/org/jetbrains/android/util/AndroidUtils.java b/plugins/android/src/org/jetbrains/android/util/AndroidUtils.java index 88b142170a1c..999bd76508e0 100644 --- a/plugins/android/src/org/jetbrains/android/util/AndroidUtils.java +++ b/plugins/android/src/org/jetbrains/android/util/AndroidUtils.java @@ -838,4 +838,43 @@ public class AndroidUtils { } return null; } + + public static int getIntAttrValue(@NotNull final XmlTag tag, @NotNull final String attrName) { + String value = ApplicationManager.getApplication().runReadAction(new Computable() { + public String compute() { + return tag.getAttributeValue(attrName, SdkConstants.NS_RESOURCES); + } + }); + try { + return Integer.parseInt(value); + } + catch (NumberFormatException e) { + return -1; + } + } + + @Nullable + public static XmlFile[] findXmlFiles(final Project project, final String... paths) { + XmlFile[] xmlFiles = new XmlFile[paths.length]; + for (int i = 0; i < paths.length; i++) { + String path = paths[i]; + final VirtualFile file = LocalFileSystem.getInstance().findFileByPath(path); + PsiFile psiFile = file != null ? ApplicationManager.getApplication().runReadAction(new Computable() { + @Nullable + public PsiFile compute() { + return PsiManager.getInstance(project).findFile(file); + } + }) : null; + if (psiFile == null) { + LOG.info("File " + path + " is not found"); + return null; + } + if (!(psiFile instanceof XmlFile)) { + LOG.info("File " + path + " is not an xml psiFile"); + return null; + } + xmlFiles[i] = (XmlFile)psiFile; + } + return xmlFiles; + } }