aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.txt112
-rw-r--r--adtproductbuild/Android.mk2
-rw-r--r--adtproductbuild/build.xml27
-rw-r--r--attribute_stats/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--build/tools.atree54
-rwxr-xr-xbuild/tools.windows.atree3
-rw-r--r--docs/howto_build_SDK.txt97
-rw-r--r--eclipse/features/com.android.ide.eclipse.adt.package/feature.xml7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt.overlay/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt.package/.classpath8
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt.package/.project6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt.package/META-INF/MANIFEST.MF9
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt.package/build.properties8
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt.package/index.html91
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt.package/introcontent.xml9
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt.package/plugin.xml33
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt.package/src/com/android/ide/eclipse/adt/internal/AdtIntro.java168
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt.package/welcome.css176
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/.settings/org.eclipse.core.resources.prefs1
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF16
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/icons/checker.pngbin0 -> 1889 bytes
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/icons/gradle.pngbin0 -> 841 bytes
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/plugin.xml28
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/GravityHelper.java53
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtConstants.java3
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java5
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/Messages.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/VersionCheck.java13
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/BuildHelper.java4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/RenderScriptProcessor.java32
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/SourceProcessor.java3
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/BaseBuilder.java4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/draw9patch/Draw9PatchEditor.java233
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/draw9patch/graphics/GraphicsUtilities.java169
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/draw9patch/graphics/NinePatchedImage.java882
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/draw9patch/ui/ImageEditorPanel.java97
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/draw9patch/ui/ImageViewer.java774
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/draw9patch/ui/MainFrame.java79
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/draw9patch/ui/StatusPanel.java357
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/draw9patch/ui/StretchesViewer.java267
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationChooser.java5
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationMatcher.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/FlagManager.java213
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/Locale.java6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/LocaleManager.java1289
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/values/ValuesTreePage.java4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchController.java13
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/LintJob.java24
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/AndroidNature.java8
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/BaseClasspathContainerInitializer.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/LibraryClasspathContainerInitializer.java249
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/ProjectHelper.java90
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/DynamicIdMap.java2
-rwxr-xr-xeclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/AdtManifestMergeCallback.java15
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/Sdk.java77
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/ui/ConfigurationSelector.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/BuildFileCreator.java538
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/ConfirmationPage.java275
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/ExportMessages.java43
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/ExportMessages.properties27
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/ExportStatus.java56
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/FinalPage.java112
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/GradleExportWizard.java110
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/GradleModule.java90
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/ProjectSelectionPage.java275
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/ProjectSetupBuilder.java425
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/NewProjectCreator.java70
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/ProjectNamePage.java12
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newxmlfile/AddTranslationDialog.java5
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/messages.properties1
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.base/.classpath1
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.base/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.ddms/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.ddms/META-INF/MANIFEST.MF2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/DdmsPlugin.java4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/systrace/SystraceOptionsDialogV1.java4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/systrace/SystraceOptionsDialogV2.java (renamed from eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/views/SystraceOptionsDialogV2.java)42
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/systrace/SystraceOutputParser.java68
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/views/DeviceView.java34
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger.tests/META-INF/MANIFEST.MF5
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger.tests/src/com/android/ide/eclipse/gltrace/format/GLMessageFormatterTest.java6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/entries.in112
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLEnum.java295
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLProtoBuf.java779
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/model/GLCall.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLSparseArrayProperty.java4
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLState.java29
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLStateType.java13
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/StateTransformFactory.java30
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/TexImageTransform.java29
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.monitor/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.ndk/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.pdt/.settings/org.eclipse.jdt.core.prefs6
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/.classpath2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/.settings/org.eclipse.jdt.core.prefs14
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/META-INF/MANIFEST.MF2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/build.properties2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/AdtProjectTest.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/ExportGradleTest.java303
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/GravityHelperTest.java44
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/draw9patch/graphics/GraphicsUtilitiesTest.java313
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/draw9patch/graphics/NinePatchedImageTest.java914
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/configuration/FlagManagerTest.java (renamed from eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/configuration/LocaleManagerTest.java)78
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/content-area-one-dot.9.pngbin0 -> 206 bytes
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/content-area-two-dots.9.pngbin0 -> 214 bytes
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/content-area.9.pngbin0 -> 210 bytes
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/invalid-patched1.9.pngbin0 -> 2923 bytes
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/invalid-patched2.9.pngbin0 -> 2913 bytes
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/invalid-patched3.9.pngbin0 -> 2914 bytes
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/invalid-patched4.9.pngbin0 -> 2914 bytes
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/invalid-patched5.9.pngbin0 -> 2929 bytes
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/invalid-patched6.9.pngbin0 -> 2920 bytes
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/invalid-patched7.9.pngbin0 -> 2916 bytes
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/invalid-patched8.9.pngbin0 -> 2923 bytes
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/layout-bounds-only.9.pngbin0 -> 1466 bytes
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/no-patched-interlace.pngbin0 -> 3138 bytes
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/no-patched.pngbin0 -> 2906 bytes
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/patched-with-badpatches.9.pngbin0 -> 214 bytes
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/patched1.9.pngbin0 -> 210 bytes
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/patched2.9.pngbin0 -> 217 bytes
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/patched3.9.pngbin0 -> 214 bytes
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.traceview/.settings/org.eclipse.jdt.core.prefs6
-rwxr-xr-xeclipse/scripts/build_server.sh15
-rwxr-xr-xeclipse/scripts/create_all_symlinks.sh190
-rwxr-xr-xeclipse/scripts/setup_eclipse.sh2
-rw-r--r--emulator/opengl/host/libs/Translator/EGL/EglX11Api.cpp1
-rw-r--r--emulator/opengl/host/libs/Translator/EGL/ThreadInfo.cpp28
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/ColorBuffer.cpp14
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/FrameBuffer.cpp33
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/RenderControl.cpp2
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/RenderServer.cpp16
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/RenderThread.cpp29
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/RenderThread.h2
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/ThreadInfo.cpp38
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/ThreadInfo.h6
-rw-r--r--files/ant/build.xml7
-rw-r--r--files/devices.xml192
-rw-r--r--files/tools_source.properties2
-rw-r--r--hierarchyviewer/Android.mk17
-rw-r--r--hierarchyviewer/README.txt8
-rw-r--r--hierarchyviewer/src/com/android/hierarchyviewer/HierarchyViewer.java93
-rw-r--r--settings/org.eclipse.jdt.core.prefs6
-rw-r--r--templates/activities/BlankActivity/globals.xml.ftl5
-rw-r--r--templates/activities/BlankActivity/recipe.xml.ftl52
-rw-r--r--templates/activities/BlankActivity/root/AndroidManifest.xml.ftl24
-rw-r--r--templates/activities/BlankActivity/root/res/layout/activity_fragment_container.xml7
-rw-r--r--templates/activities/BlankActivity/root/res/layout/activity_pager.xml.ftl24
-rw-r--r--templates/activities/BlankActivity/root/res/layout/activity_simple.xml.ftl16
-rw-r--r--templates/activities/BlankActivity/root/res/layout/fragment_dummy.xml.ftl16
-rw-r--r--templates/activities/BlankActivity/root/res/menu/main.xml.ftl6
-rw-r--r--templates/activities/BlankActivity/root/res/values-sw600dp/dimens.xml4
-rw-r--r--templates/activities/BlankActivity/root/res/values-sw720dp-land/dimens.xml5
-rw-r--r--templates/activities/BlankActivity/root/res/values/dimens.xml5
-rw-r--r--templates/activities/BlankActivity/root/res/values/strings.xml.ftl15
-rw-r--r--templates/activities/BlankActivity/root/src/app_package/DropdownActivity.java.ftl108
-rw-r--r--templates/activities/BlankActivity/root/src/app_package/SimpleActivity.java.ftl42
-rw-r--r--templates/activities/BlankActivity/root/src/app_package/TabsActivity.java.ftl86
-rw-r--r--templates/activities/BlankActivity/root/src/app_package/TabsAndPagerActivity.java.ftl153
-rw-r--r--templates/activities/BlankActivity/root/src/app_package/include_DummySectionFragment.java.ftl23
-rw-r--r--templates/activities/BlankActivity/root/src/app_package/include_onCreateOptionsMenu.java.ftl6
-rw-r--r--templates/activities/BlankActivity/root/src/app_package/include_onOptionsItemSelected.java.ftl19
-rw-r--r--templates/activities/BlankActivity/template.xml88
-rw-r--r--templates/activities/BlankActivity/template_blank_activity.pngbin4322 -> 0 bytes
-rw-r--r--templates/activities/BlankActivity/template_blank_activity_dropdown.pngbin5662 -> 0 bytes
-rw-r--r--templates/activities/BlankActivity/template_blank_activity_pager.pngbin5441 -> 0 bytes
-rw-r--r--templates/activities/BlankActivity/template_blank_activity_tabs.pngbin4873 -> 0 bytes
-rw-r--r--templates/activities/BlankActivity/template_blank_activity_tabs_pager.pngbin5257 -> 0 bytes
-rw-r--r--templates/activities/FullscreenActivity/globals.xml.ftl5
-rw-r--r--templates/activities/FullscreenActivity/recipe.xml.ftl25
-rw-r--r--templates/activities/FullscreenActivity/root/AndroidManifest.xml.ftl26
-rw-r--r--templates/activities/FullscreenActivity/root/res/layout/activity_fullscreen.xml.ftl46
-rw-r--r--templates/activities/FullscreenActivity/root/res/values-v11/styles.xml15
-rw-r--r--templates/activities/FullscreenActivity/root/res/values/attrs.xml12
-rw-r--r--templates/activities/FullscreenActivity/root/res/values/colors.xml5
-rw-r--r--templates/activities/FullscreenActivity/root/res/values/strings.xml.ftl9
-rw-r--r--templates/activities/FullscreenActivity/root/res/values/styles.xml22
-rw-r--r--templates/activities/FullscreenActivity/root/src/app_package/FullscreenActivity.java.ftl197
-rw-r--r--templates/activities/FullscreenActivity/root/src/app_package/util/SystemUiHider.java.ftl172
-rw-r--r--templates/activities/FullscreenActivity/root/src/app_package/util/SystemUiHiderBase.java.ftl63
-rw-r--r--templates/activities/FullscreenActivity/root/src/app_package/util/SystemUiHiderHoneycomb.java.ftl133
-rw-r--r--templates/activities/FullscreenActivity/template.xml68
-rw-r--r--templates/activities/FullscreenActivity/template_fullscreen_activity.pngbin16885 -> 0 bytes
-rw-r--r--templates/activities/LoginActivity/globals.xml.ftl6
-rw-r--r--templates/activities/LoginActivity/recipe.xml.ftl19
-rw-r--r--templates/activities/LoginActivity/root/AndroidManifest.xml.ftl19
-rw-r--r--templates/activities/LoginActivity/root/res/layout/activity_login.xml.ftl69
-rw-r--r--templates/activities/LoginActivity/root/res/menu/activity_login.xml5
-rw-r--r--templates/activities/LoginActivity/root/res/values-large/styles.xml10
-rw-r--r--templates/activities/LoginActivity/root/res/values/strings.xml.ftl21
-rw-r--r--templates/activities/LoginActivity/root/res/values/styles.xml9
-rw-r--r--templates/activities/LoginActivity/root/src/app_package/LoginActivity.java.ftl278
-rw-r--r--templates/activities/LoginActivity/template.xml60
-rw-r--r--templates/activities/LoginActivity/template_login_activity.pngbin5939 -> 0 bytes
-rw-r--r--templates/activities/MasterDetailFlow/globals.xml.ftl8
-rw-r--r--templates/activities/MasterDetailFlow/recipe.xml.ftl28
-rw-r--r--templates/activities/MasterDetailFlow/root/AndroidManifest.xml.ftl31
-rw-r--r--templates/activities/MasterDetailFlow/root/res/layout/activity_content_detail.xml.ftl7
-rw-r--r--templates/activities/MasterDetailFlow/root/res/layout/activity_content_list.xml.ftl10
-rw-r--r--templates/activities/MasterDetailFlow/root/res/layout/activity_content_twopane.xml.ftl38
-rw-r--r--templates/activities/MasterDetailFlow/root/res/layout/fragment_content_detail.xml.ftl9
-rw-r--r--templates/activities/MasterDetailFlow/root/res/values-large/refs.xml.ftl10
-rw-r--r--templates/activities/MasterDetailFlow/root/res/values-sw600dp/refs.xml.ftl11
-rw-r--r--templates/activities/MasterDetailFlow/root/res/values/strings.xml.ftl6
-rw-r--r--templates/activities/MasterDetailFlow/root/src/app_package/ContentDetailActivity.java.ftl67
-rw-r--r--templates/activities/MasterDetailFlow/root/src/app_package/ContentDetailFragment.java.ftl61
-rw-r--r--templates/activities/MasterDetailFlow/root/src/app_package/ContentListActivity.java.ftl105
-rw-r--r--templates/activities/MasterDetailFlow/root/src/app_package/ContentListFragment.java.ftl151
-rw-r--r--templates/activities/MasterDetailFlow/root/src/app_package/dummy/DummyContent.java.ftl55
-rw-r--r--templates/activities/MasterDetailFlow/template.xml65
-rw-r--r--templates/activities/MasterDetailFlow/template_master_detail.pngbin7173 -> 0 bytes
-rw-r--r--templates/activities/SettingsActivity/globals.xml.ftl5
-rw-r--r--templates/activities/SettingsActivity/recipe.xml.ftl17
-rw-r--r--templates/activities/SettingsActivity/root/AndroidManifest.xml.ftl18
-rw-r--r--templates/activities/SettingsActivity/root/res/values/strings.xml.ftl61
-rw-r--r--templates/activities/SettingsActivity/root/res/xml/pref_data_sync.xml21
-rw-r--r--templates/activities/SettingsActivity/root/res/xml/pref_general.xml33
-rw-r--r--templates/activities/SettingsActivity/root/res/xml/pref_headers.xml.ftl17
-rw-r--r--templates/activities/SettingsActivity/root/res/xml/pref_notification.xml27
-rw-r--r--templates/activities/SettingsActivity/root/src/app_package/SettingsActivity.java.ftl295
-rw-r--r--templates/activities/SettingsActivity/template.xml53
-rw-r--r--templates/activities/SettingsActivity/template_settings_activity.pngbin6260 -> 0 bytes
-rw-r--r--templates/build_gradle.template21
-rw-r--r--templates/other/AppWidget/globals.xml.ftl5
-rw-r--r--templates/other/AppWidget/recipe.xml.ftl31
-rw-r--r--templates/other/AppWidget/root/AndroidManifest.xml.ftl25
-rw-r--r--templates/other/AppWidget/root/res/drawable-nodpi/example_appwidget_preview.pngbin3522 -> 0 bytes
-rw-r--r--templates/other/AppWidget/root/res/layout/appwidget.xml21
-rw-r--r--templates/other/AppWidget/root/res/layout/appwidget_configure.xml27
-rw-r--r--templates/other/AppWidget/root/res/values-v14/dimens.xml10
-rw-r--r--templates/other/AppWidget/root/res/values/dimens.xml10
-rw-r--r--templates/other/AppWidget/root/res/values/strings.xml.ftl8
-rw-r--r--templates/other/AppWidget/root/res/xml/appwidget_info.xml.ftl27
-rw-r--r--templates/other/AppWidget/root/src/app_package/AppWidget.java.ftl63
-rw-r--r--templates/other/AppWidget/root/src/app_package/AppWidgetConfigureActivity.java.ftl102
-rw-r--r--templates/other/AppWidget/template.xml148
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_1x1.pngbin2960 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_1x1_h.pngbin3750 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_1x1_v.pngbin3787 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_1x1_vh.pngbin4004 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_1x2.pngbin3010 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_1x2_h.pngbin3771 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_1x2_v.pngbin3835 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_1x2_vh.pngbin4065 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_1x3.pngbin3058 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_1x3_h.pngbin3830 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_1x3_v.pngbin3880 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_1x3_vh.pngbin4120 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_1x4.pngbin3114 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_1x4_h.pngbin3880 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_1x4_v.pngbin3944 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_1x4_vh.pngbin4178 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_2x1.pngbin2973 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_2x1_h.pngbin3765 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_2x1_v.pngbin3794 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_2x1_vh.pngbin4020 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_2x2.pngbin3023 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_2x2_h.pngbin3784 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_2x2_v.pngbin3842 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_2x2_vh.pngbin4062 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_2x3.pngbin3047 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_2x3_h.pngbin3849 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_2x3_v.pngbin3890 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_2x3_vh.pngbin4133 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_2x4.pngbin3071 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_2x4_h.pngbin3888 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_2x4_v.pngbin3946 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_2x4_vh.pngbin4168 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_3x1.pngbin2950 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_3x1_h.pngbin3728 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_3x1_v.pngbin3777 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_3x1_vh.pngbin3987 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_3x2.pngbin2995 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_3x2_h.pngbin3747 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_3x2_v.pngbin3811 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_3x2_vh.pngbin4045 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_3x3.pngbin3035 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_3x3_h.pngbin3790 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_3x3_v.pngbin3844 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_3x3_vh.pngbin4080 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_3x4.pngbin3051 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_3x4_h.pngbin3819 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_3x4_v.pngbin3887 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_3x4_vh.pngbin4120 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_4x1.pngbin2925 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_4x1_h.pngbin3710 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_4x1_v.pngbin3747 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_4x1_vh.pngbin3973 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_4x2.pngbin2931 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_4x2_h.pngbin3667 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_4x2_v.pngbin3730 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_4x2_vh.pngbin3960 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_4x3.pngbin2934 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_4x3_h.pngbin3696 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_4x3_v.pngbin3723 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_4x3_vh.pngbin3994 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_4x4.pngbin2938 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_4x4_h.pngbin3639 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_4x4_v.pngbin3717 -> 0 bytes
-rw-r--r--templates/other/AppWidget/thumbs/template_widget_4x4_vh.pngbin3932 -> 0 bytes
-rw-r--r--templates/other/BlankFragment/globals.xml.ftl4
-rw-r--r--templates/other/BlankFragment/recipe.xml.ftl18
-rw-r--r--templates/other/BlankFragment/root/res/layout/fragment_blank.xml.ftl13
-rw-r--r--templates/other/BlankFragment/root/res/values/strings.xml6
-rw-r--r--templates/other/BlankFragment/root/src/app_package/BlankFragment.java.ftl129
-rw-r--r--templates/other/BlankFragment/template.xml50
-rw-r--r--templates/other/BlankFragment/template_blank_fragment.pngbin6003 -> 0 bytes
-rw-r--r--templates/other/BroadcastReceiver/globals.xml.ftl4
-rw-r--r--templates/other/BroadcastReceiver/recipe.xml.ftl7
-rw-r--r--templates/other/BroadcastReceiver/root/AndroidManifest.xml.ftl10
-rw-r--r--templates/other/BroadcastReceiver/root/src/app_package/BroadcastReceiver.java.ftl17
-rw-r--r--templates/other/BroadcastReceiver/template.xml32
-rw-r--r--templates/other/ContentProvider/globals.xml.ftl4
-rw-r--r--templates/other/ContentProvider/recipe.xml.ftl7
-rw-r--r--templates/other/ContentProvider/root/AndroidManifest.xml.ftl11
-rw-r--r--templates/other/ContentProvider/root/src/app_package/ContentProvider.java.ftl50
-rw-r--r--templates/other/ContentProvider/template.xml40
-rw-r--r--templates/other/CustomView/globals.xml.ftl5
-rw-r--r--templates/other/CustomView/recipe.xml.ftl13
-rwxr-xr-xtemplates/other/CustomView/root/res/layout/sample.xml.ftl22
-rwxr-xr-xtemplates/other/CustomView/root/res/values/attrs.xml.ftl8
-rw-r--r--templates/other/CustomView/root/src/app_package/CustomView.java.ftl181
-rw-r--r--templates/other/CustomView/template.xml28
-rw-r--r--templates/other/Daydream/globals.xml.ftl8
-rw-r--r--templates/other/Daydream/recipe.xml.ftl26
-rw-r--r--templates/other/Daydream/root/AndroidManifest.xml.ftl28
-rw-r--r--templates/other/Daydream/root/res/layout-v17/dream.xml13
-rw-r--r--templates/other/Daydream/root/res/values/strings.xml.ftl7
-rw-r--r--templates/other/Daydream/root/res/xml/dream_prefs.xml9
-rw-r--r--templates/other/Daydream/root/res/xml/xml_dream.xml.ftl3
-rw-r--r--templates/other/Daydream/root/src/app_package/DreamService.java.ftl140
-rw-r--r--templates/other/Daydream/root/src/app_package/SettingsActivity.java.ftl36
-rw-r--r--templates/other/Daydream/template.xml49
-rw-r--r--templates/other/ListFragment/globals.xml.ftl7
-rw-r--r--templates/other/ListFragment/recipe.xml.ftl26
-rw-r--r--templates/other/ListFragment/root/res/layout/fragment_grid.xml20
-rw-r--r--templates/other/ListFragment/root/res/layout/fragment_list.xml19
-rw-r--r--templates/other/ListFragment/root/res/values-large/refs_lrg.xml.ftl12
-rw-r--r--templates/other/ListFragment/root/res/values-sw600dp/refs_lrg.xml.ftl12
-rw-r--r--templates/other/ListFragment/root/res/values/refs.xml.ftl12
-rw-r--r--templates/other/ListFragment/root/res/values/refs_lrg.xml.ftl12
-rw-r--r--templates/other/ListFragment/root/src/app_package/ListFragment.java.ftl195
-rw-r--r--templates/other/ListFragment/root/src/app_package/dummy/DummyContent.java.ftl55
-rw-r--r--templates/other/ListFragment/template.xml52
-rw-r--r--templates/other/ListFragment/templates_list_fragment.pngbin7293 -> 0 bytes
-rw-r--r--templates/other/Notification/globals.xml.ftl9
-rw-r--r--templates/other/Notification/recipe.xml.ftl25
-rw-r--r--templates/other/Notification/root/AndroidManifest.xml.ftl5
-rw-r--r--templates/other/Notification/root/res/drawable-hdpi/ic_action_stat_reply.pngbin1480 -> 0 bytes
-rw-r--r--templates/other/Notification/root/res/drawable-hdpi/ic_action_stat_share.pngbin1606 -> 0 bytes
-rw-r--r--templates/other/Notification/root/res/drawable-mdpi/ic_action_stat_reply.pngbin1314 -> 0 bytes
-rw-r--r--templates/other/Notification/root/res/drawable-mdpi/ic_action_stat_share.pngbin1341 -> 0 bytes
-rw-r--r--templates/other/Notification/root/res/drawable-nodpi/example_picture_large.pngbin5834 -> 0 bytes
-rw-r--r--templates/other/Notification/root/res/drawable-nodpi/example_picture_small.pngbin1885 -> 0 bytes
-rw-r--r--templates/other/Notification/root/res/drawable-xhdpi/ic_action_stat_reply.pngbin1692 -> 0 bytes
-rw-r--r--templates/other/Notification/root/res/drawable-xhdpi/ic_action_stat_share.pngbin1780 -> 0 bytes
-rw-r--r--templates/other/Notification/root/res/values/strings.xml.ftl13
-rw-r--r--templates/other/Notification/root/src/app_package/NotificationHelper.java.ftl205
-rw-r--r--templates/other/Notification/template.xml58
-rw-r--r--templates/other/Notification/template_notification_list.pngbin7306 -> 0 bytes
-rw-r--r--templates/other/Notification/template_notification_list_actions.pngbin7850 -> 0 bytes
-rw-r--r--templates/other/Notification/template_notification_none.pngbin4146 -> 0 bytes
-rw-r--r--templates/other/Notification/template_notification_none_actions.pngbin5904 -> 0 bytes
-rw-r--r--templates/other/Notification/template_notification_picture.pngbin6308 -> 0 bytes
-rw-r--r--templates/other/Notification/template_notification_picture_actions.pngbin6749 -> 0 bytes
-rw-r--r--templates/other/Notification/template_notification_text.pngbin6695 -> 0 bytes
-rw-r--r--templates/other/Notification/template_notification_text_actions.pngbin7073 -> 0 bytes
-rw-r--r--templates/other/Service/globals.xml.ftl4
-rw-r--r--templates/other/Service/recipe.xml.ftl7
-rw-r--r--templates/other/Service/root/AndroidManifest.xml.ftl10
-rw-r--r--templates/other/Service/root/src/app_package/Service.java.ftl16
-rw-r--r--templates/other/Service/template.xml32
-rw-r--r--templates/projects/NewAndroidApplication/globals.xml.ftl4
-rw-r--r--templates/projects/NewAndroidApplication/recipe.xml.ftl21
-rw-r--r--templates/projects/NewAndroidApplication/root/AndroidManifest.xml.ftl15
-rwxr-xr-xtemplates/projects/NewAndroidApplication/root/res/drawable-hdpi/ic_launcher.pngbin9397 -> 0 bytes
-rwxr-xr-xtemplates/projects/NewAndroidApplication/root/res/drawable-mdpi/ic_launcher.pngbin5237 -> 0 bytes
-rwxr-xr-xtemplates/projects/NewAndroidApplication/root/res/drawable-xhdpi/ic_launcher.pngbin14383 -> 0 bytes
-rw-r--r--templates/projects/NewAndroidApplication/root/res/values-v11/styles_hc.xml.ftl11
-rw-r--r--templates/projects/NewAndroidApplication/root/res/values-v14/styles_ics.xml12
-rw-r--r--templates/projects/NewAndroidApplication/root/res/values/strings.xml.ftl3
-rw-r--r--templates/projects/NewAndroidApplication/root/res/values/styles.xml.ftl20
-rw-r--r--templates/projects/NewAndroidApplication/template.xml82
-rw-r--r--templates/projects/NewAndroidApplication/template_new_project.pngbin12408 -> 0 bytes
386 files changed, 9254 insertions, 8175 deletions
diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000..6625ea5
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,112 @@
+Some of the SDK tools sources have moved out of the sdk.git project.
+They are no longer found here.
+
+Instead they can be found in the tools/base.git and the tools/swt.git projects.
+If you need to view/change the source and lack these folders, you can bring
+them by using a repo init command such as:
+
+$ repo init -u https://android.googlesource.com/platform/manifest -g all,-notdefault,tools
+$ repo sync [-j N]
+
+The libraries that are sourced in tools/base and tools/swt are converted to
+prebuilts which are located in prebuilts/devtools. These prebuilts are the
+ones being used when doing a "make sdk".
+
+
+----------
+1- I don't build full SDKs but I want to change tool X:
+----------
+
+Let's say as an example you want to change lint.
+It's now located in tools/base/lint.
+
+To build it from the command-line, you'd use "gradle" as such:
+
+$ cd tools/base
+$ ./gradlew lint:build
+
+Output is located in $TOP/out/host/gradle/tools/base/lint/libs/
+
+Some comments/tips:
+- Gradle is a build system, a bit like make or ant.
+ If you want to know more, visit http://www.gradle.org/
+
+- On Windows with the CMD shell, use ./gradlew.bat.
+ For Cygwin, Linux or Mac, use ./gradlew.
+
+- Gradle targets are in the form "project-name:task-name".
+ To get a list of possible tasks, try this: $ ./gradlew lint:tasks
+
+- Generally there are only 2 task names to remember:
+ $ ./gradlew lint:assemble ==> builds but do not run tests.
+ $ ./gradlew lint:check ==> runs tests and checks such as findbugs.
+
+- To find the list of project-names you can use with gradle:
+ $ ./gradlew projects
+
+The new moved projects are unsurprisingly named like their former "make"
+counterparts. They are split between 2 repos:
+- tools/swt contains all SWT-dependent projects.
+- tools/base contains all other non-SWT projects.
+
+However that means that when you want to modify a project using both repos,
+you need an extra step.
+
+For example, the SDK Manager UI is located in /tools/swt/sdkmanager.
+However it does depend on /tools/base/sdklib. Let's say you want to
+make a change in both sdklib and sdkuilib. Here are the steps:
+
+$ # Edit tools/base/sdklib files.
+$ cd tools/base ; ./gradlew sdklib:publishLocal
+ => this builds sdklib and "publishes" an sdklib.JAR into a local maven
+ repo located in the out/gradle folder. Note that this is just a
+ temporary build artifact and is NOT used by "make sdk".
+
+$ # Edit tools/swt/sdkmanager/sdkuilib files to use the changes from sdklib.
+$ cd ../../tools/swt ; ./gradlew sdkuilib:assemble
+ => this builds sdkuilib by using the local JAR of sdklib that is
+ located in the out/gradlew folder.
+
+
+
+----------
+2- How do I change some tools sources and build a new SDK using these?
+----------
+
+Let's say you changed something in tools/base/lint and run "make sdk" from
+the top dir. Your changes will NOT be included in the resulting SDK.
+
+That's because the SDK has been changed to only rely on the prebuilts located
+in /prebuilts/devtools. There are pros and cons with this approach and we're
+not going to discuss them here. Instead we'll focus on what you need to do.
+
+It's fairly simple. Go back to the top dir on your Android tree and run:
+
+$ prebuilts/devtools/update_jars.sh -f
+$ make sdk
+
+Now your changes are included in the generated SDK.
+
+What you should know about the update_jars.sh script:
+- Without argument, it prints what it would do but does nothing.
+ Use the "-f" argument to make it build/copy stuff.
+
+- It builds indiscriminiately. It just builds ALL the libs from
+ tools/base and tools/swt and updates all the JARs under prebuilts/devtools.
+ That should only take 20-30 seconds though. Eventually we'll work on
+ making it smarter because obviously we don't want anyone to just try
+ to submit 30 JARs just because their timestamp changed.
+
+- It generates a git merge msg in prebuilts/devtools that has the sha1
+ of the corresponding tools/base and tools/swt projects.
+ Use option -m to prevent this.
+
+
+------
+
+Need a place to discuss all this?
+http://groups.google.com/group/adt-dev is the right place.
+
+--- RM 20130409
+
+
diff --git a/adtproductbuild/Android.mk b/adtproductbuild/Android.mk
index 80f23a2..a5d0c8b 100644
--- a/adtproductbuild/Android.mk
+++ b/adtproductbuild/Android.mk
@@ -6,6 +6,7 @@
#
# Expected env vars:
# ADT_IDE_DEST_DIR: existing directory where to copy the IDE zip files.
+# ADT_IDE_QUALIFIER: a root qualifier to incorporate before the build timestamp in plugins.
# ADT_IDE_ZIP_QUALIFIER: either a date or build number to incorporate in the zip names.
# Expose the ADT Eclipse IDE build only for the SDK when building adt_eclipse_ide
@@ -56,6 +57,7 @@ $(ADT_IDE_JAVA_TARGET) : $(TOPDIR)sdk/adtproductbuild/adt_eclipse_ide \
-application org.eclipse.ant.core.antRunner \
-configuration ../../out/host/eclipse/adtproduct/ant-configuration \
-data ../../out/host/eclipse/adtproduct/ant-workspace \
+ -DADT_IDE_QUALIFIER=$(ADT_IDE_QUALIFIER) \
2>&1 && \
mv -f ../../$(ADT_IDE_BUILD_LOG) ../../$(ADT_IDE_BUILD_LOG).1 ) \
| tee ../../$(ADT_IDE_BUILD_LOG) \
diff --git a/adtproductbuild/build.xml b/adtproductbuild/build.xml
index e032e33..4c5cbb9 100644
--- a/adtproductbuild/build.xml
+++ b/adtproductbuild/build.xml
@@ -1,8 +1,16 @@
<project name="com.android.eclipse.rcp.build" default="build">
+
+ <!-- Set QUALIFIER to ADT_IDE_QUALIFIER if defined, otherwise use a date timestamp. -->
<tstamp>
- <format property="QUALIFIER" pattern="yyyy-M-d-H-m"/>
+ <format property="defaultQualifier" pattern="yyyyMMddHHmm"/>
</tstamp>
+ <condition property="QUALIFIER" value="v${defaultQualifier}" else="${ADT_IDE_QUALIFIER}">
+ <equals arg1="${ADT_IDE_QUALIFIER}" arg2="" />
+ </condition>
+
+ <echo message="## ADT IDE Build Qualifier: ${QUALIFIER}"/>
+
<!-- Root of Android Source Tree -->
<property name="ANDROID_SRC" location="../../" />
@@ -76,6 +84,16 @@
</copy>
</target>
+ <property name="GooglePlayTranslation.zip" value="${ANDROID_SRC}/tools/vendor/google/TranslationPluginForEclipse/ADT_Translation_Manager_plugin.zip" />
+ <available file="${GooglePlayTranslation.zip}" property="translation.plugin.present" />
+
+ <!-- Add localization plugin to the list of features if necessary -->
+ <target name="update-features" if="translation.plugin.present">
+ <replace file="${productBuildDir}/features/com.android.ide.eclipse.adt.package/feature.xml"
+ token='!--import feature="com.google.i18n.inkstone.eclipse.localization" --'
+ value='import feature="com.google.i18n.inkstone.eclipse.localization" /' />
+ </target>
+
<!-- create target platform -->
<target name="create-target">
<mkdir dir="${targetDir}" />
@@ -93,8 +111,12 @@
<unzip src="${targetSrcDir}/egit/org.eclipse.egit.repository-2.2.0.201212191850-r.zip" dest="${targetDir}/repos/egit" overwrite="false" />
</target>
+ <target name="create-translation-target" if="translation.plugin.present">
+ <unzip src="${GooglePlayTranslation.zip}" dest="${targetDir}/repos/tpe" overwrite="false" />
+ </target>
+
<!-- Launch pde build to build the adtpackage product -->
- <target name="feature-build" depends="copy_srcs, create-target">
+ <target name="feature-build" depends="copy_srcs, update-features, create-target, create-translation-target">
<java classname="org.eclipse.equinox.launcher.Main" fork="true" failonerror="true">
<arg value="-application" />
<arg value="org.eclipse.ant.core.antRunner" />
@@ -138,6 +160,7 @@
<arg value="-DrepoBaseLocation=${targetDir}/repos/" />
<arg value="-DtransformedRepoLocation=${targetDir}/transformedRepos/" />
<arg value="-Dconfigs=${buildconfigs}" />
+ <arg value="-DforceContextQualifier=${QUALIFIER}" />
<classpath>
<pathelement location="${equinox.launcher}" />
</classpath>
diff --git a/attribute_stats/.settings/org.eclipse.jdt.core.prefs b/attribute_stats/.settings/org.eclipse.jdt.core.prefs
index 9dbff07..ea66196 100644
--- a/attribute_stats/.settings/org.eclipse.jdt.core.prefs
+++ b/attribute_stats/.settings/org.eclipse.jdt.core.prefs
@@ -48,10 +48,10 @@ org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignor
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
-org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecInsufficientInfo=warning
-org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=ignore
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
diff --git a/build/tools.atree b/build/tools.atree
index b9ae5c9..45f44c9 100644
--- a/build/tools.atree
+++ b/build/tools.atree
@@ -14,28 +14,31 @@
# limitations under the License.
#
+##############################################################################
+# Tools Component
+##############################################################################
+
#
# These are the files that comprise the tools component of the SDK.
#
-prebuilts/devtools/tools/lib tools/lib
-
-prebuilts/devtools/tools/android tools/android
-prebuilts/devtools/tools/draw9patch tools/draw9patch
-prebuilts/devtools/tools/ddms tools/ddms
-prebuilts/devtools/tools/hierarchyviewer tools/hierarchyviewer
-prebuilts/devtools/tools/jobb tools/jobb
-prebuilts/devtools/tools/lint tools/lint
-prebuilts/devtools/tools/monkeyrunner tools/monkeyrunner
-prebuilts/devtools/tools/traceview tools/traceview
-prebuilts/devtools/tools/uiautomatorviewer tools/uiautomatorviewer
+prebuilts/devtools/tools/lib tools/lib
+# manual copy of lombok-ast for now
+prebuilts/tools/common/lombok-ast/lombok-ast-0.2.1.jar tools/lib/lombok-ast-0.2.1.jar
+prebuilts/tools/common/lombok-ast/LICENSE.txt tools/lib/lombok-ast-NOTICE.txt
-prebuilts/devtools/notices/NOTICE.txt tols/NOTICE.txt
+prebuilts/devtools/tools/android tools/android
+prebuilts/devtools/tools/draw9patch tools/draw9patch
+prebuilts/devtools/tools/ddms tools/ddms
+prebuilts/devtools/tools/hierarchyviewer tools/hierarchyviewer
+prebuilts/devtools/tools/jobb tools/jobb
+prebuilts/devtools/tools/lint tools/lint
+prebuilts/devtools/tools/monkeyrunner tools/monkeyrunner
+prebuilts/devtools/tools/traceview tools/traceview
+prebuilts/devtools/tools/uiautomatorviewer tools/uiautomatorviewer
+prebuilts/devtools/notices/NOTICE.txt tools/NOTICE.txt
-##############################################################################
-# Tools Component
-##############################################################################
# version files for the SDK updater, from sdk.git
sdk/files/tools_source.properties tools/source.properties
@@ -78,9 +81,10 @@ lib/lib64GLES_V2_translator${DLL_EXTENSION} strip tools/lib/lib64GLES_V2_trans
lib/lib64EGL_translator${DLL_EXTENSION} strip tools/lib/lib64EGL_translator${DLL_EXTENSION}
-# sdk.git Ant templates for project build files
+# sdk.git Ant and gradle templates for project build files
sdk/templates/build.template tools/lib/build.template
sdk/templates/uibuild.template tools/lib/uibuild.template
+sdk/templates/build_gradle.template tools/lib/build_gradle.template
sdk/files/proguard-project.txt tools/lib/proguard-project.txt
sdk/files/proguard-android.txt tools/proguard/proguard-android.txt
sdk/files/proguard-android-optimize.txt tools/proguard/proguard-android-optimize.txt
@@ -98,9 +102,6 @@ external/qemu/android/avd/hardware-properties.ini tools/lib/hardware-propertie
# emacs support from sdk.git
sdk/files/android.el tools/lib/android.el
-# Java Libraries for the tools
-sdk/apkbuilder/etc/apkbuilder tools/apkbuilder
-
# 3rd Party java libraries
framework/emmalib.jar tools/lib/emma_device.jar
external/emma/lib/emma.jar tools/lib/emma.jar
@@ -120,9 +121,10 @@ prebuilts/tools/common/proguard/proguard4.7/bin/retrace.sh tools/proguard/bi
prebuilts/tools/common/proguard/proguard4.7/src/proguard/ant/task.properties tools/proguard/ant/task.properties
# Templates
-sdk/templates/projects tools/templates/projects
-sdk/templates/activities tools/templates/activities
-sdk/templates/other tools/templates/other
+tools/base/templates/projects tools/templates/projects
+tools/base/templates/activities tools/templates/activities
+tools/base/templates/gradle tools/templates/gradle
+tools/base/templates/other tools/templates/other
# SDK Controller
sdk/apps/SdkController tools/apps/SdkController
@@ -130,14 +132,6 @@ sdk/apps/SdkController tools/apps/SdkController
# tools specific support jar
framework/annotations.jar tools/support/annotations.jar
-# systrace
-external/chromium-trace/systrace.py tools/systrace/systrace.py
-external/chromium-trace/script.js tools/systrace/script.js
-external/chromium-trace/style.css tools/systrace/style.css
-external/chromium-trace/LICENSE tools/systrace/LICENSE
-external/chromium-trace/AUTHORS tools/systrace/AUTHORS
-external/chromium-trace/NOTICE tools/systrace/NOTICE
-
# Misspelling databases for lint
sdk/files/typos tools/support
diff --git a/build/tools.windows.atree b/build/tools.windows.atree
index 421ac10..5e5e766 100755
--- a/build/tools.windows.atree
+++ b/build/tools.windows.atree
@@ -24,9 +24,6 @@
rm tools/android
prebuilts/devtools/tools/android.bat tools/android.bat
-rm tools/apkbuilder
-sdk/apkbuilder/etc/apkbuilder.bat tools/apkbuilder.bat
-
rm tools/ddms
prebuilts/devtools/tools/ddms.bat tools/ddms.bat
diff --git a/docs/howto_build_SDK.txt b/docs/howto_build_SDK.txt
index dbe51d9..3e56569 100644
--- a/docs/howto_build_SDK.txt
+++ b/docs/howto_build_SDK.txt
@@ -15,7 +15,7 @@ limitations under the License.
Subject: How to build an Android SDK & ADT Eclipse plugin.
Date: 2009/03/27
-Updated: 2010/03/30
+Updated: 2013/04/09
Table of content:
@@ -74,7 +74,7 @@ For example for the cupcake branch:
$ mkdir ~/my-android-git
$ cd ~/my-android-git
- $ repo init -u https://android.googlesource.com/platform/manifest -b master
+ $ repo init -u https://android.googlesource.com/platform/manifest -b master -g all,-notdefault,tools
$ repo sync
Then once you have all the source, simply build the SDK using:
@@ -110,15 +110,16 @@ Some options:
3- Building an SDK for Windows
------------------------------
-Full Windows SDK builds are now only supported on Linux -- most of the framework is
-not designed to be built on Windows so technically the Windows SDK is build on top
-of a Linux SDK where a few binaries are replaced. So it cannot be built on Windows,
-and it cannot be built on Mac, only on Linux.
+Full Windows SDK builds are now only supported on Linux -- most of the
+framework is not designed to be built on Windows so technically the Windows
+SDK is build on top of a Linux SDK where a few binaries are replaced. So it
+cannot be built on Windows, and it cannot be built on Mac, only on Linux.
I'll repeat this again because it's important:
To build the Android SDK for Windows, you need to use a *Linux* box.
+
A- Pre-requisites
-----------------
@@ -126,7 +127,7 @@ Before you can even think of building the Android SDK for Windows, you need to
perform the steps from section "2- Building an SDK for MacOS and Linux" above:
setup and build a regular Linux SDK. Once this working, please continue here.
-Under Ubuntu, you will need the following extra packages:
+Under Ubuntu, you will need the following extra packages:
$ sudo apt-get install mingw32 tofrodos
@@ -142,7 +143,8 @@ $ . build/envsetup.sh
$ lunch sdk-eng
$ make win_sdk
-Note that this will build both a Linux SDK then a Windows SDK. The result is located at
+Note that this will build both a Linux SDK then a Windows SDK.
+The result is located at
out/host/windows/sdk/android-sdk_eng.${USER}_windows/
@@ -156,7 +158,7 @@ However sometimes you need to develop one specific tools, e.g. adb.exe or
aapt.exe, and it's just more convenient to do it on the same platform where
you can actually test it. This is what this section explains.
-
+
A- Cygwin pre-requisite & code checkout
---------------------------------------
@@ -219,7 +221,7 @@ Again, it requires a checkout of the full android code and the usual
setup like described above to build an SDK.
Then to build an isolated Windows binary, you'd do something like this:
-
+
$ cd ~/my-android-git
$ . build/envsetup.sh
$ lunch sdk-eng
@@ -235,80 +237,21 @@ Linux.
4- Building an ADT plugin for Eclipse
-------------------------------------
-Requirements:
-- You can currently only build an ADT plugin for Eclipse under Linux.
-- You must have a working version of Eclipse 3.6 "helios" RCP installed.
-- You need X11 to run Eclipse at least once.
-- You need a lot of patience. The trick is to do the initial setup correctly
- once, after it's a piece of cake.
-
-
-
-A- Pre-requisites
------------------
-
-Note for Ubuntu or Debian users: your apt repository probably only has Eclipse
-3.2 available and it's probably not suitable to build plugins in the first
-place. Forget that and install a working 3.6 manually as described below.
-
-- Visit http://www.eclipse.org/downloads/ to grab the
- "Eclipse for RCP/Plug-in Developers (176 MB)" download for Linux.
- 32-bit and 64-bit versions are available, depending on your Linux installation.
-
- Note: Eclipse comes in various editions. Do yourself a favor and just stick
- to the RCP for building this plugin. For example the J2EE contains too many
- useless features that will get in the way, and the "Java" version lacks some
- plugins you need to build other plugins. Please just use the RCP one.
-
- Note: You will need the CDT plugin but don't take a "CDT" flavor build as it
- will lack the RCP tools. Instead take an RCP and then add CDT.
-
-- Unpack "eclipse-rcp-*-linux-gtk.tar.gz" in the directory of
- your choice, e.g.:
+We've simplified the steps here.
+It used to be that you'd have to download a specific version of
+Eclipse and install it at a special location. That's not needed
+anymore.
- $ mkdir ~/eclipse-3.6
- $ cd ~/eclipse-3.6
- $ tar xvzf eclipse-rcp-????-linux-gtk.tar.gz
-
- This will create an "eclipse" directory in the current directory.
-
-- Set ECLIPSE_HOME to that "eclipse" directory:
-
- $ export ECLIPSE_HOME=~/eclipse-3.6/eclipse
-
- Note: it is important you set ECLIPSE_HOME before starting the build.
- Otherwise the build process will try to download and install its own Eclipse
- installation in /buildroot, which is probably limited to root.
-
-- Now, before you can build anything, it is important that you start Eclipse
- *manually* once using the same user that you will use to build later. That's
- because your Eclipse installation is not finished: Eclipse must be run at
- least once to create some files in ~/.eclipse/. So run Eclipse now:
-
- $ ~/eclipse-3.6/eclipse/eclipse &
-
-- Since you have Eclipse loaded, now is a perfect time to pick up the
- CDT plugin. (Another alternative is is to fetch the CDT from its archives
- and manually dump all the *.jar in eclipse/plugins.)
-
- That's it. You won't need to run it manually again.
-
-
-
-B- Building ADT
----------------
-
-Finally, you have Eclipse, it's installed and it created its own config files,
-so now you can build your ADT plugin. To do that you'll change directories to
-your git repository and invoke the build script by giving it a destination
-directory and an optional build number:
+Instead you just change directories to your git repository and invoke the
+build script by giving it a destination directory and an optional build number:
$ mkdir ~/mysdk
$ cd ~/my-android-git # <-- this is where you did your "repo sync"
$ sdk/eclipse/scripts/build_server.sh ~/mysdk $USER
+
The first argument is the destination directory. It must be absolute. Do not
-give a relative destination directory such as "../mysdk". This will make the
+give a relative destination directory such as "../mysdk" -- this would make the
Eclipse build fail with a cryptic message:
BUILD SUCCESSFUL
diff --git a/eclipse/features/com.android.ide.eclipse.adt.package/feature.xml b/eclipse/features/com.android.ide.eclipse.adt.package/feature.xml
index 15871b1..8e69281 100644
--- a/eclipse/features/com.android.ide.eclipse.adt.package/feature.xml
+++ b/eclipse/features/com.android.ide.eclipse.adt.package/feature.xml
@@ -79,6 +79,13 @@
<import feature="com.android.ide.eclipse.hierarchyviewer" version="22.0.0" match="greaterOrEqual" />
<import feature="com.android.ide.eclipse.ndk" version="22.0.0" match="greaterOrEqual" />
<import feature="com.android.ide.eclipse.traceview" version="22.0.0" match="greaterOrEqual" />
+ <!--
+ The build scripts will pull in the translation plugin if its plugin repository is accessible.
+ The following line should remain without any modifications as the build script looks for
+ exactly this pattern and removes the comment tags.
+ See sdk.git/adtproductbuild/build.xml.
+ -->
+ <!--import feature="com.google.i18n.inkstone.eclipse.localization" -->
</requires>
</feature>
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt.overlay/.settings/org.eclipse.jdt.core.prefs b/eclipse/plugins/com.android.ide.eclipse.adt.overlay/.settings/org.eclipse.jdt.core.prefs
index 9dbff07..ea66196 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt.overlay/.settings/org.eclipse.jdt.core.prefs
+++ b/eclipse/plugins/com.android.ide.eclipse.adt.overlay/.settings/org.eclipse.jdt.core.prefs
@@ -48,10 +48,10 @@ org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignor
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
-org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecInsufficientInfo=warning
-org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=ignore
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt.package/.classpath b/eclipse/plugins/com.android.ide.eclipse.adt.package/.classpath
new file mode 100644
index 0000000..522e779
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt.package/.classpath
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt.package/.project b/eclipse/plugins/com.android.ide.eclipse.adt.package/.project
index eedf4c6..50d3fd1 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt.package/.project
+++ b/eclipse/plugins/com.android.ide.eclipse.adt.package/.project
@@ -6,6 +6,11 @@
</projects>
<buildSpec>
<buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
<name>org.eclipse.pde.ManifestBuilder</name>
<arguments>
</arguments>
@@ -18,5 +23,6 @@
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt.package/META-INF/MANIFEST.MF b/eclipse/plugins/com.android.ide.eclipse.adt.package/META-INF/MANIFEST.MF
index 91594bb..bdbc7ea 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt.package/META-INF/MANIFEST.MF
+++ b/eclipse/plugins/com.android.ide.eclipse.adt.package/META-INF/MANIFEST.MF
@@ -7,4 +7,11 @@ Bundle-Vendor: The Android Open Source Project
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Require-Bundle: org.eclipse.platform,
org.eclipse.equinox.app,
- org.eclipse.ui.intro
+ org.eclipse.ui.intro,
+ org.eclipse.ui.workbench,
+ org.eclipse.swt,
+ org.eclipse.core.runtime,
+ org.eclipse.core.commands,
+ org.eclipse.ui.forms,
+ org.eclipse.jface,
+ com.android.ide.eclipse.adt
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt.package/build.properties b/eclipse/plugins/com.android.ide.eclipse.adt.package/build.properties
index aef2e25..ad2df37 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt.package/build.properties
+++ b/eclipse/plugins/com.android.ide.eclipse.adt.package/build.properties
@@ -1,13 +1,13 @@
+source.. = src/
+output.. = bin/
bin.includes = META-INF/,\
plugin.xml,\
+ .,\
plugin_customization.ini,\
ide.product,\
adt-about.png,\
about.mappings,\
splash.bmp,\
icons/,\
- index.html,\
- introcontent.xml,\
about.ini,\
- about.properties,\
- welcome.css
+ about.properties
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt.package/index.html b/eclipse/plugins/com.android.ide.eclipse.adt.package/index.html
deleted file mode 100644
index e70fbcb..0000000
--- a/eclipse/plugins/com.android.ide.eclipse.adt.package/index.html
+++ /dev/null
@@ -1,91 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
- <title>Welcome to the Android Developer Tools</title>
- <link rel="stylesheet" type="text/css" href="welcome.css" />
-</head>
-
-<body>
-
-<div class="wrap">
-
- <div class="col-15">
- <h1>Welcome!</h1>
-
- <p>The <b>Android Developer Tools</b> provide a first-class development
- environment for building Android apps. This integrated development environment is
- set up with the latest version of the Android platform and system image so you can immediately begin
- building apps and running them on the Android emulator.</p>
-
-
- <p>To start a new Android app project:</p>
- <ol>
- <li>Click <strong>File > New > Android Application Project</strong>.
- <br>(If you don't see this option, click <strong>File > New > Other</strong>,
- then open the <strong>Android</strong>
- folder and select <strong>Android Application Project</strong>.)</li>
- <li>Follow the wizard to set up your new Android app project.</li>
- </ol>
- <p>For a complete walkthrough that shows how to create a new
- project and build a simple app, read <a target="_blank"
- href="http://developer.android.com/training/basics/firstapp/index.html">Building Your First App</a>.</p>
-
- <p>To set up a real Android device for testing your app, read
- <a target="_blank" href="http://developer.android.com/tools/device.html">Using Hardware Devices</a>.
- If you don't have a device and need to use the emulator, read <a
- target="_blank" href="http://developer.android.com/tools/devices/index.html"
- >Managing Virtual Devices</a>.</p>
-
- <p>Although your Android SDK already includes the latest version of the platform and system image,
- you may later want to install other Android versions or packages such as the
- <a target="_blank" href="http://developer.android.com/tools/extras/support-library.html">Android Support Library</a>.
- For help installing additional packages, read
- <a target="_blank" href="http://developer.android.com/sdk/installing/adding-packages.html">Adding Platforms
- and Packages</a>.</p>
-
- </div>
-
-</div>
-
-
-<div class="wrap">
-
- <div class="col-5">
- <a target="_blank" href="http://developer.android.com/training/basics/firstapp/index.html">
- <div class="feature-box">
- <h2>Build Your First App &raquo;</h2>
- <p>If you're new to Android, follow this class
- to learn the fundamental Android APIs for creating
- a user interface that responds to input.</p>
- </div>
- </a>
- </div>
-
- <div class="col-5">
- <a target="_blank" href="http://developer.android.com/design/index.html">
- <div class="feature-box">
- <h2>Design Your App &raquo;</h2>
- <p>Before you begin developing your app, be sure you understand
- the design patterns that Android users expect from your app.</p>
- </div>
- </a>
- </div>
-
- <div class="col-5">
- <a target="_blank" href="http://developer.android.com/tools/testing/testing_android.html">
- <div class="feature-box">
- <h2>Test Your App &raquo;</h2>
- <p>The Android framework provides
- tools that help you test every aspect of your app to be sure it behaves
- as it should under various conditions.</p>
- </div>
- </a>
- </div>
-
-
-</div>
-
-
-</body>
-</html> \ No newline at end of file
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt.package/introcontent.xml b/eclipse/plugins/com.android.ide.eclipse.adt.package/introcontent.xml
deleted file mode 100644
index 65d226f..0000000
--- a/eclipse/plugins/com.android.ide.eclipse.adt.package/introcontent.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="utf-8" ?>
-<introContent>
- <page
- id="root"
- url="index.html"/>
- <page
- id="standbyPageId"
- url="index.html"/>
-</introContent> \ No newline at end of file
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt.package/plugin.xml b/eclipse/plugins/com.android.ide.eclipse.adt.package/plugin.xml
index 5d4a993..fbeabb9 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt.package/plugin.xml
+++ b/eclipse/plugins/com.android.ide.eclipse.adt.package/plugin.xml
@@ -32,38 +32,31 @@
name="startupForegroundColor"
value="999999" />
<property
- name="windowImages"
- value="icons/adt16.png,icons/adt32.png,icons/adt48.png">
+ name="windowImages"
+ value="icons/adt16.png,icons/adt32.png,icons/adt48.png">
+ </property>
+ <property
+ name="cssTheme"
+ value="org.eclipse.e4.ui.css.theme.e4_default">
+ </property>
+ <property
+ name="applicationCSSResources"
+ value="platform:/plugin/org.eclipse.platform/images/">
</property>
</product>
</extension>
<extension
point="org.eclipse.ui.intro">
<intro
- class="org.eclipse.ui.intro.config.CustomizableIntroPart"
+ class="com.android.ide.eclipse.adt.internal.AdtIntro"
icon="icons/adt16.png"
- id="org.eclipse.intro.minimal"
+ id="com.android.ide.eclipse.adt.intro"
label="Android IDE"/>
</extension>
<extension
- point="org.eclipse.ui.intro.config">
- <config
- content="introcontent.xml"
- id="org.eclipse.intro.minimal.config"
- introId="org.eclipse.intro.minimal">
- <presentation
- home-page-id="root"
- standby-page-id="standby">
- <implementation
- kind="html">
- </implementation>
- </presentation>
- </config>
- </extension>
- <extension
point="org.eclipse.ui.intro">
<introProductBinding
- introId="org.eclipse.intro.minimal"
+ introId="com.android.ide.eclipse.adt.intro"
productId="com.android.ide.eclipse.adt.package.product">
</introProductBinding>
</extension>
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt.package/src/com/android/ide/eclipse/adt/internal/AdtIntro.java b/eclipse/plugins/com.android.ide.eclipse.adt.package/src/com/android/ide/eclipse/adt/internal/AdtIntro.java
new file mode 100644
index 0000000..27e758c
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt.package/src/com/android/ide/eclipse/adt/internal/AdtIntro.java
@@ -0,0 +1,168 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal;
+
+import com.android.ide.eclipse.adt.AdtPlugin;
+import com.android.ide.eclipse.adt.internal.wizards.actions.NewProjectAction;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.browser.IWebBrowser;
+import org.eclipse.ui.browser.IWorkbenchBrowserSupport;
+import org.eclipse.ui.forms.events.HyperlinkAdapter;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.events.IHyperlinkListener;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.intro.IIntroPart;
+import org.eclipse.ui.part.IntroPart;
+
+import java.net.URL;
+
+public class AdtIntro extends IntroPart implements IIntroPart {
+ private static final int TEXT_WIDTH = 600;
+
+ private FormToolkit mToolkit;
+ private ScrolledForm mForm;
+
+ @Override
+ public void standbyStateChanged(boolean standby) {
+ }
+
+ @Override
+ public void createPartControl(Composite parent) {
+ mToolkit = new FormToolkit(parent.getDisplay());
+ mForm = mToolkit.createScrolledForm(parent);
+
+ mForm.setText("Welcome!");
+ mToolkit.decorateFormHeading(mForm.getForm());
+ mForm.getToolBarManager().update(true);
+
+ //TableWrapLayout layout = new TableWrapLayout();
+ //layout.numColumns = 2;
+ GridLayout layout = new GridLayout(1, false);
+ mForm.getBody().setLayout(layout);
+
+ createText(mForm.getBody(),
+ "The Android Developer Tools provide a first-class development environment for " +
+ "building Android apps. This integrated development environment is set up with " +
+ "the latest version of the Android platform and system image so you can " +
+ "immediately begin building apps and running them on the Android emulator."
+ );
+
+ Button newProject = mToolkit.createButton(mForm.getBody(),
+ "New Android Application...",
+ SWT.PUSH);
+ newProject.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ NewProjectAction npwAction = new NewProjectAction();
+ npwAction.run(null /*action*/);
+ PlatformUI.getWorkbench().getIntroManager().closeIntro(AdtIntro.this);
+ }
+ });
+
+ Section section = mToolkit.createSection(mForm.getBody(),
+ Section.SHORT_TITLE_BAR | Section.CLIENT_INDENT);
+ section.setText("Tutorials");
+
+ Composite c = mToolkit.createComposite(section);
+ c.setLayout(new GridLayout(2, false));
+
+ createHyperlink(c, "Build Your First App",
+ "http://developer.android.com/training/basics/firstapp/index.html");
+ createText(c, "If you're new to Android, follow this class to learn the fundamental " +
+ "Android APIs for creating a user interface that responds to input.");
+
+ createHyperlink(c, "Design Your App", "http://developer.android.com/design/index.html");
+ createText(c,
+ "Before you begin developing your app, be sure you understand the design patterns "
+ + "that Android users expect from your app.");
+
+ createHyperlink(c, "Test Your App",
+ "http://developer.android.com/tools/testing/testing_android.html");
+ createText(c, "The Android Framework provides tools that help you test every aspect of "
+ + "your app to be sure it behaves as expected under various conditions.");
+
+ section.setClient(c);
+
+ mForm.reflow(true);
+ }
+
+ private void createText(Composite body, String text) {
+ Label l = mToolkit.createLabel(body, text, SWT.WRAP);
+ GridData gd = new GridData();
+ gd.widthHint = TEXT_WIDTH;
+ l.setLayoutData(gd);
+ }
+
+ private void createHyperlink(Composite c, String text, String url) {
+ Hyperlink link = mToolkit.createHyperlink(c, text, SWT.WRAP);
+ link.setHref(url);
+ link.addHyperlinkListener(sHyperLinkListener);
+ GridData gd = new GridData();
+ gd.verticalAlignment = SWT.TOP;
+ link.setLayoutData(gd);
+ }
+
+ private static final IHyperlinkListener sHyperLinkListener = new HyperlinkAdapter() {
+ @Override
+ public void linkActivated(HyperlinkEvent e) {
+ if (!(e.getHref() instanceof String)) {
+ return;
+ }
+
+ String url = (String) e.getHref();
+ if (url.isEmpty()) {
+ return;
+ }
+
+ IWorkbenchBrowserSupport support = PlatformUI.getWorkbench().getBrowserSupport();
+ IWebBrowser browser;
+ try {
+ browser = support.getExternalBrowser();
+ browser.openURL(new URL(url));
+ } catch (Exception ex) {
+ AdtPlugin.log(ex, "Error launching browser for URL: %1$s", url);
+ }
+ }
+ };
+
+ @Override
+ public void setFocus() {
+ mForm.setFocus();
+ }
+
+ @Override
+ public void dispose() {
+ if (mToolkit != null) {
+ mToolkit.dispose();
+ mToolkit = null;
+ }
+
+ super.dispose();
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt.package/welcome.css b/eclipse/plugins/com.android.ide.eclipse.adt.package/welcome.css
deleted file mode 100644
index 9815087..0000000
--- a/eclipse/plugins/com.android.ide.eclipse.adt.package/welcome.css
+++ /dev/null
@@ -1,176 +0,0 @@
-/* stylesheet for ADT welcome page */
-
-html,body {
- background-color:#F9F9F9;
- font:14px/19px sans-serif;
- color: #222
- margin:0;
- padding:0;}
-
-body {
- padding:15px;
-}
-
-a:link, a:visited {
- color: #258aaf;
- text-decoration: none;
-}
-a:focus, a:hover, a:active {
- color: #33B5E5;
- text-decoration: none;
-}
-strong, b {
- font-weight:bold;
- color: #222;
-}
-img {
- border: none; }
-
-
-h1, h2 {
- line-height: 32px;
-}
-h1 {
- color:#33B5E5;
- font-size: 28px;
- margin: 10px 0 0;
- padding:0;
-}
-h2 {
- color:#33B5E5;
- font-size: 20px;
- margin: 20px 0 20px;
- padding:0;
-}
-h3 {
- color:#33B5E5;
- font-size: 18px;
-}
-
-
-div.feature-box,
-a:link div.feature-box,
-a:visited div.feature-box {
- margin: 20px 0 0;
- padding: 15px 0;
- width:100%;
- border:1px solid transparent;
- background-color: rgba(0, 0, 0, 0.05);
- -moz-box-shadow: 3px 3px 12px #aaa;
- -webkit-box-shadow: 3px 3px 12px #aaa;
- box-shadow: 3px 3px 12px #aaa;
-}
-
-a:hover div.feature-box {
- border:1px solid #33B5E5;
-}
-a:active div.feature-box {
- -moz-box-shadow: 1px 1px 12px #aaa;
- -webkit-box-shadow: 1px 1px 12px #aaa;
- box-shadow: 1px 1px 12px #aaa;
-}
-div.feature-box > * {
- margin:15px;
-}
-div.feature-box h2,
-div.feature-box h3 {
- color:#33B5E5;
- margin-top:0;
-}
-div.feature-box p {
- color:#222;
-}
-
-
-
-
-
-
-
-/********** LAYOUT **************/
-
-.wrap {
- margin: 0 auto;
- width: 100%;
- min-width:600px;
- max-width:900px;
- clear: both;
-}
-.cols {
- height: 1%;
- margin: 0 -1.533742331288343558282%;
- width: 103.06748466257669%}
-*+html .cols {
- margin-bottom: 20px;
-}
-.cols:after {
- clear: both;
- content: ' ';
- display: block;
- height: 0;
- visibility: hidden;
-}
-.col-1, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-10, .col-11, .col-12,
-.col-13, .col-14, .col-15, .col-16 {
- float: left;
- margin: 0 1.2% 20px 1.7%;
-}
-* html .col-1, * html .col-2, * html .col-3, * html .col-4, * html .col-5, * html .col-6, * html
-.col-7, * html .col-8, * html .col-9, * html .col-10, * html .col-11, * html .col-12, * html
-.col-13, * html .col-14, * html .col-15, * html .col-16 {
- margin: 0;
- margin: 0 1.2% 20px 1.7%;
-}
-[dir='rtl'] .col-1, [dir='rtl'] .col-2, [dir='rtl'] .col-3, [dir='rtl'] .col-4, [dir='rtl'] .col-5,
-[dir='rtl'] .col-6, [dir='rtl'] .col-7, [dir='rtl'] .col-8, [dir='rtl'] .col-9, [dir='rtl'] .col-10,
-[dir='rtl'] .col-11, [dir='rtl'] .col-12 {
- float: right;
-}
-.col-1 {
- width: 4.16666666666667%;
-}
-.col-2 {
- width: 10.4166666666667%;
-}
-.col-3 {
- width: 16.6666666666667%;
-}
-.col-4 {
- width: 22.9166666666667%;
-}
-.col-5 {
- width: 29.1666666666667%;
-}
-.col-6 {
- width: 35.4166666666667%;
-}
-.col-7 {
- width: 41.6666666666667%;
-}
-.col-8 {
- width: 47.9166666666667%;
-}
-.col-9 {
- width: 55.3333333333333%;
-}
-.col-10 {
- width: 60.4166666666667%;
-}
-.col-11 {
- width: 66.6666666666667%;
-}
-.col-12 {
- width: 72.9166666666667%;
-}
-.col-13 {
- width: 79.1666666666667%;
-}
-.col-14 {
- width: 85.4166666666667%;
-}
-.col-15 {
- width: 91.6666666666667%;
-}
-.col-16 {
- width: 97.9166666666667%;
-}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/.settings/org.eclipse.core.resources.prefs b/eclipse/plugins/com.android.ide.eclipse.adt/.settings/org.eclipse.core.resources.prefs
index 2576b6d..b3c7fde 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/.settings/org.eclipse.core.resources.prefs
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/.settings/org.eclipse.core.resources.prefs
@@ -1,2 +1 @@
eclipse.preferences.version=1
-encoding//src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/LocaleManager.java=UTF-8
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/.settings/org.eclipse.jdt.core.prefs b/eclipse/plugins/com.android.ide.eclipse.adt/.settings/org.eclipse.jdt.core.prefs
index 9dbff07..ea66196 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/.settings/org.eclipse.jdt.core.prefs
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/.settings/org.eclipse.jdt.core.prefs
@@ -48,10 +48,10 @@ org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignor
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
-org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecInsufficientInfo=warning
-org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=ignore
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF b/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF
index 4fa9be2..1683324 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/META-INF/MANIFEST.MF
@@ -59,7 +59,7 @@ Export-Package: com.android.assetstudiolib;x-friends:="com.android.ide.eclipse.t
com.android.ide.common.layout.grid;x-friends:="com.android.ide.eclipse.tests",
com.android.ide.common.layout.relative;x-friends:="com.android.ide.eclipse.tests",
com.android.ide.common.resources.platform;x-friends:="com.android.ide.eclipse.tests",
- com.android.ide.eclipse.adt;x-friends:="com.android.ide.eclipse.tests",
+ com.android.ide.eclipse.adt;x-friends:="com.android.ide.eclipse.tests,com.android.ide.eclipse.adt.package",
com.android.ide.eclipse.adt.internal;x-friends:="com.android.ide.eclipse.tests",
com.android.ide.eclipse.adt.internal.actions;x-friends:="com.android.ide.eclipse.tests",
com.android.ide.eclipse.adt.internal.assetstudio;x-friends:="com.android.ide.eclipse.tests",
@@ -113,8 +113,9 @@ Export-Package: com.android.assetstudiolib;x-friends:="com.android.ide.eclipse.t
com.android.ide.eclipse.adt.internal.ui;x-friends:="com.android.ide.eclipse.tests",
com.android.ide.eclipse.adt.internal.utils;x-friends:="com.android.ide.eclipse.tests",
com.android.ide.eclipse.adt.internal.welcome;x-friends:="com.android.ide.eclipse.tests",
- com.android.ide.eclipse.adt.internal.wizards.actions;x-friends:="com.android.ide.eclipse.tests",
+ com.android.ide.eclipse.adt.internal.wizards.actions;x-friends:="com.android.ide.eclipse.tests,com.android.ide.eclipse.adt.package",
com.android.ide.eclipse.adt.internal.wizards.export;x-friends:="com.android.ide.eclipse.tests",
+ com.android.ide.eclipse.adt.internal.wizards.exportgradle;x-friends:="com.android.ide.eclipse.tests",
com.android.ide.eclipse.adt.internal.wizards.newproject;x-friends:="com.android.ide.eclipse.tests",
com.android.ide.eclipse.adt.internal.wizards.newxmlfile;x-friends:="com.android.ide.eclipse.tests",
com.android.ide.eclipse.adt.internal.wizards.templates;x-friends:="com.android.ide.eclipse.tests",
@@ -133,14 +134,9 @@ Export-Package: com.android.assetstudiolib;x-friends:="com.android.ide.eclipse.t
com.android.tools.lint.client.api;x-friends:="com.android.ide.eclipse.tests",
com.android.tools.lint.detector.api;x-friends:="com.android.ide.eclipse.tests",
freemarker.cache;x-friends:="com.android.ide.eclipse.tests",
- freemarker.template;x-friends:="com.android.ide.eclipse.tests",
- org.kxml2.io;x-friends:="com.android.ide.eclipse.tests",
- org.kxml2.kdom;x-friends:="com.android.ide.eclipse.tests",
- org.kxml2.wap;x-friends:="com.android.ide.eclipse.tests",
- org.kxml2.wap.syncml;x-friends:="com.android.ide.eclipse.tests",
- org.kxml2.wap.wml;x-friends:="com.android.ide.eclipse.tests",
- org.kxml2.wap.wv;x-friends:="com.android.ide.eclipse.tests",
- org.xmlpull.v1;x-friends:="com.android.ide.eclipse.tests"
+ freemarker.template;x-friends:="com.android.ide.eclipse.tests"
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Import-Package: com.ibm.icu.text,
+ org.eclipse.core.variables
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/icons/checker.png b/eclipse/plugins/com.android.ide.eclipse.adt/icons/checker.png
new file mode 100644
index 0000000..78908f4
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/icons/checker.png
Binary files differ
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/icons/gradle.png b/eclipse/plugins/com.android.ide.eclipse.adt/icons/gradle.png
new file mode 100644
index 0000000..63ba4c2
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/icons/gradle.png
Binary files differ
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/plugin.xml b/eclipse/plugins/com.android.ide.eclipse.adt/plugin.xml
index 77108c8..5584914 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/plugin.xml
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/plugin.xml
@@ -581,6 +581,10 @@
class="com.android.ide.eclipse.adt.internal.project.LibraryClasspathContainerInitializer"
id="com.android.ide.eclipse.adt.LIBRARIES">
</classpathContainerInitializer>
+ <classpathContainerInitializer
+ class="com.android.ide.eclipse.adt.internal.project.LibraryClasspathContainerInitializer"
+ id="com.android.ide.eclipse.adt.DEPENDENCIES">
+ </classpathContainerInitializer>
</extension>
<extension point="org.eclipse.jdt.ui.classpathContainerPage">
<classpathContainerPage
@@ -602,6 +606,22 @@
name="Export Android Application">
</wizard>
</extension>
+ <extension point="org.eclipse.ui.exportWizards">
+ <category
+ id="com.android.ide.eclipse.wizards.category"
+ name="Android">
+ </category>
+ <wizard
+ category="com.android.ide.eclipse.wizards.category"
+ class="com.android.ide.eclipse.adt.internal.wizards.exportgradle.GradleExportWizard"
+ icon="icons/gradle.png"
+ id="com.android.ide.eclipse.adt.project.ExportGradleWizard"
+ name="Generate Gradle build files">
+ <selection
+ class="org.eclipse.jdt.core.IJavaProject">
+ </selection>
+ </wizard>
+ </extension>
<extension point="org.eclipse.ui.commands">
<command
name="Debug Android Application"
@@ -732,6 +752,14 @@
<contentTypeBinding contentTypeId="com.android.ide.eclipse.adt.binaryXml">
</contentTypeBinding>
</editor>
+ <editor
+ class="com.android.ide.eclipse.adt.internal.editors.draw9patch.Draw9PatchEditor"
+ contributorClass="com.android.ide.eclipse.adt.internal.editors.common.CommonActionContributor"
+ icon="icons/android_file.png"
+ id="draw9patchplugin.editors.Draw9PatchEditor"
+ name="Android Draw 9-patch Editor"
+ extensions="9.png">
+ </editor>
</extension>
<extension point="org.eclipse.ui.views">
<view
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/GravityHelper.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/GravityHelper.java
index 4b8154b..b9aabad 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/GravityHelper.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/common/layout/GravityHelper.java
@@ -32,7 +32,12 @@ import org.w3c.dom.Element;
/** Helper class for looking up the gravity masks of gravity attributes */
public class GravityHelper {
+ // From SDK constants; temporary
+ public static final String GRAVITY_VALUE_START = "start"; //$NON-NLS-1$
+ public static final String GRAVITY_VALUE_END = "end"; //$NON-NLS-1$
+
/** Bitmask for a gravity which includes left */
+ @SuppressWarnings("PointlessBitwiseExpression") // for symmetry with other fields
public static final int GRAVITY_LEFT = 1 << 0;
/** Bitmask for a gravity which includes right */
@@ -56,9 +61,15 @@ public class GravityHelper {
/** Bitmask for a gravity which includes bottom */
public static final int GRAVITY_BOTTOM = 1 << 7;
+ /** Bitmask for a gravity which includes start */
+ public static final int GRAVITY_START = 1 << 8;
+
+ /** Bitmask for a gravity which includes end */
+ public static final int GRAVITY_END = 1 << 9;
+
/** Bitmask for a gravity which includes any horizontal constraint */
public static final int GRAVITY_HORIZ_MASK = GRAVITY_CENTER_HORIZ | GRAVITY_FILL_HORIZ
- | GRAVITY_LEFT | GRAVITY_RIGHT;
+ | GRAVITY_LEFT | GRAVITY_RIGHT | GRAVITY_START | GRAVITY_END;
/** Bitmask for a gravity which any vertical constraint */
public static final int GRAVITY_VERT_MASK = GRAVITY_CENTER_VERT | GRAVITY_FILL_VERT
@@ -84,7 +95,7 @@ public class GravityHelper {
*/
public static int getGravity(String gravityString, int defaultMask) {
int gravity = defaultMask;
- if (gravityString != null && gravityString.length() > 0) {
+ if (gravityString != null && !gravityString.isEmpty()) {
String[] anchors = gravityString.split("\\|"); //$NON-NLS-1$
for (String anchor : anchors) {
if (GRAVITY_VALUE_CENTER.equals(anchor)) {
@@ -104,12 +115,14 @@ public class GravityHelper {
} else if (GRAVITY_VALUE_BOTTOM.equals(anchor)) {
gravity = (gravity & GRAVITY_HORIZ_MASK) | GRAVITY_BOTTOM;
} else if (GRAVITY_VALUE_LEFT.equals(anchor)) {
- gravity = (gravity & GRAVITY_VERT_MASK) | GRAVITY_LEFT;
+ gravity = (gravity & (GRAVITY_VERT_MASK|GRAVITY_START)) | GRAVITY_LEFT;
} else if (GRAVITY_VALUE_RIGHT.equals(anchor)) {
- gravity = (gravity & GRAVITY_VERT_MASK) | GRAVITY_RIGHT;
- } else {
- // "clip" not supported
- }
+ gravity = (gravity & (GRAVITY_VERT_MASK|GRAVITY_END)) | GRAVITY_RIGHT;
+ } else if (GRAVITY_VALUE_START.equals(anchor)) {
+ gravity = (gravity & (GRAVITY_VERT_MASK|GRAVITY_LEFT)) | GRAVITY_START;
+ } else if (GRAVITY_VALUE_END.equals(anchor)) {
+ gravity = (gravity & (GRAVITY_VERT_MASK|GRAVITY_RIGHT)) | GRAVITY_END;
+ } // else: "clip" not supported
}
}
@@ -143,7 +156,7 @@ public class GravityHelper {
* @return true if the given gravity bitmask is left aligned
*/
public static boolean isLeftAligned(int gravity) {
- return (gravity & GRAVITY_LEFT) != 0;
+ return (gravity & (GRAVITY_LEFT|GRAVITY_START)) != 0;
}
/**
@@ -175,10 +188,26 @@ public class GravityHelper {
int horizontal = gravity & GRAVITY_HORIZ_MASK;
int vertical = gravity & GRAVITY_VERT_MASK;
- if ((horizontal & GRAVITY_LEFT) != 0) {
- sb.append(GRAVITY_VALUE_LEFT);
- } else if ((horizontal & GRAVITY_RIGHT) != 0) {
- sb.append(GRAVITY_VALUE_RIGHT);
+ if ((horizontal & (GRAVITY_LEFT|GRAVITY_START)) != 0) {
+ if ((horizontal & GRAVITY_LEFT) != 0) {
+ sb.append(GRAVITY_VALUE_LEFT);
+ }
+ if ((horizontal & GRAVITY_START) != 0) {
+ if (sb.length() > 0) {
+ sb.append('|');
+ }
+ sb.append(GRAVITY_VALUE_START);
+ }
+ } else if ((horizontal & (GRAVITY_RIGHT|GRAVITY_END)) != 0) {
+ if ((horizontal & GRAVITY_RIGHT) != 0) {
+ sb.append(GRAVITY_VALUE_RIGHT);
+ }
+ if ((horizontal & GRAVITY_END) != 0) {
+ if (sb.length() > 0) {
+ sb.append('|');
+ }
+ sb.append(GRAVITY_VALUE_END);
+ }
} else if ((horizontal & GRAVITY_CENTER_HORIZ) != 0) {
sb.append(GRAVITY_VALUE_CENTER_HORIZONTAL);
} else if ((horizontal & GRAVITY_FILL_HORIZ) != 0) {
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtConstants.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtConstants.java
index 76808e4..5330e08 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtConstants.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtConstants.java
@@ -65,7 +65,8 @@ public class AdtConstants {
"com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"; //$NON-NLS-1$
/** The container id for the libraries */
- public final static String CONTAINER_LIBRARIES = "com.android.ide.eclipse.adt.LIBRARIES"; //$NON-NLS-1$
+ public final static String CONTAINER_PRIVATE_LIBRARIES = "com.android.ide.eclipse.adt.LIBRARIES"; //$NON-NLS-1$
+ public final static String CONTAINER_DEPENDENCIES = "com.android.ide.eclipse.adt.DEPENDENCIES";
/** Separator for workspace path, i.e. "/". */
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java
index 7aec8f5..c5d95af 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/AdtPlugin.java
@@ -1181,6 +1181,9 @@ public class AdtPlugin extends AbstractUIPlugin implements ILogger {
public void run() {
Shell shell = disp.getActiveShell();
if (shell == null) {
+ shell = AdtPlugin.getShell();
+ }
+ if (shell == null) {
return;
}
@@ -1505,6 +1508,7 @@ public class AdtPlugin extends AbstractUIPlugin implements ILogger {
}
};
job.setPriority(Job.BUILD); // build jobs are run after other interactive jobs
+ job.setRule(ResourcesPlugin.getWorkspace().getRoot());
if (delay > 0) {
job.schedule(delay);
} else {
@@ -1833,6 +1837,7 @@ public class AdtPlugin extends AbstractUIPlugin implements ILogger {
return Status.OK_STATUS;
}
};
+ job.setRule(ResourcesPlugin.getWorkspace().getRoot());
job.setPriority(Job.SHORT); // a short background job, not interactive.
job.schedule();
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/Messages.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/Messages.java
index 31e3923..413c792 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/Messages.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/Messages.java
@@ -28,6 +28,8 @@ public class Messages extends NLS {
public static String VersionCheck_Plugin_Version_Failed;
+ public static String VersionCheck_Build_Tool_Missing;
+
public static String VersionCheck_Tools_Too_Old;
public static String VersionCheck_Unable_To_Parse_Version_s;
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/VersionCheck.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/VersionCheck.java
index dfc2e33..4aeb2cc 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/VersionCheck.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/VersionCheck.java
@@ -22,12 +22,14 @@ import com.android.ide.eclipse.adt.AdtPlugin.CheckSdkErrorHandler;
import com.android.ide.eclipse.adt.AdtPlugin.CheckSdkErrorHandler.Solution;
import com.android.ide.eclipse.adt.Messages;
import com.android.sdklib.repository.FullRevision;
+import com.android.sdklib.repository.FullRevision.PreviewComparison;
import com.android.sdklib.repository.PkgProps;
import org.osgi.framework.Constants;
import org.osgi.framework.Version;
import java.io.BufferedReader;
+import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
@@ -109,6 +111,15 @@ public final class VersionCheck {
Messages.VersionCheck_Plugin_Version_Failed);
}
+ // Are the build tools installed? We can't query Sdk#getLatestBuildTool yet, since
+ // SDK initialization typically hasn't completed yet and Sdk.getCurrent() is null.
+ File buildToolsFolder = new File(osSdkPath, SdkConstants.FD_BUILD_TOOLS);
+ if (!buildToolsFolder.isDirectory()) {
+ return errorHandler.handleWarning(
+ Solution.OPEN_SDK_MANAGER,
+ Messages.VersionCheck_Build_Tool_Missing);
+ }
+
// test the plugin number
String versionString = (String) plugin.getBundle().getHeaders().get(
Constants.BUNDLE_VERSION);
@@ -164,7 +175,7 @@ public final class VersionCheck {
}
}
- if (toolsRevision.compareTo(MIN_TOOLS_REV) < 0) {
+ if (toolsRevision.compareTo(MIN_TOOLS_REV, PreviewComparison.IGNORE) < 0) {
// this is a warning only as we need to parse the SDK to allow updating
// of the tools!
return errorHandler.handleWarning(
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/BuildHelper.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/BuildHelper.java
index da8c2ea..cda1da0 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/BuildHelper.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/BuildHelper.java
@@ -983,12 +983,12 @@ public class BuildHelper {
IClasspathEntry[] classpaths = javaProject.readRawClasspath();
if (classpaths != null) {
for (IClasspathEntry e : classpaths) {
- // ignore non exported entries, unless it's the LIBRARIES container,
+ // ignore non exported entries, unless they're in the DEPEDENCIES container,
// in which case we always want it (there may be some older projects that
// have it as non exported).
if (e.isExported() ||
(e.getEntryKind() == IClasspathEntry.CPE_CONTAINER &&
- e.getPath().toString().equals(AdtConstants.CONTAINER_LIBRARIES))) {
+ e.getPath().toString().equals(AdtConstants.CONTAINER_DEPENDENCIES))) {
handleCPE(e, javaProject, wsRoot, resMarker);
}
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/RenderScriptProcessor.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/RenderScriptProcessor.java
index af58e41..806e4e2 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/RenderScriptProcessor.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/RenderScriptProcessor.java
@@ -24,7 +24,6 @@ import com.android.ide.eclipse.adt.internal.build.builders.BaseBuilder;
import com.android.ide.eclipse.adt.internal.preferences.AdtPrefs;
import com.android.ide.eclipse.adt.internal.preferences.AdtPrefs.BuildVerbosity;
import com.android.ide.eclipse.adt.internal.project.BaseProjectHelper;
-import com.android.ide.eclipse.adt.internal.sdk.Sdk;
import com.android.resources.ResourceFolderType;
import com.android.sdklib.BuildToolInfo;
import com.android.sdklib.IAndroidTarget;
@@ -50,6 +49,7 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
+import java.util.Map;
import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -173,8 +173,6 @@ public class RenderScriptProcessor extends SourceProcessor {
List<IPath> sourceFolders, List<IFile> notCompiledOut, List<File> libraryProjectsOut,
IProgressMonitor monitor) throws CoreException {
- String sdkOsPath = Sdk.getCurrent().getSdkLocation();
-
IFolder genFolder = getGenFolder();
IFolder rawFolder = project.getFolder(
@@ -182,19 +180,20 @@ public class RenderScriptProcessor extends SourceProcessor {
int depIndex;
+ BuildToolInfo buildToolInfo = getBuildToolInfo();
+
// create the command line
String[] command = new String[15];
int index = 0;
- command[index++] = quote(sdkOsPath + SdkConstants.OS_SDK_PLATFORM_TOOLS_FOLDER
- + SdkConstants.FN_RENDERSCRIPT);
+ command[index++] = buildToolInfo.getPath(BuildToolInfo.PathId.LLVM_RS_CC);
command[index++] = "-I"; //$NON-NLS-1$
- command[index++] = quote(getBuildToolInfo().getPath(BuildToolInfo.PathId.ANDROID_RS_CLANG));
+ command[index++] = buildToolInfo.getPath(BuildToolInfo.PathId.ANDROID_RS_CLANG);
command[index++] = "-I"; //$NON-NLS-1$
- command[index++] = quote(getBuildToolInfo().getPath(BuildToolInfo.PathId.ANDROID_RS));
+ command[index++] = buildToolInfo.getPath(BuildToolInfo.PathId.ANDROID_RS);
command[index++] = "-p"; //$NON-NLS-1$
- command[index++] = quote(genFolder.getLocation().toOSString());
+ command[index++] = genFolder.getLocation().toOSString();
command[index++] = "-o"; //$NON-NLS-1$
- command[index++] = quote(rawFolder.getLocation().toOSString());
+ command[index++] = rawFolder.getLocation().toOSString();
command[index++] = "-target-api"; //$NON-NLS-1$
command[index++] = Integer.toString(mTargetApi);
@@ -240,7 +239,8 @@ public class RenderScriptProcessor extends SourceProcessor {
command[index] = quote(osSourcePath);
// launch the process
- if (execLlvmRsCc(builder, project, command, sourceFile, verbose) == false) {
+ if (!execLlvmRsCc(builder, project, command, sourceFile, buildToolInfo.getLocation(),
+ verbose)) {
// llvm-rs-cc failed. File should be marked. We add the file to the list
// of file that will need compilation again.
notCompiledOut.add(sourceFile);
@@ -260,7 +260,7 @@ public class RenderScriptProcessor extends SourceProcessor {
}
private boolean execLlvmRsCc(BaseBuilder builder, IProject project, String[] command,
- IFile sourceFile, boolean verbose) {
+ IFile sourceFile, File buildToolRoot, boolean verbose) {
// do the exec
try {
if (verbose) {
@@ -273,7 +273,15 @@ public class RenderScriptProcessor extends SourceProcessor {
AdtPlugin.printToConsole(project, cmd_line);
}
- Process p = Runtime.getRuntime().exec(command);
+ ProcessBuilder processBuilder = new ProcessBuilder(command);
+ Map<String, String> env = processBuilder.environment();
+ if (SdkConstants.CURRENT_PLATFORM == SdkConstants.PLATFORM_DARWIN) {
+ env.put("DYLD_LIBRARY_PATH", buildToolRoot.getAbsolutePath());
+ } else if (SdkConstants.CURRENT_PLATFORM == SdkConstants.PLATFORM_LINUX) {
+ env.put("LD_LIBRARY_PATH", buildToolRoot.getAbsolutePath());
+ }
+
+ Process p = processBuilder.start();
// list to store each line of stderr
ArrayList<String> stdErr = new ArrayList<String>();
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/SourceProcessor.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/SourceProcessor.java
index a82d54d..7dd92aa 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/SourceProcessor.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/SourceProcessor.java
@@ -80,6 +80,9 @@ public abstract class SourceProcessor {
*/
public static String quote(String path) {
if (SdkConstants.CURRENT_PLATFORM == SdkConstants.PLATFORM_WINDOWS) {
+ if (path.endsWith(File.separator)) {
+ path = path.substring(0, path.length() -1);
+ }
return "\"" + path + "\"";
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/BaseBuilder.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/BaseBuilder.java
index 1cbf7f2..9882a0c 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/BaseBuilder.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/build/builders/BaseBuilder.java
@@ -43,6 +43,7 @@ import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -338,6 +339,8 @@ public abstract class BaseBuilder extends IncrementalProjectBuilder {
mBuildToolInfo = sdk.getLatestBuildTool();
if (mBuildToolInfo == null) {
+ AdtPlugin.printBuildToConsole(BuildVerbosity.VERBOSE, iProject,
+ "No \"Build Tools\" package available; use SDK Manager to install one.");
throw new AbortBuildException();
} else {
AdtPlugin.printBuildToConsole(BuildVerbosity.VERBOSE, iProject,
@@ -473,6 +476,7 @@ public abstract class BaseBuilder extends IncrementalProjectBuilder {
protected void launchJob(Job newJob) {
newJob.setPriority(Job.BUILD);
+ newJob.setRule(ResourcesPlugin.getWorkspace().getRoot());
newJob.schedule();
}
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/draw9patch/Draw9PatchEditor.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/draw9patch/Draw9PatchEditor.java
new file mode 100644
index 0000000..48ef7c3
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/draw9patch/Draw9PatchEditor.java
@@ -0,0 +1,233 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.editors.draw9patch;
+
+import static com.android.SdkConstants.DOT_9PNG;
+import com.android.ide.eclipse.adt.AdtPlugin;
+import com.android.ide.eclipse.adt.internal.editors.draw9patch.graphics.NinePatchedImage;
+import com.android.ide.eclipse.adt.internal.editors.draw9patch.ui.ImageViewer;
+import com.android.ide.eclipse.adt.internal.editors.draw9patch.ui.MainFrame;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.ImageLoader;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.dialogs.SaveAsDialog;
+import org.eclipse.ui.part.EditorPart;
+import org.eclipse.ui.part.FileEditorInput;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
+/**
+ * Draw9Patch editor part.
+ */
+public class Draw9PatchEditor extends EditorPart implements ImageViewer.UpdateListener {
+
+ private IProject mProject = null;
+
+ private FileEditorInput mFileEditorInput = null;
+
+ private String mFileName = null;
+
+ private NinePatchedImage mNinePatchedImage = null;
+
+ private MainFrame mMainFrame = null;
+
+ @Override
+ public void init(IEditorSite site, IEditorInput input) throws PartInitException {
+ setSite(site);
+ setInput(input);
+ setPartName(input.getName());
+
+ // The contract of init() mentions we need to fail if we can't
+ // understand the input.
+ if (input instanceof FileEditorInput) {
+ // We try to open a file that is part of the current workspace
+ mFileEditorInput = (FileEditorInput) input;
+ mFileName = mFileEditorInput.getName();
+ mProject = mFileEditorInput.getFile().getProject();
+ } else {
+ throw new PartInitException("Input is not of type FileEditorInput " + //$NON-NLS-1$
+ "nor FileStoreEditorInput: " + //$NON-NLS-1$
+ input == null ? "null" : input.toString()); //$NON-NLS-1$
+ }
+
+ }
+
+ @Override
+ public boolean isSaveAsAllowed() {
+ return true;
+ }
+
+ @Override
+ public void doSaveAs() {
+ IPath relativePath = null;
+ if ((relativePath = showSaveAsDialog()) != null) {
+ mFileEditorInput = new FileEditorInput(ResourcesPlugin.getWorkspace().getRoot()
+ .getFile(relativePath));
+ mFileName = mFileEditorInput.getName();
+ setInput(mFileEditorInput);
+
+ doSave(new NullProgressMonitor());
+ }
+ }
+
+ @Override
+ public void doSave(final IProgressMonitor monitor) {
+ boolean hasNinePatchExtension = mFileName.endsWith(DOT_9PNG);
+ boolean doConvert = false;
+
+ if (!hasNinePatchExtension) {
+ String patchedName = NinePatchedImage.getNinePatchedFileName(mFileName);
+ doConvert = MessageDialog
+ .openQuestion(AdtPlugin.getDisplay().getActiveShell(),
+ "Warning",
+ String.format(
+ "The file \"%s\" doesn't seem to be a 9-patch file. \n"
+ + "Do you want to convert and save as \"%s\" ?",
+ mFileName, patchedName));
+
+ if (doConvert) {
+ IFile destFile = mProject.getFile(NinePatchedImage.getNinePatchedFileName(
+ mFileEditorInput.getFile().getProjectRelativePath().toOSString()));
+ if (!destFile.exists()) {
+ mFileEditorInput = new FileEditorInput(destFile);
+ mFileName = mFileEditorInput.getName();
+ } else {
+ IPath relativePath = null;
+ if ((relativePath = showSaveAsDialog()) != null) {
+ mFileEditorInput = new FileEditorInput(ResourcesPlugin.getWorkspace()
+ .getRoot().getFile(relativePath));
+ mFileName = mFileEditorInput.getName();
+ } else {
+ doConvert = false;
+ }
+ }
+ }
+ }
+
+ if (hasNinePatchExtension || doConvert) {
+ ImageLoader loader = new ImageLoader();
+ loader.data = new ImageData[] {
+ mNinePatchedImage.getRawImageData()
+ };
+
+ IFile file = mFileEditorInput.getFile();
+
+ ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
+ loader.save(outputStream, SWT.IMAGE_PNG);
+ byte[] byteArray = outputStream.toByteArray();
+
+ try {
+ if (file.exists()) {
+ file.setContents(new ByteArrayInputStream(byteArray), true, false, monitor);
+ } else {
+ file.create(new ByteArrayInputStream(byteArray), true, monitor);
+ }
+
+ mNinePatchedImage.clearDirtyFlag();
+
+ AdtPlugin.getDisplay().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ setPartName(mFileName);
+ firePropertyChange(PROP_DIRTY);
+ }
+ });
+ } catch (CoreException e) {
+ AdtPlugin.log(e, null);
+ }
+ }
+ }
+
+ @Override
+ public void createPartControl(Composite parent) {
+ mMainFrame = new MainFrame(parent, SWT.NULL);
+
+ ImageViewer imageViewer = mMainFrame.getImageEditorPanel().getImageViewer();
+ imageViewer.addUpdateListener(this);
+
+ mNinePatchedImage = imageViewer.loadFile(mFileEditorInput.getPath().toOSString());
+ if (mNinePatchedImage.hasNinePatchExtension()) {
+ if (!mNinePatchedImage.ensure9Patch() && showConvertMessageBox(mFileName)) {
+ // Reload image
+ mNinePatchedImage = imageViewer.loadFile(mFileEditorInput.getPath().toOSString());
+ mNinePatchedImage.convertToNinePatch();
+ }
+ } else {
+ mNinePatchedImage.convertToNinePatch();
+ }
+
+ imageViewer.startDisplay();
+
+ parent.layout();
+ }
+
+ @Override
+ public void setFocus() {
+ mMainFrame.forceFocus();
+ }
+
+ @Override
+ public boolean isDirty() {
+ return mNinePatchedImage.isDirty();
+ }
+
+ @Override
+ public void update(NinePatchedImage image) {
+ if (image.isDirty()) {
+ firePropertyChange(PROP_DIRTY);
+ }
+ }
+
+ private IPath showSaveAsDialog() {
+ SaveAsDialog dialog = new SaveAsDialog(AdtPlugin.getDisplay().getActiveShell());
+
+ IFile dest = mProject.getFile(NinePatchedImage.getNinePatchedFileName(
+ mFileEditorInput.getFile().getProjectRelativePath().toOSString()));
+ dialog.setOriginalFile(dest);
+
+ dialog.create();
+
+ if (dialog.open() == Window.CANCEL) {
+ return null;
+ }
+
+ return dialog.getResult();
+ }
+
+ private static boolean showConvertMessageBox(String fileName) {
+ return MessageDialog.openQuestion(
+ AdtPlugin.getDisplay().getActiveShell(),
+ "Warning",
+ String.format("The file \"%s\" doesn't seem to be a 9-patch file. \n"
+ + "Do you want to convert?", fileName));
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/draw9patch/graphics/GraphicsUtilities.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/draw9patch/graphics/GraphicsUtilities.java
new file mode 100644
index 0000000..74c2f04
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/draw9patch/graphics/GraphicsUtilities.java
@@ -0,0 +1,169 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.editors.draw9patch.graphics;
+
+import org.eclipse.swt.graphics.ImageData;
+
+/**
+ * The utility class for SWT Image and ImageData manipulation.
+ */
+public class GraphicsUtilities {
+
+ /**
+ * Convert normal image to 9-patched.
+ * @return Returns 9-patched ImageData object. If image is null, returns null.
+ */
+ public static ImageData convertToNinePatch(ImageData image) {
+ if (image == null) {
+ return null;
+ }
+ ImageData result = new ImageData(image.width + 2, image.height + 2, image.depth,
+ image.palette);
+
+ final int[] colors = new int[image.width];
+ final byte[] alpha = new byte[image.width];
+
+ for (int y = 0; y < image.height; y++) {
+
+ // Copy pixels
+ image.getPixels(0, y, image.width, colors, 0);
+ result.setPixels(1, y + 1, image.width, colors, 0);
+
+ // Copy alpha
+ image.getAlphas(0, y, image.width, alpha, 0);
+ result.setAlphas(1, y + 1, image.width, alpha, 0);
+ }
+
+ return result;
+ }
+
+ /**
+ * Wipe all color and alpha pixels.
+ */
+ public static void clearImageData(ImageData imageData) {
+ if (imageData == null) {
+ throw new IllegalArgumentException("image data must not be null");
+ }
+ int width = imageData.width;
+ int height = imageData.height;
+ for (int y = 0; y < height; y++) {
+ for (int x = 0; x < width; x++) {
+ imageData.setPixel(x, y, 0x00000000);
+ imageData.setAlpha(x, y, 0x00);
+ }
+ }
+ }
+
+ /**
+ * Duplicate the image data.
+ * @return If image is null, return null.
+ */
+ public static ImageData copy(ImageData image) {
+ if (image == null) {
+ return null;
+ }
+ ImageData result = new ImageData(image.width, image.height, image.depth,
+ image.palette);
+
+ final int[] colors = new int[image.width];
+ final byte[] alpha = new byte[image.width];
+
+ for (int y = 0; y < image.height; y++) {
+
+ // Copy pixels
+ image.getPixels(0, y, image.width, colors, 0);
+ result.setPixels(0, y, image.width, colors, 0);
+
+ // Copy alpha
+ image.getAlphas(0, y, image.width, alpha, 0);
+ result.setAlphas(0, y, image.width, alpha, 0);
+ }
+
+ return result;
+ }
+
+ /**
+ * Get column pixels.
+ * @return length of obtained pixels.
+ */
+ public static int getVerticalPixels(ImageData data, int x, int y, int height, int[] out) {
+ if (data == null) {
+ throw new IllegalArgumentException("data must not be null");
+ }
+ if (out == null) {
+ throw new IllegalArgumentException("out array must not be null");
+ }
+ if (height > out.length) {
+ throw new IllegalArgumentException("out array length must be > height");
+ }
+ if (data.height < (y + height)) {
+ throw new IllegalArgumentException("image height must be > (y + height)");
+ }
+ if (x < 0 || y < 0) {
+ throw new IllegalArgumentException("argument x, y must be >= 0");
+ }
+ if (x >= data.width) {
+ throw new IllegalArgumentException("argument x must be < data.width");
+ }
+ if (y >= data.height) {
+ throw new IllegalArgumentException("argument y must be < data.height");
+ }
+ if (height <= 0) {
+ throw new IllegalArgumentException("argument height must be > 0");
+ }
+
+ int idx = 0;
+ while (idx < height) {
+ data.getPixels(x, (y + idx), 1, out, idx);
+ idx++;
+ }
+ return idx;
+ }
+
+ /**
+ * Get row pixels.
+ */
+ public static void getHorizontalPixels(ImageData data, int x, int y, int width, int[] out) {
+ if (data == null) {
+ throw new IllegalArgumentException("data must not be null");
+ }
+ if (out == null) {
+ throw new IllegalArgumentException("out array must not be null");
+ }
+ if (width > out.length) {
+ throw new IllegalArgumentException("out array length must be > width");
+ }
+ if (data.width < (x + width)) {
+ throw new IllegalArgumentException("image height must be > (x + width)");
+ }
+ if (x < 0 || y < 0) {
+ throw new IllegalArgumentException("argument x, y must be >= 0");
+ }
+ if (x >= data.width) {
+ throw new IllegalArgumentException("argument x must be < data.width");
+ }
+ if (y >= data.height) {
+ throw new IllegalArgumentException("argument y must be < data.height");
+ }
+ if (width <= 0) {
+ throw new IllegalArgumentException("argument width must be > 0");
+ }
+
+ data.getPixels(x, y, width, out, 0);
+ }
+
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/draw9patch/graphics/NinePatchedImage.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/draw9patch/graphics/NinePatchedImage.java
new file mode 100644
index 0000000..f1022c3
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/draw9patch/graphics/NinePatchedImage.java
@@ -0,0 +1,882 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.editors.draw9patch.graphics;
+
+import static com.android.SdkConstants.DOT_9PNG;
+import static com.android.SdkConstants.DOT_PNG;
+import com.android.ide.eclipse.adt.AdtPlugin;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.Rectangle;
+
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * The model of 9-patched image.
+ */
+public class NinePatchedImage {
+ private static final boolean DEBUG = false;
+
+ /**
+ * Get 9-patched filename as like image.9.png .
+ */
+ public static String getNinePatchedFileName(String fileName) {
+ if (fileName.endsWith(DOT_9PNG)) {
+ return fileName;
+ }
+ return fileName.substring(0, fileName.lastIndexOf(DOT_PNG)) + DOT_9PNG;
+ }
+
+ // For stretch regions and padding
+ public static final int BLACK_TICK = 0xFF000000;
+ // For Layout Bounds
+ public static final int RED_TICK = 0xFFFF0000;
+ // Blank
+ public static final int TRANSPARENT_TICK = 0x00000000;
+
+ private ImageData mBaseImageData;
+
+ private Image mBaseImage = null;
+
+ private boolean mHasNinePatchExtension = false;
+
+ private boolean mDirtyFlag = false;
+
+ private int[] mHorizontalPatchPixels = null;
+ private int[] mVerticalPatchPixels = null;
+
+ private int[] mHorizontalContentPixels = null;
+ private int[] mVerticalContentPixels = null;
+
+ // for Prevent unexpected stretch in StretchsView
+ private boolean mRedTickOnlyInHorizontalFlag = false;
+ private boolean mRedTickOnlyInVerticalFlag = false;
+
+ private final List<Tick> mHorizontalPatches = new ArrayList<Tick>();
+ private final List<Tick> mVerticalPatches = new ArrayList<Tick>();
+
+ private final List<Tick> mHorizontalContents = new ArrayList<Tick>();
+ private final List<Tick> mVerticalContents = new ArrayList<Tick>();
+
+
+ private static final int CHUNK_BIN_SIZE = 100;
+ private final List<Chunk> mChunkBin = new ArrayList<Chunk>(CHUNK_BIN_SIZE);
+
+ private int mHorizontalFixedPatchSum = 0;
+ private int mVerticalFixedPatchSum = 0;
+
+ private static final int PROJECTION_BIN_SIZE = 100;
+ private final List<Projection> mProjectionBin = new ArrayList<Projection>(PROJECTION_BIN_SIZE);
+
+ private Chunk[][] mPatchChunks = null;
+
+ public ImageData getImageData() {
+ return mBaseImageData;
+ }
+
+ public int getWidth() {
+ return mBaseImageData.width;
+ }
+
+ public int getHeight() {
+ return mBaseImageData.height;
+ }
+
+ public Image getImage() {
+ if (mBaseImage == null) {
+ mBaseImage = new Image(AdtPlugin.getDisplay(), mBaseImageData);
+ }
+ return mBaseImage;
+ }
+
+ public boolean hasNinePatchExtension() {
+ return mHasNinePatchExtension;
+ }
+
+ /**
+ * Get the image has/hasn't been edited flag.
+ * @return If has been edited, return true
+ */
+ public boolean isDirty() {
+ return mDirtyFlag;
+ }
+
+ /**
+ * Clear dirty(edited) flag.
+ */
+ public void clearDirtyFlag() {
+ mDirtyFlag = false;
+ }
+
+ public NinePatchedImage(String fileName) {
+ boolean hasNinePatchExtension = fileName.endsWith(DOT_9PNG);
+ ImageData data = new ImageData(fileName);
+
+ initNinePatchedImage(data, hasNinePatchExtension);
+ }
+
+ public NinePatchedImage(InputStream inputStream, String fileName) {
+ boolean hasNinePatchExtension = fileName.endsWith(DOT_9PNG);
+ ImageData data = new ImageData(inputStream);
+
+ initNinePatchedImage(data, hasNinePatchExtension);
+ }
+
+ private Chunk getChunk() {
+ if (mChunkBin.size() > 0) {
+ Chunk chunk = mChunkBin.remove(0);
+ chunk.init();
+ return chunk;
+ }
+ return new Chunk();
+ }
+
+ private static final void recycleChunks(Chunk[][] patchChunks, List<Chunk> bin) {
+ int yLen = patchChunks.length;
+ int xLen = patchChunks[0].length;
+
+ for (int y = 0; y < yLen; y++) {
+ for (int x = 0; x < xLen; x++) {
+ if (bin.size() < CHUNK_BIN_SIZE) {
+ bin.add(patchChunks[y][x]);
+ }
+ patchChunks[y][x] = null;
+ }
+ }
+ }
+
+ private Projection getProjection() {
+ if (mProjectionBin.size() > 0) {
+ Projection projection = mProjectionBin.remove(0);
+ return projection;
+ }
+ return new Projection();
+ }
+
+ private static final void recycleProjections(Projection[][] projections, List<Projection> bin) {
+ int yLen = projections.length;
+ int xLen = 0;
+ if (yLen > 0) {
+ xLen = projections[0].length;
+ }
+
+ for (int y = 0; y < yLen; y++) {
+ for (int x = 0; x < xLen; x++) {
+ if (bin.size() < CHUNK_BIN_SIZE) {
+ bin.add(projections[y][x]);
+ }
+ projections[y][x] = null;
+ }
+ }
+ }
+
+ private static final int[] initArray(int[] array) {
+ int len = array.length;
+ for (int i = 0; i < len; i++) {
+ array[i] = TRANSPARENT_TICK;
+ }
+ return array;
+ }
+
+ /**
+ * Get one pixel with alpha from the image.
+ * @return packed integer value as ARGB8888
+ */
+ private static final int getPixel(ImageData image, int x, int y) {
+ return (image.getAlpha(x, y) << 24) + image.getPixel(x, y);
+ }
+
+ private static final boolean isTransparentPixel(ImageData image, int x, int y) {
+ return image.getAlpha(x, y) == 0x0;
+ }
+
+ private static final boolean isValidTickColor(int pixel) {
+ return (pixel == BLACK_TICK || pixel == RED_TICK);
+ }
+
+ private void initNinePatchedImage(ImageData imageData, boolean hasNinePatchExtension) {
+ mBaseImageData = imageData;
+ mHasNinePatchExtension = hasNinePatchExtension;
+ }
+
+ private boolean ensurePixel(int x, int y, int[] pixels, int index) {
+ boolean isValid = true;
+ int pixel = getPixel(mBaseImageData, x, y);
+ if (!isTransparentPixel(mBaseImageData, x, y)) {
+ if (index == 0 || index == pixels.length - 1) {
+ isValid = false;
+ }
+ if (isValidTickColor(pixel)) {
+ pixels[index] = pixel;
+ } else {
+ isValid = false;
+ }
+ // clear pixel
+ mBaseImageData.setAlpha(x, y, 0x0);
+ }
+ return isValid;
+ }
+
+ private boolean ensureHorizontalPixel(int x, int y, int[] pixels) {
+ return ensurePixel(x, y, pixels, x);
+ }
+
+ private boolean ensureVerticalPixel(int x, int y, int[] pixels) {
+ return ensurePixel(x, y, pixels, y);
+ }
+
+ /**
+ * Ensure that image data is 9-patch.
+ */
+ public boolean ensure9Patch() {
+ boolean isValid = true;
+
+ int width = mBaseImageData.width;
+ int height = mBaseImageData.height;
+
+ createPatchArray();
+ createContentArray();
+
+ // horizontal
+ for (int x = 0; x < width; x++) {
+ // top row
+ if (!ensureHorizontalPixel(x, 0, mHorizontalPatchPixels)) {
+ isValid = false;
+ }
+ // bottom row
+ if (!ensureHorizontalPixel(x, height - 1, mHorizontalContentPixels)) {
+ isValid = false;
+ }
+ }
+ // vertical
+ for (int y = 0; y < height; y++) {
+ // left column
+ if (!ensureVerticalPixel(0, y, mVerticalPatchPixels)) {
+ isValid = false;
+ }
+ // right column
+ if (!ensureVerticalPixel(width -1, y, mVerticalContentPixels)) {
+ isValid = false;
+ }
+ }
+ findPatches();
+ findContentsArea();
+
+ return isValid;
+ }
+
+ private void createPatchArray() {
+ mHorizontalPatchPixels = initArray(new int[mBaseImageData.width]);
+ mVerticalPatchPixels = initArray(new int[mBaseImageData.height]);
+ }
+
+ private void createContentArray() {
+ mHorizontalContentPixels = initArray(new int[mBaseImageData.width]);
+ mVerticalContentPixels = initArray(new int[mBaseImageData.height]);
+ }
+
+ /**
+ * Convert to 9-patch image.
+ * <p>
+ * This method doesn't consider that target image is already 9-patched or
+ * not.
+ * </p>
+ */
+ public void convertToNinePatch() {
+ mBaseImageData = GraphicsUtilities.convertToNinePatch(mBaseImageData);
+ mHasNinePatchExtension = true;
+
+ createPatchArray();
+ createContentArray();
+
+ findPatches();
+ findContentsArea();
+ }
+
+ public boolean isValid(int x, int y) {
+ return (x == 0) ^ (y == 0)
+ ^ (x == mBaseImageData.width - 1) ^ (y == mBaseImageData.height - 1);
+ }
+
+ /**
+ * Set patch or content.
+ */
+ public void setPatch(int x, int y, int color) {
+ if (isValid(x, y)) {
+ if (x == 0) {
+ mVerticalPatchPixels[y] = color;
+ } else if (y == 0) {
+ mHorizontalPatchPixels[x] = color;
+ } else if (x == mBaseImageData.width - 1) {
+ mVerticalContentPixels[y] = color;
+ } else if (y == mBaseImageData.height - 1) {
+ mHorizontalContentPixels[x] = color;
+ }
+
+ // Mark as dirty
+ mDirtyFlag = true;
+ }
+ }
+
+ /**
+ * Erase the pixel.
+ */
+ public void erase(int x, int y) {
+ if (isValid(x, y)) {
+ int color = TRANSPARENT_TICK;
+ if (x == 0) {
+ mVerticalPatchPixels[y] = color;
+ } else if (y == 0) {
+ mHorizontalPatchPixels[x] = color;
+ } else if (x == mBaseImageData.width - 1) {
+ mVerticalContentPixels[y] = color;
+ } else if (y == mBaseImageData.height - 1) {
+ mHorizontalContentPixels[x] = color;
+ }
+
+ // Mark as dirty
+ mDirtyFlag = true;
+ }
+ }
+
+ public List<Tick> getHorizontalPatches() {
+ return mHorizontalPatches;
+ }
+
+ public List<Tick> getVerticalPatches() {
+ return mVerticalPatches;
+ }
+
+ /**
+ * Find patches from pixels array.
+ * @param pixels Target of seeking ticks.
+ * @param out Add the found ticks.
+ * @return If BlackTick is not found but only RedTick is found, returns true
+ */
+ private static boolean findPatches(int[] pixels, List<Tick> out) {
+ boolean redTickOnly = true;
+ Tick patch = null;
+ int len = 0;
+
+ // find patches
+ out.clear();
+ len = pixels.length - 1;
+ for (int i = 1; i < len; i++) {
+ int pixel = pixels[i];
+
+ if (redTickOnly && pixel != TRANSPARENT_TICK && pixel != RED_TICK) {
+ redTickOnly = false;
+ }
+
+ if (patch != null) {
+ if (patch.color != pixel) {
+ patch.end = i;
+ out.add(patch);
+ patch = null;
+ }
+ }
+ if (patch == null) {
+ patch = new Tick(pixel);
+ patch.start = i;
+ }
+ }
+
+ if (patch != null) {
+ patch.end = len;
+ out.add(patch);
+ }
+ return redTickOnly;
+ }
+
+ public void findPatches() {
+
+ // find horizontal patches
+ mRedTickOnlyInHorizontalFlag = findPatches(mHorizontalPatchPixels, mHorizontalPatches);
+
+ // find vertical patches
+ mRedTickOnlyInVerticalFlag = findPatches(mVerticalPatchPixels, mVerticalPatches);
+ }
+
+ public Rectangle getContentArea() {
+ Tick horizontal = getContentArea(mHorizontalContents);
+ Tick vertical = getContentArea(mVerticalContents);
+
+ Rectangle rect = new Rectangle(0, 0, 0, 0);
+ rect.x = 1;
+ rect.width = mBaseImageData.width - 1;
+ rect.y = 1;
+ rect.height = mBaseImageData.height - 1;
+
+ if (horizontal != null) {
+ rect.x = horizontal.start;
+ rect.width = horizontal.getLength();
+ }
+ if (vertical != null) {
+ rect.y = vertical.start;
+ rect.height = vertical.getLength();
+ }
+
+ return rect;
+ }
+
+ private Tick getContentArea(List<Tick> list) {
+ int size = list.size();
+ if (size == 0) {
+ return null;
+ }
+ if (size == 1) {
+ return list.get(0);
+ }
+
+ Tick start = null;
+ Tick end = null;
+
+ for (int i = 0; i < size; i++) {
+ Tick t = list.get(i);
+ if (t.color == BLACK_TICK) {
+ if (start == null) {
+ start = t;
+ end = t;
+ } else {
+ end = t;
+ }
+ }
+ }
+
+ // red tick only
+ if (start == null) {
+ return null;
+ }
+
+ Tick result = new Tick(start.color);
+ result.start = start.start;
+ result.end = end.end;
+
+ return result;
+ }
+
+ /**
+ * This is for unit test use only.
+ * @see com.android.ide.eclipse.adt.internal.editors.draw9patch.graphics.NinePatchedImageTest
+ */
+ public List<Tick> getHorizontalContents() {
+ return mHorizontalContents;
+ }
+
+ /**
+ * This is for unit test use only.
+ * @see com.android.ide.eclipse.adt.internal.editors.draw9patch.graphics.NinePatchedImageTest
+ */
+ public List<Tick> getVerticalContents() {
+ return mVerticalContents;
+ }
+
+ private static void findContentArea(int[] pixels, List<Tick> out) {
+ Tick contents = null;
+ int len = 0;
+
+ // find horizontal contents area
+ out.clear();
+ len = pixels.length - 1;
+ for (int x = 1; x < len; x++) {
+ if (contents != null) {
+ if (contents.color != pixels[x]) {
+ contents.end = x;
+ out.add(contents);
+ contents = null;
+ }
+ }
+ if (contents == null) {
+ contents = new Tick(pixels[x]);
+ contents.start = x;
+ }
+ }
+
+ if (contents != null) {
+ contents.end = len;
+ out.add(contents);
+ }
+ }
+
+ public void findContentsArea() {
+
+ // find horizontal contents area
+ findContentArea(mHorizontalContentPixels, mHorizontalContents);
+
+ // find vertical contents area
+ findContentArea(mVerticalContentPixels, mVerticalContents);
+ }
+
+ /**
+ * Get raw image data.
+ * <p>
+ * The raw image data is applicable for save.
+ * </p>
+ */
+ public ImageData getRawImageData() {
+ ImageData image = GraphicsUtilities.copy(mBaseImageData);
+
+ final int width = image.width;
+ final int height = image.height;
+ int len = 0;
+
+ len = mHorizontalPatchPixels.length;
+ for (int x = 0; x < len; x++) {
+ int pixel = mHorizontalPatchPixels[x];
+ if (pixel != TRANSPARENT_TICK) {
+ image.setAlpha(x, 0, 0xFF);
+ image.setPixel(x, 0, pixel);
+ }
+ }
+
+ len = mVerticalPatchPixels.length;
+ for (int y = 0; y < len; y++) {
+ int pixel = mVerticalPatchPixels[y];
+ if (pixel != TRANSPARENT_TICK) {
+ image.setAlpha(0, y, 0xFF);
+ image.setPixel(0, y, pixel);
+ }
+ }
+
+ len = mHorizontalContentPixels.length;
+ for (int x = 0; x < len; x++) {
+ int pixel = mHorizontalContentPixels[x];
+ if (pixel != TRANSPARENT_TICK) {
+ image.setAlpha(x, height - 1, 0xFF);
+ image.setPixel(x, height - 1, pixel);
+ }
+ }
+
+ len = mVerticalContentPixels.length;
+ for (int y = 0; y < len; y++) {
+ int pixel = mVerticalContentPixels[y];
+ if (pixel != TRANSPARENT_TICK) {
+ image.setAlpha(width - 1, y, 0xFF);
+ image.setPixel(width - 1, y, pixel);
+ }
+ }
+
+ return image;
+ }
+
+ public Chunk[][] getChunks(Chunk[][] chunks) {
+ int lenY = mVerticalPatches.size();
+ int lenX = mHorizontalPatches.size();
+
+ if (lenY == 0 || lenX == 0) {
+ return null;
+ }
+
+ if (chunks == null) {
+ chunks = new Chunk[lenY][lenX];
+ } else {
+ int y = chunks.length;
+ int x = chunks[0].length;
+ if (lenY != y || lenX != x) {
+ recycleChunks(chunks, mChunkBin);
+ chunks = new Chunk[lenY][lenX];
+ }
+ }
+
+ // for calculate weights
+ float horizontalPatchSum = 0;
+ float verticalPatchSum = 0;
+
+ mVerticalFixedPatchSum = 0;
+ mHorizontalFixedPatchSum = 0;
+
+ for (int y = 0; y < lenY; y++) {
+ Tick yTick = mVerticalPatches.get(y);
+
+ for (int x = 0; x < lenX; x++) {
+ Tick xTick = mHorizontalPatches.get(x);
+ Chunk t = getChunk();
+ chunks[y][x] = t;
+
+ t.rect.x = xTick.start;
+ t.rect.width = xTick.getLength();
+ t.rect.y = yTick.start;
+ t.rect.height = yTick.getLength();
+
+ if (mRedTickOnlyInHorizontalFlag
+ || xTick.color == BLACK_TICK || lenX == 1) {
+ t.type += Chunk.TYPE_HORIZONTAL;
+ if (y == 0) {
+ horizontalPatchSum += t.rect.width;
+ }
+ }
+ if (mRedTickOnlyInVerticalFlag
+ || yTick.color == BLACK_TICK || lenY == 1) {
+ t.type += Chunk.TYPE_VERTICAL;
+ if (x == 0) {
+ verticalPatchSum += t.rect.height;
+ }
+ }
+
+ if ((t.type & Chunk.TYPE_HORIZONTAL) == 0 && lenX > 1 && y == 0) {
+ mHorizontalFixedPatchSum += t.rect.width;
+ }
+ if ((t.type & Chunk.TYPE_VERTICAL) == 0 && lenY > 1 && x == 0) {
+ mVerticalFixedPatchSum += t.rect.height;
+ }
+
+ }
+ }
+
+ // calc weights
+ for (int y = 0; y < lenY; y++) {
+ for (int x = 0; x < lenX; x++) {
+ Chunk chunk = chunks[y][x];
+ if ((chunk.type & Chunk.TYPE_HORIZONTAL) != 0) {
+ chunk.horizontalWeight = chunk.rect.width / horizontalPatchSum;
+ }
+ if ((chunk.type & Chunk.TYPE_VERTICAL) != 0) {
+ chunk.verticalWeight = chunk.rect.height / verticalPatchSum;
+
+ }
+ }
+ }
+
+ return chunks;
+ }
+
+ public Chunk[][] getCorruptedChunks(Chunk[][] chunks) {
+ chunks = getChunks(chunks);
+
+ if (chunks != null) {
+ int yLen = chunks.length;
+ int xLen = chunks[0].length;
+
+ for (int yPos = 0; yPos < yLen; yPos++) {
+ for (int xPos = 0; xPos < xLen; xPos++) {
+ Chunk c = chunks[yPos][xPos];
+ Rectangle r = c.rect;
+ if ((c.type & Chunk.TYPE_HORIZONTAL) != 0
+ && isHorizontalCorrupted(mBaseImageData, r)) {
+ c.type |= Chunk.TYPE_CORRUPT;
+ }
+ if ((c.type & Chunk.TYPE_VERTICAL) != 0
+ && isVerticalCorrupted(mBaseImageData, r)) {
+ c.type |= Chunk.TYPE_CORRUPT;
+ }
+ }
+ }
+ }
+ return chunks;
+ }
+
+ private static boolean isVerticalCorrupted(ImageData data, Rectangle r) {
+ int[] column = new int[r.width];
+ int[] sample = new int[r.width];
+
+ GraphicsUtilities.getHorizontalPixels(data, r.x, r.y, r.width, column);
+
+ int lenY = r.y + r.height;
+ for (int y = r.y; y < lenY; y++) {
+ GraphicsUtilities.getHorizontalPixels(data, r.x, y, r.width, sample);
+ if (!Arrays.equals(column, sample)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ private static boolean isHorizontalCorrupted(ImageData data, Rectangle r) {
+ int[] column = new int[r.height];
+ int[] sample = new int[r.height];
+ GraphicsUtilities.getVerticalPixels(data, r.x, r.y, r.height, column);
+
+ int lenX = r.x + r.width;
+ for (int x = r.x; x < lenX; x++) {
+ GraphicsUtilities.getVerticalPixels(data, x, r.y, r.height, sample);
+ if (!Arrays.equals(column, sample)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public Projection[][] getProjections(int width, int height, Projection[][] projections) {
+ mPatchChunks = getChunks(mPatchChunks);
+ if (mPatchChunks == null) {
+ return null;
+ }
+
+ if (DEBUG) {
+ System.out.println(String.format("width:%d, height:%d", width, height));
+ }
+
+ int lenY = mPatchChunks.length;
+ int lenX = mPatchChunks[0].length;
+
+ if (projections == null) {
+ projections = new Projection[lenY][lenX];
+ } else {
+ int y = projections.length;
+ int x = projections[0].length;
+ if (lenY != y || lenX != x) {
+ recycleProjections(projections, mProjectionBin);
+ projections = new Projection[lenY][lenX];
+ }
+ }
+
+ float xZoom = ((float) width / mBaseImageData.width);
+ float yZoom = ((float) height / mBaseImageData.height);
+
+ if (DEBUG) {
+ System.out.println(String.format("xZoom:%f, yZoom:%f", xZoom, yZoom));
+ }
+
+ int destX = 0;
+ int destY = 0;
+ int streatchableWidth = width - mHorizontalFixedPatchSum;
+ streatchableWidth = streatchableWidth > 0 ? streatchableWidth : 1;
+
+ int streatchableHeight = height - mVerticalFixedPatchSum;
+ streatchableHeight = streatchableHeight > 0 ? streatchableHeight : 1;
+
+ if (DEBUG) {
+ System.out.println(String.format("streatchable %d %d", streatchableWidth,
+ streatchableHeight));
+ }
+
+ for (int yPos = 0; yPos < lenY; yPos++) {
+ destX = 0;
+ Projection p = null;
+ for (int xPos = 0; xPos < lenX; xPos++) {
+ Chunk chunk = mPatchChunks[yPos][xPos];
+
+ if (DEBUG) {
+ System.out.println(String.format("Tile[%d, %d] = %s",
+ yPos, xPos, chunk.toString()));
+ }
+
+ p = getProjection();
+ projections[yPos][xPos] = p;
+
+ p.chunk = chunk;
+ p.src = chunk.rect;
+ p.dest.x = destX;
+ p.dest.y = destY;
+
+ // fixed size
+ p.dest.width = chunk.rect.width;
+ p.dest.height = chunk.rect.height;
+
+ // horizontal stretch
+ if ((chunk.type & Chunk.TYPE_HORIZONTAL) != 0) {
+ p.dest.width = Math.round(streatchableWidth * chunk.horizontalWeight);
+ }
+ // vertical stretch
+ if ((chunk.type & Chunk.TYPE_VERTICAL) != 0) {
+ p.dest.height = Math.round(streatchableHeight * chunk.verticalWeight);
+ }
+
+ destX += p.dest.width;
+ }
+ destY += p.dest.height;
+ }
+ return projections;
+ }
+
+ /**
+ * Projection class for make relation between chunked image and resized image.
+ */
+ public static class Projection {
+ public Chunk chunk = null;
+ public Rectangle src = null;
+ public final Rectangle dest = new Rectangle(0, 0, 0, 0);
+
+ @Override
+ public String toString() {
+ return String.format("src[%d, %d, %d, %d] => dest[%d, %d, %d, %d]",
+ src.x, src.y, src.width, src.height,
+ dest.x, dest.y, dest.width, dest.height);
+ }
+ }
+
+ public static class Chunk {
+ public static final int TYPE_FIXED = 0x0;
+ public static final int TYPE_HORIZONTAL = 0x1;
+ public static final int TYPE_VERTICAL = 0x2;
+ public static final int TYPE_CORRUPT = 0x80000000;
+
+ public int type = TYPE_FIXED;
+
+ public Rectangle rect = new Rectangle(0, 0, 0, 0);
+
+ public float horizontalWeight = 0.0f;
+ public float verticalWeight = 0.0f;
+
+ void init() {
+ type = Chunk.TYPE_FIXED;
+ horizontalWeight = 0.0f;
+ verticalWeight = 0.0f;
+ rect.x = 0;
+ rect.y = 0;
+ rect.width = 0;
+ rect.height = 0;
+ }
+
+ private String typeToString() {
+ switch (type) {
+ case TYPE_FIXED:
+ return "FIXED";
+ case TYPE_HORIZONTAL:
+ return "HORIZONTAL";
+ case TYPE_VERTICAL:
+ return "VERTICAL";
+ case TYPE_HORIZONTAL + TYPE_VERTICAL:
+ return "BOTH";
+ default:
+ return "UNKNOWN";
+ }
+ }
+
+ @Override
+ public String toString() {
+ return String.format("%s %f/%f %s", typeToString(), horizontalWeight, verticalWeight,
+ rect.toString());
+ }
+ }
+
+ public static class Tick {
+ public int start;
+ public int end;
+ public int color;
+
+ /**
+ * Get the tick length.
+ */
+ public int getLength() {
+ return end - start;
+ }
+
+ public Tick(int tickColor) {
+ color = tickColor;
+ }
+
+ @Override
+ public String toString() {
+ return String.format("%d tick: %d to %d", color, start, end);
+ }
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/draw9patch/ui/ImageEditorPanel.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/draw9patch/ui/ImageEditorPanel.java
new file mode 100644
index 0000000..7c45230
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/draw9patch/ui/ImageEditorPanel.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.editors.draw9patch.ui;
+
+import com.android.ide.eclipse.adt.internal.editors.draw9patch.graphics.NinePatchedImage;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DropTarget;
+import org.eclipse.swt.dnd.DropTargetListener;
+import org.eclipse.swt.dnd.FileTransfer;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Image editor pane.
+ */
+public class ImageEditorPanel extends Composite implements ImageViewer.UpdateListener,
+ StatusPanel.StatusChangedListener {
+
+ private static final int WEIGHT_VIEWER = 3;
+ private static final int WEIGHT_PREVIEW = 1;
+
+ private final ImageViewer mImageViewer;
+ private final StretchesViewer mStretchesViewer;
+
+ public ImageViewer getImageViewer() {
+ return mImageViewer;
+ }
+
+ public ImageEditorPanel(Composite parent, int style) {
+ super(parent, style);
+
+ setLayout(new FillLayout());
+ SashForm sashForm = new SashForm(this, SWT.HORIZONTAL);
+
+ mImageViewer = new ImageViewer(sashForm, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
+ mImageViewer.addUpdateListener(this);
+
+ mStretchesViewer = new StretchesViewer(sashForm, SWT.BORDER);
+
+ sashForm.setWeights(new int[] {
+ WEIGHT_VIEWER, WEIGHT_PREVIEW
+ });
+ }
+
+ @Override
+ public void zoomChanged(int zoom) {
+ mImageViewer.setZoom(zoom);
+ }
+
+ @Override
+ public void scaleChanged(int scale) {
+ mStretchesViewer.setScale(scale);
+ }
+
+ @Override
+ public void lockVisibilityChanged(boolean visible) {
+ mImageViewer.setShowLock(visible);
+ }
+
+ @Override
+ public void patchesVisibilityChanged(boolean visible) {
+ mImageViewer.setShowPatchesArea(visible);
+ }
+
+ @Override
+ public void badPatchesVisibilityChanged(boolean visible) {
+ mImageViewer.setShowBadPatchesArea(visible);
+ }
+
+ @Override
+ public void contentAreaVisibilityChanged(boolean visible) {
+ mStretchesViewer.setShowContentArea(visible);
+ }
+
+ @Override
+ public void update(NinePatchedImage image) {
+ mStretchesViewer.updatePreview(image);
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/draw9patch/ui/ImageViewer.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/draw9patch/ui/ImageViewer.java
new file mode 100644
index 0000000..2414a39
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/draw9patch/ui/ImageViewer.java
@@ -0,0 +1,774 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.editors.draw9patch.ui;
+
+import com.android.ide.eclipse.adt.AdtPlugin;
+import com.android.ide.eclipse.adt.internal.editors.draw9patch.graphics.NinePatchedImage;
+import com.android.ide.eclipse.adt.internal.editors.draw9patch.graphics.NinePatchedImage.Chunk;
+import com.android.ide.eclipse.adt.internal.editors.draw9patch.graphics.NinePatchedImage.Tick;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.MouseMoveListener;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.ScrollBar;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.concurrent.ArrayBlockingQueue;
+
+/**
+ * View and edit Draw 9-patch image.
+ */
+public class ImageViewer extends Canvas implements PaintListener, KeyListener, MouseListener,
+ MouseMoveListener {
+ private static final boolean DEBUG = false;
+
+ public static final String HELP_MESSAGE_KEY_TIPS = "Press Shift to erase pixels."
+ + " Press Control to draw layout bounds.";
+
+ public static final String HELP_MESSAGE_KEY_TIPS2 = "Release Shift to draw pixels.";
+
+ private static final Color BLACK_COLOR = AdtPlugin.getDisplay().getSystemColor(SWT.COLOR_BLACK);
+ private static final Color RED_COLOR = AdtPlugin.getDisplay().getSystemColor(SWT.COLOR_RED);
+
+ private static final Color BACK_COLOR
+ = new Color(AdtPlugin.getDisplay(), new RGB(0x00, 0xFF, 0x00));
+ private static final Color LOCK_COLOR
+ = new Color(AdtPlugin.getDisplay(), new RGB(0xFF, 0x00, 0x00));
+ private static final Color PATCH_COLOR
+ = new Color(AdtPlugin.getDisplay(), new RGB(0xFF, 0xFF, 0x00));
+ private static final Color PATCH_ONEWAY_COLOR
+ = new Color(AdtPlugin.getDisplay(), new RGB(0x00, 0x00, 0xFF));
+ private static final Color CORRUPTED_COLOR
+ = new Color(AdtPlugin.getDisplay(), new RGB(0xFF, 0x00, 0x00));
+
+ private static final int NONE_ALPHA = 0xFF;
+ private static final int LOCK_ALPHA = 50;
+ private static final int PATCH_ALPHA = 50;
+ private static final int GUIDE_ALPHA = 60;
+
+ private static final int MODE_NONE = 0x00;
+ private static final int MODE_BLACK_TICK = 0x01;
+ private static final int MODE_RED_TICK = 0x02;
+ private static final int MODE_ERASE = 0xFF;
+
+ private int mDrawMode = MODE_NONE;
+
+ private static final int MARGIN = 5;
+ private static final String CHECKER_PNG_PATH = "/icons/checker.png";
+
+ private Image mBackgroundLayer = null;
+
+ private NinePatchedImage mNinePatchedImage = null;
+
+ private Chunk[][] mChunks = null;
+ private Chunk[][] mBadChunks = null;
+
+ private boolean mIsLockShown = true;
+ private boolean mIsPatchesShown = false;
+ private boolean mIsBadPatchesShown = false;
+
+ private ScrollBar mHorizontalBar;
+ private ScrollBar mVerticalBar;
+
+ private int mZoom = 500;
+
+ private int mHorizontalScroll = 0;
+ private int mVerticalScroll = 0;
+
+ private final Rectangle mPadding = new Rectangle(0, 0, 0, 0);
+
+ // one pixel size that considered zoom
+ private int mZoomedPixelSize = 1;
+
+ private Image mBufferImage = null;
+
+ private boolean isCtrlPressed = false;
+ private boolean isShiftPressed = false;
+
+ private final List<UpdateListener> mUpdateListenerList
+ = new ArrayList<UpdateListener>();
+
+ private final Point mCursorPoint = new Point(0, 0);
+
+ private static final int DEFAULT_UPDATE_QUEUE_SIZE = 10;
+
+ private final ArrayBlockingQueue<NinePatchedImage> mUpdateQueue
+ = new ArrayBlockingQueue<NinePatchedImage>(DEFAULT_UPDATE_QUEUE_SIZE);
+
+ private final Runnable mUpdateRunnable = new Runnable() {
+ @Override
+ public void run() {
+ if (isDisposed()) {
+ return;
+ }
+
+ redraw();
+
+ fireUpdateEvent();
+ }
+ };
+
+ private final Thread mUpdateThread = new Thread() {
+ @Override
+ public void run() {
+ while (!isDisposed()) {
+ try {
+ mUpdateQueue.take();
+ mNinePatchedImage.findPatches();
+ mNinePatchedImage.findContentsArea();
+
+ mChunks = mNinePatchedImage.getChunks(mChunks);
+ mBadChunks = mNinePatchedImage.getCorruptedChunks(mBadChunks);
+
+ AdtPlugin.getDisplay().asyncExec(mUpdateRunnable);
+
+ } catch (InterruptedException e) {
+ }
+ }
+ }
+ };
+
+ private StatusChangedListener mStatusChangedListener = null;
+
+ public void addUpdateListener(UpdateListener l) {
+ mUpdateListenerList.add(l);
+ }
+
+ public void removeUpdateListener(UpdateListener l) {
+ mUpdateListenerList.remove(l);
+ }
+
+ private void fireUpdateEvent() {
+ int len = mUpdateListenerList.size();
+ for(int i=0; i < len; i++) {
+ mUpdateListenerList.get(i).update(mNinePatchedImage);
+ }
+ }
+
+ public void setStatusChangedListener(StatusChangedListener l) {
+ mStatusChangedListener = l;
+ if (mStatusChangedListener != null) {
+ mStatusChangedListener.helpTextChanged(HELP_MESSAGE_KEY_TIPS);
+ }
+ }
+
+ void setShowLock(boolean show) {
+ mIsLockShown = show;
+ redraw();
+ }
+
+ void setShowPatchesArea(boolean show) {
+ mIsPatchesShown = show;
+ redraw();
+ }
+
+ void setShowBadPatchesArea(boolean show) {
+ mIsBadPatchesShown = show;
+ redraw();
+ }
+
+ void setZoom(int zoom) {
+ mZoom = zoom;
+ mZoomedPixelSize = getZoomedPixelSize(1);
+ redraw();
+ }
+
+ public ImageViewer(Composite parent, int style) {
+ super(parent, style);
+
+ mUpdateThread.start();
+
+ mBackgroundLayer = AdtPlugin.getImageDescriptor(CHECKER_PNG_PATH).createImage();
+
+ addMouseListener(this);
+ addMouseMoveListener(this);
+ addPaintListener(this);
+
+ mHorizontalBar = getHorizontalBar();
+ mHorizontalBar.setThumb(1);
+ mHorizontalBar.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ super.widgetSelected(event);
+ ScrollBar bar = (ScrollBar) event.widget;
+ if (mHorizontalBar.isVisible()
+ && mHorizontalScroll != bar.getSelection()) {
+ mHorizontalScroll = bar.getSelection();
+ redraw();
+ }
+ }
+ });
+
+ mVerticalBar = getVerticalBar();
+ mVerticalBar.setThumb(1);
+ mVerticalBar.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ super.widgetSelected(event);
+ ScrollBar bar = (ScrollBar) event.widget;
+ if (mVerticalBar.isVisible()
+ && mVerticalScroll != bar.getSelection()) {
+ mVerticalScroll = bar.getSelection();
+ redraw();
+ }
+ }
+ });
+ }
+
+ /**
+ * Load the image file.
+ *
+ * @param fileName must be absolute path
+ */
+ public NinePatchedImage loadFile(String fileName) {
+ mNinePatchedImage = new NinePatchedImage(fileName);
+
+ return mNinePatchedImage;
+ }
+
+ /**
+ * Start displaying the image.
+ */
+ public void startDisplay() {
+ mZoomedPixelSize = getZoomedPixelSize(1);
+
+ scheduleUpdate();
+ }
+
+ private void draw(int x, int y, int drawMode) {
+ if (drawMode == MODE_ERASE) {
+ erase(x, y);
+ } else {
+ int color = (drawMode == MODE_RED_TICK) ? NinePatchedImage.RED_TICK
+ : NinePatchedImage.BLACK_TICK;
+ mNinePatchedImage.setPatch(x, y, color);
+ redraw();
+
+ scheduleUpdate();
+ }
+ }
+
+ private void erase(int x, int y) {
+ mNinePatchedImage.erase(x, y);
+ redraw();
+
+ scheduleUpdate();
+ }
+
+ private void scheduleUpdate() {
+ try {
+ mUpdateQueue.put(mNinePatchedImage);
+ } catch (InterruptedException e) {
+ }
+ }
+
+ @Override
+ public void mouseDown(MouseEvent event) {
+ if (event.button == 1 && !isShiftPressed) {
+ mDrawMode = !isCtrlPressed ? MODE_BLACK_TICK : MODE_RED_TICK;
+ draw(mCursorPoint.x, mCursorPoint.y, mDrawMode);
+ } else if (event.button == 3 || isShiftPressed) {
+ mDrawMode = MODE_ERASE;
+ erase(mCursorPoint.x, mCursorPoint.y);
+ }
+ }
+
+ @Override
+ public void mouseUp(MouseEvent event) {
+ mDrawMode = MODE_NONE;
+ }
+
+ @Override
+ public void mouseDoubleClick(MouseEvent event) {
+ }
+
+ private int getLogicalPositionX(int x) {
+ return Math.round((x - mPadding.x + mHorizontalScroll) / ((float) mZoom / 100));
+ }
+
+ private int getLogicalPositionY(int y) {
+ return Math.round((y - mPadding.y + mVerticalScroll) / ((float) mZoom / 100));
+ }
+
+ @Override
+ public void mouseMove(MouseEvent event) {
+ int posX = getLogicalPositionX(event.x);
+ int posY = getLogicalPositionY(event.y);
+
+ int width = mNinePatchedImage.getWidth();
+ int height = mNinePatchedImage.getHeight();
+
+ if (posX < 0) {
+ posX = 0;
+ }
+ if (posX >= width) {
+ posX = width - 1;
+ }
+ if (posY < 0) {
+ posY = 0;
+ }
+ if (posY >= height) {
+ posY = height - 1;
+ }
+
+ if (mDrawMode != MODE_NONE) {
+ int drawMode = mDrawMode;
+ if (isShiftPressed) {
+ drawMode = MODE_ERASE;
+ } else if (mDrawMode != MODE_ERASE) {
+ drawMode = !isCtrlPressed ? MODE_BLACK_TICK : MODE_RED_TICK;
+ }
+
+ /*
+ * Consider the previous cursor position because mouseMove events are
+ * scatter.
+ */
+ int x = mCursorPoint.x;
+ int y = mCursorPoint.y;
+ for (; y != posY; y += (y > posY) ? -1 : 1) {
+ draw(x, y, drawMode);
+ }
+
+ x = mCursorPoint.x;
+ y = mCursorPoint.y;
+ for (; x != posX; x += (x > posX) ? -1 : 1) {
+ draw(x, y, drawMode);
+ }
+ }
+ mCursorPoint.x = posX;
+ mCursorPoint.y = posY;
+
+ redraw();
+
+ if (mStatusChangedListener != null) {
+ // Update position on status panel if position is in logical size.
+ if (posX >= 0 && posY >= 0
+ && posX <= mNinePatchedImage.getWidth()
+ && posY <= mNinePatchedImage.getHeight()) {
+ mStatusChangedListener.cursorPositionChanged(posX + 1, posY + 1);
+ }
+ }
+ }
+
+ private synchronized void calcPaddings(int width, int height) {
+ Point canvasSize = getSize();
+
+ mPadding.width = getZoomedPixelSize(width);
+ mPadding.height = getZoomedPixelSize(height);
+
+ int margin = getZoomedPixelSize(MARGIN);
+
+ if (mPadding.width < canvasSize.x) {
+ mPadding.x = (canvasSize.x - mPadding.width) / 2;
+ } else {
+ mPadding.x = margin;
+ }
+
+ if (mPadding.height < canvasSize.y) {
+ mPadding.y = (canvasSize.y - mPadding.height) / 2;
+ } else {
+ mPadding.y = margin;
+ }
+ }
+
+ private void calcScrollBarSettings() {
+ Point size = getSize();
+ int screenWidth = size.x;
+ int screenHeight = size.y;
+
+ int imageWidth = getZoomedPixelSize(mNinePatchedImage.getWidth() + 1);
+ int imageHeight = getZoomedPixelSize(mNinePatchedImage.getHeight() + 1);
+
+ // consider the scroll bar sizes
+ int verticalBarSize = mVerticalBar.getSize().x;
+ int horizontalBarSize = mHorizontalBar.getSize().y;
+
+ int horizontalScroll = imageWidth - (screenWidth - verticalBarSize);
+ int verticalScroll = imageHeight - (screenHeight - horizontalBarSize);
+
+ int margin = getZoomedPixelSize(MARGIN) * 2;
+
+ if (horizontalScroll > 0) {
+ mHorizontalBar.setVisible(true);
+
+ // horizontal maximum
+ int max = horizontalScroll + verticalBarSize + margin;
+ mHorizontalBar.setMaximum(max);
+
+ // set corrected scroll size
+ int value = mHorizontalBar.getSelection();
+ value = max < value ? max : value;
+
+ mHorizontalBar.setSelection(value);
+ mHorizontalScroll = value;
+
+ } else {
+ mHorizontalBar.setSelection(0);
+ mHorizontalBar.setMaximum(0);
+ mHorizontalBar.setVisible(false);
+ }
+
+ if (verticalScroll > 0) {
+ mVerticalBar.setVisible(true);
+
+ // vertical maximum
+ int max = verticalScroll + horizontalBarSize + margin;
+ mVerticalBar.setMaximum(max);
+
+ // set corrected scroll size
+ int value = mVerticalBar.getSelection();
+ value = max < value ? max : value;
+
+ mVerticalBar.setSelection(value);
+ mVerticalScroll = value;
+
+ } else {
+ mVerticalBar.setSelection(0);
+ mVerticalBar.setMaximum(0);
+ mVerticalBar.setVisible(false);
+ }
+ }
+
+ private int getZoomedPixelSize(int val) {
+ return Math.round(val * (float) mZoom / 100);
+ }
+
+ @Override
+ public void paintControl(PaintEvent pe) {
+ if (mNinePatchedImage == null) {
+ return;
+ }
+
+ // Use buffer
+ GC bufferGc = null;
+ if (mBufferImage == null) {
+ mBufferImage = new Image(AdtPlugin.getDisplay(), pe.width, pe.height);
+ } else {
+ int width = mBufferImage.getBounds().width;
+ int height = mBufferImage.getBounds().height;
+ if (width != pe.width || height != pe.height) {
+ mBufferImage = new Image(AdtPlugin.getDisplay(), pe.width, pe.height);
+ }
+ }
+
+ // Draw previous image once for prevent flicking
+ pe.gc.drawImage(mBufferImage, 0, 0);
+
+ bufferGc = new GC(mBufferImage);
+ bufferGc.setAdvanced(true);
+
+ // Make interpolation disable
+ bufferGc.setInterpolation(SWT.NONE);
+
+ // clear buffer
+ bufferGc.fillRectangle(0, 0, pe.width, pe.height);
+
+ calcScrollBarSettings();
+
+ // padding from current zoom
+ int width = mNinePatchedImage.getWidth();
+ int height = mNinePatchedImage.getHeight();
+ calcPaddings(width, height);
+
+ int baseX = mPadding.x - mHorizontalScroll;
+ int baseY = mPadding.y - mVerticalScroll;
+
+ // draw checker image
+ bufferGc.drawImage(mBackgroundLayer,
+ 0, 0, mBackgroundLayer.getImageData().width,
+ mBackgroundLayer.getImageData().height,
+ baseX, baseY, mPadding.width, mPadding.height);
+
+ if (DEBUG) {
+ System.out.println(String.format("%d,%d %d,%d %d,%d",
+ width, height, baseX, baseY, mPadding.width, mPadding.height));
+ }
+
+ // draw image
+ /* TODO: Do not draw invisible area, for better performance. */
+ bufferGc.drawImage(mNinePatchedImage.getImage(), 0, 0, width, height, baseX, baseY,
+ mPadding.width, mPadding.height);
+
+ bufferGc.setBackground(BLACK_COLOR);
+
+ // draw patch ticks
+ drawHorizontalPatches(bufferGc, baseX, baseY);
+ drawVerticalPatches(bufferGc, baseX, baseY);
+
+ // draw content ticks
+ drawHorizontalContentArea(bufferGc, baseX, baseY);
+ drawVerticalContentArea(bufferGc, baseX, baseY);
+
+ if (mNinePatchedImage.isValid(mCursorPoint.x, mCursorPoint.y)) {
+ bufferGc.setForeground(BLACK_COLOR);
+ } else if (mIsLockShown) {
+ drawLockArea(bufferGc, baseX, baseY);
+ }
+
+ // Patches
+ if (mIsPatchesShown) {
+ drawPatchAreas(bufferGc, baseX, baseY);
+ }
+
+ // Bad patches
+ if (mIsBadPatchesShown) {
+ drawBadPatchAreas(bufferGc, baseX, baseY);
+ }
+
+ if (mNinePatchedImage.isValid(mCursorPoint.x, mCursorPoint.y)) {
+ bufferGc.setForeground(BLACK_COLOR);
+ } else {
+ bufferGc.setForeground(RED_COLOR);
+ }
+
+ drawGuideLine(bufferGc, baseX, baseY);
+
+ bufferGc.dispose();
+
+ pe.gc.drawImage(mBufferImage, 0, 0);
+ }
+
+ private static final Color getColor(int color) {
+ switch (color) {
+ case NinePatchedImage.RED_TICK:
+ return RED_COLOR;
+ default:
+ return BLACK_COLOR;
+ }
+ }
+
+ private void drawVerticalPatches(GC gc, int baseX, int baseY) {
+ List<Tick> verticalPatches = mNinePatchedImage.getVerticalPatches();
+ for (Tick t : verticalPatches) {
+ if (t.color != NinePatchedImage.TRANSPARENT_TICK) {
+ gc.setBackground(getColor(t.color));
+ gc.fillRectangle(
+ baseX,
+ baseY + getZoomedPixelSize(t.start),
+ mZoomedPixelSize,
+ getZoomedPixelSize(t.getLength()));
+ }
+ }
+ }
+
+ private void drawHorizontalPatches(GC gc, int baseX, int baseY) {
+ List<Tick> horizontalPatches = mNinePatchedImage.getHorizontalPatches();
+ for (Tick t : horizontalPatches) {
+ if (t.color != NinePatchedImage.TRANSPARENT_TICK) {
+ gc.setBackground(getColor(t.color));
+ gc.fillRectangle(
+ baseX + getZoomedPixelSize(t.start),
+ baseY,
+ getZoomedPixelSize(t.getLength()),
+ mZoomedPixelSize);
+ }
+ }
+ }
+
+ private void drawHorizontalContentArea(GC gc, int baseX, int baseY) {
+ List<Tick> horizontalContentArea = mNinePatchedImage.getHorizontalContents();
+ for (Tick t : horizontalContentArea) {
+ if (t.color != NinePatchedImage.TRANSPARENT_TICK) {
+ gc.setBackground(getColor(t.color));
+ gc.fillRectangle(
+ baseX + getZoomedPixelSize(t.start),
+ baseY + getZoomedPixelSize(mNinePatchedImage.getHeight() - 1),
+ getZoomedPixelSize(t.getLength()),
+ mZoomedPixelSize);
+ }
+ }
+
+ }
+
+ private void drawVerticalContentArea(GC gc, int baseX, int baseY) {
+ List<Tick> verticalContentArea = mNinePatchedImage.getVerticalContents();
+ for (Tick t : verticalContentArea) {
+ if (t.color != NinePatchedImage.TRANSPARENT_TICK) {
+ gc.setBackground(getColor(t.color));
+ gc.fillRectangle(
+ baseX + getZoomedPixelSize(mNinePatchedImage.getWidth() - 1),
+ baseY + getZoomedPixelSize(t.start),
+ mZoomedPixelSize,
+ getZoomedPixelSize(t.getLength()));
+ }
+ }
+ }
+
+ private void drawLockArea(GC gc, int baseX, int baseY) {
+ gc.setAlpha(LOCK_ALPHA);
+ gc.setForeground(LOCK_COLOR);
+ gc.setBackground(LOCK_COLOR);
+
+ gc.fillRectangle(
+ baseX + mZoomedPixelSize,
+ baseY + mZoomedPixelSize,
+ getZoomedPixelSize(mNinePatchedImage.getWidth() - 2),
+ getZoomedPixelSize(mNinePatchedImage.getHeight() - 2));
+ gc.setAlpha(NONE_ALPHA);
+
+ }
+
+ private void drawPatchAreas(GC gc, int baseX, int baseY) {
+ if (mChunks != null) {
+ int yLen = mChunks.length;
+ int xLen = mChunks[0].length;
+
+ gc.setAlpha(PATCH_ALPHA);
+
+ for (int yPos = 0; yPos < yLen; yPos++) {
+ for (int xPos = 0; xPos < xLen; xPos++) {
+ Chunk c = mChunks[yPos][xPos];
+
+ if (c.type == Chunk.TYPE_FIXED) {
+ gc.setBackground(BACK_COLOR);
+ } else if (c.type == Chunk.TYPE_HORIZONTAL) {
+ gc.setBackground(PATCH_ONEWAY_COLOR);
+ } else if (c.type == Chunk.TYPE_VERTICAL) {
+ gc.setBackground(PATCH_ONEWAY_COLOR);
+ } else if (c.type == Chunk.TYPE_HORIZONTAL + Chunk.TYPE_VERTICAL) {
+ gc.setBackground(PATCH_COLOR);
+ }
+ Rectangle r = c.rect;
+ gc.fillRectangle(
+ baseX + getZoomedPixelSize(r.x),
+ baseY + getZoomedPixelSize(r.y),
+ getZoomedPixelSize(r.width),
+ getZoomedPixelSize(r.height));
+ }
+ }
+ }
+ gc.setAlpha(NONE_ALPHA);
+ }
+
+ private void drawBadPatchAreas(GC gc, int baseX, int baseY) {
+ if (mBadChunks != null) {
+ int yLen = mBadChunks.length;
+ int xLen = mBadChunks[0].length;
+
+ gc.setAlpha(NONE_ALPHA);
+ gc.setForeground(CORRUPTED_COLOR);
+ gc.setBackground(CORRUPTED_COLOR);
+
+ for (int yPos = 0; yPos < yLen; yPos++) {
+ for (int xPos = 0; xPos < xLen; xPos++) {
+ Chunk c = mBadChunks[yPos][xPos];
+ if ((c.type & Chunk.TYPE_CORRUPT) != 0) {
+ Rectangle r = c.rect;
+ gc.drawRectangle(
+ baseX + getZoomedPixelSize(r.x),
+ baseY + getZoomedPixelSize(r.y),
+ getZoomedPixelSize(r.width),
+ getZoomedPixelSize(r.height));
+ }
+ }
+ }
+ }
+ }
+
+ private void drawGuideLine(GC gc, int baseX, int baseY) {
+ gc.setAntialias(SWT.ON);
+ gc.setInterpolation(SWT.HIGH);
+
+ int x = Math.round((mCursorPoint.x * ((float) mZoom / 100) + baseX)
+ + ((float) mZoom / 100 / 2));
+ int y = Math.round((mCursorPoint.y * ((float) mZoom / 100) + baseY)
+ + ((float) mZoom / 100 / 2));
+ gc.setAlpha(GUIDE_ALPHA);
+
+ Point size = getSize();
+ gc.drawLine(x, 0, x, size.y);
+ gc.drawLine(0, y, size.x, y);
+
+ gc.setAlpha(NONE_ALPHA);
+ }
+
+ @Override
+ public void keyPressed(KeyEvent event) {
+ int keycode = event.keyCode;
+ if (keycode == SWT.CTRL) {
+ isCtrlPressed = true;
+ }
+ if (keycode == SWT.SHIFT) {
+ isShiftPressed = true;
+ if (mStatusChangedListener != null) {
+ mStatusChangedListener.helpTextChanged(HELP_MESSAGE_KEY_TIPS2);
+ }
+ }
+ }
+
+ @Override
+ public void keyReleased(KeyEvent event) {
+ int keycode = event.keyCode;
+ if (keycode == SWT.CTRL) {
+ isCtrlPressed = false;
+ }
+ if (keycode == SWT.SHIFT) {
+ isShiftPressed = false;
+ if (mStatusChangedListener != null) {
+ mStatusChangedListener.helpTextChanged(HELP_MESSAGE_KEY_TIPS);
+ }
+ }
+ }
+
+ @Override
+ public void dispose() {
+ mBackgroundLayer.dispose();
+ super.dispose();
+ }
+
+ /**
+ * Listen image updated event.
+ */
+ public interface UpdateListener {
+ /**
+ * 9-patched image has been updated.
+ */
+ public void update(NinePatchedImage image);
+ }
+
+ /**
+ * Listen status changed event.
+ */
+ public interface StatusChangedListener {
+ /**
+ * Mouse cursor position has been changed.
+ */
+ public void cursorPositionChanged(int x, int y);
+
+ /**
+ * Help text has been changed.
+ */
+ public void helpTextChanged(String text);
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/draw9patch/ui/MainFrame.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/draw9patch/ui/MainFrame.java
new file mode 100644
index 0000000..71845c1
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/draw9patch/ui/MainFrame.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.editors.draw9patch.ui;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Main frame.
+ */
+public class MainFrame extends Composite implements ImageViewer.StatusChangedListener {
+
+ private final StatusPanel mStatusPanel;
+ private final ImageEditorPanel mImageEditorPanel;
+
+ public StatusPanel getStatusPanel() {
+ return mStatusPanel;
+ }
+
+ public ImageEditorPanel getImageEditorPanel() {
+ return mImageEditorPanel;
+ }
+
+ public MainFrame(Composite parent, int style) {
+ super(parent, style);
+ setLayout(new FormLayout());
+
+ mStatusPanel = new StatusPanel(this, SWT.NULL);
+
+ FormData bottom = new FormData();
+ bottom.bottom = new FormAttachment(100, 0);
+ bottom.left = new FormAttachment(0, 0);
+ bottom.right = new FormAttachment(100, 0);
+ mStatusPanel.setLayoutData(bottom);
+
+ mImageEditorPanel = new ImageEditorPanel(this, SWT.NULL);
+ mImageEditorPanel.getImageViewer().setStatusChangedListener(this);
+
+ mStatusPanel.setStatusChangedListener(mImageEditorPanel);
+
+ FormData top = new FormData();
+ top.top = new FormAttachment(0);
+ top.left = new FormAttachment(0);
+ top.right = new FormAttachment(100);
+ top.bottom = new FormAttachment(mStatusPanel);
+ mImageEditorPanel.setLayoutData(top);
+
+ addKeyListener(mStatusPanel);
+ addKeyListener(mImageEditorPanel.getImageViewer());
+ }
+
+ @Override
+ public void cursorPositionChanged(int x, int y) {
+ mStatusPanel.setPosition(x, y);
+ }
+
+ @Override
+ public void helpTextChanged(String text) {
+ mStatusPanel.setHelpText(text);
+ }
+
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/draw9patch/ui/StatusPanel.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/draw9patch/ui/StatusPanel.java
new file mode 100644
index 0000000..6ad258e
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/draw9patch/ui/StatusPanel.java
@@ -0,0 +1,357 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.editors.draw9patch.ui;
+
+import com.android.ide.eclipse.adt.AdtPlugin;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ControlEvent;
+import org.eclipse.swt.events.ControlListener;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Scale;
+
+/**
+ * Status and control pane.
+ */
+public class StatusPanel extends Composite implements KeyListener {
+
+ public static final int SCALE_MIN = 2;
+ public static final int SCALE_MAX = 6;
+
+ public static final int ZOOM_MIN = 100;
+ public static final int ZOOM_MAX = 800;
+
+ public static final int PADDING_TOP = 12;
+ public static final int PADDING_RIGHT = 0;
+ public static final int PADDING_BOTTOM = 5;
+ public static final int PADDING_LEFT = 10;
+
+ public static final int MIN_WIDTH = 800;
+
+ private Button mShowLock = null;
+ private Button mShowPatches = null;
+ private Button mShowBadPatches = null;
+ private Button mShowContent = null;
+
+ private Label mHelpLabel = null;
+
+ private Label mXPosLabel = null;
+ private Label mYPosLabel = null;
+
+ private ZoomControl mZoomControl = null;
+ private ZoomControl mScaleControl = null;
+
+ private StatusChangedListener mListener = null;
+
+ public void setStatusChangedListener(StatusChangedListener l) {
+ mListener = l;
+ }
+
+ public void setHelpText(String text) {
+ Point size = getSize();
+ // check window width
+ if (MIN_WIDTH < size.x) {
+ mHelpLabel.setText(text);
+ mHelpLabel.setVisible(true);
+ } else {
+ mHelpLabel.setText("N/A");
+ mHelpLabel.setVisible(false);
+ }
+ }
+
+ /**
+ * Set mouse cursor position.
+ */
+ public void setPosition(int x, int y) {
+ mXPosLabel.setText(String.format("X: %4d px", x));
+ mYPosLabel.setText(String.format("Y: %4d px", y));
+ }
+
+ public StatusPanel(Composite parent, int style) {
+ super(parent, style);
+ setLayout(new FormLayout());
+
+ final Composite container = new Composite(this, SWT.NULL);
+ container.setLayout(new FormLayout());
+
+ FormData innerForm = new FormData();
+ innerForm.left = new FormAttachment(0, PADDING_LEFT);
+ innerForm.top = new FormAttachment(0, PADDING_TOP);
+ innerForm.right = new FormAttachment(100, PADDING_RIGHT);
+ innerForm.bottom = new FormAttachment(100, -PADDING_BOTTOM);
+ container.setLayoutData(innerForm);
+
+ buildPosition(container);
+
+ Composite zoomPanels = new Composite(container, SWT.NULL);
+ zoomPanels.setLayout(new GridLayout(3, false));
+
+ buildZoomControl(zoomPanels);
+ buildScaleControl(zoomPanels);
+
+ Composite checkPanel = new Composite(container, SWT.NULL);
+ checkPanel.setLayout(new GridLayout(2, false));
+ FormData checkPanelForm = new FormData();
+ checkPanelForm.left = new FormAttachment(zoomPanels, 0);
+ checkPanelForm.bottom = new FormAttachment(100, -PADDING_BOTTOM);
+ checkPanel.setLayoutData(checkPanelForm);
+
+ buildCheckboxes(checkPanel);
+
+ mHelpLabel = new Label(container, SWT.BORDER_SOLID | SWT.BOLD | SWT.WRAP);
+ mHelpLabel.setBackground(new Color(AdtPlugin.getDisplay(), 0xFF, 0xFF, 0xFF));
+ FormData hintForm = new FormData();
+ hintForm.left = new FormAttachment(checkPanel, 5);
+ hintForm.right = new FormAttachment(mXPosLabel, -10);
+ hintForm.top = new FormAttachment(PADDING_TOP);
+ hintForm.bottom = new FormAttachment(100, -PADDING_BOTTOM);
+ mHelpLabel.setLayoutData(hintForm);
+
+ /*
+ * If the window width is not much, the "help label" will break the window.
+ * Because that is wrapped automatically.
+ *
+ * This listener catch resized events and reset help text.
+ *
+ * setHelpText method checks window width.
+ * If window is too narrow, help text will be set invisible.
+ */
+ container.addControlListener(new ControlListener() {
+ @Override
+ public void controlResized(ControlEvent event) {
+ // reset text
+ setHelpText(ImageViewer.HELP_MESSAGE_KEY_TIPS);
+ }
+ @Override
+ public void controlMoved(ControlEvent event) {
+ }
+ });
+
+ }
+
+ private void buildPosition(Composite parent) {
+ mXPosLabel = new Label(parent, SWT.NULL);
+ mYPosLabel = new Label(parent, SWT.NULL);
+
+ mXPosLabel.setText(String.format("X: %4d px", 1000));
+ mYPosLabel.setText(String.format("Y: %4d px", 1000));
+
+ FormData bottomRight = new FormData();
+ bottomRight.bottom = new FormAttachment(100, 0);
+ bottomRight.right = new FormAttachment(100, 0);
+ mYPosLabel.setLayoutData(bottomRight);
+
+ FormData aboveYPosLabel = new FormData();
+ aboveYPosLabel.bottom = new FormAttachment(mYPosLabel);
+ aboveYPosLabel.right = new FormAttachment(100, 0);
+ mXPosLabel.setLayoutData(aboveYPosLabel);
+ }
+
+ private void buildScaleControl(Composite parent) {
+ mScaleControl = new ZoomControl(parent);
+ mScaleControl.maxLabel.setText("6x");
+ mScaleControl.minLabel.setText("2x");
+ mScaleControl.scale.setMinimum(SCALE_MIN);
+ mScaleControl.scale.setMaximum(SCALE_MAX);
+ mScaleControl.scale.setSelection(2);
+ mScaleControl.scale.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ super.widgetSelected(event);
+ if (mListener != null) {
+ Scale scale = (Scale) event.widget;
+ mListener.scaleChanged(scale.getSelection());
+ }
+ }
+ });
+ }
+
+ private void buildZoomControl(Composite parent) {
+ mZoomControl = new ZoomControl(parent);
+ mZoomControl.maxLabel.setText("800%");
+ mZoomControl.minLabel.setText("100%");
+ mZoomControl.scale.setMinimum(ZOOM_MIN);
+ mZoomControl.scale.setMaximum(ZOOM_MAX - ZOOM_MIN);
+ mZoomControl.scale.setSelection(400);
+ mZoomControl.scale.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ super.widgetSelected(event);
+ if (mListener != null) {
+ Scale scale = (Scale) event.widget;
+ mListener.zoomChanged(scale.getSelection() + ZOOM_MIN);
+ }
+ }
+ });
+
+ }
+
+ private void buildCheckboxes(Composite parent) {
+ // check lock
+ mShowLock = new Button(parent, SWT.CHECK);
+ mShowLock.setText("show Lock");
+ mShowLock.setSelection(true);
+ mShowLock.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ super.widgetSelected(event);
+ if (mListener != null) {
+ mListener.lockVisibilityChanged(mShowLock.getSelection());
+ }
+ }
+ });
+
+ // check patches
+ mShowPatches = new Button(parent, SWT.CHECK);
+ mShowPatches.setText("show Patches");
+ mShowPatches.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ super.widgetSelected(event);
+ if (mListener != null) {
+ mListener.patchesVisibilityChanged(mShowPatches.getSelection());
+ }
+ }
+ });
+
+ // check patches
+ mShowBadPatches = new Button(parent, SWT.CHECK);
+ mShowBadPatches.setText("show Bad patches");
+ mShowBadPatches.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ super.widgetSelected(event);
+ if (mListener != null) {
+ mListener.badPatchesVisibilityChanged(mShowBadPatches.getSelection());
+ }
+ }
+ });
+
+ // check contents(padding)
+ mShowContent = new Button(parent, SWT.CHECK);
+ mShowContent.setText("show Contents");
+ mShowContent.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ super.widgetSelected(event);
+ if (mListener != null) {
+ mListener.contentAreaVisibilityChanged(mShowContent.getSelection());
+ }
+ }
+ });
+ }
+
+ @Override
+ public void keyPressed(KeyEvent event) {
+ switch (event.character) {
+ case 'c':
+ mShowContent.setSelection(!mShowContent.getSelection());
+ if (mListener != null) {
+ mListener.contentAreaVisibilityChanged(mShowContent.getSelection());
+ }
+ break;
+ case 'l':
+ mShowLock.setSelection(!mShowLock.getSelection());
+ if (mListener != null) {
+ mListener.lockVisibilityChanged(mShowLock.getSelection());
+ }
+ break;
+ case 'p':
+ mShowPatches.setSelection(!mShowPatches.getSelection());
+ if (mListener != null) {
+ mListener.patchesVisibilityChanged(mShowPatches.getSelection());
+ }
+ break;
+ case 'b':
+ mShowBadPatches.setSelection(!mShowBadPatches.getSelection());
+ if (mListener != null) {
+ mListener.badPatchesVisibilityChanged(mShowBadPatches.getSelection());
+ }
+ break;
+ }
+ }
+
+ @Override
+ public void keyReleased(KeyEvent event) {
+ }
+
+ private static class ZoomControl {
+
+ private Label minLabel;
+ private Label maxLabel;
+ Scale scale;
+
+ public ZoomControl(Composite composite) {
+ minLabel = new Label(composite, SWT.RIGHT);
+ scale = new Scale(composite, SWT.HORIZONTAL);
+ maxLabel = new Label(composite, SWT.LEFT);
+ }
+ }
+
+ /**
+ * Status changed events listener.
+ */
+ public interface StatusChangedListener {
+ /**
+ * Zoom level has been changed.
+ * @param zoom
+ */
+ public void zoomChanged(int zoom);
+
+ /**
+ * Scale has been changed.
+ * @param scale
+ */
+ public void scaleChanged(int scale);
+
+ /**
+ * Lock visibility has been changed.
+ * @param visible
+ */
+ public void lockVisibilityChanged(boolean visible);
+
+ /**
+ * Patches visibility has been changed.
+ * @param visible
+ */
+ public void patchesVisibilityChanged(boolean visible);
+
+ /**
+ * BadPatches visibility has been changed.
+ * @param visible
+ */
+ public void badPatchesVisibilityChanged(boolean visible);
+
+ /**
+ * Content visibility has been changed.
+ * @param visible
+ */
+ public void contentAreaVisibilityChanged(boolean visible);
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/draw9patch/ui/StretchesViewer.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/draw9patch/ui/StretchesViewer.java
new file mode 100644
index 0000000..353312c
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/draw9patch/ui/StretchesViewer.java
@@ -0,0 +1,267 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.editors.draw9patch.ui;
+
+import com.android.ide.eclipse.adt.AdtPlugin;
+import com.android.ide.eclipse.adt.internal.editors.draw9patch.graphics.GraphicsUtilities;
+import com.android.ide.eclipse.adt.internal.editors.draw9patch.graphics.NinePatchedImage;
+import com.android.ide.eclipse.adt.internal.editors.draw9patch.graphics.NinePatchedImage.Projection;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.PaletteData;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Preview 9-patched image pane.
+ */
+public class StretchesViewer extends Composite {
+ private static final boolean DEBUG = false;
+
+ private static final int PADDING_COLOR = 0x0000CC;
+
+ private static final int PADDING_COLOR_ALPHA = 100;
+
+ private static final PaletteData PADDING_PALLET
+ = new PaletteData(new RGB[] {new RGB(0x00, 0x00, 0xCC)});
+
+ private static final String CHECKER_PNG_PATH = "/icons/checker.png";
+
+ private Image mBackgroundLayer = null;
+
+ private final StretchView mHorizontal;
+ private final StretchView mVertical;
+
+ private final StretchView mBoth;
+
+ private NinePatchedImage mNinePatchedImage = null;
+
+ private ImageData mContentAreaImageData = null;
+
+ private boolean mIsContentAreaShown = false;
+
+ private Image mContentAreaImage = null;
+
+ private int mScale = 2;
+
+ public StretchesViewer(Composite parent, int style) {
+ super(parent, style);
+
+ mBackgroundLayer = AdtPlugin.getImageDescriptor(CHECKER_PNG_PATH).createImage();
+
+ setLayout(new FillLayout(SWT.VERTICAL));
+
+ mHorizontal = new StretchView(this, SWT.NULL);
+ mVertical = new StretchView(this, SWT.NULL);
+ mBoth = new StretchView(this, SWT.NULL);
+ }
+
+ /**
+ * Set show/not show content area.
+ * @param If show, true
+ */
+ public void setShowContentArea(boolean show) {
+ mIsContentAreaShown = show;
+ redraw();
+ }
+
+ private static final boolean equalSize(ImageData image1, ImageData image2) {
+ return (image1.width == image2.width && image1.height == image2.height);
+ }
+
+ /**
+ * Update preview image.
+ */
+ public void updatePreview(NinePatchedImage image) {
+ mNinePatchedImage = image;
+ ImageData base = mNinePatchedImage.getImageData();
+
+ if (mContentAreaImageData == null
+ || (mContentAreaImageData != null && !equalSize(base, mContentAreaImageData))) {
+ mContentAreaImageData = new ImageData(
+ base.width,
+ base.height,
+ 1,
+ PADDING_PALLET);
+ } else {
+ GraphicsUtilities.clearImageData(mContentAreaImageData);
+ }
+
+ mHorizontal.setImage(mNinePatchedImage);
+ mVertical.setImage(mNinePatchedImage);
+ mBoth.setImage(mNinePatchedImage);
+
+ mContentAreaImage = buildContentAreaPreview();
+
+ setScale(mScale);
+ }
+
+ private Image buildContentAreaPreview() {
+ if (mContentAreaImage != null) {
+ mContentAreaImage.dispose();
+ }
+
+ Rectangle rect = mNinePatchedImage.getContentArea();
+
+ int yLen = rect.y + rect.height;
+ for (int y = rect.y; y < yLen; y++) {
+ int xLen = rect.x + rect.width;
+ for (int x = rect.x; x < xLen; x++) {
+ mContentAreaImageData.setPixel(x, y, PADDING_COLOR);
+ mContentAreaImageData.setAlpha(x, y, PADDING_COLOR_ALPHA);
+ }
+ }
+ return new Image(AdtPlugin.getDisplay(), mContentAreaImageData);
+ }
+
+ public void setScale(int scale) {
+ if (DEBUG) {
+ System.out.println("scale = " + scale);
+ }
+
+ mScale = scale;
+ int imageWidth = mNinePatchedImage.getWidth();
+ int imageHeight = mNinePatchedImage.getHeight();
+
+ mHorizontal.setSize(imageWidth * scale, imageHeight);
+ mVertical.setSize(imageWidth, imageHeight * scale);
+ mBoth.setSize(imageWidth * scale, imageHeight * scale);
+
+ redraw();
+ }
+
+ @Override
+ public void dispose() {
+ mBackgroundLayer.dispose();
+ super.dispose();
+ }
+
+ private class StretchView extends Canvas implements PaintListener {
+
+ private final Point mSize = new Point(0, 0);
+ private final Rectangle mPadding = new Rectangle(0, 0, 0, 0);
+ private Projection[][] mProjection = null;
+
+ public StretchView(Composite parent, int style) {
+ super(parent, style);
+ addPaintListener(this);
+ }
+
+ private void setImage(NinePatchedImage image) {
+ setSize(image.getWidth(), image.getHeight());
+ }
+
+ @Override
+ public void setSize(int width, int heigh) {
+ mSize.x = width;
+ mSize.y = heigh;
+ mProjection = mNinePatchedImage.getProjections(mSize.x, mSize.y, mProjection);
+ }
+
+ private synchronized void calcPaddings(int width, int height) {
+ Point canvasSize = getSize();
+
+ mPadding.x = (canvasSize.x - width) / 2;
+ mPadding.y = (canvasSize.y - height) / 2;
+
+ mPadding.width = width;
+ mPadding.height = height;
+ }
+
+ @Override
+ public void paintControl(PaintEvent pe) {
+ if (mNinePatchedImage == null || mProjection == null) {
+ return;
+ }
+
+ Point size = getSize();
+
+ // relative scaling
+ float ratio = 1.0f;
+ float wRatio = ((float) size.x / mSize.x);
+ ratio = Math.min(wRatio, ratio);
+ float hRatio = ((float) size.y / mSize.y);
+ ratio = Math.min(hRatio, ratio);
+
+ int width = Math.round(mSize.x * ratio);
+ int height = Math.round(mSize.y * ratio);
+
+ calcPaddings(width, height);
+
+ Rectangle dest = new Rectangle(0, 0, 0, 0);
+
+ GC gc = pe.gc;
+
+ int backgroundLayerWidth = mBackgroundLayer.getImageData().width;
+ int backgroundLayerHeight = mBackgroundLayer.getImageData().height;
+
+ int yCount = size.y / backgroundLayerHeight
+ + ((size.y % backgroundLayerHeight) > 0 ? 1 : 0);
+ int xCount = size.x / backgroundLayerWidth
+ + ((size.x % backgroundLayerWidth) > 0 ? 1 : 0);
+
+ // draw background layer
+ for (int y = 0; y < yCount; y++) {
+ for (int x = 0; x < xCount; x++) {
+ gc.drawImage(mBackgroundLayer,
+ x * backgroundLayerWidth,
+ y * backgroundLayerHeight);
+ }
+ }
+
+ // draw the border line
+ gc.setAlpha(0x88);
+ gc.drawRectangle(0, 0, size.x, size.y);
+ gc.setAlpha(0xFF);
+
+ int yLen = mProjection.length;
+ int xLen = mProjection[0].length;
+ for (int yPos = 0; yPos < yLen; yPos++) {
+ for (int xPos = 0; xPos < xLen; xPos++) {
+ Projection p = mProjection[yPos][xPos];
+
+ // consider the scale
+ dest.x = (int) Math.ceil(p.dest.x * ratio);
+ dest.y = (int) Math.ceil(p.dest.y * ratio);
+ dest.width = (int) Math.ceil(p.dest.width * ratio);
+ dest.height = (int) Math.ceil(p.dest.height * ratio);
+
+ gc.drawImage(mNinePatchedImage.getImage(), p.src.x, p.src.y,
+ p.src.width, p.src.height,
+ (mPadding.x + dest.x), (mPadding.y + dest.y),
+ dest.width, dest.height);
+
+ if (mIsContentAreaShown) {
+ gc.drawImage(mContentAreaImage, p.src.x, p.src.y,
+ p.src.width, p.src.height,
+ (mPadding.x + dest.x), (mPadding.y + dest.y),
+ dest.width, dest.height);
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationChooser.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationChooser.java
index d4cc6df..ebd1fb9 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationChooser.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationChooser.java
@@ -37,6 +37,7 @@ import com.android.annotations.NonNull;
import com.android.annotations.Nullable;
import com.android.ide.common.rendering.api.ResourceValue;
import com.android.ide.common.rendering.api.StyleResourceValue;
+import com.android.ide.common.resources.LocaleManager;
import com.android.ide.common.resources.ResourceFile;
import com.android.ide.common.resources.ResourceFolder;
import com.android.ide.common.resources.ResourceRepository;
@@ -248,7 +249,7 @@ public class ConfigurationChooser extends Composite
ToolBar rightToolBar = toolBar;
mLocaleCombo = new ToolItem(rightToolBar, SWT.DROP_DOWN);
- mLocaleCombo.setImage(LocaleManager.getGlobeIcon());
+ mLocaleCombo.setImage(FlagManager.getGlobeIcon());
mLocaleCombo.setToolTipText("Locale to use when rendering layouts in Eclipse");
@SuppressWarnings("unused")
@@ -1131,7 +1132,7 @@ public class ConfigurationChooser extends Composite
return locale.getFlagImage();
}
- return LocaleManager.getGlobeIcon();
+ return FlagManager.getGlobeIcon();
}
private void selectConfiguration(FolderConfiguration fileConfig) {
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationMatcher.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationMatcher.java
index 5dfcdb8..89104ab 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationMatcher.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationMatcher.java
@@ -46,8 +46,8 @@ import com.android.sdklib.IAndroidTarget;
import com.android.sdklib.devices.Device;
import com.android.sdklib.devices.State;
import com.android.sdklib.repository.PkgProps;
-import com.android.sdklib.util.SparseIntArray;
import com.android.utils.Pair;
+import com.android.utils.SparseIntArray;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/FlagManager.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/FlagManager.java
new file mode 100644
index 0000000..0e6acd7
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/FlagManager.java
@@ -0,0 +1,213 @@
+/*
+ * Copyright (C) 2012 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.ide.eclipse.adt.internal.editors.layout.configuration;
+
+import com.android.annotations.NonNull;
+import com.android.annotations.Nullable;
+import com.android.ide.common.resources.LocaleManager;
+import com.android.ide.common.resources.configuration.LanguageQualifier;
+import com.android.ide.common.resources.configuration.RegionQualifier;
+import com.android.ide.eclipse.adt.internal.editors.IconFactory;
+import com.google.common.base.Splitter;
+import com.google.common.collect.Maps;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wb.internal.core.DesignerPlugin;
+
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * The {@linkplain FlagManager} provides access to flags for regions known
+ * to {@link LocaleManager}. It also contains some locale related display
+ * functions.
+ * <p>
+ * All the flag images came from the WindowBuilder subversion repository
+ * http://dev.eclipse.org/svnroot/tools/org.eclipse.windowbuilder/trunk (and in
+ * particular, a snapshot of revision 424). However, it appears that the icons
+ * are from http://www.famfamfam.com/lab/icons/flags/ which states that "these
+ * flag icons are available for free use for any purpose with no requirement for
+ * attribution." Adding the URL here such that we can check back occasionally
+ * and see if there are corrections or updates. Also note that the flag names
+ * are in ISO 3166-1 alpha-2 country codes.
+ */
+public class FlagManager {
+ private static final FlagManager sInstance = new FlagManager();
+
+ /**
+ * Returns the {@linkplain FlagManager} singleton
+ *
+ * @return the {@linkplain FlagManager} singleton, never null
+ */
+ @NonNull
+ public static FlagManager get() {
+ return sInstance;
+ }
+
+ /** Use the {@link #get()} factory method */
+ private FlagManager() {
+ }
+
+ /** Map from region to flag icon */
+ private Map<String, Image> mImageMap = Maps.newHashMap();
+
+ /**
+ * Returns the empty flag icon used to indicate an unknown country
+ *
+ * @return the globe icon used to indicate an unknown country
+ */
+ public static Image getEmptyIcon() {
+ return DesignerPlugin.getImage("nls/flags/flag_empty.png"); //$NON-NLS-1$
+ }
+
+ /**
+ * Returns the globe icon used to indicate "any" language
+ *
+ * @return the globe icon used to indicate "any" language
+ */
+ public static Image getGlobeIcon() {
+ return IconFactory.getInstance().getIcon("globe"); //$NON-NLS-1$
+ }
+
+ /**
+ * Returns the flag for the given language and region.
+ *
+ * @param language the language, or null (if null, region must not be null),
+ * the 2 letter language code (ISO 639-1), in lower case
+ * @param region the region, or null (if null, language must not be null),
+ * the 2 letter region code (ISO 3166-1 alpha-2), in upper case
+ * @return a suitable flag icon, or null
+ */
+ @Nullable
+ public Image getFlag(@Nullable String language, @Nullable String region) {
+ assert region != null || language != null;
+ if (region == null || region.isEmpty()) {
+ // Look up the region for a given language
+ assert language != null;
+
+ // Prefer the local registration of the current locale; even if
+ // for example the default locale for English is the US, if the current
+ // default locale is English, then use its associated country, which could
+ // for example be Australia.
+ Locale locale = Locale.getDefault();
+ if (language.equals(locale.getLanguage())) {
+ Image flag = getFlag(locale.getCountry());
+ if (flag != null) {
+ return flag;
+ }
+ }
+
+ // Special cases where we have a dedicated flag available:
+ if (language.equals("ca")) { //$NON-NLS-1$
+ region = "catalonia"; //$NON-NLS-1$
+ } else if (language.equals("gd")) { //$NON-NLS-1$
+ region = "scotland"; //$NON-NLS-1$
+ } else if (language.equals("cy")) { //$NON-NLS-1$
+ region = "wales"; //$NON-NLS-1$
+ } else {
+ // Attempt to look up the country from the language
+ region = LocaleManager.getLanguageRegion(language);
+ }
+ }
+
+ if (region == null || region.isEmpty()) {
+ // No country specified, and the language is for a country we
+ // don't have a flag for
+ return null;
+ }
+
+ return getIcon(region);
+ }
+
+ /**
+ * Returns the flag for the given language and region.
+ *
+ * @param language the language qualifier, or null (if null, region must not be null),
+ * @param region the region, or null (if null, language must not be null),
+ * @return a suitable flag icon, or null
+ */
+ public Image getFlag(LanguageQualifier language, RegionQualifier region) {
+ String languageCode = language != null ? language.getValue() : null;
+ String regionCode = region != null ? region.getValue() : null;
+ if (LanguageQualifier.FAKE_LANG_VALUE.equals(languageCode)) {
+ languageCode = null;
+ }
+ if (RegionQualifier.FAKE_REGION_VALUE.equals(regionCode)) {
+ regionCode = null;
+ }
+ return getFlag(languageCode, regionCode);
+ }
+
+ /**
+ * Returns a flag for a given resource folder name (such as
+ * {@code values-en-rUS}), or null
+ *
+ * @param folder the folder name
+ * @return a corresponding flag icon, or null if none was found
+ */
+ @Nullable
+ public Image getFlagForFolderName(@NonNull String folder) {
+ RegionQualifier region = null;
+ LanguageQualifier language = null;
+ for (String qualifier : Splitter.on('-').split(folder)) {
+ if (qualifier.length() == 3) {
+ region = RegionQualifier.getQualifier(qualifier);
+ if (region != null) {
+ break;
+ }
+ } else if (qualifier.length() == 2 && language == null) {
+ language = LanguageQualifier.getQualifier(qualifier);
+ }
+ }
+ if (region != null || language != null) {
+ return FlagManager.get().getFlag(language, region);
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the flag for the given region.
+ *
+ * @param region the 2 letter region code (ISO 3166-1 alpha-2), in upper case
+ * @return a suitable flag icon, or null
+ */
+ @Nullable
+ public Image getFlag(@NonNull String region) {
+ assert region.length() == 2
+ && Character.isUpperCase(region.charAt(0))
+ && Character.isUpperCase(region.charAt(1)) : region;
+
+ return getIcon(region);
+ }
+
+ private Image getIcon(@NonNull String base) {
+ Image flagImage = mImageMap.get(base);
+ if (flagImage == null) {
+ // TODO: Special case locale currently running on system such
+ // that the current country matches the current locale
+ if (mImageMap.containsKey(base)) {
+ // Already checked: there's just no image there
+ return null;
+ }
+ String flagFileName = base.toLowerCase(Locale.US) + ".png"; //$NON-NLS-1$
+ flagImage = DesignerPlugin.getImage("nls/flags/" + flagFileName); //$NON-NLS-1$
+ mImageMap.put(base, flagImage);
+ }
+
+ return flagImage;
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/Locale.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/Locale.java
index 157c8c2..6e67c86 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/Locale.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/Locale.java
@@ -96,13 +96,13 @@ public class Locale {
Image image = null;
String languageCode = hasLanguage() ? language.getValue() : null;
String regionCode = hasRegion() ? region.getValue() : null;
- LocaleManager icons = LocaleManager.get();
if (languageCode == null && regionCode == null) {
- return LocaleManager.getGlobeIcon();
+ return FlagManager.getGlobeIcon();
} else {
+ FlagManager icons = FlagManager.get();
image = icons.getFlag(languageCode, regionCode);
if (image == null) {
- image = LocaleManager.getEmptyIcon();
+ image = FlagManager.getEmptyIcon();
}
return image;
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/LocaleManager.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/LocaleManager.java
deleted file mode 100644
index 43c90d9..0000000
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/LocaleManager.java
+++ /dev/null
@@ -1,1289 +0,0 @@
-/*
- * Copyright (C) 2012 The Android Open Source Project
- *
- * Licensed under the Eclipse Public License, Version 1.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.eclipse.org/org/documents/epl-v10.php
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.android.ide.eclipse.adt.internal.editors.layout.configuration;
-
-import com.android.annotations.NonNull;
-import com.android.annotations.Nullable;
-import com.android.annotations.VisibleForTesting;
-import com.android.ide.common.resources.configuration.LanguageQualifier;
-import com.android.ide.common.resources.configuration.RegionQualifier;
-import com.android.ide.eclipse.adt.internal.editors.IconFactory;
-import com.google.common.base.Splitter;
-import com.google.common.collect.Maps;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wb.internal.core.DesignerPlugin;
-
-import java.util.Collections;
-import java.util.Locale;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * The {@linkplain LocaleManager} provides access to locale information such as
- * language names and flag icons for the various locales.
- * <p>
- * All the flag images came from the WindowBuilder subversion repository
- * http://dev.eclipse.org/svnroot/tools/org.eclipse.windowbuilder/trunk (and in
- * particular, a snapshot of revision 424). However, it appears that the icons
- * are from http://www.famfamfam.com/lab/icons/flags/ which states that "these
- * flag icons are available for free use for any purpose with no requirement for
- * attribution." Adding the URL here such that we can check back occasionally
- * and see if there are corrections or updates. Also note that the flag names
- * are in ISO 3166-1 alpha-2 country codes.
- */
-public class LocaleManager {
- private static final LocaleManager sInstance = new LocaleManager();
-
- /**
- * Returns the {@linkplain LocaleManager} singleton
- *
- * @return the {@linkplain LocaleManager} singleton, never null
- */
- @NonNull
- public static LocaleManager get() {
- return sInstance;
- }
-
- /** Use the {@link #get()} factory method */
- private LocaleManager() {
- }
-
- /** Map from region to flag icon */
- private Map<String, Image> mImageMap = Maps.newHashMap();
-
- /**
- * Map of default bindings from language to country (if a region is not
- * specified). Note that if a given language is the language of the default
- * locale on the user's machine, then the country corresponding to that
- * locale is used. Thus, even if for example the default binding of the "en"
- * language is "US", if the current locale has language="en" and the country
- * for that locale is "GB", then "GB" will be used.
- */
- private static Map<String, String> sLanguageToCountry = Maps.newHashMapWithExpectedSize(177);
- /** Names of the various languages according to ISO 639-1 */
- private static Map<String, String> sLanguageNames = Maps.newHashMapWithExpectedSize(187);
- /** Names of the various regions according to ISO 3166-1 */
- private static Map<String, String> sRegionNames = Maps.newHashMapWithExpectedSize(249);
-
- /**
- * Returns the empty flag icon used to indicate an unknown country
- *
- * @return the globe icon used to indicate an unknown country
- */
- public static Image getEmptyIcon() {
- return DesignerPlugin.getImage("nls/flags/flag_empty.png"); //$NON-NLS-1$
- }
-
- /**
- * Returns the globe icon used to indicate "any" language
- *
- * @return the globe icon used to indicate "any" language
- */
- public static Image getGlobeIcon() {
- return IconFactory.getInstance().getIcon("globe"); //$NON-NLS-1$
- }
-
- /**
- * Returns the flag for the given language and region.
- *
- * @param language the language, or null (if null, region must not be null),
- * the 2 letter language code (ISO 639-1), in lower case
- * @param region the region, or null (if null, language must not be null),
- * the 2 letter region code (ISO 3166-1 alpha-2), in upper case
- * @return a suitable flag icon, or null
- */
- @Nullable
- public Image getFlag(@Nullable String language, @Nullable String region) {
- assert region != null || language != null;
- if (region == null || region.isEmpty()) {
- // Look up the region for a given language
- assert language != null;
-
- // Prefer the local registration of the current locale; even if
- // for example the default locale for English is the US, if the current
- // default locale is English, then use its associated country, which could
- // for example be Australia.
- Locale locale = Locale.getDefault();
- if (language.equals(locale.getLanguage())) {
- Image flag = getFlag(locale.getCountry());
- if (flag != null) {
- return flag;
- }
- }
-
- // Special cases where we have a dedicated flag available:
- if (language.equals("ca")) { //$NON-NLS-1$
- region = "catalonia"; //$NON-NLS-1$
- } else if (language.equals("gd")) { //$NON-NLS-1$
- region = "scotland"; //$NON-NLS-1$
- } else if (language.equals("cy")) { //$NON-NLS-1$
- region = "wales"; //$NON-NLS-1$
- } else {
- // Attempt to look up the country from the language
- region = sLanguageToCountry.get(language);
- }
- }
-
- if (region == null || region.isEmpty()) {
- // No country specified, and the language is for a country we
- // don't have a flag for
- return null;
- }
-
- return getIcon(region);
- }
-
- /**
- * Returns the flag for the given language and region.
- *
- * @param language the language qualifier, or null (if null, region must not be null),
- * @param region the region, or null (if null, language must not be null),
- * @return a suitable flag icon, or null
- */
- public Image getFlag(LanguageQualifier language, RegionQualifier region) {
- String languageCode = language != null ? language.getValue() : null;
- String regionCode = region != null ? region.getValue() : null;
- if (LanguageQualifier.FAKE_LANG_VALUE.equals(languageCode)) {
- languageCode = null;
- }
- if (RegionQualifier.FAKE_REGION_VALUE.equals(regionCode)) {
- regionCode = null;
- }
- return getFlag(languageCode, regionCode);
- }
-
- /**
- * Returns a flag for a given resource folder name (such as
- * {@code values-en-rUS}), or null
- *
- * @param folder the folder name
- * @return a corresponding flag icon, or null if none was found
- */
- @Nullable
- public Image getFlagForFolderName(@NonNull String folder) {
- RegionQualifier region = null;
- LanguageQualifier language = null;
- for (String qualifier : Splitter.on('-').split(folder)) {
- if (qualifier.length() == 3) {
- region = RegionQualifier.getQualifier(qualifier);
- if (region != null) {
- break;
- }
- } else if (qualifier.length() == 2 && language == null) {
- language = LanguageQualifier.getQualifier(qualifier);
- }
- }
- if (region != null || language != null) {
- return LocaleManager.get().getFlag(language, region);
- }
-
- return null;
- }
-
- /**
- * Returns the flag for the given region.
- *
- * @param region the 2 letter region code (ISO 3166-1 alpha-2), in upper case
- * @return a suitable flag icon, or null
- */
- @Nullable
- public Image getFlag(@NonNull String region) {
- assert region.length() == 2
- && Character.isUpperCase(region.charAt(0))
- && Character.isUpperCase(region.charAt(1)) : region;
-
- return getIcon(region);
- }
-
- private Image getIcon(@NonNull String base) {
- Image flagImage = mImageMap.get(base);
- if (flagImage == null) {
- // TODO: Special case locale currently running on system such
- // that the current country matches the current locale
- if (mImageMap.containsKey(base)) {
- // Already checked: there's just no image there
- return null;
- }
- String flagFileName = base.toLowerCase(Locale.US) + ".png"; //$NON-NLS-1$
- flagImage = DesignerPlugin.getImage("nls/flags/" + flagFileName); //$NON-NLS-1$
- mImageMap.put(base, flagImage);
- }
-
- return flagImage;
- }
-
- /**
- * Returns the name of the given region for a 2 letter region code, in English.
- *
- * @param regionCode the 2 letter region code (ISO 3166-1 alpha-2)
- * @return the name of the given region for a region code, in English, or
- * null if not known
- */
- @Nullable
- public static String getRegionName(@NonNull String regionCode) {
- assert regionCode.length() == 2
- && Character.isUpperCase(regionCode.charAt(0))
- && Character.isUpperCase(regionCode.charAt(1)) : regionCode;
-
- return sRegionNames.get(regionCode);
- }
-
- /**
- * Returns the name of the given language for a language code, in English.
- *
- * @param languageCode the 2 letter language code (ISO 639-1)
- * @return the name of the given language for a language code, in English, or
- * null if not known
- */
- @Nullable
- public static String getLanguageName(@NonNull String languageCode) {
- assert languageCode.length() == 2
- && Character.isLowerCase(languageCode.charAt(0))
- && Character.isLowerCase(languageCode.charAt(1)) : languageCode;
-
- return sLanguageNames.get(languageCode);
- }
-
- /**
- * Returns all the known language codes
- *
- * @return all the known language codes
- */
- @NonNull
- public static Set<String> getLanguageCodes() {
- return Collections.unmodifiableSet(sLanguageNames.keySet());
- }
-
- /**
- * Returns all the known region codes
- *
- * @return all the known region codes
- */
- @NonNull
- public static Set<String> getRegionCodes() {
- return Collections.unmodifiableSet(sRegionNames.keySet());
- }
-
- /**
- * Populate the various maps.
- * <p>
- * The language to region mapping was constructed by using the ISO 639-1 table from
- * http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
- * and for each language, looking up the corresponding Wikipedia entry
- * and picking the first mentioned or in some cases largest country where
- * the language is spoken, then mapping that back to the corresponding ISO 3166-1
- * code.
- */
- static {
- // Afar -> Ethiopia
- sLanguageToCountry.put("aa", "ET"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("aa", "Afar"); //$NON-NLS-1$
-
- // "ab": Abkhaz -> Abkhazia, Georgia
- sLanguageToCountry.put("ab", "GE"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ab", "Abkhaz"); //$NON-NLS-1$
-
- // "af": Afrikaans -> South Africa, Namibia
- sLanguageToCountry.put("af", "ZA"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("af", "Afrikaans"); //$NON-NLS-1$
-
- // "ak": Akan -> Ghana, Ivory Coast
- sLanguageToCountry.put("ak", "GH"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ak", "Akan"); //$NON-NLS-1$
-
- // "am": Amharic -> Ethiopia
- sLanguageToCountry.put("am", "ET"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("am", "Amharic"); //$NON-NLS-1$
-
- // "an": Aragonese -> Aragon in Spain
- sLanguageToCountry.put("an", "ES"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("an", "Aragonese"); //$NON-NLS-1$
-
- // "ar": Arabic -> United Arab Emirates, Kuwait, Oman, Saudi Arabia, Qatar, and Bahrain
- sLanguageToCountry.put("ar", "AE"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ar", "Arabic"); //$NON-NLS-1$
-
- // "as": Assamese -> India
- sLanguageToCountry.put("as", "IN"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("as", "Assamese"); //$NON-NLS-1$
-
- // "av": Avaric -> Azerbaijan
- sLanguageToCountry.put("av", "AZ"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("av", "Avaric"); //$NON-NLS-1$
-
- // "ay": Aymara -> Bolivia
- sLanguageToCountry.put("ay", "BO"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ay", "Aymara"); //$NON-NLS-1$
-
- // "az": Azerbaijani -> Azerbaijan
- sLanguageToCountry.put("az", "AZ"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("az", "Azerbaijani"); //$NON-NLS-1$
-
- // "ba": Bashkir -> Russia
- sLanguageToCountry.put("ba", "RU"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ba", "Bashkir"); //$NON-NLS-1$
-
- // "be": Belarusian -> Belarus
- sLanguageToCountry.put("be", "BY"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("be", "Belarusian"); //$NON-NLS-1$
-
- // "bg": Bulgarian -> Bulgaria
- sLanguageToCountry.put("bg", "BG"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("bg", "Bulgarian"); //$NON-NLS-1$
-
- // "bh": Bihari languages -> India, Nepal
- sLanguageToCountry.put("bh", "IN"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("bh", "Bihari languages"); //$NON-NLS-1$
-
- // "bi": Bislama -> Vanatu
- sLanguageToCountry.put("bi", "VU"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("bi", "Bislama"); //$NON-NLS-1$
-
- // "bm": Bambara -> Mali
- sLanguageToCountry.put("bm", "ML"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("bm", "Bambara"); //$NON-NLS-1$
-
- // "bn": Bengali -> Bangladesh, India
- sLanguageToCountry.put("bn", "BD"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("bn", "Bengali"); //$NON-NLS-1$
-
- // "bo": Tibetan -> China
- sLanguageToCountry.put("bo", "CN"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("bo", "Tibetan"); //$NON-NLS-1$
-
- // "br": Breton -> France
- sLanguageToCountry.put("br", "FR"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("br", "Breton"); //$NON-NLS-1$
-
- // "bs": Bosnian -> Bosnia and Herzegovina
- sLanguageToCountry.put("bs", "BA"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("bs", "Bosnian"); //$NON-NLS-1$
-
- // "ca": Catalan -> Andorra, Catalonia
- sLanguageToCountry.put("ca", "AD"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ca", "Catalan"); //$NON-NLS-1$
-
- // "ce": Chechen -> Russia
- sLanguageToCountry.put("ce", "RU"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ce", "Chechen"); //$NON-NLS-1$
-
- // "ch": Chamorro -> Guam, Northern Mariana Islands
- sLanguageToCountry.put("ch", "GU"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ch", "Chamorro"); //$NON-NLS-1$
-
- // "co": Corsican -> France
- sLanguageToCountry.put("co", "FR"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("co", "Corsican"); //$NON-NLS-1$
-
- // "cr": Cree -> Canada and United States
- sLanguageToCountry.put("cr", "CA"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("cr", "Cree"); //$NON-NLS-1$
-
- // "cs": Czech -> Czech Republic
- sLanguageToCountry.put("cs", "CZ"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("cs", "Czech"); //$NON-NLS-1$
-
- // "cv": Chuvash -> Russia, Kazakhstan, Ukraine, Uzbekistan...
- sLanguageToCountry.put("cv", "RU"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("cv", "Chuvash"); //$NON-NLS-1$
-
- // "cy": Welsh -> Wales (no 3166 code; using GB)
- sLanguageToCountry.put("cy", "GB"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("cy", "Welsh"); //$NON-NLS-1$
-
- // "da": Danish -> Denmark
- sLanguageToCountry.put("da", "DK"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("da", "Danish"); //$NON-NLS-1$
-
- // "de": German -> Germany
- sLanguageToCountry.put("de", "DE"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("de", "German"); //$NON-NLS-1$
-
- // "dv": Divehi -> Maldives
- sLanguageToCountry.put("dv", "MV"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("dv", "Divehi"); //$NON-NLS-1$
-
- // "dz": Dzongkha -> Bhutan
- sLanguageToCountry.put("dz", "BT"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("dz", "Dzongkha"); //$NON-NLS-1$
-
- // "ee": Ewe -> Ghana, Togo
- sLanguageToCountry.put("ee", "GH"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ee", "Ewe"); //$NON-NLS-1$
-
- // "el": Greek -> Greece
- sLanguageToCountry.put("el", "GR"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("el", "Greek"); //$NON-NLS-1$
-
- // "en": English -> United States, United Kingdom, Australia, ...
- sLanguageToCountry.put("en", "US"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("en", "English"); //$NON-NLS-1$
-
- // "es": Spanish -> Spain, Mexico, ...
- sLanguageToCountry.put("es", "ES"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("es", "Spanish"); //$NON-NLS-1$
-
- // "et": Estonian ->
- sLanguageToCountry.put("et", "EE"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("et", "Estonian"); //$NON-NLS-1$
-
- // "eu": Basque -> Spain, France
- sLanguageToCountry.put("eu", "ES"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("eu", "Basque"); //$NON-NLS-1$
-
- // "fa": Persian -> Iran, Afghanistan
- sLanguageToCountry.put("fa", "IR"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("fa", "Persian"); //$NON-NLS-1$
-
- // "ff": Fulah -> Mauritania, Senegal, Mali, Guinea, Burkina Faso, ...
- sLanguageToCountry.put("ff", "MR"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ff", "Fulah"); //$NON-NLS-1$
-
- // "fi": Finnish -> Finland
- sLanguageToCountry.put("fi", "FI"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("fi", "Finnish"); //$NON-NLS-1$
-
- // "fj": Fijian -> Fiji
- sLanguageToCountry.put("fj", "FJ"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("fj", "Fijian"); //$NON-NLS-1$
-
- // "fo": Faroese -> Denmark
- sLanguageToCountry.put("fo", "DK"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("fo", "Faroese"); //$NON-NLS-1$
-
- // "fr": French -> France
- sLanguageToCountry.put("fr", "FR"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("fr", "French"); //$NON-NLS-1$
-
- // "fy": Western Frisian -> Netherlands
- sLanguageToCountry.put("fy", "NL"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("fy", "Western Frisian"); //$NON-NLS-1$
-
- // "ga": Irish -> Ireland
- sLanguageToCountry.put("ga", "IE"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ga", "Irish"); //$NON-NLS-1$
-
- // "gd": Gaelic -> Scotland
- sLanguageToCountry.put("gd", "GB"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("gd", "Gaelic"); //$NON-NLS-1$
-
- // "gl": Galician -> Galicia/Spain
- sLanguageToCountry.put("gl", "ES"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("gl", "Galician"); //$NON-NLS-1$
-
- // "gn": Guaraní -> Paraguay
- sLanguageToCountry.put("gn", "PY"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("gn", "Guaran\u00ed" /*Guaraní*/); //$NON-NLS-1$
-
- // "gu": Gujarati -> India
- sLanguageToCountry.put("gu", "IN"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("gu", "Gujarati"); //$NON-NLS-1$
-
- // "gv": Manx -> Isle of Man
- // We don't have an icon for IM
- //sLanguageToCountry.put("gv", "IM"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("gv", "Manx"); //$NON-NLS-1$
-
- // "ha": Hausa -> Nigeria, Niger
- sLanguageToCountry.put("ha", "NG"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ha", "Hausa"); //$NON-NLS-1$
-
- // "he": Hebrew -> Israel
- sLanguageToCountry.put("he", "IL"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("he", "Hebrew"); //$NON-NLS-1$
-
- // "hi": Hindi -> India
- sLanguageToCountry.put("hi", "IN"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("hi", "Hindi"); //$NON-NLS-1$
-
- // "ho": Hiri Motu -> Papua New Guinea
- sLanguageToCountry.put("ho", "PG"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ho", "Hiri Motu"); //$NON-NLS-1$
-
- // "hr": Croatian ->
- sLanguageToCountry.put("hr", "HR"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("hr", "Croatian"); //$NON-NLS-1$
-
- // "ht": Haitian -> Haiti
- sLanguageToCountry.put("ht", "HT"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ht", "Haitian"); //$NON-NLS-1$
-
- // "hu": Hungarian -> Hungary
- sLanguageToCountry.put("hu", "HU"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("hu", "Hungarian"); //$NON-NLS-1$
-
- // "hy": Armenian -> Armenia
- sLanguageToCountry.put("hy", "AM"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("hy", "Armenian"); //$NON-NLS-1$
-
- // "hz": Herero -> Namibia, Botswana
- sLanguageToCountry.put("hz", "NA"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("hz", "Herero"); //$NON-NLS-1$
-
- // "id": Indonesian -> Indonesia
- sLanguageToCountry.put("id", "ID"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("id", "Indonesian"); //$NON-NLS-1$
-
- // "ig": Igbo ->
- sLanguageToCountry.put("ig", "NG"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ig", "Igbo"); //$NON-NLS-1$
-
- // "ii": Nuosu -> China
- sLanguageToCountry.put("ii", "CN"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ii", "Nuosu"); //$NON-NLS-1$
-
- // "ik": Inupiaq -> USA
- sLanguageToCountry.put("ik", "US"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ik", "Inupiaq"); //$NON-NLS-1$
-
- // "is": Icelandic -> Iceland
- sLanguageToCountry.put("is", "IS"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("is", "Icelandic"); //$NON-NLS-1$
-
- // "it": Italian -> Italy
- sLanguageToCountry.put("it", "IT"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("it", "Italian"); //$NON-NLS-1$
-
- // "iu": Inuktitut -> Canada
- sLanguageToCountry.put("iu", "CA"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("iu", "Inuktitut"); //$NON-NLS-1$
-
- // "ja": Japanese -> Japan
- sLanguageToCountry.put("ja", "JP"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ja", "Japanese"); //$NON-NLS-1$
-
- // "jv": Javanese -> Indonesia
- sLanguageToCountry.put("jv", "ID"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("jv", "Javanese"); //$NON-NLS-1$
-
- // "ka": Georgian -> Georgia
- sLanguageToCountry.put("ka", "GE"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ka", "Georgian"); //$NON-NLS-1$
-
- // "kg": Kongo -> Angola, Congo
- sLanguageToCountry.put("kg", "AO"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("kg", "Kongo"); //$NON-NLS-1$
-
- // "ki": Kikuyu -> Kenya
- sLanguageToCountry.put("ki", "KE"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ki", "Kikuyu"); //$NON-NLS-1$
-
- // "kj": Kwanyama -> Angola, Namibia
- sLanguageToCountry.put("kj", "AO"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("kj", "Kwanyama"); //$NON-NLS-1$
-
- // "kk": Kazakh -> Kazakhstan
- sLanguageToCountry.put("kk", "KZ"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("kk", "Kazakh"); //$NON-NLS-1$
-
- // "kl": Kalaallisut -> Denmark
- sLanguageToCountry.put("kl", "DK"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("kl", "Kalaallisut"); //$NON-NLS-1$
-
- // "km": Khmer -> Cambodia
- sLanguageToCountry.put("km", "KH"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("km", "Khmer"); //$NON-NLS-1$
-
- // "kn": Kannada -> India
- sLanguageToCountry.put("kn", "IN"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("kn", "Kannada"); //$NON-NLS-1$
-
- // "ko": Korean -> Korea
- sLanguageToCountry.put("ko", "KR"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ko", "Korean"); //$NON-NLS-1$
-
- // "kr": Kanuri -> Nigeria
- sLanguageToCountry.put("kr", "NG"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("kr", "Kanuri"); //$NON-NLS-1$
-
- // "ks": Kashmiri -> India
- sLanguageToCountry.put("ks", "IN"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ks", "Kashmiri"); //$NON-NLS-1$
-
- // "ku": Kurdish -> Turkey, Iran, Iraq, Syria, Armenia, Azerbaijan
- sLanguageToCountry.put("ku", "TR"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ku", "Kurdish"); //$NON-NLS-1$
-
- // "kv": Komi -> Russia
- sLanguageToCountry.put("kv", "RU"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("kv", "Komi"); //$NON-NLS-1$
-
- // "kw": Cornish -> UK
- sLanguageToCountry.put("kw", "GB"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("kw", "Cornish"); //$NON-NLS-1$
-
- // "ky": Kyrgyz -> Kyrgyzstan
- sLanguageToCountry.put("ky", "KG"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ky", "Kyrgyz"); //$NON-NLS-1$
-
- // "lb": Luxembourgish -> Luxembourg
- sLanguageToCountry.put("lb", "LU"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("lb", "Luxembourgish"); //$NON-NLS-1$
-
- // "lg": Ganda -> Uganda
- sLanguageToCountry.put("lg", "UG"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("lg", "Ganda"); //$NON-NLS-1$
-
- // "li": Limburgish -> Netherlands
- sLanguageToCountry.put("li", "NL"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("li", "Limburgish"); //$NON-NLS-1$
-
- // "ln": Lingala -> Congo
- sLanguageToCountry.put("ln", "CD"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ln", "Lingala"); //$NON-NLS-1$
-
- // "lo": Lao -> Laos
- sLanguageToCountry.put("lo", "LA"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("lo", "Lao"); //$NON-NLS-1$
-
- // "lt": Lithuanian -> Lithuania
- sLanguageToCountry.put("lt", "LT"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("lt", "Lithuanian"); //$NON-NLS-1$
-
- // "lu": Luba-Katanga -> Congo
- sLanguageToCountry.put("lu", "CD"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("lu", "Luba-Katanga"); //$NON-NLS-1$
-
- // "lv": Latvian -> Latvia
- sLanguageToCountry.put("lv", "LV"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("lv", "Latvian"); //$NON-NLS-1$
-
- // "mg": Malagasy -> Madagascar
- sLanguageToCountry.put("mg", "MG"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("mg", "Malagasy"); //$NON-NLS-1$
-
- // "mh": Marshallese -> Marshall Islands
- sLanguageToCountry.put("mh", "MH"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("mh", "Marshallese"); //$NON-NLS-1$
-
- // "mi": Maori -> New Zealand
- sLanguageToCountry.put("mi", "NZ"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("mi", "M\u0101ori"); //$NON-NLS-1$
-
- // "mk": Macedonian -> Macedonia
- sLanguageToCountry.put("mk", "MK"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("mk", "Macedonian"); //$NON-NLS-1$
-
- // "ml": Malayalam -> India
- sLanguageToCountry.put("ml", "IN"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ml", "Malayalam"); //$NON-NLS-1$
-
- // "mn": Mongolian -> Mongolia
- sLanguageToCountry.put("mn", "MN"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("mn", "Mongolian"); //$NON-NLS-1$
-
- // "mr": Marathi -> India
- sLanguageToCountry.put("mr", "IN"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("mr", "Marathi"); //$NON-NLS-1$
-
- // "ms": Malay -> Malaysia, Indonesia ...
- sLanguageToCountry.put("ms", "MY"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ms", "Malay"); //$NON-NLS-1$
-
- // "mt": Maltese -> Malta
- sLanguageToCountry.put("mt", "MT"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("mt", "Maltese"); //$NON-NLS-1$
-
- // "my": Burmese -> Myanmar
- sLanguageToCountry.put("my", "MM"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("my", "Burmese"); //$NON-NLS-1$
-
- // "na": Nauru -> Nauru
- sLanguageToCountry.put("na", "NR"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("na", "Nauru"); //$NON-NLS-1$
-
- // "nb": Norwegian -> Norway
- sLanguageToCountry.put("nb", "NO"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("nb", "Norwegian Bokm\u00e5l" /*Norwegian Bokmål*/); //$NON-NLS-1$
-
- // "nd": North Ndebele -> Zimbabwe
- sLanguageToCountry.put("nd", "ZW"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("nd", "North Ndebele"); //$NON-NLS-1$
-
- // "ne": Nepali -> Nepal
- sLanguageToCountry.put("ne", "NP"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ne", "Nepali"); //$NON-NLS-1$
-
- // "ng":Ndonga -> Namibia
- sLanguageToCountry.put("ng", "NA"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ng", "Ndonga"); //$NON-NLS-1$
-
- // "nl": Dutch -> Netherlands
- sLanguageToCountry.put("nl", "NL"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("nl", "Dutch"); //$NON-NLS-1$
-
- // "nn": Norwegian Nynorsk -> Norway
- sLanguageToCountry.put("nn", "NO"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("nn", "Norwegian Nynorsk"); //$NON-NLS-1$
-
- // "no": Norwegian -> Norway
- sLanguageToCountry.put("no", "NO"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("no", "Norwegian"); //$NON-NLS-1$
-
- // "nr": South Ndebele -> South Africa
- sLanguageToCountry.put("nr", "ZA"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("nr", "South Ndebele"); //$NON-NLS-1$
-
- // "nv": Navajo -> USA
- sLanguageToCountry.put("nv", "US"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("nv", "Navajo"); //$NON-NLS-1$
-
- // "ny": Chichewa -> Malawi, Zambia
- sLanguageToCountry.put("ny", "MW"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ny", "Chichewa"); //$NON-NLS-1$
-
- // "oc": Occitan -> France, Italy, Spain, Monaco
- sLanguageToCountry.put("oc", "FR"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("oc", "Occitan"); //$NON-NLS-1$
-
- // "oj": Ojibwe -> Canada, United States
- sLanguageToCountry.put("oj", "CA"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("oj", "Ojibwe"); //$NON-NLS-1$
-
- // "om": Oromo -> Ethiopia
- sLanguageToCountry.put("om", "ET"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("om", "Oromo"); //$NON-NLS-1$
-
- // "or": Oriya -> India
- sLanguageToCountry.put("or", "IN"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("or", "Oriya"); //$NON-NLS-1$
-
- // "os": Ossetian -> Russia (North Ossetia), Georgia
- sLanguageToCountry.put("os", "RU"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("os", "Ossetian"); //$NON-NLS-1$
-
- // "pa": Panjabi, -> Pakistan, India
- sLanguageToCountry.put("pa", "PK"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("pa", "Panjabi"); //$NON-NLS-1$
-
- // "pl": Polish -> Poland
- sLanguageToCountry.put("pl", "PL"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("pl", "Polish"); //$NON-NLS-1$
-
- // "ps": Pashto -> Afghanistan, Pakistan
- sLanguageToCountry.put("ps", "AF"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ps", "Pashto"); //$NON-NLS-1$
-
- // "pt": Portuguese -> Brazil, Portugal, ...
- sLanguageToCountry.put("pt", "BR"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("pt", "Portuguese"); //$NON-NLS-1$
-
- // "qu": Quechua -> Peru, Bolivia
- sLanguageToCountry.put("qu", "PE"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("qu", "Quechua"); //$NON-NLS-1$
-
- // "rm": Romansh -> Switzerland
- sLanguageToCountry.put("rm", "CH"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("rm", "Romansh"); //$NON-NLS-1$
-
- // "rn": Kirundi -> Burundi, Uganda
- sLanguageToCountry.put("rn", "BI"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("rn", "Kirundi"); //$NON-NLS-1$
-
- // "ro": Romanian -> Romania, Republic of Moldova
- sLanguageToCountry.put("ro", "RO"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ro", "Romanian"); //$NON-NLS-1$
-
- // "ru": Russian -> Russia
- sLanguageToCountry.put("ru", "RU"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ru", "Russian"); //$NON-NLS-1$
-
- // "rw": Kinyarwanda -> Rwanda, Uganda, Democratic Republic of the Congo
- sLanguageToCountry.put("rw", "RW"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("rw", "Kinyarwanda"); //$NON-NLS-1$
-
- // "sa": Sanskrit -> India
- sLanguageToCountry.put("sa", "IN"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("sa", "Sanskrit"); //$NON-NLS-1$
-
- // "sc": Sardinian -> Italy
- sLanguageToCountry.put("sc", "IT"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("sc", "Sardinian"); //$NON-NLS-1$
-
- // "sd": Sindhi -> Pakistan, India
- sLanguageToCountry.put("sd", "PK"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("sd", "Sindhi"); //$NON-NLS-1$
-
- // "se": Northern Sami -> Norway, Sweden, Finland
- sLanguageToCountry.put("se", "NO"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("se", "Northern Sami"); //$NON-NLS-1$
-
- // "sg": Sango -> Central African Republic
- sLanguageToCountry.put("sg", "CF"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("sg", "Sango"); //$NON-NLS-1$
-
- // "si": Sinhala -> Sri Lanka
- sLanguageToCountry.put("si", "LK"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("si", "Sinhala"); //$NON-NLS-1$
-
- // "sk": Slovak -> Slovakia
- sLanguageToCountry.put("sk", "SK"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("sk", "Slovak"); //$NON-NLS-1$
-
- // "sl": Slovene -> Slovenia
- sLanguageToCountry.put("sl", "SI"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("sl", "Slovene"); //$NON-NLS-1$
-
- // "sm": Samoan -> Samoa
- sLanguageToCountry.put("sm", "WS"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("sm", "Samoan"); //$NON-NLS-1$
-
- // "sn": Shona -> Zimbabwe
- sLanguageToCountry.put("sn", "ZW"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("sn", "Shona"); //$NON-NLS-1$
-
- // "so": Somali -> Somalia
- sLanguageToCountry.put("so", "SO"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("so", "Somali"); //$NON-NLS-1$
-
- // "sq": Albanian -> Albania
- sLanguageToCountry.put("sq", "AL"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("sq", "Albanian"); //$NON-NLS-1$
-
- // "sr": Serbian -> Serbia, Bosnia and Herzegovina
- sLanguageToCountry.put("sr", "RS"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("sr", "Serbian"); //$NON-NLS-1$
-
- // "ss": Swati -> Swaziland
- sLanguageToCountry.put("ss", "SZ"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ss", "Swati"); //$NON-NLS-1$
-
- // "st": Southern Sotho -> Lesotho, South Africa
- sLanguageToCountry.put("st", "LS"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("st", "Southern Sotho"); //$NON-NLS-1$
-
- // "su": Sundanese -> Indoniesia
- sLanguageToCountry.put("su", "ID"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("su", "Sundanese"); //$NON-NLS-1$
-
- // "sv": Swedish -> Sweden
- sLanguageToCountry.put("sv", "SE"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("sv", "Swedish"); //$NON-NLS-1$
-
- // "sw": Swahili -> Tanzania, Kenya, and Congo (DRC)
- sLanguageToCountry.put("sw", "TZ"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("sw", "Swahili"); //$NON-NLS-1$
-
- // "ta": Tamil -> India, Sri Lanka
- sLanguageToCountry.put("ta", "IN"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ta", "Tamil"); //$NON-NLS-1$
-
- // "te": Telugu -> India
- sLanguageToCountry.put("te", "IN"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("te", "Telugu"); //$NON-NLS-1$
-
- // "tg": Tajik -> Tajikistan, Uzbekistan, Russia, Afghanistan
- sLanguageToCountry.put("tg", "TJ"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("tg", "Tajik"); //$NON-NLS-1$
-
- // "th": Thai -> Thailand
- sLanguageToCountry.put("th", "TH"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("th", "Thai"); //$NON-NLS-1$
-
- // "ti": Tigrinya -> Eritrea, Ethiopia
- sLanguageToCountry.put("ti", "ER"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ti", "Tigrinya"); //$NON-NLS-1$
-
- // "tk": Turkmen -> Turkmenistan
- sLanguageToCountry.put("tk", "TM"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("tk", "Turkmen"); //$NON-NLS-1$
-
- // "tl": Tagalog -> Philippines
- sLanguageToCountry.put("tl", "PH"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("tl", "Tagalog"); //$NON-NLS-1$
-
- // "tn": Tswana -> Botswana, South Africa,
- sLanguageToCountry.put("tn", "BW"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("tn", "Tswana"); //$NON-NLS-1$
-
- // "to": Tonga -> Tonga
- sLanguageToCountry.put("to", "TO"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("to", "Tonga"); //$NON-NLS-1$
-
- // "tr": Turkish -> Turkey
- sLanguageToCountry.put("tr", "TR"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("tr", "Turkish"); //$NON-NLS-1$
-
- // "ts": Tsonga -> Mozambique, South Africa
- sLanguageToCountry.put("ts", "MZ"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ts", "Tsonga"); //$NON-NLS-1$
-
- // "tt": Tatar -> Russia
- sLanguageToCountry.put("tt", "RU"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("tt", "Tatar"); //$NON-NLS-1$
-
- // "tw": Twi -> Ghana, Ivory Coast
- sLanguageToCountry.put("tw", "GH"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("tw", "Twi"); //$NON-NLS-1$
-
- // "ty": Tahitian -> French Polynesia
- sLanguageToCountry.put("ty", "PF"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ty", "Tahitian"); //$NON-NLS-1$
-
- // "ug": Uighur -> China, Kazakhstan
- sLanguageToCountry.put("ug", "CN"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ug", "Uighur"); //$NON-NLS-1$
-
- // "uk": Ukrainian -> Ukraine
- sLanguageToCountry.put("uk", "UA"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("uk", "Ukrainian"); //$NON-NLS-1$
-
- // "ur": Urdu -> India, Pakistan
- sLanguageToCountry.put("ur", "IN"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ur", "Urdu"); //$NON-NLS-1$
-
- // "uz": Uzbek -> Uzbekistan
- sLanguageToCountry.put("uz", "UZ"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("uz", "Uzbek"); //$NON-NLS-1$
-
- // "ve": Venda -> South Africa, Zimbabwe
- sLanguageToCountry.put("ve", "ZA"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ve", "Venda"); //$NON-NLS-1$
-
- // "vi": Vietnamese -> Vietnam
- sLanguageToCountry.put("vi", "VN"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("vi", "Vietnamese"); //$NON-NLS-1$
-
- // "wa": Walloon -> Belgium, France
- sLanguageToCountry.put("wa", "BE"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("wa", "Walloon"); //$NON-NLS-1$
-
- // "wo": Wolof -> Senegal, Gambia, Mauritania
- sLanguageToCountry.put("wo", "SN"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("wo", "Wolof"); //$NON-NLS-1$
-
- // "xh": Xhosa -> South Africa, Lesotho
- sLanguageToCountry.put("xh", "ZA"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("xh", "Xhosa"); //$NON-NLS-1$
-
- // "yi": Yiddish -> United States, Israel, Argentina, Brazil, ...
- sLanguageToCountry.put("yi", "US"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("yi", "Yiddish"); //$NON-NLS-1$
-
- // "yo": Yorùbá -> Nigeria, Togo, Benin
- sLanguageToCountry.put("yo", "NG"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("yo", "Yor\u00f9b\u00e1" /*Yorùbá*/); //$NON-NLS-1$
-
- // "za": Zhuang -> China
- sLanguageToCountry.put("za", "CN"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("za", "Zhuang"); //$NON-NLS-1$
-
- // "zh": Chinese -> China, Taiwan, Singapore
- sLanguageToCountry.put("zh", "CN"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("zh", "Chinese"); //$NON-NLS-1$
-
- // "zu": Zulu -> South Africa
- sLanguageToCountry.put("zu", "ZA"); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("zu", "Zulu"); //$NON-NLS-1$
-
- // Region Name Map, ISO_3166-1, alpha-2
- sRegionNames.put("AD", "Andorra"); //$NON-NLS-1$
- sRegionNames.put("AE", "United Arab Emirates"); //$NON-NLS-1$
- sRegionNames.put("AF", "Afghanistan"); //$NON-NLS-1$
- sRegionNames.put("AG", "Antigua and Barbuda"); //$NON-NLS-1$
- sRegionNames.put("AI", "Anguilla"); //$NON-NLS-1$
- sRegionNames.put("AL", "Albania"); //$NON-NLS-1$
- sRegionNames.put("AM", "Armenia"); //$NON-NLS-1$
- sRegionNames.put("AO", "Angola"); //$NON-NLS-1$
- sRegionNames.put("AQ", "Antarctica"); //$NON-NLS-1$
- sRegionNames.put("AR", "Argentina"); //$NON-NLS-1$
- sRegionNames.put("AS", "American Samoa"); //$NON-NLS-1$
- sRegionNames.put("AT", "Austria"); //$NON-NLS-1$
- sRegionNames.put("AU", "Australia"); //$NON-NLS-1$
- sRegionNames.put("AW", "Aruba"); //$NON-NLS-1$
- sRegionNames.put("AX", "\u00c5land Islands" /*Ã…land Islands*/); //$NON-NLS-1$
- sRegionNames.put("AZ", "Azerbaijan"); //$NON-NLS-1$
- sRegionNames.put("BA", "Bosnia and Herzegovina"); //$NON-NLS-1$
- sRegionNames.put("BB", "Barbados"); //$NON-NLS-1$
- sRegionNames.put("BD", "Bangladesh"); //$NON-NLS-1$
- sRegionNames.put("BE", "Belgium"); //$NON-NLS-1$
- sRegionNames.put("BF", "Burkina Faso"); //$NON-NLS-1$
- sRegionNames.put("BG", "Bulgaria"); //$NON-NLS-1$
- sRegionNames.put("BH", "Bahrain"); //$NON-NLS-1$
- sRegionNames.put("BI", "Burundi"); //$NON-NLS-1$
- sRegionNames.put("BJ", "Benin"); //$NON-NLS-1$
- sRegionNames.put("BL", "Saint Barth\u00e9lemy" /*Saint Barthélemy*/); //$NON-NLS-1$
- sRegionNames.put("BM", "Bermuda"); //$NON-NLS-1$
- sRegionNames.put("BN", "Brunei Darussalam"); //$NON-NLS-1$
- sRegionNames.put("BO", "Bolivia, Plurinational State of"); //$NON-NLS-1$
- sRegionNames.put("BQ", "Bonaire, Sint Eustatius and Saba"); //$NON-NLS-1$
- sRegionNames.put("BR", "Brazil"); //$NON-NLS-1$
- sRegionNames.put("BS", "Bahamas"); //$NON-NLS-1$
- sRegionNames.put("BT", "Bhutan"); //$NON-NLS-1$
- sRegionNames.put("BV", "Bouvet Island"); //$NON-NLS-1$
- sRegionNames.put("BW", "Botswana"); //$NON-NLS-1$
- sRegionNames.put("BY", "Belarus"); //$NON-NLS-1$
- sRegionNames.put("BZ", "Belize"); //$NON-NLS-1$
- sRegionNames.put("CA", "Canada"); //$NON-NLS-1$
- sRegionNames.put("CC", "Cocos (Keeling) Islands"); //$NON-NLS-1$
- sRegionNames.put("CD", "Congo, the Democratic Republic of the"); //$NON-NLS-1$
- sRegionNames.put("CF", "Central African Republic"); //$NON-NLS-1$
- sRegionNames.put("CG", "Congo"); //$NON-NLS-1$
- sRegionNames.put("CH", "Switzerland"); //$NON-NLS-1$
- sRegionNames.put("CI", "C\u00f4te d'Ivoire" /*Côte d'Ivoire*/); //$NON-NLS-1$
- sRegionNames.put("CK", "Cook Islands"); //$NON-NLS-1$
- sRegionNames.put("CL", "Chile"); //$NON-NLS-1$
- sRegionNames.put("CM", "Cameroon"); //$NON-NLS-1$
- sRegionNames.put("CN", "China"); //$NON-NLS-1$
- sRegionNames.put("CO", "Colombia"); //$NON-NLS-1$
- sRegionNames.put("CR", "Costa Rica"); //$NON-NLS-1$
- sRegionNames.put("CU", "Cuba"); //$NON-NLS-1$
- sRegionNames.put("CV", "Cape Verde"); //$NON-NLS-1$
- sRegionNames.put("CW", "Cura\u00e7ao" /*Curaçao*/); //$NON-NLS-1$
- sRegionNames.put("CX", "Christmas Island"); //$NON-NLS-1$
- sRegionNames.put("CY", "Cyprus"); //$NON-NLS-1$
- sRegionNames.put("CZ", "Czech Republic"); //$NON-NLS-1$
- sRegionNames.put("DE", "Germany"); //$NON-NLS-1$
- sRegionNames.put("DJ", "Djibouti"); //$NON-NLS-1$
- sRegionNames.put("DK", "Denmark"); //$NON-NLS-1$
- sRegionNames.put("DM", "Dominica"); //$NON-NLS-1$
- sRegionNames.put("DO", "Dominican Republic"); //$NON-NLS-1$
- sRegionNames.put("DZ", "Algeria"); //$NON-NLS-1$
- sRegionNames.put("EC", "Ecuador"); //$NON-NLS-1$
- sRegionNames.put("EE", "Estonia"); //$NON-NLS-1$
- sRegionNames.put("EG", "Egypt"); //$NON-NLS-1$
- sRegionNames.put("EH", "Western Sahara"); //$NON-NLS-1$
- sRegionNames.put("ER", "Eritrea"); //$NON-NLS-1$
- sRegionNames.put("ES", "Spain"); //$NON-NLS-1$
- sRegionNames.put("ET", "Ethiopia"); //$NON-NLS-1$
- sRegionNames.put("FI", "Finland"); //$NON-NLS-1$
- sRegionNames.put("FJ", "Fiji"); //$NON-NLS-1$
- sRegionNames.put("FK", "Falkland Islands (Malvinas)"); //$NON-NLS-1$
- sRegionNames.put("FM", "Micronesia, Federated States of"); //$NON-NLS-1$
- sRegionNames.put("FO", "Faroe Islands"); //$NON-NLS-1$
- sRegionNames.put("FR", "France"); //$NON-NLS-1$
- sRegionNames.put("GA", "Gabon"); //$NON-NLS-1$
- sRegionNames.put("GB", "United Kingdom"); //$NON-NLS-1$
- sRegionNames.put("GD", "Grenada"); //$NON-NLS-1$
- sRegionNames.put("GE", "Georgia"); //$NON-NLS-1$
- sRegionNames.put("GF", "French Guiana"); //$NON-NLS-1$
- sRegionNames.put("GG", "Guernsey"); //$NON-NLS-1$
- sRegionNames.put("GH", "Ghana"); //$NON-NLS-1$
- sRegionNames.put("GI", "Gibraltar"); //$NON-NLS-1$
- sRegionNames.put("GL", "Greenland"); //$NON-NLS-1$
- sRegionNames.put("GM", "Gambia"); //$NON-NLS-1$
- sRegionNames.put("GN", "Guinea"); //$NON-NLS-1$
- sRegionNames.put("GP", "Guadeloupe"); //$NON-NLS-1$
- sRegionNames.put("GQ", "Equatorial Guinea"); //$NON-NLS-1$
- sRegionNames.put("GR", "Greece"); //$NON-NLS-1$
- sRegionNames.put("GS", "South Georgia and the South Sandwich Islands"); //$NON-NLS-1$
- sRegionNames.put("GT", "Guatemala"); //$NON-NLS-1$
- sRegionNames.put("GU", "Guam"); //$NON-NLS-1$
- sRegionNames.put("GW", "Guinea-Bissau"); //$NON-NLS-1$
- sRegionNames.put("GY", "Guyana"); //$NON-NLS-1$
- sRegionNames.put("HK", "Hong Kong"); //$NON-NLS-1$
- sRegionNames.put("HM", "Heard Island and McDonald Islands"); //$NON-NLS-1$
- sRegionNames.put("HN", "Honduras"); //$NON-NLS-1$
- sRegionNames.put("HR", "Croatia"); //$NON-NLS-1$
- sRegionNames.put("HT", "Haiti"); //$NON-NLS-1$
- sRegionNames.put("HU", "Hungary"); //$NON-NLS-1$
- sRegionNames.put("ID", "Indonesia"); //$NON-NLS-1$
- sRegionNames.put("IE", "Ireland"); //$NON-NLS-1$
- sRegionNames.put("IL", "Israel"); //$NON-NLS-1$
- sRegionNames.put("IM", "Isle of Man"); //$NON-NLS-1$
- sRegionNames.put("IN", "India"); //$NON-NLS-1$
- sRegionNames.put("IO", "British Indian Ocean Territory"); //$NON-NLS-1$
- sRegionNames.put("IQ", "Iraq"); //$NON-NLS-1$
- sRegionNames.put("IR", "Iran, Islamic Republic of"); //$NON-NLS-1$
- sRegionNames.put("IS", "Iceland"); //$NON-NLS-1$
- sRegionNames.put("IT", "Italy"); //$NON-NLS-1$
- sRegionNames.put("JE", "Jersey"); //$NON-NLS-1$
- sRegionNames.put("JM", "Jamaica"); //$NON-NLS-1$
- sRegionNames.put("JO", "Jordan"); //$NON-NLS-1$
- sRegionNames.put("JP", "Japan"); //$NON-NLS-1$
- sRegionNames.put("KE", "Kenya"); //$NON-NLS-1$
- sRegionNames.put("KG", "Kyrgyzstan"); //$NON-NLS-1$
- sRegionNames.put("KH", "Cambodia"); //$NON-NLS-1$
- sRegionNames.put("KI", "Kiribati"); //$NON-NLS-1$
- sRegionNames.put("KM", "Comoros"); //$NON-NLS-1$
- sRegionNames.put("KN", "Saint Kitts and Nevis"); //$NON-NLS-1$
- sRegionNames.put("KP", "Korea, Democratic People's Republic of"); //$NON-NLS-1$
- sRegionNames.put("KR", "Korea, Republic of"); //$NON-NLS-1$
- sRegionNames.put("KW", "Kuwait"); //$NON-NLS-1$
- sRegionNames.put("KY", "Cayman Islands"); //$NON-NLS-1$
- sRegionNames.put("KZ", "Kazakhstan"); //$NON-NLS-1$
- sRegionNames.put("LA", "Lao People's Democratic Republic"); //$NON-NLS-1$
- sRegionNames.put("LB", "Lebanon"); //$NON-NLS-1$
- sRegionNames.put("LC", "Saint Lucia"); //$NON-NLS-1$
- sRegionNames.put("LI", "Liechtenstein"); //$NON-NLS-1$
- sRegionNames.put("LK", "Sri Lanka"); //$NON-NLS-1$
- sRegionNames.put("LR", "Liberia"); //$NON-NLS-1$
- sRegionNames.put("LS", "Lesotho"); //$NON-NLS-1$
- sRegionNames.put("LT", "Lithuania"); //$NON-NLS-1$
- sRegionNames.put("LU", "Luxembourg"); //$NON-NLS-1$
- sRegionNames.put("LV", "Latvia"); //$NON-NLS-1$
- sRegionNames.put("LY", "Libya"); //$NON-NLS-1$
- sRegionNames.put("MA", "Morocco"); //$NON-NLS-1$
- sRegionNames.put("MC", "Monaco"); //$NON-NLS-1$
- sRegionNames.put("MD", "Moldova, Republic of"); //$NON-NLS-1$
- sRegionNames.put("ME", "Montenegro"); //$NON-NLS-1$
- sRegionNames.put("MF", "Saint Martin (French part)"); //$NON-NLS-1$
- sRegionNames.put("MG", "Madagascar"); //$NON-NLS-1$
- sRegionNames.put("MH", "Marshall Islands"); //$NON-NLS-1$
- sRegionNames.put("MK", "Macedonia, the former Yugoslav Republic of"); //$NON-NLS-1$
- sRegionNames.put("ML", "Mali"); //$NON-NLS-1$
- sRegionNames.put("MM", "Myanmar"); //$NON-NLS-1$
- sRegionNames.put("MN", "Mongolia"); //$NON-NLS-1$
- sRegionNames.put("MO", "Macao"); //$NON-NLS-1$
- sRegionNames.put("MP", "Northern Mariana Islands"); //$NON-NLS-1$
- sRegionNames.put("MQ", "Martinique"); //$NON-NLS-1$
- sRegionNames.put("MR", "Mauritania"); //$NON-NLS-1$
- sRegionNames.put("MS", "Montserrat"); //$NON-NLS-1$
- sRegionNames.put("MT", "Malta"); //$NON-NLS-1$
- sRegionNames.put("MU", "Mauritius"); //$NON-NLS-1$
- sRegionNames.put("MV", "Maldives"); //$NON-NLS-1$
- sRegionNames.put("MW", "Malawi"); //$NON-NLS-1$
- sRegionNames.put("MX", "Mexico"); //$NON-NLS-1$
- sRegionNames.put("MY", "Malaysia"); //$NON-NLS-1$
- sRegionNames.put("MZ", "Mozambique"); //$NON-NLS-1$
- sRegionNames.put("NA", "Namibia"); //$NON-NLS-1$
- sRegionNames.put("NC", "New Caledonia"); //$NON-NLS-1$
- sRegionNames.put("NE", "Niger"); //$NON-NLS-1$
- sRegionNames.put("NF", "Norfolk Island"); //$NON-NLS-1$
- sRegionNames.put("NG", "Nigeria"); //$NON-NLS-1$
- sRegionNames.put("NI", "Nicaragua"); //$NON-NLS-1$
- sRegionNames.put("NL", "Netherlands"); //$NON-NLS-1$
- sRegionNames.put("NO", "Norway"); //$NON-NLS-1$
- sRegionNames.put("NP", "Nepal"); //$NON-NLS-1$
- sRegionNames.put("NR", "Nauru"); //$NON-NLS-1$
- sRegionNames.put("NU", "Niue"); //$NON-NLS-1$
- sRegionNames.put("NZ", "New Zealand"); //$NON-NLS-1$
- sRegionNames.put("OM", "Oman"); //$NON-NLS-1$
- sRegionNames.put("PA", "Panama"); //$NON-NLS-1$
- sRegionNames.put("PE", "Peru"); //$NON-NLS-1$
- sRegionNames.put("PF", "French Polynesia"); //$NON-NLS-1$
- sRegionNames.put("PG", "Papua New Guinea"); //$NON-NLS-1$
- sRegionNames.put("PH", "Philippines"); //$NON-NLS-1$
- sRegionNames.put("PK", "Pakistan"); //$NON-NLS-1$
- sRegionNames.put("PL", "Poland"); //$NON-NLS-1$
- sRegionNames.put("PM", "Saint Pierre and Miquelon"); //$NON-NLS-1$
- sRegionNames.put("PN", "Pitcairn"); //$NON-NLS-1$
- sRegionNames.put("PR", "Puerto Rico"); //$NON-NLS-1$
- sRegionNames.put("PS", "Palestinian Territory, Occupied"); //$NON-NLS-1$
- sRegionNames.put("PT", "Portugal"); //$NON-NLS-1$
- sRegionNames.put("PW", "Palau"); //$NON-NLS-1$
- sRegionNames.put("PY", "Paraguay"); //$NON-NLS-1$
- sRegionNames.put("QA", "Qatar"); //$NON-NLS-1$
- sRegionNames.put("RE", "R\u00e9union" /*Réunion*/); //$NON-NLS-1$
- sRegionNames.put("RO", "Romania"); //$NON-NLS-1$
- sRegionNames.put("RS", "Serbia"); //$NON-NLS-1$
- sRegionNames.put("RU", "Russian Federation"); //$NON-NLS-1$
- sRegionNames.put("RW", "Rwanda"); //$NON-NLS-1$
- sRegionNames.put("SA", "Saudi Arabia"); //$NON-NLS-1$
- sRegionNames.put("SB", "Solomon Islands"); //$NON-NLS-1$
- sRegionNames.put("SC", "Seychelles"); //$NON-NLS-1$
- sRegionNames.put("SD", "Sudan"); //$NON-NLS-1$
- sRegionNames.put("SE", "Sweden"); //$NON-NLS-1$
- sRegionNames.put("SG", "Singapore"); //$NON-NLS-1$
- sRegionNames.put("SH", "Saint Helena, Ascension and Tristan da Cunha"); //$NON-NLS-1$
- sRegionNames.put("SI", "Slovenia"); //$NON-NLS-1$
- sRegionNames.put("SJ", "Svalbard and Jan Mayen"); //$NON-NLS-1$
- sRegionNames.put("SK", "Slovakia"); //$NON-NLS-1$
- sRegionNames.put("SL", "Sierra Leone"); //$NON-NLS-1$
- sRegionNames.put("SM", "San Marino"); //$NON-NLS-1$
- sRegionNames.put("SN", "Senegal"); //$NON-NLS-1$
- sRegionNames.put("SO", "Somalia"); //$NON-NLS-1$
- sRegionNames.put("SR", "Suriname"); //$NON-NLS-1$
- sRegionNames.put("SS", "South Sudan"); //$NON-NLS-1$
- sRegionNames.put("ST", "Sao Tome and Principe"); //$NON-NLS-1$
- sRegionNames.put("SV", "El Salvador"); //$NON-NLS-1$
- sRegionNames.put("SX", "Sint Maarten (Dutch part)"); //$NON-NLS-1$
- sRegionNames.put("SY", "Syrian Arab Republic"); //$NON-NLS-1$
- sRegionNames.put("SZ", "Swaziland"); //$NON-NLS-1$
- sRegionNames.put("TC", "Turks and Caicos Islands"); //$NON-NLS-1$
- sRegionNames.put("TD", "Chad"); //$NON-NLS-1$
- sRegionNames.put("TF", "French Southern Territories"); //$NON-NLS-1$
- sRegionNames.put("TG", "Togo"); //$NON-NLS-1$
- sRegionNames.put("TH", "Thailand"); //$NON-NLS-1$
- sRegionNames.put("TJ", "Tajikistan"); //$NON-NLS-1$
- sRegionNames.put("TK", "Tokelau"); //$NON-NLS-1$
- sRegionNames.put("TL", "Timor-Leste"); //$NON-NLS-1$
- sRegionNames.put("TM", "Turkmenistan"); //$NON-NLS-1$
- sRegionNames.put("TN", "Tunisia"); //$NON-NLS-1$
- sRegionNames.put("TO", "Tonga"); //$NON-NLS-1$
- sRegionNames.put("TR", "Turkey"); //$NON-NLS-1$
- sRegionNames.put("TT", "Trinidad and Tobago"); //$NON-NLS-1$
- sRegionNames.put("TV", "Tuvalu"); //$NON-NLS-1$
- sRegionNames.put("TW", "Taiwan, Province of China"); //$NON-NLS-1$
- sRegionNames.put("TZ", "Tanzania, United Republic of"); //$NON-NLS-1$
- sRegionNames.put("UA", "Ukraine"); //$NON-NLS-1$
- sRegionNames.put("UG", "Uganda"); //$NON-NLS-1$
- sRegionNames.put("UM", "United States Minor Outlying Islands"); //$NON-NLS-1$
- sRegionNames.put("US", "United States"); //$NON-NLS-1$
- sRegionNames.put("UY", "Uruguay"); //$NON-NLS-1$
- sRegionNames.put("UZ", "Uzbekistan"); //$NON-NLS-1$
- sRegionNames.put("VA", "Holy See (Vatican City State)"); //$NON-NLS-1$
- sRegionNames.put("VC", "Saint Vincent and the Grenadines"); //$NON-NLS-1$
- sRegionNames.put("VE", "Venezuela, Bolivarian Republic of"); //$NON-NLS-1$
- sRegionNames.put("VG", "Virgin Islands, British"); //$NON-NLS-1$
- sRegionNames.put("VI", "Virgin Islands, U.S."); //$NON-NLS-1$
- sRegionNames.put("VN", "Viet Nam"); //$NON-NLS-1$
- sRegionNames.put("VU", "Vanuatu"); //$NON-NLS-1$
- sRegionNames.put("WF", "Wallis and Futuna"); //$NON-NLS-1$
- sRegionNames.put("WS", "Samoa"); //$NON-NLS-1$
- sRegionNames.put("YE", "Yemen"); //$NON-NLS-1$
- sRegionNames.put("YT", "Mayotte"); //$NON-NLS-1$
- sRegionNames.put("ZA", "South Africa"); //$NON-NLS-1$
- sRegionNames.put("ZM", "Zambia"); //$NON-NLS-1$
- sRegionNames.put("ZW", "Zimbabwe"); //$NON-NLS-1$
-
- // Aliases
- // http://developer.android.com/reference/java/util/Locale.html
- // Apparently we're using some old aliases for some languages
- // The Hebrew ("he") language code is rewritten as "iw", Indonesian ("id") as "in",
- // and Yiddish ("yi") as "ji".
- sLanguageToCountry.put("iw", sLanguageToCountry.get("he")); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageToCountry.put("in", sLanguageToCountry.get("id")); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageToCountry.put("ji", sLanguageToCountry.get("yi")); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("iw", sLanguageNames.get("he")); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("in", sLanguageNames.get("id")); //$NON-NLS-1$ //$NON-NLS-2$
- sLanguageNames.put("ji", sLanguageNames.get("yi")); //$NON-NLS-1$ //$NON-NLS-2$
-
- // The following miscellaneous languages have no binding to a region
- // in sLanguageToCountry, since they are either extinct or constructed or
- // only in literary use:
- sLanguageNames.put("pi", "Pali"); //$NON-NLS-1$
- sLanguageNames.put("vo", "Volap\u00fck" /*Volapük*/); //$NON-NLS-1$
- sLanguageNames.put("eo", "Esperanto"); //$NON-NLS-1$
- sLanguageNames.put("la", "Latin"); //$NON-NLS-1$
- sLanguageNames.put("ia", "Interlingua"); //$NON-NLS-1$
- sLanguageNames.put("ie", "Interlingue"); //$NON-NLS-1$
- sLanguageNames.put("io", "Ido"); //$NON-NLS-1$
- sLanguageNames.put("ae", "Avestan"); //$NON-NLS-1$
- sLanguageNames.put("cu", "Church Slavic"); //$NON-NLS-1$
-
- // To check initial capacities of the maps and avoid dynamic resizing:
- //System.out.println("Language count = " + sLanguageNames.size());
- //System.out.println("Language Binding count = " + sLanguageToCountry.size());
- //System.out.println("Region count = " + sRegionNames.size());
- }
-
- @VisibleForTesting
- static Map<String, String> getLanguageToCountryMap() {
- return sLanguageToCountry;
- }
-
- @VisibleForTesting
- static Map<String, String> getLanguageNamesMap() {
- return sLanguageNames;
- }
-
- @VisibleForTesting
- static Map<String, String> getRegionNamesMap() {
- return sRegionNames;
- }
-}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/values/ValuesTreePage.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/values/ValuesTreePage.java
index b400457..224eb73 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/values/ValuesTreePage.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/values/ValuesTreePage.java
@@ -21,7 +21,7 @@ import com.android.ide.eclipse.adt.AdtPlugin;
import com.android.ide.eclipse.adt.internal.editors.IPageImageProvider;
import com.android.ide.eclipse.adt.internal.editors.IconFactory;
import com.android.ide.eclipse.adt.internal.editors.common.CommonXmlEditor;
-import com.android.ide.eclipse.adt.internal.editors.layout.configuration.LocaleManager;
+import com.android.ide.eclipse.adt.internal.editors.layout.configuration.FlagManager;
import com.android.ide.eclipse.adt.internal.editors.ui.tree.UiTreeBlock;
import com.android.ide.eclipse.adt.internal.editors.uimodel.UiElementNode;
import com.android.ide.eclipse.adt.internal.resources.manager.ResourceManager;
@@ -57,7 +57,7 @@ public final class ValuesTreePage extends FormPage implements IPageImageProvider
if (file != null) {
IContainer parent = file.getParent();
if (parent != null) {
- Image flag = LocaleManager.get().getFlagForFolderName(parent.getName());
+ Image flag = FlagManager.get().getFlagForFolderName(parent.getName());
if (flag != null) {
return flag;
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchController.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchController.java
index 4281f19..6818789 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchController.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/launch/AndroidLaunchController.java
@@ -1194,7 +1194,17 @@ public final class AndroidLaunchController implements IDebugBridgeChangeListener
String.format("Installation failed: Could not copy %1$s to its final location!",
launchInfo.getPackageFile().getName()),
"Please check logcat output for more details.");
- } else if (result.equals("INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES")) {
+ } else if (result.equals("INSTALL_PARSE_FAILED_INCONSISTENT_CERTIFICATES")) { //$NON-NLS-1$
+ if (retryMode != InstallRetryMode.NEVER) {
+ boolean prompt = AdtPlugin.displayPrompt("Application Install",
+ "Re-installation failed due to different application signatures. You must perform a full uninstall of the application. WARNING: This will remove the application data!\nDo you want to uninstall?");
+ if (prompt) {
+ doUninstall(device, launchInfo);
+ String res = doInstall(launchInfo, remotePath, device, false);
+ return checkInstallResult(res, device, launchInfo, remotePath,
+ InstallRetryMode.NEVER);
+ }
+ }
AdtPlugin.printErrorToConsole(launchInfo.getProject(),
"Re-installation failed due to different application signatures.",
"You must perform a full uninstall of the application. WARNING: This will remove the application data!",
@@ -1215,7 +1225,6 @@ public final class AndroidLaunchController implements IDebugBridgeChangeListener
* @return a {@link String} with an error code, or <code>null</code> if success.
* @throws InstallException if the installation failed.
*/
- @SuppressWarnings("unused")
private String doUninstall(IDevice device, DelayedLaunchInfo launchInfo)
throws InstallException {
try {
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/LintJob.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/LintJob.java
index bd1eb72..51fa2d1 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/LintJob.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/lint/LintJob.java
@@ -26,6 +26,7 @@ import com.android.ide.eclipse.adt.AdtPlugin;
import com.android.ide.eclipse.adt.AdtUtils;
import com.android.tools.lint.client.api.IssueRegistry;
import com.android.tools.lint.client.api.LintDriver;
+import com.android.tools.lint.client.api.LintRequest;
import com.android.tools.lint.detector.api.Issue;
import com.android.tools.lint.detector.api.Scope;
import com.android.utils.SdkUtils;
@@ -46,23 +47,33 @@ import java.util.EnumSet;
import java.util.List;
/** Job to check lint on a set of resources */
-final class LintJob extends Job {
+public final class LintJob extends Job {
/** Job family */
private static final Object FAMILY_RUN_LINT = new Object();
private final EclipseLintClient mClient;
private final List<? extends IResource> mResources;
private final IResource mSource;
+ private final IssueRegistry mRegistry;
private LintDriver mLint;
private boolean mFatal;
- LintJob(
+ public LintJob(
@NonNull EclipseLintClient client,
@NonNull List<? extends IResource> resources,
- @Nullable IResource source) {
+ @Nullable IResource source,
+ @NonNull IssueRegistry registry) {
super("Running Android Lint");
mClient = client;
mResources = resources;
mSource = source;
+ mRegistry = registry;
+ }
+
+ public LintJob(
+ @NonNull EclipseLintClient client,
+ @NonNull List<? extends IResource> resources,
+ @Nullable IResource source) {
+ this(client, resources, source, EclipseLintClient.getRegistry());
}
@Override
@@ -83,7 +94,6 @@ final class LintJob extends Job {
protected IStatus run(IProgressMonitor monitor) {
try {
monitor.beginTask("Looking for errors", IProgressMonitor.UNKNOWN);
- IssueRegistry registry = EclipseLintClient.getRegistry();
EnumSet<Scope> scope = null;
List<File> files = new ArrayList<File>(mResources.size());
for (IResource resource : mResources) {
@@ -136,7 +146,7 @@ final class LintJob extends Job {
IMarker[] markers = EclipseLintClient.getMarkers(mSource);
for (IMarker marker : markers) {
String id = marker.getAttribute(EclipseLintRunner.MARKER_CHECKID_PROPERTY, "");
- Issue issue = registry.getIssue(id);
+ Issue issue = mRegistry.getIssue(id);
if (issue == null) {
continue;
}
@@ -149,8 +159,8 @@ final class LintJob extends Job {
EclipseLintClient.clearMarkers(mResources);
}
- mLint = new LintDriver(registry, mClient);
- mLint.analyze(files, scope);
+ mLint = new LintDriver(mRegistry, mClient);
+ mLint.analyze(new LintRequest(mClient, files).setScope(scope));
mFatal = mClient.hasFatalErrors();
return Status.OK_STATUS;
} catch (Exception e) {
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/AndroidNature.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/AndroidNature.java
index 9da519e..3b1c29f 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/AndroidNature.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/AndroidNature.java
@@ -118,10 +118,12 @@ public class AndroidNature implements IProjectNature {
*
* @param project An existing or new project to update
* @param monitor An optional progress monitor. Can be null.
+ * @param addAndroidNature true if the Android Nature should be added to the project; false to
+ * add only the Java nature.
* @throws CoreException if fails to change the nature.
*/
public static synchronized void setupProjectNatures(IProject project,
- IProgressMonitor monitor) throws CoreException {
+ IProgressMonitor monitor, boolean addAndroidNature) throws CoreException {
if (project == null || !project.isOpen()) return;
if (monitor == null) monitor = new NullProgressMonitor();
@@ -131,7 +133,9 @@ public class AndroidNature implements IProjectNature {
// Adding the java nature after the android one, would place the java builder before the
// android builders.
addNatureToProjectDescription(project, JavaCore.NATURE_ID, monitor);
- addNatureToProjectDescription(project, AdtConstants.NATURE_DEFAULT, monitor);
+ if (addAndroidNature) {
+ addNatureToProjectDescription(project, AdtConstants.NATURE_DEFAULT, monitor);
+ }
}
/**
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/BaseClasspathContainerInitializer.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/BaseClasspathContainerInitializer.java
index d19b107..362fe28 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/BaseClasspathContainerInitializer.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/BaseClasspathContainerInitializer.java
@@ -21,6 +21,7 @@ import com.android.ide.eclipse.adt.AdtPlugin;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
@@ -79,6 +80,7 @@ abstract class BaseClasspathContainerInitializer extends ClasspathContainerIniti
// build jobs are run after other interactive jobs
markerJob.setPriority(Job.BUILD);
+ markerJob.setRule(ResourcesPlugin.getWorkspace().getRoot());
markerJob.schedule();
}
} else {
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/LibraryClasspathContainerInitializer.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/LibraryClasspathContainerInitializer.java
index 5b0d185..3beb181 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/LibraryClasspathContainerInitializer.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/LibraryClasspathContainerInitializer.java
@@ -16,6 +16,8 @@
package com.android.ide.eclipse.adt.internal.project;
+import static com.android.ide.eclipse.adt.AdtConstants.CONTAINER_DEPENDENCIES;
+
import com.android.SdkConstants;
import com.android.ide.eclipse.adt.AdtConstants;
import com.android.ide.eclipse.adt.AdtPlugin;
@@ -76,16 +78,21 @@ public class LibraryClasspathContainerInitializer extends BaseClasspathContainer
// container id for each projects.
int projectCount = androidProjects.length;
- IClasspathContainer[] containers = new IClasspathContainer[projectCount];
+ IClasspathContainer[] libraryContainers = new IClasspathContainer[projectCount];
+ IClasspathContainer[] dependencyContainers = new IClasspathContainer[projectCount];
for (int i = 0 ; i < projectCount; i++) {
- containers[i] = allocateLibraryContainer(androidProjects[i]);
+ libraryContainers[i] = allocateLibraryContainer(androidProjects[i]);
+ dependencyContainers[i] = allocateDependencyContainer(androidProjects[i]);
}
// give each project their new container in one call.
JavaCore.setClasspathContainer(
- new Path(AdtConstants.CONTAINER_LIBRARIES),
- androidProjects, containers, new NullProgressMonitor());
+ new Path(AdtConstants.CONTAINER_PRIVATE_LIBRARIES),
+ androidProjects, libraryContainers, new NullProgressMonitor());
+ JavaCore.setClasspathContainer(
+ new Path(AdtConstants.CONTAINER_DEPENDENCIES),
+ androidProjects, dependencyContainers, new NullProgressMonitor());
return true;
} catch (JavaModelException e) {
return false;
@@ -114,12 +121,21 @@ public class LibraryClasspathContainerInitializer extends BaseClasspathContainer
@Override
public void initialize(IPath containerPath, IJavaProject project) throws CoreException {
- if (AdtConstants.CONTAINER_LIBRARIES.equals(containerPath.toString())) {
- IClasspathContainer container = allocateLibraryContainer(project);
- if (container != null) {
- JavaCore.setClasspathContainer(new Path(AdtConstants.CONTAINER_LIBRARIES),
+ if (AdtConstants.CONTAINER_PRIVATE_LIBRARIES.equals(containerPath.toString())) {
+ IClasspathContainer libraries = allocateLibraryContainer(project);
+ if (libraries != null) {
+ JavaCore.setClasspathContainer(new Path(AdtConstants.CONTAINER_PRIVATE_LIBRARIES),
+ new IJavaProject[] { project },
+ new IClasspathContainer[] { libraries },
+ new NullProgressMonitor());
+ }
+
+ } else if(AdtConstants.CONTAINER_DEPENDENCIES.equals(containerPath.toString())) {
+ IClasspathContainer dependencies = allocateDependencyContainer(project);
+ if (dependencies != null) {
+ JavaCore.setClasspathContainer(new Path(AdtConstants.CONTAINER_DEPENDENCIES),
new IJavaProject[] { project },
- new IClasspathContainer[] { container },
+ new IClasspathContainer[] { dependencies },
new NullProgressMonitor());
}
}
@@ -128,48 +144,6 @@ public class LibraryClasspathContainerInitializer extends BaseClasspathContainer
private static IClasspathContainer allocateLibraryContainer(IJavaProject javaProject) {
final IProject iProject = javaProject.getProject();
- AdtPlugin plugin = AdtPlugin.getDefault();
- if (plugin == null) { // This is totally weird, but I've seen it happen!
- return null;
- }
-
- // First check that the project has a library-type container.
- try {
- IClasspathEntry[] rawClasspath = javaProject.getRawClasspath();
- IClasspathEntry[] oldRawClasspath = rawClasspath;
-
- boolean foundLibrariesContainer = false;
- for (IClasspathEntry entry : rawClasspath) {
- // get the entry and kind
- int kind = entry.getEntryKind();
-
- if (kind == IClasspathEntry.CPE_CONTAINER) {
- String path = entry.getPath().toString();
- if (AdtConstants.CONTAINER_LIBRARIES.equals(path)) {
- foundLibrariesContainer = true;
- break;
- }
- }
- }
-
- // if there isn't any, add it.
- if (foundLibrariesContainer == false) {
- // add the android container to the array
- rawClasspath = ProjectHelper.addEntryToClasspath(rawClasspath,
- JavaCore.newContainerEntry(new Path(AdtConstants.CONTAINER_LIBRARIES),
- true /*isExported*/));
- }
-
- // set the new list of entries to the project
- if (rawClasspath != oldRawClasspath) {
- javaProject.setRawClasspath(rawClasspath, new NullProgressMonitor());
- }
- } catch (JavaModelException e) {
- // This really shouldn't happen, but if it does, simply return null (the calling
- // method will fails as well)
- return null;
- }
-
// check if the project has a valid target.
ProjectState state = Sdk.getProjectState(iProject);
if (state == null) {
@@ -188,11 +162,8 @@ public class LibraryClasspathContainerInitializer extends BaseClasspathContainer
* + inside the library projects' libs/
* + inside the referenced Java projects' classpath
*/
-
List<IClasspathEntry> entries = new ArrayList<IClasspathEntry>();
- IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
-
// list of java project dependencies and jar files that will be built while
// going through the library projects.
Set<File> jarFiles = new HashSet<File>();
@@ -202,61 +173,32 @@ public class LibraryClasspathContainerInitializer extends BaseClasspathContainer
List<IProject> libProjects = state.getFullLibraryProjects();
for (IProject libProject : libProjects) {
- // get the project output
- IFolder outputFolder = BaseProjectHelper.getAndroidOutputFolder(libProject);
-
- if (outputFolder != null) { // can happen when closing/deleting a library)
- IFile jarIFile = outputFolder.getFile(libProject.getName().toLowerCase() +
- SdkConstants.DOT_JAR);
-
- // get the source folder for the library project
- List<IPath> srcs = BaseProjectHelper.getSourceClasspaths(libProject);
- // find the first non-derived source folder.
- IPath sourceFolder = null;
- for (IPath src : srcs) {
- IFolder srcFolder = workspaceRoot.getFolder(src);
- if (srcFolder.isDerived() == false) {
- sourceFolder = src;
- break;
- }
- }
-
- // we can directly add a CPE for this jar as there's no risk of a duplicate.
- IClasspathEntry entry = JavaCore.newLibraryEntry(
- jarIFile.getLocation(),
- sourceFolder, // source attachment path
- null, // default source attachment root path.
- true /*isExported*/);
-
- entries.add(entry);
-
- // process all of the library project's dependencies
- getDependencyListFromClasspath(libProject, refProjects, jarFiles, true);
- // and the content of its libs folder.
- getJarListFromLibsFolder(libProject, jarFiles);
- }
+ // process all of the library project's dependencies
+ getDependencyListFromClasspath(libProject, refProjects, jarFiles, true);
}
// now process this projects' referenced projects only.
processReferencedProjects(iProject, refProjects, jarFiles);
+
// and the content of its libs folder
getJarListFromLibsFolder(iProject, jarFiles);
- // annotations support for older version of android
- if (state.getTarget() != null && state.getTarget().getVersion().getApiLevel() <= 15) {
- File annotationsJar = new File(Sdk.getCurrent().getSdkLocation(),
- SdkConstants.FD_TOOLS + File.separator + SdkConstants.FD_SUPPORT +
- File.separator + SdkConstants.FN_ANNOTATIONS_JAR);
-
- jarFiles.add(annotationsJar);
- }
-
// now add a classpath entry for each Java project (this is a set so dups are already
// removed)
for (IProject p : refProjects) {
entries.add(JavaCore.newProjectEntry(p.getFullPath(), true /*isExported*/));
}
+ entries.addAll(convertJarsToClasspathEntries(iProject, jarFiles));
+
+ return allocateContainer(javaProject, entries, new Path(AdtConstants.CONTAINER_PRIVATE_LIBRARIES),
+ "Android Private Libraries");
+ }
+
+ private static List<IClasspathEntry> convertJarsToClasspathEntries(final IProject iProject,
+ Set<File> jarFiles) {
+ List<IClasspathEntry> entries = new ArrayList<IClasspathEntry>(jarFiles.size());
+
// and process the jar files list, but first sanitize it to remove dups.
JarListSanitizer sanitizer = new JarListSanitizer(
iProject.getFolder(SdkConstants.FD_OUTPUT).getLocation().toFile(),
@@ -355,10 +297,119 @@ public class LibraryClasspathContainerInitializer extends BaseClasspathContainer
processError(iProject, errorMessage, AdtConstants.MARKER_DEPENDENCY,
true /*outputToConsole*/);
+ return entries;
+ }
+
+ private static IClasspathContainer allocateDependencyContainer(IJavaProject javaProject) {
+ final IProject iProject = javaProject.getProject();
+ final List<IClasspathEntry> entries = new ArrayList<IClasspathEntry>();
+ final Set<File> jarFiles = new HashSet<File>();
+ final IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
+
+ // check if the project has a valid target.
+ final ProjectState state = Sdk.getProjectState(iProject);
+ if (state == null) {
+ // getProjectState should already have logged an error. Just bail out.
+ return null;
+ }
+
+ // annotations support for older version of android
+ if (state.getTarget() != null && state.getTarget().getVersion().getApiLevel() <= 15) {
+ File annotationsJar = new File(Sdk.getCurrent().getSdkLocation(),
+ SdkConstants.FD_TOOLS + File.separator + SdkConstants.FD_SUPPORT +
+ File.separator + SdkConstants.FN_ANNOTATIONS_JAR);
+
+ jarFiles.add(annotationsJar);
+ }
+
+ // process all the libraries
+
+ List<IProject> libProjects = state.getFullLibraryProjects();
+ for (IProject libProject : libProjects) {
+ // get the project output
+ IFolder outputFolder = BaseProjectHelper.getAndroidOutputFolder(libProject);
+
+ if (outputFolder != null) { // can happen when closing/deleting a library)
+ IFile jarIFile = outputFolder.getFile(libProject.getName().toLowerCase() +
+ SdkConstants.DOT_JAR);
+
+ // get the source folder for the library project
+ List<IPath> srcs = BaseProjectHelper.getSourceClasspaths(libProject);
+ // find the first non-derived source folder.
+ IPath sourceFolder = null;
+ for (IPath src : srcs) {
+ IFolder srcFolder = workspaceRoot.getFolder(src);
+ if (srcFolder.isDerived() == false) {
+ sourceFolder = src;
+ break;
+ }
+ }
+
+ // we can directly add a CPE for this jar as there's no risk of a duplicate.
+ IClasspathEntry entry = JavaCore.newLibraryEntry(
+ jarIFile.getLocation(),
+ sourceFolder, // source attachment path
+ null, // default source attachment root path.
+ true /*isExported*/);
+
+ entries.add(entry);
+ }
+ }
+
+ entries.addAll(convertJarsToClasspathEntries(iProject, jarFiles));
+
+ return allocateContainer(javaProject, entries, new Path(CONTAINER_DEPENDENCIES),
+ "Android Dependencies");
+ }
+
+ private static IClasspathContainer allocateContainer(IJavaProject javaProject,
+ List<IClasspathEntry> entries, IPath id, String description) {
+
+ if (AdtPlugin.getDefault() == null) { // This is totally weird, but I've seen it happen!
+ return null;
+ }
+
+ // First check that the project has a library-type container.
+ try {
+ IClasspathEntry[] rawClasspath = javaProject.getRawClasspath();
+ final IClasspathEntry[] oldRawClasspath = rawClasspath;
+
+ boolean foundContainer = false;
+ for (IClasspathEntry entry : rawClasspath) {
+ // get the entry and kind
+ final int kind = entry.getEntryKind();
+
+ if (kind == IClasspathEntry.CPE_CONTAINER) {
+ String path = entry.getPath().toString();
+ String idString = id.toString();
+ if (idString.equals(path)) {
+ foundContainer = true;
+ break;
+ }
+ }
+ }
+
+ // if there isn't any, add it.
+ if (foundContainer == false) {
+ // add the android container to the array
+ rawClasspath = ProjectHelper.addEntryToClasspath(rawClasspath,
+ JavaCore.newContainerEntry(id, true /*isExported*/));
+ }
+
+ // set the new list of entries to the project
+ if (rawClasspath != oldRawClasspath) {
+ javaProject.setRawClasspath(rawClasspath, new NullProgressMonitor());
+ }
+ } catch (JavaModelException e) {
+ // This really shouldn't happen, but if it does, simply return null (the calling
+ // method will fails as well)
+ return null;
+ }
+
return new AndroidClasspathContainer(
entries.toArray(new IClasspathEntry[entries.size()]),
- new Path(AdtConstants.CONTAINER_LIBRARIES),
- "Android Dependencies",
+ id,
+ description,
IClasspathContainer.K_APPLICATION);
}
@@ -445,7 +496,7 @@ public class LibraryClasspathContainerInitializer extends BaseClasspathContainer
if (classpaths != null) {
for (IClasspathEntry e : classpaths) {
// ignore entries that are not exported
- if (e.isExported()) {
+ if (!e.getPath().toString().equals(CONTAINER_DEPENDENCIES) && e.isExported()) {
processCPE(e, javaProject, wsRoot, projects, jarFiles, includeJarFiles);
}
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/ProjectHelper.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/ProjectHelper.java
index cb58b02..2fceffe 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/ProjectHelper.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/project/ProjectHelper.java
@@ -73,7 +73,7 @@ public final class ProjectHelper {
public final static int COMPILER_COMPLIANCE_CODEGEN_TARGET = 3;
/**
- * Adds the corresponding source folder to the class path entries.
+ * Adds the given ClasspathEntry object to the class path entries.
* This method does not check whether the entry is already defined in the project.
*
* @param entries The class path entries to read. A copy will be returned.
@@ -90,6 +90,32 @@ public final class ProjectHelper {
}
/**
+ * Replaces the given ClasspathEntry in the classpath entries.
+ *
+ * If the classpath does not yet exists (Check is based on entry path), then it is added.
+ *
+ * @param entries The class path entries to read. The same array (replace) or a copy (add)
+ * will be returned.
+ * @param newEntry The new class path entry to add.
+ * @return The same array (replace) or a copy (add) will be returned.
+ *
+ * @see IClasspathEntry#getPath()
+ */
+ public static IClasspathEntry[] replaceEntryInClasspath(
+ IClasspathEntry[] entries, IClasspathEntry newEntry) {
+
+ IPath path = newEntry.getPath();
+ for (int i = 0, count = entries.length; i < count ; i++) {
+ if (path.equals(entries[i].getPath())) {
+ entries[i] = newEntry;
+ return entries;
+ }
+ }
+
+ return addEntryToClasspath(entries, newEntry);
+ }
+
+ /**
* Adds the corresponding source folder to the project's class path entries.
* This method does not check whether the entry is already defined in the project.
*
@@ -285,6 +311,7 @@ public final class ProjectHelper {
// get the project classpath
IClasspathEntry[] entries = javaProject.getRawClasspath();
IClasspathEntry[] oldEntries = entries;
+ boolean forceRewriteOfCPE = false;
// check if the JRE is set as library
int jreIndex = ProjectHelper.findClasspathEntryByPath(entries, JavaRuntime.JRE_CONTAINER,
@@ -298,7 +325,8 @@ public final class ProjectHelper {
IPath outputFolder = javaProject.getOutputLocation();
boolean foundFrameworkContainer = false;
- boolean foundLibrariesContainer = false;
+ IClasspathEntry foundLibrariesContainer = null;
+ IClasspathEntry foundDependenciesContainer = null;
for (int i = 0 ; i < entries.length ;) {
// get the entry and kind
@@ -318,31 +346,73 @@ public final class ProjectHelper {
String path = entry.getPath().toString();
if (AdtConstants.CONTAINER_FRAMEWORK.equals(path)) {
foundFrameworkContainer = true;
- }
- if (AdtConstants.CONTAINER_LIBRARIES.equals(path)) {
- foundLibrariesContainer = true;
+ } else if (AdtConstants.CONTAINER_PRIVATE_LIBRARIES.equals(path)) {
+ foundLibrariesContainer = entry;
+ } else if (AdtConstants.CONTAINER_DEPENDENCIES.equals(path)) {
+ foundDependenciesContainer = entry;
}
}
i++;
}
+ // look to see if we have the m2eclipse nature
+ boolean m2eNature = false;
+ try {
+ m2eNature = javaProject.getProject().hasNature("org.eclipse.m2e.core.maven2Nature");
+ } catch (CoreException e) {
+ AdtPlugin.log(e, "Failed to query project %s for m2e nature",
+ javaProject.getProject().getName());
+ }
+
+
// if the framework container is not there, we add it
- if (foundFrameworkContainer == false) {
+ if (!foundFrameworkContainer) {
// add the android container to the array
entries = ProjectHelper.addEntryToClasspath(entries,
JavaCore.newContainerEntry(new Path(AdtConstants.CONTAINER_FRAMEWORK)));
}
// same thing for the library container
- if (foundLibrariesContainer == false) {
- // add the android container to the array
+ if (foundLibrariesContainer == null) {
+ // add the exported libraries android container to the array
+ entries = ProjectHelper.addEntryToClasspath(entries,
+ JavaCore.newContainerEntry(
+ new Path(AdtConstants.CONTAINER_PRIVATE_LIBRARIES), true));
+ } else if (!m2eNature && !foundLibrariesContainer.isExported()) {
+ // the container is present but it's not exported and since there's no m2e nature
+ // we do want it to be exported.
+ // keep all the other parameters the same.
+ entries = ProjectHelper.replaceEntryInClasspath(entries,
+ JavaCore.newContainerEntry(
+ new Path(AdtConstants.CONTAINER_PRIVATE_LIBRARIES),
+ foundLibrariesContainer.getAccessRules(),
+ foundLibrariesContainer.getExtraAttributes(),
+ true));
+ forceRewriteOfCPE = true;
+ }
+
+ // same thing for the dependencies container
+ if (foundDependenciesContainer == null) {
+ // add the android dependencies container to the array
entries = ProjectHelper.addEntryToClasspath(entries,
- JavaCore.newContainerEntry(new Path(AdtConstants.CONTAINER_LIBRARIES)));
+ JavaCore.newContainerEntry(
+ new Path(AdtConstants.CONTAINER_DEPENDENCIES), true));
+ } else if (!m2eNature && !foundDependenciesContainer.isExported()) {
+ // the container is present but it's not exported and since there's no m2e nature
+ // we do want it to be exported.
+ // keep all the other parameters the same.
+ entries = ProjectHelper.replaceEntryInClasspath(entries,
+ JavaCore.newContainerEntry(
+ new Path(AdtConstants.CONTAINER_DEPENDENCIES),
+ foundDependenciesContainer.getAccessRules(),
+ foundDependenciesContainer.getExtraAttributes(),
+ true));
+ forceRewriteOfCPE = true;
}
// set the new list of entries to the project
- if (entries != oldEntries) {
+ if (entries != oldEntries || forceRewriteOfCPE) {
javaProject.setRawClasspath(entries, new NullProgressMonitor());
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/DynamicIdMap.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/DynamicIdMap.java
index 702f8f6..7bab4fd 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/DynamicIdMap.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/manager/DynamicIdMap.java
@@ -17,8 +17,8 @@
package com.android.ide.eclipse.adt.internal.resources.manager;
import com.android.resources.ResourceType;
-import com.android.sdklib.util.SparseArray;
import com.android.util.Pair;
+import com.android.utils.SparseArray;
import java.util.HashMap;
import java.util.Map;
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/AdtManifestMergeCallback.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/AdtManifestMergeCallback.java
index df0c873..dc539dc 100755
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/AdtManifestMergeCallback.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/AdtManifestMergeCallback.java
@@ -19,6 +19,8 @@ package com.android.ide.eclipse.adt.internal.sdk;
import com.android.annotations.NonNull;
import com.android.manifmerger.ICallback;
import com.android.manifmerger.ManifestMerger;
+import com.android.sdklib.AndroidTargetHash;
+import com.android.sdklib.AndroidVersion;
import com.android.sdklib.IAndroidTarget;
/**
@@ -30,11 +32,14 @@ public class AdtManifestMergeCallback implements ICallback {
public int queryCodenameApiLevel(@NonNull String codename) {
Sdk sdk = Sdk.getCurrent();
if (sdk != null) {
- IAndroidTarget t = sdk.getTargetFromHashString(
- IAndroidTarget.PLATFORM_HASH_PREFIX + codename);
- if (t != null) {
- return t.getVersion().getApiLevel();
- }
+ try {
+ AndroidVersion version = new AndroidVersion(codename);
+ String hashString = AndroidTargetHash.getPlatformHashString(version);
+ IAndroidTarget t = sdk.getTargetFromHashString(hashString);
+ if (t != null) {
+ return t.getVersion().getApiLevel();
+ }
+ } catch (AndroidVersion.AndroidVersionException ignore) {}
}
return ICallback.UNKNOWN_CODENAME;
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/Sdk.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/Sdk.java
index ad2648f..ca6cc57 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/Sdk.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/Sdk.java
@@ -63,6 +63,7 @@ import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceDelta;
import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -72,6 +73,7 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.Job;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.ui.IEditorDescriptor;
import org.eclipse.ui.IEditorInput;
@@ -98,6 +100,7 @@ import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
+import java.util.concurrent.atomic.AtomicBoolean;
/**
* Central point to load, manipulate and deal with the Android SDK. Only one SDK can be used
@@ -236,11 +239,14 @@ public final class Sdk {
sCurrentSdk = null;
}
+ final AtomicBoolean hasWarning = new AtomicBoolean();
+ final AtomicBoolean hasError = new AtomicBoolean();
final ArrayList<String> logMessages = new ArrayList<String>();
ILogger log = new ILogger() {
@Override
public void error(@Nullable Throwable throwable, @Nullable String errorFormat,
Object... arg) {
+ hasError.set(true);
if (errorFormat != null) {
logMessages.add(String.format("Error: " + errorFormat, arg));
}
@@ -252,6 +258,7 @@ public final class Sdk {
@Override
public void warning(@NonNull String warningFormat, Object... arg) {
+ hasWarning.set(true);
logMessages.add(String.format("Warning: " + warningFormat, arg));
}
@@ -268,23 +275,36 @@ public final class Sdk {
// get an SdkManager object for the location
SdkManager manager = SdkManager.createManager(sdkLocation, log);
- if (manager != null) {
- // create the AVD Manager
- AvdManager avdManager = null;
- try {
- avdManager = AvdManager.getInstance(manager, log);
- } catch (AndroidLocationException e) {
- log.error(e, "Error parsing the AVDs");
+ try {
+ if (manager == null) {
+ hasError.set(true);
+ } else {
+ // create the AVD Manager
+ AvdManager avdManager = null;
+ try {
+ avdManager = AvdManager.getInstance(manager, log);
+ } catch (AndroidLocationException e) {
+ log.error(e, "Error parsing the AVDs");
+ }
+ sCurrentSdk = new Sdk(manager, avdManager);
+ return sCurrentSdk;
}
- sCurrentSdk = new Sdk(manager, avdManager);
- return sCurrentSdk;
- } else {
- StringBuilder sb = new StringBuilder("Error Loading the SDK:\n");
- for (String msg : logMessages) {
- sb.append('\n');
- sb.append(msg);
+ } finally {
+ if (hasError.get() || hasWarning.get()) {
+ StringBuilder sb = new StringBuilder(
+ String.format("%s when loading the SDK:\n",
+ hasError.get() ? "Error" : "Warning"));
+ for (String msg : logMessages) {
+ sb.append('\n');
+ sb.append(msg);
+ }
+ if (hasError.get()) {
+ AdtPlugin.printErrorToConsole("Android SDK", sb.toString());
+ AdtPlugin.displayError("Android SDK", sb.toString());
+ } else {
+ AdtPlugin.printToConsole("Android SDK", sb.toString());
+ }
}
- AdtPlugin.displayError("Android SDK", sb.toString());
}
return null;
}
@@ -598,6 +618,7 @@ public final class Sdk {
// build jobs are run after other interactive jobs
markerJob.setPriority(Job.BUILD);
+ markerJob.setRule(ResourcesPlugin.getWorkspace().getRoot());
markerJob.schedule();
}
@@ -700,6 +721,7 @@ public final class Sdk {
}
};
job.setPriority(Job.BUILD); // build jobs are run after other interactive jobs
+ job.setRule(ResourcesPlugin.getWorkspace().getRoot());
job.schedule();
}
@@ -1107,6 +1129,30 @@ public final class Sdk {
// Correct file editor associations.
fixEditorAssociations(openedProject);
+ // Fix classpath entries in a job since the workspace might be locked now.
+ Job fixCpeJob = new Job("Adjusting Android Project Classpath") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ ProjectHelper.fixProjectClasspathEntries(
+ JavaCore.create(openedProject));
+ } catch (JavaModelException e) {
+ AdtPlugin.log(e, "error fixing classpath entries");
+ // Don't return e2.getStatus(); the job control will then produce
+ // a popup with this error, which isn't very interesting for the
+ // user.
+ }
+
+ return Status.OK_STATUS;
+ }
+ };
+
+ // build jobs are run after other interactive jobs
+ fixCpeJob.setPriority(Job.BUILD);
+ fixCpeJob.setRule(ResourcesPlugin.getWorkspace().getRoot());
+ fixCpeJob.schedule();
+
+
if (DEBUG) {
System.out.println("<<<");
}
@@ -1306,6 +1352,7 @@ public final class Sdk {
}
};
job.setPriority(Job.BUILD);
+ job.setRule(ResourcesPlugin.getWorkspace().getRoot());
job.schedule();
}
};
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/ui/ConfigurationSelector.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/ui/ConfigurationSelector.java
index 15453fb..9d7ade6 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/ui/ConfigurationSelector.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/ui/ConfigurationSelector.java
@@ -17,6 +17,7 @@
package com.android.ide.eclipse.adt.internal.ui;
import com.android.SdkConstants;
+import com.android.ide.common.resources.LocaleManager;
import com.android.ide.common.resources.configuration.CountryCodeQualifier;
import com.android.ide.common.resources.configuration.DensityQualifier;
import com.android.ide.common.resources.configuration.FolderConfiguration;
@@ -40,7 +41,6 @@ import com.android.ide.common.resources.configuration.TextInputMethodQualifier;
import com.android.ide.common.resources.configuration.TouchScreenQualifier;
import com.android.ide.common.resources.configuration.UiModeQualifier;
import com.android.ide.common.resources.configuration.VersionQualifier;
-import com.android.ide.eclipse.adt.internal.editors.layout.configuration.LocaleManager;
import com.android.ide.eclipse.adt.internal.resources.ResourceHelper;
import com.android.resources.Density;
import com.android.resources.Keyboard;
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/BuildFileCreator.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/BuildFileCreator.java
new file mode 100644
index 0000000..baa6b47
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/BuildFileCreator.java
@@ -0,0 +1,538 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.wizards.exportgradle;
+
+import com.android.SdkConstants;
+import com.android.annotations.NonNull;
+import com.android.ide.eclipse.adt.internal.sdk.ProjectState;
+import com.android.ide.eclipse.adt.internal.sdk.Sdk;
+import com.android.ide.eclipse.adt.io.IFolderWrapper;
+import com.android.io.IAbstractFile;
+import com.android.sdklib.io.FileOp;
+import com.android.xml.AndroidManifest;
+import com.google.common.base.Charsets;
+import com.google.common.base.Joiner;
+import com.google.common.collect.Lists;
+import com.google.common.io.Files;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Shell;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Set;
+import java.util.TreeSet;
+
+/**
+ * Creates build.gradle and settings.gradle files for a set of projects.
+ * <p>
+ * Based on {@link org.eclipse.ant.internal.ui.datatransfer.BuildFileCreator}
+ */
+public class BuildFileCreator {
+ static final String BUILD_FILE = "build.gradle"; //$NON-NLS-1$
+ static final String SETTINGS_FILE = "settings.gradle"; //$NON-NLS-1$
+ private static final String NEWLINE = System.getProperty("line.separator"); //$NON-NLS-1$
+ private static final String GRADLE_WRAPPER_LOCATION =
+ "tools/templates/gradle/wrapper"; //$NON-NLS-1$
+ static final String PLUGIN_CLASSPATH =
+ "classpath 'com.android.tools.build:gradle:0.5.+'"; //$NON-NLS-1$
+ static final String MAVEN_REPOSITORY = "mavenCentral()"; //$NON-NLS-1$
+
+ private static final String[] GRADLE_WRAPPER_FILES = new String[] {
+ "gradlew", //$NON-NLS-1$
+ "gradlew.bat", //$NON-NLS-1$
+ "gradle/wrapper/gradle-wrapper.jar", //$NON-NLS-1$
+ "gradle/wrapper/gradle-wrapper.properties" //$NON-NLS-1$
+ };
+
+ private static final Comparator<IFile> FILE_COMPARATOR = new Comparator<IFile>() {
+ @Override
+ public int compare(IFile o1, IFile o2) {
+ return o1.toString().compareTo(o2.toString());
+ }
+ };
+
+ private final GradleModule mModule;
+ private final StringBuilder mBuildFile = new StringBuilder();
+
+ /**
+ * Create buildfile for the projects.
+ *
+ * @param shell parent instance for dialogs
+ * @return project names for which buildfiles were created
+ * @throws InterruptedException thrown when user cancels task
+ */
+ public static void createBuildFiles(
+ @NonNull ProjectSetupBuilder builder,
+ @NonNull Shell shell,
+ @NonNull IProgressMonitor pm) {
+
+ File gradleLocation = new File(Sdk.getCurrent().getSdkLocation(), GRADLE_WRAPPER_LOCATION);
+ SubMonitor localmonitor = null;
+
+ try {
+ // See if we have a Gradle wrapper in the SDK templates directory. If so, we can copy
+ // it over.
+ boolean hasGradleWrapper = true;
+ for (File wrapperFile : getGradleWrapperFiles(gradleLocation)) {
+ if (!wrapperFile.exists()) {
+ hasGradleWrapper = false;
+ }
+ }
+
+ Collection<GradleModule> modules = builder.getModules();
+ boolean multiModules = modules.size() > 1;
+
+ // determine files to create/change
+ List<IFile> files = new ArrayList<IFile>();
+
+ // add the build.gradle file for all modules.
+ for (GradleModule module : modules) {
+ // build.gradle file
+ IFile file = module.getProject().getFile(BuildFileCreator.BUILD_FILE);
+ files.add(file);
+ }
+
+ // get the commonRoot for all modules. If only one module, this returns the path
+ // of the project.
+ IPath commonRoot = builder.getCommonRoot();
+
+ IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
+ IPath workspaceLocation = workspaceRoot.getLocation();
+
+ IPath relativePath = commonRoot.makeRelativeTo(workspaceLocation);
+ boolean rootInWorkspace = !relativePath.equals(commonRoot);
+
+ File settingsFile = new File(commonRoot.toFile(), SETTINGS_FILE);
+
+ // more than one modules -> generate settings.gradle
+ if (multiModules && rootInWorkspace) {
+ // Locate the settings.gradle file and add it to the changed files list
+ IPath settingsGradle = Path.fromOSString(settingsFile.getAbsolutePath());
+
+ // different path, means commonRoot is inside the workspace, which means we have
+ // to add settings.gradle and wrapper files to the list of files to add.
+ IFile iFile = workspaceRoot.getFile(settingsGradle);
+ if (iFile != null) {
+ files.add(iFile);
+ }
+ }
+
+ // Gradle wrapper files
+ if (hasGradleWrapper && rootInWorkspace) {
+ // See if there already wrapper files there and only mark nonexistent ones for
+ // creation.
+ for (File wrapperFile : getGradleWrapperFiles(commonRoot.toFile())) {
+ if (!wrapperFile.exists()) {
+ IPath path = Path.fromOSString(wrapperFile.getAbsolutePath());
+ IFile file = workspaceRoot.getFile(path);
+ files.add(file);
+ }
+ }
+ }
+
+ ExportStatus status = new ExportStatus();
+ builder.setStatus(status);
+
+ // Trigger checkout of changed files
+ Set<IFile> confirmedFiles = validateEdit(files, status, shell);
+
+ if (status.hasError()) {
+ return;
+ }
+
+ // Now iterate over all the modules and generate the build files.
+ localmonitor = SubMonitor.convert(pm, ExportMessages.PageTitle,
+ confirmedFiles.size());
+ List<String> projectSettingsPath = Lists.newArrayList();
+ for (GradleModule currentModule : modules) {
+ IProject moduleProject = currentModule.getProject();
+
+ IFile file = moduleProject.getFile(BuildFileCreator.BUILD_FILE);
+ if (!confirmedFiles.contains(file)) {
+ continue;
+ }
+
+ localmonitor.setTaskName(NLS.bind(ExportMessages.FileStatusMessage,
+ moduleProject.getName()));
+
+ ProjectState projectState = Sdk.getProjectState(moduleProject);
+ BuildFileCreator instance = new BuildFileCreator(currentModule, shell);
+ if (projectState != null) {
+ // This is an Android project
+ if (!multiModules) {
+ instance.appendBuildScript();
+ }
+ instance.appendHeader(projectState.isLibrary());
+ instance.appendDependencies();
+ instance.startAndroidTask(projectState);
+ //instance.appendDefaultConfig();
+ instance.createAndroidSourceSets();
+ instance.finishAndroidTask();
+ } else {
+ // This is a plain Java project
+ instance.appendJavaHeader();
+ instance.createJavaSourceSets();
+ }
+
+ try {
+ // Write the build file
+ String buildfile = instance.mBuildFile.toString();
+ InputStream is =
+ new ByteArrayInputStream(buildfile.getBytes("UTF-8")); //$NON-NLS-1$
+ if (file.exists()) {
+ file.setContents(is, true, true, null);
+ } else {
+ file.create(is, true, null);
+ }
+ } catch (Exception e) {
+ status.addFileStatus(ExportStatus.FileStatus.IO_FAILURE,
+ file.getLocation().toFile());
+ status.setErrorMessage(e.getMessage());
+ return;
+ }
+
+ if (localmonitor.isCanceled()) {
+ return;
+ }
+ localmonitor.worked(1);
+
+ // get the project path to add it to the settings.gradle.
+ projectSettingsPath.add(currentModule.getPath());
+ }
+
+ // write the settings file.
+ if (multiModules) {
+ try {
+ writeGradleSettingsFile(settingsFile, projectSettingsPath);
+ } catch (IOException e) {
+ status.addFileStatus(ExportStatus.FileStatus.IO_FAILURE, settingsFile);
+ status.setErrorMessage(e.getMessage());
+ return;
+ }
+ File mainBuildFile = new File(commonRoot.toFile(), BUILD_FILE);
+ try {
+ writeRootBuildGradle(mainBuildFile);
+ } catch (IOException e) {
+ status.addFileStatus(ExportStatus.FileStatus.IO_FAILURE, mainBuildFile);
+ status.setErrorMessage(e.getMessage());
+ return;
+ }
+ }
+
+ // finally write the wrapper
+ // TODO check we can based on where it is
+ if (hasGradleWrapper) {
+ copyGradleWrapper(gradleLocation, commonRoot.toFile(), status);
+ if (status.hasError()) {
+ return;
+ }
+ }
+
+ } finally {
+ if (localmonitor != null && !localmonitor.isCanceled()) {
+ localmonitor.done();
+ }
+ if (pm != null) {
+ pm.done();
+ }
+ }
+ }
+
+ /**
+ * @param GradleModule create buildfile for this project
+ * @param shell parent instance for dialogs
+ */
+ private BuildFileCreator(GradleModule module, Shell shell) {
+ mModule = module;
+ }
+
+ /**
+ * Return the files that comprise the Gradle wrapper as a collection of {@link File} instances.
+ * @param root
+ * @return
+ */
+ private static List<File> getGradleWrapperFiles(File root) {
+ List<File> files = new ArrayList<File>(GRADLE_WRAPPER_FILES.length);
+ for (String file : GRADLE_WRAPPER_FILES) {
+ files.add(new File(root, file));
+ }
+ return files;
+ }
+
+ /**
+ * Copy the Gradle wrapper files from one directory to another.
+ */
+ private static void copyGradleWrapper(File from, File to, ExportStatus status) {
+ for (String file : GRADLE_WRAPPER_FILES) {
+ File dest = new File(to, file);
+ try {
+ File src = new File(from, file);
+ dest.getParentFile().mkdirs();
+ new FileOp().copyFile(src, dest);
+ dest.setExecutable(src.canExecute());
+ status.addFileStatus(ExportStatus.FileStatus.OK, dest);
+ } catch (IOException e) {
+ status.addFileStatus(ExportStatus.FileStatus.IO_FAILURE, dest);
+ return;
+ }
+ }
+ }
+
+ /**
+ * Outputs boilerplate buildscript information common to all Gradle build files.
+ */
+ private void appendBuildScript() {
+ appendBuildScript(mBuildFile);
+ }
+
+ /**
+ * Outputs boilerplate header information common to all Gradle build files.
+ */
+ private static void appendBuildScript(StringBuilder builder) {
+ builder.append("buildscript {\n"); //$NON-NLS-1$
+ builder.append(" repositories {\n"); //$NON-NLS-1$
+ builder.append(" " + MAVEN_REPOSITORY + "\n"); //$NON-NLS-1$
+ builder.append(" }\n"); //$NON-NLS-1$
+ builder.append(" dependencies {\n"); //$NON-NLS-1$
+ builder.append(" " + PLUGIN_CLASSPATH + "\n"); //$NON-NLS-1$
+ builder.append(" }\n"); //$NON-NLS-1$
+ builder.append("}\n"); //$NON-NLS-1$
+ }
+
+ /**
+ * Outputs boilerplate header information common to all Gradle build files.
+ */
+ private void appendHeader(boolean isLibrary) {
+ if (isLibrary) {
+ mBuildFile.append("apply plugin: 'android-library'\n"); //$NON-NLS-1$
+ } else {
+ mBuildFile.append("apply plugin: 'android'\n"); //$NON-NLS-1$
+ }
+ mBuildFile.append("\n"); //$NON-NLS-1$
+ }
+
+ /**
+ * Outputs a block which sets up library and project dependencies.
+ */
+ private void appendDependencies() {
+ mBuildFile.append("dependencies {\n"); //$NON-NLS-1$
+
+ // first the local jars.
+ // TODO: Fix
+ mBuildFile.append(" compile fileTree(dir: 'libs', include: '*.jar')\n"); //$NON-NLS-1$
+
+ for (GradleModule dep : mModule.getDependencies()) {
+ mBuildFile.append(" compile project('" + dep.getPath() + "')\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ mBuildFile.append("}\n"); //$NON-NLS-1$
+ mBuildFile.append("\n"); //$NON-NLS-1$
+ }
+
+ /**
+ * Outputs the beginning of an Android task in the build file.
+ */
+ private void startAndroidTask(ProjectState projectState) {
+ int buildApi = projectState.getTarget().getVersion().getApiLevel();
+ String toolsVersion = projectState.getTarget().getBuildToolInfo().getRevision().toString();
+ mBuildFile.append("android {\n"); //$NON-NLS-1$
+ mBuildFile.append(" compileSdkVersion " + buildApi + "\n"); //$NON-NLS-1$
+ mBuildFile.append(" buildToolsVersion \"" + toolsVersion + "\"\n"); //$NON-NLS-1$
+ mBuildFile.append("\n"); //$NON-NLS-1$
+ }
+
+ /**
+ * Outputs a sourceSets block to the Android task that locates all of the various source
+ * subdirectories in the project.
+ */
+ private void createAndroidSourceSets() {
+ IFolderWrapper projectFolder = new IFolderWrapper(mModule.getProject());
+ IAbstractFile mManifestFile = AndroidManifest.getManifest(projectFolder);
+ if (mManifestFile == null) {
+ return;
+ }
+ List<String> srcDirs = new ArrayList<String>();
+ for (IClasspathEntry entry : mModule.getJavaProject().readRawClasspath()) {
+ if (entry.getEntryKind() != IClasspathEntry.CPE_SOURCE ||
+ SdkConstants.FD_GEN_SOURCES.equals(entry.getPath().lastSegment())) {
+ continue;
+ }
+ IPath path = entry.getPath().removeFirstSegments(1);
+ srcDirs.add("'" + path.toOSString() + "'"); //$NON-NLS-1$
+ }
+
+ String srcPaths = Joiner.on(",").join(srcDirs);
+
+ mBuildFile.append(" sourceSets {\n"); //$NON-NLS-1$
+ mBuildFile.append(" main {\n"); //$NON-NLS-1$
+ mBuildFile.append(" manifest.srcFile '" + SdkConstants.FN_ANDROID_MANIFEST_XML + "'\n"); //$NON-NLS-1$
+ mBuildFile.append(" java.srcDirs = [" + srcPaths + "]\n"); //$NON-NLS-1$
+ mBuildFile.append(" resources.srcDirs = [" + srcPaths + "]\n"); //$NON-NLS-1$
+ mBuildFile.append(" aidl.srcDirs = [" + srcPaths + "]\n"); //$NON-NLS-1$
+ mBuildFile.append(" renderscript.srcDirs = [" + srcPaths + "]\n"); //$NON-NLS-1$
+ mBuildFile.append(" res.srcDirs = ['res']\n"); //$NON-NLS-1$
+ mBuildFile.append(" assets.srcDirs = ['assets']\n"); //$NON-NLS-1$
+ mBuildFile.append(" }\n"); //$NON-NLS-1$
+ mBuildFile.append("\n"); //$NON-NLS-1$
+ mBuildFile.append(" // Move the tests to tests/java, tests/res, etc...\n"); //$NON-NLS-1$
+ mBuildFile.append(" instrumentTest.setRoot('tests')\n"); //$NON-NLS-1$
+ if (srcDirs.contains("'src'")) {
+ mBuildFile.append("\n"); //$NON-NLS-1$
+ mBuildFile.append(" // Move the build types to build-types/<type>\n"); //$NON-NLS-1$
+ mBuildFile.append(" // For instance, build-types/debug/java, build-types/debug/AndroidManifest.xml, ...\n"); //$NON-NLS-1$
+ mBuildFile.append(" // This moves them out of them default location under src/<type>/... which would\n"); //$NON-NLS-1$
+ mBuildFile.append(" // conflict with src/ being used by the main source set.\n"); //$NON-NLS-1$
+ mBuildFile.append(" // Adding new build types or product flavors should be accompanied\n"); //$NON-NLS-1$
+ mBuildFile.append(" // by a similar customization.\n"); //$NON-NLS-1$
+ mBuildFile.append(" debug.setRoot('build-types/debug')\n"); //$NON-NLS-1$
+ mBuildFile.append(" release.setRoot('build-types/release')\n"); //$NON-NLS-1$
+ }
+ mBuildFile.append(" }\n"); //$NON-NLS-1$
+ }
+
+ /**
+ * Outputs the completion of the Android task in the build file.
+ */
+ private void finishAndroidTask() {
+ mBuildFile.append("}\n"); //$NON-NLS-1$
+ }
+
+ /**
+ * Outputs a boilerplate header for non-Android projects
+ */
+ private void appendJavaHeader() {
+ mBuildFile.append("apply plugin: 'java'\n"); //$NON-NLS-1$
+ }
+
+ /**
+ * Outputs a sourceSets block for non-Android projects to locate the source directories.
+ */
+ private void createJavaSourceSets() {
+ List<String> dirs = new ArrayList<String>();
+ for (IClasspathEntry entry : mModule.getJavaProject().readRawClasspath()) {
+ if (entry.getEntryKind() != IClasspathEntry.CPE_SOURCE) {
+ continue;
+ }
+ IPath path = entry.getPath().removeFirstSegments(1);
+ dirs.add("'" + path.toOSString() + "'"); //$NON-NLS-1$
+ }
+
+ String srcPaths = Joiner.on(",").join(dirs);
+
+ mBuildFile.append("sourceSets {\n"); //$NON-NLS-1$
+ mBuildFile.append(" main.java.srcDirs = [" + srcPaths + "]\n"); //$NON-NLS-1$
+ mBuildFile.append(" main.resources.srcDirs = [" + srcPaths + "]\n"); //$NON-NLS-1$
+ mBuildFile.append(" test.java.srcDirs = ['tests/java']\n"); //$NON-NLS-1$
+ mBuildFile.append(" test.resources.srcDirs = ['tests/resources']\n"); //$NON-NLS-1$
+ mBuildFile.append("}\n"); //$NON-NLS-1$
+ }
+
+ /**
+ * Merges the new subproject dependencies into the settings.gradle file if it already exists,
+ * and creates one if it does not.
+ * @throws IOException
+ */
+ private static void writeGradleSettingsFile(File settingsFile, List<String> projectPaths)
+ throws IOException {
+ StringBuilder contents = new StringBuilder();
+ for (String path : projectPaths) {
+ contents.append("include '").append(path).append("'\n"); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ Files.write(contents.toString(), settingsFile, Charsets.UTF_8);
+ }
+
+ private static void writeRootBuildGradle(File buildFile) throws IOException {
+ StringBuilder sb = new StringBuilder(
+ "// Top-level build file where you can add configuration options common to all sub-projects/modules.\n");
+
+ appendBuildScript(sb);
+
+ Files.write(sb.toString(), buildFile, Charsets.UTF_8);
+ }
+
+ /**
+ * Request write access to given files. Depending on the version control
+ * plug-in opens a confirm checkout dialog.
+ *
+ * @param shell
+ * parent instance for dialogs
+ * @return <code>IFile</code> objects for which user confirmed checkout
+ * @throws CoreException
+ * thrown if project is under version control, but not connected
+ */
+ static Set<IFile> validateEdit(
+ @NonNull List<IFile> files,
+ @NonNull ExportStatus exportStatus,
+ @NonNull Shell shell) {
+ Set<IFile> confirmedFiles = new TreeSet<IFile>(FILE_COMPARATOR);
+ if (files.size() == 0) {
+ return confirmedFiles;
+ }
+ IStatus status = (files.get(0)).getWorkspace().validateEdit(
+ files.toArray(new IFile[files.size()]), shell);
+ if (status.isMultiStatus() && status.getChildren().length > 0) {
+ for (int i = 0; i < status.getChildren().length; i++) {
+ IStatus statusChild = status.getChildren()[i];
+ if (statusChild.isOK()) {
+ confirmedFiles.add(files.get(i));
+ } else {
+ exportStatus.addFileStatus(
+ ExportStatus.FileStatus.VCS_FAILURE,
+ files.get(i).getLocation().toFile());
+ }
+ }
+ } else if (status.isOK()) {
+ confirmedFiles.addAll(files);
+ }
+ if (status.getSeverity() == IStatus.ERROR) {
+ // not possible to checkout files: not connected to version
+ // control plugin or hijacked files and made read-only, so
+ // collect error messages provided by validator and re-throw
+ StringBuffer message = new StringBuffer(status.getPlugin() + ": " //$NON-NLS-1$
+ + status.getMessage() + NEWLINE);
+ if (status.isMultiStatus()) {
+ for (int i = 0; i < status.getChildren().length; i++) {
+ IStatus statusChild = status.getChildren()[i];
+ message.append(statusChild.getMessage() + NEWLINE);
+ }
+ }
+ String s = message.toString();
+ exportStatus.setErrorMessage(s);
+ }
+
+ return confirmedFiles;
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/ConfirmationPage.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/ConfirmationPage.java
new file mode 100644
index 0000000..1f236fb
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/ConfirmationPage.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.wizards.exportgradle;
+
+import com.google.common.collect.Lists;
+
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+
+import java.io.File;
+import java.util.Collection;
+import java.util.List;
+
+/**
+ * Confirmation page to review the actual project export
+ * list and see warning about existing files.
+ *
+ */
+public class ConfirmationPage extends WizardPage {
+
+ private final ProjectSetupBuilder mBuilder;
+ private TableViewer mTableViewer;
+ private Label mModuleDescription1;
+ private Label mModuleDescription2;
+ private Label mModuleDescription3;
+ private Label mProjectRootLabel;
+ private Label mProjectRootWarning;
+ private List<IJavaProject> mOverrideProjects;
+ private boolean mOverrideWarning;
+ private Button mForceOverride;
+
+ public ConfirmationPage(ProjectSetupBuilder builder) {
+ super("ConfirmationPage"); //$NON-NLS-1$
+ mBuilder = builder;
+ setPageComplete(false);
+ setTitle(ExportMessages.PageTitle);
+ setDescription(ExportMessages.PageDescription);
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ initializeDialogUnits(parent);
+ GridData data;
+
+ Composite workArea = new Composite(parent, SWT.NONE);
+ setControl(workArea);
+
+ workArea.setLayout(new GridLayout());
+ workArea.setLayoutData(new GridData(GridData.FILL_BOTH
+ | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
+
+ Label title = new Label(workArea, SWT.NONE);
+ title.setText("Please review the export options.");
+
+ Group group = new Group(workArea, SWT.NONE);
+ group.setText("Project root");
+ group.setLayout(new GridLayout());
+ group.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
+
+ mProjectRootLabel = new Label(group, SWT.NONE);
+ mProjectRootLabel.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
+
+ mProjectRootWarning = new Label(group, SWT.NONE);
+ mProjectRootWarning.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
+
+ Group group2 = new Group(workArea, SWT.NONE);
+ group2.setText("Exported Modules");
+ group2.setLayout(new GridLayout());
+ group2.setLayoutData(data = new GridData(SWT.FILL, SWT.FILL, true, true));
+ data.heightHint = 300;
+
+ Table table = new Table(group2, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
+ mTableViewer = new TableViewer(table);
+ table.setLayout(new TableLayout());
+ table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ mTableViewer.setContentProvider(new IStructuredContentProvider() {
+ @Override
+ public Object[] getElements(Object inputElement) {
+ if (inputElement instanceof ProjectSetupBuilder) {
+ ProjectSetupBuilder builder = (ProjectSetupBuilder) inputElement;
+ Collection<GradleModule> modules = builder.getModules();
+ Object[] array = new Object[modules.size()];
+ int i = 0;
+ for (GradleModule module : modules) {
+ array[i++] = module.getJavaProject();
+ }
+
+ return array;
+ }
+
+ return null;
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ });
+ mTableViewer.setLabelProvider(new WorkbenchLabelProvider() {
+ @Override
+ protected String decorateText(String input, Object element) {
+ if (element instanceof IJavaProject) {
+ IJavaProject javaProject = (IJavaProject) element;
+ StringBuilder sb = new StringBuilder(input);
+ if (!mBuilder.isOriginalProject(javaProject)) {
+ sb.append('*');
+ }
+ // TODO: decorate icon instead?
+ if (mOverrideProjects.contains(javaProject)) {
+ sb.append(" (1 warning)");
+ }
+
+ return sb.toString();
+ }
+
+ return input;
+ }
+ });
+ mTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) event.getSelection();
+ Object firstElement = selection.getFirstElement();
+ if (firstElement instanceof IJavaProject) {
+ GradleModule module = mBuilder.getModule((IJavaProject) firstElement);
+ if (mBuilder.getOriginalModules().contains(module)) {
+ mModuleDescription1.setText("Exported because selected in previous page.");
+ } else {
+ List<GradleModule> list = mBuilder.getShortestDependencyTo(module);
+ StringBuilder sb = new StringBuilder();
+ for (GradleModule m : list) {
+ if (sb.length() > 0) {
+ sb.append(" > ");
+ }
+ sb.append(m.getJavaProject().getProject().getName());
+ }
+ mModuleDescription1.setText("Dependency chain: " + sb);
+ }
+ mModuleDescription2.setText("Path: " + module.getPath());
+
+ if (mOverrideProjects.contains(module.getJavaProject())) {
+ mModuleDescription3.setText(
+ "WARNING: build.gradle already exists for this project");
+ } else {
+ mModuleDescription3.setText("");
+ }
+ } else {
+ mModuleDescription1.setText("");
+ mModuleDescription2.setText("");
+ mModuleDescription3.setText("");
+ }
+ }
+ });
+
+ mModuleDescription1 = new Label(group2, SWT.NONE);
+ mModuleDescription1.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
+ mModuleDescription2 = new Label(group2, SWT.NONE);
+ mModuleDescription2.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
+ mModuleDescription3 = new Label(group2, SWT.NONE);
+ mModuleDescription3.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
+
+ mForceOverride = new Button(workArea, SWT.CHECK);
+ mForceOverride.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false));
+ mForceOverride.setText("Force overriding of existing files");
+ mForceOverride.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ updateEnablement();
+ }
+ });
+
+ setControl(workArea);
+ Dialog.applyDialogFont(parent);
+ }
+
+ /**
+ * Get list of projects which have already a buildfile.
+ *
+ * @param javaProjects list of IJavaProject objects
+ * @return set of project names
+ */
+ private void computeOverride(String commonRoot) {
+ mOverrideProjects = Lists.newArrayList();
+ for (GradleModule module : mBuilder.getModules()) {
+ if (new File(module.getProject().getLocation().toFile(),
+ BuildFileCreator.BUILD_FILE).exists()) {
+ mOverrideProjects.add(module.getJavaProject());
+ }
+ }
+
+ // also check on the root settings.gradle/build.gradle
+ boolean settingsFile = new File(commonRoot, BuildFileCreator.SETTINGS_FILE).exists();
+ boolean buildFile = new File(commonRoot, BuildFileCreator.BUILD_FILE).exists();
+ if (settingsFile && buildFile) {
+ mProjectRootWarning.setText(
+ "WARNING: build.gradle/settings.gradle already exists at this location.");
+ } else if (settingsFile) {
+ mProjectRootWarning.setText(
+ "WARNING: settings.gradle already exists at this location.");
+ } else if (buildFile) {
+ mProjectRootWarning.setText("WARNING: build.gradle already exists at this location.");
+ }
+
+ mOverrideWarning = mOverrideProjects.size() > 0 || settingsFile || buildFile;
+ }
+
+ /**
+ * Enables/disables the finish button on the wizard and displays error messages as needed.
+ */
+ private void updateEnablement() {
+ if (mOverrideWarning && !mForceOverride.getSelection()) {
+ setErrorMessage("Enable overriding of existing files before clicking Finish");
+ mBuilder.setCanGenerate(false);
+ } else {
+ setErrorMessage(null);
+ mBuilder.setCanGenerate(true);
+ }
+ setPageComplete(false);
+ getContainer().updateButtons();
+ }
+
+ @Override
+ public void setVisible(boolean visible) {
+ super.setVisible(visible);
+ if (visible) {
+ mProjectRootWarning.setText("");
+
+ String commonRoot = mBuilder.getCommonRoot().toOSString();
+ computeOverride(commonRoot);
+ mProjectRootLabel.setText(commonRoot);
+ mTableViewer.setInput(mBuilder);
+ mTableViewer.getTable().setFocus();
+ mBuilder.setCanFinish(false);
+ mBuilder.setCanGenerate(true);
+ updateEnablement();
+ }
+ }
+} \ No newline at end of file
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/ExportMessages.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/ExportMessages.java
new file mode 100644
index 0000000..c7d6c17
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/ExportMessages.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.wizards.exportgradle;
+
+import org.eclipse.osgi.util.NLS;
+
+public class ExportMessages extends NLS {
+ private static final String BUNDLE_NAME =
+ "com.android.ide.eclipse.adt.internal.wizards.exportgradle.ExportMessages";//$NON-NLS-1$
+
+ public static String PageTitle;
+ public static String PageDescription;
+ public static String SelectProjects;
+ public static String ConfirmOverwrite;
+ public static String ConfirmOverwriteTitle;
+ public static String CyclicProjectsError;
+ public static String ExportFailedError;
+ public static String SelectAll;
+ public static String DeselectAll;
+ public static String NoProjectsError;
+ public static String StatusMessage;
+ public static String FileStatusMessage;
+ public static String WindowTitle;
+
+ static {
+ // load message values from bundle file
+ NLS.initializeMessages(BUNDLE_NAME, ExportMessages.class);
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/ExportMessages.properties b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/ExportMessages.properties
new file mode 100644
index 0000000..1a6dbb1
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/ExportMessages.properties
@@ -0,0 +1,27 @@
+# Copyright (C) 2013 The Android Open Source Project
+#
+# Licensed under the Eclipse Public License, Version 1.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.eclipse.org/org/documents/epl-v10.php
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+PageTitle=Generate Gradle Build files
+PageDescription=Generates Gradle build files based on the configuration of the Java projects
+SelectProjects=Select the projects to use to &generate the Gradle buildfiles:
+ConfirmOverwrite=Are you sure you want to overwrite the buildfiles for these projects?
+ConfirmOverwriteTitle=Overwrite Buildfiles?
+CyclicProjectsError=A cycle was detected in the build path of project: {0}
+ExportFailedError=Buildfile export failed: {0}. See the error log for more details.
+SelectAll=&Select All
+DeselectAll=&Deselect All
+NoProjectsError=Select one or more projects to export.
+StatusMessage=Creating Gradle build files...
+FileStatusMessage=Generating build file for {0}...
+WindowTitle=Export \ No newline at end of file
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/ExportStatus.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/ExportStatus.java
new file mode 100644
index 0000000..6fbe14e
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/ExportStatus.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.wizards.exportgradle;
+
+import com.android.annotations.NonNull;
+import com.android.annotations.Nullable;
+import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.Multimap;
+
+import java.io.File;
+
+public class ExportStatus {
+
+ public static enum FileStatus { OK, VCS_FAILURE, IO_FAILURE; }
+
+ private String mMainError = null;
+ private final Multimap<FileStatus, File> mFileStatus = ArrayListMultimap.create();
+
+ void addFileStatus(@NonNull FileStatus status, @NonNull File file) {
+ mFileStatus.put(status, file);
+ }
+
+ boolean hasError() {
+ return mMainError != null ||
+ !mFileStatus.get(FileStatus.VCS_FAILURE).isEmpty() ||
+ !mFileStatus.get(FileStatus.IO_FAILURE).isEmpty();
+ }
+
+ public void setErrorMessage(String error) {
+ mMainError = error;
+ }
+
+ @Nullable
+ public String getErrorMessage() {
+ return mMainError;
+ }
+
+ @NonNull
+ public Multimap<FileStatus, File> getFileStatus() {
+ return mFileStatus;
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/FinalPage.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/FinalPage.java
new file mode 100644
index 0000000..9e976aa
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/FinalPage.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.wizards.exportgradle;
+
+import com.android.ide.eclipse.adt.internal.wizards.exportgradle.ExportStatus.FileStatus;
+import com.google.common.collect.Multimap;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+
+import java.io.File;
+import java.util.Collection;
+
+/**
+ * Final page to review the result of the export.
+ */
+public class FinalPage extends WizardPage {
+
+ private final ProjectSetupBuilder mBuilder;
+ private ExportStatus mStatus;
+
+ private Text mText;
+
+ public FinalPage(ProjectSetupBuilder builder) {
+ super("FinalPage"); //$NON-NLS-1$
+ mBuilder = builder;
+ setPageComplete(true);
+ setTitle(ExportMessages.PageTitle);
+ setDescription(ExportMessages.PageDescription);
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ initializeDialogUnits(parent);
+
+ mText = new Text(parent, SWT.MULTI | SWT.READ_ONLY);
+ mText.setLayoutData(new GridData(GridData.FILL_BOTH
+ | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
+
+ setControl(mText);
+ Dialog.applyDialogFont(parent);
+ }
+
+ @Override
+ public void setVisible(boolean visible) {
+ super.setVisible(visible);
+ if (visible) {
+ mStatus = mBuilder.getStatus();
+ mBuilder.setCanFinish(!mStatus.hasError());
+ mBuilder.setCanGenerate(false);
+
+ StringBuilder sb = new StringBuilder();
+ if (mStatus.hasError()) {
+ sb.append("There was an error!").append("\n\n");
+
+ String errorMsg = mStatus.getErrorMessage();
+ if (errorMsg != null) {
+ sb.append(errorMsg);
+ }
+
+ Multimap<FileStatus, File> fileStatusMap = mStatus.getFileStatus();
+ Collection<File> files = fileStatusMap.values();
+ if (files != null) {
+ sb.append("\n\n").append("Error on files:").append('\n');
+ for (File file : files) {
+ sb.append("\n").append(file.getAbsolutePath());
+ }
+ }
+ } else {
+ sb.append("Export successful.\n\n");
+
+ int count = mBuilder.getModuleCount();
+ if (count > 1) {
+ sb.append(String.format("Exported %s modules", count)).append('\n');
+ sb.append(String.format(
+ "Root folder: %s", mBuilder.getCommonRoot().toOSString()));
+ } else {
+ sb.append("Exported project: ").append(mBuilder.getCommonRoot().toOSString());
+ }
+
+ sb.append("\n\n").append("Choose 'import project' in Android Studio").append('\n');
+ sb.append("and select the following file:").append("\n\t");
+
+ File bGradle = new File(
+ mBuilder.getCommonRoot().toFile(), BuildFileCreator.BUILD_FILE);
+ sb.append(bGradle.getAbsolutePath());
+
+ sb.append("\n\n").append("Do NOT import the Eclipse project itself!");
+ }
+
+ mText.setText(sb.toString());
+ }
+ }
+} \ No newline at end of file
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/GradleExportWizard.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/GradleExportWizard.java
new file mode 100644
index 0000000..29f8802
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/GradleExportWizard.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.wizards.exportgradle;
+
+import com.android.ide.eclipse.adt.AdtPlugin;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubMonitor;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.ui.IExportWizard;
+import org.eclipse.ui.IWorkbench;
+
+import java.lang.reflect.InvocationTargetException;
+import java.util.Collection;
+
+public class GradleExportWizard extends Wizard implements IExportWizard {
+
+ private ProjectSetupBuilder mBuilder = new ProjectSetupBuilder();
+
+ private ProjectSelectionPage mFirstPage;
+ private ConfirmationPage mSecondPage;
+ private FinalPage mFinalPage;
+
+ /**
+ * Creates buildfile.
+ */
+ @Override
+ public boolean performFinish() {
+ if (mBuilder.canGenerate()) {
+ generateBuildfiles(mSecondPage);
+ getContainer().showPage(mFinalPage);
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ public void addPages() {
+ mFirstPage = new ProjectSelectionPage(mBuilder);
+ addPage(mFirstPage);
+ mSecondPage = new ConfirmationPage(mBuilder);
+ addPage(mSecondPage);
+ mFinalPage = new FinalPage(mBuilder);
+ addPage(mFinalPage);
+ }
+
+ @Override
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ setWindowTitle(ExportMessages.WindowTitle);
+ setNeedsProgressMonitor(true);
+ }
+
+ @Override
+ public boolean canFinish() {
+ return mBuilder.canFinish() || mBuilder.canGenerate();
+ }
+
+ /**
+ * Converts Eclipse Java projects to Gradle build files. Displays error dialogs.
+ */
+ public boolean generateBuildfiles(final WizardPage page) {
+ IRunnableWithProgress runnable = new IRunnableWithProgress() {
+ @Override
+ public void run(IProgressMonitor pm) throws InterruptedException {
+ Collection<GradleModule> modules = mBuilder.getModules();
+ final int count = modules.size();
+
+ SubMonitor localmonitor = SubMonitor.convert(pm, ExportMessages.StatusMessage,
+ count);
+ BuildFileCreator.createBuildFiles(
+ mBuilder,
+ page.getShell(),
+ localmonitor.newChild(count));
+ }
+ };
+
+ try {
+ getContainer().run(false, false, runnable);
+ } catch (InvocationTargetException e) {
+ AdtPlugin.log(e, null);
+ return false;
+ } catch (InterruptedException e) {
+ AdtPlugin.log(e, null);
+ return false;
+ }
+ if (page.getErrorMessage() != null) {
+ return false;
+ }
+ return true;
+ }
+
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/GradleModule.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/GradleModule.java
new file mode 100644
index 0000000..684f03b
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/GradleModule.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.wizards.exportgradle;
+
+import com.android.annotations.NonNull;
+import com.google.common.collect.Lists;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jdt.core.IJavaProject;
+
+import java.util.List;
+
+/**
+ * A configured Gradle module for export. This includes gradle path, dependency, type, etc...
+ */
+public class GradleModule {
+
+ @NonNull
+ private final IJavaProject mJavaProject;
+
+ private String mPath;
+ private Type mType;
+
+ private final List<GradleModule> mDependencies = Lists.newArrayList();
+
+ public static enum Type { ANDROID, JAVA };
+
+ GradleModule(@NonNull IJavaProject javaProject) {
+ mJavaProject = javaProject;
+ }
+
+ @NonNull
+ public IJavaProject getJavaProject() {
+ return mJavaProject;
+ }
+
+ @NonNull
+ public IProject getProject() {
+ return mJavaProject.getProject();
+ }
+
+ boolean isConfigured() {
+ return mType != null;
+ }
+
+ public void setType(Type type) {
+ mType = type;
+ }
+
+ public Type getType() {
+ return mType;
+ }
+
+ public void addDependency(GradleModule module) {
+ mDependencies.add(module);
+ }
+
+ public List<GradleModule> getDependencies() {
+ return mDependencies;
+ }
+
+ public void setPath(String path) {
+ mPath = path;
+ }
+
+ public String getPath() {
+ return mPath;
+ }
+
+ @Override
+ public String toString() {
+ return "GradleModule [mJavaProject=" + mJavaProject + ", mPath=" + mPath + ", mType="
+ + mType + ", mDependencies=" + mDependencies + "]";
+ }
+}
+
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/ProjectSelectionPage.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/ProjectSelectionPage.java
new file mode 100644
index 0000000..81c7a73
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/ProjectSelectionPage.java
@@ -0,0 +1,275 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.wizards.exportgradle;
+
+import com.google.common.base.Joiner;
+import com.google.common.collect.Lists;
+import com.ibm.icu.text.MessageFormat;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IJavaModel;
+import org.eclipse.jdt.core.IJavaModelMarker;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.TableLayout;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.ui.model.WorkbenchContentProvider;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * Displays a wizard page that lets the user choose the projects for which to create Gradle build
+ * files.
+ * <p>
+ * Based on {@link org.eclipse.ant.internal.ui.datatransfer.AntBuildfileExportPage}
+ */
+public class ProjectSelectionPage extends WizardPage {
+
+ private final ProjectSetupBuilder mBuilder;
+ private CheckboxTableViewer mTableViewer;
+ private List<IJavaProject> mSelectedJavaProjects = Lists.newArrayList();
+
+ public ProjectSelectionPage(ProjectSetupBuilder builder) {
+ super("GradleExportPage"); //$NON-NLS-1$
+ mBuilder = builder;
+ setPageComplete(false);
+ setTitle(ExportMessages.PageTitle);
+ setDescription(ExportMessages.PageDescription);
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ initializeDialogUnits(parent);
+
+ Composite workArea = new Composite(parent, SWT.NONE);
+ setControl(workArea);
+
+ workArea.setLayout(new GridLayout());
+ workArea.setLayoutData(new GridData(GridData.FILL_BOTH
+ | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
+
+ Label title = new Label(workArea, SWT.NONE);
+ title.setText(ExportMessages.SelectProjects);
+
+ Composite listComposite = new Composite(workArea, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ layout.marginWidth = 0;
+ layout.makeColumnsEqualWidth = false;
+ listComposite.setLayout(layout);
+
+ listComposite.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
+ | GridData.GRAB_VERTICAL | GridData.FILL_BOTH));
+
+ Table table = new Table(listComposite,
+ SWT.CHECK | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
+ mTableViewer = new CheckboxTableViewer(table);
+ table.setLayout(new TableLayout());
+ GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
+ data.heightHint = 300;
+ table.setLayoutData(data);
+ mTableViewer.setContentProvider(new WorkbenchContentProvider() {
+ @Override
+ public Object[] getElements(Object element) {
+ if (element instanceof IJavaProject[]) {
+ return (IJavaProject[]) element;
+ }
+ return null;
+ }
+ });
+ mTableViewer.setLabelProvider(new WorkbenchLabelProvider());
+ mTableViewer.addCheckStateListener(new ICheckStateListener() {
+ @Override
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ if (event.getChecked()) {
+ mSelectedJavaProjects.add((IJavaProject) event.getElement());
+ } else {
+ mSelectedJavaProjects.remove(event.getElement());
+ }
+ updateEnablement();
+ }
+ });
+
+ initializeProjects();
+ createSelectionButtons(listComposite);
+ setControl(workArea);
+ updateEnablement();
+ Dialog.applyDialogFont(parent);
+ }
+
+ /**
+ * Creates select all/deselect all buttons.
+ */
+ private void createSelectionButtons(Composite composite) {
+ Composite buttonsComposite = new Composite(composite, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ buttonsComposite.setLayout(layout);
+
+ buttonsComposite.setLayoutData(new GridData(
+ GridData.VERTICAL_ALIGN_BEGINNING));
+
+ Button selectAll = new Button(buttonsComposite, SWT.PUSH);
+ selectAll.setText(ExportMessages.SelectAll);
+ selectAll.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ for (int i = 0; i < mTableViewer.getTable().getItemCount(); i++) {
+ mSelectedJavaProjects.add((IJavaProject) mTableViewer.getElementAt(i));
+ }
+ mTableViewer.setAllChecked(true);
+ updateEnablement();
+ }
+ });
+ setButtonLayoutData(selectAll);
+
+ Button deselectAll = new Button(buttonsComposite, SWT.PUSH);
+ deselectAll.setText(ExportMessages.DeselectAll);
+ deselectAll.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ mSelectedJavaProjects.clear();
+ mTableViewer.setAllChecked(false);
+ updateEnablement();
+ }
+ });
+ setButtonLayoutData(deselectAll);
+ }
+
+ /**
+ * Populates the list with all the eligible projects in the workspace.
+ */
+ private void initializeProjects() {
+ IWorkspaceRoot rootWorkspace = ResourcesPlugin.getWorkspace().getRoot();
+ IJavaModel javaModel = JavaCore.create(rootWorkspace);
+ IJavaProject[] javaProjects;
+ try {
+ javaProjects = javaModel.getJavaProjects();
+ } catch (JavaModelException e) {
+ javaProjects = new IJavaProject[0];
+ }
+ mTableViewer.setInput(javaProjects);
+ // Check any necessary projects
+ if (mSelectedJavaProjects != null) {
+ mTableViewer.setCheckedElements(mSelectedJavaProjects.toArray(
+ new IJavaProject[mSelectedJavaProjects.size()]));
+ }
+ }
+
+ /**
+ * Enables/disables the finish button on the wizard and displays error messages as needed.
+ */
+ private void updateEnablement() {
+ String error = null;
+ try {
+ if (mSelectedJavaProjects.size() == 0) {
+ error = ExportMessages.NoProjectsError;
+ return;
+ }
+
+ List<String> cyclicProjects;
+ try {
+ cyclicProjects = getCyclicProjects(mSelectedJavaProjects);
+ if (cyclicProjects.size() > 0) {
+ error = MessageFormat.format(ExportMessages.CyclicProjectsError,
+ new Object[] { Joiner.on(", ").join(cyclicProjects) }); //$NON-NLS-1$
+ return;
+ }
+
+ error = mBuilder.setProject(mSelectedJavaProjects);
+ if (error != null) {
+ return;
+ }
+
+ } catch (CoreException ignored) {
+ // TODO: do something?
+ }
+ } finally {
+ setErrorMessage(error);
+ setPageComplete(error == null);
+ getContainer().updateButtons();
+ }
+ }
+
+ @Override
+ public void setVisible(boolean visible) {
+ super.setVisible(visible);
+ if (visible) {
+ mTableViewer.getTable().setFocus();
+ mBuilder.setCanFinish(false);
+ mBuilder.setCanGenerate(false);
+ }
+ }
+
+ /**
+ * Returns given projects that have cyclic dependencies.
+ *
+ * @param javaProjects list of IJavaProject objects
+ * @return set of project names
+ */
+ private List<String> getCyclicProjects(List<IJavaProject> projects) throws CoreException {
+
+ List<String> cyclicProjects = new ArrayList<String>();
+ for (IJavaProject javaProject : projects) {
+ if (hasCyclicDependency(javaProject)) {
+ cyclicProjects.add(javaProject.getProject().getName());
+ }
+ }
+ return cyclicProjects;
+ }
+
+ /**
+ * Check if given project has a cyclic dependency.
+ * <p>
+ * See {@link org.eclipse.jdt.core.tests.model.ClasspathTests.numberOfCycleMarkers}
+ */
+ private static boolean hasCyclicDependency(IJavaProject javaProject)
+ throws CoreException {
+ IMarker[] markers = javaProject.getProject().findMarkers(
+ IJavaModelMarker.BUILDPATH_PROBLEM_MARKER, false,
+ IResource.DEPTH_ONE);
+ for (IMarker marker : markers) {
+ String cycleAttr = (String) marker
+ .getAttribute(IJavaModelMarker.CYCLE_DETECTED);
+ if (cycleAttr != null && cycleAttr.equals("true")) { //$NON-NLS-1$
+ return true;
+ }
+ }
+ return false;
+ }
+} \ No newline at end of file
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/ProjectSetupBuilder.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/ProjectSetupBuilder.java
new file mode 100644
index 0000000..1fd6b74
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/ProjectSetupBuilder.java
@@ -0,0 +1,425 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.wizards.exportgradle;
+
+import com.android.annotations.NonNull;
+import com.android.annotations.Nullable;
+import com.android.ide.eclipse.adt.AdtConstants;
+import com.android.ide.eclipse.adt.internal.project.BaseProjectHelper;
+import com.android.ide.eclipse.adt.internal.sdk.ProjectState;
+import com.android.ide.eclipse.adt.internal.sdk.ProjectState.LibraryState;
+import com.android.ide.eclipse.adt.internal.sdk.Sdk;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+
+import java.io.File;
+import java.util.Collection;
+import java.util.List;
+import java.util.Map;
+import java.util.regex.Pattern;
+
+/**
+ * Class to setup the project and its modules.
+ */
+public class ProjectSetupBuilder {
+
+ private final static class InternalException extends Exception {
+ private static final long serialVersionUID = 1L;
+
+ InternalException(String message) {
+ super(message);
+ }
+ }
+
+ private boolean mCanFinish = false;
+ private boolean mCanGenerate = false;
+ private final List<GradleModule> mOriginalModules = Lists.newArrayList();
+ private final Map<IJavaProject, GradleModule> mModules = Maps.newHashMap();
+ private IPath mCommonRoot;
+ private ExportStatus mStatus;
+
+ public ProjectSetupBuilder() {
+
+ }
+
+ public void setCanGenerate(boolean generate) {
+ mCanGenerate = generate;
+ }
+
+ public void setCanFinish(boolean canFinish) {
+ mCanFinish = canFinish;
+ }
+
+ public boolean canFinish() {
+ return mCanFinish;
+ }
+
+ public boolean canGenerate() {
+ return mCanGenerate;
+ }
+
+ public void setStatus(ExportStatus status) {
+ mStatus = status;
+ }
+
+ public ExportStatus getStatus() {
+ return mStatus;
+ }
+
+ @NonNull
+ public String setProject(@NonNull List<IJavaProject> selectedProjects)
+ throws CoreException {
+ mModules.clear();
+
+ // build a list of all projects that must be included. This is in case
+ // some dependencies have not been included in the selected projects. We also include
+ // parent projects so that the full multi-project setup is correct.
+ // Note that if two projects are selected that are not related, both will be added
+ // in the same multi-project anyway.
+ try {
+ for (IJavaProject javaProject : selectedProjects) {
+ GradleModule module;
+
+ if (javaProject.getProject().hasNature(AdtConstants.NATURE_DEFAULT)) {
+ module = processAndroidProject(javaProject);
+ } else {
+ module = processJavaProject(javaProject);
+ }
+
+ mOriginalModules.add(module);
+ }
+
+ Collection<GradleModule> modules = mModules.values();
+ computeRootAndPaths(modules);
+
+ return null;
+ } catch (InternalException e) {
+ return e.getMessage();
+ }
+ }
+
+ @NonNull
+ public Collection<GradleModule> getModules() {
+ return mModules.values();
+ }
+
+ public int getModuleCount() {
+ return mModules.size();
+ }
+
+ @Nullable
+ public IPath getCommonRoot() {
+ return mCommonRoot;
+ }
+
+ @Nullable
+ public GradleModule getModule(IJavaProject javaProject) {
+ return mModules.get(javaProject);
+ }
+
+ public boolean isOriginalProject(@NonNull IJavaProject javaProject) {
+ GradleModule module = mModules.get(javaProject);
+ return mOriginalModules.contains(module);
+ }
+
+ @NonNull
+ public List<GradleModule> getOriginalModules() {
+ return mOriginalModules;
+ }
+
+ @Nullable
+ public List<GradleModule> getShortestDependencyTo(GradleModule module) {
+ return findModule(module, mOriginalModules);
+ }
+
+ @Nullable
+ public List<GradleModule> findModule(GradleModule toFind, GradleModule rootModule) {
+ if (toFind == rootModule) {
+ List<GradleModule> list = Lists.newArrayList();
+ list.add(toFind);
+ return list;
+ }
+
+ List<GradleModule> shortestChain = findModule(toFind, rootModule.getDependencies());
+
+ if (shortestChain != null) {
+ shortestChain.add(0, rootModule);
+ }
+
+ return shortestChain;
+ }
+
+ @Nullable
+ public List<GradleModule> findModule(GradleModule toFind, List<GradleModule> modules) {
+ List<GradleModule> currentChain = null;
+
+ for (GradleModule child : modules) {
+ List<GradleModule> newChain = findModule(toFind, child);
+ if (currentChain == null) {
+ currentChain = newChain;
+ } else if (newChain != null) {
+ if (currentChain.size() > newChain.size()) {
+ currentChain = newChain;
+ }
+ }
+ }
+
+ return currentChain;
+ }
+
+ @NonNull
+ private GradleModule processAndroidProject(@NonNull IJavaProject javaProject)
+ throws InternalException, CoreException {
+
+ // get/create the module
+ GradleModule module = createModuleOnDemand(javaProject);
+ if (module.isConfigured()) {
+ return module;
+ }
+
+ module.setType(GradleModule.Type.ANDROID);
+
+ ProjectState projectState = Sdk.getProjectState(javaProject.getProject());
+ assert projectState != null;
+
+ // add library project dependencies
+ List<LibraryState> libraryProjects = projectState.getLibraries();
+ for (LibraryState libraryState : libraryProjects) {
+ ProjectState libProjectState = libraryState.getProjectState();
+ if (libProjectState != null) {
+ IJavaProject javaLib = getJavaProject(libProjectState);
+ if (javaLib != null) {
+ GradleModule libModule = processAndroidProject(javaLib);
+ module.addDependency(libModule);
+ } else {
+ throw new InternalException(String.format(
+ "Project %1$s is missing. Needed by %2$s.\n" +
+ "Make sure all dependencies are opened.",
+ libraryState.getRelativePath(),
+ javaProject.getProject().getName()));
+ }
+ } else {
+ throw new InternalException(String.format(
+ "Project %1$s is missing. Needed by %2$s.\n" +
+ "Make sure all dependencies are opened.",
+ libraryState.getRelativePath(),
+ javaProject.getProject().getName()));
+ }
+ }
+
+ // add java project dependencies
+ List<IJavaProject> javaDepProjects = getReferencedProjects(javaProject);
+ for (IJavaProject javaDep : javaDepProjects) {
+ GradleModule libModule = processJavaProject(javaDep);
+ module.addDependency(libModule);
+ }
+
+ return module;
+ }
+
+ @NonNull
+ private GradleModule processJavaProject(@NonNull IJavaProject javaProject)
+ throws InternalException, CoreException {
+ // get/create the module
+ GradleModule module = createModuleOnDemand(javaProject);
+
+ if (module.isConfigured()) {
+ return module;
+ }
+
+ module.setType(GradleModule.Type.JAVA);
+
+ // add java project dependencies
+ List<IJavaProject> javaDepProjects = getReferencedProjects(javaProject);
+ for (IJavaProject javaDep : javaDepProjects) {
+ // Java project should not reference Android project!
+ if (javaDep.getProject().hasNature(AdtConstants.NATURE_DEFAULT)) {
+ throw new InternalException(String.format(
+ "Java project %1$s depends on Android project %2$s!\n" +
+ "This is not a valid dependency",
+ javaProject.getProject().getName(), javaDep.getProject().getName()));
+ }
+ GradleModule libModule = processJavaProject(javaDep);
+ module.addDependency(libModule);
+ }
+
+ return module;
+ }
+
+ private void computeRootAndPaths(Collection<GradleModule> modules) throws InternalException {
+ // compute the common root.
+ mCommonRoot = determineCommonRoot(modules);
+
+ // compute all the relative paths.
+ for (GradleModule module : modules) {
+ String path = getGradlePath(module.getJavaProject().getProject().getLocation(),
+ mCommonRoot);
+
+ module.setPath(path);
+ }
+ }
+
+ /**
+ * Finds the common parent directory shared by this project and all its dependencies.
+ * If there's only one project, returns the single project's folder.
+ * @throws InternalException
+ */
+ @NonNull
+ private static IPath determineCommonRoot(Collection<GradleModule> modules)
+ throws InternalException {
+ IPath commonRoot = null;
+ for (GradleModule module : modules) {
+ if (commonRoot == null) {
+ commonRoot = module.getJavaProject().getProject().getLocation();
+ } else {
+ commonRoot = findCommonRoot(commonRoot,
+ module.getJavaProject().getProject().getLocation());
+ }
+ }
+
+ return commonRoot;
+ }
+
+ /**
+ * Converts the given path to be relative to the given root path, and converts it to
+ * Gradle project notation, such as is used in the settings.gradle file.
+ */
+ @NonNull
+ private static String getGradlePath(IPath path, IPath root) {
+ IPath relativePath = path.makeRelativeTo(root);
+ String relativeString = relativePath.toOSString();
+ return ":" + relativeString.replaceAll(Pattern.quote(File.separator), ":"); //$NON-NLS-1$
+ }
+
+ /**
+ * Given two IPaths, finds the parent directory of both of them.
+ * @throws InternalException
+ */
+ @NonNull
+ private static IPath findCommonRoot(@NonNull IPath path1, @NonNull IPath path2)
+ throws InternalException {
+ if (path1.getDevice() != null && !path1.getDevice().equals(path2.getDevice())) {
+ throw new InternalException(
+ "Different modules have been detected on different drives.\n" +
+ "This prevents finding a common root to all modules.");
+ }
+
+ IPath result = path1.uptoSegment(0);
+
+ final int count = Math.min(path1.segmentCount(), path2.segmentCount());
+ for (int i = 0; i < count; i++) {
+ if (path1.segment(i).equals(path2.segment(i))) {
+ result = result.append(Path.SEPARATOR + path2.segment(i));
+ }
+ }
+ return result;
+ }
+
+ @Nullable
+ private IJavaProject getJavaProject(ProjectState projectState) {
+ try {
+ return BaseProjectHelper.getJavaProject(projectState.getProject());
+ } catch (CoreException e) {
+ return null;
+ }
+ }
+
+ @NonNull
+ private GradleModule createModuleOnDemand(@NonNull IJavaProject javaProject) {
+ GradleModule module = mModules.get(javaProject);
+ if (module == null) {
+ module = new GradleModule(javaProject);
+ mModules.put(javaProject, module);
+ }
+
+ return module;
+ }
+
+ @NonNull
+ private static List<IJavaProject> getReferencedProjects(IJavaProject javaProject)
+ throws JavaModelException, InternalException {
+
+ List<IJavaProject> projects = Lists.newArrayList();
+
+ IClasspathEntry entries[] = javaProject.getRawClasspath();
+ for (IClasspathEntry classpathEntry : entries) {
+ if (classpathEntry.getContentKind() == IPackageFragmentRoot.K_SOURCE
+ && classpathEntry.getEntryKind() == IClasspathEntry.CPE_PROJECT) {
+ // found required project on build path
+ String subProjectRoot = classpathEntry.getPath().toString();
+ IJavaProject subProject = getJavaProject(subProjectRoot);
+ // is project available in workspace?
+ if (subProject != null) {
+ projects.add(subProject);
+ } else {
+ throw new InternalException(String.format(
+ "Project '%s' is missing project dependency '%s' in Eclipse workspace.\n" +
+ "Make sure all dependencies are opened.",
+ javaProject.getProject().getName(),
+ classpathEntry.getPath().toString()));
+ }
+ }
+ }
+
+ return projects;
+ }
+
+ /**
+ * Get Java project for given root.
+ */
+ @Nullable
+ private static IJavaProject getJavaProject(String root) {
+ IPath path = new Path(root);
+ if (path.segmentCount() == 1) {
+ return getJavaProjectByName(root);
+ }
+ IResource resource = ResourcesPlugin.getWorkspace().getRoot()
+ .findMember(path);
+ if (resource != null && resource.getType() == IResource.PROJECT) {
+ if (resource.exists()) {
+ return (IJavaProject) JavaCore.create(resource);
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Get Java project from resource.
+ */
+ private static IJavaProject getJavaProjectByName(String name) {
+ try {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(name);
+ if (project.exists()) {
+ return JavaCore.create(project);
+ }
+ } catch (IllegalArgumentException iae) {
+ }
+ return null;
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/NewProjectCreator.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/NewProjectCreator.java
index 8c8fa29..d168c75 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/NewProjectCreator.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/NewProjectCreator.java
@@ -24,6 +24,7 @@ import static org.eclipse.core.resources.IResource.DEPTH_ZERO;
import com.android.SdkConstants;
import com.android.annotations.NonNull;
import com.android.annotations.Nullable;
+import com.android.annotations.VisibleForTesting;
import com.android.ide.common.res2.ValueXmlHelper;
import com.android.ide.common.xml.ManifestData;
import com.android.ide.common.xml.XmlFormatStyle;
@@ -299,7 +300,34 @@ public class NewProjectCreator {
WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
@Override
protected void execute(IProgressMonitor monitor) throws InvocationTargetException {
- createProjectAsync(monitor, mainData, testData, null);
+ createProjectAsync(monitor, mainData, testData, null, true);
+ }
+ };
+
+ // Run the operation in a different thread
+ runAsyncOperation(op);
+ return true;
+ }
+
+ /**
+ * Creates the a plain Java project without typical android directories or an Android Nature.
+ * This is intended for use by unit tests and not as a general-purpose Java project creator.
+ * @return True if the project could be created.
+ */
+ @VisibleForTesting
+ public boolean createJavaProjects() {
+ if (mValues.importProjects != null && !mValues.importProjects.isEmpty()) {
+ return importProjects();
+ }
+
+ final ProjectInfo mainData = collectMainPageInfo();
+ final ProjectInfo testData = collectTestPageInfo();
+
+ // Create a monitored operation to create the actual project
+ WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
+ @Override
+ protected void execute(IProgressMonitor monitor) throws InvocationTargetException {
+ createProjectAsync(monitor, mainData, testData, null, false);
}
};
@@ -369,7 +397,7 @@ public class NewProjectCreator {
WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
@Override
protected void execute(IProgressMonitor monitor) throws InvocationTargetException {
- createProjectAsync(monitor, null, null, projectData);
+ createProjectAsync(monitor, null, null, projectData, true);
}
};
@@ -553,6 +581,8 @@ public class NewProjectCreator {
*
* @param monitor An existing monitor.
* @param mainData Data for main project. Can be null.
+ * @param isAndroidProject true if the project is to be set up as a full Android project; false
+ * for a plain Java project.
* @throws InvocationTargetException to wrap any unmanaged exception and
* return it to the calling thread. The method can fail if it fails
* to create or modify the project or if it is canceled by the user.
@@ -560,7 +590,8 @@ public class NewProjectCreator {
private void createProjectAsync(IProgressMonitor monitor,
ProjectInfo mainData,
ProjectInfo testData,
- List<ProjectInfo> importData)
+ List<ProjectInfo> importData,
+ boolean isAndroidProject)
throws InvocationTargetException {
monitor.beginTask("Create Android Project", 100);
try {
@@ -573,7 +604,8 @@ public class NewProjectCreator {
mainData.getDescription(),
mainData.getParameters(),
mainData.getDictionary(),
- null);
+ null,
+ isAndroidProject);
if (mainProject != null) {
final IJavaProject javaProject = JavaCore.create(mainProject);
@@ -594,7 +626,8 @@ public class NewProjectCreator {
testData.getDescription(),
parameters,
testData.getDictionary(),
- null);
+ null,
+ isAndroidProject);
if (testProject != null) {
final IJavaProject javaProject = JavaCore.create(testProject);
Display.getDefault().syncExec(new WorksetAdder(javaProject,
@@ -630,7 +663,8 @@ public class NewProjectCreator {
data.getDescription(),
data.getParameters(),
data.getDictionary(),
- projectPopulator);
+ projectPopulator,
+ isAndroidProject);
if (project != null) {
final IJavaProject javaProject = JavaCore.create(project);
Display.getDefault().syncExec(new WorksetAdder(javaProject,
@@ -670,6 +704,8 @@ public class NewProjectCreator {
* @param description A description of the project.
* @param parameters Template parameters.
* @param dictionary String definition.
+ * @param isAndroidProject true if the project is to be set up as a full Android project; false
+ * for a plain Java project.
* @return The project newly created
* @throws StreamException
*/
@@ -679,12 +715,13 @@ public class NewProjectCreator {
@NonNull IProjectDescription description,
@NonNull Map<String, Object> parameters,
@Nullable Map<String, String> dictionary,
- @Nullable ProjectPopulator projectPopulator)
+ @Nullable ProjectPopulator projectPopulator,
+ boolean isAndroidProject)
throws CoreException, IOException, StreamException {
// get the project target
IAndroidTarget target = (IAndroidTarget) parameters.get(PARAM_SDK_TARGET);
- boolean legacy = target.getVersion().getApiLevel() < 4;
+ boolean legacy = isAndroidProject && target.getVersion().getApiLevel() < 4;
// Create project and open it
project.create(description, new SubProgressMonitor(monitor, 10));
@@ -693,14 +730,21 @@ public class NewProjectCreator {
project.open(IResource.BACKGROUND_REFRESH, new SubProgressMonitor(monitor, 10));
// Add the Java and android nature to the project
- AndroidNature.setupProjectNatures(project, monitor);
+ AndroidNature.setupProjectNatures(project, monitor, isAndroidProject);
// Create folders in the project if they don't already exist
addDefaultDirectories(project, AdtConstants.WS_ROOT, DEFAULT_DIRECTORIES, monitor);
- String[] sourceFolders = new String[] {
+ String[] sourceFolders;
+ if (isAndroidProject) {
+ sourceFolders = new String[] {
(String) parameters.get(PARAM_SRC_FOLDER),
GEN_SRC_DIRECTORY
};
+ } else {
+ sourceFolders = new String[] {
+ (String) parameters.get(PARAM_SRC_FOLDER)
+ };
+ }
addDefaultDirectories(project, AdtConstants.WS_ROOT, sourceFolders, monitor);
// Create the resource folders in the project if they don't already exist.
@@ -784,7 +828,9 @@ public class NewProjectCreator {
}
}
- Sdk.getCurrent().initProject(project, target);
+ if (isAndroidProject) {
+ Sdk.getCurrent().initProject(project, target);
+ }
// Fix the project to make sure all properties are as expected.
// Necessary for existing projects and good for new ones to.
@@ -866,7 +912,7 @@ public class NewProjectCreator {
public void run(IProgressMonitor submonitor) throws CoreException {
try {
creator.createEclipseProject(submonitor, project, description, parameters,
- dictionary, projectPopulator);
+ dictionary, projectPopulator, true);
} catch (IOException e) {
throw new CoreException(new Status(IStatus.ERROR, AdtPlugin.PLUGIN_ID,
"Unexpected error while creating project", e));
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/ProjectNamePage.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/ProjectNamePage.java
index 6bf5e28..d04ea89 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/ProjectNamePage.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newproject/ProjectNamePage.java
@@ -60,6 +60,7 @@ import org.eclipse.ui.IWorkingSet;
import java.io.File;
import java.net.URI;
+import java.util.Locale;
/**
* Initial page shown when creating projects which asks for the project name,
@@ -580,10 +581,13 @@ public class ProjectNamePage extends WizardPage implements SelectionListener, Mo
if (!nameStatus.isOK()) {
return nameStatus;
} else {
- IProject handle = workspace.getRoot().getProject(projectName);
- if (handle.exists()) {
- return new Status(IStatus.ERROR, AdtPlugin.PLUGIN_ID,
- "A project with that name already exists in the workspace");
+ // Note: the case-sensitiveness of the project name matters and can cause a
+ // conflict *later* when creating the project resource, so let's check it now.
+ for (IProject existingProj : workspace.getRoot().getProjects()) {
+ if (projectName.equalsIgnoreCase(existingProj.getName())) {
+ return new Status(IStatus.ERROR, AdtPlugin.PLUGIN_ID,
+ "A project with that name already exists in the workspace");
+ }
}
}
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newxmlfile/AddTranslationDialog.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newxmlfile/AddTranslationDialog.java
index 0be37cf..fcb3139 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newxmlfile/AddTranslationDialog.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/wizards/newxmlfile/AddTranslationDialog.java
@@ -21,11 +21,12 @@ import static com.android.SdkConstants.RES_QUALIFIER_SEP;
import com.android.ide.common.rendering.api.ResourceValue;
import com.android.ide.common.res2.ValueXmlHelper;
+import com.android.ide.common.resources.LocaleManager;
import com.android.ide.common.resources.ResourceItem;
import com.android.ide.common.resources.configuration.FolderConfiguration;
import com.android.ide.eclipse.adt.AdtPlugin;
import com.android.ide.eclipse.adt.AdtUtils;
-import com.android.ide.eclipse.adt.internal.editors.layout.configuration.LocaleManager;
+import com.android.ide.eclipse.adt.internal.editors.layout.configuration.FlagManager;
import com.android.ide.eclipse.adt.internal.editors.layout.gle2.ImageControl;
import com.android.ide.eclipse.adt.internal.editors.layout.gle2.RenderPreviewManager;
import com.android.ide.eclipse.adt.internal.resources.manager.ProjectResources;
@@ -358,7 +359,7 @@ public class AddTranslationDialog extends Dialog implements ControlListener, Sel
// Nothing selected
((GridData) mFlag.getLayoutData()).exclude = true;
} else {
- LocaleManager manager = LocaleManager.get();
+ FlagManager manager = FlagManager.get();
Image flag = manager.getFlag(mSelectedLanguage, mSelectedRegion);
if (flag != null) {
((GridData) mFlag.getLayoutData()).exclude = false;
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/messages.properties b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/messages.properties
index 80a2f45..3a85856 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/messages.properties
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/messages.properties
@@ -3,6 +3,7 @@ Could_Not_Find_Folder_In_SDK=Could not find folder '%1$s' inside SDK '%2$s'.
Could_Not_Find=Could not find %1$s\!
VersionCheck_Tools_Too_Old=This version of ADT requires Android SDK Tools revision %1$s or above.\n\nCurrent revision is %2$s.\n\nPlease update your SDK Tools to the latest version.
VersionCheck_Plugin_Version_Failed=Failed to get the required ADT version number from the SDK.\n\nThe Android Developer Toolkit may not work properly.
+VersionCheck_Build_Tool_Missing=The Android SDK requires the new Build Tools component to be installed.\n\nPlease open the SDK Manager and install \"Android SDK Build-tools".
VersionCheck_Unable_To_Parse_Version_s=Unable to parse sdk build version: %1$s
VersionCheck_Plugin_Too_Old=This Android SDK requires Android Developer Toolkit version %1$d.%2$d.%3$d or above.\n\nCurrent version is %4$s.\n\nPlease update ADT to the latest version.
AdtPlugin_Failed_To_Start_s=Failed to start %1$s
diff --git a/eclipse/plugins/com.android.ide.eclipse.base/.classpath b/eclipse/plugins/com.android.ide.eclipse.base/.classpath
index 81461ed..856475c 100644
--- a/eclipse/plugins/com.android.ide.eclipse.base/.classpath
+++ b/eclipse/plugins/com.android.ide.eclipse.base/.classpath
@@ -15,6 +15,7 @@
<classpathentry exported="true" kind="lib" path="libs/sdklib.jar" sourcepath="/sdklib"/>
<classpathentry exported="true" kind="lib" path="libs/sdkstats.jar" sourcepath="/sdkstats"/>
<classpathentry exported="true" kind="lib" path="libs/sdk-common.jar" sourcepath="/sdk-common"/>
+ <classpathentry exported="true" kind="lib" path="libs/httpmime-4.1.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="src" path="src"/>
diff --git a/eclipse/plugins/com.android.ide.eclipse.base/.settings/org.eclipse.jdt.core.prefs b/eclipse/plugins/com.android.ide.eclipse.base/.settings/org.eclipse.jdt.core.prefs
index 9dbff07..ea66196 100644
--- a/eclipse/plugins/com.android.ide.eclipse.base/.settings/org.eclipse.jdt.core.prefs
+++ b/eclipse/plugins/com.android.ide.eclipse.base/.settings/org.eclipse.jdt.core.prefs
@@ -48,10 +48,10 @@ org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignor
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
-org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecInsufficientInfo=warning
-org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=ignore
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
diff --git a/eclipse/plugins/com.android.ide.eclipse.ddms/.settings/org.eclipse.jdt.core.prefs b/eclipse/plugins/com.android.ide.eclipse.ddms/.settings/org.eclipse.jdt.core.prefs
index 9dbff07..ea66196 100644
--- a/eclipse/plugins/com.android.ide.eclipse.ddms/.settings/org.eclipse.jdt.core.prefs
+++ b/eclipse/plugins/com.android.ide.eclipse.ddms/.settings/org.eclipse.jdt.core.prefs
@@ -48,10 +48,10 @@ org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignor
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
-org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecInsufficientInfo=warning
-org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=ignore
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
diff --git a/eclipse/plugins/com.android.ide.eclipse.ddms/META-INF/MANIFEST.MF b/eclipse/plugins/com.android.ide.eclipse.ddms/META-INF/MANIFEST.MF
index f5209ca..06ead0f 100644
--- a/eclipse/plugins/com.android.ide.eclipse.ddms/META-INF/MANIFEST.MF
+++ b/eclipse/plugins/com.android.ide.eclipse.ddms/META-INF/MANIFEST.MF
@@ -38,6 +38,6 @@ Bundle-ClassPath: .,
libs/ddmuilib.jar,
libs/jcommon-1.0.12.jar,
libs/jfreechart-1.0.9.jar,
- libs/jfreechart-1.0.9-swt.jar,
+ libs/jfreechart-swt-1.0.9.jar,
libs/uiautomatorviewer.jar
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
diff --git a/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/DdmsPlugin.java b/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/DdmsPlugin.java
index b77c34f..e08080b 100644
--- a/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/DdmsPlugin.java
+++ b/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/DdmsPlugin.java
@@ -490,6 +490,10 @@ public final class DdmsPlugin extends AbstractUIPlugin implements IDeviceChangeL
return sAdbLocation;
}
+ public static File getPlatformToolsFolder() {
+ return new File(sAdbLocation).getParentFile();
+ }
+
public static String getToolsFolder() {
return sToolsFolder;
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/systrace/SystraceOptionsDialogV1.java b/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/systrace/SystraceOptionsDialogV1.java
index cacedd7..d4b5e5b 100644
--- a/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/systrace/SystraceOptionsDialogV1.java
+++ b/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/systrace/SystraceOptionsDialogV1.java
@@ -347,7 +347,7 @@ public class SystraceOptionsDialogV1 extends TitleAreaDialog implements ISystrac
if (mAmTagBtn.getSelection()) mOptions.enableTag(SystraceOptions.TAG_AM);
if (mSyncTagBtn.getSelection()) mOptions.enableTag(SystraceOptions.TAG_SYNC);
if (mAudioTagBtn.getSelection()) mOptions.enableTag(SystraceOptions.TAG_AUDIO);
- if (mViewTagBtn.getSelection()) mOptions.enableTag(SystraceOptions.TAG_VIDEO);
+ if (mVideoTagBtn.getSelection()) mOptions.enableTag(SystraceOptions.TAG_VIDEO);
if (mCameraTagBtn.getSelection()) mOptions.enableTag(SystraceOptions.TAG_CAMERA);
// save current selections to be restored if the dialog is invoked again
@@ -366,7 +366,7 @@ public class SystraceOptionsDialogV1 extends TitleAreaDialog implements ISystrac
sAmTag = mAmTagBtn.getSelection();
sSyncTag = mSyncTagBtn.getSelection();
sAudioTag = mAudioTagBtn.getSelection();
- sViewTag = mViewTagBtn.getSelection();
+ sVideoTag = mVideoTagBtn.getSelection();
sCameraTag = mCameraTagBtn.getSelection();
super.okPressed();
diff --git a/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/views/SystraceOptionsDialogV2.java b/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/systrace/SystraceOptionsDialogV2.java
index 887e352..104804a 100644
--- a/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/views/SystraceOptionsDialogV2.java
+++ b/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/systrace/SystraceOptionsDialogV2.java
@@ -14,12 +14,9 @@
* limitations under the License.
*/
-package com.android.ide.eclipse.ddms.views;
+package com.android.ide.eclipse.ddms.systrace;
import com.android.ddmuilib.TableHelper;
-import com.android.ide.eclipse.ddms.systrace.ISystraceOptions;
-import com.android.ide.eclipse.ddms.systrace.ISystraceOptionsDialog;
-import com.android.ide.eclipse.ddms.systrace.SystraceTag;
import org.eclipse.jface.dialogs.TitleAreaDialog;
import org.eclipse.swt.SWT;
@@ -30,6 +27,7 @@ import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.FileDialog;
@@ -54,20 +52,24 @@ public class SystraceOptionsDialogV2 extends TitleAreaDialog implements ISystrac
private String mDestinationPath;
private Text mTraceDurationText;
private Text mTraceBufferSizeText;
+ private Combo mTraceAppCombo;
private static String sSaveToFolder = System.getProperty("user.home"); //$NON-NLS-1$
private static String sTraceDuration = "";
private static String sTraceBufferSize = "";
private static Set<String> sEnabledTags = new HashSet<String>();
+ private static String sLastSelectedApp = null;
private final List<SystraceTag> mSupportedTags;
+ private final List<String> mCurrentApps;
private final SystraceOptions mOptions = new SystraceOptions();
private Table mTable;
- public SystraceOptionsDialogV2(Shell parentShell, List<SystraceTag> tags) {
+ public SystraceOptionsDialogV2(Shell parentShell, List<SystraceTag> tags, List<String> apps) {
super(parentShell);
mSupportedTags = tags;
+ mCurrentApps = apps;
}
@Override
@@ -114,6 +116,24 @@ public class SystraceOptionsDialogV2 extends TitleAreaDialog implements ISystrac
mTraceBufferSizeText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
mTraceBufferSizeText.setText(sTraceBufferSize);
+ Label lblTraceAppName = new Label(c, SWT.NONE);
+ lblTraceAppName.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
+ lblTraceAppName.setText("Enable Application Traces from: ");
+
+ mTraceAppCombo = new Combo(c, SWT.DROP_DOWN | SWT.READ_ONLY);
+ mTraceAppCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
+ String[] items = new String[mCurrentApps.size() + 1];
+ items[0] = "None";
+ for (int i = 0; i < mCurrentApps.size(); i++) {
+ items[i+1] = mCurrentApps.get(i);
+ }
+ mTraceAppCombo.setItems(items);
+ if (sLastSelectedApp != null) {
+ mTraceAppCombo.setText(sLastSelectedApp);
+ } else {
+ mTraceAppCombo.select(0);
+ }
+
Label separator = new Label(c, SWT.SEPARATOR | SWT.HORIZONTAL);
GridData gd = new GridData(GridData.FILL_HORIZONTAL);
gd.horizontalSpan = 3;
@@ -144,6 +164,7 @@ public class SystraceOptionsDialogV2 extends TitleAreaDialog implements ISystrac
for (SystraceTag tag : mSupportedTags) {
TableItem item = new TableItem(mTable, SWT.NONE);
item.setText(tag.info);
+ item.setChecked(sEnabledTags.contains(tag.tag));
}
TableHelper.createTableColumn(mTable,
@@ -247,6 +268,10 @@ public class SystraceOptionsDialogV2 extends TitleAreaDialog implements ISystrac
mOptions.mTraceBufferSize = Integer.parseInt(sTraceBufferSize);
}
+ if (mTraceAppCombo.getSelectionIndex() != 0) {
+ mOptions.mTraceApp = sLastSelectedApp = mTraceAppCombo.getText();
+ }
+
sEnabledTags.clear();
for (int i = 0; i < mTable.getItemCount(); i++) {
TableItem it = mTable.getItem(i);
@@ -271,6 +296,7 @@ public class SystraceOptionsDialogV2 extends TitleAreaDialog implements ISystrac
private class SystraceOptions implements ISystraceOptions {
private int mTraceBufferSize;
private int mTraceDuration;
+ private String mTraceApp;
@Override
public String getTags() {
@@ -281,6 +307,12 @@ public class SystraceOptionsDialogV2 extends TitleAreaDialog implements ISystrac
public String getOptions() {
StringBuilder sb = new StringBuilder(5 * mSupportedTags.size());
+ if (mTraceApp != null) {
+ sb.append("-a "); //$NON-NLS-1$
+ sb.append(mTraceApp);
+ sb.append(' ');
+ }
+
if (mTraceDuration > 0) {
sb.append("-t"); //$NON-NLS-1$
sb.append(mTraceDuration);
diff --git a/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/systrace/SystraceOutputParser.java b/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/systrace/SystraceOutputParser.java
index 7963a30..2548edc 100644
--- a/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/systrace/SystraceOutputParser.java
+++ b/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/systrace/SystraceOutputParser.java
@@ -29,50 +29,11 @@ import java.util.zip.Inflater;
public class SystraceOutputParser {
private static final String TRACE_START = "TRACE:\n"; //$NON-NLS-1$
- private static final String HTML_PREFIX = "<!DOCTYPE HTML>\n"
- + "<html>\n"
- + "<head i18n-values=\"dir:textdirection;\">\n"
- + "<title>Android System Trace</title>\n"
- + "%s\n"
- + "%s\n"
- + "<script language=\"javascript\">\n"
- + "document.addEventListener('DOMContentLoaded', function() {\n"
- + " if (!linuxPerfData)\n"
- + " return;\n"
- + " var m = new tracing.TimelineModel(linuxPerfData);\n"
- + " var timelineViewEl = document.querySelector('.view');\n"
- + " base.ui.decorate(timelineViewEl, tracing.TimelineView);\n"
- + " timelineViewEl.model = m;\n"
- + " timelineViewEl.tabIndex = 1;\n"
- + " timelineViewEl.timeline.focusElement = timelineViewEl;\n"
- + "});\n"
- + "</script>\n"
- + "<style>\n"
- + " .view {\n"
- + " overflow: hidden;\n"
- + " position: absolute;\n"
- + " top: 0;\n"
- + " bottom: 0;\n"
- + " left: 0;\n"
- + " right: 0;\n"
- + " }\n"
- + "</style>\n"
- + "</head>\n"
- + "<body>\n"
- + " <div class=\"view\">\n"
- + " </div>\n"
- + " <script>\n"
- + " var linuxPerfData = \"\\\n";
-
- private static final String HTML_SUFFIX =
- " dummy-0000 [000] 0.0: 0: trace_event_clock_sync: parent_ts=0.0\\n\";\n"
- + " </script>\n"
- + "</body>\n"
- + "</html>\n";
-
private final boolean mUncompress;
private final String mJs;
private final String mCss;
+ private final String mHtmlPrefix;
+ private final String mHtmlSuffix;
private byte[] mAtraceOutput;
private int mAtraceLength;
@@ -84,10 +45,13 @@ public class SystraceOutputParser {
* @param systraceJs systrace javascript content
* @param systraceCss systrace css content
*/
- public SystraceOutputParser(boolean compressedStream, String systraceJs, String systraceCss) {
+ public SystraceOutputParser(boolean compressedStream, String systraceJs, String systraceCss,
+ String htmlPrefix, String htmlSuffix) {
mUncompress = compressedStream;
mJs = systraceJs;
mCss = systraceCss;
+ mHtmlPrefix = htmlPrefix;
+ mHtmlSuffix = htmlSuffix;
}
/**
@@ -164,8 +128,8 @@ public class SystraceOutputParser {
// each line should end with the characters \n\ followed by a newline
String html_out = trace.replaceAll("\n", "\\\\n\\\\\n");
- String header = String.format(HTML_PREFIX, mCss, mJs);
- String footer = HTML_SUFFIX;
+ String header = String.format(mHtmlPrefix, mCss, mJs, "");
+ String footer = mHtmlSuffix;
return header + html_out + footer;
}
@@ -186,4 +150,20 @@ public class SystraceOutputParser {
return "";
}
}
+
+ public static String getHtmlPrefix(File assetsFolder) {
+ return getHtmlTemplate(assetsFolder, "prefix.html");
+ }
+
+ public static String getHtmlSuffix(File assetsFolder) {
+ return getHtmlTemplate(assetsFolder, "suffix.html");
+ }
+
+ private static String getHtmlTemplate(File assetsFolder, String htmlFileName) {
+ try {
+ return Files.toString(new File(assetsFolder, htmlFileName), Charsets.UTF_8);
+ } catch (IOException e) {
+ return "";
+ }
+ }
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/views/DeviceView.java b/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/views/DeviceView.java
index 3322b9c..13a4f99 100644
--- a/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/views/DeviceView.java
+++ b/eclipse/plugins/com.android.ide.eclipse.ddms/src/com/android/ide/eclipse/ddms/views/DeviceView.java
@@ -46,6 +46,7 @@ import com.android.ide.eclipse.ddms.preferences.PreferenceInitializer;
import com.android.ide.eclipse.ddms.systrace.ISystraceOptions;
import com.android.ide.eclipse.ddms.systrace.ISystraceOptionsDialog;
import com.android.ide.eclipse.ddms.systrace.SystraceOptionsDialogV1;
+import com.android.ide.eclipse.ddms.systrace.SystraceOptionsDialogV2;
import com.android.ide.eclipse.ddms.systrace.SystraceOutputParser;
import com.android.ide.eclipse.ddms.systrace.SystraceTask;
import com.android.ide.eclipse.ddms.systrace.SystraceVersionDetector;
@@ -89,6 +90,8 @@ import org.eclipse.ui.part.ViewPart;
import java.io.File;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
+import java.util.ArrayList;
+import java.util.List;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;
@@ -565,6 +568,14 @@ public class DeviceView extends ViewPart implements IUiSelectionListener, IClien
};
private void launchSystrace(final IDevice device, final Shell parentShell) {
+ final File systraceAssets = new File(DdmsPlugin.getPlatformToolsFolder(), "systrace"); //$NON-NLS-1$
+ if (!systraceAssets.isDirectory()) {
+ MessageDialog.openError(parentShell, "Systrace",
+ "Updated version of platform-tools (18.0.1 or greater) is required.\n"
+ + "Please update your platform-tools using SDK Manager.");
+ return;
+ }
+
SystraceVersionDetector detector = new SystraceVersionDetector(device);
try {
new ProgressMonitorDialog(parentShell).run(true, false, detector);
@@ -577,10 +588,20 @@ public class DeviceView extends ViewPart implements IUiSelectionListener, IClien
return;
}
- final ISystraceOptionsDialog dlg =
- (detector.getVersion() == SystraceVersionDetector.SYSTRACE_V1) ?
- new SystraceOptionsDialogV1(parentShell) :
- new SystraceOptionsDialogV2(parentShell, detector.getTags());
+ final ISystraceOptionsDialog dlg;
+ if (detector.getVersion() == SystraceVersionDetector.SYSTRACE_V1) {
+ dlg = new SystraceOptionsDialogV1(parentShell);
+ } else {
+ Client[] clients = device.getClients();
+ List<String> apps = new ArrayList<String>(clients.length);
+ for (int i = 0; i < clients.length; i++) {
+ String name = clients[i].getClientData().getClientDescription();
+ if (name != null && !name.isEmpty()) {
+ apps.add(name);
+ }
+ }
+ dlg = new SystraceOptionsDialogV2(parentShell, detector.getTags(), apps);
+ }
if (dlg.open() != SystraceOptionsDialogV1.OK) {
return;
@@ -646,11 +667,12 @@ public class DeviceView extends ViewPart implements IUiSelectionListener, IClien
}
monitor.setTaskName("Saving trace information");
- File systraceAssets = new File(DdmsPlugin.getToolsFolder(), "systrace"); //$NON-NLS-1$
SystraceOutputParser parser = new SystraceOutputParser(
COMPRESS_DATA,
SystraceOutputParser.getJs(systraceAssets),
- SystraceOutputParser.getCss(systraceAssets));
+ SystraceOutputParser.getCss(systraceAssets),
+ SystraceOutputParser.getHtmlPrefix(systraceAssets),
+ SystraceOutputParser.getHtmlSuffix(systraceAssets));
parser.parse(task.getAtraceOutput());
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger.tests/META-INF/MANIFEST.MF b/eclipse/plugins/com.android.ide.eclipse.gldebugger.tests/META-INF/MANIFEST.MF
index f1d0d25..84f1e79 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger.tests/META-INF/MANIFEST.MF
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger.tests/META-INF/MANIFEST.MF
@@ -4,6 +4,7 @@ Bundle-Name: gldebugger-tests
Bundle-SymbolicName: com.android.ide.eclipse.gldebugger.tests
Bundle-Version: 22.0.0.qualifier
Bundle-RequiredExecutionEnvironment: J2SE-1.5
-Require-Bundle: org.junit4;bundle-version="4.5.0",
+Require-Bundle: org.junit4;bundle-version="4.5.0";resolution:=optional,
com.android.ide.eclipse.gldebugger,
- org.eclipse.swt
+ org.eclipse.swt,
+ org.junit;bundle-version="4.11.0";resolution:=optional
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger.tests/src/com/android/ide/eclipse/gltrace/format/GLMessageFormatterTest.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger.tests/src/com/android/ide/eclipse/gltrace/format/GLMessageFormatterTest.java
index afbc09a..5d18041 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger.tests/src/com/android/ide/eclipse/gltrace/format/GLMessageFormatterTest.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger.tests/src/com/android/ide/eclipse/gltrace/format/GLMessageFormatterTest.java
@@ -60,7 +60,7 @@ public class GLMessageFormatterTest {
int arg2 = 10;
GLMessage msg = constructGLMessage(null, Function.glBindBuffer,
- createEnumDataType(arg1.value),
+ createEnumDataType((int)arg1.value),
createIntegerDataType(arg2));
String expected = String.format("glBindBuffer(target = %s, buffer = %s)",
@@ -79,7 +79,7 @@ public class GLMessageFormatterTest {
GLMessage msg = constructGLMessage(
createStringDataType(retValue),
Function.glGetString,
- createEnumDataType(arg1.value));
+ createEnumDataType((int)arg1.value));
String expected = String.format("%s(name = %s) = (const GLchar*) %s", Function.glGetString,
arg1.toString(), retValue);
String actual = sGLMessageFormatter.formatGLMessage(msg);
@@ -132,7 +132,7 @@ public class GLMessageFormatterTest {
//void, glGetActiveAttrib, GLenum* type
GLMessage msg = constructGLMessage(null,
Function.glGetActiveAttrib,
- createIntegerPointerDataType(GLEnum.GL_FLOAT_MAT4.value));
+ createIntegerPointerDataType((int)GLEnum.GL_FLOAT_MAT4.value));
String expected = "glGetActiveAttrib(type = [GL_FLOAT_MAT4])";
String actual = sGLMessageFormatter.formatGLMessage(msg);
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/.settings/org.eclipse.jdt.core.prefs b/eclipse/plugins/com.android.ide.eclipse.gldebugger/.settings/org.eclipse.jdt.core.prefs
index 9dbff07..ea66196 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/.settings/org.eclipse.jdt.core.prefs
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/.settings/org.eclipse.jdt.core.prefs
@@ -48,10 +48,10 @@ org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignor
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
-org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecInsufficientInfo=warning
-org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=ignore
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/entries.in b/eclipse/plugins/com.android.ide.eclipse.gldebugger/entries.in
index 763254d..46f2797 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/entries.in
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/entries.in
@@ -13,15 +13,22 @@ void, glAlphaFuncx, GLenum func, GLclampx ref
void, glAlphaFuncxOES, GLenum func, GLclampx ref
void, glAttachShader, GLuint program, GLuint shader
void, glBeginPerfMonitorAMD, GLuint monitor
+void, glBeginQuery, GLenum target, GLuint id
void, glBeginQueryEXT, GLenum target, GLuint id
+void, glBeginTransformFeedback, GLenum primitiveMode
void, glBindAttribLocation, GLuint program, GLuint index, const GLchar* name
void, glBindBuffer, GLenum target, GLuint buffer
+void, glBindBufferBase, GLenum target, GLuint index, GLuint buffer
+void, glBindBufferRange, GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size
void, glBindFramebuffer, GLenum target, GLuint framebuffer
void, glBindFramebufferOES, GLenum target, GLuint framebuffer
void, glBindProgramPipelineEXT, GLuint pipeline
void, glBindRenderbuffer, GLenum target, GLuint renderbuffer
void, glBindRenderbufferOES, GLenum target, GLuint renderbuffer
+void, glBindSampler, GLuint unit, GLuint sampler
void, glBindTexture, GLenum target, GLuint texture
+void, glBindTransformFeedback, GLenum target, GLuint id
+void, glBindVertexArray, GLuint array
void, glBindVertexArrayOES, GLuint array
void, glBlendColor, GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha
void, glBlendEquation, GLenum mode
@@ -31,12 +38,17 @@ void, glBlendEquationSeparateOES, GLenum modeRGB, GLenum modeAlpha
void, glBlendFunc, GLenum sfactor, GLenum dfactor
void, glBlendFuncSeparate, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha
void, glBlendFuncSeparateOES, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha
+void, glBlitFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter
void, glBlitFramebufferANGLE, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter
void, glBufferData, GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage
void, glBufferSubData, GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data
GLenum, glCheckFramebufferStatus, GLenum target
GLenum, glCheckFramebufferStatusOES, GLenum target
void, glClear, GLbitfield mask
+void, glClearBufferfi, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil
+void, glClearBufferfv, GLenum buffer, GLint drawbuffer, const GLfloat* value
+void, glClearBufferiv, GLenum buffer, GLint drawbuffer, const GLint* value
+void, glClearBufferuiv, GLenum buffer, GLint drawbuffer, const GLuint* value
void, glClearColor, GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha
void, glClearColorx, GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha
void, glClearColorxOES, GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha
@@ -46,6 +58,7 @@ void, glClearDepthx, GLclampx depth
void, glClearDepthxOES, GLclampx depth
void, glClearStencil, GLint s
void, glClientActiveTexture, GLenum texture
+GLenum, glClientWaitSync, GLsync sync, GLbitfield flags, GLuint64 timeout
void, glClipPlanef, GLenum plane, const GLfloat* equation
void, glClipPlanefIMG, GLenum p, const GLfloat* eqn
void, glClipPlanefOES, GLenum plane, const GLfloat* equation
@@ -60,11 +73,15 @@ void, glColorMask, GLboolean red, GLboolean green, GLboolean blue, GLboolean alp
void, glColorPointer, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer
void, glCompileShader, GLuint shader
void, glCompressedTexImage2D, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data
+void, glCompressedTexImage3D, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data
void, glCompressedTexImage3DOES, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data
void, glCompressedTexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data
+void, glCompressedTexSubImage3D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data
void, glCompressedTexSubImage3DOES, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data
+void, glCopyBufferSubData, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size
void, glCopyTexImage2D, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border
void, glCopyTexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height
+void, glCopyTexSubImage3D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height
void, glCopyTexSubImage3DOES, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height
void, glCoverageMaskNV, GLboolean mask
void, glCoverageOperationNV, GLenum operation
@@ -80,11 +97,16 @@ void, glDeleteFramebuffersOES, GLsizei n, const GLuint* framebuffers
void, glDeletePerfMonitorsAMD, GLsizei n, GLuint* monitors
void, glDeleteProgram, GLuint program
void, glDeleteProgramPipelinesEXT, GLsizei n, const GLuint* pipelines
+void, glDeleteQueries, GLsizei n, const GLuint* ids
void, glDeleteQueriesEXT, GLsizei n, const GLuint* ids
void, glDeleteRenderbuffers, GLsizei n, const GLuint* renderbuffers
void, glDeleteRenderbuffersOES, GLsizei n, const GLuint* renderbuffers
+void, glDeleteSamplers, GLsizei count, const GLuint* samplers
void, glDeleteShader, GLuint shader
+void, glDeleteSync, GLsync sync
void, glDeleteTextures, GLsizei n, const GLuint* textures
+void, glDeleteTransformFeedbacks, GLsizei n, const GLuint* ids
+void, glDeleteVertexArrays, GLsizei n, const GLuint* arrays
void, glDeleteVertexArraysOES, GLsizei n, const GLuint* arrays
void, glDepthFunc, GLenum func
void, glDepthMask, GLboolean flag
@@ -99,8 +121,12 @@ void, glDisableDriverControlQCOM, GLuint driverControl
void, glDisableVertexAttribArray, GLuint index
void, glDiscardFramebufferEXT, GLenum target, GLsizei numAttachments, const GLenum* attachments
void, glDrawArrays, GLenum mode, GLint first, GLsizei count
+void, glDrawArraysInstanced, GLenum mode, GLint first, GLsizei count, GLsizei instanceCount
+void, glDrawBuffers, GLsizei n, const GLenum* bufs
void, glDrawBuffersNV, GLsizei n, const GLenum* bufs
void, glDrawElements, GLenum mode, GLsizei count, GLenum type, const GLvoid* indices
+void, glDrawElementsInstanced, GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount
+void, glDrawRangeElements, GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices
void, glDrawTexfOES, GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height
void, glDrawTexfvOES, const GLfloat* coords
void, glDrawTexiOES, GLint x, GLint y, GLint z, GLint width, GLint height
@@ -116,8 +142,10 @@ void, glEnableClientState, GLenum array
void, glEnableDriverControlQCOM, GLuint driverControl
void, glEnableVertexAttribArray, GLuint index
void, glEndPerfMonitorAMD, GLuint monitor
+void, glEndQuery, GLenum target
void, glEndQueryEXT, GLenum target
void, glEndTilingQCOM, GLbitfield preserveMask
+void, glEndTransformFeedback, void
void, glExtGetBufferPointervQCOM, GLenum target, GLvoid** params
void, glExtGetBuffersQCOM, GLuint* buffers, GLint maxBuffers, GLint* numBuffers
void, glExtGetFramebuffersQCOM, GLuint* framebuffers, GLint maxFramebuffers, GLint* numFramebuffers
@@ -130,9 +158,11 @@ void, glExtGetTexSubImageQCOM, GLenum target, GLint level, GLint xoffset, GLint
void, glExtGetTexturesQCOM, GLuint* textures, GLint maxTextures, GLint* numTextures
GLboolean, glExtIsProgramBinaryQCOM, GLuint program
void, glExtTexObjectStateOverrideiQCOM, GLenum target, GLenum pname, GLint param
+GLsync, glFenceSync, GLenum condition, GLbitfield flags
void, glFinish, void
void, glFinishFenceNV, GLuint fence
void, glFlush, void
+void, glFlushMappedBufferRange, GLenum target, GLintptr offset, GLsizeiptr length
void, glFogf, GLenum pname, GLfloat param
void, glFogfv, GLenum pname, const GLfloat* params
void, glFogx, GLenum pname, GLfixed param
@@ -146,6 +176,7 @@ void, glFramebufferTexture2DMultisampleEXT, GLenum target, GLenum attachment, GL
void, glFramebufferTexture2DMultisampleIMG, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples
void, glFramebufferTexture2DOES, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level
void, glFramebufferTexture3DOES, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset
+void, glFramebufferTextureLayer, GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer
void, glFrontFace, GLenum mode
void, glFrustumf, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar
void, glFrustumfOES, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar
@@ -157,20 +188,29 @@ void, glGenFramebuffers, GLsizei n, GLuint* framebuffers
void, glGenFramebuffersOES, GLsizei n, GLuint* framebuffers
void, glGenPerfMonitorsAMD, GLsizei n, GLuint* monitors
void, glGenProgramPipelinesEXT, GLsizei n, GLuint* pipelines
+void, glGenQueries, GLsizei n, GLuint* ids
void, glGenQueriesEXT, GLsizei n, GLuint* ids
void, glGenRenderbuffers, GLsizei n, GLuint* renderbuffers
void, glGenRenderbuffersOES, GLsizei n, GLuint* renderbuffers
+void, glGenSamplers, GLsizei count, GLuint* samplers
void, glGenTextures, GLsizei n, GLuint* textures
+void, glGenTransformFeedbacks, GLsizei n, GLuint* ids
+void, glGenVertexArrays, GLsizei n, GLuint* arrays
void, glGenVertexArraysOES, GLsizei n, GLuint* arrays
void, glGenerateMipmap, GLenum target
void, glGenerateMipmapOES, GLenum target
void, glGetActiveAttrib, GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name
void, glGetActiveUniform, GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name
+void, glGetActiveUniformBlockName, GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName
+void, glGetActiveUniformBlockiv, GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params
+void, glGetActiveUniformsiv, GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params
void, glGetAttachedShaders, GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders
-int, glGetAttribLocation, GLuint program, const GLchar* name
+GLint, glGetAttribLocation, GLuint program, const GLchar* name
void, glGetBooleanv, GLenum pname, GLboolean* params
+void, glGetBufferParameteri64v, GLenum target, GLenum pname, GLint64* params
void, glGetBufferParameteriv, GLenum target, GLenum pname, GLint* params
-void, glGetBufferPointervOES, GLenum target, GLenum pname, GLvoid** params
+void, glGetBufferPointerv, GLenum target, GLenum pname, GLvoid** params
+void, glGetBufferPointervOES, GLenum target, GLenum pname, GLvoid** params
void, glGetClipPlanef, GLenum pname, GLfloat eqn[4]
void, glGetClipPlanefOES, GLenum pname, GLfloat eqn[4]
void, glGetClipPlanex, GLenum pname, GLfixed eqn[4]
@@ -182,10 +222,15 @@ void, glGetFenceivNV, GLuint fence, GLenum pname, GLint* params
void, glGetFixedv, GLenum pname, GLfixed* params
void, glGetFixedvOES, GLenum pname, GLfixed* params
void, glGetFloatv, GLenum pname, GLfloat* params
+GLint, glGetFragDataLocation, GLuint program, const GLchar* name
void, glGetFramebufferAttachmentParameteriv, GLenum target, GLenum attachment, GLenum pname, GLint* params
void, glGetFramebufferAttachmentParameterivOES, GLenum target, GLenum attachment, GLenum pname, GLint* params
GLenum, glGetGraphicsResetStatusEXT, void
+void, glGetInteger64i_v, GLenum target, GLuint index, GLint64* data
+void, glGetInteger64v, GLenum pname, GLint64* params
+void, glGetIntegeri_v, GLenum target, GLuint index, GLint* data
void, glGetIntegerv, GLenum pname, GLint* params
+void, glGetInternalformativ, GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params
void, glGetLightfv, GLenum light, GLenum pname, GLfloat* params
void, glGetLightxv, GLenum light, GLenum pname, GLfixed* params
void, glGetLightxvOES, GLenum light, GLenum pname, GLfixed* params
@@ -200,20 +245,27 @@ void, glGetPerfMonitorCountersAMD, GLuint group, GLint* numCounters, GLint* maxA
void, glGetPerfMonitorGroupStringAMD, GLuint group, GLsizei bufSize, GLsizei* length, GLchar* groupString
void, glGetPerfMonitorGroupsAMD, GLint* numGroups, GLsizei groupsSize, GLuint* groups
void, glGetPointerv, GLenum pname, GLvoid** params
+void, glGetProgramBinary, GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary
void, glGetProgramBinaryOES, GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary
void, glGetProgramInfoLog, GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog
void, glGetProgramPipelineInfoLogEXT, GLuint pipeline, GLsizei bufSize, GLsizei* length, GLchar* infoLog
void, glGetProgramPipelineivEXT, GLuint pipeline, GLenum pname, GLint* params
void, glGetProgramiv, GLuint program, GLenum pname, GLint* params
+void, glGetQueryObjectuiv, GLuint id, GLenum pname, GLuint* params
void, glGetQueryObjectuivEXT, GLuint id, GLenum pname, GLuint* params
+void, glGetQueryiv, GLenum target, GLenum pname, GLint* params
void, glGetQueryivEXT, GLenum target, GLenum pname, GLint* params
void, glGetRenderbufferParameteriv, GLenum target, GLenum pname, GLint* params
void, glGetRenderbufferParameterivOES, GLenum target, GLenum pname, GLint* params
+void, glGetSamplerParameterfv, GLuint sampler, GLenum pname, GLfloat* params
+void, glGetSamplerParameteriv, GLuint sampler, GLenum pname, GLint* params
void, glGetShaderInfoLog, GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog
void, glGetShaderPrecisionFormat, GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision
void, glGetShaderSource, GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source
void, glGetShaderiv, GLuint shader, GLenum pname, GLint* params
const GLchar* , glGetString, GLenum name
+const GLubyte*, glGetStringi, GLenum name, GLuint index
+void, glGetSynciv, GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values
void, glGetTexEnvfv, GLenum env, GLenum pname, GLfloat* params
void, glGetTexEnviv, GLenum env, GLenum pname, GLint* params
void, glGetTexEnvxv, GLenum env, GLenum pname, GLfixed* params
@@ -225,9 +277,15 @@ void, glGetTexParameterfv, GLenum target, GLenum pname, GLfloat* params
void, glGetTexParameteriv, GLenum target, GLenum pname, GLint* params
void, glGetTexParameterxv, GLenum target, GLenum pname, GLfixed* params
void, glGetTexParameterxvOES, GLenum target, GLenum pname, GLfixed* params
-int, glGetUniformLocation, GLuint program, const GLchar* name
+void, glGetTransformFeedbackVarying, GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name
+GLuint, glGetUniformBlockIndex, GLuint program, const GLchar* uniformBlockName
+void, glGetUniformIndices, GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices
+GLint, glGetUniformLocation, GLuint program, const GLchar* name
void, glGetUniformfv, GLuint program, GLint location, GLfloat* params
void, glGetUniformiv, GLuint program, GLint location, GLint* params
+void, glGetUniformuiv, GLuint program, GLint location, GLuint* params
+void, glGetVertexAttribIiv, GLuint index, GLenum pname, GLint* params
+void, glGetVertexAttribIuiv, GLuint index, GLenum pname, GLuint* params
void, glGetVertexAttribPointerv, GLuint index, GLenum pname, GLvoid** pointer
void, glGetVertexAttribfv, GLuint index, GLenum pname, GLfloat* params
void, glGetVertexAttribiv, GLuint index, GLenum pname, GLint* params
@@ -235,6 +293,8 @@ void, glGetnUniformfvEXT, GLuint program, GLint location, GLsizei bufSize, float
void, glGetnUniformivEXT, GLuint program, GLint location, GLsizei bufSize, GLint* params
void, glHint, GLenum target, GLenum mode
void, glInsertEventMarkerEXT, GLsizei length, const GLchar* marker
+void, glInvalidateFramebuffer, GLenum target, GLsizei numAttachments, const GLenum* attachments
+void, glInvalidateSubFramebuffer, GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height
GLboolean, glIsBuffer, GLuint buffer
GLboolean, glIsEnabled, GLenum cap
GLboolean, glIsFenceNV, GLuint fence
@@ -242,11 +302,16 @@ GLboolean, glIsFramebuffer, GLuint framebuffer
GLboolean, glIsFramebufferOES, GLuint framebuffer
GLboolean, glIsProgram, GLuint program
GLboolean, glIsProgramPipelineEXT, GLuint pipeline
+GLboolean, glIsQuery, GLuint id
GLboolean, glIsQueryEXT, GLuint id
GLboolean, glIsRenderbuffer, GLuint renderbuffer
GLboolean, glIsRenderbufferOES, GLuint renderbuffer
+GLboolean, glIsSampler, GLuint sampler
GLboolean, glIsShader, GLuint shader
+GLboolean, glIsSync, GLsync sync
GLboolean, glIsTexture, GLuint texture
+GLboolean, glIsTransformFeedback, GLuint id
+GLboolean, glIsVertexArray, GLuint array
GLboolean, glIsVertexArrayOES, GLuint array
void, glLabelObjectEXT, GLenum type, GLuint object, GLsizei length, const GLchar* label
void, glLightModelf, GLenum pname, GLfloat param
@@ -272,6 +337,7 @@ void, glLoadMatrixxOES, const GLfixed* m
void, glLoadPaletteFromModelViewMatrixOES, void
void, glLogicOp, GLenum opcode
void*, glMapBufferOES, GLenum target, GLenum access
+GLvoid*, glMapBufferRange, GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access
void, glMaterialf, GLenum face, GLenum pname, GLfloat param
void, glMaterialfv, GLenum face, GLenum pname, const GLfloat* params
void, glMaterialx, GLenum face, GLenum pname, GLfixed param
@@ -296,6 +362,7 @@ void, glOrthof, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloa
void, glOrthofOES, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar
void, glOrthox, GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar
void, glOrthoxOES, GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar
+void, glPauseTransformFeedback, void
void, glPixelStorei, GLenum pname, GLint param
void, glPointParameterf, GLenum pname, GLfloat param
void, glPointParameterfv, GLenum pname, const GLfloat* params
@@ -312,7 +379,9 @@ void, glPolygonOffsetx, GLfixed factor, GLfixed units
void, glPolygonOffsetxOES, GLfixed factor, GLfixed units
void, glPopGroupMarkerEXT, void
void, glPopMatrix, void
+void, glProgramBinary, GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length
void, glProgramBinaryOES, GLuint program, GLenum binaryFormat, const GLvoid* binary, GLint length
+void, glProgramParameteri, GLuint program, GLenum pname, GLint value
void, glProgramParameteriEXT, GLuint program, GLenum pname, GLint value
void, glProgramUniform1fEXT, GLuint program, GLint location, GLfloat x
void, glProgramUniform1fvEXT, GLuint program, GLint location, GLsizei count, const GLfloat* value
@@ -336,23 +405,30 @@ void, glProgramUniformMatrix4fvEXT, GLuint program, GLint location, GLsizei coun
void, glPushGroupMarkerEXT, GLsizei length, const GLchar* marker
void, glPushMatrix, void
GLbitfield, glQueryMatrixxOES, GLfixed mantissa[16], GLint exponent[16]
+void, glReadBuffer, GLenum mode
void, glReadBufferNV, GLenum mode
void, glReadPixels, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels
void, glReadnPixelsEXT, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void* data
void, glReleaseShaderCompiler, void
void, glRenderbufferStorage, GLenum target, GLenum internalformat, GLsizei width, GLsizei height
+void, glRenderbufferStorageMultisample, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height
void, glRenderbufferStorageMultisampleANGLE, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height
void, glRenderbufferStorageMultisampleAPPLE, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height
void, glRenderbufferStorageMultisampleEXT, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height
void, glRenderbufferStorageMultisampleIMG, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height
void, glRenderbufferStorageOES, GLenum target, GLenum internalformat, GLsizei width, GLsizei height
void, glResolveMultisampleFramebufferAPPLE, void
+void, glResumeTransformFeedback, void
void, glRotatef, GLfloat angle, GLfloat x, GLfloat y, GLfloat z
void, glRotatex, GLfixed angle, GLfixed x, GLfixed y, GLfixed z
void, glRotatexOES, GLfixed angle, GLfixed x, GLfixed y, GLfixed z
void, glSampleCoverage, GLclampf value, GLboolean invert
void, glSampleCoveragex, GLclampx value, GLboolean invert
void, glSampleCoveragexOES, GLclampx value, GLboolean invert
+void, glSamplerParameterf, GLuint sampler, GLenum pname, GLfloat param
+void, glSamplerParameterfv, GLuint sampler, GLenum pname, const GLfloat* param
+void, glSamplerParameteri, GLuint sampler, GLenum pname, GLint param
+void, glSamplerParameteriv, GLuint sampler, GLenum pname, const GLint* param
void, glScalef, GLfloat x, GLfloat y, GLfloat z
void, glScalex, GLfixed x, GLfixed y, GLfixed z
void, glScalexOES, GLfixed x, GLfixed y, GLfixed z
@@ -385,7 +461,8 @@ void, glTexGeniOES, GLenum coord, GLenum pname, GLint param
void, glTexGenivOES, GLenum coord, GLenum pname, const GLint* params
void, glTexGenxOES, GLenum coord, GLenum pname, GLfixed param
void, glTexGenxvOES, GLenum coord, GLenum pname, const GLfixed* params
-void, glTexImage2D, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels
+void, glTexImage2D, GLenum target, GLint level, GLEnum internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels
+void, glTexImage3D, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels
void, glTexImage3DOES, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels
void, glTexParameterf, GLenum target, GLenum pname, GLfloat param
void, glTexParameterfv, GLenum target, GLenum pname, const GLfloat* params
@@ -396,13 +473,17 @@ void, glTexParameterxOES, GLenum target, GLenum pname, GLfixed param
void, glTexParameterxv, GLenum target, GLenum pname, const GLfixed* params
void, glTexParameterxvOES, GLenum target, GLenum pname, const GLfixed* params
void, glTexStorage1DEXT, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width
+void, glTexStorage2D, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height
void, glTexStorage2DEXT, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height
+void, glTexStorage3D, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth
void, glTexStorage3DEXT, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth
void, glTexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels
+void, glTexSubImage3D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels
void, glTexSubImage3DOES, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels
void, glTextureStorage1DEXT, GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width
void, glTextureStorage2DEXT, GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height
void, glTextureStorage3DEXT, GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth
+void, glTransformFeedbackVaryings, GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode
void, glTranslatef, GLfloat x, GLfloat y, GLfloat z
void, glTranslatex, GLfixed x, GLfixed y, GLfixed z
void, glTranslatexOES, GLfixed x, GLfixed y, GLfixed z
@@ -410,21 +491,37 @@ void, glUniform1f, GLint location, GLfloat x
void, glUniform1fv, GLint location, GLsizei count, const GLfloat* v
void, glUniform1i, GLint location, GLint x
void, glUniform1iv, GLint location, GLsizei count, const GLint* v
+void, glUniform1ui, GLint location, GLuint v0
+void, glUniform1uiv, GLint location, GLsizei count, const GLuint* value
void, glUniform2f, GLint location, GLfloat x, GLfloat y
void, glUniform2fv, GLint location, GLsizei count, const GLfloat* v
void, glUniform2i, GLint location, GLint x, GLint y
void, glUniform2iv, GLint location, GLsizei count, const GLint* v
+void, glUniform2ui, GLint location, GLuint v0, GLuint v1
+void, glUniform2uiv, GLint location, GLsizei count, const GLuint* value
void, glUniform3f, GLint location, GLfloat x, GLfloat y, GLfloat z
void, glUniform3fv, GLint location, GLsizei count, const GLfloat* v
void, glUniform3i, GLint location, GLint x, GLint y, GLint z
void, glUniform3iv, GLint location, GLsizei count, const GLint* v
+void, glUniform3ui, GLint location, GLuint v0, GLuint v1, GLuint v2
+void, glUniform3uiv, GLint location, GLsizei count, const GLuint* value
void, glUniform4f, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w
void, glUniform4fv, GLint location, GLsizei count, const GLfloat* v
void, glUniform4i, GLint location, GLint x, GLint y, GLint z, GLint w
void, glUniform4iv, GLint location, GLsizei count, const GLint* v
+void, glUniform4ui, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3
+void, glUniform4uiv, GLint location, GLsizei count, const GLuint* value
+void, glUniformBlockBinding, GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding
void, glUniformMatrix2fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value
+void, glUniformMatrix2x3fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value
+void, glUniformMatrix2x4fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value
void, glUniformMatrix3fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value
+void, glUniformMatrix3x2fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value
+void, glUniformMatrix3x4fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value
void, glUniformMatrix4fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value
+void, glUniformMatrix4x2fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value
+void, glUniformMatrix4x3fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value
+GLboolean, glUnmapBuffer, GLenum target
GLboolean, glUnmapBufferOES, GLenum target
void, glUseProgram, GLuint program
void, glUseProgramStagesEXT, GLuint pipeline, GLbitfield stages, GLuint program
@@ -438,8 +535,15 @@ void, glVertexAttrib3f, GLuint indx, GLfloat x, GLfloat y, GLfloat z
void, glVertexAttrib3fv, GLuint indx, const GLfloat* values
void, glVertexAttrib4f, GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w
void, glVertexAttrib4fv, GLuint indx, const GLfloat* values
+void, glVertexAttribDivisor, GLuint index, GLuint divisor
+void, glVertexAttribI4i, GLuint index, GLint x, GLint y, GLint z, GLint w
+void, glVertexAttribI4iv, GLuint index, const GLint* v
+void, glVertexAttribI4ui, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w
+void, glVertexAttribI4uiv, GLuint index, const GLuint* v
+void, glVertexAttribIPointer, GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer
void, glVertexAttribPointer, GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr
void, glVertexAttribPointerData, GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr, GLuint minIndex, GLuint maxIndex
void, glVertexPointer, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer
void, glViewport, GLint x, GLint y, GLsizei width, GLsizei height
+void, glWaitSync, GLsync sync, GLbitfield flags, GLuint64 timeout
void, glWeightPointerOES, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLEnum.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLEnum.java
index 97c04ca..ceb9f1a 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLEnum.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLEnum.java
@@ -19,7 +19,7 @@
package com.android.ide.eclipse.gltrace;
public enum GLEnum {
- GL_POINTS(0x0000),
+ GL_NONE(0x0000),
GL_LINES(0x0001),
GL_LINE_LOOP(0x0002),
GL_LINE_STRIP(0x0003),
@@ -307,7 +307,6 @@ public enum GLEnum {
GL_POINT_FADE_THRESHOLD_SIZE(0x8128),
GL_POINT_DISTANCE_ATTENUATION(0x8129),
GL_CLAMP_TO_EDGE(0x812F),
- GL_TEXTURE_MAX_LEVEL_APPLE(0x813D),
GL_GENERATE_MIPMAP(0x8191),
GL_GENERATE_MIPMAP_HINT(0x8192),
GL_DEPTH_COMPONENT16(0x81A5),
@@ -488,8 +487,6 @@ public enum GLEnum {
GL_MATRIX_INDEX_ARRAY_TYPE(0x8847),
GL_MATRIX_INDEX_ARRAY_STRIDE(0x8848),
GL_MATRIX_INDEX_ARRAY_POINTER(0x8849),
- GL_TEXTURE_COMPARE_MODE_EXT(0x884C),
- GL_TEXTURE_COMPARE_FUNC_EXT(0x884D),
GL_COMPARE_REF_TO_TEXTURE_EXT(0x884E),
GL_CURRENT_QUERY_EXT(0x8865),
GL_QUERY_RESULT_EXT(0x8866),
@@ -718,21 +715,303 @@ public enum GLEnum {
GL_VERTEX_ARRAY_OBJECT_EXT(0x9154),
GL_SHADER_BINARY_DMP(0x9250),
GL_BGRA8_EXT(0x93A1),
+
+ // Constants defined by ES3
+ GL_READ_BUFFER(0x0C02),
+ GL_PACK_ROW_LENGTH(0x0D02),
+ GL_PACK_SKIP_ROWS(0x0D03),
+ GL_PACK_SKIP_PIXELS(0x0D04),
+ GL_COLOR(0x1800),
+ GL_DEPTH(0x1801),
+ GL_STENCIL(0x1802),
+ GL_RED(0x1903),
+ GL_RGB10_A2(0x8059),
+ GL_UNPACK_SKIP_IMAGES(0x806D),
+ GL_UNPACK_IMAGE_HEIGHT(0x806E),
+ GL_UNSIGNED_INT_2_10_10_10_REV(0x8368),
+ GL_MAX_ELEMENTS_VERTICES(0x80E8),
+ GL_MAX_ELEMENTS_INDICES(0x80E9),
+ GL_TEXTURE_MIN_LOD(0x813A),
+ GL_TEXTURE_MAX_LOD(0x813B),
+ GL_TEXTURE_BASE_LEVEL(0x813C),
+ GL_TEXTURE_MAX_LEVEL(0x813D),
+ GL_MIN(0x8007),
+ GL_MAX(0x8008),
+ GL_MAX_TEXTURE_LOD_BIAS(0x84FD),
+ GL_TEXTURE_COMPARE_MODE(0x884C),
+ GL_TEXTURE_COMPARE_FUNC(0x884D),
+ GL_CURRENT_QUERY(0x8865),
+ GL_QUERY_RESULT(0x8866),
+ GL_QUERY_RESULT_AVAILABLE(0x8867),
+ GL_STREAM_READ(0x88E1),
+ GL_STREAM_COPY(0x88E2),
+ GL_STATIC_READ(0x88E5),
+ GL_STATIC_COPY(0x88E6),
+ GL_DYNAMIC_READ(0x88E9),
+ GL_DYNAMIC_COPY(0x88EA),
+ GL_MAX_DRAW_BUFFERS(0x8824),
+ GL_DRAW_BUFFER0(0x8825),
+ GL_DRAW_BUFFER1(0x8826),
+ GL_DRAW_BUFFER2(0x8827),
+ GL_DRAW_BUFFER3(0x8828),
+ GL_DRAW_BUFFER4(0x8829),
+ GL_DRAW_BUFFER5(0x882A),
+ GL_DRAW_BUFFER6(0x882B),
+ GL_DRAW_BUFFER7(0x882C),
+ GL_DRAW_BUFFER8(0x882D),
+ GL_DRAW_BUFFER9(0x882E),
+ GL_DRAW_BUFFER10(0x882F),
+ GL_DRAW_BUFFER11(0x8830),
+ GL_DRAW_BUFFER12(0x8831),
+ GL_DRAW_BUFFER13(0x8832),
+ GL_DRAW_BUFFER14(0x8833),
+ GL_DRAW_BUFFER15(0x8834),
+ GL_MAX_FRAGMENT_UNIFORM_COMPONENTS(0x8B49),
+ GL_MAX_VERTEX_UNIFORM_COMPONENTS(0x8B4A),
+ GL_SAMPLER_2D_SHADOW(0x8B62),
+ GL_PIXEL_PACK_BUFFER(0x88EB),
+ GL_PIXEL_UNPACK_BUFFER(0x88EC),
+ GL_PIXEL_PACK_BUFFER_BINDING(0x88ED),
+ GL_PIXEL_UNPACK_BUFFER_BINDING(0x88EF),
+ GL_FLOAT_MAT2x3(0x8B65),
+ GL_FLOAT_MAT2x4(0x8B66),
+ GL_FLOAT_MAT3x2(0x8B67),
+ GL_FLOAT_MAT3x4(0x8B68),
+ GL_FLOAT_MAT4x2(0x8B69),
+ GL_FLOAT_MAT4x3(0x8B6A),
+ GL_SRGB(0x8C40),
+ GL_SRGB8(0x8C41),
+ GL_SRGB8_ALPHA8(0x8C43),
+ GL_COMPARE_REF_TO_TEXTURE(0x884E),
+ GL_MAJOR_VERSION(0x821B),
+ GL_MINOR_VERSION(0x821C),
+ GL_NUM_EXTENSIONS(0x821D),
+ GL_RGBA32F(0x8814),
+ GL_RGB32F(0x8815),
+ GL_RGBA16F(0x881A),
+ GL_RGB16F(0x881B),
+ GL_VERTEX_ATTRIB_ARRAY_INTEGER(0x88FD),
+ GL_MAX_ARRAY_TEXTURE_LAYERS(0x88FF),
+ GL_MIN_PROGRAM_TEXEL_OFFSET(0x8904),
+ GL_MAX_PROGRAM_TEXEL_OFFSET(0x8905),
+ GL_MAX_VARYING_COMPONENTS(0x8B4B),
+ GL_TEXTURE_2D_ARRAY(0x8C1A),
+ GL_TEXTURE_BINDING_2D_ARRAY(0x8C1D),
+ GL_R11F_G11F_B10F(0x8C3A),
+ GL_UNSIGNED_INT_10F_11F_11F_REV(0x8C3B),
+ GL_RGB9_E5(0x8C3D),
+ GL_UNSIGNED_INT_5_9_9_9_REV(0x8C3E),
+ GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH(0x8C76),
+ GL_TRANSFORM_FEEDBACK_BUFFER_MODE(0x8C7F),
+ GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS(0x8C80),
+ GL_TRANSFORM_FEEDBACK_VARYINGS(0x8C83),
+ GL_TRANSFORM_FEEDBACK_BUFFER_START(0x8C84),
+ GL_TRANSFORM_FEEDBACK_BUFFER_SIZE(0x8C85),
+ GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN(0x8C88),
+ GL_RASTERIZER_DISCARD(0x8C89),
+ GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS(0x8C8A),
+ GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS(0x8C8B),
+ GL_INTERLEAVED_ATTRIBS(0x8C8C),
+ GL_SEPARATE_ATTRIBS(0x8C8D),
+ GL_TRANSFORM_FEEDBACK_BUFFER(0x8C8E),
+ GL_TRANSFORM_FEEDBACK_BUFFER_BINDING(0x8C8F),
+ GL_RGBA32UI(0x8D70),
+ GL_RGB32UI(0x8D71),
+ GL_RGBA16UI(0x8D76),
+ GL_RGB16UI(0x8D77),
+ GL_RGBA8UI(0x8D7C),
+ GL_RGB8UI(0x8D7D),
+ GL_RGBA32I(0x8D82),
+ GL_RGB32I(0x8D83),
+ GL_RGBA16I(0x8D88),
+ GL_RGB16I(0x8D89),
+ GL_RGBA8I(0x8D8E),
+ GL_RGB8I(0x8D8F),
+ GL_RED_INTEGER(0x8D94),
+ GL_RGB_INTEGER(0x8D98),
+ GL_RGBA_INTEGER(0x8D99),
+ GL_SAMPLER_2D_ARRAY(0x8DC1),
+ GL_SAMPLER_2D_ARRAY_SHADOW(0x8DC4),
+ GL_SAMPLER_CUBE_SHADOW(0x8DC5),
+ GL_UNSIGNED_INT_VEC2(0x8DC6),
+ GL_UNSIGNED_INT_VEC3(0x8DC7),
+ GL_UNSIGNED_INT_VEC4(0x8DC8),
+ GL_INT_SAMPLER_2D(0x8DCA),
+ GL_INT_SAMPLER_3D(0x8DCB),
+ GL_INT_SAMPLER_CUBE(0x8DCC),
+ GL_INT_SAMPLER_2D_ARRAY(0x8DCF),
+ GL_UNSIGNED_INT_SAMPLER_2D(0x8DD2),
+ GL_UNSIGNED_INT_SAMPLER_3D(0x8DD3),
+ GL_UNSIGNED_INT_SAMPLER_CUBE(0x8DD4),
+ GL_UNSIGNED_INT_SAMPLER_2D_ARRAY(0x8DD7),
+ GL_BUFFER_ACCESS_FLAGS(0x911F),
+ GL_BUFFER_MAP_LENGTH(0x9120),
+ GL_BUFFER_MAP_OFFSET(0x9121),
+ GL_DEPTH_COMPONENT32F(0x8CAC),
+ GL_DEPTH32F_STENCIL8(0x8CAD),
+ GL_FLOAT_32_UNSIGNED_INT_24_8_REV(0x8DAD),
+ GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING(0x8210),
+ GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE(0x8211),
+ GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE(0x8212),
+ GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE(0x8213),
+ GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE(0x8214),
+ GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE(0x8215),
+ GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE(0x8216),
+ GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE(0x8217),
+ GL_FRAMEBUFFER_DEFAULT(0x8218),
+ GL_FRAMEBUFFER_UNDEFINED(0x8219),
+ GL_DEPTH_STENCIL_ATTACHMENT(0x821A),
+ GL_UNSIGNED_NORMALIZED(0x8C17),
+ GL_READ_FRAMEBUFFER(0x8CA8),
+ GL_DRAW_FRAMEBUFFER(0x8CA9),
+ GL_READ_FRAMEBUFFER_BINDING(0x8CAA),
+ GL_RENDERBUFFER_SAMPLES(0x8CAB),
+ GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER(0x8CD4),
+ GL_MAX_COLOR_ATTACHMENTS(0x8CDF),
+ GL_COLOR_ATTACHMENT1(0x8CE1),
+ GL_COLOR_ATTACHMENT2(0x8CE2),
+ GL_COLOR_ATTACHMENT3(0x8CE3),
+ GL_COLOR_ATTACHMENT4(0x8CE4),
+ GL_COLOR_ATTACHMENT5(0x8CE5),
+ GL_COLOR_ATTACHMENT6(0x8CE6),
+ GL_COLOR_ATTACHMENT7(0x8CE7),
+ GL_COLOR_ATTACHMENT8(0x8CE8),
+ GL_COLOR_ATTACHMENT9(0x8CE9),
+ GL_COLOR_ATTACHMENT10(0x8CEA),
+ GL_COLOR_ATTACHMENT11(0x8CEB),
+ GL_COLOR_ATTACHMENT12(0x8CEC),
+ GL_COLOR_ATTACHMENT13(0x8CED),
+ GL_COLOR_ATTACHMENT14(0x8CEE),
+ GL_COLOR_ATTACHMENT15(0x8CEF),
+ GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE(0x8D56),
+ GL_MAX_SAMPLES(0x8D57),
+ GL_MAP_READ_BIT(0x0001),
+ GL_MAP_WRITE_BIT(0x0002),
+ GL_MAP_INVALIDATE_RANGE_BIT(0x0004),
+ GL_MAP_INVALIDATE_BUFFER_BIT(0x0008),
+ GL_MAP_FLUSH_EXPLICIT_BIT(0x0010),
+ GL_MAP_UNSYNCHRONIZED_BIT(0x0020),
+ GL_RG(0x8227),
+ GL_RG_INTEGER(0x8228),
+ GL_R8(0x8229),
+ GL_RG8(0x822B),
+ GL_R16F(0x822D),
+ GL_R32F(0x822E),
+ GL_RG16F(0x822F),
+ GL_RG32F(0x8230),
+ GL_R8I(0x8231),
+ GL_R8UI(0x8232),
+ GL_R16I(0x8233),
+ GL_R16UI(0x8234),
+ GL_R32I(0x8235),
+ GL_R32UI(0x8236),
+ GL_RG8I(0x8237),
+ GL_RG8UI(0x8238),
+ GL_RG16I(0x8239),
+ GL_RG16UI(0x823A),
+ GL_RG32I(0x823B),
+ GL_RG32UI(0x823C),
+ GL_R8_SNORM(0x8F94),
+ GL_RG8_SNORM(0x8F95),
+ GL_RGB8_SNORM(0x8F96),
+ GL_RGBA8_SNORM(0x8F97),
+ GL_SIGNED_NORMALIZED(0x8F9C),
+ GL_PRIMITIVE_RESTART_FIXED_INDEX(0x8D69),
+ GL_COPY_READ_BUFFER(0x8F36),
+ GL_COPY_WRITE_BUFFER(0x8F37),
+ GL_UNIFORM_BUFFER(0x8A11),
+ GL_UNIFORM_BUFFER_BINDING(0x8A28),
+ GL_UNIFORM_BUFFER_START(0x8A29),
+ GL_UNIFORM_BUFFER_SIZE(0x8A2A),
+ GL_MAX_VERTEX_UNIFORM_BLOCKS(0x8A2B),
+ GL_MAX_FRAGMENT_UNIFORM_BLOCKS(0x8A2D),
+ GL_MAX_COMBINED_UNIFORM_BLOCKS(0x8A2E),
+ GL_MAX_UNIFORM_BUFFER_BINDINGS(0x8A2F),
+ GL_MAX_UNIFORM_BLOCK_SIZE(0x8A30),
+ GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS(0x8A31),
+ GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS(0x8A33),
+ GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT(0x8A34),
+ GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH(0x8A35),
+ GL_ACTIVE_UNIFORM_BLOCKS(0x8A36),
+ GL_UNIFORM_TYPE(0x8A37),
+ GL_UNIFORM_SIZE(0x8A38),
+ GL_UNIFORM_NAME_LENGTH(0x8A39),
+ GL_UNIFORM_BLOCK_INDEX(0x8A3A),
+ GL_UNIFORM_OFFSET(0x8A3B),
+ GL_UNIFORM_ARRAY_STRIDE(0x8A3C),
+ GL_UNIFORM_MATRIX_STRIDE(0x8A3D),
+ GL_UNIFORM_IS_ROW_MAJOR(0x8A3E),
+ GL_UNIFORM_BLOCK_BINDING(0x8A3F),
+ GL_UNIFORM_BLOCK_DATA_SIZE(0x8A40),
+ GL_UNIFORM_BLOCK_NAME_LENGTH(0x8A41),
+ GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS(0x8A42),
+ GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES(0x8A43),
+ GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER(0x8A44),
+ GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER(0x8A46),
+ GL_MAX_VERTEX_OUTPUT_COMPONENTS(0x9122),
+ GL_MAX_FRAGMENT_INPUT_COMPONENTS(0x9125),
+ GL_MAX_SERVER_WAIT_TIMEOUT(0x9111),
+ GL_OBJECT_TYPE(0x9112),
+ GL_SYNC_CONDITION(0x9113),
+ GL_SYNC_STATUS(0x9114),
+ GL_SYNC_FLAGS(0x9115),
+ GL_SYNC_FENCE(0x9116),
+ GL_SYNC_GPU_COMMANDS_COMPLETE(0x9117),
+ GL_UNSIGNALED(0x9118),
+ GL_SIGNALED(0x9119),
+ GL_ALREADY_SIGNALED(0x911A),
+ GL_TIMEOUT_EXPIRED(0x911B),
+ GL_CONDITION_SATISFIED(0x911C),
+ GL_WAIT_FAILED(0x911D),
+ GL_SYNC_FLUSH_COMMANDS_BIT(0x00000001),
+ GL_TIMEOUT_IGNORED(0xFFFFFFFFFFFFFFFFl),
+ GL_VERTEX_ATTRIB_ARRAY_DIVISOR(0x88FE),
+ GL_ANY_SAMPLES_PASSED(0x8C2F),
+ GL_ANY_SAMPLES_PASSED_CONSERVATIVE(0x8D6A),
+ GL_SAMPLER_BINDING(0x8919),
+ GL_RGB10_A2UI(0x906F),
+ GL_TEXTURE_SWIZZLE_R(0x8E42),
+ GL_TEXTURE_SWIZZLE_G(0x8E43),
+ GL_TEXTURE_SWIZZLE_B(0x8E44),
+ GL_TEXTURE_SWIZZLE_A(0x8E45),
+ GL_GREEN(0x1904),
+ GL_BLUE(0x1905),
+ GL_INT_2_10_10_10_REV(0x8D9F),
+ GL_TRANSFORM_FEEDBACK(0x8E22),
+ GL_TRANSFORM_FEEDBACK_PAUSED(0x8E23),
+ GL_TRANSFORM_FEEDBACK_ACTIVE(0x8E24),
+ GL_TRANSFORM_FEEDBACK_BINDING(0x8E25),
+ GL_PROGRAM_BINARY_RETRIEVABLE_HINT(0x8257),
+ GL_COMPRESSED_R11_EAC(0x9270),
+ GL_COMPRESSED_SIGNED_R11_EAC(0x9271),
+ GL_COMPRESSED_RG11_EAC(0x9272),
+ GL_COMPRESSED_SIGNED_RG11_EAC(0x9273),
+ GL_COMPRESSED_RGB8_ETC2(0x9274),
+ GL_COMPRESSED_SRGB8_ETC2(0x9275),
+ GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2(0x9276),
+ GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2(0x9277),
+ GL_COMPRESSED_RGBA8_ETC2_EAC(0x9278),
+ GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC(0x9279),
+ GL_TEXTURE_IMMUTABLE_FORMAT(0x912F),
+ GL_MAX_ELEMENT_INDEX(0x8D6B),
+ GL_NUM_SAMPLE_COUNTS(0x9380),
+ GL_TEXTURE_IMMUTABLE_LEVELS(0x82DF),
+
GL_ALL_SHADER_BITS_EXT(0xFFFFFFFF),
;
- public final int value;
- GLEnum(final int value) {
+ public final long value;
+ GLEnum(final long value) {
this.value = value;
}
- private static final java.util.HashMap<Integer, GLEnum> reverseMap = new java.util.HashMap<Integer, GLEnum>();
+ private static final java.util.HashMap<Long, GLEnum> reverseMap = new java.util.HashMap<Long, GLEnum>();
static {
for (GLEnum e : GLEnum.values())
reverseMap.put(e.value, e);
}
- public static GLEnum valueOf(final int value) {
+ public static GLEnum valueOf(final long value) {
return reverseMap.get(value);
}
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLProtoBuf.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLProtoBuf.java
index 86018f8..3c0fbd4 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLProtoBuf.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/GLProtoBuf.java
@@ -15,17 +15,17 @@ public final class GLProtoBuf {
initFields();
}
private GLMessage(boolean noInit) {}
-
+
private static final GLMessage defaultInstance;
public static GLMessage getDefaultInstance() {
return defaultInstance;
}
-
+
@Override
public GLMessage getDefaultInstanceForType() {
return defaultInstance;
}
-
+
public enum Function
implements com.google.protobuf.Internal.EnumLite {
glActiveTexture(0, 0),
@@ -404,121 +404,225 @@ public final class GLProtoBuf {
glVertexPointer(373, 373),
glViewport(374, 374),
glWeightPointerOES(375, 375),
- glActiveShaderProgramEXT(376, 502),
- glAlphaFuncQCOM(377, 503),
- glBeginQueryEXT(378, 504),
- glBindProgramPipelineEXT(379, 505),
- glBlitFramebufferANGLE(380, 506),
- glCreateShaderProgramvEXT(381, 507),
- glDeleteProgramPipelinesEXT(382, 508),
- glDeleteQueriesEXT(383, 509),
- glDrawBuffersNV(384, 510),
- glEndQueryEXT(385, 511),
- glFramebufferTexture2DMultisampleEXT(386, 512),
- glGenProgramPipelinesEXT(387, 513),
- glGenQueriesEXT(388, 514),
- glGetGraphicsResetStatusEXT(389, 515),
- glGetObjectLabelEXT(390, 516),
- glGetProgramPipelineInfoLogEXT(391, 517),
- glGetProgramPipelineivEXT(392, 518),
- glGetQueryObjectuivEXT(393, 519),
- glGetQueryivEXT(394, 520),
- glGetnUniformfvEXT(395, 521),
- glInsertEventMarkerEXT(397, 522),
- glIsProgramPipelineEXT(398, 523),
- glIsQueryEXT(399, 524),
- glLabelObjectEXT(400, 525),
- glPopGroupMarkerEXT(401, 526),
- glProgramParameteriEXT(402, 527),
- glProgramUniform1fEXT(403, 528),
- glProgramUniform1fvEXT(404, 529),
- glProgramUniform1iEXT(405, 530),
- glProgramUniform1ivEXT(406, 531),
- glProgramUniform2fEXT(407, 532),
- glProgramUniform2fvEXT(408, 533),
- glProgramUniform2iEXT(409, 534),
- glProgramUniform2ivEXT(410, 535),
- glProgramUniform3fEXT(411, 536),
- glProgramUniform3fvEXT(412, 537),
- glProgramUniform3iEXT(413, 538),
- glProgramUniform3ivEXT(414, 539),
- glProgramUniform4fEXT(415, 540),
- glProgramUniform4fvEXT(416, 541),
- glProgramUniform4iEXT(417, 542),
- glProgramUniform4ivEXT(418, 543),
- glProgramUniformMatrix2fvEXT(419, 544),
- glProgramUniformMatrix3fvEXT(420, 545),
- glProgramUniformMatrix4fvEXT(421, 546),
- glPushGroupMarkerEXT(422, 547),
- glReadBufferNV(423, 548),
- glReadnPixelsEXT(424, 549),
- glRenderbufferStorageMultisampleANGLE(425, 550),
- glRenderbufferStorageMultisampleAPPLE(426, 551),
- glRenderbufferStorageMultisampleEXT(427, 552),
- glResolveMultisampleFramebufferAPPLE(428, 553),
- glTexStorage1DEXT(429, 554),
- glTexStorage2DEXT(430, 555),
- glTexStorage3DEXT(431, 556),
- glTextureStorage1DEXT(432, 557),
- glTextureStorage2DEXT(433, 558),
- glTextureStorage3DEXT(434, 559),
- glUseProgramStagesEXT(435, 560),
- glValidateProgramPipelineEXT(436, 561),
- eglGetDisplay(437, 2000),
- eglInitialize(438, 2001),
- eglTerminate(439, 2002),
- eglGetConfigs(440, 2003),
- eglChooseConfig(441, 2004),
- eglGetConfigAttrib(442, 2005),
- eglCreateWindowSurface(443, 2006),
- eglCreatePixmapSurface(444, 2007),
- eglCreatePbufferSurface(445, 2008),
- eglDestroySurface(446, 2009),
- eglQuerySurface(447, 2010),
- eglCreateContext(448, 2011),
- eglDestroyContext(449, 2012),
- eglMakeCurrent(450, 2013),
- eglGetCurrentContext(451, 2014),
- eglGetCurrentSurface(452, 2015),
- eglGetCurrentDisplay(453, 2016),
- eglQueryContext(454, 2017),
- eglWaitGL(455, 2018),
- eglWaitNative(456, 2019),
- eglSwapBuffers(457, 2020),
- eglCopyBuffers(458, 2021),
- eglGetError(459, 2022),
- eglQueryString(460, 2023),
- eglGetProcAddress(461, 2024),
- eglSurfaceAttrib(462, 2025),
- eglBindTexImage(463, 2026),
- eglReleaseTexImage(464, 2027),
- eglSwapInterval(465, 2028),
- eglBindAPI(466, 2029),
- eglQueryAPI(467, 2030),
- eglWaitClient(468, 2031),
- eglReleaseThread(469, 2032),
- eglCreatePbufferFromClientBuffer(470, 2033),
- eglLockSurfaceKHR(471, 2034),
- eglUnlockSurfaceKHR(472, 2035),
- eglCreateImageKHR(473, 2036),
- eglDestroyImageKHR(474, 2037),
- eglCreateSyncKHR(475, 2038),
- eglDestroySyncKHR(476, 2039),
- eglClientWaitSyncKHR(477, 2040),
- eglGetSyncAttribKHR(478, 2041),
- eglSetSwapRectangleANDROID(479, 2042),
- eglGetRenderBufferANDROID(480, 2043),
- eglGetSystemTimeFrequencyNV(481, 2044),
- eglGetSystemTimeNV(482, 2045),
- invalid(483, 3000),
- glVertexAttribPointerData(484, 3001),
+ glReadBuffer(376, 376),
+ glDrawRangeElements(377, 377),
+ glTexImage3D(378, 378),
+ glTexSubImage3D(379, 379),
+ glCopyTexSubImage3D(380, 380),
+ glCompressedTexImage3D(381, 381),
+ glCompressedTexSubImage3D(382, 382),
+ glGenQueries(383, 383),
+ glDeleteQueries(384, 384),
+ glIsQuery(385, 385),
+ glBeginQuery(386, 386),
+ glEndQuery(387, 387),
+ glGetQueryiv(388, 388),
+ glGetQueryObjectuiv(389, 389),
+ glUnmapBuffer(390, 390),
+ glGetBufferPointerv(391, 391),
+ glDrawBuffers(392, 392),
+ glUniformMatrix2x3fv(393, 393),
+ glUniformMatrix3x2fv(394, 394),
+ glUniformMatrix2x4fv(395, 395),
+ glUniformMatrix4x2fv(396, 396),
+ glUniformMatrix3x4fv(397, 397),
+ glUniformMatrix4x3fv(398, 398),
+ glBlitFramebuffer(399, 399),
+ glRenderbufferStorageMultisample(400, 400),
+ glFramebufferTextureLayer(401, 401),
+ glMapBufferRange(402, 402),
+ glFlushMappedBufferRange(403, 403),
+ glBindVertexArray(404, 404),
+ glDeleteVertexArrays(405, 405),
+ glGenVertexArrays(406, 406),
+ glIsVertexArray(407, 407),
+ glGetIntegeri_v(408, 408),
+ glBeginTransformFeedback(409, 409),
+ glEndTransformFeedback(410, 410),
+ glBindBufferRange(411, 411),
+ glBindBufferBase(412, 412),
+ glTransformFeedbackVaryings(413, 413),
+ glGetTransformFeedbackVarying(414, 414),
+ glVertexAttribIPointer(415, 415),
+ glGetVertexAttribIiv(416, 416),
+ glGetVertexAttribIuiv(417, 417),
+ glVertexAttribI4i(418, 418),
+ glVertexAttribI4ui(419, 419),
+ glVertexAttribI4iv(420, 420),
+ glVertexAttribI4uiv(421, 421),
+ glGetUniformuiv(422, 422),
+ glGetFragDataLocation(423, 423),
+ glUniform1ui(424, 424),
+ glUniform2ui(425, 425),
+ glUniform3ui(426, 426),
+ glUniform4ui(427, 427),
+ glUniform1uiv(428, 428),
+ glUniform2uiv(429, 429),
+ glUniform3uiv(430, 430),
+ glUniform4uiv(431, 431),
+ glClearBufferiv(432, 432),
+ glClearBufferuiv(433, 433),
+ glClearBufferfv(434, 434),
+ glClearBufferfi(435, 435),
+ glGetStringi(436, 436),
+ glCopyBufferSubData(437, 437),
+ glGetUniformIndices(438, 438),
+ glGetActiveUniformsiv(439, 439),
+ glGetUniformBlockIndex(440, 440),
+ glGetActiveUniformBlockiv(441, 441),
+ glGetActiveUniformBlockName(442, 442),
+ glUniformBlockBinding(443, 443),
+ glDrawArraysInstanced(444, 444),
+ glDrawElementsInstanced(445, 445),
+ glFenceSync(446, 446),
+ glIsSync(447, 447),
+ glDeleteSync(448, 448),
+ glClientWaitSync(449, 449),
+ glWaitSync(450, 450),
+ glGetInteger64v(451, 451),
+ glGetSynciv(452, 452),
+ glGetInteger64i_v(453, 453),
+ glGetBufferParameteri64v(454, 454),
+ glGenSamplers(455, 455),
+ glDeleteSamplers(456, 456),
+ glIsSampler(457, 457),
+ glBindSampler(458, 458),
+ glSamplerParameteri(459, 459),
+ glSamplerParameteriv(460, 460),
+ glSamplerParameterf(461, 461),
+ glSamplerParameterfv(462, 462),
+ glGetSamplerParameteriv(463, 463),
+ glGetSamplerParameterfv(464, 464),
+ glVertexAttribDivisor(465, 465),
+ glBindTransformFeedback(466, 466),
+ glDeleteTransformFeedbacks(467, 467),
+ glGenTransformFeedbacks(468, 468),
+ glIsTransformFeedback(469, 469),
+ glPauseTransformFeedback(470, 470),
+ glResumeTransformFeedback(471, 471),
+ glGetProgramBinary(472, 472),
+ glProgramBinary(473, 473),
+ glProgramParameteri(474, 474),
+ glInvalidateFramebuffer(475, 475),
+ glInvalidateSubFramebuffer(476, 476),
+ glTexStorage2D(477, 477),
+ glTexStorage3D(478, 478),
+ glGetInternalformativ(479, 479),
+ glActiveShaderProgramEXT(480, 502),
+ glAlphaFuncQCOM(481, 503),
+ glBeginQueryEXT(482, 504),
+ glBindProgramPipelineEXT(483, 505),
+ glBlitFramebufferANGLE(484, 506),
+ glCreateShaderProgramvEXT(485, 507),
+ glDeleteProgramPipelinesEXT(486, 508),
+ glDeleteQueriesEXT(487, 509),
+ glDrawBuffersNV(488, 510),
+ glEndQueryEXT(489, 511),
+ glFramebufferTexture2DMultisampleEXT(490, 512),
+ glGenProgramPipelinesEXT(491, 513),
+ glGenQueriesEXT(492, 514),
+ glGetGraphicsResetStatusEXT(493, 515),
+ glGetObjectLabelEXT(494, 516),
+ glGetProgramPipelineInfoLogEXT(495, 517),
+ glGetProgramPipelineivEXT(496, 518),
+ glGetQueryObjectuivEXT(497, 519),
+ glGetQueryivEXT(498, 520),
+ glGetnUniformfvEXT(499, 521),
+ glInsertEventMarkerEXT(501, 522),
+ glIsProgramPipelineEXT(502, 523),
+ glIsQueryEXT(503, 524),
+ glLabelObjectEXT(504, 525),
+ glPopGroupMarkerEXT(505, 526),
+ glProgramParameteriEXT(506, 527),
+ glProgramUniform1fEXT(507, 528),
+ glProgramUniform1fvEXT(508, 529),
+ glProgramUniform1iEXT(509, 530),
+ glProgramUniform1ivEXT(510, 531),
+ glProgramUniform2fEXT(511, 532),
+ glProgramUniform2fvEXT(512, 533),
+ glProgramUniform2iEXT(513, 534),
+ glProgramUniform2ivEXT(514, 535),
+ glProgramUniform3fEXT(515, 536),
+ glProgramUniform3fvEXT(516, 537),
+ glProgramUniform3iEXT(517, 538),
+ glProgramUniform3ivEXT(518, 539),
+ glProgramUniform4fEXT(519, 540),
+ glProgramUniform4fvEXT(520, 541),
+ glProgramUniform4iEXT(521, 542),
+ glProgramUniform4ivEXT(522, 543),
+ glProgramUniformMatrix2fvEXT(523, 544),
+ glProgramUniformMatrix3fvEXT(524, 545),
+ glProgramUniformMatrix4fvEXT(525, 546),
+ glPushGroupMarkerEXT(526, 547),
+ glReadBufferNV(527, 548),
+ glReadnPixelsEXT(528, 549),
+ glRenderbufferStorageMultisampleANGLE(529, 550),
+ glRenderbufferStorageMultisampleAPPLE(530, 551),
+ glRenderbufferStorageMultisampleEXT(531, 552),
+ glResolveMultisampleFramebufferAPPLE(532, 553),
+ glTexStorage1DEXT(533, 554),
+ glTexStorage2DEXT(534, 555),
+ glTexStorage3DEXT(535, 556),
+ glTextureStorage1DEXT(536, 557),
+ glTextureStorage2DEXT(537, 558),
+ glTextureStorage3DEXT(538, 559),
+ glUseProgramStagesEXT(539, 560),
+ glValidateProgramPipelineEXT(540, 561),
+ eglGetDisplay(541, 2000),
+ eglInitialize(542, 2001),
+ eglTerminate(543, 2002),
+ eglGetConfigs(544, 2003),
+ eglChooseConfig(545, 2004),
+ eglGetConfigAttrib(546, 2005),
+ eglCreateWindowSurface(547, 2006),
+ eglCreatePixmapSurface(548, 2007),
+ eglCreatePbufferSurface(549, 2008),
+ eglDestroySurface(550, 2009),
+ eglQuerySurface(551, 2010),
+ eglCreateContext(552, 2011),
+ eglDestroyContext(553, 2012),
+ eglMakeCurrent(554, 2013),
+ eglGetCurrentContext(555, 2014),
+ eglGetCurrentSurface(556, 2015),
+ eglGetCurrentDisplay(557, 2016),
+ eglQueryContext(558, 2017),
+ eglWaitGL(559, 2018),
+ eglWaitNative(560, 2019),
+ eglSwapBuffers(561, 2020),
+ eglCopyBuffers(562, 2021),
+ eglGetError(563, 2022),
+ eglQueryString(564, 2023),
+ eglGetProcAddress(565, 2024),
+ eglSurfaceAttrib(566, 2025),
+ eglBindTexImage(567, 2026),
+ eglReleaseTexImage(568, 2027),
+ eglSwapInterval(569, 2028),
+ eglBindAPI(570, 2029),
+ eglQueryAPI(571, 2030),
+ eglWaitClient(572, 2031),
+ eglReleaseThread(573, 2032),
+ eglCreatePbufferFromClientBuffer(574, 2033),
+ eglLockSurfaceKHR(575, 2034),
+ eglUnlockSurfaceKHR(576, 2035),
+ eglCreateImageKHR(577, 2036),
+ eglDestroyImageKHR(578, 2037),
+ eglCreateSyncKHR(579, 2038),
+ eglDestroySyncKHR(580, 2039),
+ eglClientWaitSyncKHR(581, 2040),
+ eglGetSyncAttribKHR(582, 2041),
+ eglSetSwapRectangleANDROID(583, 2042),
+ eglGetRenderBufferANDROID(584, 2043),
+ eglGetSystemTimeFrequencyNV(585, 2044),
+ eglGetSystemTimeNV(586, 2045),
+ invalid(587, 3000),
+ glVertexAttribPointerData(588, 3001),
;
-
+
public static final Function glGetnUniformivEXT = glGetnUniformfvEXT;
-
+
@Override
public final int getNumber() { return value; }
-
+
public static Function valueOf(int value) {
switch (value) {
case 0: return glActiveTexture;
@@ -897,6 +1001,110 @@ public final class GLProtoBuf {
case 373: return glVertexPointer;
case 374: return glViewport;
case 375: return glWeightPointerOES;
+ case 376: return glReadBuffer;
+ case 377: return glDrawRangeElements;
+ case 378: return glTexImage3D;
+ case 379: return glTexSubImage3D;
+ case 380: return glCopyTexSubImage3D;
+ case 381: return glCompressedTexImage3D;
+ case 382: return glCompressedTexSubImage3D;
+ case 383: return glGenQueries;
+ case 384: return glDeleteQueries;
+ case 385: return glIsQuery;
+ case 386: return glBeginQuery;
+ case 387: return glEndQuery;
+ case 388: return glGetQueryiv;
+ case 389: return glGetQueryObjectuiv;
+ case 390: return glUnmapBuffer;
+ case 391: return glGetBufferPointerv;
+ case 392: return glDrawBuffers;
+ case 393: return glUniformMatrix2x3fv;
+ case 394: return glUniformMatrix3x2fv;
+ case 395: return glUniformMatrix2x4fv;
+ case 396: return glUniformMatrix4x2fv;
+ case 397: return glUniformMatrix3x4fv;
+ case 398: return glUniformMatrix4x3fv;
+ case 399: return glBlitFramebuffer;
+ case 400: return glRenderbufferStorageMultisample;
+ case 401: return glFramebufferTextureLayer;
+ case 402: return glMapBufferRange;
+ case 403: return glFlushMappedBufferRange;
+ case 404: return glBindVertexArray;
+ case 405: return glDeleteVertexArrays;
+ case 406: return glGenVertexArrays;
+ case 407: return glIsVertexArray;
+ case 408: return glGetIntegeri_v;
+ case 409: return glBeginTransformFeedback;
+ case 410: return glEndTransformFeedback;
+ case 411: return glBindBufferRange;
+ case 412: return glBindBufferBase;
+ case 413: return glTransformFeedbackVaryings;
+ case 414: return glGetTransformFeedbackVarying;
+ case 415: return glVertexAttribIPointer;
+ case 416: return glGetVertexAttribIiv;
+ case 417: return glGetVertexAttribIuiv;
+ case 418: return glVertexAttribI4i;
+ case 419: return glVertexAttribI4ui;
+ case 420: return glVertexAttribI4iv;
+ case 421: return glVertexAttribI4uiv;
+ case 422: return glGetUniformuiv;
+ case 423: return glGetFragDataLocation;
+ case 424: return glUniform1ui;
+ case 425: return glUniform2ui;
+ case 426: return glUniform3ui;
+ case 427: return glUniform4ui;
+ case 428: return glUniform1uiv;
+ case 429: return glUniform2uiv;
+ case 430: return glUniform3uiv;
+ case 431: return glUniform4uiv;
+ case 432: return glClearBufferiv;
+ case 433: return glClearBufferuiv;
+ case 434: return glClearBufferfv;
+ case 435: return glClearBufferfi;
+ case 436: return glGetStringi;
+ case 437: return glCopyBufferSubData;
+ case 438: return glGetUniformIndices;
+ case 439: return glGetActiveUniformsiv;
+ case 440: return glGetUniformBlockIndex;
+ case 441: return glGetActiveUniformBlockiv;
+ case 442: return glGetActiveUniformBlockName;
+ case 443: return glUniformBlockBinding;
+ case 444: return glDrawArraysInstanced;
+ case 445: return glDrawElementsInstanced;
+ case 446: return glFenceSync;
+ case 447: return glIsSync;
+ case 448: return glDeleteSync;
+ case 449: return glClientWaitSync;
+ case 450: return glWaitSync;
+ case 451: return glGetInteger64v;
+ case 452: return glGetSynciv;
+ case 453: return glGetInteger64i_v;
+ case 454: return glGetBufferParameteri64v;
+ case 455: return glGenSamplers;
+ case 456: return glDeleteSamplers;
+ case 457: return glIsSampler;
+ case 458: return glBindSampler;
+ case 459: return glSamplerParameteri;
+ case 460: return glSamplerParameteriv;
+ case 461: return glSamplerParameterf;
+ case 462: return glSamplerParameterfv;
+ case 463: return glGetSamplerParameteriv;
+ case 464: return glGetSamplerParameterfv;
+ case 465: return glVertexAttribDivisor;
+ case 466: return glBindTransformFeedback;
+ case 467: return glDeleteTransformFeedbacks;
+ case 468: return glGenTransformFeedbacks;
+ case 469: return glIsTransformFeedback;
+ case 470: return glPauseTransformFeedback;
+ case 471: return glResumeTransformFeedback;
+ case 472: return glGetProgramBinary;
+ case 473: return glProgramBinary;
+ case 474: return glProgramParameteri;
+ case 475: return glInvalidateFramebuffer;
+ case 476: return glInvalidateSubFramebuffer;
+ case 477: return glTexStorage2D;
+ case 478: return glTexStorage3D;
+ case 479: return glGetInternalformativ;
case 502: return glActiveShaderProgramEXT;
case 503: return glAlphaFuncQCOM;
case 504: return glBeginQueryEXT;
@@ -1008,7 +1216,7 @@ public final class GLProtoBuf {
default: return null;
}
}
-
+
public static com.google.protobuf.Internal.EnumLiteMap<Function>
internalGetValueMap() {
return internalValueMap;
@@ -1016,22 +1224,22 @@ public final class GLProtoBuf {
private static com.google.protobuf.Internal.EnumLiteMap<Function>
internalValueMap =
new com.google.protobuf.Internal.EnumLiteMap<Function>() {
- @Override
+ @Override
public Function findValueByNumber(int number) {
- return Function.valueOf(number);
- }
- };
-
+ return Function.valueOf(number)
+ ; }
+ };
+
private final int index;
private final int value;
private Function(int index, int value) {
this.index = index;
this.value = value;
}
-
+
// @@protoc_insertion_point(enum_scope:android.gltrace.GLMessage.Function)
}
-
+
public static final class DataType extends
com.google.protobuf.GeneratedMessageLite {
// Use DataType.newBuilder() to construct.
@@ -1039,17 +1247,17 @@ public final class GLProtoBuf {
initFields();
}
private DataType(boolean noInit) {}
-
+
private static final DataType defaultInstance;
public static DataType getDefaultInstance() {
return defaultInstance;
}
-
+
@Override
- public DataType getDefaultInstanceForType() {
+ public DataType getDefaultInstanceForType() {
return defaultInstance;
}
-
+
public enum Type
implements com.google.protobuf.Internal.EnumLite {
VOID(0, 1),
@@ -1059,12 +1267,13 @@ public final class GLProtoBuf {
FLOAT(4, 5),
BOOL(5, 6),
ENUM(6, 7),
+ INT64(7, 8),
;
-
-
+
+
@Override
public final int getNumber() { return value; }
-
+
public static Type valueOf(int value) {
switch (value) {
case 1: return VOID;
@@ -1074,10 +1283,11 @@ public final class GLProtoBuf {
case 5: return FLOAT;
case 6: return BOOL;
case 7: return ENUM;
+ case 8: return INT64;
default: return null;
}
}
-
+
public static com.google.protobuf.Internal.EnumLiteMap<Type>
internalGetValueMap() {
return internalValueMap;
@@ -1087,34 +1297,34 @@ public final class GLProtoBuf {
new com.google.protobuf.Internal.EnumLiteMap<Type>() {
@Override
public Type findValueByNumber(int number) {
- return Type.valueOf(number);
- }
+ return Type.valueOf(number)
+ ; }
};
-
+
private final int index;
private final int value;
private Type(int index, int value) {
this.index = index;
this.value = value;
}
-
+
// @@protoc_insertion_point(enum_scope:android.gltrace.GLMessage.DataType.Type)
}
-
+
// required .android.gltrace.GLMessage.DataType.Type type = 1 [default = VOID];
public static final int TYPE_FIELD_NUMBER = 1;
private boolean hasType;
private com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.DataType.Type type_;
public boolean hasType() { return hasType; }
public com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.DataType.Type getType() { return type_; }
-
+
// required bool isArray = 2 [default = false];
public static final int ISARRAY_FIELD_NUMBER = 2;
private boolean hasIsArray;
private boolean isArray_ = false;
public boolean hasIsArray() { return hasIsArray; }
public boolean getIsArray() { return isArray_; }
-
+
// repeated int32 intValue = 3;
public static final int INTVALUE_FIELD_NUMBER = 3;
private java.util.List<java.lang.Integer> intValue_ =
@@ -1126,7 +1336,7 @@ public final class GLProtoBuf {
public int getIntValue(int index) {
return intValue_.get(index);
}
-
+
// repeated float floatValue = 4;
public static final int FLOATVALUE_FIELD_NUMBER = 4;
private java.util.List<java.lang.Float> floatValue_ =
@@ -1138,7 +1348,7 @@ public final class GLProtoBuf {
public float getFloatValue(int index) {
return floatValue_.get(index);
}
-
+
// repeated bytes charValue = 5;
public static final int CHARVALUE_FIELD_NUMBER = 5;
private java.util.List<com.google.protobuf.ByteString> charValue_ =
@@ -1150,7 +1360,7 @@ public final class GLProtoBuf {
public com.google.protobuf.ByteString getCharValue(int index) {
return charValue_.get(index);
}
-
+
// repeated bytes rawBytes = 6;
public static final int RAWBYTES_FIELD_NUMBER = 6;
private java.util.List<com.google.protobuf.ByteString> rawBytes_ =
@@ -1162,7 +1372,7 @@ public final class GLProtoBuf {
public com.google.protobuf.ByteString getRawBytes(int index) {
return rawBytes_.get(index);
}
-
+
// repeated bool boolValue = 7;
public static final int BOOLVALUE_FIELD_NUMBER = 7;
private java.util.List<java.lang.Boolean> boolValue_ =
@@ -1174,7 +1384,19 @@ public final class GLProtoBuf {
public boolean getBoolValue(int index) {
return boolValue_.get(index);
}
-
+
+ // repeated int64 int64Value = 8;
+ public static final int INT64VALUE_FIELD_NUMBER = 8;
+ private java.util.List<java.lang.Long> int64Value_ =
+ java.util.Collections.emptyList();
+ public java.util.List<java.lang.Long> getInt64ValueList() {
+ return int64Value_;
+ }
+ public int getInt64ValueCount() { return int64Value_.size(); }
+ public long getInt64Value(int index) {
+ return int64Value_.get(index);
+ }
+
private void initFields() {
type_ = com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.DataType.Type.VOID;
}
@@ -1184,7 +1406,7 @@ public final class GLProtoBuf {
if (!hasIsArray) return false;
return true;
}
-
+
@Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
@@ -1210,14 +1432,17 @@ public final class GLProtoBuf {
for (boolean element : getBoolValueList()) {
output.writeBool(7, element);
}
+ for (long element : getInt64ValueList()) {
+ output.writeInt64(8, element);
+ }
}
-
+
private int memoizedSerializedSize = -1;
@Override
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
-
+
size = 0;
if (hasType()) {
size += com.google.protobuf.CodedOutputStream
@@ -1266,10 +1491,19 @@ public final class GLProtoBuf {
size += dataSize;
size += 1 * getBoolValueList().size();
}
+ {
+ int dataSize = 0;
+ for (long element : getInt64ValueList()) {
+ dataSize += com.google.protobuf.CodedOutputStream
+ .computeInt64SizeNoTag(element);
+ }
+ size += dataSize;
+ size += 1 * getInt64ValueList().size();
+ }
memoizedSerializedSize = size;
return size;
}
-
+
public static com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.DataType parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
@@ -1336,7 +1570,7 @@ public final class GLProtoBuf {
return newBuilder().mergeFrom(input, extensionRegistry)
.buildParsed();
}
-
+
public static Builder newBuilder() { return Builder.create(); }
@Override
public Builder newBuilderForType() { return newBuilder(); }
@@ -1345,26 +1579,26 @@ public final class GLProtoBuf {
}
@Override
public Builder toBuilder() { return newBuilder(this); }
-
+
public static final class Builder extends
com.google.protobuf.GeneratedMessageLite.Builder<
com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.DataType, Builder> {
private com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.DataType result;
-
+
// Construct using com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.DataType.newBuilder()
private Builder() {}
-
+
private static Builder create() {
Builder builder = new Builder();
builder.result = new com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.DataType();
return builder;
}
-
+
@Override
protected com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.DataType internalGetResult() {
return result;
}
-
+
@Override
public Builder clear() {
if (result == null) {
@@ -1374,17 +1608,17 @@ public final class GLProtoBuf {
result = new com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.DataType();
return this;
}
-
+
@Override
public Builder clone() {
return create().mergeFrom(result);
}
-
+
@Override
public com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.DataType getDefaultInstanceForType() {
return com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.DataType.getDefaultInstance();
}
-
+
@Override
public boolean isInitialized() {
return result.isInitialized();
@@ -1396,7 +1630,7 @@ public final class GLProtoBuf {
}
return buildPartial();
}
-
+
private com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.DataType buildParsed()
throws com.google.protobuf.InvalidProtocolBufferException {
if (!isInitialized()) {
@@ -1405,7 +1639,7 @@ public final class GLProtoBuf {
}
return buildPartial();
}
-
+
@Override
public com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.DataType buildPartial() {
if (result == null) {
@@ -1432,11 +1666,15 @@ public final class GLProtoBuf {
result.boolValue_ =
java.util.Collections.unmodifiableList(result.boolValue_);
}
+ if (result.int64Value_ != java.util.Collections.EMPTY_LIST) {
+ result.int64Value_ =
+ java.util.Collections.unmodifiableList(result.int64Value_);
+ }
com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.DataType returnMe = result;
result = null;
return returnMe;
}
-
+
@Override
public Builder mergeFrom(com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.DataType other) {
if (other == com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.DataType.getDefaultInstance()) return this;
@@ -1476,9 +1714,15 @@ public final class GLProtoBuf {
}
result.boolValue_.addAll(other.boolValue_);
}
+ if (!other.int64Value_.isEmpty()) {
+ if (result.int64Value_.isEmpty()) {
+ result.int64Value_ = new java.util.ArrayList<java.lang.Long>();
+ }
+ result.int64Value_.addAll(other.int64Value_);
+ }
return this;
}
-
+
@Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
@@ -1554,11 +1798,24 @@ public final class GLProtoBuf {
input.popLimit(limit);
break;
}
+ case 64: {
+ addInt64Value(input.readInt64());
+ break;
+ }
+ case 66: {
+ int length = input.readRawVarint32();
+ int limit = input.pushLimit(length);
+ while (input.getBytesUntilLimit() > 0) {
+ addInt64Value(input.readInt64());
+ }
+ input.popLimit(limit);
+ break;
+ }
}
}
}
-
-
+
+
// required .android.gltrace.GLMessage.DataType.Type type = 1 [default = VOID];
public boolean hasType() {
return result.hasType();
@@ -1579,7 +1836,7 @@ public final class GLProtoBuf {
result.type_ = com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.DataType.Type.VOID;
return this;
}
-
+
// required bool isArray = 2 [default = false];
public boolean hasIsArray() {
return result.hasIsArray();
@@ -1597,7 +1854,7 @@ public final class GLProtoBuf {
result.isArray_ = false;
return this;
}
-
+
// repeated int32 intValue = 3;
public java.util.List<java.lang.Integer> getIntValueList() {
return java.util.Collections.unmodifiableList(result.intValue_);
@@ -1631,7 +1888,7 @@ public final class GLProtoBuf {
result.intValue_ = java.util.Collections.emptyList();
return this;
}
-
+
// repeated float floatValue = 4;
public java.util.List<java.lang.Float> getFloatValueList() {
return java.util.Collections.unmodifiableList(result.floatValue_);
@@ -1665,7 +1922,7 @@ public final class GLProtoBuf {
result.floatValue_ = java.util.Collections.emptyList();
return this;
}
-
+
// repeated bytes charValue = 5;
public java.util.List<com.google.protobuf.ByteString> getCharValueList() {
return java.util.Collections.unmodifiableList(result.charValue_);
@@ -1705,7 +1962,7 @@ public final class GLProtoBuf {
result.charValue_ = java.util.Collections.emptyList();
return this;
}
-
+
// repeated bytes rawBytes = 6;
public java.util.List<com.google.protobuf.ByteString> getRawBytesList() {
return java.util.Collections.unmodifiableList(result.rawBytes_);
@@ -1745,7 +2002,7 @@ public final class GLProtoBuf {
result.rawBytes_ = java.util.Collections.emptyList();
return this;
}
-
+
// repeated bool boolValue = 7;
public java.util.List<java.lang.Boolean> getBoolValueList() {
return java.util.Collections.unmodifiableList(result.boolValue_);
@@ -1779,19 +2036,53 @@ public final class GLProtoBuf {
result.boolValue_ = java.util.Collections.emptyList();
return this;
}
-
+
+ // repeated int64 int64Value = 8;
+ public java.util.List<java.lang.Long> getInt64ValueList() {
+ return java.util.Collections.unmodifiableList(result.int64Value_);
+ }
+ public int getInt64ValueCount() {
+ return result.getInt64ValueCount();
+ }
+ public long getInt64Value(int index) {
+ return result.getInt64Value(index);
+ }
+ public Builder setInt64Value(int index, long value) {
+ result.int64Value_.set(index, value);
+ return this;
+ }
+ public Builder addInt64Value(long value) {
+ if (result.int64Value_.isEmpty()) {
+ result.int64Value_ = new java.util.ArrayList<java.lang.Long>();
+ }
+ result.int64Value_.add(value);
+ return this;
+ }
+ public Builder addAllInt64Value(
+ java.lang.Iterable<? extends java.lang.Long> values) {
+ if (result.int64Value_.isEmpty()) {
+ result.int64Value_ = new java.util.ArrayList<java.lang.Long>();
+ }
+ super.addAll(values, result.int64Value_);
+ return this;
+ }
+ public Builder clearInt64Value() {
+ result.int64Value_ = java.util.Collections.emptyList();
+ return this;
+ }
+
// @@protoc_insertion_point(builder_scope:android.gltrace.GLMessage.DataType)
}
-
+
static {
defaultInstance = new DataType(true);
com.android.ide.eclipse.gltrace.GLProtoBuf.internalForceInit();
defaultInstance.initFields();
}
-
+
// @@protoc_insertion_point(class_scope:android.gltrace.GLMessage.DataType)
}
-
+
public static final class FrameBuffer extends
com.google.protobuf.GeneratedMessageLite {
// Use FrameBuffer.newBuilder() to construct.
@@ -1799,31 +2090,31 @@ public final class GLProtoBuf {
initFields();
}
private FrameBuffer(boolean noInit) {}
-
+
private static final FrameBuffer defaultInstance;
public static FrameBuffer getDefaultInstance() {
return defaultInstance;
}
-
+
@Override
- public FrameBuffer getDefaultInstanceForType() {
+ public FrameBuffer getDefaultInstanceForType() {
return defaultInstance;
}
-
+
// required int32 width = 1;
public static final int WIDTH_FIELD_NUMBER = 1;
private boolean hasWidth;
private int width_ = 0;
public boolean hasWidth() { return hasWidth; }
public int getWidth() { return width_; }
-
+
// required int32 height = 2;
public static final int HEIGHT_FIELD_NUMBER = 2;
private boolean hasHeight;
private int height_ = 0;
public boolean hasHeight() { return hasHeight; }
public int getHeight() { return height_; }
-
+
// repeated bytes contents = 3;
public static final int CONTENTS_FIELD_NUMBER = 3;
private java.util.List<com.google.protobuf.ByteString> contents_ =
@@ -1835,7 +2126,7 @@ public final class GLProtoBuf {
public com.google.protobuf.ByteString getContents(int index) {
return contents_.get(index);
}
-
+
private void initFields() {
}
@Override
@@ -1844,7 +2135,7 @@ public final class GLProtoBuf {
if (!hasHeight) return false;
return true;
}
-
+
@Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
@@ -1859,13 +2150,13 @@ public final class GLProtoBuf {
output.writeBytes(3, element);
}
}
-
+
private int memoizedSerializedSize = -1;
@Override
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
-
+
size = 0;
if (hasWidth()) {
size += com.google.protobuf.CodedOutputStream
@@ -1887,7 +2178,7 @@ public final class GLProtoBuf {
memoizedSerializedSize = size;
return size;
}
-
+
public static com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.FrameBuffer parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
@@ -1954,7 +2245,7 @@ public final class GLProtoBuf {
return newBuilder().mergeFrom(input, extensionRegistry)
.buildParsed();
}
-
+
public static Builder newBuilder() { return Builder.create(); }
@Override
public Builder newBuilderForType() { return newBuilder(); }
@@ -1963,26 +2254,26 @@ public final class GLProtoBuf {
}
@Override
public Builder toBuilder() { return newBuilder(this); }
-
+
public static final class Builder extends
com.google.protobuf.GeneratedMessageLite.Builder<
com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.FrameBuffer, Builder> {
private com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.FrameBuffer result;
-
+
// Construct using com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.FrameBuffer.newBuilder()
private Builder() {}
-
+
private static Builder create() {
Builder builder = new Builder();
builder.result = new com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.FrameBuffer();
return builder;
}
-
+
@Override
protected com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.FrameBuffer internalGetResult() {
return result;
}
-
+
@Override
public Builder clear() {
if (result == null) {
@@ -1992,17 +2283,17 @@ public final class GLProtoBuf {
result = new com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.FrameBuffer();
return this;
}
-
+
@Override
public Builder clone() {
return create().mergeFrom(result);
}
-
+
@Override
public com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.FrameBuffer getDefaultInstanceForType() {
return com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.FrameBuffer.getDefaultInstance();
}
-
+
@Override
public boolean isInitialized() {
return result.isInitialized();
@@ -2014,7 +2305,7 @@ public final class GLProtoBuf {
}
return buildPartial();
}
-
+
private com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.FrameBuffer buildParsed()
throws com.google.protobuf.InvalidProtocolBufferException {
if (!isInitialized()) {
@@ -2023,7 +2314,7 @@ public final class GLProtoBuf {
}
return buildPartial();
}
-
+
@Override
public com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.FrameBuffer buildPartial() {
if (result == null) {
@@ -2038,7 +2329,7 @@ public final class GLProtoBuf {
result = null;
return returnMe;
}
-
+
@Override
public Builder mergeFrom(com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.FrameBuffer other) {
if (other == com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.FrameBuffer.getDefaultInstance()) return this;
@@ -2056,7 +2347,7 @@ public final class GLProtoBuf {
}
return this;
}
-
+
@Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
@@ -2088,8 +2379,8 @@ public final class GLProtoBuf {
}
}
}
-
-
+
+
// required int32 width = 1;
public boolean hasWidth() {
return result.hasWidth();
@@ -2107,7 +2398,7 @@ public final class GLProtoBuf {
result.width_ = 0;
return this;
}
-
+
// required int32 height = 2;
public boolean hasHeight() {
return result.hasHeight();
@@ -2125,7 +2416,7 @@ public final class GLProtoBuf {
result.height_ = 0;
return this;
}
-
+
// repeated bytes contents = 3;
public java.util.List<com.google.protobuf.ByteString> getContentsList() {
return java.util.Collections.unmodifiableList(result.contents_);
@@ -2165,47 +2456,47 @@ public final class GLProtoBuf {
result.contents_ = java.util.Collections.emptyList();
return this;
}
-
+
// @@protoc_insertion_point(builder_scope:android.gltrace.GLMessage.FrameBuffer)
}
-
+
static {
defaultInstance = new FrameBuffer(true);
com.android.ide.eclipse.gltrace.GLProtoBuf.internalForceInit();
defaultInstance.initFields();
}
-
+
// @@protoc_insertion_point(class_scope:android.gltrace.GLMessage.FrameBuffer)
}
-
+
// required int32 context_id = 1;
public static final int CONTEXT_ID_FIELD_NUMBER = 1;
private boolean hasContextId;
private int contextId_ = 0;
public boolean hasContextId() { return hasContextId; }
public int getContextId() { return contextId_; }
-
+
// required int64 start_time = 2;
public static final int START_TIME_FIELD_NUMBER = 2;
private boolean hasStartTime;
private long startTime_ = 0L;
public boolean hasStartTime() { return hasStartTime; }
public long getStartTime() { return startTime_; }
-
+
// required int32 duration = 3;
public static final int DURATION_FIELD_NUMBER = 3;
private boolean hasDuration;
private int duration_ = 0;
public boolean hasDuration() { return hasDuration; }
public int getDuration() { return duration_; }
-
+
// required .android.gltrace.GLMessage.Function function = 4 [default = invalid];
public static final int FUNCTION_FIELD_NUMBER = 4;
private boolean hasFunction;
private com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.Function function_;
public boolean hasFunction() { return hasFunction; }
public com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.Function getFunction() { return function_; }
-
+
// repeated .android.gltrace.GLMessage.DataType args = 5;
public static final int ARGS_FIELD_NUMBER = 5;
private java.util.List<com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.DataType> args_ =
@@ -2217,28 +2508,28 @@ public final class GLProtoBuf {
public com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.DataType getArgs(int index) {
return args_.get(index);
}
-
+
// optional .android.gltrace.GLMessage.DataType returnValue = 6;
public static final int RETURNVALUE_FIELD_NUMBER = 6;
private boolean hasReturnValue;
private com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.DataType returnValue_;
public boolean hasReturnValue() { return hasReturnValue; }
public com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.DataType getReturnValue() { return returnValue_; }
-
+
// optional .android.gltrace.GLMessage.FrameBuffer fb = 7;
public static final int FB_FIELD_NUMBER = 7;
private boolean hasFb;
private com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.FrameBuffer fb_;
public boolean hasFb() { return hasFb; }
public com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.FrameBuffer getFb() { return fb_; }
-
+
// optional int32 threadtime = 8;
public static final int THREADTIME_FIELD_NUMBER = 8;
private boolean hasThreadtime;
private int threadtime_ = 0;
public boolean hasThreadtime() { return hasThreadtime; }
public int getThreadtime() { return threadtime_; }
-
+
private void initFields() {
function_ = com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.Function.invalid;
returnValue_ = com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.DataType.getDefaultInstance();
@@ -2261,7 +2552,7 @@ public final class GLProtoBuf {
}
return true;
}
-
+
@Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
@@ -2291,13 +2582,13 @@ public final class GLProtoBuf {
output.writeInt32(8, getThreadtime());
}
}
-
+
private int memoizedSerializedSize = -1;
@Override
public int getSerializedSize() {
int size = memoizedSerializedSize;
if (size != -1) return size;
-
+
size = 0;
if (hasContextId()) {
size += com.google.protobuf.CodedOutputStream
@@ -2334,7 +2625,7 @@ public final class GLProtoBuf {
memoizedSerializedSize = size;
return size;
}
-
+
public static com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage parseFrom(
com.google.protobuf.ByteString data)
throws com.google.protobuf.InvalidProtocolBufferException {
@@ -2401,7 +2692,7 @@ public final class GLProtoBuf {
return newBuilder().mergeFrom(input, extensionRegistry)
.buildParsed();
}
-
+
public static Builder newBuilder() { return Builder.create(); }
@Override
public Builder newBuilderForType() { return newBuilder(); }
@@ -2410,26 +2701,26 @@ public final class GLProtoBuf {
}
@Override
public Builder toBuilder() { return newBuilder(this); }
-
+
public static final class Builder extends
com.google.protobuf.GeneratedMessageLite.Builder<
com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage, Builder> {
private com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage result;
-
+
// Construct using com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.newBuilder()
private Builder() {}
-
+
private static Builder create() {
Builder builder = new Builder();
builder.result = new com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage();
return builder;
}
-
+
@Override
protected com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage internalGetResult() {
return result;
}
-
+
@Override
public Builder clear() {
if (result == null) {
@@ -2439,17 +2730,17 @@ public final class GLProtoBuf {
result = new com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage();
return this;
}
-
+
@Override
public Builder clone() {
return create().mergeFrom(result);
}
-
+
@Override
public com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage getDefaultInstanceForType() {
return com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.getDefaultInstance();
}
-
+
@Override
public boolean isInitialized() {
return result.isInitialized();
@@ -2461,7 +2752,7 @@ public final class GLProtoBuf {
}
return buildPartial();
}
-
+
private com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage buildParsed()
throws com.google.protobuf.InvalidProtocolBufferException {
if (!isInitialized()) {
@@ -2470,7 +2761,7 @@ public final class GLProtoBuf {
}
return buildPartial();
}
-
+
@Override
public com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage buildPartial() {
if (result == null) {
@@ -2485,7 +2776,7 @@ public final class GLProtoBuf {
result = null;
return returnMe;
}
-
+
@Override
public Builder mergeFrom(com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage other) {
if (other == com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.getDefaultInstance()) return this;
@@ -2518,7 +2809,7 @@ public final class GLProtoBuf {
}
return this;
}
-
+
@Override
public Builder mergeFrom(
com.google.protobuf.CodedInputStream input,
@@ -2586,8 +2877,8 @@ public final class GLProtoBuf {
}
}
}
-
-
+
+
// required int32 context_id = 1;
public boolean hasContextId() {
return result.hasContextId();
@@ -2605,7 +2896,7 @@ public final class GLProtoBuf {
result.contextId_ = 0;
return this;
}
-
+
// required int64 start_time = 2;
public boolean hasStartTime() {
return result.hasStartTime();
@@ -2623,7 +2914,7 @@ public final class GLProtoBuf {
result.startTime_ = 0L;
return this;
}
-
+
// required int32 duration = 3;
public boolean hasDuration() {
return result.hasDuration();
@@ -2641,7 +2932,7 @@ public final class GLProtoBuf {
result.duration_ = 0;
return this;
}
-
+
// required .android.gltrace.GLMessage.Function function = 4 [default = invalid];
public boolean hasFunction() {
return result.hasFunction();
@@ -2662,7 +2953,7 @@ public final class GLProtoBuf {
result.function_ = com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.Function.invalid;
return this;
}
-
+
// repeated .android.gltrace.GLMessage.DataType args = 5;
public java.util.List<com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.DataType> getArgsList() {
return java.util.Collections.unmodifiableList(result.args_);
@@ -2713,7 +3004,7 @@ public final class GLProtoBuf {
result.args_ = java.util.Collections.emptyList();
return this;
}
-
+
// optional .android.gltrace.GLMessage.DataType returnValue = 6;
public boolean hasReturnValue() {
return result.hasReturnValue();
@@ -2750,7 +3041,7 @@ public final class GLProtoBuf {
result.returnValue_ = com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.DataType.getDefaultInstance();
return this;
}
-
+
// optional .android.gltrace.GLMessage.FrameBuffer fb = 7;
public boolean hasFb() {
return result.hasFb();
@@ -2787,7 +3078,7 @@ public final class GLProtoBuf {
result.fb_ = com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.FrameBuffer.getDefaultInstance();
return this;
}
-
+
// optional int32 threadtime = 8;
public boolean hasThreadtime() {
return result.hasThreadtime();
@@ -2805,24 +3096,24 @@ public final class GLProtoBuf {
result.threadtime_ = 0;
return this;
}
-
+
// @@protoc_insertion_point(builder_scope:android.gltrace.GLMessage)
}
-
+
static {
defaultInstance = new GLMessage(true);
com.android.ide.eclipse.gltrace.GLProtoBuf.internalForceInit();
defaultInstance.initFields();
}
-
+
// @@protoc_insertion_point(class_scope:android.gltrace.GLMessage)
}
-
-
+
+
static {
}
-
+
public static void internalForceInit() {}
-
+
// @@protoc_insertion_point(outer_class_scope)
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/model/GLCall.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/model/GLCall.java
index f7841cb..0f6a116 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/model/GLCall.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/model/GLCall.java
@@ -19,7 +19,7 @@ package com.android.ide.eclipse.gltrace.model;
import com.android.ide.eclipse.gltrace.GLProtoBuf;
import com.android.ide.eclipse.gltrace.GLProtoBuf.GLMessage.Function;
import com.android.ide.eclipse.gltrace.state.transforms.IStateTransform;
-import com.android.sdklib.util.SparseArray;
+import com.android.utils.SparseArray;
import java.util.Collections;
import java.util.List;
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLSparseArrayProperty.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLSparseArrayProperty.java
index ee063a2..c450028 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLSparseArrayProperty.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLSparseArrayProperty.java
@@ -16,12 +16,12 @@
package com.android.ide.eclipse.gltrace.state;
-import com.android.sdklib.util.SparseArray;
-
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
+import com.android.utils.SparseArray;
+
public class GLSparseArrayProperty implements IGLProperty {
private final GLStateType mType;
private final IGLProperty mDefaultValue;
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLState.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLState.java
index 74c6fcd..1743499 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLState.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLState.java
@@ -209,9 +209,9 @@ public class GLState {
IGLProperty blendSrcRgb = new GLEnumProperty(GLStateType.BLEND_SRC_RGB, GLEnum.GL_LINES);
IGLProperty blendSrcAlpha = new GLEnumProperty(GLStateType.BLEND_SRC_ALPHA,
GLEnum.GL_LINES);
- IGLProperty blendDstRgb = new GLEnumProperty(GLStateType.BLEND_DST_RGB, GLEnum.GL_POINTS);
+ IGLProperty blendDstRgb = new GLEnumProperty(GLStateType.BLEND_DST_RGB, GLEnum.GL_NONE);
IGLProperty blendDstAlpha = new GLEnumProperty(GLStateType.BLEND_DST_ALPHA,
- GLEnum.GL_POINTS);
+ GLEnum.GL_NONE);
IGLProperty blendEquationRgb = new GLEnumProperty(GLStateType.BLEND_EQUATION_RGB,
GLEnum.GL_FUNC_ADD);
IGLProperty blendEquationAlpha = new GLEnumProperty(GLStateType.BLEND_EQUATION_ALPHA,
@@ -260,12 +260,28 @@ public class GLState {
IGLProperty textureUnitState = new GLListProperty(GLStateType.TEXTURE_UNITS,
perTextureUnitState, TEXTURE_UNIT_COUNT);
+ IGLProperty swizzleR = new GLEnumProperty(GLStateType.TEXTURE_SWIZZLE_R, GLEnum.GL_RED);
+ IGLProperty swizzleG = new GLEnumProperty(GLStateType.TEXTURE_SWIZZLE_G, GLEnum.GL_GREEN);
+ IGLProperty swizzleB = new GLEnumProperty(GLStateType.TEXTURE_SWIZZLE_B, GLEnum.GL_BLUE);
+ IGLProperty swizzleA = new GLEnumProperty(GLStateType.TEXTURE_SWIZZLE_A, GLEnum.GL_ALPHA);
IGLProperty minFilter = new GLEnumProperty(GLStateType.TEXTURE_MIN_FILTER,
GLEnum.GL_NEAREST);
IGLProperty magFilter = new GLEnumProperty(GLStateType.TEXTURE_MAG_FILTER,
GLEnum.GL_NEAREST);
IGLProperty wrapS = new GLEnumProperty(GLStateType.TEXTURE_WRAP_S, GLEnum.GL_REPEAT);
IGLProperty wrapT = new GLEnumProperty(GLStateType.TEXTURE_WRAP_T, GLEnum.GL_REPEAT);
+ IGLProperty wrapR = new GLEnumProperty(GLStateType.TEXTURE_WRAP_R, GLEnum.GL_REPEAT);
+ IGLProperty minLod = new GLFloatProperty(GLStateType.TEXTURE_MIN_LOD, Float.valueOf(-1000));
+ IGLProperty maxLod = new GLFloatProperty(GLStateType.TEXTURE_MAX_LOD, Float.valueOf(1000));
+ IGLProperty baseLevel = new GLIntegerProperty(GLStateType.TEXTURE_BASE_LEVEL, 0);
+ IGLProperty maxLevel = new GLIntegerProperty(GLStateType.TEXTURE_MAX_LEVEL, 1000);
+ IGLProperty cmpMode = new GLEnumProperty(GLStateType.TEXTURE_COMPARE_MODE, GLEnum.GL_NONE);
+ IGLProperty cmpFunc = new GLEnumProperty(GLStateType.TEXTURE_COMPARE_FUNC,
+ GLEnum.GL_LEQUAL);
+ IGLProperty immutableFormat = new GLBooleanProperty(GLStateType.TEXTURE_IMMUTABLE_FORMAT,
+ Boolean.FALSE);
+ IGLProperty immutableLevels = new GLIntegerProperty(GLStateType.TEXTURE_IMMUTABLE_LEVELS,
+ 0);
IGLProperty width = new GLIntegerProperty(GLStateType.TEXTURE_WIDTH, Integer.valueOf(-1));
IGLProperty height = new GLIntegerProperty(GLStateType.TEXTURE_HEIGHT,
@@ -283,7 +299,14 @@ public class GLState {
perTextureLevelState, true);
IGLProperty textureDefaultState = new GLCompositeProperty(GLStateType.PER_TEXTURE_STATE,
- minFilter, magFilter, wrapS, wrapT, mipmapState);
+ swizzleR, swizzleG, swizzleB, swizzleA,
+ minFilter, magFilter,
+ wrapS, wrapT, wrapR,
+ minLod, maxLod,
+ baseLevel, maxLevel,
+ cmpMode, cmpFunc,
+ immutableFormat, immutableLevels,
+ mipmapState);
GLSparseArrayProperty textures = new GLSparseArrayProperty(GLStateType.TEXTURES,
textureDefaultState);
textures.add(0);
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLStateType.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLStateType.java
index 330e4f5..a0a7ce4 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLStateType.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/GLStateType.java
@@ -119,10 +119,23 @@ public enum GLStateType {
TEXTURE_BINDING_EXTERNAL("TEXTURE_EXTERNAL Binding"),
TEXTURES("Textures"),
PER_TEXTURE_STATE("Per Texture State"),
+ TEXTURE_SWIZZLE_R("Red Component Swizzle"),
+ TEXTURE_SWIZZLE_G("Green Component Swizzle"),
+ TEXTURE_SWIZZLE_B("Blue Component Swizzle"),
+ TEXTURE_SWIZZLE_A("Alpha Component Swizzle"),
TEXTURE_MIN_FILTER("Minification Function"),
TEXTURE_MAG_FILTER("Magnification Function"),
TEXTURE_WRAP_S("Texcoord s Wrap Mode"),
TEXTURE_WRAP_T("Texcoord t Wrap Mode"),
+ TEXTURE_WRAP_R("Texcoord r Wrap Mode"),
+ TEXTURE_MIN_LOD("Min Level of Detail"),
+ TEXTURE_MAX_LOD("Max Level of Detail"),
+ TEXTURE_BASE_LEVEL("Base Texture Array"),
+ TEXTURE_MAX_LEVEL("Max Texture Array Level"),
+ TEXTURE_COMPARE_MODE("Comparison Mode"),
+ TEXTURE_COMPARE_FUNC("Comparison Function"),
+ TEXTURE_IMMUTABLE_FORMAT("Size and format immutable?"),
+ TEXTURE_IMMUTABLE_LEVELS("# of levels in immutable textures"),
TEXTURE_MIPMAPS("Texture Mipmap State"),
PER_TEXTURE_LEVEL_STATE("Per Texture Level State"),
TEXTURE_FORMAT("Format"),
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/StateTransformFactory.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/StateTransformFactory.java
index 1a95798..fb9f227 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/StateTransformFactory.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/StateTransformFactory.java
@@ -30,11 +30,13 @@ import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
+import java.util.EnumSet;
import java.util.List;
public class StateTransformFactory {
private static final String TEXTURE_DATA_FILE_PREFIX = "tex"; //$NON-NLS-1$
private static final String TEXTURE_DATA_FILE_SUFFIX = ".dat"; //$NON-NLS-1$
+ private static EnumSet<GLEnum> sTexParameterPnameValues;
/** Construct a list of transformations to be applied for the provided OpenGL call. */
public static List<IStateTransform> getTransformsFor(GLMessage msg) {
@@ -937,7 +939,7 @@ public class StateTransformFactory {
private static List<IStateTransform> transformsForGlActiveTexture(GLMessage msg) {
// void glActiveTexture(GLenum texture);
GLEnum texture = GLEnum.valueOf(msg.getArgs(0).getIntValue(0));
- Integer textureIndex = Integer.valueOf(texture.value - GLEnum.GL_TEXTURE0.value);
+ Integer textureIndex = Integer.valueOf((int)(texture.value - GLEnum.GL_TEXTURE0.value));
IStateTransform transform = new PropertyChangeTransform(
GLPropertyAccessor.makeAccessor(msg.getContextId(),
GLStateType.TEXTURE_STATE,
@@ -1075,10 +1077,28 @@ public class StateTransformFactory {
GLEnum pname = GLEnum.valueOf(msg.getArgs(1).getIntValue(0));
GLEnum pvalue = GLEnum.valueOf(msg.getArgs(2).getIntValue(0));
- if (pname != GLEnum.GL_TEXTURE_MIN_FILTER
- && pname != GLEnum.GL_TEXTURE_MAG_FILTER
- && pname != GLEnum.GL_TEXTURE_WRAP_S
- && pname != GLEnum.GL_TEXTURE_WRAP_T) {
+ if (sTexParameterPnameValues == null) {
+ GLEnum[] pnameValues = new GLEnum[] {
+ GLEnum.GL_TEXTURE_BASE_LEVEL,
+ GLEnum.GL_TEXTURE_COMPARE_FUNC,
+ GLEnum.GL_TEXTURE_COMPARE_MODE,
+ GLEnum.GL_TEXTURE_MIN_FILTER,
+ GLEnum.GL_TEXTURE_MAG_FILTER,
+ GLEnum.GL_TEXTURE_MIN_LOD,
+ GLEnum.GL_TEXTURE_MAX_LOD,
+ GLEnum.GL_TEXTURE_MAX_LEVEL,
+ GLEnum.GL_TEXTURE_SWIZZLE_R,
+ GLEnum.GL_TEXTURE_SWIZZLE_G,
+ GLEnum.GL_TEXTURE_SWIZZLE_B,
+ GLEnum.GL_TEXTURE_SWIZZLE_A,
+ GLEnum.GL_TEXTURE_WRAP_S,
+ GLEnum.GL_TEXTURE_WRAP_T,
+ GLEnum.GL_TEXTURE_WRAP_R
+ };
+ sTexParameterPnameValues = EnumSet.copyOf(Arrays.asList(pnameValues));
+ }
+
+ if (!sTexParameterPnameValues.contains(pname)) {
throw new IllegalArgumentException(
String.format("Unsupported parameter (%s) for glTexParameter()", pname));
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/TexImageTransform.java b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/TexImageTransform.java
index 451eb70..dde89ea 100644
--- a/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/TexImageTransform.java
+++ b/eclipse/plugins/com.android.ide.eclipse.gldebugger/src/com/android/ide/eclipse/gltrace/state/transforms/TexImageTransform.java
@@ -26,6 +26,8 @@ import com.google.common.primitives.UnsignedBytes;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.FloatBuffer;
import javax.imageio.ImageIO;
@@ -99,6 +101,8 @@ public class TexImageTransform implements IStateTransform {
}
} catch (IOException e) {
throw new RuntimeException(e);
+ } catch (RuntimeException e) {
+ throw e;
}
}
@@ -186,6 +190,18 @@ public class TexImageTransform implements IStateTransform {
return subImageData;
case GL_RGB:
return addAlphaChannel(subImageData, width, height);
+ case GL_RED:
+ case GL_GREEN:
+ case GL_BLUE:
+ // GL_RED, GL_GREEN and GL_BLUE are all supposed to fill those respective
+ // channels, but we assume that the programmers intent was to use GL_ALPHA in order
+ // to overcome the issue that GL_ALPHA cannot be used with float data.
+ if (mType != GLEnum.GL_FLOAT) {
+ throw new RuntimeException();
+ } else {
+ // fall through - assume that it is GL_ALPHA
+ }
+ //$FALL-THROUGH$
case GL_ALPHA:
return addRGBChannels(subImageData, width, height);
case GL_LUMINANCE:
@@ -210,11 +226,24 @@ public class TexImageTransform implements IStateTransform {
case GL_UNSIGNED_SHORT_5_5_5_1:
return convertShortToUnsigned(data, 0xf800, 11, 0x07c0, 6, 0x003e, 1, 0x1, 0,
true);
+ case GL_FLOAT:
+ return convertFloatToUnsigned(data);
default:
return data;
}
}
+ private byte[] convertFloatToUnsigned(byte[] data) {
+ byte[] unsignedData = new byte[data.length];
+ ByteBuffer floatBuffer = ByteBuffer.wrap(data);
+ for (int i = 0; i < data.length / 4; i++) {
+ float v = floatBuffer.getFloat(i);
+ byte alpha = (byte)(v * 255);
+ unsignedData[i*4 + 3] = alpha;
+ }
+ return unsignedData;
+ }
+
private byte[] convertShortToUnsigned(byte[] shortData,
int rmask, int rshift,
int gmask, int gshift,
diff --git a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/.settings/org.eclipse.jdt.core.prefs b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/.settings/org.eclipse.jdt.core.prefs
index 9dbff07..ea66196 100644
--- a/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/.settings/org.eclipse.jdt.core.prefs
+++ b/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/.settings/org.eclipse.jdt.core.prefs
@@ -48,10 +48,10 @@ org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignor
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
-org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecInsufficientInfo=warning
-org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=ignore
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
diff --git a/eclipse/plugins/com.android.ide.eclipse.monitor/.settings/org.eclipse.jdt.core.prefs b/eclipse/plugins/com.android.ide.eclipse.monitor/.settings/org.eclipse.jdt.core.prefs
index 9dbff07..ea66196 100644
--- a/eclipse/plugins/com.android.ide.eclipse.monitor/.settings/org.eclipse.jdt.core.prefs
+++ b/eclipse/plugins/com.android.ide.eclipse.monitor/.settings/org.eclipse.jdt.core.prefs
@@ -48,10 +48,10 @@ org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignor
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
-org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecInsufficientInfo=warning
-org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=ignore
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
diff --git a/eclipse/plugins/com.android.ide.eclipse.ndk/.settings/org.eclipse.jdt.core.prefs b/eclipse/plugins/com.android.ide.eclipse.ndk/.settings/org.eclipse.jdt.core.prefs
index 9dbff07..ea66196 100644
--- a/eclipse/plugins/com.android.ide.eclipse.ndk/.settings/org.eclipse.jdt.core.prefs
+++ b/eclipse/plugins/com.android.ide.eclipse.ndk/.settings/org.eclipse.jdt.core.prefs
@@ -48,10 +48,10 @@ org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignor
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
-org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecInsufficientInfo=warning
-org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=ignore
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
diff --git a/eclipse/plugins/com.android.ide.eclipse.pdt/.settings/org.eclipse.jdt.core.prefs b/eclipse/plugins/com.android.ide.eclipse.pdt/.settings/org.eclipse.jdt.core.prefs
index 9dbff07..ea66196 100644
--- a/eclipse/plugins/com.android.ide.eclipse.pdt/.settings/org.eclipse.jdt.core.prefs
+++ b/eclipse/plugins/com.android.ide.eclipse.pdt/.settings/org.eclipse.jdt.core.prefs
@@ -48,10 +48,10 @@ org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignor
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
-org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecInsufficientInfo=warning
-org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=ignore
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/.classpath b/eclipse/plugins/com.android.ide.eclipse.tests/.classpath
index 5202252..247c1c2 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/.classpath
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/.classpath
@@ -6,7 +6,7 @@
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
<classpathentry kind="lib" path="kxml2-2.3.0.jar"/>
<classpathentry kind="lib" path="easymock.jar"/>
- <classpathentry kind="lib" path="sdktestutils.jar"/>
+ <classpathentry kind="lib" path="testutils.jar"/>
<classpathentry kind="lib" path="/plugin-adt/libs/ninepatch.jar" sourcepath="/ninepatch"/>
<classpathentry kind="lib" path="/plugin-base/libs/sdklib.jar" sourcepath="/SdkLib"/>
<classpathentry kind="lib" path="/plugin-adt/libs/sdkuilib.jar" sourcepath="/SdkUiLib"/>
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/.settings/org.eclipse.jdt.core.prefs b/eclipse/plugins/com.android.ide.eclipse.tests/.settings/org.eclipse.jdt.core.prefs
index bc45534..ea66196 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/.settings/org.eclipse.jdt.core.prefs
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/.settings/org.eclipse.jdt.core.prefs
@@ -4,7 +4,7 @@ org.eclipse.jdt.core.compiler.annotation.nonnull=com.android.annotations.NonNull
org.eclipse.jdt.core.compiler.annotation.nonnullbydefault=com.android.annotations.NonNullByDefault
org.eclipse.jdt.core.compiler.annotation.nonnullisdefault=disabled
org.eclipse.jdt.core.compiler.annotation.nullable=com.android.annotations.Nullable
-org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled
+org.eclipse.jdt.core.compiler.annotation.nullanalysis=enabled
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
@@ -33,7 +33,7 @@ org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
org.eclipse.jdt.core.compiler.problem.includeNullInfoFromAsserts=enabled
org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=warning
org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
@@ -48,11 +48,11 @@ org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignor
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
-org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecInsufficientInfo=warning
-org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
-org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=warning
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning
+org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=ignore
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
@@ -68,7 +68,7 @@ org.eclipse.jdt.core.compiler.problem.reportMethodCanBePotentiallyStatic=ignore
org.eclipse.jdt.core.compiler.problem.reportMethodCanBeStatic=ignore
org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=enabled
org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/META-INF/MANIFEST.MF b/eclipse/plugins/com.android.ide.eclipse.tests/META-INF/MANIFEST.MF
index 8695eb2..e40176a 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/META-INF/MANIFEST.MF
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/META-INF/MANIFEST.MF
@@ -9,7 +9,7 @@ Require-Bundle: org.junit
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ClassPath: kxml2-2.3.0.jar,
.,
- sdktestutils.jar,
+ testutils.jar,
layoutlib.jar,
lint-api.jar,
lint-checks.jar,
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/build.properties b/eclipse/plugins/com.android.ide.eclipse.tests/build.properties
index 27e32c2..e8daa3e 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/build.properties
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/build.properties
@@ -7,7 +7,7 @@ bin.includes = META-INF/,\
prefs.template,\
unittest.xml,\
kxml2-2.3.0.jar,\
- sdktestutils.jar,\
+ testutils.jar,\
layoutlib.jar,\
lint-api.jar,\
lint-checks.jar,\
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/AdtProjectTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/AdtProjectTest.java
index 8dd83d7..9c48ccd 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/AdtProjectTest.java
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/editors/layout/refactoring/AdtProjectTest.java
@@ -317,7 +317,7 @@ public abstract class AdtProjectTest extends SdkLoadingTestCase {
assertNotNull(target);
}
- private static IProject validateProjectExists(String name) {
+ protected static IProject validateProjectExists(String name) {
IProject iproject = getProject(name);
assertTrue(String.format("%s project not created", name), iproject.exists());
assertTrue(String.format("%s project not opened", name), iproject.isOpen());
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/ExportGradleTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/ExportGradleTest.java
new file mode 100644
index 0000000..f5cc58b
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/src/com/android/ide/eclipse/adt/internal/wizards/exportgradle/ExportGradleTest.java
@@ -0,0 +1,303 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.android.ide.eclipse.adt.internal.wizards.exportgradle;
+
+import static com.android.sdklib.internal.project.ProjectProperties.PROPERTY_LIBRARY;
+
+import com.android.SdkConstants;
+import com.android.ide.eclipse.adt.AdtPlugin;
+import com.android.ide.eclipse.adt.AdtUtils;
+import com.android.ide.eclipse.adt.internal.editors.layout.refactoring.AdtProjectTest;
+import com.android.ide.eclipse.adt.internal.project.BaseProjectHelper;
+import com.android.ide.eclipse.adt.internal.sdk.ProjectState;
+import com.android.ide.eclipse.adt.internal.sdk.Sdk;
+import com.android.ide.eclipse.adt.internal.wizards.newproject.NewProjectCreator;
+import com.android.ide.eclipse.adt.internal.wizards.newproject.NewProjectWizardState;
+import com.android.ide.eclipse.adt.internal.wizards.newproject.NewProjectWizardState.Mode;
+import com.android.sdklib.internal.project.ProjectPropertiesWorkingCopy;
+import com.google.common.base.Charsets;
+import com.google.common.io.Files;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.QualifiedName;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+
+import java.io.File;
+import java.lang.reflect.InvocationTargetException;
+import java.util.Collections;
+
+public class ExportGradleTest extends AdtProjectTest {
+ private QualifiedName ERROR_KEY = new QualifiedName(AdtPlugin.PLUGIN_ID, "JobErrorKey");
+ private Throwable mLastThrown;
+
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+ mLastThrown = null;
+ }
+
+ @Override
+ protected boolean testCaseNeedsUniqueProject() {
+ return true;
+ }
+
+ public void testSimpleAndroidApp() throws Throwable {
+ IProject project = getProject("simple-app");
+ final IJavaProject javaProject = BaseProjectHelper.getJavaProject(project);
+
+ final ProjectSetupBuilder builder = new ProjectSetupBuilder();
+ builder.setProject(Collections.singletonList(javaProject));
+
+ Job job = new Job("Validate project") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ BuildFileCreator.createBuildFiles(builder, null, monitor);
+ File buildfile = new File(javaProject.getResource().getLocation().toString(),
+ BuildFileCreator.BUILD_FILE);
+ assertTrue(buildfile.exists());
+ String contents = Files.toString(buildfile, Charsets.UTF_8);
+ String expectedContents =
+ "buildscript {\n" +
+ " repositories {\n" +
+ " " + BuildFileCreator.MAVEN_REPOSITORY + "\n" +
+ " }\n" +
+ " dependencies {\n" +
+ " " + BuildFileCreator.PLUGIN_CLASSPATH + "\n" +
+ " }\n" +
+ "}\n" +
+ "apply plugin: 'android'\n" +
+ "\n" +
+ "dependencies {\n" +
+ "}\n" +
+ "\n" +
+ "android {\n" +
+ " compileSdkVersion 16\n" +
+ " buildToolsVersion \"16\"\n" +
+ "\n" +
+ " defaultConfig {\n" +
+ " minSdkVersion 1\n" +
+ " targetSdkVersion 1\n" +
+ " }\n" +
+ " sourceSets {\n" +
+ " main {\n" +
+ " manifest.srcFile 'AndroidManifest.xml'\n" +
+ " java.srcDirs = ['src']\n" +
+ " resources.srcDirs = ['src']\n" +
+ " aidl.srcDirs = ['src']\n" +
+ " renderscript.srcDirs = ['src']\n" +
+ " res.srcDirs = ['res']\n" +
+ " assets.srcDirs = ['assets']\n" +
+ " }\n" +
+ " instrumentTest.setRoot('tests')\n" +
+ " }\n" +
+ "}";
+
+ assertEqualsWhitespaceInsensitive(expectedContents, contents);
+ } catch (Throwable t) {
+ mLastThrown = t;
+ }
+ return null;
+ }
+ };
+ job.schedule(1000);
+ job.join();
+ Object property = job.getProperty(ERROR_KEY);
+ assertNull(property);
+ if (mLastThrown != null) {
+ throw mLastThrown;
+ }
+ }
+
+ public void testSimpleAndroidLib() throws Throwable {
+ final IProject project = getProject("simple-library");
+ ProjectState projectState = Sdk.getProjectState(project.getProject());
+ ProjectPropertiesWorkingCopy propertiesWorkingCopy = projectState.getProperties().makeWorkingCopy();
+ propertiesWorkingCopy.setProperty(PROPERTY_LIBRARY, "true");
+ propertiesWorkingCopy.save();
+ IResource projectProp = project.findMember(SdkConstants.FN_PROJECT_PROPERTIES);
+ if (projectProp != null) {
+ projectProp.refreshLocal(IResource.DEPTH_ZERO, new NullProgressMonitor());
+ }
+
+ Job job = new Job("Validate project") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ IJavaProject javaProject = BaseProjectHelper.getJavaProject(project);
+
+ final ProjectSetupBuilder builder = new ProjectSetupBuilder();
+ builder.setProject(Collections.singletonList(javaProject));
+
+ BuildFileCreator.createBuildFiles(builder, null, monitor);
+ File buildfile = new File(javaProject.getResource().getLocation().toString(),
+ BuildFileCreator.BUILD_FILE);
+ assertTrue(buildfile.exists());
+ String contents = Files.toString(buildfile, Charsets.UTF_8);
+ String expectedContents =
+ "buildscript {\n" +
+ " repositories {\n" +
+ " " + BuildFileCreator.MAVEN_REPOSITORY + "\n" +
+ " }\n" +
+ " dependencies {\n" +
+ " " + BuildFileCreator.PLUGIN_CLASSPATH + "\n" +
+ " }\n" +
+ "}\n" +
+ "apply plugin: 'android-library'\n" +
+ "\n" +
+ "dependencies {\n" +
+ "}\n" +
+ "\n" +
+ "android {\n" +
+ " compileSdkVersion 16\n" +
+ " buildToolsVersion \"16\"\n" +
+ "\n" +
+ " defaultConfig {\n" +
+ " minSdkVersion 1\n" +
+ " targetSdkVersion 1\n" +
+ " }\n" +
+ " sourceSets {\n" +
+ " main {\n" +
+ " manifest.srcFile 'AndroidManifest.xml'\n" +
+ " java.srcDirs = ['src']\n" +
+ " resources.srcDirs = ['src']\n" +
+ " aidl.srcDirs = ['src']\n" +
+ " renderscript.srcDirs = ['src']\n" +
+ " res.srcDirs = ['res']\n" +
+ " assets.srcDirs = ['assets']\n" +
+ " }\n" +
+ " instrumentTest.setRoot('tests')\n" +
+ " }\n" +
+ "}";
+
+ assertEqualsWhitespaceInsensitive(expectedContents, contents);
+ } catch (Throwable t) {
+ mLastThrown = t;
+ }
+ return null;
+ }
+ };
+ job.schedule(1000);
+ job.join();
+ Object property = job.getProperty(ERROR_KEY);
+ assertNull(property);
+ if (mLastThrown != null) {
+ throw mLastThrown;
+ }
+ }
+
+ public void testPlainJavaProject() throws Throwable {
+ IProject project = getJavaProject("simple-java");
+ final IJavaProject javaProject = BaseProjectHelper.getJavaProject(project);
+
+ final ProjectSetupBuilder builder = new ProjectSetupBuilder();
+ builder.setProject(Collections.singletonList(javaProject));
+
+ BuildFileCreator.createBuildFiles(builder, null, null);
+ Job job = new Job("Validate project") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ try {
+ File buildfile = new File(javaProject.getResource().getLocation().toString(), "build.gradle");
+ assertTrue(buildfile.exists());
+ String contents = Files.toString(buildfile, Charsets.UTF_8);
+ String expectedContents =
+ "apply plugin: 'java'\n" +
+ "sourceSets {\n" +
+ " main.java.srcDirs = ['src']\n" +
+ "}";
+
+ assertEqualsWhitespaceInsensitive(expectedContents, contents);
+ } catch (Throwable t) {
+ mLastThrown = t;
+ }
+ return null;
+ }
+ };
+ job.schedule(1000);
+ job.join();
+ Object property = job.getProperty(ERROR_KEY);
+ assertNull(property);
+ if (mLastThrown != null) {
+ throw mLastThrown;
+ }
+ }
+
+ protected IProject getProject(String projectName) {
+ IProject project = createProject(projectName);
+ assertNotNull(project);
+ if (!testCaseNeedsUniqueProject() && !testNeedsUniqueProject()) {
+ addCleanupDir(AdtUtils.getAbsolutePath(project).toFile());
+ }
+ addCleanupDir(project.getFullPath().toFile());
+ return project;
+ }
+
+ protected IProject getJavaProject(String projectName) {
+ IProject project = createJavaProject(projectName);
+ assertNotNull(project);
+ if (!testCaseNeedsUniqueProject() && !testNeedsUniqueProject()) {
+ addCleanupDir(AdtUtils.getAbsolutePath(project).toFile());
+ }
+ addCleanupDir(project.getFullPath().toFile());
+ return project;
+ }
+
+ protected IProject createJavaProject(String name) {
+ IRunnableContext context = new IRunnableContext() {
+ @Override
+ public void run(boolean fork, boolean cancelable, IRunnableWithProgress runnable)
+ throws InvocationTargetException, InterruptedException {
+ runnable.run(new NullProgressMonitor());
+ }
+ };
+ NewProjectWizardState state = new NewProjectWizardState(Mode.ANY);
+ state.projectName = name;
+ state.packageName = TEST_PROJECT_PACKAGE;
+ state.activityName = name;
+ state.applicationName = name;
+ state.createActivity = false;
+ state.useDefaultLocation = true;
+ if (getMinSdk() != -1) {
+ state.minSdk = Integer.toString(getMinSdk());
+ }
+
+ NewProjectCreator creator = new NewProjectCreator(state, context);
+ creator.createJavaProjects();
+ return validateProjectExists(name);
+ }
+
+ /**
+ * Compares two strings, disregarding whitespace. This makes the test less brittle with respect
+ * to insignificant changes.
+ */
+ protected void assertEqualsWhitespaceInsensitive(String a, String b) {
+ a = stripWhitespace(a);
+ b = stripWhitespace(b);
+ assertEquals("Expected:\n" + a + "\nbut was:\n" + b + "\n\n", a, b);
+ }
+
+ protected String stripWhitespace(String s) {
+ return s.replaceAll("\\s","");
+ }
+} \ No newline at end of file
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/GravityHelperTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/GravityHelperTest.java
index f162924..8161bab 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/GravityHelperTest.java
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/common/layout/GravityHelperTest.java
@@ -18,12 +18,20 @@ package com.android.ide.common.layout;
import static com.android.ide.common.layout.GravityHelper.GRAVITY_BOTTOM;
import static com.android.ide.common.layout.GravityHelper.GRAVITY_CENTER_HORIZ;
import static com.android.ide.common.layout.GravityHelper.GRAVITY_CENTER_VERT;
+import static com.android.ide.common.layout.GravityHelper.GRAVITY_END;
import static com.android.ide.common.layout.GravityHelper.GRAVITY_FILL_HORIZ;
import static com.android.ide.common.layout.GravityHelper.GRAVITY_FILL_VERT;
import static com.android.ide.common.layout.GravityHelper.GRAVITY_LEFT;
import static com.android.ide.common.layout.GravityHelper.GRAVITY_RIGHT;
+import static com.android.ide.common.layout.GravityHelper.GRAVITY_START;
import static com.android.ide.common.layout.GravityHelper.GRAVITY_TOP;
import static com.android.ide.common.layout.GravityHelper.getGravity;
+
+import com.android.utils.XmlUtils;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
import junit.framework.TestCase;
@SuppressWarnings("javadoc")
@@ -31,13 +39,23 @@ public class GravityHelperTest extends TestCase {
public void testGravity() throws Exception {
assertEquals(GRAVITY_BOTTOM, GravityHelper.getGravity("bottom", 0));
assertEquals(GRAVITY_BOTTOM | GRAVITY_LEFT, GravityHelper.getGravity("bottom|left", 0));
+ assertEquals(GRAVITY_BOTTOM | GRAVITY_LEFT | GRAVITY_START,
+ GravityHelper.getGravity("bottom|left|start", 0));
+ assertEquals(GRAVITY_BOTTOM | GRAVITY_LEFT | GRAVITY_START,
+ GravityHelper.getGravity("bottom|start|left", 0));
+ assertEquals(GRAVITY_BOTTOM | GRAVITY_RIGHT | GRAVITY_END,
+ GravityHelper.getGravity("bottom|right|end", 0));
+ assertEquals(GRAVITY_BOTTOM | GRAVITY_RIGHT | GRAVITY_END,
+ GravityHelper.getGravity("bottom|end|right", 0));
assertEquals(GRAVITY_CENTER_HORIZ | GRAVITY_CENTER_VERT,
GravityHelper.getGravity("center", 0));
}
public void testGravityString() throws Exception {
assertEquals("left", getGravity(GRAVITY_LEFT));
+ assertEquals("start", getGravity(GRAVITY_START));
assertEquals("right", getGravity(GRAVITY_RIGHT));
+ assertEquals("end", getGravity(GRAVITY_END));
assertEquals("top", getGravity(GRAVITY_TOP));
assertEquals("bottom", getGravity(GRAVITY_BOTTOM));
assertEquals("center_horizontal", getGravity(GRAVITY_CENTER_HORIZ));
@@ -48,17 +66,22 @@ public class GravityHelperTest extends TestCase {
assertEquals("center", getGravity(GRAVITY_CENTER_HORIZ|GRAVITY_CENTER_VERT));
assertEquals("left|bottom", getGravity(GRAVITY_LEFT|GRAVITY_BOTTOM));
+ assertEquals("left|start|bottom", getGravity(GRAVITY_LEFT|GRAVITY_START|GRAVITY_BOTTOM));
assertEquals("center_horizontal|top", getGravity(GRAVITY_CENTER_HORIZ|GRAVITY_TOP));
}
public void testConstrained() throws Exception {
assertTrue(GravityHelper.isConstrainedHorizontally(GRAVITY_LEFT));
+ assertTrue(GravityHelper.isConstrainedHorizontally(GRAVITY_START));
assertTrue(GravityHelper.isConstrainedHorizontally(GRAVITY_RIGHT));
+ assertTrue(GravityHelper.isConstrainedHorizontally(GRAVITY_END));
assertTrue(GravityHelper.isConstrainedHorizontally(GRAVITY_CENTER_HORIZ));
assertTrue(GravityHelper.isConstrainedHorizontally(GRAVITY_FILL_HORIZ));
assertFalse(GravityHelper.isConstrainedVertically(GRAVITY_LEFT));
+ assertFalse(GravityHelper.isConstrainedVertically(GRAVITY_START));
assertFalse(GravityHelper.isConstrainedVertically(GRAVITY_RIGHT));
+ assertFalse(GravityHelper.isConstrainedVertically(GRAVITY_END));
assertFalse(GravityHelper.isConstrainedVertically(GRAVITY_CENTER_HORIZ));
assertFalse(GravityHelper.isConstrainedVertically(GRAVITY_FILL_HORIZ));
@@ -75,11 +98,30 @@ public class GravityHelperTest extends TestCase {
public void testAligned() throws Exception {
assertTrue(GravityHelper.isLeftAligned(GRAVITY_LEFT|GRAVITY_TOP));
+ assertTrue(GravityHelper.isLeftAligned(GRAVITY_START|GRAVITY_TOP));
assertTrue(GravityHelper.isLeftAligned(GRAVITY_LEFT));
+ assertTrue(GravityHelper.isLeftAligned(GRAVITY_START));
assertFalse(GravityHelper.isLeftAligned(GRAVITY_RIGHT));
+ assertFalse(GravityHelper.isLeftAligned(GRAVITY_END));
assertTrue(GravityHelper.isTopAligned(GRAVITY_LEFT|GRAVITY_TOP));
+ assertTrue(GravityHelper.isTopAligned(GRAVITY_START|GRAVITY_TOP));
assertTrue(GravityHelper.isTopAligned(GRAVITY_TOP));
assertFalse(GravityHelper.isTopAligned(GRAVITY_BOTTOM));
}
-}
+
+ public void testElement() throws Exception {
+ Document document = XmlUtils.parseDocumentSilently(""
+ + "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n"
+ + "<LinearLayout xmlns:android=\"http://schemas.android.com/apk/res/android\"\n"
+ + " android:layout_width=\"match_parent\"\n"
+ + " android:layout_height=\"wrap_content\"\n"
+ + " android:layout_gravity=\"start|center_vertical|left\""
+ + " android:orientation=\"vertical\" />\n", true);
+ assertNotNull(document);
+ Element element = document.getDocumentElement();
+ assertNotNull(element);
+ int gravity = GravityHelper.getGravity(element);
+ assertEquals("left|start|center_vertical", GravityHelper.getGravity(gravity));
+ }
+} \ No newline at end of file
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/draw9patch/graphics/GraphicsUtilitiesTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/draw9patch/graphics/GraphicsUtilitiesTest.java
new file mode 100644
index 0000000..4f00097
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/draw9patch/graphics/GraphicsUtilitiesTest.java
@@ -0,0 +1,313 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.editors.draw9patch.graphics;
+
+import java.util.Arrays;
+
+import junit.framework.TestCase;
+
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.widgets.Display;
+
+public class GraphicsUtilitiesTest extends TestCase {
+ private static final int MASK_ALPHA = 0xFF000000;
+
+ private static final String DIR = "/com/android/ide/eclipse/testdata/draw9patch/";
+
+ public void testConvertToNinePatchNull() throws Exception {
+ ImageData result = GraphicsUtilities.convertToNinePatch(null);
+ assertNull(result);
+ }
+
+ public void testConvertToNinePatch() throws Exception {
+ String fileName = DIR + "no-patched.png";
+ Image image = new Image(Display.getDefault(),
+ getClass().getResourceAsStream(fileName));
+ ImageData baseData = image.getImageData();
+
+ ImageData result = GraphicsUtilities.convertToNinePatch(baseData);
+
+ assertEquals(baseData.width + 2, result.width);
+ assertEquals(baseData.height + 2, result.height);
+
+ // horizontal
+ for (int x = 0; x < result.width; x++) {
+
+ // top row
+ assertEquals(0x0, result.getPixel(x, 0) & MASK_ALPHA);
+
+ // bottom row
+ assertEquals(0x0, result.getPixel(x, result.height - 1) & MASK_ALPHA);
+ }
+
+ // vertical
+ for (int y = 0; y < result.height; y++) {
+
+ // left column
+ assertEquals(0x0, result.getPixel(0, y) & MASK_ALPHA);
+
+ // right column
+ assertEquals(0x0, result.getPixel(result.width - 1, y) & MASK_ALPHA);
+ }
+ }
+
+ public void testClearImageDataNull() throws Exception {
+ try {
+ GraphicsUtilities.clearImageData(null);
+ fail();
+ } catch (IllegalArgumentException e) {
+ }
+ }
+
+ public void testClearImageData() throws Exception {
+ String fileName = DIR + "no-patched.png";
+ Image image = new Image(Display.getDefault(),
+ getClass().getResourceAsStream(fileName));
+
+ ImageData baseData = image.getImageData();
+ GraphicsUtilities.clearImageData(baseData);
+ for (int y = 0; y < baseData.height; y++) {
+ for (int x = 0; x < baseData.width; x++) {
+ assertEquals(0x000000, baseData.getPixel(x, y));
+ assertEquals(0x00, baseData.getAlpha(x, y));
+ }
+ }
+
+ }
+
+ public void testCopyNull() throws Exception {
+ ImageData result = GraphicsUtilities.copy(null);
+ assertNull(result);
+ }
+
+ public void testCopy() throws Exception {
+ String fileName = DIR + "no-patched.png";
+ Image image = new Image(Display.getDefault(),
+ getClass().getResourceAsStream(fileName));
+
+ ImageData baseData = image.getImageData();
+ ImageData copiedData = GraphicsUtilities.copy(baseData);
+
+ assertEquals(baseData.width, copiedData.width);
+ assertEquals(baseData.height, copiedData.height);
+ assertEquals(baseData.depth, copiedData.depth);
+ assertEquals(baseData.transparentPixel, copiedData.transparentPixel);
+ assertEquals(baseData.alpha, copiedData.alpha);
+ assertTrue(baseData.palette.equals(copiedData.palette));
+
+ final int[] baseColors = new int[baseData.width];
+ final byte[] baseAlpha = new byte[baseData.width];
+
+ final int[] copiedColors = new int[copiedData.width];
+ final byte[] copiedAlpha = new byte[copiedData.width];
+
+ for (int y = 0; y < baseData.height; y++) {
+
+ baseData.getPixels(0, y, baseData.width, baseColors, 0);
+ baseData.getPixels(0, y, baseData.width, copiedColors, 0);
+ assertTrue(Arrays.equals(baseColors, copiedColors));
+
+ baseData.getAlphas(0, y, baseData.width, baseAlpha, 0);
+ baseData.getAlphas(0, y, baseData.width, copiedAlpha, 0);
+ assertTrue(Arrays.equals(baseAlpha, copiedAlpha));
+
+ }
+ }
+
+ public void testGetVerticalPixelsIllegalArgument() throws Exception {
+ String fileName = DIR + "no-patched.png";
+ Image image = new Image(Display.getDefault(),
+ getClass().getResourceAsStream(fileName));
+
+ ImageData baseData = image.getImageData();
+ int[] temp = new int[baseData.width];
+
+ // data must not be null
+ try {
+ GraphicsUtilities.getVerticalPixels(null, 0, 0, 1, temp);
+ fail();
+ } catch (IllegalArgumentException e) {
+ }
+
+ // out must not be null
+ try {
+ GraphicsUtilities.getVerticalPixels(baseData, 0, 0, 1, null);
+ fail();
+ } catch (IllegalArgumentException e) {
+ }
+
+ // out length must be > height
+ try {
+ GraphicsUtilities.getVerticalPixels(baseData, 0, 0, 1, new int[0]);
+ fail();
+ } catch (IllegalArgumentException e) {
+ }
+
+ // x must be > 0
+ try {
+ GraphicsUtilities.getVerticalPixels(baseData, -1, 0, 1, temp);
+ fail();
+ } catch (IllegalArgumentException e) {
+ }
+
+ // y must be > 0
+ try {
+ GraphicsUtilities.getVerticalPixels(baseData, 0, -1, 1, temp);
+ fail();
+ } catch (IllegalArgumentException e) {
+ }
+
+ // height must be >= 0
+ try {
+ GraphicsUtilities.getVerticalPixels(baseData, 0, 0, 0, temp);
+ fail();
+ } catch (IllegalArgumentException e) {
+ }
+
+ // argument x must be < data.width
+ try {
+ GraphicsUtilities.getVerticalPixels(baseData, baseData.width, 0, baseData.height, temp);
+ fail();
+ } catch (IllegalArgumentException e) {
+ }
+
+ // argument y must be < data.height
+ try {
+ GraphicsUtilities
+ .getVerticalPixels(baseData, 0, baseData.height, baseData.height, temp);
+ fail();
+ } catch (IllegalArgumentException e) {
+ }
+
+ // argument height must be > (y + data.height)
+ try {
+ GraphicsUtilities.getVerticalPixels(baseData, 0, 1, baseData.height, temp);
+ fail();
+ } catch (IllegalArgumentException e) {
+ }
+
+ }
+
+ public void testGetVerticalPixels() throws Exception {
+ String fileName = DIR + "no-patched.png";
+ Image image = new Image(Display.getDefault(),
+ getClass().getResourceAsStream(fileName));
+
+ ImageData baseData = image.getImageData();
+ int[] temp = new int[baseData.width];
+
+ GraphicsUtilities.getVerticalPixels(baseData, 0, 0, baseData.height, temp);
+
+ int height = baseData.height;
+ for (int y = 0; y < height; y++) {
+ assertEquals(baseData.getPixel(0, y), temp[y]);
+ }
+ }
+
+ public void testGetHorizontalPixelsIllegalArgument() throws Exception {
+ String fileName = DIR + "no-patched.png";
+ Image image = new Image(Display.getDefault(),
+ getClass().getResourceAsStream(fileName));
+
+ ImageData baseData = image.getImageData();
+ int[] temp = new int[baseData.width];
+
+ // data must not be null
+ try {
+ GraphicsUtilities.getHorizontalPixels(null, 0, 0, 1, temp);
+ fail();
+ } catch (IllegalArgumentException e) {
+ }
+
+ // out must not be null
+ try {
+ GraphicsUtilities.getHorizontalPixels(baseData, 0, 0, 1, null);
+ fail();
+ } catch (IllegalArgumentException e) {
+ }
+
+ // out length must be > width
+ try {
+ GraphicsUtilities.getHorizontalPixels(baseData, 0, 0, 1, new int[0]);
+ fail();
+ } catch (IllegalArgumentException e) {
+ }
+
+ // x must be > 0
+ try {
+ GraphicsUtilities.getHorizontalPixels(baseData, -1, 0, 1, temp);
+ fail();
+ } catch (IllegalArgumentException e) {
+ }
+
+ // y must be > 0
+ try {
+ GraphicsUtilities.getHorizontalPixels(baseData, 0, -1, 1, temp);
+ fail();
+ } catch (IllegalArgumentException e) {
+ }
+
+ // width must be >= 0
+ try {
+ GraphicsUtilities.getHorizontalPixels(baseData, 0, 0, 0, temp);
+ fail();
+ } catch (IllegalArgumentException e) {
+ }
+
+ // argument x must be < data.width
+ try {
+ GraphicsUtilities
+ .getHorizontalPixels(baseData, baseData.width, 0, baseData.width, temp);
+ fail();
+ } catch (IllegalArgumentException e) {
+ }
+
+ // argument y must be < data.height
+ try {
+ GraphicsUtilities
+ .getHorizontalPixels(baseData, 0, baseData.height, baseData.width, temp);
+ fail();
+ } catch (IllegalArgumentException e) {
+ }
+
+ // argument width must be > (x + data.width)
+ try {
+ GraphicsUtilities.getHorizontalPixels(baseData, 1, 0, baseData.width, temp);
+ fail();
+ } catch (IllegalArgumentException e) {
+ }
+
+ }
+
+ public void testGetHorizontalPixels() throws Exception {
+ String fileName = DIR + "no-patched.png";
+ Image image = new Image(Display.getDefault(),
+ getClass().getResourceAsStream(fileName));
+
+ ImageData baseData = image.getImageData();
+ int[] temp = new int[baseData.width];
+
+ GraphicsUtilities.getHorizontalPixels(baseData, 0, 0, baseData.width, temp);
+
+ int width = baseData.width;
+ for (int x = 0; x < width; x++) {
+ assertEquals(baseData.getPixel(x, 0), temp[x]);
+ }
+ }
+
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/draw9patch/graphics/NinePatchedImageTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/draw9patch/graphics/NinePatchedImageTest.java
new file mode 100644
index 0000000..72c9296
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/draw9patch/graphics/NinePatchedImageTest.java
@@ -0,0 +1,914 @@
+/*
+ * Copyright (C) 2013 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.editors.draw9patch.graphics;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+
+import com.android.ide.eclipse.adt.internal.editors.draw9patch.graphics.NinePatchedImage.Chunk;
+import com.android.ide.eclipse.adt.internal.editors.draw9patch.graphics.NinePatchedImage.Projection;
+import com.android.ide.eclipse.adt.internal.editors.draw9patch.graphics.NinePatchedImage.Tick;
+
+public class NinePatchedImageTest extends TestCase {
+
+ private static final String DIR = "/com/android/ide/eclipse/testdata/draw9patch/";
+
+ public void testReadNoPatchedImage() throws Exception {
+ String fileName = DIR + "no-patched.png";
+ NinePatchedImage image = new NinePatchedImage(getClass()
+ .getResourceAsStream(fileName), fileName);
+ assertNotNull(image);
+
+ ImageData data = image.getImageData();
+ int width = data.width;
+ int height = data.height;
+
+ assertEquals(72, width);
+ assertEquals(50, height);
+
+ assertFalse(image.hasNinePatchExtension());
+ }
+
+ public void testReadNoPatchedInteraceImage() throws Exception {
+ String fileName = DIR + "no-patched-interlace.png";
+ NinePatchedImage image = new NinePatchedImage(getClass()
+ .getResourceAsStream(fileName), fileName);
+ assertNotNull(image);
+
+ ImageData data = image.getImageData();
+ int width = data.width;
+ int height = data.height;
+
+ assertEquals(72, width);
+ assertEquals(50, height);
+
+ assertFalse(image.hasNinePatchExtension());
+ }
+
+ public void testConvert9PatchedImage() throws Exception {
+ String fileName = DIR + "no-patched.png";
+ NinePatchedImage image = new NinePatchedImage(getClass()
+ .getResourceAsStream(fileName), fileName);
+ assertNotNull(image);
+
+ ImageData data = image.getImageData();
+ int width = data.width;
+ int height = data.height;
+
+ assertEquals(72, width);
+ assertEquals(50, height);
+
+ assertFalse(image.hasNinePatchExtension());
+
+ image.convertToNinePatch();
+
+ data = image.getImageData();
+ width = data.width;
+ height = data.height;
+
+ // increased patch size
+ assertEquals(72 + 2, width);
+ assertEquals(50 + 2, height);
+
+ assertTrue(image.hasNinePatchExtension());
+ assertFalse(image.isDirty());
+
+ // initialized patches
+ List<Tick> horizontalPatches = image.getHorizontalPatches();
+ List<Tick> verticalPatches = image.getVerticalPatches();
+ assertEquals(1, horizontalPatches.size());
+ assertEquals(1, verticalPatches.size());
+
+ // initialized contents area
+ List<Tick> horizontalContentsArea = image.getHorizontalContents();
+ List<Tick> verticalContentsArea = image.getVerticalContents();
+ assertEquals(1, horizontalContentsArea.size());
+ assertEquals(1, verticalContentsArea.size());
+
+ // content area rectangle
+ Rectangle contentsArea = image.getContentArea();
+ assertEquals(new Rectangle(1, 1, width - 2, height - 2), contentsArea);
+ }
+
+ public void testReadInvalidPatchedImageCorners() throws Exception {
+
+ // top-left
+ String fileName = DIR + "invalid-patched1.9.png";
+ NinePatchedImage image = new NinePatchedImage(getClass()
+ .getResourceAsStream(fileName), fileName);
+ assertNotNull(image);
+ assertTrue(image.hasNinePatchExtension());
+ assertFalse(image.ensure9Patch());
+
+ // top-right
+ fileName = DIR + "invalid-patched2.9.png";
+ image = new NinePatchedImage(getClass()
+ .getResourceAsStream(fileName), fileName);
+ assertNotNull(image);
+ assertTrue(image.hasNinePatchExtension());
+ assertFalse(image.ensure9Patch());
+
+ // bottom-left
+ fileName = DIR + "invalid-patched3.9.png";
+ image = new NinePatchedImage(getClass()
+ .getResourceAsStream(fileName), fileName);
+ assertNotNull(image);
+ assertTrue(image.hasNinePatchExtension());
+ assertFalse(image.ensure9Patch());
+
+ // bottom-right
+ fileName = DIR + "invalid-patched4.9.png";
+ image = new NinePatchedImage(getClass()
+ .getResourceAsStream(fileName), fileName);
+ assertNotNull(image);
+ assertTrue(image.hasNinePatchExtension());
+ assertFalse(image.ensure9Patch());
+ }
+
+ public void testReadInvalidPatchedImageLine() throws Exception {
+
+ // top
+ String fileName = DIR + "invalid-patched5.9.png";
+ NinePatchedImage image = new NinePatchedImage(getClass()
+ .getResourceAsStream(fileName), fileName);
+ assertNotNull(image);
+ assertTrue(image.hasNinePatchExtension());
+ assertFalse(image.ensure9Patch());
+
+ // right
+ fileName = DIR + "invalid-patched6.9.png";
+ image = new NinePatchedImage(getClass()
+ .getResourceAsStream(fileName), fileName);
+ assertNotNull(image);
+ assertTrue(image.hasNinePatchExtension());
+ assertFalse(image.ensure9Patch());
+
+ // bottom
+ fileName = DIR + "invalid-patched7.9.png";
+ image = new NinePatchedImage(getClass()
+ .getResourceAsStream(fileName), fileName);
+ assertNotNull(image);
+ assertTrue(image.hasNinePatchExtension());
+ assertFalse(image.ensure9Patch());
+
+ // left
+ fileName = DIR + "invalid-patched8.9.png";
+ image = new NinePatchedImage(getClass()
+ .getResourceAsStream(fileName), fileName);
+ assertNotNull(image);
+ assertTrue(image.hasNinePatchExtension());
+ assertFalse(image.ensure9Patch());
+ }
+
+ public void testEnsure9PatchIgnoreInvalidPixels() throws Exception {
+ // top
+ String fileName = DIR + "invalid-patched5.9.png";
+ NinePatchedImage image = new NinePatchedImage(getClass()
+ .getResourceAsStream(fileName), fileName);
+ assertNotNull(image);
+
+ // invalid pixel
+ int invalidPixel = image.getImageData().getPixel(33, 0);
+ assertTrue(0x0 != invalidPixel);
+
+ assertTrue(image.hasNinePatchExtension());
+ assertFalse(image.ensure9Patch());
+
+ // ensure9path() ignored invalid pixels
+ int invalidPixelAlpha = image.getImageData().getAlpha(33, 0);
+ assertEquals(0x00, invalidPixelAlpha);
+ }
+
+ public void test9Patch1() throws Exception {
+ String fileName = DIR + "patched1.9.png";
+ NinePatchedImage image = new NinePatchedImage(getClass()
+ .getResourceAsStream(fileName), fileName);
+ assertNotNull(image);
+
+ assertTrue(image.hasNinePatchExtension());
+ assertTrue(image.ensure9Patch());
+
+ // patches
+ List<Tick> horizontalPatches = image.getHorizontalPatches();
+ List<Tick> verticalPatches = image.getVerticalPatches();
+ assertEquals(3, horizontalPatches.size());
+ assertEquals(3, verticalPatches.size());
+
+ Chunk[][] chunks = null;
+ chunks = image.getChunks(chunks);
+
+ // vertical chunk size
+ assertEquals(3, chunks.length);
+
+ // horizontal chunk size
+ for (int i = 0; i < chunks.length; i++) {
+ assertEquals(3, chunks[i].length);
+ }
+
+ Chunk c = null;
+ Rectangle rect = null;
+
+ // Row 1
+ c = chunks[0][0];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_HORIZONTAL | Chunk.TYPE_VERTICAL, c.type);
+ assertEquals(1, rect.x);
+ assertEquals(1, rect.y);
+ assertEquals(1, rect.width);
+ assertEquals(1, rect.height);
+
+ c = chunks[0][1];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_VERTICAL, c.type);
+ assertEquals(2, rect.x);
+ assertEquals(1, rect.y);
+ assertEquals(70, rect.width);
+ assertEquals(1, rect.height);
+
+ c = chunks[0][2];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_HORIZONTAL | Chunk.TYPE_VERTICAL, c.type);
+ assertEquals(72, rect.x);
+ assertEquals(1, rect.y);
+ assertEquals(1, rect.width);
+ assertEquals(1, rect.height);
+
+ // Row 2
+ c = chunks[1][0];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_HORIZONTAL, c.type);
+ assertEquals(1, rect.x);
+ assertEquals(2, rect.y);
+ assertEquals(1, rect.width);
+ assertEquals(48, rect.height);
+
+ c = chunks[1][1];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_FIXED, c.type);
+ assertEquals(2, rect.x);
+ assertEquals(2, rect.y);
+ assertEquals(70, rect.width);
+ assertEquals(48, rect.height);
+
+ c = chunks[1][2];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_HORIZONTAL, c.type);
+ assertEquals(72, rect.x);
+ assertEquals(2, rect.y);
+ assertEquals(1, rect.width);
+ assertEquals(48, rect.height);
+
+ // Row 3
+ c = chunks[2][0];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_HORIZONTAL | Chunk.TYPE_VERTICAL, c.type);
+ assertEquals(1, rect.x);
+ assertEquals(50, rect.y);
+ assertEquals(1, rect.width);
+ assertEquals(1, rect.height);
+
+ c = chunks[2][1];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_VERTICAL, c.type);
+ assertEquals(2, rect.x);
+ assertEquals(50, rect.y);
+ assertEquals(70, rect.width);
+ assertEquals(1, rect.height);
+
+ c = chunks[2][2];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_HORIZONTAL | Chunk.TYPE_VERTICAL, c.type);
+ assertEquals(72, rect.x);
+ assertEquals(50, rect.y);
+ assertEquals(1, rect.width);
+ assertEquals(1, rect.height);
+ }
+
+ public void test9Patch2() throws Exception {
+ String fileName = DIR + "patched2.9.png";
+ NinePatchedImage image = new NinePatchedImage(getClass()
+ .getResourceAsStream(fileName), fileName);
+ assertNotNull(image);
+
+ assertTrue(image.hasNinePatchExtension());
+ assertTrue(image.ensure9Patch());
+
+ // patches
+ List<Tick> horizontalPatches = image.getHorizontalPatches();
+ List<Tick> verticalPatches = image.getVerticalPatches();
+ assertEquals(5, horizontalPatches.size());
+ assertEquals(7, verticalPatches.size());
+
+ NinePatchedImage.Chunk[][] chunks = null;
+ chunks = image.getChunks(chunks);
+
+ // vertical chunk size
+ assertEquals(7, chunks.length);
+
+ // horizontal chunk size
+ for (int i = 0; i < chunks.length; i++) {
+ assertEquals(5, chunks[i].length);
+ }
+
+ NinePatchedImage.Chunk c = null;
+ Rectangle rect = null;
+
+ // Row 1
+ c = chunks[0][0];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_HORIZONTAL | Chunk.TYPE_VERTICAL, c.type);
+ assertEquals(1, rect.x);
+ assertEquals(1, rect.y);
+ assertEquals(1, rect.width);
+ assertEquals(1, rect.height);
+
+ c = chunks[0][1];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_VERTICAL, c.type);
+ assertEquals(2, rect.x);
+ assertEquals(1, rect.y);
+ assertEquals(34, rect.width);
+ assertEquals(1, rect.height);
+
+ c = chunks[0][2];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_HORIZONTAL | Chunk.TYPE_VERTICAL, c.type);
+ assertEquals(36, rect.x);
+ assertEquals(1, rect.y);
+ assertEquals(1, rect.width);
+ assertEquals(1, rect.height);
+
+ c = chunks[0][3];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_VERTICAL, c.type);
+ assertEquals(37, rect.x);
+ assertEquals(1, rect.y);
+ assertEquals(35, rect.width);
+ assertEquals(1, rect.height);
+
+ c = chunks[0][4];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_HORIZONTAL | Chunk.TYPE_VERTICAL, c.type);
+ assertEquals(72, rect.x);
+ assertEquals(1, rect.y);
+ assertEquals(1, rect.width);
+ assertEquals(1, rect.height);
+
+ // Row 2
+ c = chunks[1][0];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_HORIZONTAL, c.type);
+ assertEquals(1, rect.x);
+ assertEquals(2, rect.y);
+ assertEquals(1, rect.width);
+ assertEquals(7, rect.height);
+
+ c = chunks[1][1];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_FIXED, c.type);
+ assertEquals(2, rect.x);
+ assertEquals(2, rect.y);
+ assertEquals(34, rect.width);
+ assertEquals(7, rect.height);
+
+ c = chunks[1][2];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_HORIZONTAL, c.type);
+ assertEquals(36, rect.x);
+ assertEquals(2, rect.y);
+ assertEquals(1, rect.width);
+ assertEquals(7, rect.height);
+
+ c = chunks[1][3];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_FIXED, c.type);
+ assertEquals(37, rect.x);
+ assertEquals(2, rect.y);
+ assertEquals(35, rect.width);
+ assertEquals(7, rect.height);
+
+ c = chunks[1][4];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_HORIZONTAL, c.type);
+ assertEquals(72, rect.x);
+ assertEquals(2, rect.y);
+ assertEquals(1, rect.width);
+ assertEquals(7, rect.height);
+
+ // Row 3
+ c = chunks[2][0];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_HORIZONTAL | Chunk.TYPE_VERTICAL, c.type);
+ assertEquals(1, rect.x);
+ assertEquals(9, rect.y);
+ assertEquals(1, rect.width);
+ assertEquals(4, rect.height);
+
+ c = chunks[2][1];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_VERTICAL, c.type);
+ assertEquals(2, rect.x);
+ assertEquals(9, rect.y);
+ assertEquals(34, rect.width);
+ assertEquals(4, rect.height);
+
+ c = chunks[2][2];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_HORIZONTAL | Chunk.TYPE_VERTICAL, c.type);
+ assertEquals(36, rect.x);
+ assertEquals(9, rect.y);
+ assertEquals(1, rect.width);
+ assertEquals(4, rect.height);
+
+ c = chunks[2][3];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_VERTICAL, c.type);
+ assertEquals(37, rect.x);
+ assertEquals(9, rect.y);
+ assertEquals(35, rect.width);
+ assertEquals(4, rect.height);
+
+ c = chunks[2][4];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_HORIZONTAL | Chunk.TYPE_VERTICAL, c.type);
+ assertEquals(72, rect.x);
+ assertEquals(9, rect.y);
+ assertEquals(1, rect.width);
+ assertEquals(4, rect.height);
+
+ // Row 4
+ c = chunks[3][0];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_HORIZONTAL, c.type);
+ assertEquals(1, rect.x);
+ assertEquals(13, rect.y);
+ assertEquals(1, rect.width);
+ assertEquals(13, rect.height);
+
+ c = chunks[3][1];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_FIXED, c.type);
+ assertEquals(2, rect.x);
+ assertEquals(13, rect.y);
+ assertEquals(34, rect.width);
+ assertEquals(13, rect.height);
+
+ c = chunks[3][2];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_HORIZONTAL, c.type);
+ assertEquals(36, rect.x);
+ assertEquals(13, rect.y);
+ assertEquals(1, rect.width);
+ assertEquals(13, rect.height);
+
+ c = chunks[3][3];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_FIXED, c.type);
+ assertEquals(37, rect.x);
+ assertEquals(13, rect.y);
+ assertEquals(35, rect.width);
+ assertEquals(13, rect.height);
+
+ c = chunks[3][4];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_HORIZONTAL, c.type);
+ assertEquals(72, rect.x);
+ assertEquals(13, rect.y);
+ assertEquals(1, rect.width);
+ assertEquals(13, rect.height);
+
+ // Row 5
+ c = chunks[4][0];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_HORIZONTAL | Chunk.TYPE_VERTICAL, c.type);
+ assertEquals(1, rect.x);
+ assertEquals(26, rect.y);
+ assertEquals(1, rect.width);
+ assertEquals(12, rect.height);
+
+ c = chunks[4][1];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_VERTICAL, c.type);
+ assertEquals(2, rect.x);
+ assertEquals(26, rect.y);
+ assertEquals(34, rect.width);
+ assertEquals(12, rect.height);
+
+ c = chunks[4][2];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_HORIZONTAL | Chunk.TYPE_VERTICAL, c.type);
+ assertEquals(36, rect.x);
+ assertEquals(26, rect.y);
+ assertEquals(1, rect.width);
+ assertEquals(12, rect.height);
+
+ c = chunks[4][3];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_VERTICAL, c.type);
+ assertEquals(37, rect.x);
+ assertEquals(26, rect.y);
+ assertEquals(35, rect.width);
+ assertEquals(12, rect.height);
+
+ c = chunks[4][4];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_HORIZONTAL | Chunk.TYPE_VERTICAL, c.type);
+ assertEquals(72, rect.x);
+ assertEquals(26, rect.y);
+ assertEquals(1, rect.width);
+ assertEquals(12, rect.height);
+
+ // Row 6
+ c = chunks[5][0];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_HORIZONTAL, c.type);
+ assertEquals(1, rect.x);
+ assertEquals(38, rect.y);
+ assertEquals(1, rect.width);
+ assertEquals(12, rect.height);
+
+ c = chunks[5][1];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_FIXED, c.type);
+ assertEquals(2, rect.x);
+ assertEquals(38, rect.y);
+ assertEquals(34, rect.width);
+ assertEquals(12, rect.height);
+
+ c = chunks[5][2];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_HORIZONTAL, c.type);
+ assertEquals(36, rect.x);
+ assertEquals(38, rect.y);
+ assertEquals(1, rect.width);
+ assertEquals(12, rect.height);
+
+ c = chunks[5][3];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_FIXED, c.type);
+ assertEquals(37, rect.x);
+ assertEquals(38, rect.y);
+ assertEquals(35, rect.width);
+ assertEquals(12, rect.height);
+
+ c = chunks[5][4];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_HORIZONTAL, c.type);
+ assertEquals(72, rect.x);
+ assertEquals(38, rect.y);
+ assertEquals(1, rect.width);
+ assertEquals(12, rect.height);
+
+ // Row 7
+ c = chunks[6][0];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_HORIZONTAL | Chunk.TYPE_VERTICAL, c.type);
+ assertEquals(1, rect.x);
+ assertEquals(50, rect.y);
+ assertEquals(1, rect.width);
+ assertEquals(1, rect.height);
+
+ c = chunks[6][1];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_VERTICAL, c.type);
+ assertEquals(2, rect.x);
+ assertEquals(50, rect.y);
+ assertEquals(34, rect.width);
+ assertEquals(1, rect.height);
+
+ c = chunks[6][2];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_HORIZONTAL | Chunk.TYPE_VERTICAL, c.type);
+ assertEquals(36, rect.x);
+ assertEquals(50, rect.y);
+ assertEquals(1, rect.width);
+ assertEquals(1, rect.height);
+
+ c = chunks[6][3];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_VERTICAL, c.type);
+ assertEquals(37, rect.x);
+ assertEquals(50, rect.y);
+ assertEquals(35, rect.width);
+ assertEquals(1, rect.height);
+
+ c = chunks[6][4];
+ rect = c.rect;
+ assertEquals(Chunk.TYPE_HORIZONTAL | Chunk.TYPE_VERTICAL, c.type);
+ assertEquals(72, rect.x);
+ assertEquals(50, rect.y);
+ assertEquals(1, rect.width);
+ assertEquals(1, rect.height);
+ }
+
+ public void testContentArea() throws Exception {
+ String fileName = DIR + "content-area.9.png";
+ NinePatchedImage image = new NinePatchedImage(getClass()
+ .getResourceAsStream(fileName), fileName);
+ assertNotNull(image);
+
+ assertTrue(image.hasNinePatchExtension());
+ assertTrue(image.ensure9Patch());
+
+ // contents area
+ List<Tick> horizontalContentsArea = image.getHorizontalContents();
+ List<Tick> verticalContentsArea = image.getVerticalContents();
+ assertEquals(3, horizontalContentsArea.size());
+ assertEquals(3, verticalContentsArea.size());
+
+ // content area rectangle
+ Rectangle contentsArea = image.getContentArea();
+ assertEquals(new Rectangle(19, 13, 35, 25), contentsArea);
+ }
+
+ public void testContentAreaOneDot() throws Exception {
+ String fileName = DIR + "content-area-one-dot.9.png";
+ NinePatchedImage image = new NinePatchedImage(getClass()
+ .getResourceAsStream(fileName), fileName);
+ assertNotNull(image);
+
+ assertTrue(image.hasNinePatchExtension());
+ assertTrue(image.ensure9Patch());
+
+ // contents area
+ List<Tick> horizontalContentsArea = image.getHorizontalContents();
+ List<Tick> verticalContentsArea = image.getVerticalContents();
+ assertEquals(3, horizontalContentsArea.size());
+ assertEquals(3, verticalContentsArea.size());
+
+ // content area rectangle
+ Rectangle contentsArea = image.getContentArea();
+ assertEquals(new Rectangle(19, 13, 1, 1), contentsArea);
+ }
+
+ public void testContentAreaTwoDots() throws Exception {
+ String fileName = DIR + "content-area-two-dots.9.png";
+ NinePatchedImage image = new NinePatchedImage(getClass()
+ .getResourceAsStream(fileName), fileName);
+ assertNotNull(image);
+
+ assertTrue(image.hasNinePatchExtension());
+ assertTrue(image.ensure9Patch());
+
+ // contents area
+ List<Tick> horizontalContentsArea = image.getHorizontalContents();
+ List<Tick> verticalContentsArea = image.getVerticalContents();
+ assertEquals(5, horizontalContentsArea.size());
+ assertEquals(5, verticalContentsArea.size());
+
+ // content area rectangle
+ Rectangle contentsArea = image.getContentArea();
+ assertEquals(new Rectangle(19, 13, 35, 25), contentsArea);
+
+ String fileName2 = DIR + "content-area.9.png";
+ NinePatchedImage image2 = new NinePatchedImage(getClass()
+ .getResourceAsStream(fileName2), fileName2);
+ assertNotNull(image2);
+
+ assertTrue(image2.hasNinePatchExtension());
+ assertTrue(image2.ensure9Patch());
+
+ // content area rectangle
+ Rectangle contentsArea2 = image2.getContentArea();
+ assertEquals(contentsArea2, contentsArea);
+ }
+
+ public void testBadPatches() throws Exception {
+ String fileName = DIR + "patched-with-badpatches.9.png";
+ NinePatchedImage image = new NinePatchedImage(getClass()
+ .getResourceAsStream(fileName), fileName);
+ assertNotNull(image);
+
+ assertTrue(image.hasNinePatchExtension());
+ assertTrue(image.ensure9Patch());
+
+ Chunk[][] chunks = null;
+ chunks = image.getChunks(chunks);
+
+ // vertical chunk size
+ assertEquals(5, chunks.length);
+
+ // horizontal chunk size
+ for (int i = 0; i < chunks.length; i++) {
+ assertEquals(7, chunks[i].length);
+ }
+
+ chunks = image.getCorruptedChunks(chunks);
+
+ Chunk c = null;
+
+ // collect bad patches
+ List<Point> badPatches = new ArrayList<Point>(5 * 7);
+ for (int y = 0; y < chunks.length; y++) {
+ for (int x = 0; x < chunks[0].length; x++) {
+ c = chunks[y][x];
+ if ((c.type & Chunk.TYPE_CORRUPT) != 0x0) {
+ badPatches.add(new Point(y, x));
+ }
+ }
+ }
+
+ assertEquals(15, badPatches.size());
+
+ assertTrue(badPatches.contains(new Point(0, 3)));
+
+ assertTrue(badPatches.contains(new Point(1, 1)));
+ assertTrue(badPatches.contains(new Point(1, 2)));
+ assertTrue(badPatches.contains(new Point(1, 3)));
+ assertTrue(badPatches.contains(new Point(1, 4)));
+ assertTrue(badPatches.contains(new Point(1, 5)));
+
+ assertTrue(badPatches.contains(new Point(2, 1)));
+ assertTrue(badPatches.contains(new Point(2, 5)));
+
+ assertTrue(badPatches.contains(new Point(3, 0)));
+ assertTrue(badPatches.contains(new Point(3, 1)));
+ assertTrue(badPatches.contains(new Point(3, 5)));
+ assertTrue(badPatches.contains(new Point(3, 6)));
+
+ assertTrue(badPatches.contains(new Point(4, 1)));
+ assertTrue(badPatches.contains(new Point(4, 3)));
+ assertTrue(badPatches.contains(new Point(4, 5)));
+ }
+
+ public void testProjection() throws Exception {
+ // top
+ String fileName = DIR + "patched3.9.png";
+ NinePatchedImage image = new NinePatchedImage(getClass()
+ .getResourceAsStream(fileName), fileName);
+ assertNotNull(image);
+
+ assertTrue(image.hasNinePatchExtension());
+ assertTrue(image.ensure9Patch());
+
+ ImageData data = image.getImageData();
+ assertEquals(72 + 2, data.width);
+ assertEquals(50 + 2, data.height);
+
+ int width = 72 * 2;
+ int height = 50 * 2;
+
+ Chunk[][] chunks = null;
+ chunks = image.getChunks(chunks);
+
+ Projection[][] projections = null;
+ projections = image.getProjections(width, height, projections);
+
+ assertEquals(chunks.length, projections.length);
+ for (int i = 0; i < chunks.length; i++) {
+ assertEquals(chunks[i].length, projections[i].length);
+ }
+
+ for (int y = 0; y < projections.length; y++) {
+ for (int x = 0; x < projections[y].length; x++) {
+ assertEquals(projections[y][x].src, chunks[y][x].rect);
+
+ // If chunk type is FIXED. Same projection size as original
+ // chunk.
+ if (projections[y][x].chunk.type == Chunk.TYPE_FIXED) {
+ assertEquals(projections[y][x].dest.width, chunks[y][x].rect.width);
+ assertEquals(projections[y][x].dest.height, chunks[y][x].rect.height);
+ }
+ }
+ }
+
+ Projection p = null;
+ Rectangle rect = null;
+
+ // Check start position
+ p = projections[0][0];
+
+ // src position start from 1, 9-patch row and column included.
+ assertEquals(1, p.src.x);
+ assertEquals(1, p.src.y);
+
+ // dest position start from 0, 9-patch row and column ignored.
+ assertEquals(0, p.dest.x);
+ assertEquals(0, p.dest.y);
+
+ // row 1
+ p = projections[0][0];
+ rect = p.dest;
+ assertEquals(0, rect.x);
+ assertEquals(0, rect.y);
+ assertEquals(74, rect.width);
+ assertEquals(5, rect.height);
+
+ p = projections[0][1];
+ rect = p.dest;
+ assertEquals(74, rect.x);
+ assertEquals(0, rect.y);
+ assertEquals(62, rect.width);
+ assertEquals(5, rect.height);
+
+ p = projections[0][2];
+ rect = p.dest;
+ assertEquals(136, rect.x);
+ assertEquals(0, rect.y);
+ assertEquals(8, rect.width);
+ assertEquals(5, rect.height);
+
+ // row 2
+ p = projections[1][0];
+ rect = p.dest;
+ assertEquals(0, rect.x);
+ assertEquals(5, rect.y);
+ assertEquals(74, rect.width);
+ assertEquals(24, rect.height);
+
+ p = projections[1][1];
+ rect = p.dest;
+ assertEquals(74, rect.x);
+ assertEquals(5, rect.y);
+ assertEquals(62, rect.width);
+ assertEquals(24, rect.height);
+
+ p = projections[1][2];
+ rect = p.dest;
+ assertEquals(136, rect.x);
+ assertEquals(5, rect.y);
+ assertEquals(8, rect.width);
+ assertEquals(24, rect.height);
+
+ // row 3
+ p = projections[2][0];
+ rect = p.dest;
+ assertEquals(0, rect.x);
+ assertEquals(29, rect.y);
+ assertEquals(74, rect.width);
+ assertEquals(58, rect.height);
+
+ p = projections[2][1];
+ rect = p.dest;
+ assertEquals(74, rect.x);
+ assertEquals(29, rect.y);
+ assertEquals(62, rect.width);
+ assertEquals(58, rect.height);
+
+ p = projections[2][2];
+ rect = p.dest;
+ assertEquals(136, rect.x);
+ assertEquals(29, rect.y);
+ assertEquals(8, rect.width);
+ assertEquals(58, rect.height);
+
+ // row 4
+ p = projections[3][0];
+ rect = p.dest;
+ assertEquals(0, rect.x);
+ assertEquals(87, rect.y);
+ assertEquals(74, rect.width);
+ assertEquals(13, rect.height);
+
+ p = projections[3][1];
+ rect = p.dest;
+ assertEquals(74, rect.x);
+ assertEquals(87, rect.y);
+ assertEquals(62, rect.width);
+ assertEquals(13, rect.height);
+
+ p = projections[3][2];
+ rect = p.dest;
+ assertEquals(136, rect.x);
+ assertEquals(87, rect.y);
+ assertEquals(8, rect.width);
+ assertEquals(13, rect.height);
+ }
+
+ public void testReadLayoutBoundsOnlyImage() throws Exception {
+ String fileName = DIR + "layout-bounds-only.9.png";
+ NinePatchedImage image = new NinePatchedImage(getClass()
+ .getResourceAsStream(fileName), fileName);
+ assertNotNull(image);
+
+ ImageData data = image.getImageData();
+ int width = data.width;
+ int height = data.height;
+
+ assertEquals(74, width);
+ assertEquals(52, height);
+
+ assertTrue(image.hasNinePatchExtension());
+ assertTrue(image.ensure9Patch());
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/configuration/LocaleManagerTest.java b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/configuration/FlagManagerTest.java
index 4ab6a87..c22609f 100644
--- a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/configuration/LocaleManagerTest.java
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/adt/internal/editors/layout/configuration/FlagManagerTest.java
@@ -16,7 +16,7 @@
package com.android.ide.eclipse.adt.internal.editors.layout.configuration;
-import com.google.common.collect.Sets;
+import com.android.ide.common.resources.LocaleManager;
import org.eclipse.swt.graphics.Image;
@@ -30,70 +30,9 @@ import java.util.Set;
import junit.framework.TestCase;
@SuppressWarnings("javadoc")
-public class LocaleManagerTest extends TestCase {
- public void testIntegrity() {
- LocaleManager localeManager = LocaleManager.get();
- assertSame(localeManager, LocaleManager.get());
-
- Map<String, String> languageToCountry = LocaleManager.getLanguageToCountryMap();
- Map<String, String> languageNames = LocaleManager.getLanguageNamesMap();
- Map<String, String> regionNames = LocaleManager.getRegionNamesMap();
- assertEquals("Make sure to update initial capacity in declaration after editing map",
- 177, languageToCountry.size());
- assertEquals("Make sure to update initial capacity in declaration after editing map",
- 187, languageNames.size());
- assertEquals("Make sure to update initial capacity in declaration after editing map",
- 249, regionNames.size());
-
- assertTrue(Sets.difference(languageToCountry.keySet(),
- languageNames.keySet()).isEmpty());
- for (Map.Entry<String, String> entry : languageToCountry.entrySet()) {
- assertTrue(entry.getValue(), entry.getKey().length() > 0);
- assertTrue(entry.getKey(), entry.getValue().length() > 0);
- }
- for (Map.Entry<String, String> entry : regionNames.entrySet()) {
- assertTrue(entry.getValue(), entry.getKey().length() > 0);
- assertTrue(entry.getKey(), entry.getValue().length() > 0);
- }
- for (Map.Entry<String, String> entry : languageNames.entrySet()) {
- assertTrue(entry.getValue(), entry.getKey().length() > 0);
- assertTrue(entry.getKey(), entry.getValue().length() > 0);
- }
- for (String s : languageToCountry.keySet()) {
- assertTrue(s, s.length() == 2 && s.equals(s.toLowerCase(Locale.US)));
- }
- for (String s : languageNames.keySet()) {
- assertTrue(s, s.length() == 2 && s.equals(s.toLowerCase(Locale.US)));
- }
- for (String s : languageNames.values()) {
- assertTrue(s, s.length() > 2 && Character.isUpperCase(s.charAt(0)));
- }
- for (String s : languageToCountry.values()) {
- assertTrue(s, s.length() == 2 && s.equals(s.toUpperCase(Locale.US)));
- }
- for (String s : regionNames.keySet()) {
- assertTrue(s, s.length() == 2 && s.equals(s.toUpperCase(Locale.US)));
- }
- for (String s : regionNames.values()) {
- assertTrue(s, s.length() > 2 && Character.isUpperCase(s.charAt(0)));
- }
- assertNull(languageToCountry.get(""));
- assertNull(languageNames.get(""));
- assertTrue(Sets.difference(languageToCountry.keySet(),
- languageNames.keySet()).isEmpty());
- }
-
- public void testGetLanguageNames() throws Exception {
- assertEquals("English", LocaleManager.getLanguageName("en"));
- assertEquals("Norwegian BokmŒl", LocaleManager.getLanguageName("nb"));
- assertEquals("Norwegian", LocaleManager.getLanguageName("no"));
- assertEquals("French", LocaleManager.getLanguageName("fr"));
- assertEquals("German", LocaleManager.getLanguageName("de"));
- assertEquals("Hindi", LocaleManager.getLanguageName("hi"));
- }
-
+public class FlagManagerTest extends TestCase {
public void testGetFlagImage() {
- LocaleManager manager = LocaleManager.get();
+ FlagManager manager = FlagManager.get();
Image us = manager.getFlag("US");
Image gb = manager.getFlag("GB");
Image ca = manager.getFlag("CA");
@@ -127,23 +66,12 @@ public class LocaleManagerTest extends TestCase {
assertSame(manager.getFlag("yi", null), manager.getFlag("ji", null));
assertSame(manager.getFlag("in", null), manager.getFlag("id", null));
assertSame(manager.getFlag("iw", null), manager.getFlag("he", null));
- assertSame(LocaleManager.getLanguageName("iw"), LocaleManager.getLanguageName("he"));
- assertSame(LocaleManager.getLanguageName("in"), LocaleManager.getLanguageName("id"));
- assertSame(LocaleManager.getLanguageName("yi"), LocaleManager.getLanguageName("ji"));
-
assertSame(us, manager.getFlagForFolderName("values-en-rUS"));
assertSame(gb, manager.getFlagForFolderName("values-en-rGB"));
Locale.setDefault(Locale.CANADA);
assertSame(ca, manager.getFlagForFolderName("values-en"));
}
- public void testGetRegionNames() {
- assertEquals("United States", LocaleManager.getRegionName("US"));
- assertEquals("Norway", LocaleManager.getRegionName("NO"));
- assertEquals("France", LocaleManager.getRegionName("FR"));
- assertEquals("India", LocaleManager.getRegionName("IN"));
- }
-
public void testAvailableIcons() {
// Icons we have in WindowBuilder
String[] icons = new String[] {
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/content-area-one-dot.9.png b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/content-area-one-dot.9.png
new file mode 100644
index 0000000..690d76e
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/content-area-one-dot.9.png
Binary files differ
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/content-area-two-dots.9.png b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/content-area-two-dots.9.png
new file mode 100644
index 0000000..c3d3e4c
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/content-area-two-dots.9.png
Binary files differ
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/content-area.9.png b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/content-area.9.png
new file mode 100644
index 0000000..6a7a62c
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/content-area.9.png
Binary files differ
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/invalid-patched1.9.png b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/invalid-patched1.9.png
new file mode 100644
index 0000000..9e5ffbf
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/invalid-patched1.9.png
Binary files differ
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/invalid-patched2.9.png b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/invalid-patched2.9.png
new file mode 100644
index 0000000..cfd9c1d
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/invalid-patched2.9.png
Binary files differ
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/invalid-patched3.9.png b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/invalid-patched3.9.png
new file mode 100644
index 0000000..0f2c3eb
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/invalid-patched3.9.png
Binary files differ
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/invalid-patched4.9.png b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/invalid-patched4.9.png
new file mode 100644
index 0000000..ce73210
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/invalid-patched4.9.png
Binary files differ
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/invalid-patched5.9.png b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/invalid-patched5.9.png
new file mode 100644
index 0000000..97d9cd8
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/invalid-patched5.9.png
Binary files differ
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/invalid-patched6.9.png b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/invalid-patched6.9.png
new file mode 100644
index 0000000..f9b8a48
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/invalid-patched6.9.png
Binary files differ
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/invalid-patched7.9.png b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/invalid-patched7.9.png
new file mode 100644
index 0000000..bbbb3ad
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/invalid-patched7.9.png
Binary files differ
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/invalid-patched8.9.png b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/invalid-patched8.9.png
new file mode 100644
index 0000000..35f04b5
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/invalid-patched8.9.png
Binary files differ
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/layout-bounds-only.9.png b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/layout-bounds-only.9.png
new file mode 100644
index 0000000..6f70473
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/layout-bounds-only.9.png
Binary files differ
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/no-patched-interlace.png b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/no-patched-interlace.png
new file mode 100644
index 0000000..a6d0e94
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/no-patched-interlace.png
Binary files differ
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/no-patched.png b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/no-patched.png
new file mode 100644
index 0000000..742b1e8
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/no-patched.png
Binary files differ
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/patched-with-badpatches.9.png b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/patched-with-badpatches.9.png
new file mode 100644
index 0000000..1a38972
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/patched-with-badpatches.9.png
Binary files differ
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/patched1.9.png b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/patched1.9.png
new file mode 100644
index 0000000..6a7a62c
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/patched1.9.png
Binary files differ
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/patched2.9.png b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/patched2.9.png
new file mode 100644
index 0000000..11a1a6d
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/patched2.9.png
Binary files differ
diff --git a/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/patched3.9.png b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/patched3.9.png
new file mode 100644
index 0000000..8d288c9
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.tests/unittests/com/android/ide/eclipse/testdata/draw9patch/patched3.9.png
Binary files differ
diff --git a/eclipse/plugins/com.android.ide.eclipse.traceview/.settings/org.eclipse.jdt.core.prefs b/eclipse/plugins/com.android.ide.eclipse.traceview/.settings/org.eclipse.jdt.core.prefs
index 9dbff07..ea66196 100644
--- a/eclipse/plugins/com.android.ide.eclipse.traceview/.settings/org.eclipse.jdt.core.prefs
+++ b/eclipse/plugins/com.android.ide.eclipse.traceview/.settings/org.eclipse.jdt.core.prefs
@@ -48,10 +48,10 @@ org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignor
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
-org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecInsufficientInfo=warning
-org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=ignore
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
diff --git a/eclipse/scripts/build_server.sh b/eclipse/scripts/build_server.sh
index 4efd609..e96abe1 100755
--- a/eclipse/scripts/build_server.sh
+++ b/eclipse/scripts/build_server.sh
@@ -24,6 +24,7 @@ DEST_DIR=""
BUILD_NUMBER=""
CREATE_ZIP="1"
INTERNAL_BUILD=""
+ADT_PREVIEW="preview" # "preview" for preview builds, "" for final release builds.
function get_params() {
# parse input parameters
@@ -60,10 +61,10 @@ function check_params() {
[ -n "$DEST_DIR" ] || die "Usage: $0 <destination-directory> [build-number]"
[ -d "$DEST_DIR" ] || die "Destination directory $DEST_DIR must exist."
- # Qualifier is "v" followed by date/time in YYYYMMDDHHSS format and the optional
- # build number.
+ # Qualifier is "v" followed by date/time in YYYYMMDDHHSS format, an optional "preview"
+ # tag and the optional build number.
DATE=`date +v%Y%m%d%H%M`
- QUALIFIER="$DATE"
+ QUALIFIER="${DATE}-$ADT_PREVIEW"
[ -n "$BUILD_NUMBER" ] && QUALIFIER="${QUALIFIER}-${BUILD_NUMBER}"
return 0
@@ -76,14 +77,15 @@ function build_plugin() {
# runs if any.
BUILD_PREFIX="android-eclipse"
if [ "$INTERNAL_BUILD" ]; then
- # append 'eng' signifier to end of archive name to denote internal build
+ # append 'eng' qualifier to end of archive name to denote internal build
BUILD_PREFIX="${BUILD_PREFIX}-eng"
fi
# exclude date from build-zip name so it can be auto-calculated by continuous
# test process unless there's no build number, in which case the date is
# still used (useful for testing)
- ZIP_NAME="${BUILD_PREFIX}-${BUILD_NUMBER:-$DATE}.zip"
+ local preview="${ADT_PREVIEW:+-}${ADT_PREVIEW}"
+ ZIP_NAME="${BUILD_PREFIX}${preview}-${BUILD_NUMBER:-$DATE}.zip"
[ -d "$DEST_DIR/$BUILD_PREFIX" ] || rm -rfv "$DEST_DIR/$BUILD_PREFIX"
# Perform the Eclipse build and move the result in $DEST_DIR/android-build
@@ -111,6 +113,7 @@ function build_plugin() {
}
function build_adt_ide() {
+ local preview="${ADT_PREVIEW}${ADT_PREVIEW:+-}"
if [[ -z $INTERNAL_BUILD ]]; then
# This needs to run from the top android directory
D="$PROG_DIR"
@@ -118,7 +121,7 @@ function build_adt_ide() {
for sc in */*/*/build_ide*.sh; do
if [[ -x $sc ]]; then
echo "RUNNING $sc from $PWD"
- $sc "$DEST_DIR" "$QUALIFIER" "${BUILD_NUMBER:-$QUALIFIER}"
+ $sc "$DEST_DIR" "$QUALIFIER" "${preview}${BUILD_NUMBER:-$QUALIFIER}"
else
echo "WARNING: skipping non-exec $sc script"
fi
diff --git a/eclipse/scripts/create_all_symlinks.sh b/eclipse/scripts/create_all_symlinks.sh
index 925bc70..a464f51 100755
--- a/eclipse/scripts/create_all_symlinks.sh
+++ b/eclipse/scripts/create_all_symlinks.sh
@@ -39,6 +39,20 @@ function warn() {
fi
}
+function printGradleJarPath() {
+ # Prints to stdout the absolute path of the JAR assembled for a given gradle project.
+ # $1 = source dir, e.g. tools/base or tools/swt
+ # $2 = the gradle project name e.g. common or lint-api
+ echo "## Quering Gradle properties for '$2' in '$1'." > /dev/stderr
+ ( cd $1 && \
+ ./gradlew :$2:properties | awk '
+ BEGIN { B=""; N=""; V="" }
+ /^archivesBaseName:/ { N=$2 }
+ /^buildDir:/ { D=$2 }
+ /^version:/ { V=$2 }
+ END { print D "/libs/" N "-" V ".jar" }' )
+}
+
## parse arguments
while [ $# -gt 0 ]; do
case "$1" in
@@ -76,12 +90,8 @@ else
fi
if [[ "$USE_COPY" == "1" ]]; then
- function cpfile { # $1=source $2=dest
- cp -fv $1 $2/
- }
-
- function cpdir() { # $1=source $2=dest
- rsync -avW --delete-after $1 $2
+ function cpfile { # $1=source $2=dest $3=optional dest filename
+ cp -fv $1 $2/$3
}
else
# computes the "reverse" path, e.g. "a/b/c" => "../../.."
@@ -89,12 +99,15 @@ else
echo $1 | sed 's@[^/]*@..@g'
}
- function cpfile { # $1=source $2=dest
- ln -svf `back $2`/$1 $2/
- }
-
- function cpdir() { # $1=source $2=dest
- ln -svf `back $2`/$1 $2
+ function cpfile { # $1=source $2=dest $3=optional dest filename
+ local src=$1
+ if [[ "${src:0:1}" != "/" ]]; then
+ # Not an absolute path. We assume a relative path to be
+ # relative to the android root and we want to make it
+ # relative to the destination dir.
+ src=$(back $2)/$1
+ fi
+ ln -svf $src $2/$3
}
fi
@@ -105,10 +118,19 @@ LIBS=""
CP_FILES=""
+### Configure which libs to build.
+#
+# Each entry for LIBS needs to be prefixed with the way we want to build it:
+# make: - a library built using its traditional Android.mk
+# base: - a gradle library located in tools/base
+# swt: - a gradle library located in toosl/swt
+#
+# LIBS entries without or with an unknown ":" prefix will generate an error.
+
### BASE ###
BASE_PLUGIN_DEST="sdk/eclipse/plugins/com.android.ide.eclipse.base/libs"
-BASE_PLUGIN_LIBS="common sdkstats sdklib dvlib layoutlib-api sdk-common"
+BASE_PLUGIN_LIBS="base:common swt:sdkstats base:sdklib base:dvlib base:layoutlib-api base:sdk-common"
BASE_PLUGIN_PREBUILTS="\
prebuilts/tools/common/m2/repository/net/sf/kxml/kxml2/2.3.0/kxml2-2.3.0.jar \
prebuilts/tools/common/m2/repository/org/apache/commons/commons-compress/1.0/commons-compress-1.0.jar \
@@ -128,7 +150,8 @@ CP_FILES="$CP_FILES @:$BASE_PLUGIN_DEST $BASE_PLUGIN_LIBS $BASE_PLUGIN_PREBUILTS
### ADT ###
ADT_DEST="sdk/eclipse/plugins/com.android.ide.eclipse.adt/libs"
-ADT_LIBS="ant-glob asset-studio lint-api lint-checks ninepatch propertysheet rule-api sdkuilib swtmenubar manifest-merger"
+ADT_LIBS="make:ant-glob base:asset-studio base:lint-api base:lint-checks base:ninepatch make:propertysheet \
+ base:rule-api swt:sdkuilib swt:swtmenubar base:manifest-merger"
ADT_PREBUILTS="\
prebuilts/tools/common/freemarker/freemarker-2.3.19.jar \
prebuilts/tools/common/m2/repository/org/ow2/asm/asm/4.0/asm-4.0.jar \
@@ -143,7 +166,7 @@ CP_FILES="$CP_FILES @:$ADT_DEST $ADT_LIBS $ADT_PREBUILTS"
### DDMS ###
DDMS_DEST="sdk/eclipse/plugins/com.android.ide.eclipse.ddms/libs"
-DDMS_LIBS="ddmlib ddmuilib swtmenubar uiautomatorviewer"
+DDMS_LIBS="base:ddmlib swt:ddmuilib swt:swtmenubar swt:uiautomatorviewer"
DDMS_PREBUILTS="\
prebuilts/tools/common/m2/repository/jfree/jcommon/1.0.12/jcommon-1.0.12.jar \
@@ -157,7 +180,7 @@ CP_FILES="$CP_FILES @:$DDMS_DEST $DDMS_LIBS $DDMS_PREBUILTS"
### TEST ###
TEST_DEST="sdk/eclipse/plugins/com.android.ide.eclipse.tests"
-TEST_LIBS="easymock sdktestutils"
+TEST_LIBS="make:easymock base:testutils"
TEST_PREBUILTS="prebuilts/tools/common/m2/repository/net/sf/kxml/kxml2/2.3.0/kxml2-2.3.0.jar"
LIBS="$LIBS $TEST_LIBS"
@@ -168,7 +191,7 @@ CP_FILES="$CP_FILES @:$TEST_DEST $TEST_LIBS $TEST_PREBUILTS"
if [[ $PLATFORM != "windows-x86" ]]; then
# We can't build enough of the platform on Cygwin to create layoutlib
- BRIDGE_LIBS="layoutlib ninepatch"
+ BRIDGE_LIBS="make:layoutlib base:ninepatch"
LIBS="$LIBS $BRIDGE_LIBS"
fi
@@ -177,7 +200,7 @@ fi
### HIERARCHYVIEWER ###
HV_DEST="sdk/eclipse/plugins/com.android.ide.eclipse.hierarchyviewer/libs"
-HV_LIBS="hierarchyviewer2lib swtmenubar"
+HV_LIBS="swt:hierarchyviewer2lib swt:swtmenubar"
LIBS="$LIBS $HV_LIBS"
CP_FILES="$CP_FILES @:$HV_DEST $HV_LIBS"
@@ -186,7 +209,7 @@ CP_FILES="$CP_FILES @:$HV_DEST $HV_LIBS"
### TRACEVIEW ###
TV_DEST="sdk/eclipse/plugins/com.android.ide.eclipse.traceview/libs"
-TV_LIBS="traceview"
+TV_LIBS="swt:traceview"
LIBS="$LIBS $TV_LIBS"
CP_FILES="$CP_FILES @:$TV_DEST $TV_LIBS"
@@ -195,7 +218,7 @@ CP_FILES="$CP_FILES @:$TV_DEST $TV_LIBS"
### MONITOR ###
MONITOR_DEST="sdk/eclipse/plugins/com.android.ide.eclipse.monitor/libs"
-MONITOR_LIBS="sdkuilib"
+MONITOR_LIBS="swt:sdkuilib"
LIBS="$LIBS $MONITOR_LIBS"
CP_FILES="$CP_FILES @:$MONITOR_DEST $MONITOR_LIBS"
@@ -203,7 +226,7 @@ CP_FILES="$CP_FILES @:$MONITOR_DEST $MONITOR_LIBS"
### SDKMANAGER ###
-SDKMAN_LIBS="swtmenubar"
+SDKMAN_LIBS="swt:swtmenubar"
LIBS="$LIBS $SDKMAN_LIBS"
@@ -214,18 +237,72 @@ if [[ $PLATFORM != "windows-x86" ]]; then
# liblzf doesn't build under cygwin. If necessary, this should be fixed first.
GLD_DEST="sdk/eclipse/plugins/com.android.ide.eclipse.gldebugger/libs"
- GLD_LIBS="host-libprotobuf-java-2.3.0-lite liblzf"
+ GLD_LIBS="make:host-libprotobuf-java-2.3.0-lite make:liblzf"
LIBS="$LIBS $GLD_LIBS"
CP_FILES="$CP_FILES @:$GLD_DEST $GLD_LIBS"
fi
+
+#--- Determine what to build
+
+UNPROCESSED=""
+GRADLE_SWT=""
+GRADLE_BASE=""
+MAKE_TARGETS=""
+for LIB in $LIBS; do
+ if [[ "${LIB:0:5}" == "base:" ]]; then
+ GRADLE_BASE="$GRADLE_BASE :${LIB:5}:assemble"
+ elif [[ "${LIB:0:4}" == "swt:" ]]; then
+ GRADLE_SWT="$GRADLE_SWT :${LIB:4}:assemble"
+ elif [[ "${LIB:0:5}" == "make:" ]]; then
+ MAKE_TARGETS="$MAKE_TARGETS ${LIB:5}"
+ else
+ UNPROCESSED="$UNPROCESSED $LIB"
+ fi
+done
+
+unset LIBS # we shouldn't use this anymore, it has been split up just above.
+
+
+if [[ -n $UNPROCESSED ]]; then
+ die "## The following libs lack a prefix (make:, base: or swt:): $UNPROCESSED"
+fi
+
+# In the mode to only echo dependencies, output them and we're done
+if [[ -n $ONLY_SHOW_DEPS ]]; then
+ echo $MAKE_TARGETS
+ exit 0
+fi
+
+# --- Gradle Build ---
+
+# tools/base: if we need it for SWT, we build them all and public local.
+# Otherwise we do a specific tools/base build on just the requested targets.
+
+if [[ -n "$GRADLE_SWT" ]]; then
+ echo "### Starting tools/base: gradlew publishLocal"
+ (cd tools/base && ./gradlew publishLocal)
+elif [[ -n "$GRADLE_BASE" ]]; then
+ echo "### Starting tools/base: gradlew $GRADLE_BASE"
+ (cd tools/base && ./gradlew $GRADLE_BASE)
+fi
+
+# tools/swt: build requested targets
+
+if [[ -n "$GRADLE_SWT" ]]; then
+ echo "### Starting tools/swt: gradlew $GRADLE_SWT"
+ (cd tools/swt && ./gradlew $GRADLE_SWT)
+fi
+
+# --- Android.mk Build ---
+
# If some of the libs are available in prebuilts/devtools, use link to them directly
# instead of trying to rebuild them so remove them from the libs to build. Note that
# they are already listed in CP_FILES so we'll adjust the source to copy later.
-LIBS2=""
-for LIB in $LIBS; do
+NEW_TARGETS=""
+for LIB in $MAKE_TARGETS; do
J="prebuilts/devtools/tools/lib/$LIB.jar"
if [[ ! -f $J ]]; then
J="prebuilts/devtools/adt/lib/$LIB.jar"
@@ -233,38 +310,33 @@ for LIB in $LIBS; do
if [[ -f $J ]]; then
warn "## Using existing $J"
else
- LIBS2="$LIBS2 $LIB"
+ NEW_TARGETS="$NEW_TARGETS $LIB"
fi
done
-LIBS="$LIBS2"
-unset LIBS2
+MAKE_TARGETS="$NEW_TARGETS"
+unset NEW_TARGETS
-# In the mode to only echo dependencies, output them and we're done
-if [[ -n $ONLY_SHOW_DEPS ]]; then
- echo $LIBS
- exit 0
-fi
-if [[ -z $ONLY_COPY_DEPS ]]; then
- # Make sure we have lunch sdk-<something>
- if [[ ! "$TARGET_PRODUCT" ]]; then
- warn "## TARGET_PRODUCT is not set, running build/envsetup.sh"
- . build/envsetup.sh
- warn "## lunch sdk-eng"
- lunch sdk-eng
- fi
-
- # Run make on all libs
+if [[ -n $MAKE_TARGETS ]]; then
+ ( # Make sure we have lunch sdk-<something>
+ if [[ ! "$TARGET_PRODUCT" ]]; then
+ warn "## TARGET_PRODUCT is not set, running build/envsetup.sh"
+ . build/envsetup.sh
+ warn "## lunch sdk-eng"
+ lunch sdk-eng
+ fi
- J="4"
- [[ $(uname) == "Darwin" ]] && J=$(sysctl hw.ncpu | cut -d : -f 2 | tr -d ' ')
- [[ $(uname) == "Linux" ]] && J=$(cat /proc/cpuinfo | grep processor | wc -l)
+ J="4"
+ [[ $(uname) == "Darwin" ]] && J=$(sysctl hw.ncpu | cut -d : -f 2 | tr -d ' ')
+ [[ $(uname) == "Linux" ]] && J=$(cat /proc/cpuinfo | grep processor | wc -l)
- warn "## Building libs: make -j$J $LIBS"
- make -j${J} $LIBS
+ warn "## Building libs: make -j$J $MAKE_TARGETS"
+ make -j${J} $MAKE_TARGETS
+ )
fi
-# Copy resulting files
+# --- Copy resulting files ---
+
DEST=""
for SRC in $CP_FILES; do
if [[ "${SRC:0:2}" == "@:" ]]; then
@@ -272,8 +344,26 @@ for SRC in $CP_FILES; do
mkdir -vp "$DEST"
continue
fi
- if [[ ! -f "$SRC" ]]; then
+
+ ORIG_SRC="$SRC"
+ DEST_FILE=""
+
+ if [[ "${SRC:0:5}" == "base:" ]]; then
+ SRC="${SRC:5}"
+ ORIG_SRC="$SRC"
+ DEST_FILE="$SRC.jar"
+ SRC=$(printGradleJarPath tools/base $SRC)
+ elif [[ "${SRC:0:4}" == "swt:" ]]; then
+ SRC="${SRC:4}"
+ ORIG_SRC="$SRC"
+ DEST_FILE="$SRC.jar"
+ SRC=$(printGradleJarPath tools/swt $SRC)
+ elif [[ "${SRC:0:5}" == "make:" ]]; then
+ SRC="${SRC:5}"
ORIG_SRC="$SRC"
+ fi
+
+ if [[ ! -f "$SRC" ]]; then
# Take a prebuilts/devtools instead of a framework one if possible.
SRC="prebuilts/devtools/tools/lib/$SRC.jar"
if [[ ! -f "$SRC" ]]; then
@@ -288,7 +378,7 @@ for SRC in $CP_FILES; do
die "Invalid cp_file dest directory: $DEST"
fi
- cpfile "$SRC" "$DEST"
+ cpfile "$SRC" "$DEST" "$DEST_FILE"
else
die "## Unknown source '$ORIG_SRC' to copy in '$DEST'"
fi
diff --git a/eclipse/scripts/setup_eclipse.sh b/eclipse/scripts/setup_eclipse.sh
index 4154bf8..5942c06 100755
--- a/eclipse/scripts/setup_eclipse.sh
+++ b/eclipse/scripts/setup_eclipse.sh
@@ -45,7 +45,7 @@ BASE_DIR="$1"
[[ -n "$1" ]] || die "Usage: $0 <dest-dir>"
# URL for Eclipse Linux RCP.
-DOWNLOAD_URL="http://download.eclipse.org/technology/epp/downloads/release/helios/SR2/eclipse-rcp-helios-SR2-linux-gtk-x86_64.tar.gz"
+DOWNLOAD_URL="http://archive.eclipse.org/technology/epp/downloads/release/helios/SR2/eclipse-rcp-helios-SR2-linux-gtk-x86_64.tar.gz"
# URL for CDT
CDT_DOWNLOAD_URL="http://download.eclipse.org/tools/cdt/releases/helios/dist/cdt-master-7.0.2.zip"
diff --git a/emulator/opengl/host/libs/Translator/EGL/EglX11Api.cpp b/emulator/opengl/host/libs/Translator/EGL/EglX11Api.cpp
index c362210..129f244 100644
--- a/emulator/opengl/host/libs/Translator/EGL/EglX11Api.cpp
+++ b/emulator/opengl/host/libs/Translator/EGL/EglX11Api.cpp
@@ -66,7 +66,6 @@ ErrorHandler::~ErrorHandler(){
}
int ErrorHandler::errorHandlerProc(EGLNativeDisplayType dpy,XErrorEvent* event){
- android::Mutex::Autolock mutex(s_lock);
s_lastErrorCode = event->error_code;
return 0;
}
diff --git a/emulator/opengl/host/libs/Translator/EGL/ThreadInfo.cpp b/emulator/opengl/host/libs/Translator/EGL/ThreadInfo.cpp
index d1d018f..4f5d75f 100644
--- a/emulator/opengl/host/libs/Translator/EGL/ThreadInfo.cpp
+++ b/emulator/opengl/host/libs/Translator/EGL/ThreadInfo.cpp
@@ -14,8 +14,15 @@
* limitations under the License.
*/
+#include <stdio.h>
#include "ThreadInfo.h"
+//#define TRACE_THREADINFO
+#ifdef TRACE_THREADINFO
+#define LOG_THREADINFO(x...) fprintf(stderr, x)
+#else
+#define LOG_THREADINFO(x...)
+#endif
void ThreadInfo::updateInfo(ContextPtr eglCtx,
EglDisplay* dpy,
@@ -30,24 +37,13 @@ void ThreadInfo::updateInfo(ContextPtr eglCtx,
objManager = manager;
}
-#ifdef __linux__
-
-__thread ThreadInfo* thread = NULL;
-
-ThreadInfo* getThreadInfo(){
- if(!thread) {
- thread = new ThreadInfo();
- }
- return thread;
-}
-
-#else
-
#include <cutils/threads.h>
static thread_store_t s_tls = THREAD_STORE_INITIALIZER;
-
+static int active_instance = 0;
static void tlsDestruct(void *ptr)
{
+ active_instance--;
+ LOG_THREADINFO("tlsDestruct EGL %lx %d\n", (long)ptr, active_instance);
if (ptr) {
ThreadInfo *ti = (ThreadInfo *)ptr;
delete ti;
@@ -60,8 +56,8 @@ ThreadInfo *getThreadInfo()
if (!ti) {
ti = new ThreadInfo();
thread_store_set(&s_tls, ti, tlsDestruct);
+ active_instance++;
+ LOG_THREADINFO("getThreadInfo EGL %lx %d\n", (long)ti, active_instance);
}
return ti;
}
-
-#endif
diff --git a/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.cpp b/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.cpp
index c970337..5f04a97 100644
--- a/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.cpp
+++ b/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.cpp
@@ -170,7 +170,7 @@ void ColorBuffer::subUpdate(int x, int y, int width, int height, GLenum p_format
bool ColorBuffer::blitFromCurrentReadBuffer()
{
- RenderThreadInfo *tInfo = getRenderThreadInfo();
+ RenderThreadInfo *tInfo = RenderThreadInfo::get();
if (!tInfo->currContext.Ptr()) {
// no Current context
return false;
@@ -188,16 +188,16 @@ bool ColorBuffer::blitFromCurrentReadBuffer()
s_gl2.glGenTextures(1,&tmpTex);
s_gl2.glBindTexture(GL_TEXTURE_2D, tmpTex);
s_gl2.glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, m_blitEGLImage);
- s_gl2.glCopyTexImage2D(GL_TEXTURE_2D, 0, m_internalFormat,
- 0, 0, m_width, m_height, 0);
+ s_gl2.glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0,
+ m_width, m_height);
}
else {
s_gl.glGetIntegerv(GL_TEXTURE_BINDING_2D, &currTexBind);
s_gl.glGenTextures(1,&tmpTex);
s_gl.glBindTexture(GL_TEXTURE_2D, tmpTex);
s_gl.glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, m_blitEGLImage);
- s_gl.glCopyTexImage2D(GL_TEXTURE_2D, 0, m_internalFormat,
- 0, 0, m_width, m_height, 0);
+ s_gl.glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0,
+ m_width, m_height);
}
@@ -257,7 +257,7 @@ bool ColorBuffer::blitFromCurrentReadBuffer()
bool ColorBuffer::bindToTexture()
{
if (m_eglImage) {
- RenderThreadInfo *tInfo = getRenderThreadInfo();
+ RenderThreadInfo *tInfo = RenderThreadInfo::get();
if (tInfo->currContext.Ptr()) {
#ifdef WITH_GLES2
if (tInfo->currContext->isGL2()) {
@@ -278,7 +278,7 @@ bool ColorBuffer::bindToTexture()
bool ColorBuffer::bindToRenderbuffer()
{
if (m_eglImage) {
- RenderThreadInfo *tInfo = getRenderThreadInfo();
+ RenderThreadInfo *tInfo = RenderThreadInfo::get();
if (tInfo->currContext.Ptr()) {
#ifdef WITH_GLES2
if (tInfo->currContext->isGL2()) {
diff --git a/emulator/opengl/host/libs/libOpenglRender/FrameBuffer.cpp b/emulator/opengl/host/libs/libOpenglRender/FrameBuffer.cpp
index d41b9a5..2c9e8c5 100644
--- a/emulator/opengl/host/libs/libOpenglRender/FrameBuffer.cpp
+++ b/emulator/opengl/host/libs/libOpenglRender/FrameBuffer.cpp
@@ -419,7 +419,7 @@ bool FrameBuffer::setupSubWindow(FBNativeWindowType p_window,
fb->m_nativeWindow = p_window;
// create EGLSurface from the generated subwindow
- fb->m_eglSurface = s_egl.eglCreateWindowSurface(fb->m_eglDisplay,
+ fb->m_eglSurface = s_egl.eglCreateWindowSurface(fb->m_eglDisplay,
fb->m_eglConfig,
fb->m_subWin,
NULL);
@@ -692,28 +692,31 @@ bool FrameBuffer::bindContext(HandleType p_context,
draw ? draw->getEGLSurface() : EGL_NO_SURFACE,
read ? read->getEGLSurface() : EGL_NO_SURFACE,
ctx ? ctx->getEGLContext() : EGL_NO_CONTEXT)) {
- // MakeCurrent failed
+ ERR("eglMakeCurrent failed\n");
return false;
}
//
// Bind the surface(s) to the context
//
- RenderThreadInfo *tinfo = getRenderThreadInfo();
+ RenderThreadInfo *tinfo = RenderThreadInfo::get();
+ WindowSurfacePtr bindDraw, bindRead;
if (draw.Ptr() == NULL && read.Ptr() == NULL) {
- // if this is an unbind operation - make sure the current bound
- // surfaces get unbound from the context.
- draw = tinfo->currDrawSurf;
- read = tinfo->currReadSurf;
- }
-
- if (draw.Ptr() != NULL && read.Ptr() != NULL) {
- if (p_readSurface != p_drawSurface) {
- draw->bind( ctx, SURFACE_BIND_DRAW );
- read->bind( ctx, SURFACE_BIND_READ );
+ // Unbind the current read and draw surfaces from the context
+ bindDraw = tinfo->currDrawSurf;
+ bindRead = tinfo->currReadSurf;
+ } else {
+ bindDraw = draw;
+ bindRead = read;
+ }
+
+ if (bindDraw.Ptr() != NULL && bindRead.Ptr() != NULL) {
+ if (bindDraw.Ptr() != bindRead.Ptr()) {
+ bindDraw->bind(ctx, SURFACE_BIND_DRAW);
+ bindRead->bind(ctx, SURFACE_BIND_READ);
}
else {
- draw->bind( ctx, SURFACE_BIND_READDRAW );
+ bindDraw->bind(ctx, SURFACE_BIND_READDRAW);
}
}
@@ -846,7 +849,7 @@ bool FrameBuffer::post(HandleType p_colorbuffer, bool needLock)
s_egl.eglSwapBuffers(m_eglDisplay, m_eglSurface);
}
-
+
// restore previous binding
unbind_locked();
diff --git a/emulator/opengl/host/libs/libOpenglRender/RenderControl.cpp b/emulator/opengl/host/libs/libOpenglRender/RenderControl.cpp
index 6b8f8fd..960dec7 100644
--- a/emulator/opengl/host/libs/libOpenglRender/RenderControl.cpp
+++ b/emulator/opengl/host/libs/libOpenglRender/RenderControl.cpp
@@ -63,7 +63,7 @@ static EGLint rcQueryEGLString(EGLenum name, void* buffer, EGLint bufferSize)
static EGLint rcGetGLString(EGLenum name, void* buffer, EGLint bufferSize)
{
- RenderThreadInfo *tInfo = getRenderThreadInfo();
+ RenderThreadInfo *tInfo = RenderThreadInfo::get();
if (!tInfo || !tInfo->currContext.Ptr()) {
return 0;
}
diff --git a/emulator/opengl/host/libs/libOpenglRender/RenderServer.cpp b/emulator/opengl/host/libs/libOpenglRender/RenderServer.cpp
index c726e00..0acb307 100644
--- a/emulator/opengl/host/libs/libOpenglRender/RenderServer.cpp
+++ b/emulator/opengl/host/libs/libOpenglRender/RenderServer.cpp
@@ -106,12 +106,11 @@ int RenderServer::Main()
if (!rt) {
fprintf(stderr,"Failed to create RenderThread\n");
delete stream;
- }
-
- if (!rt->start()) {
+ stream = NULL;
+ } else if (!rt->start()) {
fprintf(stderr,"Failed to start RenderThread\n");
- delete stream;
delete rt;
+ rt = NULL;
}
//
@@ -133,10 +132,11 @@ int RenderServer::Main()
}
}
- // insert the added thread to the list
- threads.insert(rt);
-
- DBG("Started new RenderThread\n");
+ // if the thread has been created and started, insert it to the list
+ if (rt) {
+ threads.insert(rt);
+ DBG("Started new RenderThread\n");
+ }
}
//
diff --git a/emulator/opengl/host/libs/libOpenglRender/RenderThread.cpp b/emulator/opengl/host/libs/libOpenglRender/RenderThread.cpp
index 0119133..1b2c0fe 100644
--- a/emulator/opengl/host/libs/libOpenglRender/RenderThread.cpp
+++ b/emulator/opengl/host/libs/libOpenglRender/RenderThread.cpp
@@ -21,6 +21,7 @@
#include "GLDispatch.h"
#include "GL2Dispatch.h"
#include "EGLDispatch.h"
+#include "FrameBuffer.h"
#define STREAM_BUFFER_SIZE 4*1024*1024
@@ -31,6 +32,11 @@ RenderThread::RenderThread() :
{
}
+RenderThread::~RenderThread()
+{
+ delete m_stream;
+}
+
RenderThread *RenderThread::create(IOStream *p_stream)
{
RenderThread *rt = new RenderThread();
@@ -45,12 +51,13 @@ RenderThread *RenderThread::create(IOStream *p_stream)
int RenderThread::Main()
{
- RenderThreadInfo * tInfo = getRenderThreadInfo();
+ RenderThreadInfo tInfo;
+
//
// initialize decoders
//
- tInfo->m_glDec.initGL( gl_dispatch_get_proc_func, NULL );
- tInfo->m_gl2Dec.initGL( gl2_dispatch_get_proc_func, NULL );
+ tInfo.m_glDec.initGL( gl_dispatch_get_proc_func, NULL );
+ tInfo.m_gl2Dec.initGL( gl2_dispatch_get_proc_func, NULL );
initRenderControlContext( &m_rcDec );
ReadBuffer readBuf(m_stream, STREAM_BUFFER_SIZE);
@@ -109,7 +116,7 @@ int RenderThread::Main()
//
// try to process some of the command buffer using the GLESv1 decoder
//
- size_t last = tInfo->m_glDec.decode(readBuf.buf(), readBuf.validData(), m_stream);
+ size_t last = tInfo.m_glDec.decode(readBuf.buf(), readBuf.validData(), m_stream);
if (last > 0) {
progress = true;
readBuf.consume(last);
@@ -118,7 +125,7 @@ int RenderThread::Main()
//
// try to process some of the command buffer using the GLESv2 decoder
//
- last = tInfo->m_gl2Dec.decode(readBuf.buf(), readBuf.validData(), m_stream);
+ last = tInfo.m_gl2Dec.decode(readBuf.buf(), readBuf.validData(), m_stream);
if (last > 0) {
progress = true;
readBuf.consume(last);
@@ -143,15 +150,11 @@ int RenderThread::Main()
}
//
- // release the thread from any EGL context
- // if bound to context.
+ // Release references to the current thread's context/surfaces if any
//
- EGLDisplay eglDpy = s_egl.eglGetCurrentDisplay();
- if (eglDpy != EGL_NO_DISPLAY) {
- s_egl.eglMakeCurrent(eglDpy,
- EGL_NO_SURFACE,
- EGL_NO_SURFACE,
- EGL_NO_CONTEXT);
+ FrameBuffer::getFB()->bindContext(0, 0, 0);
+ if (tInfo.currContext || tInfo.currDrawSurf || tInfo.currReadSurf) {
+ fprintf(stderr, "ERROR: RenderThread exiting with current context/surfaces\n");
}
//
diff --git a/emulator/opengl/host/libs/libOpenglRender/RenderThread.h b/emulator/opengl/host/libs/libOpenglRender/RenderThread.h
index 67d423f..80a9aef 100644
--- a/emulator/opengl/host/libs/libOpenglRender/RenderThread.h
+++ b/emulator/opengl/host/libs/libOpenglRender/RenderThread.h
@@ -25,7 +25,7 @@ class RenderThread : public osUtils::Thread
{
public:
static RenderThread *create(IOStream *p_stream);
-
+ virtual ~RenderThread();
bool isFinished() const { return m_finished; }
private:
diff --git a/emulator/opengl/host/libs/libOpenglRender/ThreadInfo.cpp b/emulator/opengl/host/libs/libOpenglRender/ThreadInfo.cpp
index 2f2a962..566ca40 100644
--- a/emulator/opengl/host/libs/libOpenglRender/ThreadInfo.cpp
+++ b/emulator/opengl/host/libs/libOpenglRender/ThreadInfo.cpp
@@ -13,41 +13,19 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#include "ThreadInfo.h"
-
-#ifdef __linux__
-
-static __thread RenderThreadInfo *tinfo = NULL;
-
-RenderThreadInfo *getRenderThreadInfo()
-{
- if (!tinfo) {
- tinfo = new RenderThreadInfo();
- }
- return tinfo;
-}
-
-#else
+#include "ThreadInfo.h"
#include <cutils/threads.h>
+
static thread_store_t s_tls = THREAD_STORE_INITIALIZER;
-static void tlsDestruct(void *ptr)
-{
- if (ptr) {
- RenderThreadInfo *ti = (RenderThreadInfo *)ptr;
- delete ti;
- }
+RenderThreadInfo::RenderThreadInfo() {
+ thread_store_set(&s_tls, this, NULL);
}
-RenderThreadInfo *getRenderThreadInfo()
-{
- RenderThreadInfo *ti = (RenderThreadInfo *)thread_store_get(&s_tls);
- if (!ti) {
- ti = new RenderThreadInfo();
- thread_store_set(&s_tls, ti, tlsDestruct);
- }
- return ti;
+RenderThreadInfo::~RenderThreadInfo() {
}
-#endif
+RenderThreadInfo* RenderThreadInfo::get() {
+ return (RenderThreadInfo*)thread_store_get(&s_tls);
+}
diff --git a/emulator/opengl/host/libs/libOpenglRender/ThreadInfo.h b/emulator/opengl/host/libs/libOpenglRender/ThreadInfo.h
index b147290..2e67521 100644
--- a/emulator/opengl/host/libs/libOpenglRender/ThreadInfo.h
+++ b/emulator/opengl/host/libs/libOpenglRender/ThreadInfo.h
@@ -23,6 +23,10 @@
struct RenderThreadInfo
{
+ RenderThreadInfo();
+ ~RenderThreadInfo();
+ static RenderThreadInfo* get();
+
RenderContextPtr currContext;
WindowSurfacePtr currDrawSurf;
WindowSurfacePtr currReadSurf;
@@ -30,6 +34,4 @@ struct RenderThreadInfo
GL2Decoder m_gl2Dec;
};
-RenderThreadInfo *getRenderThreadInfo();
-
#endif
diff --git a/files/ant/build.xml b/files/ant/build.xml
index 7931cd2..1c3f82d 100644
--- a/files/ant/build.xml
+++ b/files/ant/build.xml
@@ -480,12 +480,11 @@
<property name="aidl" location="${android.build.tools.dir}/aidl${exe}" />
<property name="aapt" location="${android.build.tools.dir}/aapt${exe}" />
<property name="dx" location="${android.build.tools.dir}/dx${bat}" />
- <property name="renderscript" location="${android.build.tools.dir}/llvm-rs-cc${exe}"/>
<!-- Renderscript include Path -->
<path id="android.renderscript.include.path">
- <pathelement location="${android.platform.tools.dir}/renderscript/include" />
- <pathelement location="${android.platform.tools.dir}/renderscript/clang-include" />
+ <pathelement location="${android.build.tools.dir}/renderscript/include" />
+ <pathelement location="${android.build.tools.dir}/renderscript/clang-include" />
</path>
<!-- read the previous build mode -->
@@ -662,7 +661,7 @@
<echo level="info">Handling RenderScript files...</echo>
<!-- set the rs target prop in case it hasn't been set. -->
<property name="renderscript.target" value="${project.minSdkVersion}" />
- <renderscript executable="${renderscript}"
+ <renderscript buildToolsRoot="${android.build.tools.dir}"
includePathRefId="android.renderscript.include.path"
genFolder="${gen.absolute.dir}"
resFolder="${out.res.absolute.dir}/raw"
diff --git a/files/devices.xml b/files/devices.xml
index ac92da3..e729986 100644
--- a/files/devices.xml
+++ b/files/devices.xml
@@ -400,4 +400,196 @@
</d:state>
</d:device>
+
+ <d:device>
+ <d:name>Nexus 4</d:name>
+ <d:manufacturer>Google</d:manufacturer>
+ <d:hardware>
+ <d:screen>
+ <d:screen-size>normal</d:screen-size>
+ <d:diagonal-length>4.7</d:diagonal-length>
+ <d:pixel-density>xhdpi</d:pixel-density>
+ <d:screen-ratio>notlong</d:screen-ratio>
+ <d:dimensions>
+ <d:x-dimension>768</d:x-dimension>
+ <d:y-dimension>1280</d:y-dimension>
+ </d:dimensions>
+ <d:xdpi>320</d:xdpi>
+ <d:ydpi>320</d:ydpi>
+ <d:touch>
+ <d:multitouch>jazz-hands</d:multitouch>
+ <d:mechanism>finger</d:mechanism>
+ <d:screen-type>capacitive</d:screen-type>
+ </d:touch>
+ </d:screen>
+ <d:networking>
+ Wifi
+ Bluetooth
+ NFC
+ </d:networking>
+ <d:sensors>
+ Accelerometer
+ Barometer
+ Compass
+ GPS
+ Gyroscope
+ LightSensor
+ ProximitySensor
+ </d:sensors>
+ <d:mic>true</d:mic>
+ <d:camera>
+ <d:location>back</d:location>
+ <d:autofocus>true</d:autofocus>
+ <d:flash>true</d:flash>
+ </d:camera>
+ <d:camera>
+ <d:location>front</d:location>
+ <d:autofocus>false</d:autofocus>
+ <d:flash>false</d:flash>
+ </d:camera>
+ <d:keyboard>nokeys</d:keyboard>
+ <d:nav>nonav</d:nav>
+ <d:ram unit="KiB">1953125</d:ram>
+ <d:buttons>soft</d:buttons>
+ <d:internal-storage unit="KiB">7811891</d:internal-storage>
+ <d:removable-storage unit="MiB"></d:removable-storage>
+ <d:cpu>Qualcomm Snapdragon S4 Pro</d:cpu>
+ <d:gpu>Adreno 320</d:gpu>
+ <d:abi>
+ armeabi-v7a
+ armeabi
+ </d:abi>
+ <d:dock></d:dock>
+ <d:power-type>battery</d:power-type>
+ </d:hardware>
+ <d:software>
+ <d:api-level>16</d:api-level>
+ <d:live-wallpaper-support>true</d:live-wallpaper-support>
+ <d:bluetooth-profiles></d:bluetooth-profiles>
+ <d:gl-version>2.0</d:gl-version>
+ <d:gl-extensions>GL_EXT_debug_marker GL_AMD_compressed_ATC_texture
+ GL_AMD_performance_monitor GL_AMD_program_binary_Z400 GL_EXT_robustness
+ GL_EXT_texture_format_BGRA8888 GL_EXT_texture_type_2_10_10_10_REV GL_NV_fence
+ GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth_texture GL_OES_depth24
+ GL_OES_EGL_image GL_OES_EGL_image_external GL_OES_element_index_uint
+ GL_OES_fbo_render_mipmap GL_OES_fragment_precision_high GL_OES_get_program_binary
+ GL_OES_packed_depth_stencil GL_OES_rgb8_rgba8 GL_OES_standard_derivatives
+ GL_OES_texture_3D GL_OES_texture_float GL_OES_texture_half_float
+ GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_half_float
+ GL_OES_vertex_type_10_10_10_2 GL_OES_vertex_array_object GL_QCOM_alpha_test
+ GL_QCOM_binning_control GL_QCOM_driver_control GL_QCOM_perfmon_global_mode
+ GL_QCOM_extended_get GL_QCOM_extended_get2 GL_QCOM_tiled_rendering
+ GL_QCOM_writeonly_rendering GL_EXT_sRGB
+ </d:gl-extensions>
+ <d:status-bar>true</d:status-bar>
+ </d:software>
+ <d:state name="Portrait" default="true">
+ <d:description>The phone in portrait view</d:description>
+ <d:screen-orientation>port</d:screen-orientation>
+ <d:keyboard-state>keyssoft</d:keyboard-state>
+ <d:nav-state>nonav</d:nav-state>
+ </d:state>
+ <d:state name="Landscape">
+ <d:description>The phone in landscape view</d:description>
+ <d:screen-orientation>land</d:screen-orientation>
+ <d:keyboard-state>keyssoft</d:keyboard-state>
+ <d:nav-state>nonav</d:nav-state>
+ </d:state>
+ </d:device>
+
+ <d:device>
+ <d:name>Nexus 10</d:name>
+ <d:manufacturer>Google</d:manufacturer>
+ <d:hardware>
+ <d:screen>
+ <d:screen-size>xlarge</d:screen-size>
+ <d:diagonal-length>10.055</d:diagonal-length>
+ <d:pixel-density>xhdpi</d:pixel-density>
+ <d:screen-ratio>notlong</d:screen-ratio>
+ <d:dimensions>
+ <d:x-dimension>2560</d:x-dimension>
+ <d:y-dimension>1600</d:y-dimension>
+ </d:dimensions>
+ <d:xdpi>300</d:xdpi>
+ <d:ydpi>300</d:ydpi>
+ <d:touch>
+ <d:multitouch>jazz-hands</d:multitouch>
+ <d:mechanism>finger</d:mechanism>
+ <d:screen-type>capacitive</d:screen-type>
+ </d:touch>
+ </d:screen>
+ <d:networking>
+ Wifi
+ Bluetooth
+ NFC
+ </d:networking>
+ <d:sensors>
+ Accelerometer
+ Barometer
+ Compass
+ GPS
+ Gyroscope
+ LightSensor
+ </d:sensors>
+ <d:mic>true</d:mic>
+ <d:camera>
+ <d:location>back</d:location>
+ <d:autofocus>true</d:autofocus>
+ <d:flash>true</d:flash>
+ </d:camera>
+ <d:camera>
+ <d:location>front</d:location>
+ <d:autofocus>false</d:autofocus>
+ <d:flash>false</d:flash>
+ </d:camera>
+ <d:keyboard>nokeys</d:keyboard>
+ <d:nav>nonav</d:nav>
+ <d:ram unit="KiB">1953125</d:ram>
+ <d:buttons>soft</d:buttons>
+ <d:internal-storage unit="KiB">15623782</d:internal-storage>
+ <d:removable-storage unit="MiB"></d:removable-storage>
+ <d:cpu>Dual-core A15</d:cpu>
+ <d:gpu>Quad-core Mali T604</d:gpu>
+ <d:abi>
+ armeabi-v7a
+ armeabi
+ </d:abi>
+ <d:dock></d:dock>
+ <d:power-type>battery</d:power-type>
+ </d:hardware>
+ <d:software>
+ <d:api-level>16</d:api-level>
+ <d:live-wallpaper-support>true</d:live-wallpaper-support>
+ <d:bluetooth-profiles></d:bluetooth-profiles>
+ <d:gl-version>2.0</d:gl-version>
+ <d:gl-extensions>GL_EXT_debug_marker GL_ARM_rgba8 GL_ARM_mali_shader_binary
+ GL_OES_depth24 GL_OES_depth_texture GL_OES_depth_texture_cube_map
+ GL_OES_packed_depth_stencil GL_OES_rgb8_rgba8 GL_EXT_read_format_bgra
+ GL_OES_compressed_paletted_texture GL_OES_compressed_ETC1_RGB8_texture
+ GL_OES_standard_derivatives GL_OES_EGL_image GL_OES_EGL_image_external
+ GL_OES_EGL_sync GL_OES_texture_npot GL_OES_vertex_half_float
+ GL_OES_required_internalformat GL_OES_vertex_array_object GL_OES_mapbuffer
+ GL_EXT_texture_format_BGRA8888 GL_EXT_texture_rg GL_EXT_texture_type_2_10_10_10_REV
+ GL_OES_fbo_render_mipmap GL_OES_element_index_uint GL_EXT_shadow_samplers
+ GL_EXT_occlusion_query_boolean GL_EXT_blend_minmax GL_EXT_discard_framebuffer
+ GL_OES_get_program_binary GL_OES_texture_3D GL_EXT_texture_storage
+ GL_EXT_multisampled_render_to_texture GL_OES_surfaceless_context
+ GL_ARM_mali_program_binary
+ </d:gl-extensions>
+ <d:status-bar>true</d:status-bar>
+ </d:software>
+ <d:state name="Portrait">
+ <d:description>The phone in portrait view</d:description>
+ <d:screen-orientation>port</d:screen-orientation>
+ <d:keyboard-state>keyssoft</d:keyboard-state>
+ <d:nav-state>nonav</d:nav-state>
+ </d:state>
+ <d:state name="Landscape" default="true">
+ <d:description>The phone in landscape view</d:description>
+ <d:screen-orientation>land</d:screen-orientation>
+ <d:keyboard-state>keyssoft</d:keyboard-state>
+ <d:nav-state>nonav</d:nav-state>
+ </d:state>
+ </d:device>
+
</d:devices>
diff --git a/files/tools_source.properties b/files/tools_source.properties
index 3deca7a..2e8aa8a 100644
--- a/files/tools_source.properties
+++ b/files/tools_source.properties
@@ -1,3 +1,3 @@
Pkg.UserSrc=false
-Pkg.Revision=22
+Pkg.Revision=22.0.1
Platform.MinPlatformToolsRev=16
diff --git a/hierarchyviewer/Android.mk b/hierarchyviewer/Android.mk
deleted file mode 100644
index 0940457..0000000
--- a/hierarchyviewer/Android.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-# Copyright (C) 2008 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#HIERARCHYVIEWER_LOCAL_DIR := $(call my-dir)
-#include $(HIERARCHYVIEWER_LOCAL_DIR)/etc/Android.mk
-#include $(HIERARCHYVIEWER_LOCAL_DIR)/src/Android.mk
diff --git a/hierarchyviewer/README.txt b/hierarchyviewer/README.txt
new file mode 100644
index 0000000..81fae95
--- /dev/null
+++ b/hierarchyviewer/README.txt
@@ -0,0 +1,8 @@
+This version of HierarchyViewer is deprecated and obsolete.
+The sources are left here just for reference. Please do not change them.
+
+HierarchyViewer2 is located in /tools/swt/hierarchyviewer2.
+This is the version that ships in the SDK.
+
+--- RM 20130409
+
diff --git a/hierarchyviewer/src/com/android/hierarchyviewer/HierarchyViewer.java b/hierarchyviewer/src/com/android/hierarchyviewer/HierarchyViewer.java
index e945987..385ee79 100644
--- a/hierarchyviewer/src/com/android/hierarchyviewer/HierarchyViewer.java
+++ b/hierarchyviewer/src/com/android/hierarchyviewer/HierarchyViewer.java
@@ -16,12 +16,16 @@
package com.android.hierarchyviewer;
+import com.android.ddmlib.IDevice;
+import com.android.hierarchyviewer.device.Window;
+import com.android.hierarchyviewer.scene.CaptureLoader;
import com.android.hierarchyviewer.ui.Workspace;
import com.android.hierarchyviewer.device.DeviceBridge;
import javax.swing.SwingUtilities;
import javax.swing.UIManager;
import javax.swing.UnsupportedLookAndFeelException;
+import java.io.File;
public class HierarchyViewer {
private static final CharSequence OS_WINDOWS = "Windows";
@@ -44,7 +48,7 @@ public class HierarchyViewer {
if (os.contains(OS_WINDOWS) || os.contains(OS_MACOSX)) {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} else {
- UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
+ UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
}
} catch (ClassNotFoundException e) {
e.printStackTrace();
@@ -57,14 +61,95 @@ public class HierarchyViewer {
}
}
+ private static void listDevices() {
+ System.out.println("List of devices attached");
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ for (IDevice device : DeviceBridge.getDevices()) {
+ printDevice(device);
+ }
+ DeviceBridge.terminate();
+ }
+
+ private static void printDevice(IDevice device) {
+ System.out.println(device.toString() + "\t\t" +
+ (device.isEmulator() ? "emulator" : "device"));
+ }
+
+ private static void outputPsd(String deviceName, String file) {
+ IDevice device = selectDevice(deviceName);
+ if (device != null) {
+ if (DeviceBridge.isViewServerRunning(device)) {
+ DeviceBridge.stopViewServer(device);
+ }
+ DeviceBridge.startViewServer(device);
+ DeviceBridge.setupDeviceForward(device);
+ System.out.println("Capturing layers to " + file);
+ CaptureLoader.saveLayers(device, Window.FOCUSED_WINDOW, new File(file));
+ } else {
+ System.out.println("The selected device does not exist");
+ }
+ DeviceBridge.terminate();
+ }
+
+ private static IDevice selectDevice(String deviceName) {
+ try {
+ Thread.sleep(500);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ if (DeviceBridge.getDevices() == null) return null;
+ if (deviceName == null) return DeviceBridge.getDevices()[0];
+ for (IDevice device : DeviceBridge.getDevices()) {
+ if (device.getSerialNumber().equalsIgnoreCase(deviceName)) {
+ return device;
+ }
+ }
+ return null;
+ }
+
public static void main(String[] args) {
+ DeviceBridge.initDebugBridge();
+
if (args.length > 0) {
- sProfilingEnabled = !args[0].equalsIgnoreCase("-profiling=false");
+ for (int i = 0; i < args.length; i++) {
+ String arg = args[i];
+ if ("--help".equalsIgnoreCase(arg)) {
+ System.out.println("Usage: hierarchyviewer1 [options]\n");
+ System.out.println("Options:");
+ System.out.println(" --help\t\t\t Show this help message and exit");
+ System.out.println(" --no-profiling\t Disable views profiling");
+ System.out.println(" --devices\t\t\t Show the list of available devices");
+ System.out.println(" --psd [device] <file>\t Export psd and exit");
+ System.exit(0);
+ } else if ("--no-profiling".equalsIgnoreCase(arg)) {
+ sProfilingEnabled = false;
+ } else if ("--devices".equalsIgnoreCase(arg)) {
+ listDevices();
+ System.exit(0);
+ } else if ("--psd".equalsIgnoreCase(arg)) {
+ if (i == args.length - 1) {
+ System.out.println("You must specify at least an output file with --psd");
+ System.exit(1);
+ }
+ String device = null;
+ String file = null;
+ if (i < args.length - 2) {
+ device = args[++i];
+ }
+ if (i < args.length - 1) {
+ file = args[++i];
+ }
+ outputPsd(device, file);
+ System.exit(0);
+ }
+ }
}
initUserInterface();
- DeviceBridge.initDebugBridge();
-
SwingUtilities.invokeLater(new Runnable() {
public void run() {
Workspace workspace = new Workspace();
diff --git a/settings/org.eclipse.jdt.core.prefs b/settings/org.eclipse.jdt.core.prefs
index 9dbff07..ea66196 100644
--- a/settings/org.eclipse.jdt.core.prefs
+++ b/settings/org.eclipse.jdt.core.prefs
@@ -48,10 +48,10 @@ org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignor
org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error
-org.eclipse.jdt.core.compiler.problem.nullReference=error
+org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=warning
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
org.eclipse.jdt.core.compiler.problem.nullSpecInsufficientInfo=warning
-org.eclipse.jdt.core.compiler.problem.nullSpecViolation=error
+org.eclipse.jdt.core.compiler.problem.nullSpecViolation=warning
org.eclipse.jdt.core.compiler.problem.nullUncheckedConversion=ignore
org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
diff --git a/templates/activities/BlankActivity/globals.xml.ftl b/templates/activities/BlankActivity/globals.xml.ftl
deleted file mode 100644
index 6220005..0000000
--- a/templates/activities/BlankActivity/globals.xml.ftl
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0"?>
-<globals>
- <global id="srcOut" value="src/${slashedPackageName(packageName)}" />
- <global id="menuName" value="${classToResource(activityClass)}" />
-</globals>
diff --git a/templates/activities/BlankActivity/recipe.xml.ftl b/templates/activities/BlankActivity/recipe.xml.ftl
deleted file mode 100644
index 78bd8b2..0000000
--- a/templates/activities/BlankActivity/recipe.xml.ftl
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0"?>
-<recipe>
- <merge from="AndroidManifest.xml.ftl" />
-
- <instantiate from="res/menu/main.xml.ftl"
- to="res/menu/${menuName}.xml" />
-
- <merge from="res/values/strings.xml.ftl" />
-
- <merge from="res/values/dimens.xml" />
- <merge from="res/values-sw600dp/dimens.xml" />
- <merge from="res/values-sw720dp-land/dimens.xml" />
-
- <!-- Decide what kind of layout to add (viewpager or not) -->
- <#if navType?contains("pager")>
- <instantiate from="res/layout/activity_pager.xml.ftl"
- to="res/layout/${layoutName}.xml" />
- <instantiate from="res/layout/fragment_dummy.xml.ftl"
- to="res/layout/fragment_${classToResource(activityClass)}_dummy.xml" />
-
- <#elseif navType == "tabs" || navType == "dropdown">
- <instantiate from="res/layout/activity_fragment_container.xml"
- to="res/layout/${layoutName}.xml" />
- <instantiate from="res/layout/fragment_dummy.xml.ftl"
- to="res/layout/fragment_${classToResource(activityClass)}_dummy.xml" />
-
- <#else>
- <instantiate from="res/layout/activity_simple.xml.ftl"
- to="res/layout/${layoutName}.xml" />
- </#if>
-
- <!-- Decide which activity code to add -->
- <#if navType == "none">
- <instantiate from="src/app_package/SimpleActivity.java.ftl"
- to="${srcOut}/${activityClass}.java" />
-
- <#elseif navType == "tabs_pager" || navType == "pager_strip">
- <instantiate from="src/app_package/TabsAndPagerActivity.java.ftl"
- to="${srcOut}/${activityClass}.java" />
-
- <#elseif navType == "tabs">
- <instantiate from="src/app_package/TabsActivity.java.ftl"
- to="${srcOut}/${activityClass}.java" />
-
- <#elseif navType == "dropdown">
- <instantiate from="src/app_package/DropdownActivity.java.ftl"
- to="${srcOut}/${activityClass}.java" />
-
- </#if>
-
- <open file="res/layout/${layoutName}.xml" />
-</recipe>
diff --git a/templates/activities/BlankActivity/root/AndroidManifest.xml.ftl b/templates/activities/BlankActivity/root/AndroidManifest.xml.ftl
deleted file mode 100644
index b8ae72e..0000000
--- a/templates/activities/BlankActivity/root/AndroidManifest.xml.ftl
+++ /dev/null
@@ -1,24 +0,0 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" >
-
- <application>
- <activity android:name=".${activityClass}"
- <#if isNewProject>
- android:label="@string/app_name"
- <#else>
- android:label="@string/title_${activityToLayout(activityClass)}"
- </#if>
- <#if buildApi gte 16 && parentActivityClass != "">android:parentActivityName="${parentActivityClass}"</#if>>
- <#if parentActivityClass != "">
- <meta-data android:name="android.support.PARENT_ACTIVITY"
- android:value="${parentActivityClass}" />
- </#if>
- <#if isLauncher>
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </#if>
- </activity>
- </application>
-
-</manifest>
diff --git a/templates/activities/BlankActivity/root/res/layout/activity_fragment_container.xml b/templates/activities/BlankActivity/root/res/layout/activity_fragment_container.xml
deleted file mode 100644
index 935d379..0000000
--- a/templates/activities/BlankActivity/root/res/layout/activity_fragment_container.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:id="@+id/container"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- tools:context=".${activityClass}"
- tools:ignore="MergeRootFrame" />
diff --git a/templates/activities/BlankActivity/root/res/layout/activity_pager.xml.ftl b/templates/activities/BlankActivity/root/res/layout/activity_pager.xml.ftl
deleted file mode 100644
index ab57463..0000000
--- a/templates/activities/BlankActivity/root/res/layout/activity_pager.xml.ftl
+++ /dev/null
@@ -1,24 +0,0 @@
-<android.support.v4.view.ViewPager xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:id="@+id/pager"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- tools:context=".${activityClass}"<#if navType != "pager_strip"> /><#else>>
-
- <!--
- This title strip will display the currently visible page title, as well as the page
- titles for adjacent pages.
- -->
-
- <android.support.v4.view.PagerTitleStrip
- android:id="@+id/pager_title_strip"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="top"
- android:background="#33b5e5"
- android:paddingBottom="4dp"
- android:paddingTop="4dp"
- android:textColor="#fff" />
-
-</android.support.v4.view.ViewPager>
-</#if>
diff --git a/templates/activities/BlankActivity/root/res/layout/activity_simple.xml.ftl b/templates/activities/BlankActivity/root/res/layout/activity_simple.xml.ftl
deleted file mode 100644
index 9ddd213..0000000
--- a/templates/activities/BlankActivity/root/res/layout/activity_simple.xml.ftl
+++ /dev/null
@@ -1,16 +0,0 @@
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width=<#if buildApi lt 8 >"fill_parent"<#else>"match_parent"</#if>
- android:layout_height=<#if buildApi lt 8 >"fill_parent"<#else>"match_parent"</#if>
- android:paddingLeft="@dimen/activity_horizontal_margin"
- android:paddingRight="@dimen/activity_horizontal_margin"
- android:paddingTop="@dimen/activity_vertical_margin"
- android:paddingBottom="@dimen/activity_vertical_margin"
- tools:context=".${activityClass}">
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/hello_world" />
-
-</RelativeLayout>
diff --git a/templates/activities/BlankActivity/root/res/layout/fragment_dummy.xml.ftl b/templates/activities/BlankActivity/root/res/layout/fragment_dummy.xml.ftl
deleted file mode 100644
index 1f21998..0000000
--- a/templates/activities/BlankActivity/root/res/layout/fragment_dummy.xml.ftl
+++ /dev/null
@@ -1,16 +0,0 @@
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width=<#if buildApi lt 8 >"fill_parent"<#else>"match_parent"</#if>
- android:layout_height=<#if buildApi lt 8 >"fill_parent"<#else>"match_parent"</#if>
- android:paddingLeft="@dimen/activity_horizontal_margin"
- android:paddingRight="@dimen/activity_horizontal_margin"
- android:paddingTop="@dimen/activity_vertical_margin"
- android:paddingBottom="@dimen/activity_vertical_margin"
- tools:context=".${activityClass}$DummySectionFragment">
-
- <TextView
- android:id="@+id/section_label"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content" />
-
-</RelativeLayout>
diff --git a/templates/activities/BlankActivity/root/res/menu/main.xml.ftl b/templates/activities/BlankActivity/root/res/menu/main.xml.ftl
deleted file mode 100644
index e35aa1b..0000000
--- a/templates/activities/BlankActivity/root/res/menu/main.xml.ftl
+++ /dev/null
@@ -1,6 +0,0 @@
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:id="@+id/action_settings"
- android:title="@string/action_settings"
- android:orderInCategory="100"<#if buildApi gte 11>
- android:showAsAction="never"</#if> />
-</menu>
diff --git a/templates/activities/BlankActivity/root/res/values-sw600dp/dimens.xml b/templates/activities/BlankActivity/root/res/values-sw600dp/dimens.xml
deleted file mode 100644
index 886b05f..0000000
--- a/templates/activities/BlankActivity/root/res/values-sw600dp/dimens.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-<resources>
- <!-- Customize dimensions originally defined in res/values/dimens.xml (such as
- screen margins) for sw600dp devices (e.g. 7" tablets) here. -->
-</resources>
diff --git a/templates/activities/BlankActivity/root/res/values-sw720dp-land/dimens.xml b/templates/activities/BlankActivity/root/res/values-sw720dp-land/dimens.xml
deleted file mode 100644
index 00059fc..0000000
--- a/templates/activities/BlankActivity/root/res/values-sw720dp-land/dimens.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<resources>
- <!-- Customize dimensions originally defined in res/values/dimens.xml (such as
- screen margins) for sw720dp devices (e.g. 10" tablets) in landscape here. -->
- <dimen name="activity_horizontal_margin">128dp</dimen>
-</resources>
diff --git a/templates/activities/BlankActivity/root/res/values/dimens.xml b/templates/activities/BlankActivity/root/res/values/dimens.xml
deleted file mode 100644
index 47c8224..0000000
--- a/templates/activities/BlankActivity/root/res/values/dimens.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<resources>
- <!-- Default screen margins, per the Android Design guidelines. -->
- <dimen name="activity_horizontal_margin">16dp</dimen>
- <dimen name="activity_vertical_margin">16dp</dimen>
-</resources>
diff --git a/templates/activities/BlankActivity/root/res/values/strings.xml.ftl b/templates/activities/BlankActivity/root/res/values/strings.xml.ftl
deleted file mode 100644
index 1c9bc8b..0000000
--- a/templates/activities/BlankActivity/root/res/values/strings.xml.ftl
+++ /dev/null
@@ -1,15 +0,0 @@
-<resources>
- <#if !isNewProject>
- <string name="title_${activityToLayout(activityClass)}">${escapeXmlString(activityTitle)}</string>
- </#if>
-
- <string name="action_settings">Settings</string>
-
- <#if navType != "none">
- <string name="title_section1">Section 1</string>
- <string name="title_section2">Section 2</string>
- <string name="title_section3">Section 3</string>
- <#else>
- <string name="hello_world">Hello world!</string>
- </#if>
-</resources>
diff --git a/templates/activities/BlankActivity/root/src/app_package/DropdownActivity.java.ftl b/templates/activities/BlankActivity/root/src/app_package/DropdownActivity.java.ftl
deleted file mode 100644
index cb0665e..0000000
--- a/templates/activities/BlankActivity/root/src/app_package/DropdownActivity.java.ftl
+++ /dev/null
@@ -1,108 +0,0 @@
-package ${packageName};
-
-<#if minApiLevel < 14>import android.annotation.TargetApi;</#if>
-import android.app.ActionBar;
-import android.os.Bundle;
-<#if minApiLevel < 14>import android.content.Context;
-import android.os.Build;</#if>
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentActivity;
-import android.support.v4.app.NavUtils;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ArrayAdapter;
-import android.widget.TextView;
-
-public class ${activityClass} extends FragmentActivity implements ActionBar.OnNavigationListener {
-
- /**
- * The serialization (saved instance state) Bundle key representing the
- * current dropdown position.
- */
- private static final String STATE_SELECTED_NAVIGATION_ITEM = "selected_navigation_item";
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.${layoutName});
-
- // Set up the action bar to show a dropdown list.
- final ActionBar actionBar = getActionBar();
- actionBar.setDisplayShowTitleEnabled(false);
- actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_LIST);
- <#if parentActivityClass != "">
- // Show the Up button in the action bar.
- actionBar.setDisplayHomeAsUpEnabled(true);
- </#if>
-
- // Set up the dropdown list navigation in the action bar.
- actionBar.setListNavigationCallbacks(
- // Specify a SpinnerAdapter to populate the dropdown list.
- new ArrayAdapter<String>(
- <#if minApiLevel gte 14>actionBar.getThemedContext()<#else>getActionBarThemedContextCompat()</#if>,
- android.R.layout.simple_list_item_1,
- android.R.id.text1,
- new String[] {
- getString(R.string.title_section1),
- getString(R.string.title_section2),
- getString(R.string.title_section3),
- }),
- this);
- }
-
- <#if minApiLevel < 14>
- /**
- * Backward-compatible version of {@link ActionBar#getThemedContext()} that
- * simply returns the {@link android.app.Activity} if
- * <code>getThemedContext</code> is unavailable.
- */
- @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
- private Context getActionBarThemedContextCompat() {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
- return getActionBar().getThemedContext();
- } else {
- return this;
- }
- }
- </#if>
-
- @Override
- public void onRestoreInstanceState(Bundle savedInstanceState) {
- // Restore the previously serialized current dropdown position.
- if (savedInstanceState.containsKey(STATE_SELECTED_NAVIGATION_ITEM)) {
- getActionBar().setSelectedNavigationItem(
- savedInstanceState.getInt(STATE_SELECTED_NAVIGATION_ITEM));
- }
- }
-
- @Override
- public void onSaveInstanceState(Bundle outState) {
- // Serialize the current dropdown position.
- outState.putInt(STATE_SELECTED_NAVIGATION_ITEM,
- getActionBar().getSelectedNavigationIndex());
- }
-
- <#include "include_onCreateOptionsMenu.java.ftl">
- <#include "include_onOptionsItemSelected.java.ftl">
-
- @Override
- public boolean onNavigationItemSelected(int position, long id) {
- // When the given dropdown item is selected, show its contents in the
- // container view.
- Fragment fragment = new DummySectionFragment();
- Bundle args = new Bundle();
- args.putInt(DummySectionFragment.ARG_SECTION_NUMBER, position + 1);
- fragment.setArguments(args);
- getSupportFragmentManager().beginTransaction()
- .replace(R.id.container, fragment)
- .commit();
- return true;
- }
-
- <#include "include_DummySectionFragment.java.ftl">
-
-}
diff --git a/templates/activities/BlankActivity/root/src/app_package/SimpleActivity.java.ftl b/templates/activities/BlankActivity/root/src/app_package/SimpleActivity.java.ftl
deleted file mode 100644
index 7edd647..0000000
--- a/templates/activities/BlankActivity/root/src/app_package/SimpleActivity.java.ftl
+++ /dev/null
@@ -1,42 +0,0 @@
-package ${packageName};
-
-import android.os.Bundle;
-import android.app.Activity;
-import android.view.Menu;
-<#if parentActivityClass != "">
-import android.view.MenuItem;
-import android.support.v4.app.NavUtils;
-<#if minApiLevel < 11>
-import android.annotation.TargetApi;
-import android.os.Build;
-</#if>
-</#if>
-
-public class ${activityClass} extends Activity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.${layoutName});
- <#if parentActivityClass != "">
- // Show the Up button in the action bar.
- setupActionBar();
- </#if>
- }
-
- <#if parentActivityClass != "">
- /**
- * Set up the {@link android.app.ActionBar}<#if minApiLevel < 11>, if the API is available</#if>.
- */
- <#if minApiLevel < 11>@TargetApi(Build.VERSION_CODES.HONEYCOMB)
- </#if>private void setupActionBar() {
- <#if minApiLevel < 11>if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {</#if>
- getActionBar().setDisplayHomeAsUpEnabled(true);
- <#if minApiLevel < 11>}</#if>
- }
- </#if>
-
- <#include "include_onCreateOptionsMenu.java.ftl">
- <#include "include_onOptionsItemSelected.java.ftl">
-
-}
diff --git a/templates/activities/BlankActivity/root/src/app_package/TabsActivity.java.ftl b/templates/activities/BlankActivity/root/src/app_package/TabsActivity.java.ftl
deleted file mode 100644
index 0bf975e..0000000
--- a/templates/activities/BlankActivity/root/src/app_package/TabsActivity.java.ftl
+++ /dev/null
@@ -1,86 +0,0 @@
-package ${packageName};
-
-import android.app.ActionBar;
-import android.app.FragmentTransaction;
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentActivity;
-import android.support.v4.app.NavUtils;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.TextView;
-
-public class ${activityClass} extends FragmentActivity implements ActionBar.TabListener {
-
- /**
- * The serialization (saved instance state) Bundle key representing the
- * current tab position.
- */
- private static final String STATE_SELECTED_NAVIGATION_ITEM = "selected_navigation_item";
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.${layoutName});
-
- // Set up the action bar to show tabs.
- final ActionBar actionBar = getActionBar();
- actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
- <#if parentActivityClass != "">
- // Show the Up button in the action bar.
- actionBar.setDisplayHomeAsUpEnabled(true);
- </#if>
-
- // For each of the sections in the app, add a tab to the action bar.
- actionBar.addTab(actionBar.newTab().setText(R.string.title_section1).setTabListener(this));
- actionBar.addTab(actionBar.newTab().setText(R.string.title_section2).setTabListener(this));
- actionBar.addTab(actionBar.newTab().setText(R.string.title_section3).setTabListener(this));
- }
-
- @Override
- public void onRestoreInstanceState(Bundle savedInstanceState) {
- // Restore the previously serialized current tab position.
- if (savedInstanceState.containsKey(STATE_SELECTED_NAVIGATION_ITEM)) {
- getActionBar().setSelectedNavigationItem(
- savedInstanceState.getInt(STATE_SELECTED_NAVIGATION_ITEM));
- }
- }
-
- @Override
- public void onSaveInstanceState(Bundle outState) {
- // Serialize the current tab position.
- outState.putInt(STATE_SELECTED_NAVIGATION_ITEM,
- getActionBar().getSelectedNavigationIndex());
- }
-
- <#include "include_onCreateOptionsMenu.java.ftl">
- <#include "include_onOptionsItemSelected.java.ftl">
-
- @Override
- public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
- // When the given tab is selected, show the tab contents in the
- // container view.
- Fragment fragment = new DummySectionFragment();
- Bundle args = new Bundle();
- args.putInt(DummySectionFragment.ARG_SECTION_NUMBER, tab.getPosition() + 1);
- fragment.setArguments(args);
- getSupportFragmentManager().beginTransaction()
- .replace(R.id.container, fragment)
- .commit();
- }
-
- @Override
- public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
- }
-
- @Override
- public void onTabReselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
- }
-
- <#include "include_DummySectionFragment.java.ftl">
-
-}
diff --git a/templates/activities/BlankActivity/root/src/app_package/TabsAndPagerActivity.java.ftl b/templates/activities/BlankActivity/root/src/app_package/TabsAndPagerActivity.java.ftl
deleted file mode 100644
index 30c4f4a..0000000
--- a/templates/activities/BlankActivity/root/src/app_package/TabsAndPagerActivity.java.ftl
+++ /dev/null
@@ -1,153 +0,0 @@
-package ${packageName};
-
-import java.util.Locale;
-
-<#if navType?contains("tabs")>import android.app.ActionBar;
-import android.app.FragmentTransaction;</#if>
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.support.v4.app.FragmentActivity;
-import android.support.v4.app.FragmentManager;
-import android.support.v4.app.FragmentPagerAdapter;
-import android.support.v4.app.NavUtils;
-import android.support.v4.view.ViewPager;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.Menu;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.TextView;
-
-public class ${activityClass} extends FragmentActivity<#if navType?contains("tabs")> implements ActionBar.TabListener</#if> {
-
- /**
- * The {@link android.support.v4.view.PagerAdapter} that will provide
- * fragments for each of the sections. We use a
- * {@link android.support.v4.app.FragmentPagerAdapter} derivative, which
- * will keep every loaded fragment in memory. If this becomes too memory
- * intensive, it may be best to switch to a
- * {@link android.support.v4.app.FragmentStatePagerAdapter}.
- */
- SectionsPagerAdapter mSectionsPagerAdapter;
-
- /**
- * The {@link ViewPager} that will host the section contents.
- */
- ViewPager mViewPager;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.${layoutName});
-
- <#if navType?contains("tabs")>
- // Set up the action bar.
- final ActionBar actionBar = getActionBar();
- actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS);
- <#if parentActivityClass != "">
- // Show the Up button in the action bar.
- actionBar.setDisplayHomeAsUpEnabled(true);
- </#if>
- <#elseif parentActivityClass != "">
- // Show the Up button in the action bar.
- getActionBar().setDisplayHomeAsUpEnabled(true);
- </#if>
-
- // Create the adapter that will return a fragment for each of the three
- // primary sections of the app.
- mSectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager());
-
- // Set up the ViewPager with the sections adapter.
- mViewPager = (ViewPager) findViewById(R.id.pager);
- mViewPager.setAdapter(mSectionsPagerAdapter);
-
- <#if navType?contains("tabs")>
- // When swiping between different sections, select the corresponding
- // tab. We can also use ActionBar.Tab#select() to do this if we have
- // a reference to the Tab.
- mViewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() {
- @Override
- public void onPageSelected(int position) {
- actionBar.setSelectedNavigationItem(position);
- }
- });
-
- // For each of the sections in the app, add a tab to the action bar.
- for (int i = 0; i < mSectionsPagerAdapter.getCount(); i++) {
- // Create a tab with text corresponding to the page title defined by
- // the adapter. Also specify this Activity object, which implements
- // the TabListener interface, as the callback (listener) for when
- // this tab is selected.
- actionBar.addTab(
- actionBar.newTab()
- .setText(mSectionsPagerAdapter.getPageTitle(i))
- .setTabListener(this));
- }
- </#if>
- }
-
- <#include "include_onCreateOptionsMenu.java.ftl">
- <#include "include_onOptionsItemSelected.java.ftl">
-
- <#if navType?contains("tabs")>@Override
- public void onTabSelected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
- // When the given tab is selected, switch to the corresponding page in
- // the ViewPager.
- mViewPager.setCurrentItem(tab.getPosition());
- }
-
- @Override
- public void onTabUnselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
- }
-
- @Override
- public void onTabReselected(ActionBar.Tab tab, FragmentTransaction fragmentTransaction) {
- }</#if>
-
- /**
- * A {@link FragmentPagerAdapter} that returns a fragment corresponding to
- * one of the sections/tabs/pages.
- */
- public class SectionsPagerAdapter extends FragmentPagerAdapter {
-
- public SectionsPagerAdapter(FragmentManager fm) {
- super(fm);
- }
-
- @Override
- public Fragment getItem(int position) {
- // getItem is called to instantiate the fragment for the given page.
- // Return a DummySectionFragment (defined as a static inner class
- // below) with the page number as its lone argument.
- Fragment fragment = new DummySectionFragment();
- Bundle args = new Bundle();
- args.putInt(DummySectionFragment.ARG_SECTION_NUMBER, position + 1);
- fragment.setArguments(args);
- return fragment;
- }
-
- @Override
- public int getCount() {
- // Show 3 total pages.
- return 3;
- }
-
- @Override
- public CharSequence getPageTitle(int position) {
- Locale l = Locale.getDefault();
- switch (position) {
- case 0:
- return getString(R.string.title_section1).toUpperCase(l);
- case 1:
- return getString(R.string.title_section2).toUpperCase(l);
- case 2:
- return getString(R.string.title_section3).toUpperCase(l);
- }
- return null;
- }
- }
-
- <#include "include_DummySectionFragment.java.ftl">
-
-}
diff --git a/templates/activities/BlankActivity/root/src/app_package/include_DummySectionFragment.java.ftl b/templates/activities/BlankActivity/root/src/app_package/include_DummySectionFragment.java.ftl
deleted file mode 100644
index 8eb1399..0000000
--- a/templates/activities/BlankActivity/root/src/app_package/include_DummySectionFragment.java.ftl
+++ /dev/null
@@ -1,23 +0,0 @@
- /**
- * A dummy fragment representing a section of the app, but that simply
- * displays dummy text.
- */
- public static class DummySectionFragment extends Fragment {
- /**
- * The fragment argument representing the section number for this
- * fragment.
- */
- public static final String ARG_SECTION_NUMBER = "section_number";
-
- public DummySectionFragment() {
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- View rootView = inflater.inflate(R.layout.fragment_${classToResource(activityClass)}_dummy, container, false);
- TextView dummyTextView = (TextView) rootView.findViewById(R.id.section_label);
- dummyTextView.setText(Integer.toString(getArguments().getInt(ARG_SECTION_NUMBER)));
- return rootView;
- }
- }
diff --git a/templates/activities/BlankActivity/root/src/app_package/include_onCreateOptionsMenu.java.ftl b/templates/activities/BlankActivity/root/src/app_package/include_onCreateOptionsMenu.java.ftl
deleted file mode 100644
index 005d629..0000000
--- a/templates/activities/BlankActivity/root/src/app_package/include_onCreateOptionsMenu.java.ftl
+++ /dev/null
@@ -1,6 +0,0 @@
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- // Inflate the menu; this adds items to the action bar if it is present.
- getMenuInflater().inflate(R.menu.${menuName}, menu);
- return true;
- }
diff --git a/templates/activities/BlankActivity/root/src/app_package/include_onOptionsItemSelected.java.ftl b/templates/activities/BlankActivity/root/src/app_package/include_onOptionsItemSelected.java.ftl
deleted file mode 100644
index e1dc462..0000000
--- a/templates/activities/BlankActivity/root/src/app_package/include_onOptionsItemSelected.java.ftl
+++ /dev/null
@@ -1,19 +0,0 @@
- <#if parentActivityClass != "">
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case android.R.id.home:
- // This ID represents the Home or Up button. In the case of this
- // activity, the Up button is shown. Use NavUtils to allow users
- // to navigate up one level in the application structure. For
- // more details, see the Navigation pattern on Android Design:
- //
- // http://developer.android.com/design/patterns/navigation.html#up-vs-back
- //
- NavUtils.navigateUpFromSameTask(this);
- return true;
- }
- return super.onOptionsItemSelected(item);
- }
- </#if>
diff --git a/templates/activities/BlankActivity/template.xml b/templates/activities/BlankActivity/template.xml
deleted file mode 100644
index 08a306d..0000000
--- a/templates/activities/BlankActivity/template.xml
+++ /dev/null
@@ -1,88 +0,0 @@
-<?xml version="1.0"?>
-<template
- format="3"
- revision="2"
- name="Blank Activity"
- description="Creates a new blank activity, with an action bar and optional navigational elements such as tabs or horizontal swipe.">
- <dependency name="android-support-v4" revision="8" />
-
- <category value="Activities" />
-
- <parameter
- id="activityClass"
- name="Activity Name"
- type="string"
- constraints="class|unique|nonempty"
- suggest="${layoutToActivity(layoutName)}"
- default="MainActivity"
- help="The name of the activity class to create" />
-
- <parameter
- id="layoutName"
- name="Layout Name"
- type="string"
- constraints="layout|unique|nonempty"
- suggest="${activityToLayout(activityClass)}"
- default="activity_main"
- help="The name of the layout to create for the activity" />
-
- <parameter
- id="activityTitle"
- name="Title"
- type="string"
- constraints="nonempty"
- default="MainActivity"
- suggest="${activityClass}"
- help="The name of the activity. For launcher activities, the application title." />
-
- <parameter
- id="isLauncher"
- name="Launcher Activity"
- type="boolean"
- default="false"
- help="If true, this activity will have a CATEGORY_LAUNCHER intent filter, making it visible in the launcher" />
-
- <parameter
- id="parentActivityClass"
- name="Hierarchical Parent"
- type="string"
- constraints="activity|exists|empty"
- default=""
- help="The hierarchical parent activity, used to provide a default implementation for the 'Up' button" />
-
- <parameter
- id="navType"
- name="Navigation Type"
- type="enum"
- default="none"
- help="The type of navigation to use for the activity" >
- <option id="none" default="true">None</option>
- <!--<option id="tabs" minApi="11">Fixed Tabs</option>-->
- <option id="tabs_pager" minApi="11">Fixed Tabs + Swipe</option>
- <option id="pager_strip" minApi="11">Scrollable Tabs + Swipe</option>
- <option id="dropdown" minApi="11">Dropdown</option>
- </parameter>
-
- <parameter
- id="packageName"
- name="Package name"
- type="string"
- constraints="package"
- default="com.mycompany.myapp" />
-
- <!-- 128x128 thumbnails relative to template.xml -->
- <thumbs>
- <!-- default thumbnail is required -->
- <thumb>template_blank_activity.png</thumb>
- <!-- attributes act as selectors based on chosen parameters -->
- <thumb navType="none">template_blank_activity.png</thumb>
- <thumb navType="tabs">template_blank_activity_tabs.png</thumb>
- <thumb navType="tabs_pager">template_blank_activity_tabs_pager.png</thumb>
- <thumb navType="pager_strip">template_blank_activity_pager.png</thumb>
- <thumb navType="dropdown">template_blank_activity_dropdown.png</thumb>
- </thumbs>
-
- <globals file="globals.xml.ftl" />
- <execute file="recipe.xml.ftl" />
-
-</template>
diff --git a/templates/activities/BlankActivity/template_blank_activity.png b/templates/activities/BlankActivity/template_blank_activity.png
deleted file mode 100644
index 729dd1c..0000000
--- a/templates/activities/BlankActivity/template_blank_activity.png
+++ /dev/null
Binary files differ
diff --git a/templates/activities/BlankActivity/template_blank_activity_dropdown.png b/templates/activities/BlankActivity/template_blank_activity_dropdown.png
deleted file mode 100644
index 09fa2cf..0000000
--- a/templates/activities/BlankActivity/template_blank_activity_dropdown.png
+++ /dev/null
Binary files differ
diff --git a/templates/activities/BlankActivity/template_blank_activity_pager.png b/templates/activities/BlankActivity/template_blank_activity_pager.png
deleted file mode 100644
index 7cd8e0e..0000000
--- a/templates/activities/BlankActivity/template_blank_activity_pager.png
+++ /dev/null
Binary files differ
diff --git a/templates/activities/BlankActivity/template_blank_activity_tabs.png b/templates/activities/BlankActivity/template_blank_activity_tabs.png
deleted file mode 100644
index 86a09d6..0000000
--- a/templates/activities/BlankActivity/template_blank_activity_tabs.png
+++ /dev/null
Binary files differ
diff --git a/templates/activities/BlankActivity/template_blank_activity_tabs_pager.png b/templates/activities/BlankActivity/template_blank_activity_tabs_pager.png
deleted file mode 100644
index 0697a56..0000000
--- a/templates/activities/BlankActivity/template_blank_activity_tabs_pager.png
+++ /dev/null
Binary files differ
diff --git a/templates/activities/FullscreenActivity/globals.xml.ftl b/templates/activities/FullscreenActivity/globals.xml.ftl
deleted file mode 100644
index a416d3a..0000000
--- a/templates/activities/FullscreenActivity/globals.xml.ftl
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0"?>
-<globals>
- <global id="srcOut" value="src/${slashedPackageName(packageName)}" />
- <global id="simpleName" value="${activityToLayout(activityClass)}" />
-</globals>
diff --git a/templates/activities/FullscreenActivity/recipe.xml.ftl b/templates/activities/FullscreenActivity/recipe.xml.ftl
deleted file mode 100644
index 1e41e5f..0000000
--- a/templates/activities/FullscreenActivity/recipe.xml.ftl
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0"?>
-<recipe>
- <merge from="AndroidManifest.xml.ftl" />
-
- <merge from="res/values/attrs.xml" />
- <merge from="res/values/colors.xml" />
- <merge from="res/values/styles.xml" />
- <merge from="res/values-v11/styles.xml" />
- <instantiate from="res/layout/activity_fullscreen.xml.ftl"
- to="res/layout/${layoutName}.xml" />
-
- <merge from="res/values/strings.xml.ftl"
- to="res/values/strings.xml" />
-
- <instantiate from="src/app_package/FullscreenActivity.java.ftl"
- to="${srcOut}/${activityClass}.java" />
- <instantiate from="src/app_package/util/SystemUiHider.java.ftl"
- to="${srcOut}/util/SystemUiHider.java" />
- <instantiate from="src/app_package/util/SystemUiHiderBase.java.ftl"
- to="${srcOut}/util/SystemUiHiderBase.java" />
- <instantiate from="src/app_package/util/SystemUiHiderHoneycomb.java.ftl"
- to="${srcOut}/util/SystemUiHiderHoneycomb.java" />
-
- <open file="res/layout/${layoutName}.xml" />
-</recipe>
diff --git a/templates/activities/FullscreenActivity/root/AndroidManifest.xml.ftl b/templates/activities/FullscreenActivity/root/AndroidManifest.xml.ftl
deleted file mode 100644
index b909732..0000000
--- a/templates/activities/FullscreenActivity/root/AndroidManifest.xml.ftl
+++ /dev/null
@@ -1,26 +0,0 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" >
-
- <application>
- <activity android:name=".${activityClass}"
- <#if isNewProject>
- android:label="@string/app_name"
- <#else>
- android:label="@string/title_${simpleName}"
- </#if>
- android:configChanges="orientation|keyboardHidden|screenSize"
- android:theme="@style/FullscreenTheme"
- <#if buildApi gte 16 && parentActivityClass != "">android:parentActivityName="${parentActivityClass}"</#if>>
- <#if parentActivityClass != "">
- <meta-data android:name="android.support.PARENT_ACTIVITY"
- android:value="${parentActivityClass}" />
- </#if>
- <#if isLauncher>
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </#if>
- </activity>
- </application>
-
-</manifest>
diff --git a/templates/activities/FullscreenActivity/root/res/layout/activity_fullscreen.xml.ftl b/templates/activities/FullscreenActivity/root/res/layout/activity_fullscreen.xml.ftl
deleted file mode 100644
index 39f801a..0000000
--- a/templates/activities/FullscreenActivity/root/res/layout/activity_fullscreen.xml.ftl
+++ /dev/null
@@ -1,46 +0,0 @@
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:background="#0099cc"
- tools:context=".${activityClass}">
-
- <!-- The primary full-screen view. This can be replaced with whatever view
- is needed to present your content, e.g. VideoView, SurfaceView,
- TextureView, etc. -->
- <TextView android:id="@+id/fullscreen_content"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:keepScreenOn="true"
- android:textColor="#33b5e5"
- android:textStyle="bold"
- android:textSize="50sp"
- android:gravity="center"
- android:text="@string/dummy_content" />
-
- <!-- This FrameLayout insets its children based on system windows using
- android:fitsSystemWindows. -->
- <FrameLayout android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:fitsSystemWindows="true">
-
- <LinearLayout android:id="@+id/fullscreen_content_controls"
- style="?buttonBarStyle"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_gravity="bottom|center_horizontal"
- android:background="@color/black_overlay"
- android:orientation="horizontal"
- tools:ignore="UselessParent">
-
- <Button android:id="@+id/dummy_button"
- style="?buttonBarButtonStyle"
- android:layout_width="0dp"
- android:layout_height="wrap_content"
- android:layout_weight="1"
- android:text="@string/dummy_button" />
-
- </LinearLayout>
- </FrameLayout>
-
-</FrameLayout>
diff --git a/templates/activities/FullscreenActivity/root/res/values-v11/styles.xml b/templates/activities/FullscreenActivity/root/res/values-v11/styles.xml
deleted file mode 100644
index feaeb70..0000000
--- a/templates/activities/FullscreenActivity/root/res/values-v11/styles.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-<resources>
-
- <style name="FullscreenTheme" parent="android:Theme.Holo">
- <item name="android:actionBarStyle">@style/FullscreenActionBarStyle</item>
- <item name="android:windowActionBarOverlay">true</item>
- <item name="android:windowBackground">@null</item>
- <item name="buttonBarStyle">?android:attr/buttonBarStyle</item>
- <item name="buttonBarButtonStyle">?android:attr/buttonBarButtonStyle</item>
- </style>
-
- <style name="FullscreenActionBarStyle" parent="android:Widget.Holo.ActionBar">
- <item name="android:background">@color/black_overlay</item>
- </style>
-
-</resources>
diff --git a/templates/activities/FullscreenActivity/root/res/values/attrs.xml b/templates/activities/FullscreenActivity/root/res/values/attrs.xml
deleted file mode 100644
index 0201588..0000000
--- a/templates/activities/FullscreenActivity/root/res/values/attrs.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<resources>
-
- <!-- Declare custom theme attributes that allow changing which styles are
- used for button bars depending on the API level.
- ?android:attr/buttonBarStyle is new as of API 11 so this is
- necessary to support previous API levels. -->
- <declare-styleable name="ButtonBarContainerTheme">
- <attr name="buttonBarStyle" format="reference" />
- <attr name="buttonBarButtonStyle" format="reference" />
- </declare-styleable>
-
-</resources> \ No newline at end of file
diff --git a/templates/activities/FullscreenActivity/root/res/values/colors.xml b/templates/activities/FullscreenActivity/root/res/values/colors.xml
deleted file mode 100644
index 327c060..0000000
--- a/templates/activities/FullscreenActivity/root/res/values/colors.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<resources>
-
- <color name="black_overlay">#66000000</color>
-
-</resources>
diff --git a/templates/activities/FullscreenActivity/root/res/values/strings.xml.ftl b/templates/activities/FullscreenActivity/root/res/values/strings.xml.ftl
deleted file mode 100644
index 00043bd..0000000
--- a/templates/activities/FullscreenActivity/root/res/values/strings.xml.ftl
+++ /dev/null
@@ -1,9 +0,0 @@
-<resources>
-
- <#if !isNewProject>
- <string name="title_${simpleName}">${escapeXmlString(activityTitle)}</string>
- </#if>
- <string name="dummy_button">Dummy Button</string>
- <string name="dummy_content">DUMMY\nCONTENT</string>
-
-</resources>
diff --git a/templates/activities/FullscreenActivity/root/res/values/styles.xml b/templates/activities/FullscreenActivity/root/res/values/styles.xml
deleted file mode 100644
index 48bb968..0000000
--- a/templates/activities/FullscreenActivity/root/res/values/styles.xml
+++ /dev/null
@@ -1,22 +0,0 @@
-<resources>
-
- <style name="FullscreenTheme" parent="android:Theme.NoTitleBar">
- <item name="android:windowContentOverlay">@null</item>
- <item name="android:windowBackground">@null</item>
- <item name="buttonBarStyle">@style/ButtonBar</item>
- <item name="buttonBarButtonStyle">@style/ButtonBarButton</item>
- </style>
-
- <!-- Backward-compatible version of ?android:attr/buttonBarStyle -->
- <style name="ButtonBar">
- <item name="android:paddingLeft">2dp</item>
- <item name="android:paddingTop">5dp</item>
- <item name="android:paddingRight">2dp</item>
- <item name="android:paddingBottom">0dp</item>
- <item name="android:background">@android:drawable/bottom_bar</item>
- </style>
-
- <!-- Backward-compatible version of ?android:attr/buttonBarButtonStyle -->
- <style name="ButtonBarButton" />
-
-</resources>
diff --git a/templates/activities/FullscreenActivity/root/src/app_package/FullscreenActivity.java.ftl b/templates/activities/FullscreenActivity/root/src/app_package/FullscreenActivity.java.ftl
deleted file mode 100644
index 4714244..0000000
--- a/templates/activities/FullscreenActivity/root/src/app_package/FullscreenActivity.java.ftl
+++ /dev/null
@@ -1,197 +0,0 @@
-package ${packageName};
-
-import ${packageName}.util.SystemUiHider;
-
-import android.annotation.TargetApi;
-import android.app.Activity;
-import android.os.Build;
-import android.os.Bundle;
-import android.os.Handler;
-import android.view.MotionEvent;
-import android.view.View;
-<#if parentActivityClass != "">
-import android.view.MenuItem;
-import android.support.v4.app.NavUtils;
-</#if>
-
-/**
- * An example full-screen activity that shows and hides the system UI (i.e.
- * status bar and navigation/system bar) with user interaction.
- *
- * @see SystemUiHider
- */
-public class ${activityClass} extends Activity {
- /**
- * Whether or not the system UI should be auto-hidden after
- * {@link #AUTO_HIDE_DELAY_MILLIS} milliseconds.
- */
- private static final boolean AUTO_HIDE = true;
-
- /**
- * If {@link #AUTO_HIDE} is set, the number of milliseconds to wait after
- * user interaction before hiding the system UI.
- */
- private static final int AUTO_HIDE_DELAY_MILLIS = 3000;
-
- /**
- * If set, will toggle the system UI visibility upon interaction. Otherwise,
- * will show the system UI visibility upon interaction.
- */
- private static final boolean TOGGLE_ON_CLICK = true;
-
- /**
- * The flags to pass to {@link SystemUiHider#getInstance}.
- */
- private static final int HIDER_FLAGS = SystemUiHider.FLAG_HIDE_NAVIGATION;
-
- /**
- * The instance of the {@link SystemUiHider} for this activity.
- */
- private SystemUiHider mSystemUiHider;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- setContentView(R.layout.${layoutName});
- <#if parentActivityClass != "">
- setupActionBar();
- </#if>
-
- final View controlsView = findViewById(R.id.fullscreen_content_controls);
- final View contentView = findViewById(R.id.fullscreen_content);
-
- // Set up an instance of SystemUiHider to control the system UI for
- // this activity.
- mSystemUiHider = SystemUiHider.getInstance(this, contentView, HIDER_FLAGS);
- mSystemUiHider.setup();
- mSystemUiHider
- .setOnVisibilityChangeListener(new SystemUiHider.OnVisibilityChangeListener() {
- // Cached values.
- int mControlsHeight;
- int mShortAnimTime;
-
- @Override
- @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
- public void onVisibilityChange(boolean visible) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
- // If the ViewPropertyAnimator API is available
- // (Honeycomb MR2 and later), use it to animate the
- // in-layout UI controls at the bottom of the
- // screen.
- if (mControlsHeight == 0) {
- mControlsHeight = controlsView.getHeight();
- }
- if (mShortAnimTime == 0) {
- mShortAnimTime = getResources().getInteger(
- android.R.integer.config_shortAnimTime);
- }
- controlsView.animate()
- .translationY(visible ? 0 : mControlsHeight)
- .setDuration(mShortAnimTime);
- } else {
- // If the ViewPropertyAnimator APIs aren't
- // available, simply show or hide the in-layout UI
- // controls.
- controlsView.setVisibility(visible ? View.VISIBLE : View.GONE);
- }
-
- if (visible && AUTO_HIDE) {
- // Schedule a hide().
- delayedHide(AUTO_HIDE_DELAY_MILLIS);
- }
- }
- });
-
- // Set up the user interaction to manually show or hide the system UI.
- contentView.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- if (TOGGLE_ON_CLICK) {
- mSystemUiHider.toggle();
- } else {
- mSystemUiHider.show();
- }
- }
- });
-
- // Upon interacting with UI controls, delay any scheduled hide()
- // operations to prevent the jarring behavior of controls going away
- // while interacting with the UI.
- findViewById(R.id.dummy_button).setOnTouchListener(mDelayHideTouchListener);
- }
-
- @Override
- protected void onPostCreate(Bundle savedInstanceState) {
- super.onPostCreate(savedInstanceState);
-
- // Trigger the initial hide() shortly after the activity has been
- // created, to briefly hint to the user that UI controls
- // are available.
- delayedHide(100);
- }
-
- <#if parentActivityClass != "">
- /**
- * Set up the {@link android.app.ActionBar}, if the API is available.
- */
- @TargetApi(Build.VERSION_CODES.HONEYCOMB)
- private void setupActionBar() {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
- // Show the Up button in the action bar.
- getActionBar().setDisplayHomeAsUpEnabled(true);
- }
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case android.R.id.home:
- // This ID represents the Home or Up button. In the case of this
- // activity, the Up button is shown. Use NavUtils to allow users
- // to navigate up one level in the application structure. For
- // more details, see the Navigation pattern on Android Design:
- //
- // http://developer.android.com/design/patterns/navigation.html#up-vs-back
- //
- // TODO: If Settings has multiple levels, Up should navigate up
- // that hierarchy.
- NavUtils.navigateUpFromSameTask(this);
- return true;
- }
- return super.onOptionsItemSelected(item);
- }
- </#if>
-
- /**
- * Touch listener to use for in-layout UI controls to delay hiding the
- * system UI. This is to prevent the jarring behavior of controls going away
- * while interacting with activity UI.
- */
- View.OnTouchListener mDelayHideTouchListener = new View.OnTouchListener() {
- @Override
- public boolean onTouch(View view, MotionEvent motionEvent) {
- if (AUTO_HIDE) {
- delayedHide(AUTO_HIDE_DELAY_MILLIS);
- }
- return false;
- }
- };
-
- Handler mHideHandler = new Handler();
- Runnable mHideRunnable = new Runnable() {
- @Override
- public void run() {
- mSystemUiHider.hide();
- }
- };
-
- /**
- * Schedules a call to hide() in [delay] milliseconds, canceling any
- * previously scheduled calls.
- */
- private void delayedHide(int delayMillis) {
- mHideHandler.removeCallbacks(mHideRunnable);
- mHideHandler.postDelayed(mHideRunnable, delayMillis);
- }
-}
diff --git a/templates/activities/FullscreenActivity/root/src/app_package/util/SystemUiHider.java.ftl b/templates/activities/FullscreenActivity/root/src/app_package/util/SystemUiHider.java.ftl
deleted file mode 100644
index 28efb77..0000000
--- a/templates/activities/FullscreenActivity/root/src/app_package/util/SystemUiHider.java.ftl
+++ /dev/null
@@ -1,172 +0,0 @@
-package ${packageName}.util;
-
-import android.app.Activity;
-import android.os.Build;
-import android.view.View;
-
-/**
- * A utility class that helps with showing and hiding system UI such as the
- * status bar and navigation/system bar. This class uses backward-compatibility
- * techniques described in <a href=
- * "http://developer.android.com/training/backward-compatible-ui/index.html">
- * Creating Backward-Compatible UIs</a> to ensure that devices running any
- * version of ndroid OS are supported. More specifically, there are separate
- * implementations of this abstract class: for newer devices,
- * {@link #getInstance} will return a {@link SystemUiHiderHoneycomb} instance,
- * while on older devices {@link #getInstance} will return a
- * {@link SystemUiHiderBase} instance.
- * <p>
- * For more on system bars, see <a href=
- * "http://developer.android.com/design/get-started/ui-overview.html#system-bars"
- * > System Bars</a>.
- *
- * @see android.view.View#setSystemUiVisibility(int)
- * @see android.view.WindowManager.LayoutParams#FLAG_FULLSCREEN
- */
-public abstract class SystemUiHider {
- /**
- * When this flag is set, the
- * {@link android.view.WindowManager.LayoutParams#FLAG_LAYOUT_IN_SCREEN}
- * flag will be set on older devices, making the status bar "float" on top
- * of the activity layout. This is most useful when there are no controls at
- * the top of the activity layout.
- * <p>
- * This flag isn't used on newer devices because the <a
- * href="http://developer.android.com/design/patterns/actionbar.html">action
- * bar</a>, the most important structural element of an Android app, should
- * be visible and not obscured by the system UI.
- */
- public static final int FLAG_LAYOUT_IN_SCREEN_OLDER_DEVICES = 0x1;
-
- /**
- * When this flag is set, {@link #show()} and {@link #hide()} will toggle
- * the visibility of the status bar. If there is a navigation bar, show and
- * hide will toggle low profile mode.
- */
- public static final int FLAG_FULLSCREEN = 0x2;
-
- /**
- * When this flag is set, {@link #show()} and {@link #hide()} will toggle
- * the visibility of the navigation bar, if it's present on the device and
- * the device allows hiding it. In cases where the navigation bar is present
- * but cannot be hidden, show and hide will toggle low profile mode.
- */
- public static final int FLAG_HIDE_NAVIGATION = FLAG_FULLSCREEN | 0x4;
-
- /**
- * The activity associated with this UI hider object.
- */
- protected Activity mActivity;
-
- /**
- * The view on which {@link View#setSystemUiVisibility(int)} will be called.
- */
- protected View mAnchorView;
-
- /**
- * The current UI hider flags.
- *
- * @see #FLAG_FULLSCREEN
- * @see #FLAG_HIDE_NAVIGATION
- * @see #FLAG_LAYOUT_IN_SCREEN_OLDER_DEVICES
- */
- protected int mFlags;
-
- /**
- * The current visibility callback.
- */
- protected OnVisibilityChangeListener mOnVisibilityChangeListener = sDummyListener;
-
- /**
- * Creates and returns an instance of {@link SystemUiHider} that is
- * appropriate for this device. The object will be either a
- * {@link SystemUiHiderBase} or {@link SystemUiHiderHoneycomb} depending on
- * the device.
- *
- * @param activity The activity whose window's system UI should be
- * controlled by this class.
- * @param anchorView The view on which
- * {@link View#setSystemUiVisibility(int)} will be called.
- * @param flags Either 0 or any combination of {@link #FLAG_FULLSCREEN},
- * {@link #FLAG_HIDE_NAVIGATION}, and
- * {@link #FLAG_LAYOUT_IN_SCREEN_OLDER_DEVICES}.
- */
- public static SystemUiHider getInstance(Activity activity, View anchorView, int flags) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
- return new SystemUiHiderHoneycomb(activity, anchorView, flags);
- } else {
- return new SystemUiHiderBase(activity, anchorView, flags);
- }
- }
-
- protected SystemUiHider(Activity activity, View anchorView, int flags) {
- mActivity = activity;
- mAnchorView = anchorView;
- mFlags = flags;
- }
-
- /**
- * Sets up the system UI hider. Should be called from
- * {@link Activity#onCreate}.
- */
- public abstract void setup();
-
- /**
- * Returns whether or not the system UI is visible.
- */
- public abstract boolean isVisible();
-
- /**
- * Hide the system UI.
- */
- public abstract void hide();
-
- /**
- * Show the system UI.
- */
- public abstract void show();
-
- /**
- * Toggle the visibility of the system UI.
- */
- public void toggle() {
- if (isVisible()) {
- hide();
- } else {
- show();
- }
- }
-
- /**
- * Registers a callback, to be triggered when the system UI visibility
- * changes.
- */
- public void setOnVisibilityChangeListener(OnVisibilityChangeListener listener) {
- if (listener == null) {
- listener = sDummyListener;
- }
-
- mOnVisibilityChangeListener = listener;
- }
-
- /**
- * A dummy no-op callback for use when there is no other listener set.
- */
- private static OnVisibilityChangeListener sDummyListener = new OnVisibilityChangeListener() {
- @Override
- public void onVisibilityChange(boolean visible) {
- }
- };
-
- /**
- * A callback interface used to listen for system UI visibility changes.
- */
- public interface OnVisibilityChangeListener {
- /**
- * Called when the system UI visibility has changed.
- *
- * @param visible True if the system UI is visible.
- */
- public void onVisibilityChange(boolean visible);
- }
-}
diff --git a/templates/activities/FullscreenActivity/root/src/app_package/util/SystemUiHiderBase.java.ftl b/templates/activities/FullscreenActivity/root/src/app_package/util/SystemUiHiderBase.java.ftl
deleted file mode 100644
index da08842..0000000
--- a/templates/activities/FullscreenActivity/root/src/app_package/util/SystemUiHiderBase.java.ftl
+++ /dev/null
@@ -1,63 +0,0 @@
-package ${packageName}.util;
-
-import android.app.Activity;
-import android.view.View;
-import android.view.WindowManager;
-
-/**
- * A base implementation of {@link SystemUiHider}. Uses APIs available in all
- * API levels to show and hide the status bar.
- */
-public class SystemUiHiderBase extends SystemUiHider {
- /**
- * Whether or not the system UI is currently visible. This is a cached value
- * from calls to {@link #hide()} and {@link #show()}.
- */
- private boolean mVisible = true;
-
- /**
- * Constructor not intended to be called by clients. Use
- * {@link SystemUiHider#getInstance} to obtain an instance.
- */
- protected SystemUiHiderBase(Activity activity, View anchorView, int flags) {
- super(activity, anchorView, flags);
- }
-
- @Override
- public void setup() {
- if ((mFlags & FLAG_LAYOUT_IN_SCREEN_OLDER_DEVICES) == 0) {
- mActivity.getWindow().setFlags(
- WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
- | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
- WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
- | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
- }
- }
-
- @Override
- public boolean isVisible() {
- return mVisible;
- }
-
- @Override
- public void hide() {
- if ((mFlags & FLAG_FULLSCREEN) != 0) {
- mActivity.getWindow().setFlags(
- WindowManager.LayoutParams.FLAG_FULLSCREEN,
- WindowManager.LayoutParams.FLAG_FULLSCREEN);
- }
- mOnVisibilityChangeListener.onVisibilityChange(false);
- mVisible = false;
- }
-
- @Override
- public void show() {
- if ((mFlags & FLAG_FULLSCREEN) != 0) {
- mActivity.getWindow().setFlags(
- 0,
- WindowManager.LayoutParams.FLAG_FULLSCREEN);
- }
- mOnVisibilityChangeListener.onVisibilityChange(true);
- mVisible = true;
- }
-}
diff --git a/templates/activities/FullscreenActivity/root/src/app_package/util/SystemUiHiderHoneycomb.java.ftl b/templates/activities/FullscreenActivity/root/src/app_package/util/SystemUiHiderHoneycomb.java.ftl
deleted file mode 100644
index f2460eb..0000000
--- a/templates/activities/FullscreenActivity/root/src/app_package/util/SystemUiHiderHoneycomb.java.ftl
+++ /dev/null
@@ -1,133 +0,0 @@
-package ${packageName}.util;
-
-import android.annotation.TargetApi;
-import android.app.Activity;
-import android.os.Build;
-import android.view.View;
-import android.view.WindowManager;
-
-/**
- * An API 11+ implementation of {@link SystemUiHider}. Uses APIs available in
- * Honeycomb and later (specifically {@link View#setSystemUiVisibility(int)}) to
- * show and hide the system UI.
- */
-@TargetApi(Build.VERSION_CODES.HONEYCOMB)
-public class SystemUiHiderHoneycomb extends SystemUiHiderBase {
- /**
- * Flags for {@link View#setSystemUiVisibility(int)} to use when showing the
- * system UI.
- */
- private int mShowFlags;
-
- /**
- * Flags for {@link View#setSystemUiVisibility(int)} to use when hiding the
- * system UI.
- */
- private int mHideFlags;
-
- /**
- * Flags to test against the first parameter in
- * {@link android.view.View.OnSystemUiVisibilityChangeListener#onSystemUiVisibilityChange(int)}
- * to determine the system UI visibility state.
- */
- private int mTestFlags;
-
- /**
- * Whether or not the system UI is currently visible. This is cached from
- * {@link android.view.View.OnSystemUiVisibilityChangeListener}.
- */
- private boolean mVisible = true;
-
- /**
- * Constructor not intended to be called by clients. Use
- * {@link SystemUiHider#getInstance} to obtain an instance.
- */
- protected SystemUiHiderHoneycomb(Activity activity, View anchorView, int flags) {
- super(activity, anchorView, flags);
-
- mShowFlags = View.SYSTEM_UI_FLAG_VISIBLE;
- mHideFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;
- mTestFlags = View.SYSTEM_UI_FLAG_LOW_PROFILE;
-
- if ((mFlags & FLAG_FULLSCREEN) != 0) {
- // If the client requested fullscreen, add flags relevant to hiding
- // the status bar. Note that some of these constants are new as of
- // API 16 (Jelly Bean). It is safe to use them, as they are inlined
- // at compile-time and do nothing on pre-Jelly Bean devices.
- mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
- mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
- | View.SYSTEM_UI_FLAG_FULLSCREEN;
- }
-
- if ((mFlags & FLAG_HIDE_NAVIGATION) != 0) {
- // If the client requested hiding navigation, add relevant flags.
- mShowFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
- mHideFlags |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
- | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
- mTestFlags = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
- }
- }
-
- /** {@inheritDoc} */
- @Override
- public void setup() {
- mAnchorView.setOnSystemUiVisibilityChangeListener(mSystemUiVisibilityChangeListener);
- }
-
- /** {@inheritDoc} */
- @Override
- public void hide() {
- mAnchorView.setSystemUiVisibility(mHideFlags);
- }
-
- /** {@inheritDoc} */
- @Override
- public void show() {
- mAnchorView.setSystemUiVisibility(mShowFlags);
- }
-
- /** {@inheritDoc} */
- @Override
- public boolean isVisible() {
- return mVisible;
- }
-
- private View.OnSystemUiVisibilityChangeListener mSystemUiVisibilityChangeListener
- = new View.OnSystemUiVisibilityChangeListener() {
- @Override
- public void onSystemUiVisibilityChange(int vis) {
- // Test against mTestFlags to see if the system UI is visible.
- if ((vis & mTestFlags) != 0) {
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
- // Pre-Jelly Bean, we must manually hide the action bar
- // and use the old window flags API.
- mActivity.getActionBar().hide();
- mActivity.getWindow().setFlags(
- WindowManager.LayoutParams.FLAG_FULLSCREEN,
- WindowManager.LayoutParams.FLAG_FULLSCREEN);
- }
-
- // Trigger the registered listener and cache the visibility
- // state.
- mOnVisibilityChangeListener.onVisibilityChange(false);
- mVisible = false;
-
- } else {
- mAnchorView.setSystemUiVisibility(mShowFlags);
- if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
- // Pre-Jelly Bean, we must manually show the action bar
- // and use the old window flags API.
- mActivity.getActionBar().show();
- mActivity.getWindow().setFlags(
- 0,
- WindowManager.LayoutParams.FLAG_FULLSCREEN);
- }
-
- // Trigger the registered listener and cache the visibility
- // state.
- mOnVisibilityChangeListener.onVisibilityChange(true);
- mVisible = true;
- }
- }
- };
-}
diff --git a/templates/activities/FullscreenActivity/template.xml b/templates/activities/FullscreenActivity/template.xml
deleted file mode 100644
index 165854c..0000000
--- a/templates/activities/FullscreenActivity/template.xml
+++ /dev/null
@@ -1,68 +0,0 @@
-<?xml version="1.0"?>
-<template
- format="3"
- revision="2"
- name="Fullscreen Activity"
- description="Creates a new activity that toggles the visibility of the system UI (status and navigation bars) and action bar upon user interaction."
- minApi="4"
- minBuildApi="16">
- <dependency name="android-support-v4" revision="8" />
-
- <category value="Activities" />
-
- <parameter
- id="activityClass"
- name="Activity Name"
- type="string"
- constraints="class|unique|nonempty"
- default="FullscreenActivity"
- help="The name of the activity class to create" />
-
- <parameter
- id="layoutName"
- name="Layout Name"
- type="string"
- constraints="layout|unique|nonempty"
- suggest="${activityToLayout(activityClass)}"
- default="activity_fullscreen"
- help="The name of the layout to create for the activity" />
-
- <parameter
- id="activityTitle"
- name="Title"
- type="string"
- constraints="nonempty"
- default="FullscreenActivity"
- suggest="${activityClass}"
- help="The name of the activity." />
-
- <parameter
- id="isLauncher"
- name="Launcher Activity"
- type="boolean"
- default="false"
- help="If true, this activity will have a CATEGORY_LAUNCHER intent filter, making it visible in the launcher" />
-
- <parameter
- id="parentActivityClass"
- name="Hierarchical Parent"
- type="string"
- constraints="activity|exists|empty"
- default=""
- help="The hierarchical parent activity, used to provide a default implementation for the 'Up' button" />
-
- <parameter
- id="packageName"
- name="Package name"
- type="string"
- constraints="package"
- default="com.mycompany.myapp" />
-
- <thumbs>
- <thumb>template_fullscreen_activity.png</thumb>
- </thumbs>
-
- <globals file="globals.xml.ftl" />
- <execute file="recipe.xml.ftl" />
-
-</template>
diff --git a/templates/activities/FullscreenActivity/template_fullscreen_activity.png b/templates/activities/FullscreenActivity/template_fullscreen_activity.png
deleted file mode 100644
index a8597b2..0000000
--- a/templates/activities/FullscreenActivity/template_fullscreen_activity.png
+++ /dev/null
Binary files differ
diff --git a/templates/activities/LoginActivity/globals.xml.ftl b/templates/activities/LoginActivity/globals.xml.ftl
deleted file mode 100644
index 62dfd8d..0000000
--- a/templates/activities/LoginActivity/globals.xml.ftl
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0"?>
-<globals>
- <global id="srcOut" value="src/${slashedPackageName(packageName)}" />
- <global id="menuName" value="${classToResource(activityClass)}" />
- <global id="simpleName" value="${activityToLayout(activityClass)}" />
-</globals>
diff --git a/templates/activities/LoginActivity/recipe.xml.ftl b/templates/activities/LoginActivity/recipe.xml.ftl
deleted file mode 100644
index ece4285..0000000
--- a/templates/activities/LoginActivity/recipe.xml.ftl
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0"?>
-<recipe>
- <merge from="AndroidManifest.xml.ftl" />
-
- <merge from="res/values/styles.xml" />
- <merge from="res/values-large/styles.xml" />
- <copy from="res/menu/activity_login.xml"
- to="res/menu/${menuName}.xml" />
- <instantiate from="res/layout/activity_login.xml.ftl"
- to="res/layout/${layoutName}.xml" />
-
- <instantiate from="res/values/strings.xml.ftl"
- to="res/values/strings_${simpleName}.xml" />
-
- <instantiate from="src/app_package/LoginActivity.java.ftl"
- to="${srcOut}/${activityClass}.java" />
-
- <open file="res/layout/${layoutName}.xml" />
-</recipe>
diff --git a/templates/activities/LoginActivity/root/AndroidManifest.xml.ftl b/templates/activities/LoginActivity/root/AndroidManifest.xml.ftl
deleted file mode 100644
index c5f02d2..0000000
--- a/templates/activities/LoginActivity/root/AndroidManifest.xml.ftl
+++ /dev/null
@@ -1,19 +0,0 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" >
-
- <application>
- <activity android:name=".${activityClass}"
- <#if isNewProject>
- android:label="@string/app_name"
- <#else>
- android:label="@string/title_${simpleName}"
- </#if>
- android:windowSoftInputMode="adjustResize|stateVisible"
- <#if buildApi gte 16 && parentActivityClass != "">android:parentActivityName="${parentActivityClass}"</#if>>
- <#if parentActivityClass != "">
- <meta-data android:name="android.support.PARENT_ACTIVITY"
- android:value="${parentActivityClass}" />
- </#if>
- </activity>
- </application>
-
-</manifest>
diff --git a/templates/activities/LoginActivity/root/res/layout/activity_login.xml.ftl b/templates/activities/LoginActivity/root/res/layout/activity_login.xml.ftl
deleted file mode 100644
index 9434e5b..0000000
--- a/templates/activities/LoginActivity/root/res/layout/activity_login.xml.ftl
+++ /dev/null
@@ -1,69 +0,0 @@
-<merge xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- tools:context=".${activityClass}">
-
- <!-- Login progress -->
- <LinearLayout android:id="@+id/login_status"
- android:visibility="gone"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_gravity="center"
- android:gravity="center_horizontal"
- android:orientation="vertical">
- <ProgressBar style="?android:attr/progressBarStyleLarge"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginBottom="8dp"/>
- <TextView
- android:id="@+id/login_status_message"
- android:textAppearance="?android:attr/textAppearanceMedium"
- android:fontFamily="sans-serif-light"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginBottom="16dp"
- android:text="@string/login_progress_signing_in" />
- </LinearLayout>
-
- <!-- Login form -->
- <ScrollView
- android:id="@+id/login_form"
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <LinearLayout style="@style/LoginFormContainer"
- android:orientation="vertical">
-
- <EditText
- android:id="@+id/email"
- android:singleLine="true"
- android:maxLines="1"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:inputType="textEmailAddress"
- android:hint="@string/prompt_email" />
-
- <EditText
- android:id="@+id/password"
- android:singleLine="true"
- android:maxLines="1"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:hint="@string/prompt_password"
- android:inputType="textPassword"
- android:imeActionLabel="@string/action_sign_in_short"
- android:imeActionId="@+id/login"
- android:imeOptions="actionUnspecified" />
-
- <Button android:id="@+id/sign_in_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_marginTop="16dp"
- android:text="@string/action_sign_in_register"
- android:paddingLeft="32dp"
- android:paddingRight="32dp"
- android:layout_gravity="right" />
-
- </LinearLayout>
-
- </ScrollView>
-</merge>
diff --git a/templates/activities/LoginActivity/root/res/menu/activity_login.xml b/templates/activities/LoginActivity/root/res/menu/activity_login.xml
deleted file mode 100644
index 2965794..0000000
--- a/templates/activities/LoginActivity/root/res/menu/activity_login.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-<menu xmlns:android="http://schemas.android.com/apk/res/android">
- <item android:id="@+id/action_forgot_password"
- android:title="@string/action_forgot_password"
- android:showAsAction="never" />
-</menu>
diff --git a/templates/activities/LoginActivity/root/res/values-large/styles.xml b/templates/activities/LoginActivity/root/res/values-large/styles.xml
deleted file mode 100644
index 7b56acd..0000000
--- a/templates/activities/LoginActivity/root/res/values-large/styles.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<resources>
-
- <style name="LoginFormContainer">
- <item name="android:layout_width">400dp</item>
- <item name="android:layout_height">wrap_content</item>
- <item name="android:layout_gravity">center</item>
- <item name="android:padding">16dp</item>
- </style>
-
-</resources>
diff --git a/templates/activities/LoginActivity/root/res/values/strings.xml.ftl b/templates/activities/LoginActivity/root/res/values/strings.xml.ftl
deleted file mode 100644
index def1b2f..0000000
--- a/templates/activities/LoginActivity/root/res/values/strings.xml.ftl
+++ /dev/null
@@ -1,21 +0,0 @@
-<resources>
- <#if !isNewProject>
- <string name="title_${simpleName}">${escapeXmlString(activityTitle)}</string>
- </#if>
-
- <!-- Strings related to login -->
- <string name="prompt_email">Email</string>
- <string name="prompt_password">Password</string>
-
- <string name="action_sign_in_register"><b>Sign in</b> or register</string>
- <string name="action_sign_in_short">Sign in</string>
-
- <string name="action_forgot_password">Recover lost password</string>
-
- <string name="login_progress_signing_in">Signing in&#8230;</string>
-
- <string name="error_invalid_email">This email address is invalid</string>
- <string name="error_invalid_password">This password is too short</string>
- <string name="error_incorrect_password">This password is incorrect</string>
- <string name="error_field_required">This field is required</string>
-</resources>
diff --git a/templates/activities/LoginActivity/root/res/values/styles.xml b/templates/activities/LoginActivity/root/res/values/styles.xml
deleted file mode 100644
index eaec28d..0000000
--- a/templates/activities/LoginActivity/root/res/values/styles.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<resources>
-
- <style name="LoginFormContainer">
- <item name="android:layout_width">match_parent</item>
- <item name="android:layout_height">wrap_content</item>
- <item name="android:padding">16dp</item>
- </style>
-
-</resources>
diff --git a/templates/activities/LoginActivity/root/src/app_package/LoginActivity.java.ftl b/templates/activities/LoginActivity/root/src/app_package/LoginActivity.java.ftl
deleted file mode 100644
index 8defdc7..0000000
--- a/templates/activities/LoginActivity/root/src/app_package/LoginActivity.java.ftl
+++ /dev/null
@@ -1,278 +0,0 @@
-package ${packageName};
-
-import android.animation.Animator;
-import android.animation.AnimatorListenerAdapter;
-import android.annotation.TargetApi;
-import android.app.Activity;
-import android.os.AsyncTask;
-import android.os.Build;
-import android.os.Bundle;
-import android.text.TextUtils;
-import android.view.KeyEvent;
-import android.view.Menu;
-import android.view.View;
-import android.view.inputmethod.EditorInfo;
-import android.widget.EditText;
-import android.widget.TextView;
-<#if parentActivityClass != "">
-import android.view.MenuItem;
-import android.support.v4.app.NavUtils;
-</#if>
-
-/**
- * Activity which displays a login screen to the user, offering registration as
- * well.
- */
-public class ${activityClass} extends Activity {
- /**
- * A dummy authentication store containing known user names and passwords.
- * TODO: remove after connecting to a real authentication system.
- */
- private static final String[] DUMMY_CREDENTIALS = new String[]{
- "foo@example.com:hello",
- "bar@example.com:world"
- };
-
- /**
- * The default email to populate the email field with.
- */
- public static final String EXTRA_EMAIL = "com.example.android.authenticatordemo.extra.EMAIL";
-
- /**
- * Keep track of the login task to ensure we can cancel it if requested.
- */
- private UserLoginTask mAuthTask = null;
-
- // Values for email and password at the time of the login attempt.
- private String mEmail;
- private String mPassword;
-
- // UI references.
- private EditText mEmailView;
- private EditText mPasswordView;
- private View mLoginFormView;
- private View mLoginStatusView;
- private TextView mLoginStatusMessageView;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- setContentView(R.layout.${layoutName});
- <#if parentActivityClass != "">
- setupActionBar();
- </#if>
-
- // Set up the login form.
- mEmail = getIntent().getStringExtra(EXTRA_EMAIL);
- mEmailView = (EditText) findViewById(R.id.email);
- mEmailView.setText(mEmail);
-
- mPasswordView = (EditText) findViewById(R.id.password);
- mPasswordView.setOnEditorActionListener(new TextView.OnEditorActionListener() {
- @Override
- public boolean onEditorAction(TextView textView, int id, KeyEvent keyEvent) {
- if (id == R.id.login || id == EditorInfo.IME_NULL) {
- attemptLogin();
- return true;
- }
- return false;
- }
- });
-
- mLoginFormView = findViewById(R.id.login_form);
- mLoginStatusView = findViewById(R.id.login_status);
- mLoginStatusMessageView = (TextView) findViewById(R.id.login_status_message);
-
- findViewById(R.id.sign_in_button).setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View view) {
- attemptLogin();
- }
- });
- }
-
- <#if parentActivityClass != "">
- /**
- * Set up the {@link android.app.ActionBar}, if the API is available.
- */
- @TargetApi(Build.VERSION_CODES.HONEYCOMB)
- private void setupActionBar() {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
- // Show the Up button in the action bar.
- getActionBar().setDisplayHomeAsUpEnabled(true);
- }
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case android.R.id.home:
- // This ID represents the Home or Up button. In the case of this
- // activity, the Up button is shown. Use NavUtils to allow users
- // to navigate up one level in the application structure. For
- // more details, see the Navigation pattern on Android Design:
- //
- // http://developer.android.com/design/patterns/navigation.html#up-vs-back
- //
- // TODO: If Settings has multiple levels, Up should navigate up
- // that hierarchy.
- NavUtils.navigateUpFromSameTask(this);
- return true;
- }
- return super.onOptionsItemSelected(item);
- }
- </#if>
-
- @Override
- public boolean onCreateOptionsMenu(Menu menu) {
- super.onCreateOptionsMenu(menu);
- getMenuInflater().inflate(R.menu.${menuName}, menu);
- return true;
- }
-
- /**
- * Attempts to sign in or register the account specified by the login form.
- * If there are form errors (invalid email, missing fields, etc.), the
- * errors are presented and no actual login attempt is made.
- */
- public void attemptLogin() {
- if (mAuthTask != null) {
- return;
- }
-
- // Reset errors.
- mEmailView.setError(null);
- mPasswordView.setError(null);
-
- // Store values at the time of the login attempt.
- mEmail = mEmailView.getText().toString();
- mPassword = mPasswordView.getText().toString();
-
- boolean cancel = false;
- View focusView = null;
-
- // Check for a valid password.
- if (TextUtils.isEmpty(mPassword)) {
- mPasswordView.setError(getString(R.string.error_field_required));
- focusView = mPasswordView;
- cancel = true;
- } else if (mPassword.length() < 4) {
- mPasswordView.setError(getString(R.string.error_invalid_password));
- focusView = mPasswordView;
- cancel = true;
- }
-
- // Check for a valid email address.
- if (TextUtils.isEmpty(mEmail)) {
- mEmailView.setError(getString(R.string.error_field_required));
- focusView = mEmailView;
- cancel = true;
- } else if (!mEmail.contains("@")) {
- mEmailView.setError(getString(R.string.error_invalid_email));
- focusView = mEmailView;
- cancel = true;
- }
-
- if (cancel) {
- // There was an error; don't attempt login and focus the first
- // form field with an error.
- focusView.requestFocus();
- } else {
- // Show a progress spinner, and kick off a background task to
- // perform the user login attempt.
- mLoginStatusMessageView.setText(R.string.login_progress_signing_in);
- showProgress(true);
- mAuthTask = new UserLoginTask();
- mAuthTask.execute((Void) null);
- }
- }
-
- /**
- * Shows the progress UI and hides the login form.
- */
- @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
- private void showProgress(final boolean show) {
- // On Honeycomb MR2 we have the ViewPropertyAnimator APIs, which allow
- // for very easy animations. If available, use these APIs to fade-in
- // the progress spinner.
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB_MR2) {
- int shortAnimTime = getResources().getInteger(android.R.integer.config_shortAnimTime);
-
- mLoginStatusView.setVisibility(View.VISIBLE);
- mLoginStatusView.animate()
- .setDuration(shortAnimTime)
- .alpha(show ? 1 : 0)
- .setListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- mLoginStatusView.setVisibility(show ? View.VISIBLE : View.GONE);
- }
- });
-
- mLoginFormView.setVisibility(View.VISIBLE);
- mLoginFormView.animate()
- .setDuration(shortAnimTime)
- .alpha(show ? 0 : 1)
- .setListener(new AnimatorListenerAdapter() {
- @Override
- public void onAnimationEnd(Animator animation) {
- mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
- }
- });
- } else {
- // The ViewPropertyAnimator APIs are not available, so simply show
- // and hide the relevant UI components.
- mLoginStatusView.setVisibility(show ? View.VISIBLE : View.GONE);
- mLoginFormView.setVisibility(show ? View.GONE : View.VISIBLE);
- }
- }
-
- /**
- * Represents an asynchronous login/registration task used to authenticate
- * the user.
- */
- public class UserLoginTask extends AsyncTask<Void, Void, Boolean> {
- @Override
- protected Boolean doInBackground(Void... params) {
- // TODO: attempt authentication against a network service.
-
- try {
- // Simulate network access.
- Thread.sleep(2000);
- } catch (InterruptedException e) {
- return false;
- }
-
- for (String credential : DUMMY_CREDENTIALS) {
- String[] pieces = credential.split(":");
- if (pieces[0].equals(mEmail)) {
- // Account exists, return true if the password matches.
- return pieces[1].equals(mPassword);
- }
- }
-
- // TODO: register the new account here.
- return true;
- }
-
- @Override
- protected void onPostExecute(final Boolean success) {
- mAuthTask = null;
- showProgress(false);
-
- if (success) {
- finish();
- } else {
- mPasswordView.setError(getString(R.string.error_incorrect_password));
- mPasswordView.requestFocus();
- }
- }
-
- @Override
- protected void onCancelled() {
- mAuthTask = null;
- showProgress(false);
- }
- }
-}
diff --git a/templates/activities/LoginActivity/template.xml b/templates/activities/LoginActivity/template.xml
deleted file mode 100644
index 40a413a..0000000
--- a/templates/activities/LoginActivity/template.xml
+++ /dev/null
@@ -1,60 +0,0 @@
-<?xml version="1.0"?>
-<template
- format="3"
- revision="2"
- name="Login Activity"
- description="Creates a new login activity, allowing users to enter an email address and password to log in to or register with your application."
- minApi="3"
- minBuildApi="13">
- <dependency name="android-support-v4" revision="8" />
-
- <category value="Activities" />
-
- <parameter
- id="activityClass"
- name="Activity Name"
- type="string"
- constraints="class|unique|nonempty"
- default="LoginActivity"
- help="The name of the activity class to create" />
-
- <parameter
- id="layoutName"
- name="Layout Name"
- type="string"
- constraints="layout|unique|nonempty"
- suggest="${activityToLayout(activityClass)}"
- default="activity_login"
- help="The name of the layout to create for the activity" />
-
- <parameter
- id="activityTitle"
- name="Title"
- type="string"
- constraints="nonempty"
- default="Sign in"
- help="The name of the activity." />
-
- <parameter
- id="parentActivityClass"
- name="Hierarchical Parent"
- type="string"
- constraints="activity|exists|empty"
- default=""
- help="The hierarchical parent activity, used to provide a default implementation for the 'Up' button" />
-
- <parameter
- id="packageName"
- name="Package name"
- type="string"
- constraints="package"
- default="com.mycompany.myapp" />
-
- <thumbs>
- <thumb>template_login_activity.png</thumb>
- </thumbs>
-
- <globals file="globals.xml.ftl" />
- <execute file="recipe.xml.ftl" />
-
-</template>
diff --git a/templates/activities/LoginActivity/template_login_activity.png b/templates/activities/LoginActivity/template_login_activity.png
deleted file mode 100644
index 0f9bfc0..0000000
--- a/templates/activities/LoginActivity/template_login_activity.png
+++ /dev/null
Binary files differ
diff --git a/templates/activities/MasterDetailFlow/globals.xml.ftl b/templates/activities/MasterDetailFlow/globals.xml.ftl
deleted file mode 100644
index 952e278..0000000
--- a/templates/activities/MasterDetailFlow/globals.xml.ftl
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0"?>
-<globals>
- <global id="srcOut" value="src/${slashedPackageName(packageName)}" />
- <global id="CollectionName" value="${extractLetters(objectKind)}List" />
- <global id="collection_name" value="${extractLetters(objectKind?lower_case)}_list" />
- <global id="DetailName" value="${extractLetters(objectKind)}Detail" />
- <global id="detail_name" value="${extractLetters(objectKind?lower_case)}_detail" />
-</globals>
diff --git a/templates/activities/MasterDetailFlow/recipe.xml.ftl b/templates/activities/MasterDetailFlow/recipe.xml.ftl
deleted file mode 100644
index 8b09c84..0000000
--- a/templates/activities/MasterDetailFlow/recipe.xml.ftl
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0"?>
-<recipe>
- <merge from="AndroidManifest.xml.ftl" />
-
- <merge from="res/values-large/refs.xml.ftl" />
- <merge from="res/values-sw600dp/refs.xml.ftl" />
- <merge from="res/values/strings.xml.ftl" />
-
- <instantiate from="res/layout/activity_content_detail.xml.ftl"
- to="res/layout/activity_${detail_name}.xml" />
- <instantiate from="res/layout/activity_content_list.xml.ftl"
- to="res/layout/activity_${collection_name}.xml" />
- <instantiate from="res/layout/activity_content_twopane.xml.ftl"
- to="res/layout/activity_${extractLetters(objectKind?lower_case)}_twopane.xml" />
- <instantiate from="res/layout/fragment_content_detail.xml.ftl"
- to="res/layout/fragment_${detail_name}.xml" />
-
- <instantiate from="src/app_package/ContentDetailActivity.java.ftl"
- to="${srcOut}/${DetailName}Activity.java" />
- <instantiate from="src/app_package/ContentDetailFragment.java.ftl"
- to="${srcOut}/${DetailName}Fragment.java" />
- <instantiate from="src/app_package/ContentListActivity.java.ftl"
- to="${srcOut}/${CollectionName}Activity.java" />
- <instantiate from="src/app_package/ContentListFragment.java.ftl"
- to="${srcOut}/${CollectionName}Fragment.java" />
- <instantiate from="src/app_package/dummy/DummyContent.java.ftl"
- to="${srcOut}/dummy/DummyContent.java" />
-</recipe>
diff --git a/templates/activities/MasterDetailFlow/root/AndroidManifest.xml.ftl b/templates/activities/MasterDetailFlow/root/AndroidManifest.xml.ftl
deleted file mode 100644
index 4707bd6..0000000
--- a/templates/activities/MasterDetailFlow/root/AndroidManifest.xml.ftl
+++ /dev/null
@@ -1,31 +0,0 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
-
- <application>
- <activity android:name=".${CollectionName}Activity"
- <#if isNewProject>
- android:label="@string/app_name"
- <#else>
- android:label="@string/title_${collection_name}"
- </#if>
- <#if buildApi gte 16 && parentActivityClass != "">android:parentActivityName="${parentActivityClass}"</#if>>
- <#if parentActivityClass != "">
- <meta-data android:name="android.support.PARENT_ACTIVITY"
- android:value="${parentActivityClass}" />
- </#if>
- <#if isLauncher>
- <intent-filter>
- <action android:name="android.intent.action.MAIN" />
- <category android:name="android.intent.category.LAUNCHER" />
- </intent-filter>
- </#if>
- </activity>
-
- <activity android:name=".${DetailName}Activity"
- android:label="@string/title_${detail_name}"
- <#if buildApi gte 16>android:parentActivityName=".${CollectionName}Activity"</#if>>
- <meta-data android:name="android.support.PARENT_ACTIVITY"
- android:value=".${CollectionName}Activity" />
- </activity>
- </application>
-
-</manifest>
diff --git a/templates/activities/MasterDetailFlow/root/res/layout/activity_content_detail.xml.ftl b/templates/activities/MasterDetailFlow/root/res/layout/activity_content_detail.xml.ftl
deleted file mode 100644
index ddc1ecc..0000000
--- a/templates/activities/MasterDetailFlow/root/res/layout/activity_content_detail.xml.ftl
+++ /dev/null
@@ -1,7 +0,0 @@
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:id="@+id/${detail_name}_container"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- tools:context=".${DetailName}Activity"
- tools:ignore="MergeRootFrame" />
diff --git a/templates/activities/MasterDetailFlow/root/res/layout/activity_content_list.xml.ftl b/templates/activities/MasterDetailFlow/root/res/layout/activity_content_list.xml.ftl
deleted file mode 100644
index 065cd42..0000000
--- a/templates/activities/MasterDetailFlow/root/res/layout/activity_content_list.xml.ftl
+++ /dev/null
@@ -1,10 +0,0 @@
-<fragment xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:id="@+id/${collection_name}"
- android:name="${packageName}.${CollectionName}Fragment"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_marginLeft="16dp"
- android:layout_marginRight="16dp"
- tools:context=".${CollectionName}Activity"
- tools:layout="@android:layout/list_content" />
diff --git a/templates/activities/MasterDetailFlow/root/res/layout/activity_content_twopane.xml.ftl b/templates/activities/MasterDetailFlow/root/res/layout/activity_content_twopane.xml.ftl
deleted file mode 100644
index 575e9e6..0000000
--- a/templates/activities/MasterDetailFlow/root/res/layout/activity_content_twopane.xml.ftl
+++ /dev/null
@@ -1,38 +0,0 @@
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:layout_marginLeft="16dp"
- android:layout_marginRight="16dp"
- android:baselineAligned="false"
- android:divider="?android:attr/dividerHorizontal"
- android:orientation="horizontal"
- android:showDividers="middle"
- tools:context=".${CollectionName}Activity">
-
- <!--
- This layout is a two-pane layout for the ${objectKindPlural}
- master/detail flow. See res/values-large/refs.xml and
- res/values-sw600dp/refs.xml for an example of layout aliases
- that replace the single-pane version of the layout with
- this two-pane version.
-
- For more on layout aliases, see:
- http://developer.android.com/training/multiscreen/screensizes.html#TaskUseAliasFilters
- -->
-
- <fragment
- android:id="@+id/${collection_name}"
- android:name="${packageName}.${CollectionName}Fragment"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="1"
- tools:layout="@android:layout/list_content" />
-
- <FrameLayout
- android:id="@+id/${detail_name}_container"
- android:layout_width="0dp"
- android:layout_height="match_parent"
- android:layout_weight="3" />
-
-</LinearLayout>
diff --git a/templates/activities/MasterDetailFlow/root/res/layout/fragment_content_detail.xml.ftl b/templates/activities/MasterDetailFlow/root/res/layout/fragment_content_detail.xml.ftl
deleted file mode 100644
index 808fc31..0000000
--- a/templates/activities/MasterDetailFlow/root/res/layout/fragment_content_detail.xml.ftl
+++ /dev/null
@@ -1,9 +0,0 @@
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:id="@+id/${detail_name}"
- style="?android:attr/textAppearanceLarge"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:padding="16dp"
- android:textIsSelectable="true"
- tools:context=".${DetailName}Fragment" />
diff --git a/templates/activities/MasterDetailFlow/root/res/values-large/refs.xml.ftl b/templates/activities/MasterDetailFlow/root/res/values-large/refs.xml.ftl
deleted file mode 100644
index 97215c3..0000000
--- a/templates/activities/MasterDetailFlow/root/res/values-large/refs.xml.ftl
+++ /dev/null
@@ -1,10 +0,0 @@
-<resources>
- <!--
- Layout alias to replace the single-pane version of the layout with a
- two-pane version on Large screens.
-
- For more on layout aliases, see:
- http://developer.android.com/training/multiscreen/screensizes.html#TaskUseAliasFilters
- -->
- <item type="layout" name="activity_${collection_name}">@layout/activity_${extractLetters(objectKind?lower_case)}_twopane</item>
-</resources>
diff --git a/templates/activities/MasterDetailFlow/root/res/values-sw600dp/refs.xml.ftl b/templates/activities/MasterDetailFlow/root/res/values-sw600dp/refs.xml.ftl
deleted file mode 100644
index d592404..0000000
--- a/templates/activities/MasterDetailFlow/root/res/values-sw600dp/refs.xml.ftl
+++ /dev/null
@@ -1,11 +0,0 @@
-<resources>
- <!--
- Layout alias to replace the single-pane version of the layout with a
- two-pane version on screens with a smallest width (smallest dimension)
- of at least 600 density-independent pixels (dips).
-
- For more on layout aliases, see:
- http://developer.android.com/training/multiscreen/screensizes.html#TaskUseAliasFilters
- -->
- <item type="layout" name="activity_${collection_name}">@layout/activity_${extractLetters(objectKind?lower_case)}_twopane</item>
-</resources>
diff --git a/templates/activities/MasterDetailFlow/root/res/values/strings.xml.ftl b/templates/activities/MasterDetailFlow/root/res/values/strings.xml.ftl
deleted file mode 100644
index ea882bc..0000000
--- a/templates/activities/MasterDetailFlow/root/res/values/strings.xml.ftl
+++ /dev/null
@@ -1,6 +0,0 @@
-<resources>
- <#if !isNewProject>
- <string name="title_${collection_name}">${escapeXmlString(objectKindPlural)}</string>
- </#if>
- <string name="title_${detail_name}">${escapeXmlString(objectKind)} Detail</string>
-</resources>
diff --git a/templates/activities/MasterDetailFlow/root/src/app_package/ContentDetailActivity.java.ftl b/templates/activities/MasterDetailFlow/root/src/app_package/ContentDetailActivity.java.ftl
deleted file mode 100644
index 2cc6054..0000000
--- a/templates/activities/MasterDetailFlow/root/src/app_package/ContentDetailActivity.java.ftl
+++ /dev/null
@@ -1,67 +0,0 @@
-package ${packageName};
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.support.v4.app.FragmentActivity;
-import android.support.v4.app.NavUtils;
-import android.view.MenuItem;
-
-/**
- * An activity representing a single ${objectKind} detail screen. This
- * activity is only used on handset devices. On tablet-size devices,
- * item details are presented side-by-side with a list of items
- * in a {@link ${CollectionName}Activity}.
- * <p>
- * This activity is mostly just a 'shell' activity containing nothing
- * more than a {@link ${DetailName}Fragment}.
- */
-public class ${DetailName}Activity extends FragmentActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_${detail_name});
-
- // Show the Up button in the action bar.
- getActionBar().setDisplayHomeAsUpEnabled(true);
-
- // savedInstanceState is non-null when there is fragment state
- // saved from previous configurations of this activity
- // (e.g. when rotating the screen from portrait to landscape).
- // In this case, the fragment will automatically be re-added
- // to its container so we don't need to manually add it.
- // For more information, see the Fragments API guide at:
- //
- // http://developer.android.com/guide/components/fragments.html
- //
- if (savedInstanceState == null) {
- // Create the detail fragment and add it to the activity
- // using a fragment transaction.
- Bundle arguments = new Bundle();
- arguments.putString(${DetailName}Fragment.ARG_ITEM_ID,
- getIntent().getStringExtra(${DetailName}Fragment.ARG_ITEM_ID));
- ${DetailName}Fragment fragment = new ${DetailName}Fragment();
- fragment.setArguments(arguments);
- getSupportFragmentManager().beginTransaction()
- .add(R.id.${detail_name}_container, fragment)
- .commit();
- }
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case android.R.id.home:
- // This ID represents the Home or Up button. In the case of this
- // activity, the Up button is shown. Use NavUtils to allow users
- // to navigate up one level in the application structure. For
- // more details, see the Navigation pattern on Android Design:
- //
- // http://developer.android.com/design/patterns/navigation.html#up-vs-back
- //
- NavUtils.navigateUpTo(this, new Intent(this, ${CollectionName}Activity.class));
- return true;
- }
- return super.onOptionsItemSelected(item);
- }
-}
diff --git a/templates/activities/MasterDetailFlow/root/src/app_package/ContentDetailFragment.java.ftl b/templates/activities/MasterDetailFlow/root/src/app_package/ContentDetailFragment.java.ftl
deleted file mode 100644
index 2cecaec..0000000
--- a/templates/activities/MasterDetailFlow/root/src/app_package/ContentDetailFragment.java.ftl
+++ /dev/null
@@ -1,61 +0,0 @@
-package ${packageName};
-
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.TextView;
-
-import ${packageName}.dummy.DummyContent;
-
-/**
- * A fragment representing a single ${objectKind} detail screen.
- * This fragment is either contained in a {@link ${CollectionName}Activity}
- * in two-pane mode (on tablets) or a {@link ${DetailName}Activity}
- * on handsets.
- */
-public class ${DetailName}Fragment extends Fragment {
- /**
- * The fragment argument representing the item ID that this fragment
- * represents.
- */
- public static final String ARG_ITEM_ID = "item_id";
-
- /**
- * The dummy content this fragment is presenting.
- */
- private DummyContent.DummyItem mItem;
-
- /**
- * Mandatory empty constructor for the fragment manager to instantiate the
- * fragment (e.g. upon screen orientation changes).
- */
- public ${DetailName}Fragment() {
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- if (getArguments().containsKey(ARG_ITEM_ID)) {
- // Load the dummy content specified by the fragment
- // arguments. In a real-world scenario, use a Loader
- // to load content from a content provider.
- mItem = DummyContent.ITEM_MAP.get(getArguments().getString(ARG_ITEM_ID));
- }
- }
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- View rootView = inflater.inflate(R.layout.fragment_${detail_name}, container, false);
-
- // Show the dummy content as text in a TextView.
- if (mItem != null) {
- ((TextView) rootView.findViewById(R.id.${detail_name})).setText(mItem.content);
- }
-
- return rootView;
- }
-}
diff --git a/templates/activities/MasterDetailFlow/root/src/app_package/ContentListActivity.java.ftl b/templates/activities/MasterDetailFlow/root/src/app_package/ContentListActivity.java.ftl
deleted file mode 100644
index ae73f7d..0000000
--- a/templates/activities/MasterDetailFlow/root/src/app_package/ContentListActivity.java.ftl
+++ /dev/null
@@ -1,105 +0,0 @@
-package ${packageName};
-
-import android.content.Intent;
-import android.os.Bundle;
-import android.support.v4.app.FragmentActivity;
-<#if parentActivityClass != "">import android.support.v4.app.NavUtils;
-import android.view.MenuItem;</#if>
-
-/**
- * An activity representing a list of ${objectKindPlural}. This activity
- * has different presentations for handset and tablet-size devices. On
- * handsets, the activity presents a list of items, which when touched,
- * lead to a {@link ${DetailName}Activity} representing
- * item details. On tablets, the activity presents the list of items and
- * item details side-by-side using two vertical panes.
- * <p>
- * The activity makes heavy use of fragments. The list of items is a
- * {@link ${CollectionName}Fragment} and the item details
- * (if present) is a {@link ${DetailName}Fragment}.
- * <p>
- * This activity also implements the required
- * {@link ${CollectionName}Fragment.Callbacks} interface
- * to listen for item selections.
- */
-public class ${CollectionName}Activity extends FragmentActivity
- implements ${CollectionName}Fragment.Callbacks {
-
- /**
- * Whether or not the activity is in two-pane mode, i.e. running on a tablet
- * device.
- */
- private boolean mTwoPane;
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_${collection_name});
- <#if parentActivityClass != "">
- // Show the Up button in the action bar.
- getActionBar().setDisplayHomeAsUpEnabled(true);
- </#if>
-
- if (findViewById(R.id.${detail_name}_container) != null) {
- // The detail container view will be present only in the
- // large-screen layouts (res/values-large and
- // res/values-sw600dp). If this view is present, then the
- // activity should be in two-pane mode.
- mTwoPane = true;
-
- // In two-pane mode, list items should be given the
- // 'activated' state when touched.
- ((${CollectionName}Fragment) getSupportFragmentManager()
- .findFragmentById(R.id.${collection_name}))
- .setActivateOnItemClick(true);
- }
-
- // TODO: If exposing deep links into your app, handle intents here.
- }
- <#if parentActivityClass != "">
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case android.R.id.home:
- // This ID represents the Home or Up button. In the case of this
- // activity, the Up button is shown. Use NavUtils to allow users
- // to navigate up one level in the application structure. For
- // more details, see the Navigation pattern on Android Design:
- //
- // http://developer.android.com/design/patterns/navigation.html#up-vs-back
- //
- NavUtils.navigateUpFromSameTask(this);
- return true;
- }
- return super.onOptionsItemSelected(item);
- }
- </#if>
-
- /**
- * Callback method from {@link ${CollectionName}Fragment.Callbacks}
- * indicating that the item with the given ID was selected.
- */
- @Override
- public void onItemSelected(String id) {
- if (mTwoPane) {
- // In two-pane mode, show the detail view in this activity by
- // adding or replacing the detail fragment using a
- // fragment transaction.
- Bundle arguments = new Bundle();
- arguments.putString(${DetailName}Fragment.ARG_ITEM_ID, id);
- ${DetailName}Fragment fragment = new ${DetailName}Fragment();
- fragment.setArguments(arguments);
- getSupportFragmentManager().beginTransaction()
- .replace(R.id.${detail_name}_container, fragment)
- .commit();
-
- } else {
- // In single-pane mode, simply start the detail activity
- // for the selected item ID.
- Intent detailIntent = new Intent(this, ${DetailName}Activity.class);
- detailIntent.putExtra(${DetailName}Fragment.ARG_ITEM_ID, id);
- startActivity(detailIntent);
- }
- }
-}
diff --git a/templates/activities/MasterDetailFlow/root/src/app_package/ContentListFragment.java.ftl b/templates/activities/MasterDetailFlow/root/src/app_package/ContentListFragment.java.ftl
deleted file mode 100644
index e9a2e74..0000000
--- a/templates/activities/MasterDetailFlow/root/src/app_package/ContentListFragment.java.ftl
+++ /dev/null
@@ -1,151 +0,0 @@
-package ${packageName};
-
-import android.app.Activity;
-import android.os.Bundle;
-import android.support.v4.app.ListFragment;
-import android.view.View;
-import android.widget.ArrayAdapter;
-import android.widget.ListView;
-
-import ${packageName}.dummy.DummyContent;
-
-/**
- * A list fragment representing a list of ${objectKindPlural}. This fragment
- * also supports tablet devices by allowing list items to be given an
- * 'activated' state upon selection. This helps indicate which item is
- * currently being viewed in a {@link ${DetailName}Fragment}.
- * <p>
- * Activities containing this fragment MUST implement the {@link Callbacks}
- * interface.
- */
-public class ${CollectionName}Fragment extends ListFragment {
-
- /**
- * The serialization (saved instance state) Bundle key representing the
- * activated item position. Only used on tablets.
- */
- private static final String STATE_ACTIVATED_POSITION = "activated_position";
-
- /**
- * The fragment's current callback object, which is notified of list item
- * clicks.
- */
- private Callbacks mCallbacks = sDummyCallbacks;
-
- /**
- * The current activated item position. Only used on tablets.
- */
- private int mActivatedPosition = ListView.INVALID_POSITION;
-
- /**
- * A callback interface that all activities containing this fragment must
- * implement. This mechanism allows activities to be notified of item
- * selections.
- */
- public interface Callbacks {
- /**
- * Callback for when an item has been selected.
- */
- public void onItemSelected(String id);
- }
-
- /**
- * A dummy implementation of the {@link Callbacks} interface that does
- * nothing. Used only when this fragment is not attached to an activity.
- */
- private static Callbacks sDummyCallbacks = new Callbacks() {
- @Override
- public void onItemSelected(String id) {
- }
- };
-
- /**
- * Mandatory empty constructor for the fragment manager to instantiate the
- * fragment (e.g. upon screen orientation changes).
- */
- public ${CollectionName}Fragment() {
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- // TODO: replace with a real list adapter.
- setListAdapter(new ArrayAdapter<DummyContent.DummyItem>(
- getActivity(),
- android.R.layout.simple_list_item_activated_1,
- android.R.id.text1,
- DummyContent.ITEMS));
- }
-
- @Override
- public void onViewCreated(View view, Bundle savedInstanceState) {
- super.onViewCreated(view, savedInstanceState);
-
- // Restore the previously serialized activated item position.
- if (savedInstanceState != null
- && savedInstanceState.containsKey(STATE_ACTIVATED_POSITION)) {
- setActivatedPosition(savedInstanceState.getInt(STATE_ACTIVATED_POSITION));
- }
- }
-
- @Override
- public void onAttach(Activity activity) {
- super.onAttach(activity);
-
- // Activities containing this fragment must implement its callbacks.
- if (!(activity instanceof Callbacks)) {
- throw new IllegalStateException("Activity must implement fragment's callbacks.");
- }
-
- mCallbacks = (Callbacks) activity;
- }
-
- @Override
- public void onDetach() {
- super.onDetach();
-
- // Reset the active callbacks interface to the dummy implementation.
- mCallbacks = sDummyCallbacks;
- }
-
- @Override
- public void onListItemClick(ListView listView, View view, int position, long id) {
- super.onListItemClick(listView, view, position, id);
-
- // Notify the active callbacks interface (the activity, if the
- // fragment is attached to one) that an item has been selected.
- mCallbacks.onItemSelected(DummyContent.ITEMS.get(position).id);
- }
-
- @Override
- public void onSaveInstanceState(Bundle outState) {
- super.onSaveInstanceState(outState);
- if (mActivatedPosition != ListView.INVALID_POSITION) {
- // Serialize and persist the activated item position.
- outState.putInt(STATE_ACTIVATED_POSITION, mActivatedPosition);
- }
- }
-
- /**
- * Turns on activate-on-click mode. When this mode is on, list items will be
- * given the 'activated' state when touched.
- */
- public void setActivateOnItemClick(boolean activateOnItemClick) {
- // When setting CHOICE_MODE_SINGLE, ListView will automatically
- // give items the 'activated' state when touched.
- getListView().setChoiceMode(activateOnItemClick
- ? ListView.CHOICE_MODE_SINGLE
- : ListView.CHOICE_MODE_NONE);
- }
-
- private void setActivatedPosition(int position) {
- if (position == ListView.INVALID_POSITION) {
- getListView().setItemChecked(mActivatedPosition, false);
- } else {
- getListView().setItemChecked(position, true);
- }
-
- mActivatedPosition = position;
- }
-}
diff --git a/templates/activities/MasterDetailFlow/root/src/app_package/dummy/DummyContent.java.ftl b/templates/activities/MasterDetailFlow/root/src/app_package/dummy/DummyContent.java.ftl
deleted file mode 100644
index 3545ba3..0000000
--- a/templates/activities/MasterDetailFlow/root/src/app_package/dummy/DummyContent.java.ftl
+++ /dev/null
@@ -1,55 +0,0 @@
-package ${packageName}.dummy;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Helper class for providing sample content for user interfaces created by
- * Android template wizards.
- * <p>
- * TODO: Replace all uses of this class before publishing your app.
- */
-public class DummyContent {
-
- /**
- * An array of sample (dummy) items.
- */
- public static List<DummyItem> ITEMS = new ArrayList<DummyItem>();
-
- /**
- * A map of sample (dummy) items, by ID.
- */
- public static Map<String, DummyItem> ITEM_MAP = new HashMap<String, DummyItem>();
-
- static {
- // Add 3 sample items.
- addItem(new DummyItem("1", "Item 1"));
- addItem(new DummyItem("2", "Item 2"));
- addItem(new DummyItem("3", "Item 3"));
- }
-
- private static void addItem(DummyItem item) {
- ITEMS.add(item);
- ITEM_MAP.put(item.id, item);
- }
-
- /**
- * A dummy item representing a piece of content.
- */
- public static class DummyItem {
- public String id;
- public String content;
-
- public DummyItem(String id, String content) {
- this.id = id;
- this.content = content;
- }
-
- @Override
- public String toString() {
- return content;
- }
- }
-}
diff --git a/templates/activities/MasterDetailFlow/template.xml b/templates/activities/MasterDetailFlow/template.xml
deleted file mode 100644
index 95fe597..0000000
--- a/templates/activities/MasterDetailFlow/template.xml
+++ /dev/null
@@ -1,65 +0,0 @@
-<?xml version="1.0"?>
-<template
- format="3"
- revision="2"
- name="Master/Detail Flow"
- minApi="11"
- description="Creates a new master/detail flow, allowing users to view a collection of objects as well as details for each object. This flow is presented using two columns on tablet-size screens and one column on handsets and smaller screens. This template creates two activities, a master fragment, and a detail fragment.">
- <dependency name="android-support-v4" revision="8" />
-
- <thumbs>
- <thumb>template_master_detail.png</thumb>
- </thumbs>
-
- <category value="Flows" />
-
- <parameter
- id="objectKind"
- name="Object Kind"
- type="string"
- constraints="nonempty"
- default="Item"
- help="Other examples are 'Person', 'Book', etc." />
-
- <parameter
- id="objectKindPlural"
- name="Object Kind Plural"
- type="string"
- constraints="nonempty"
- default="Items"
- help="Other examples are 'People', 'Books', etc." />
-
- <parameter
- id="activityTitle"
- name="Title"
- type="string"
- constraints="nonempty"
- suggest="${objectKindPlural}"
- default="Items" />
-
- <parameter
- id="isLauncher"
- name="Launcher Activity"
- type="boolean"
- default="false"
- help="If true, the primary activity in the flow will have a CATEGORY_LAUNCHER intent filter, making it visible in the launcher" />
-
- <parameter
- id="parentActivityClass"
- name="Hierarchical Parent"
- type="string"
- constraints="activity|exists|empty"
- default=""
- help="The hierarchical parent activity, used to provide a default implementation for the 'Up' button" />
-
- <parameter
- id="packageName"
- name="Package name"
- type="string"
- constraints="package"
- default="com.mycompany.myapp" />
-
- <globals file="globals.xml.ftl" />
- <execute file="recipe.xml.ftl" />
-
-</template>
diff --git a/templates/activities/MasterDetailFlow/template_master_detail.png b/templates/activities/MasterDetailFlow/template_master_detail.png
deleted file mode 100644
index f9d3f23..0000000
--- a/templates/activities/MasterDetailFlow/template_master_detail.png
+++ /dev/null
Binary files differ
diff --git a/templates/activities/SettingsActivity/globals.xml.ftl b/templates/activities/SettingsActivity/globals.xml.ftl
deleted file mode 100644
index a416d3a..0000000
--- a/templates/activities/SettingsActivity/globals.xml.ftl
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0"?>
-<globals>
- <global id="srcOut" value="src/${slashedPackageName(packageName)}" />
- <global id="simpleName" value="${activityToLayout(activityClass)}" />
-</globals>
diff --git a/templates/activities/SettingsActivity/recipe.xml.ftl b/templates/activities/SettingsActivity/recipe.xml.ftl
deleted file mode 100644
index e315963..0000000
--- a/templates/activities/SettingsActivity/recipe.xml.ftl
+++ /dev/null
@@ -1,17 +0,0 @@
-<?xml version="1.0"?>
-<recipe>
- <merge from="AndroidManifest.xml.ftl" />
-
- <copy from="res/xml/pref_data_sync.xml" />
- <copy from="res/xml/pref_general.xml" />
- <merge from="res/xml/pref_headers.xml.ftl" />
- <copy from="res/xml/pref_notification.xml" />
-
- <instantiate from="res/values/strings.xml.ftl"
- to="res/values/strings_${simpleName}.xml" />
-
- <instantiate from="src/app_package/SettingsActivity.java.ftl"
- to="${srcOut}/${activityClass}.java" />
-
- <open file="${srcOut}/${activityClass}.java" />
-</recipe>
diff --git a/templates/activities/SettingsActivity/root/AndroidManifest.xml.ftl b/templates/activities/SettingsActivity/root/AndroidManifest.xml.ftl
deleted file mode 100644
index 9f78fcf..0000000
--- a/templates/activities/SettingsActivity/root/AndroidManifest.xml.ftl
+++ /dev/null
@@ -1,18 +0,0 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" >
-
- <application>
- <activity android:name=".${activityClass}"
- <#if isNewProject>
- android:label="@string/app_name"
- <#else>
- android:label="@string/title_${simpleName}"
- </#if>
- <#if buildApi gte 16 && parentActivityClass != "">android:parentActivityName="${parentActivityClass}"</#if>>
- <#if parentActivityClass != "">
- <meta-data android:name="android.support.PARENT_ACTIVITY"
- android:value="${parentActivityClass}" />
- </#if>
- </activity>
- </application>
-
-</manifest>
diff --git a/templates/activities/SettingsActivity/root/res/values/strings.xml.ftl b/templates/activities/SettingsActivity/root/res/values/strings.xml.ftl
deleted file mode 100644
index 8dc52ac..0000000
--- a/templates/activities/SettingsActivity/root/res/values/strings.xml.ftl
+++ /dev/null
@@ -1,61 +0,0 @@
-<resources>
- <#if !isNewProject>
- <string name="title_${simpleName}">${escapeXmlString(activityTitle)}</string>
- </#if>
-
- <!-- Strings related to Settings -->
-
- <!-- Example General settings -->
- <string name="pref_header_general">General</string>
-
- <string name="pref_title_social_recommendations">Enable social recommendations</string>
- <string name="pref_description_social_recommendations">Recommendations for people to contact based on your message history</string>
-
- <string name="pref_title_display_name">Display name</string>
- <string name="pref_default_display_name">John Smith</string>
-
- <string name="pref_title_add_friends_to_messages">Add friends to messages</string>
- <string-array name="pref_example_list_titles">
- <item>Always</item>
- <item>When possible</item>
- <item>Never</item>
- </string-array>
- <string-array name="pref_example_list_values">
- <item>1</item>
- <item>0</item>
- <item>-1</item>
- </string-array>
-
- <!-- Example settings for Data & Sync -->
- <string name="pref_header_data_sync">Data &amp; sync</string>
-
- <string name="pref_title_sync_frequency">Sync frequency</string>
- <string-array name="pref_sync_frequency_titles">
- <item>15 minutes</item>
- <item>30 minutes</item>
- <item>1 hour</item>
- <item>3 hours</item>
- <item>6 hours</item>
- <item>Never</item>
- </string-array>
- <string-array name="pref_sync_frequency_values">
- <item>15</item>
- <item>30</item>
- <item>60</item>
- <item>180</item>
- <item>360</item>
- <item>-1</item>
- </string-array>
-
- <string name="pref_title_system_sync_settings">System sync settings</string>
-
- <!-- Example settings for Notifications -->
- <string name="pref_header_notifications">Notifications</string>
-
- <string name="pref_title_new_message_notifications">New message notifications</string>
-
- <string name="pref_title_ringtone">Ringtone</string>
- <string name="pref_ringtone_silent">Silent</string>
-
- <string name="pref_title_vibrate">Vibrate</string>
-</resources>
diff --git a/templates/activities/SettingsActivity/root/res/xml/pref_data_sync.xml b/templates/activities/SettingsActivity/root/res/xml/pref_data_sync.xml
deleted file mode 100644
index ffda831..0000000
--- a/templates/activities/SettingsActivity/root/res/xml/pref_data_sync.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
-
- <!-- NOTE: Hide buttons to simplify the UI. Users can touch outside the dialog to
- dismiss it. -->
- <!-- NOTE: ListPreference's summary should be set to its value by the activity code. -->
- <ListPreference
- android:key="sync_frequency"
- android:title="@string/pref_title_sync_frequency"
- android:entries="@array/pref_sync_frequency_titles"
- android:entryValues="@array/pref_sync_frequency_values"
- android:defaultValue="180"
- android:negativeButtonText="@null"
- android:positiveButtonText="@null" />
-
- <!-- This preference simply launches an intent when selected. Use this UI sparingly, per
- design guidelines. -->
- <Preference android:title="@string/pref_title_system_sync_settings">
- <intent android:action="android.settings.SYNC_SETTINGS" />
- </Preference>
-
-</PreferenceScreen>
diff --git a/templates/activities/SettingsActivity/root/res/xml/pref_general.xml b/templates/activities/SettingsActivity/root/res/xml/pref_general.xml
deleted file mode 100644
index c49cbed..0000000
--- a/templates/activities/SettingsActivity/root/res/xml/pref_general.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
-
- <CheckBoxPreference
- android:key="example_checkbox"
- android:title="@string/pref_title_social_recommendations"
- android:summary="@string/pref_description_social_recommendations"
- android:defaultValue="true" />
-
- <!-- NOTE: EditTextPreference accepts EditText attributes. -->
- <!-- NOTE: EditTextPreference's summary should be set to its value by the activity code. -->
- <EditTextPreference
- android:key="example_text"
- android:title="@string/pref_title_display_name"
- android:defaultValue="@string/pref_default_display_name"
- android:selectAllOnFocus="true"
- android:inputType="textCapWords"
- android:capitalize="words"
- android:singleLine="true"
- android:maxLines="1" />
-
- <!-- NOTE: Hide buttons to simplify the UI. Users can touch outside the dialog to
- dismiss it. -->
- <!-- NOTE: ListPreference's summary should be set to its value by the activity code. -->
- <ListPreference
- android:key="example_list"
- android:title="@string/pref_title_add_friends_to_messages"
- android:defaultValue="-1"
- android:entries="@array/pref_example_list_titles"
- android:entryValues="@array/pref_example_list_values"
- android:negativeButtonText="@null"
- android:positiveButtonText="@null" />
-
-</PreferenceScreen>
diff --git a/templates/activities/SettingsActivity/root/res/xml/pref_headers.xml.ftl b/templates/activities/SettingsActivity/root/res/xml/pref_headers.xml.ftl
deleted file mode 100644
index a3da325..0000000
--- a/templates/activities/SettingsActivity/root/res/xml/pref_headers.xml.ftl
+++ /dev/null
@@ -1,17 +0,0 @@
-<preference-headers xmlns:android="http://schemas.android.com/apk/res/android">
-
- <!-- These settings headers are only used on tablets. -->
-
- <header
- android:fragment="${packageName}.${activityClass}$GeneralPreferenceFragment"
- android:title="@string/pref_header_general" />
-
- <header
- android:fragment="${packageName}.${activityClass}$NotificationPreferenceFragment"
- android:title="@string/pref_header_notifications" />
-
- <header
- android:fragment="${packageName}.${activityClass}$DataSyncPreferenceFragment"
- android:title="@string/pref_header_data_sync" />
-
-</preference-headers>
diff --git a/templates/activities/SettingsActivity/root/res/xml/pref_notification.xml b/templates/activities/SettingsActivity/root/res/xml/pref_notification.xml
deleted file mode 100644
index b4b8cae..0000000
--- a/templates/activities/SettingsActivity/root/res/xml/pref_notification.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
-
- <!-- A 'parent' preference, which enables/disables child preferences (below)
- when checked/unchecked. -->
- <CheckBoxPreference
- android:key="notifications_new_message"
- android:title="@string/pref_title_new_message_notifications"
- android:defaultValue="true" />
-
- <!-- Allows the user to choose a ringtone in the 'notification' category. -->
- <!-- NOTE: This preference will be enabled only when the checkbox above is checked. -->
- <!-- NOTE: RingtonePreference's summary should be set to its value by the activity code. -->
- <RingtonePreference
- android:dependency="notifications_new_message"
- android:key="notifications_new_message_ringtone"
- android:title="@string/pref_title_ringtone"
- android:ringtoneType="notification"
- android:defaultValue="content://settings/system/notification_sound" />
-
- <!-- NOTE: This preference will be enabled only when the checkbox above is checked. -->
- <CheckBoxPreference
- android:dependency="notifications_new_message"
- android:key="notifications_new_message_vibrate"
- android:title="@string/pref_title_vibrate"
- android:defaultValue="true" />
-
-</PreferenceScreen>
diff --git a/templates/activities/SettingsActivity/root/src/app_package/SettingsActivity.java.ftl b/templates/activities/SettingsActivity/root/src/app_package/SettingsActivity.java.ftl
deleted file mode 100644
index bf67aca..0000000
--- a/templates/activities/SettingsActivity/root/src/app_package/SettingsActivity.java.ftl
+++ /dev/null
@@ -1,295 +0,0 @@
-package ${packageName};
-
-import android.annotation.TargetApi;
-import android.content.Context;
-import android.content.res.Configuration;
-import android.media.Ringtone;
-import android.media.RingtoneManager;
-import android.net.Uri;
-import android.os.Build;
-import android.os.Bundle;
-import android.preference.ListPreference;
-import android.preference.Preference;
-import android.preference.PreferenceActivity;
-import android.preference.PreferenceCategory;
-import android.preference.PreferenceFragment;
-import android.preference.PreferenceManager;
-import android.preference.RingtonePreference;
-import android.text.TextUtils;
-<#if parentActivityClass != "">
-import android.view.MenuItem;
-import android.support.v4.app.NavUtils;
-</#if>
-
-import java.util.List;
-
-/**
- * A {@link PreferenceActivity} that presents a set of application settings. On
- * handset devices, settings are presented as a single list. On tablets,
- * settings are split by category, with category headers shown to the left of
- * the list of settings.
- * <p>
- * See <a href="http://developer.android.com/design/patterns/settings.html">
- * Android Design: Settings</a> for design guidelines and the <a
- * href="http://developer.android.com/guide/topics/ui/settings.html">Settings
- * API Guide</a> for more information on developing a Settings UI.
- */
-public class ${activityClass} extends PreferenceActivity {
- /**
- * Determines whether to always show the simplified settings UI, where
- * settings are presented in a single list. When false, settings are shown
- * as a master/detail two-pane view on tablets. When true, a single pane is
- * shown on tablets.
- */
- private static final boolean ALWAYS_SIMPLE_PREFS = false;
-
- <#if parentActivityClass != "">
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setupActionBar();
- }
-
- /**
- * Set up the {@link android.app.ActionBar}, if the API is available.
- */
- @TargetApi(Build.VERSION_CODES.HONEYCOMB)
- private void setupActionBar() {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
- // Show the Up button in the action bar.
- getActionBar().setDisplayHomeAsUpEnabled(true);
- }
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case android.R.id.home:
- // This ID represents the Home or Up button. In the case of this
- // activity, the Up button is shown. Use NavUtils to allow users
- // to navigate up one level in the application structure. For
- // more details, see the Navigation pattern on Android Design:
- //
- // http://developer.android.com/design/patterns/navigation.html#up-vs-back
- //
- // TODO: If Settings has multiple levels, Up should navigate up
- // that hierarchy.
- NavUtils.navigateUpFromSameTask(this);
- return true;
- }
- return super.onOptionsItemSelected(item);
- }
- </#if>
-
- @Override
- protected void onPostCreate(Bundle savedInstanceState) {
- super.onPostCreate(savedInstanceState);
-
- setupSimplePreferencesScreen();
- }
-
- /**
- * Shows the simplified settings UI if the device configuration if the
- * device configuration dictates that a simplified, single-pane UI should be
- * shown.
- */
- private void setupSimplePreferencesScreen() {
- if (!isSimplePreferences(this)) {
- return;
- }
-
- // In the simplified UI, fragments are not used at all and we instead
- // use the older PreferenceActivity APIs.
-
- // Add 'general' preferences.
- addPreferencesFromResource(R.xml.pref_general);
-
- // Add 'notifications' preferences, and a corresponding header.
- PreferenceCategory fakeHeader = new PreferenceCategory(this);
- fakeHeader.setTitle(R.string.pref_header_notifications);
- getPreferenceScreen().addPreference(fakeHeader);
- addPreferencesFromResource(R.xml.pref_notification);
-
- // Add 'data and sync' preferences, and a corresponding header.
- fakeHeader = new PreferenceCategory(this);
- fakeHeader.setTitle(R.string.pref_header_data_sync);
- getPreferenceScreen().addPreference(fakeHeader);
- addPreferencesFromResource(R.xml.pref_data_sync);
-
- // Bind the summaries of EditText/List/Dialog/Ringtone preferences to
- // their values. When their values change, their summaries are updated
- // to reflect the new value, per the Android Design guidelines.
- bindPreferenceSummaryToValue(findPreference("example_text"));
- bindPreferenceSummaryToValue(findPreference("example_list"));
- bindPreferenceSummaryToValue(findPreference("notifications_new_message_ringtone"));
- bindPreferenceSummaryToValue(findPreference("sync_frequency"));
- }
-
- /** {@inheritDoc} */
- @Override
- public boolean onIsMultiPane() {
- return isXLargeTablet(this) && !isSimplePreferences(this);
- }
-
- /**
- * Helper method to determine if the device has an extra-large screen. For
- * example, 10" tablets are extra-large.
- */
- private static boolean isXLargeTablet(Context context) {
- return (context.getResources().getConfiguration().screenLayout
- & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
- }
-
- /**
- * Determines whether the simplified settings UI should be shown. This is
- * true if this is forced via {@link #ALWAYS_SIMPLE_PREFS}, or the device
- * doesn't have newer APIs like {@link PreferenceFragment}, or the device
- * doesn't have an extra-large screen. In these cases, a single-pane
- * "simplified" settings UI should be shown.
- */
- private static boolean isSimplePreferences(Context context) {
- return ALWAYS_SIMPLE_PREFS
- || Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB
- || !isXLargeTablet(context);
- }
-
- /** {@inheritDoc} */
- @Override
- @TargetApi(Build.VERSION_CODES.HONEYCOMB)
- public void onBuildHeaders(List<Header> target) {
- if (!isSimplePreferences(this)) {
- loadHeadersFromResource(R.xml.pref_headers, target);
- }
- }
-
- /**
- * A preference value change listener that updates the preference's summary
- * to reflect its new value.
- */
- private static Preference.OnPreferenceChangeListener sBindPreferenceSummaryToValueListener = new Preference.OnPreferenceChangeListener() {
- @Override
- public boolean onPreferenceChange(Preference preference, Object value) {
- String stringValue = value.toString();
-
- if (preference instanceof ListPreference) {
- // For list preferences, look up the correct display value in
- // the preference's 'entries' list.
- ListPreference listPreference = (ListPreference) preference;
- int index = listPreference.findIndexOfValue(stringValue);
-
- // Set the summary to reflect the new value.
- preference.setSummary(
- index >= 0
- ? listPreference.getEntries()[index]
- : null);
-
- } else if (preference instanceof RingtonePreference) {
- // For ringtone preferences, look up the correct display value
- // using RingtoneManager.
- if (TextUtils.isEmpty(stringValue)) {
- // Empty values correspond to 'silent' (no ringtone).
- preference.setSummary(R.string.pref_ringtone_silent);
-
- } else {
- Ringtone ringtone = RingtoneManager.getRingtone(
- preference.getContext(), Uri.parse(stringValue));
-
- if (ringtone == null) {
- // Clear the summary if there was a lookup error.
- preference.setSummary(null);
- } else {
- // Set the summary to reflect the new ringtone display
- // name.
- String name = ringtone.getTitle(preference.getContext());
- preference.setSummary(name);
- }
- }
-
- } else {
- // For all other preferences, set the summary to the value's
- // simple string representation.
- preference.setSummary(stringValue);
- }
- return true;
- }
- };
-
- /**
- * Binds a preference's summary to its value. More specifically, when the
- * preference's value is changed, its summary (line of text below the
- * preference title) is updated to reflect the value. The summary is also
- * immediately updated upon calling this method. The exact display format is
- * dependent on the type of preference.
- *
- * @see #sBindPreferenceSummaryToValueListener
- */
- private static void bindPreferenceSummaryToValue(Preference preference) {
- // Set the listener to watch for value changes.
- preference.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);
-
- // Trigger the listener immediately with the preference's
- // current value.
- sBindPreferenceSummaryToValueListener.onPreferenceChange(preference,
- PreferenceManager
- .getDefaultSharedPreferences(preference.getContext())
- .getString(preference.getKey(), ""));
- }
-
- /**
- * This fragment shows general preferences only. It is used when the
- * activity is showing a two-pane settings UI.
- */
- @TargetApi(Build.VERSION_CODES.HONEYCOMB)
- public static class GeneralPreferenceFragment extends PreferenceFragment {
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- addPreferencesFromResource(R.xml.pref_general);
-
- // Bind the summaries of EditText/List/Dialog/Ringtone preferences
- // to their values. When their values change, their summaries are
- // updated to reflect the new value, per the Android Design
- // guidelines.
- bindPreferenceSummaryToValue(findPreference("example_text"));
- bindPreferenceSummaryToValue(findPreference("example_list"));
- }
- }
-
- /**
- * This fragment shows notification preferences only. It is used when the
- * activity is showing a two-pane settings UI.
- */
- @TargetApi(Build.VERSION_CODES.HONEYCOMB)
- public static class NotificationPreferenceFragment extends PreferenceFragment {
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- addPreferencesFromResource(R.xml.pref_notification);
-
- // Bind the summaries of EditText/List/Dialog/Ringtone preferences
- // to their values. When their values change, their summaries are
- // updated to reflect the new value, per the Android Design
- // guidelines.
- bindPreferenceSummaryToValue(findPreference("notifications_new_message_ringtone"));
- }
- }
-
- /**
- * This fragment shows data and sync preferences only. It is used when the
- * activity is showing a two-pane settings UI.
- */
- @TargetApi(Build.VERSION_CODES.HONEYCOMB)
- public static class DataSyncPreferenceFragment extends PreferenceFragment {
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- addPreferencesFromResource(R.xml.pref_data_sync);
-
- // Bind the summaries of EditText/List/Dialog/Ringtone preferences
- // to their values. When their values change, their summaries are
- // updated to reflect the new value, per the Android Design
- // guidelines.
- bindPreferenceSummaryToValue(findPreference("sync_frequency"));
- }
- }
-}
diff --git a/templates/activities/SettingsActivity/template.xml b/templates/activities/SettingsActivity/template.xml
deleted file mode 100644
index e024aff..0000000
--- a/templates/activities/SettingsActivity/template.xml
+++ /dev/null
@@ -1,53 +0,0 @@
-<?xml version="1.0"?>
-<template
- format="3"
- revision="2"
- name="Settings Activity"
- description="Creates a new application settings activity that presents alternative layouts on handset and tablet-size screens."
- minApi="4"
- minBuildApi="11">
- <dependency name="android-support-v4" revision="8" />
-
- <category value="Activities" />
-
- <parameter
- id="activityClass"
- name="Activity Name"
- type="string"
- constraints="class|unique|nonempty"
- default="SettingsActivity"
- help="The name of the activity class to create" />
-
- <parameter
- id="activityTitle"
- name="Title"
- type="string"
- constraints="nonempty"
- default="Settings"
- help="The name of the activity." />
-
- <parameter
- id="parentActivityClass"
- name="Hierarchical Parent"
- type="string"
- constraints="activity|exists|empty"
- default=""
- help="The hierarchical parent activity, used to provide a default implementation for the 'Up' button" />
-
- <parameter
- id="packageName"
- name="Package name"
- type="string"
- constraints="package"
- default="com.mycompany.myapp" />
-
- <!-- 128x128 thumbnails relative to template.xml -->
- <thumbs>
- <!-- default thumbnail is required -->
- <thumb>template_settings_activity.png</thumb>
- </thumbs>
-
- <globals file="globals.xml.ftl" />
- <execute file="recipe.xml.ftl" />
-
-</template>
diff --git a/templates/activities/SettingsActivity/template_settings_activity.png b/templates/activities/SettingsActivity/template_settings_activity.png
deleted file mode 100644
index c1a65cb..0000000
--- a/templates/activities/SettingsActivity/template_settings_activity.png
+++ /dev/null
Binary files differ
diff --git a/templates/build_gradle.template b/templates/build_gradle.template
new file mode 100644
index 0000000..6ec137c
--- /dev/null
+++ b/templates/build_gradle.template
@@ -0,0 +1,21 @@
+buildscript {
+ repositories {
+ mavenCentral()
+ }
+ dependencies {
+ classpath 'com.android.tools.build:gradle:ARTIFACT_VERSION'
+ }
+}
+apply plugin: 'PLUGIN'
+
+android {
+ compileSdkVersion 'TARGET'
+ buildToolsVersion 'BUILD_TOOL_REV'
+
+ buildTypes {
+ release {
+ runProguard false
+ proguardFile getDefaultProguardFile('proguard-android.txt')
+ }
+ }
+}
diff --git a/templates/other/AppWidget/globals.xml.ftl b/templates/other/AppWidget/globals.xml.ftl
deleted file mode 100644
index ac85374..0000000
--- a/templates/other/AppWidget/globals.xml.ftl
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0"?>
-<globals>
- <global id="srcOut" value="src/${slashedPackageName(packageName)}" />
- <global id="class_name" value="${camelCaseToUnderscore(className)}" />
-</globals>
diff --git a/templates/other/AppWidget/recipe.xml.ftl b/templates/other/AppWidget/recipe.xml.ftl
deleted file mode 100644
index 876b7b0..0000000
--- a/templates/other/AppWidget/recipe.xml.ftl
+++ /dev/null
@@ -1,31 +0,0 @@
-<?xml version="1.0"?>
-<recipe>
-
- <merge from="AndroidManifest.xml.ftl" />
-
- <copy from="res/drawable-nodpi/example_appwidget_preview.png" />
- <instantiate from="res/layout/appwidget.xml"
- to="res/layout/${class_name}.xml" />
-
-
- <#if configurable>
- <instantiate from="res/layout/appwidget_configure.xml"
- to="res/layout/${class_name}_configure.xml" />
- </#if>
-
- <instantiate from="res/xml/appwidget_info.xml.ftl"
- to="res/xml/${class_name}_info.xml" />
- <merge from="res/values/strings.xml.ftl" />
- <merge from="res/values-v14/dimens.xml" />
- <merge from="res/values/dimens.xml" />
-
- <instantiate from="src/app_package/AppWidget.java.ftl"
- to="${srcOut}/${className}.java" />
-
- <#if configurable>
- <instantiate from="src/app_package/AppWidgetConfigureActivity.java.ftl"
- to="${srcOut}/${className}ConfigureActivity.java" />
- </#if>
-
- <open file="${srcOut}/${className}.java" />
-</recipe>
diff --git a/templates/other/AppWidget/root/AndroidManifest.xml.ftl b/templates/other/AppWidget/root/AndroidManifest.xml.ftl
deleted file mode 100644
index 8b96d56..0000000
--- a/templates/other/AppWidget/root/AndroidManifest.xml.ftl
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
-
- <application>
-
- <receiver android:name=".${className}" >
- <intent-filter>
- <action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
- </intent-filter>
-
- <meta-data
- android:name="android.appwidget.provider"
- android:resource="@xml/${class_name}_info" />
- </receiver>
-
- <#if configurable>
- <activity android:name=".${className}ConfigureActivity" >
- <intent-filter>
- <action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
- </intent-filter>
- </activity>
- </#if>
- </application>
-
-</manifest> \ No newline at end of file
diff --git a/templates/other/AppWidget/root/res/drawable-nodpi/example_appwidget_preview.png b/templates/other/AppWidget/root/res/drawable-nodpi/example_appwidget_preview.png
deleted file mode 100644
index 894b069..0000000
--- a/templates/other/AppWidget/root/res/drawable-nodpi/example_appwidget_preview.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/root/res/layout/appwidget.xml b/templates/other/AppWidget/root/res/layout/appwidget.xml
deleted file mode 100644
index 3a00464..0000000
--- a/templates/other/AppWidget/root/res/layout/appwidget.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:padding="@dimen/widget_margin"
- android:background="#09C" >
-
- <TextView
- android:id="@+id/appwidget_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:layout_centerHorizontal="true"
- android:layout_centerVertical="true"
- android:text="@string/appwidget_text"
- android:textColor="#ffffff"
- android:textSize="24sp"
- android:textStyle="bold|italic"
- android:layout_margin="8dp"
- android:contentDescription="@string/appwidget_text"
- android:background="#09C"/>
-
-</RelativeLayout> \ No newline at end of file
diff --git a/templates/other/AppWidget/root/res/layout/appwidget_configure.xml b/templates/other/AppWidget/root/res/layout/appwidget_configure.xml
deleted file mode 100644
index 8ddc335..0000000
--- a/templates/other/AppWidget/root/res/layout/appwidget_configure.xml
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:orientation="vertical"
- android:padding="16dp">
-
- <TextView
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:text="@string/configure"
- android:layout_marginBottom="8dp" />
-
- <EditText
- android:id="@+id/appwidget_text"
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:inputType="text" />
-
- <Button
- android:id="@+id/add_button"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="@string/add_widget"
- android:layout_marginTop="8dp" />
-
-</LinearLayout> \ No newline at end of file
diff --git a/templates/other/AppWidget/root/res/values-v14/dimens.xml b/templates/other/AppWidget/root/res/values-v14/dimens.xml
deleted file mode 100644
index 4db8c59..0000000
--- a/templates/other/AppWidget/root/res/values-v14/dimens.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-
- <!--
-Refer to App Widget Documentation for margin information
-http://developer.android.com/guide/topics/appwidgets/index.html#CreatingLayout
- -->
- <dimen name="widget_margin">0dp</dimen>
-
-</resources> \ No newline at end of file
diff --git a/templates/other/AppWidget/root/res/values/dimens.xml b/templates/other/AppWidget/root/res/values/dimens.xml
deleted file mode 100644
index fdececf..0000000
--- a/templates/other/AppWidget/root/res/values/dimens.xml
+++ /dev/null
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
-
- <!--
-Refer to App Widget Documentation for margin information
-http://developer.android.com/guide/topics/appwidgets/index.html#CreatingLayout
- -->
- <dimen name="widget_margin">8dp</dimen>
-
-</resources> \ No newline at end of file
diff --git a/templates/other/AppWidget/root/res/values/strings.xml.ftl b/templates/other/AppWidget/root/res/values/strings.xml.ftl
deleted file mode 100644
index 66c06bc..0000000
--- a/templates/other/AppWidget/root/res/values/strings.xml.ftl
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<resources>
- <string name="appwidget_text">EXAMPLE</string>
- <#if configurable>
- <string name="configure">Configure</string>
- </#if>
- <string name="add_widget">Add widget</string>
-</resources> \ No newline at end of file
diff --git a/templates/other/AppWidget/root/res/xml/appwidget_info.xml.ftl b/templates/other/AppWidget/root/res/xml/appwidget_info.xml.ftl
deleted file mode 100644
index 75791be..0000000
--- a/templates/other/AppWidget/root/res/xml/appwidget_info.xml.ftl
+++ /dev/null
@@ -1,27 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android"
- android:minWidth="${-30 + 70 * minWidth?number}dp"
- android:minHeight="${-30 + 70 * minHeight?number}dp"
- android:updatePeriodMillis="86400000"
- android:previewImage="@drawable/example_appwidget_preview"
- android:initialLayout="@layout/${class_name}"
-<#if configurable>
- android:configure="${packageName}.${className}ConfigureActivity"
-</#if>
-<#if resizable='both'>
- android:resizeMode="horizontal|vertical"
-<#elseif resizable='horizontal'>
- android:resizeMode="horizontal"
-<#elseif resizable='vertical'>
- android:resizeMode="vertical"
-<#elseif resizable='none'>
-</#if>
-<#if placement='both'>
- android:widgetCategory="home_screen|keyguard"
-<#elseif placement='homescreen'>
- android:widgetCategory="home_screen"
-<#elseif placement='keyguard'>
- android:widgetCategory="keyguard"
-</#if>
- android:initialKeyguardLayout="@layout/${class_name}">
-</appwidget-provider> \ No newline at end of file
diff --git a/templates/other/AppWidget/root/src/app_package/AppWidget.java.ftl b/templates/other/AppWidget/root/src/app_package/AppWidget.java.ftl
deleted file mode 100644
index d86b0b5..0000000
--- a/templates/other/AppWidget/root/src/app_package/AppWidget.java.ftl
+++ /dev/null
@@ -1,63 +0,0 @@
-package ${packageName};
-
-import android.appwidget.AppWidgetManager;
-import android.appwidget.AppWidgetProvider;
-import android.content.Context;
-import android.widget.RemoteViews;
-
-/**
- * Implementation of App Widget functionality.
-<#if configurable>
- * App Widget Configuration implemented in {@link ${className}ConfigureActivity ${className}ConfigureActivity}
-</#if>
- */
-public class ${className} extends AppWidgetProvider {
-
- @Override
- public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) {
- // There may be multiple widgets active, so update all of them
- final int N = appWidgetIds.length;
- for (int i=0; i<N; i++) {
- updateAppWidget(context, appWidgetManager, appWidgetIds[i]);
- }
- }
-
-<#if configurable>
- @Override
- public void onDeleted(Context context, int[] appWidgetIds) {
- // When the user deletes the widget, delete the preference associated with it.
- final int N = appWidgetIds.length;
- for (int i=0; i<N; i++) {
- ${className}ConfigureActivity.deleteTitlePref(context, appWidgetIds[i]);
- }
- }
-</#if>
-
- @Override
- public void onEnabled(Context context) {
- // Enter relevant functionality for when the first widget is created
- }
-
- @Override
- public void onDisabled(Context context) {
- // Enter relevant functionality for when the last widget is disabled
- }
-
- static void updateAppWidget(Context context, AppWidgetManager appWidgetManager,
- int appWidgetId) {
-
-<#if configurable>
- CharSequence widgetText = ${className}ConfigureActivity.loadTitlePref(context, appWidgetId);
-<#else>
- CharSequence widgetText = context.getString(R.string.appwidget_text);
-</#if>
- // Construct the RemoteViews object
- RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.${class_name});
- views.setTextViewText(R.id.appwidget_text, widgetText);
-
- // Instruct the widget manager to update the widget
- appWidgetManager.updateAppWidget(appWidgetId, views);
- }
-}
-
-
diff --git a/templates/other/AppWidget/root/src/app_package/AppWidgetConfigureActivity.java.ftl b/templates/other/AppWidget/root/src/app_package/AppWidgetConfigureActivity.java.ftl
deleted file mode 100644
index 3c2be67..0000000
--- a/templates/other/AppWidget/root/src/app_package/AppWidgetConfigureActivity.java.ftl
+++ /dev/null
@@ -1,102 +0,0 @@
-package ${packageName};
-
-import android.app.Activity;
-import android.appwidget.AppWidgetManager;
-import android.content.Context;
-import android.content.Intent;
-import android.content.SharedPreferences;
-import android.os.Bundle;
-import android.view.View;
-import android.widget.EditText;
-
-/**
- * The configuration screen for the {@link ${className} ${className}} AppWidget.
- */
-public class ${className}ConfigureActivity extends Activity {
-
- int mAppWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID;
- EditText mAppWidgetText;
- private static final String PREFS_NAME = "${packageName}.${className}";
- private static final String PREF_PREFIX_KEY = "appwidget_";
-
- public ${className}ConfigureActivity() {
- super();
- }
-
- @Override
- public void onCreate(Bundle icicle) {
- super.onCreate(icicle);
-
- // Set the result to CANCELED. This will cause the widget host to cancel
- // out of the widget placement if the user presses the back button.
- setResult(RESULT_CANCELED);
-
- setContentView(R.layout.${class_name}_configure);
- mAppWidgetText = (EditText)findViewById(R.id.appwidget_text);
- findViewById(R.id.add_button).setOnClickListener(mOnClickListener);
-
- // Find the widget id from the intent.
- Intent intent = getIntent();
- Bundle extras = intent.getExtras();
- if (extras != null) {
- mAppWidgetId = extras.getInt(
- AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
- }
-
- // If this activity was started with an intent without an app widget ID, finish with an error.
- if (mAppWidgetId == AppWidgetManager.INVALID_APPWIDGET_ID) {
- finish();
- return;
- }
-
- mAppWidgetText.setText(loadTitlePref(${className}ConfigureActivity.this, mAppWidgetId));
- }
-
- View.OnClickListener mOnClickListener = new View.OnClickListener() {
- public void onClick(View v) {
- final Context context = ${className}ConfigureActivity.this;
-
- // When the button is clicked, store the string locally
- String widgetText = mAppWidgetText.getText().toString();
- saveTitlePref(context,mAppWidgetId,widgetText);
-
- // It is the responsibility of the configuration activity to update the app widget
- AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context);
- ${className}.updateAppWidget(context, appWidgetManager, mAppWidgetId);
-
- // Make sure we pass back the original appWidgetId
- Intent resultValue = new Intent();
- resultValue.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, mAppWidgetId);
- setResult(RESULT_OK, resultValue);
- finish();
- }
- };
-
- // Write the prefix to the SharedPreferences object for this widget
- static void saveTitlePref(Context context, int appWidgetId, String text) {
- SharedPreferences.Editor prefs = context.getSharedPreferences(PREFS_NAME, 0).edit();
- prefs.putString(PREF_PREFIX_KEY + appWidgetId, text);
- prefs.commit();
- }
-
- // Read the prefix from the SharedPreferences object for this widget.
- // If there is no preference saved, get the default from a resource
- static String loadTitlePref(Context context, int appWidgetId) {
- SharedPreferences prefs = context.getSharedPreferences(PREFS_NAME, 0);
- String titleValue = prefs.getString(PREF_PREFIX_KEY + appWidgetId, null);
- if (titleValue != null) {
- return titleValue;
- } else {
- return context.getString(R.string.appwidget_text);
- }
- }
-
- static void deleteTitlePref(Context context, int appWidgetId) {
- SharedPreferences.Editor prefs = context.getSharedPreferences(PREFS_NAME, 0).edit();
- prefs.remove(PREF_PREFIX_KEY + appWidgetId);
- prefs.commit();
- }
-}
-
-
-
diff --git a/templates/other/AppWidget/template.xml b/templates/other/AppWidget/template.xml
deleted file mode 100644
index f071363..0000000
--- a/templates/other/AppWidget/template.xml
+++ /dev/null
@@ -1,148 +0,0 @@
-<?xml version="1.0"?>
-<template
- format="3"
- revision="1"
- name="New App Widget"
- description="Creates a new App Widget"
- minApi="4"
- minBuildApi="16">
-
- <category value="Other" />
-
- <parameter
- id="className"
- name="Class Name"
- type="string"
- constraints="class|unique|nonempty"
- default="NewAppWidget"
- help="The name of the App Widget to create" />
-
- <parameter
- id="placement"
- name="Placement"
- type="enum"
- default="homescreen"
- help="Make the widget available on the Home-screen and/or on the Keyguard. Keyguard placement is only supported in Android 4.2 and above; this setting is ignored on earlier versions and defaults to Home-screen.">
- <option id="both">Home-screen and Keyguard</option>
- <option id="homescreen" default="true" >Home-screen only</option>
- <option id="keyguard" >Keyguard only (API 17+)</option>
- </parameter>
-
- <parameter
- id="resizable"
- name="Resizable (API 12+)"
- type="enum"
- default="both"
- help="Allow the user to resize the widget. Feature only available on Android 3.1 and above.">
- <option id="both" default="true">Horizontally and vertically</option>
- <option id="horizontal">Only horizontally</option>
- <option id="vertical" >Only vertically</option>
- <option id="none">Not resizable</option>
- </parameter>
-
- <parameter
- id="minWidth"
- name="Minimum Width (cells)"
- type="enum"
- default="1">
- <option id="1" default="true">1</option>
- <option id="2" >2</option>
- <option id="3" >3</option>
- <option id="4" >4</option>
- </parameter>
-
- <parameter
- id="minHeight"
- name="Minimum Height (cells)"
- type="enum"
- default="1">
- <option id="1" default="true">1</option>
- <option id="2" >2</option>
- <option id="3" >3</option>
- <option id="4" >4</option>
- </parameter>
-
- <parameter
- id="configurable"
- name="Configuration Screen"
- type="boolean"
- default="false"
- help="Generates a widget configuration activity" />
-
- <globals file="globals.xml.ftl" />
- <execute file="recipe.xml.ftl" />
-
-
- <thumbs>
- <thumb>thumbs/template_widget_3x3_vh.png</thumb>
-
- <thumb minWidth="1" minHeight="1" resizable="none" >thumbs/template_widget_1x1.png</thumb>
- <thumb minWidth="2" minHeight="1" resizable="none" >thumbs/template_widget_2x1.png</thumb>
- <thumb minWidth="3" minHeight="1" resizable="none" >thumbs/template_widget_3x1.png</thumb>
- <thumb minWidth="4" minHeight="1" resizable="none" >thumbs/template_widget_4x1.png</thumb>
- <thumb minWidth="1" minHeight="2" resizable="none" >thumbs/template_widget_1x2.png</thumb>
- <thumb minWidth="2" minHeight="2" resizable="none" >thumbs/template_widget_2x2.png</thumb>
- <thumb minWidth="3" minHeight="2" resizable="none" >thumbs/template_widget_3x2.png</thumb>
- <thumb minWidth="4" minHeight="2" resizable="none" >thumbs/template_widget_4x2.png</thumb>
- <thumb minWidth="1" minHeight="3" resizable="none" >thumbs/template_widget_1x3.png</thumb>
- <thumb minWidth="2" minHeight="3" resizable="none" >thumbs/template_widget_2x3.png</thumb>
- <thumb minWidth="3" minHeight="3" resizable="none" >thumbs/template_widget_3x3.png</thumb>
- <thumb minWidth="4" minHeight="3" resizable="none" >thumbs/template_widget_4x3.png</thumb>
- <thumb minWidth="1" minHeight="4" resizable="none" >thumbs/template_widget_1x4.png</thumb>
- <thumb minWidth="2" minHeight="4" resizable="none" >thumbs/template_widget_2x4.png</thumb>
- <thumb minWidth="3" minHeight="4" resizable="none" >thumbs/template_widget_3x4.png</thumb>
- <thumb minWidth="4" minHeight="4" resizable="none" >thumbs/template_widget_4x4.png</thumb>
-
- <thumb minWidth="1" minHeight="1" resizable="horizontal">thumbs/template_widget_1x1_h.png</thumb>
- <thumb minWidth="2" minHeight="1" resizable="horizontal">thumbs/template_widget_2x1_h.png</thumb>
- <thumb minWidth="3" minHeight="1" resizable="horizontal">thumbs/template_widget_3x1_h.png</thumb>
- <thumb minWidth="4" minHeight="1" resizable="horizontal">thumbs/template_widget_4x1_h.png</thumb>
- <thumb minWidth="1" minHeight="2" resizable="horizontal">thumbs/template_widget_1x2_h.png</thumb>
- <thumb minWidth="2" minHeight="2" resizable="horizontal">thumbs/template_widget_2x2_h.png</thumb>
- <thumb minWidth="3" minHeight="2" resizable="horizontal">thumbs/template_widget_3x2_h.png</thumb>
- <thumb minWidth="4" minHeight="2" resizable="horizontal">thumbs/template_widget_4x2_h.png</thumb>
- <thumb minWidth="1" minHeight="3" resizable="horizontal">thumbs/template_widget_1x3_h.png</thumb>
- <thumb minWidth="2" minHeight="3" resizable="horizontal">thumbs/template_widget_2x3_h.png</thumb>
- <thumb minWidth="3" minHeight="3" resizable="horizontal">thumbs/template_widget_3x3_h.png</thumb>
- <thumb minWidth="4" minHeight="3" resizable="horizontal">thumbs/template_widget_4x3_h.png</thumb>
- <thumb minWidth="1" minHeight="4" resizable="horizontal">thumbs/template_widget_1x4_h.png</thumb>
- <thumb minWidth="2" minHeight="4" resizable="horizontal">thumbs/template_widget_2x4_h.png</thumb>
- <thumb minWidth="3" minHeight="4" resizable="horizontal">thumbs/template_widget_3x4_h.png</thumb>
- <thumb minWidth="4" minHeight="4" resizable="horizontal">thumbs/template_widget_4x4_h.png</thumb>
-
- <thumb minWidth="1" minHeight="1" resizable="vertical" >thumbs/template_widget_1x1_v.png</thumb>
- <thumb minWidth="2" minHeight="1" resizable="vertical" >thumbs/template_widget_2x1_v.png</thumb>
- <thumb minWidth="3" minHeight="1" resizable="vertical" >thumbs/template_widget_3x1_v.png</thumb>
- <thumb minWidth="4" minHeight="1" resizable="vertical" >thumbs/template_widget_4x1_v.png</thumb>
- <thumb minWidth="1" minHeight="2" resizable="vertical" >thumbs/template_widget_1x2_v.png</thumb>
- <thumb minWidth="2" minHeight="2" resizable="vertical" >thumbs/template_widget_2x2_v.png</thumb>
- <thumb minWidth="3" minHeight="2" resizable="vertical" >thumbs/template_widget_3x2_v.png</thumb>
- <thumb minWidth="4" minHeight="2" resizable="vertical" >thumbs/template_widget_4x2_v.png</thumb>
- <thumb minWidth="1" minHeight="3" resizable="vertical" >thumbs/template_widget_1x3_v.png</thumb>
- <thumb minWidth="2" minHeight="3" resizable="vertical" >thumbs/template_widget_2x3_v.png</thumb>
- <thumb minWidth="3" minHeight="3" resizable="vertical" >thumbs/template_widget_3x3_v.png</thumb>
- <thumb minWidth="4" minHeight="3" resizable="vertical" >thumbs/template_widget_4x3_v.png</thumb>
- <thumb minWidth="1" minHeight="4" resizable="vertical" >thumbs/template_widget_1x4_v.png</thumb>
- <thumb minWidth="2" minHeight="4" resizable="vertical" >thumbs/template_widget_2x4_v.png</thumb>
- <thumb minWidth="3" minHeight="4" resizable="vertical" >thumbs/template_widget_3x4_v.png</thumb>
- <thumb minWidth="4" minHeight="4" resizable="vertical" >thumbs/template_widget_4x4_v.png</thumb>
-
- <thumb minWidth="1" minHeight="1" resizable="both" >thumbs/template_widget_1x1_vh.png</thumb>
- <thumb minWidth="2" minHeight="1" resizable="both" >thumbs/template_widget_2x1_vh.png</thumb>
- <thumb minWidth="3" minHeight="1" resizable="both" >thumbs/template_widget_3x1_vh.png</thumb>
- <thumb minWidth="4" minHeight="1" resizable="both" >thumbs/template_widget_4x1_vh.png</thumb>
- <thumb minWidth="1" minHeight="2" resizable="both" >thumbs/template_widget_1x2_vh.png</thumb>
- <thumb minWidth="2" minHeight="2" resizable="both" >thumbs/template_widget_2x2_vh.png</thumb>
- <thumb minWidth="3" minHeight="2" resizable="both" >thumbs/template_widget_3x2_vh.png</thumb>
- <thumb minWidth="4" minHeight="2" resizable="both" >thumbs/template_widget_4x2_vh.png</thumb>
- <thumb minWidth="1" minHeight="3" resizable="both" >thumbs/template_widget_1x3_vh.png</thumb>
- <thumb minWidth="2" minHeight="3" resizable="both" >thumbs/template_widget_2x3_vh.png</thumb>
- <thumb minWidth="3" minHeight="3" resizable="both" >thumbs/template_widget_3x3_vh.png</thumb>
- <thumb minWidth="4" minHeight="3" resizable="both" >thumbs/template_widget_4x3_vh.png</thumb>
- <thumb minWidth="1" minHeight="4" resizable="both" >thumbs/template_widget_1x4_vh.png</thumb>
- <thumb minWidth="2" minHeight="4" resizable="both" >thumbs/template_widget_2x4_vh.png</thumb>
- <thumb minWidth="3" minHeight="4" resizable="both" >thumbs/template_widget_3x4_vh.png</thumb>
- <thumb minWidth="4" minHeight="4" resizable="both" >thumbs/template_widget_4x4_vh.png</thumb>
- </thumbs>
-
-</template>
diff --git a/templates/other/AppWidget/thumbs/template_widget_1x1.png b/templates/other/AppWidget/thumbs/template_widget_1x1.png
deleted file mode 100644
index 8b34a24..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_1x1.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_1x1_h.png b/templates/other/AppWidget/thumbs/template_widget_1x1_h.png
deleted file mode 100644
index 38ce687..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_1x1_h.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_1x1_v.png b/templates/other/AppWidget/thumbs/template_widget_1x1_v.png
deleted file mode 100644
index 0aedac7..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_1x1_v.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_1x1_vh.png b/templates/other/AppWidget/thumbs/template_widget_1x1_vh.png
deleted file mode 100644
index 301ee0f..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_1x1_vh.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_1x2.png b/templates/other/AppWidget/thumbs/template_widget_1x2.png
deleted file mode 100644
index 0e4181d..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_1x2.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_1x2_h.png b/templates/other/AppWidget/thumbs/template_widget_1x2_h.png
deleted file mode 100644
index 37f3b94..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_1x2_h.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_1x2_v.png b/templates/other/AppWidget/thumbs/template_widget_1x2_v.png
deleted file mode 100644
index 2d13903..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_1x2_v.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_1x2_vh.png b/templates/other/AppWidget/thumbs/template_widget_1x2_vh.png
deleted file mode 100644
index 431f929..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_1x2_vh.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_1x3.png b/templates/other/AppWidget/thumbs/template_widget_1x3.png
deleted file mode 100644
index b0fb55a..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_1x3.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_1x3_h.png b/templates/other/AppWidget/thumbs/template_widget_1x3_h.png
deleted file mode 100644
index 14fdc46..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_1x3_h.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_1x3_v.png b/templates/other/AppWidget/thumbs/template_widget_1x3_v.png
deleted file mode 100644
index 136b8de..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_1x3_v.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_1x3_vh.png b/templates/other/AppWidget/thumbs/template_widget_1x3_vh.png
deleted file mode 100644
index 5e18856..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_1x3_vh.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_1x4.png b/templates/other/AppWidget/thumbs/template_widget_1x4.png
deleted file mode 100644
index 2922d34..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_1x4.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_1x4_h.png b/templates/other/AppWidget/thumbs/template_widget_1x4_h.png
deleted file mode 100644
index 462c802..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_1x4_h.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_1x4_v.png b/templates/other/AppWidget/thumbs/template_widget_1x4_v.png
deleted file mode 100644
index f239e73..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_1x4_v.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_1x4_vh.png b/templates/other/AppWidget/thumbs/template_widget_1x4_vh.png
deleted file mode 100644
index b05e168..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_1x4_vh.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_2x1.png b/templates/other/AppWidget/thumbs/template_widget_2x1.png
deleted file mode 100644
index 9e14ef8..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_2x1.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_2x1_h.png b/templates/other/AppWidget/thumbs/template_widget_2x1_h.png
deleted file mode 100644
index 3a8019e..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_2x1_h.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_2x1_v.png b/templates/other/AppWidget/thumbs/template_widget_2x1_v.png
deleted file mode 100644
index d09ff28..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_2x1_v.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_2x1_vh.png b/templates/other/AppWidget/thumbs/template_widget_2x1_vh.png
deleted file mode 100644
index b6093e1..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_2x1_vh.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_2x2.png b/templates/other/AppWidget/thumbs/template_widget_2x2.png
deleted file mode 100644
index 2894704..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_2x2.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_2x2_h.png b/templates/other/AppWidget/thumbs/template_widget_2x2_h.png
deleted file mode 100644
index a2ab77c..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_2x2_h.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_2x2_v.png b/templates/other/AppWidget/thumbs/template_widget_2x2_v.png
deleted file mode 100644
index c09f1f7..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_2x2_v.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_2x2_vh.png b/templates/other/AppWidget/thumbs/template_widget_2x2_vh.png
deleted file mode 100644
index 21becb2..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_2x2_vh.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_2x3.png b/templates/other/AppWidget/thumbs/template_widget_2x3.png
deleted file mode 100644
index 3226127..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_2x3.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_2x3_h.png b/templates/other/AppWidget/thumbs/template_widget_2x3_h.png
deleted file mode 100644
index db2037a..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_2x3_h.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_2x3_v.png b/templates/other/AppWidget/thumbs/template_widget_2x3_v.png
deleted file mode 100644
index af21176..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_2x3_v.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_2x3_vh.png b/templates/other/AppWidget/thumbs/template_widget_2x3_vh.png
deleted file mode 100644
index e0edfb4..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_2x3_vh.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_2x4.png b/templates/other/AppWidget/thumbs/template_widget_2x4.png
deleted file mode 100644
index dfcda22..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_2x4.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_2x4_h.png b/templates/other/AppWidget/thumbs/template_widget_2x4_h.png
deleted file mode 100644
index dc21139..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_2x4_h.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_2x4_v.png b/templates/other/AppWidget/thumbs/template_widget_2x4_v.png
deleted file mode 100644
index 6bfc884..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_2x4_v.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_2x4_vh.png b/templates/other/AppWidget/thumbs/template_widget_2x4_vh.png
deleted file mode 100644
index 922aeee..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_2x4_vh.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_3x1.png b/templates/other/AppWidget/thumbs/template_widget_3x1.png
deleted file mode 100644
index bb394b9..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_3x1.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_3x1_h.png b/templates/other/AppWidget/thumbs/template_widget_3x1_h.png
deleted file mode 100644
index 47b19c3..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_3x1_h.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_3x1_v.png b/templates/other/AppWidget/thumbs/template_widget_3x1_v.png
deleted file mode 100644
index 5575850..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_3x1_v.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_3x1_vh.png b/templates/other/AppWidget/thumbs/template_widget_3x1_vh.png
deleted file mode 100644
index c4a5f3f..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_3x1_vh.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_3x2.png b/templates/other/AppWidget/thumbs/template_widget_3x2.png
deleted file mode 100644
index 200fba4..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_3x2.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_3x2_h.png b/templates/other/AppWidget/thumbs/template_widget_3x2_h.png
deleted file mode 100644
index b027430..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_3x2_h.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_3x2_v.png b/templates/other/AppWidget/thumbs/template_widget_3x2_v.png
deleted file mode 100644
index b350ae8..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_3x2_v.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_3x2_vh.png b/templates/other/AppWidget/thumbs/template_widget_3x2_vh.png
deleted file mode 100644
index 129b706..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_3x2_vh.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_3x3.png b/templates/other/AppWidget/thumbs/template_widget_3x3.png
deleted file mode 100644
index 30dfb4b..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_3x3.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_3x3_h.png b/templates/other/AppWidget/thumbs/template_widget_3x3_h.png
deleted file mode 100644
index 9b062e9..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_3x3_h.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_3x3_v.png b/templates/other/AppWidget/thumbs/template_widget_3x3_v.png
deleted file mode 100644
index af8b494..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_3x3_v.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_3x3_vh.png b/templates/other/AppWidget/thumbs/template_widget_3x3_vh.png
deleted file mode 100644
index bc92413..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_3x3_vh.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_3x4.png b/templates/other/AppWidget/thumbs/template_widget_3x4.png
deleted file mode 100644
index 1759b62..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_3x4.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_3x4_h.png b/templates/other/AppWidget/thumbs/template_widget_3x4_h.png
deleted file mode 100644
index e09fa7e..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_3x4_h.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_3x4_v.png b/templates/other/AppWidget/thumbs/template_widget_3x4_v.png
deleted file mode 100644
index e6451fe..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_3x4_v.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_3x4_vh.png b/templates/other/AppWidget/thumbs/template_widget_3x4_vh.png
deleted file mode 100644
index 376611f..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_3x4_vh.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_4x1.png b/templates/other/AppWidget/thumbs/template_widget_4x1.png
deleted file mode 100644
index 75031c8..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_4x1.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_4x1_h.png b/templates/other/AppWidget/thumbs/template_widget_4x1_h.png
deleted file mode 100644
index 7a4b81f..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_4x1_h.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_4x1_v.png b/templates/other/AppWidget/thumbs/template_widget_4x1_v.png
deleted file mode 100644
index 2c8c604..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_4x1_v.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_4x1_vh.png b/templates/other/AppWidget/thumbs/template_widget_4x1_vh.png
deleted file mode 100644
index 0b43cd7..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_4x1_vh.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_4x2.png b/templates/other/AppWidget/thumbs/template_widget_4x2.png
deleted file mode 100644
index 8328141..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_4x2.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_4x2_h.png b/templates/other/AppWidget/thumbs/template_widget_4x2_h.png
deleted file mode 100644
index d83062c..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_4x2_h.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_4x2_v.png b/templates/other/AppWidget/thumbs/template_widget_4x2_v.png
deleted file mode 100644
index 561f47a..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_4x2_v.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_4x2_vh.png b/templates/other/AppWidget/thumbs/template_widget_4x2_vh.png
deleted file mode 100644
index 132ccd1..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_4x2_vh.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_4x3.png b/templates/other/AppWidget/thumbs/template_widget_4x3.png
deleted file mode 100644
index c3ea452..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_4x3.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_4x3_h.png b/templates/other/AppWidget/thumbs/template_widget_4x3_h.png
deleted file mode 100644
index 57d84ce..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_4x3_h.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_4x3_v.png b/templates/other/AppWidget/thumbs/template_widget_4x3_v.png
deleted file mode 100644
index e8d93fc..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_4x3_v.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_4x3_vh.png b/templates/other/AppWidget/thumbs/template_widget_4x3_vh.png
deleted file mode 100644
index 71dfbb3..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_4x3_vh.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_4x4.png b/templates/other/AppWidget/thumbs/template_widget_4x4.png
deleted file mode 100644
index 340244f..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_4x4.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_4x4_h.png b/templates/other/AppWidget/thumbs/template_widget_4x4_h.png
deleted file mode 100644
index f20c14e..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_4x4_h.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_4x4_v.png b/templates/other/AppWidget/thumbs/template_widget_4x4_v.png
deleted file mode 100644
index d490c79..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_4x4_v.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/AppWidget/thumbs/template_widget_4x4_vh.png b/templates/other/AppWidget/thumbs/template_widget_4x4_vh.png
deleted file mode 100644
index 52e1b4d..0000000
--- a/templates/other/AppWidget/thumbs/template_widget_4x4_vh.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/BlankFragment/globals.xml.ftl b/templates/other/BlankFragment/globals.xml.ftl
deleted file mode 100644
index bfc27eb..0000000
--- a/templates/other/BlankFragment/globals.xml.ftl
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0"?>
-<globals>
- <global id="srcOut" value="src/${slashedPackageName(packageName)}" />
-</globals>
diff --git a/templates/other/BlankFragment/recipe.xml.ftl b/templates/other/BlankFragment/recipe.xml.ftl
deleted file mode 100644
index add6d27..0000000
--- a/templates/other/BlankFragment/recipe.xml.ftl
+++ /dev/null
@@ -1,18 +0,0 @@
-<?xml version="1.0"?>
-<recipe>
-
- <merge from="res/values/strings.xml" />
-
- <#if includeLayout>
- <instantiate from="res/layout/fragment_blank.xml.ftl"
- to="res/layout/fragment_${classToResource(className)}.xml" />
-
- <open file="res/layout/fragment_${classToResource(className)}.xml" />
- </#if>
-
- <open file="${srcOut}/${className}.java" />
-
- <instantiate from="src/app_package/BlankFragment.java.ftl"
- to="${srcOut}/${className}.java" />
-
-</recipe>
diff --git a/templates/other/BlankFragment/root/res/layout/fragment_blank.xml.ftl b/templates/other/BlankFragment/root/res/layout/fragment_blank.xml.ftl
deleted file mode 100644
index 3e04f05..0000000
--- a/templates/other/BlankFragment/root/res/layout/fragment_blank.xml.ftl
+++ /dev/null
@@ -1,13 +0,0 @@
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- tools:context=".${className}">
-
- <!-- TODO: Update blank fragment layout -->
- <TextView
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:text="@string/hello_blank_fragment" />
-
-</FrameLayout>
diff --git a/templates/other/BlankFragment/root/res/values/strings.xml b/templates/other/BlankFragment/root/res/values/strings.xml
deleted file mode 100644
index c8d8b1a..0000000
--- a/templates/other/BlankFragment/root/res/values/strings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-<resources>
-
-<!-- TODO: Remove or change this placeholder text -->
- <string name="hello_blank_fragment">Hello blank fragment</string>
-
-</resources>
diff --git a/templates/other/BlankFragment/root/src/app_package/BlankFragment.java.ftl b/templates/other/BlankFragment/root/src/app_package/BlankFragment.java.ftl
deleted file mode 100644
index 6b3fb1e..0000000
--- a/templates/other/BlankFragment/root/src/app_package/BlankFragment.java.ftl
+++ /dev/null
@@ -1,129 +0,0 @@
-package ${packageName};
-
-<#if includeCallbacks>import android.app.Activity;</#if>
-<#if includeCallbacks>import android.net.Uri;</#if>
-import android.os.Bundle;
-import android.support.v4.app.Fragment;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-<#if !includeLayout>import android.widget.TextView;</#if>
-
-/**
- * A simple {@link android.support.v4.app.Fragment} subclass.
-<#if includeCallbacks>
- * Activities that contain this fragment must implement the
- * {@link ${className}.OnFragmentInteractionListener} interface
- * to handle interaction events.
-</#if>
-<#if includeFactory>
- * Use the {@link ${className}#newInstance} factory method to
- * create an instance of this fragment.
-</#if>
- *
- */
-public class ${className} extends Fragment {
-<#if includeFactory>
- // TODO: Rename parameter arguments, choose names that match
- // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
- private static final String ARG_PARAM1 = "param1";
- private static final String ARG_PARAM2 = "param2";
-
- // TODO: Rename and change types of parameters
- private String mParam1;
- private String mParam2;
-</#if>
-
-<#if includeCallbacks>
- private OnFragmentInteractionListener mListener;
-</#if>
-
-<#if includeFactory>
- /**
- * Use this factory method to create a new instance of
- * this fragment using the provided parameters.
- *
- * @param param1 Parameter 1.
- * @param param2 Parameter 2.
- * @return A new instance of fragment ${className}.
- */
- // TODO: Rename and change types and number of parameters
- public static ${className} newInstance(String param1, String param2) {
- ${className} fragment = new ${className}();
- Bundle args = new Bundle();
- args.putString(ARG_PARAM1, param1);
- args.putString(ARG_PARAM2, param2);
- fragment.setArguments(args);
- return fragment;
- }
-</#if>
- public ${className}() {
- // Required empty public constructor
- }
-
-<#if includeFactory>
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- if (getArguments() != null) {
- mParam1 = getArguments().getString(ARG_PARAM1);
- mParam2 = getArguments().getString(ARG_PARAM2);
- }
- }
-</#if>
-
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
-<#if includeLayout>
- // Inflate the layout for this fragment
- return inflater.inflate(R.layout.fragment_${classToResource(className)}, container, false);
-<#else>
- TextView textView = new TextView(getActivity());
- textView.setText(R.string.hello_blank_fragment);
- return textView;
-</#if>
- }
-
-<#if includeCallbacks>
- // TODO: Rename method, update argument and hook method into UI event
- public void onButtonPressed(Uri uri) {
- if (mListener != null) {
- mListener.onFragmentInteraction(uri);
- }
- }
-
- @Override
- public void onAttach(Activity activity) {
- super.onAttach(activity);
- try {
- mListener = (OnFragmentInteractionListener) activity;
- } catch (ClassCastException e) {
- throw new ClassCastException(activity.toString()
- + " must implement OnFragmentInteractionListener");
- }
- }
-
- @Override
- public void onDetach() {
- super.onDetach();
- mListener = null;
- }
-
- /**
- * This interface must be implemented by activities that contain this
- * fragment to allow an interaction in this fragment to be communicated
- * to the activity and potentially other fragments contained in that
- * activity.
- * <p>
- * See the Android Training lesson <a href=
- * "http://developer.android.com/training/basics/fragments/communicating.html"
- * >Communicating with Other Fragments</a> for more information.
- */
- public interface OnFragmentInteractionListener {
- // TODO: Update argument type and name
- public void onFragmentInteraction(Uri uri);
- }
-</#if>
-
-}
diff --git a/templates/other/BlankFragment/template.xml b/templates/other/BlankFragment/template.xml
deleted file mode 100644
index 9434c18..0000000
--- a/templates/other/BlankFragment/template.xml
+++ /dev/null
@@ -1,50 +0,0 @@
-<?xml version="1.0"?>
-<template
- format="3"
- revision="1"
- name="New Blank Fragment"
- description="Creates a blank fragment that is compatible back to API level 4."
- minApi="7"
- minBuildApi="8">
-
- <dependency name="android-support-v4" revision="8" />
-
- <category value="Other" />
-
- <parameter
- id="className"
- name="Fragment Name"
- type="string"
- constraints="class|nonempty|unique"
- default="BlankFragment"
- help="The name of the fragment class to create" />
-
- <parameter
- id="includeLayout"
- name="Create layout XML?"
- type="boolean"
- default="true"
- help="Generate a layout XML for the fragment" />
-
- <parameter
- id="includeFactory"
- name="Include fragment factory methods?"
- type="boolean"
- default="true"
- help="Generate static fragment factory methods for easy instantiation" />
-
- <parameter
- id="includeCallbacks"
- name="Include interface callbacks?"
- type="boolean"
- default="true"
- help="Generate event callbacks for communication with an Activity or other fragments" />
-
- <thumbs>
- <thumb>template_blank_fragment.png</thumb>
- </thumbs>
-
- <globals file="globals.xml.ftl" />
- <execute file="recipe.xml.ftl" />
-
-</template>
diff --git a/templates/other/BlankFragment/template_blank_fragment.png b/templates/other/BlankFragment/template_blank_fragment.png
deleted file mode 100644
index e0e71ce..0000000
--- a/templates/other/BlankFragment/template_blank_fragment.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/BroadcastReceiver/globals.xml.ftl b/templates/other/BroadcastReceiver/globals.xml.ftl
deleted file mode 100644
index bfc27eb..0000000
--- a/templates/other/BroadcastReceiver/globals.xml.ftl
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0"?>
-<globals>
- <global id="srcOut" value="src/${slashedPackageName(packageName)}" />
-</globals>
diff --git a/templates/other/BroadcastReceiver/recipe.xml.ftl b/templates/other/BroadcastReceiver/recipe.xml.ftl
deleted file mode 100644
index a9d2623..0000000
--- a/templates/other/BroadcastReceiver/recipe.xml.ftl
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0"?>
-<recipe>
- <merge from="AndroidManifest.xml.ftl" />
- <instantiate from="src/app_package/BroadcastReceiver.java.ftl"
- to="${srcOut}/${className}.java" />
- <open file="${srcOut}/${className}.java" />
-</recipe>
diff --git a/templates/other/BroadcastReceiver/root/AndroidManifest.xml.ftl b/templates/other/BroadcastReceiver/root/AndroidManifest.xml.ftl
deleted file mode 100644
index 27b60b0..0000000
--- a/templates/other/BroadcastReceiver/root/AndroidManifest.xml.ftl
+++ /dev/null
@@ -1,10 +0,0 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" >
-
- <application>
- <receiver android:name=".${className}"
- android:exported="${isExported?string}"
- android:enabled="${isEnabled?string}" >
- </receiver>
- </application>
-
-</manifest>
diff --git a/templates/other/BroadcastReceiver/root/src/app_package/BroadcastReceiver.java.ftl b/templates/other/BroadcastReceiver/root/src/app_package/BroadcastReceiver.java.ftl
deleted file mode 100644
index 560c132..0000000
--- a/templates/other/BroadcastReceiver/root/src/app_package/BroadcastReceiver.java.ftl
+++ /dev/null
@@ -1,17 +0,0 @@
-package ${packageName};
-
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-
-public class ${className} extends BroadcastReceiver {
- public ${className}() {
- }
-
- @Override
- public void onReceive(Context context, Intent intent) {
- // TODO: This method is called when the BroadcastReceiver is receiving
- // an Intent broadcast.
- throw new UnsupportedOperationException("Not yet implemented");
- }
-}
diff --git a/templates/other/BroadcastReceiver/template.xml b/templates/other/BroadcastReceiver/template.xml
deleted file mode 100644
index b17851e..0000000
--- a/templates/other/BroadcastReceiver/template.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0"?>
-<template
- format="1"
- revision="1"
- name="Broadcast Receiver"
- description="Creates a new broadcast receiver component and adds it to your Android manifest.">
-
- <parameter
- id="className"
- name="Class Name"
- type="string"
- constraints="class|unique|nonempty"
- default="MyReceiver" />
-
- <parameter
- id="isExported"
- name="Exported"
- type="boolean"
- default="true"
- help="Whether or not the broadcast receiver can receive messages from sources outside its application" />
-
- <parameter
- id="isEnabled"
- name="Enabled"
- type="boolean"
- default="true"
- help="Whether or not the broadcast receiver can be instantiated by the system" />
-
- <globals file="globals.xml.ftl" />
- <execute file="recipe.xml.ftl" />
-
-</template>
diff --git a/templates/other/ContentProvider/globals.xml.ftl b/templates/other/ContentProvider/globals.xml.ftl
deleted file mode 100644
index bfc27eb..0000000
--- a/templates/other/ContentProvider/globals.xml.ftl
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0"?>
-<globals>
- <global id="srcOut" value="src/${slashedPackageName(packageName)}" />
-</globals>
diff --git a/templates/other/ContentProvider/recipe.xml.ftl b/templates/other/ContentProvider/recipe.xml.ftl
deleted file mode 100644
index 6cdad82..0000000
--- a/templates/other/ContentProvider/recipe.xml.ftl
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0"?>
-<recipe>
- <merge from="AndroidManifest.xml.ftl" />
- <instantiate from="src/app_package/ContentProvider.java.ftl"
- to="${srcOut}/${className}.java" />
- <open file="${srcOut}/${className}.java" />
-</recipe>
diff --git a/templates/other/ContentProvider/root/AndroidManifest.xml.ftl b/templates/other/ContentProvider/root/AndroidManifest.xml.ftl
deleted file mode 100644
index 6fa4afc..0000000
--- a/templates/other/ContentProvider/root/AndroidManifest.xml.ftl
+++ /dev/null
@@ -1,11 +0,0 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" >
-
- <application>
- <provider android:name=".${className}"
- android:authorities="${authorities}"
- android:exported="${isExported?string}"
- android:enabled="${isEnabled?string}" >
- </provider>
- </application>
-
-</manifest>
diff --git a/templates/other/ContentProvider/root/src/app_package/ContentProvider.java.ftl b/templates/other/ContentProvider/root/src/app_package/ContentProvider.java.ftl
deleted file mode 100644
index e5b43b5..0000000
--- a/templates/other/ContentProvider/root/src/app_package/ContentProvider.java.ftl
+++ /dev/null
@@ -1,50 +0,0 @@
-package ${packageName};
-
-import android.content.ContentProvider;
-import android.content.ContentValues;
-import android.database.Cursor;
-import android.net.Uri;
-
-public class ${className} extends ContentProvider {
- public ${className}() {
- }
-
- @Override
- public int delete(Uri uri, String selection, String[] selectionArgs) {
- // Implement this to handle requests to delete one or more rows.
- throw new UnsupportedOperationException("Not yet implemented");
- }
-
- @Override
- public String getType(Uri uri) {
- // TODO: Implement this to handle requests for the MIME type of the data
- // at the given URI.
- throw new UnsupportedOperationException("Not yet implemented");
- }
-
- @Override
- public Uri insert(Uri uri, ContentValues values) {
- // TODO: Implement this to handle requests to insert a new row.
- throw new UnsupportedOperationException("Not yet implemented");
- }
-
- @Override
- public boolean onCreate() {
- // TODO: Implement this to initialize your content provider on startup.
- return false;
- }
-
- @Override
- public Cursor query(Uri uri, String[] projection, String selection,
- String[] selectionArgs, String sortOrder) {
- // TODO: Implement this to handle query requests from clients.
- throw new UnsupportedOperationException("Not yet implemented");
- }
-
- @Override
- public int update(Uri uri, ContentValues values, String selection,
- String[] selectionArgs) {
- // TODO: Implement this to handle requests to update one or more rows.
- throw new UnsupportedOperationException("Not yet implemented");
- }
-}
diff --git a/templates/other/ContentProvider/template.xml b/templates/other/ContentProvider/template.xml
deleted file mode 100644
index 21ed1be..0000000
--- a/templates/other/ContentProvider/template.xml
+++ /dev/null
@@ -1,40 +0,0 @@
-<?xml version="1.0"?>
-<template
- format="1"
- revision="1"
- name="Content Provider"
- description="Creates a new content provider component and adds it to your Android manifest.">
-
- <parameter
- id="className"
- name="Class Name"
- type="string"
- constraints="class|unique|nonempty"
- default="MyContentProvider" />
-
- <parameter
- id="authorities"
- name="URI Authorities"
- type="string"
- constraints="nonempty"
- default=""
- help="A list of one or more URI authorities that identify data under the purview of the content provider. " />
-
- <parameter
- id="isExported"
- name="Exported"
- type="boolean"
- default="true"
- help="Whether or not the content provider can be used by components of other applications " />
-
- <parameter
- id="isEnabled"
- name="Enabled"
- type="boolean"
- default="true"
- help="Whether or not the content provider can be instantiated by the system " />
-
- <globals file="globals.xml.ftl" />
- <execute file="recipe.xml.ftl" />
-
-</template>
diff --git a/templates/other/CustomView/globals.xml.ftl b/templates/other/CustomView/globals.xml.ftl
deleted file mode 100644
index d2eeb40..0000000
--- a/templates/other/CustomView/globals.xml.ftl
+++ /dev/null
@@ -1,5 +0,0 @@
-<?xml version="1.0"?>
-<globals>
- <global id="srcOut" value="src/${slashedPackageName(packageName)}" />
- <global id="view_class" value="${camelCaseToUnderscore(viewClass)}" />
-</globals>
diff --git a/templates/other/CustomView/recipe.xml.ftl b/templates/other/CustomView/recipe.xml.ftl
deleted file mode 100644
index d152df0..0000000
--- a/templates/other/CustomView/recipe.xml.ftl
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0"?>
-<recipe>
- <merge from="res/values/attrs.xml.ftl"
- to="res/values/attrs_${view_class}.xml" />
- <instantiate from="res/layout/sample.xml.ftl"
- to="res/layout/sample_${view_class}.xml" />
-
- <instantiate from="src/app_package/CustomView.java.ftl"
- to="${srcOut}/${viewClass}.java" />
-
- <open file="${srcOut}/${viewClass}.java" />
- <open file="res/layout/sample_${view_class}.xml" />
-</recipe>
diff --git a/templates/other/CustomView/root/res/layout/sample.xml.ftl b/templates/other/CustomView/root/res/layout/sample.xml.ftl
deleted file mode 100755
index 03125b2..0000000
--- a/templates/other/CustomView/root/res/layout/sample.xml.ftl
+++ /dev/null
@@ -1,22 +0,0 @@
-<FrameLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
-<#if !isLibraryProject>
- xmlns:app="http://schemas.android.com/apk/res/${packageName}"
-<#else>
- xmlns:app="http://schemas.android.com/apk/res-auto"
-</#if>
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <${packageName}.${viewClass}
- android:background="#ccc"
- android:layout_width="300dp"
- android:layout_height="300dp"
- android:paddingLeft="20dp"
- android:paddingBottom="40dp"
- app:exampleDimension="24sp"
- app:exampleColor="#33b5e5"
- app:exampleString="Hello, ${viewClass}"
- app:exampleDrawable="@android:drawable/ic_menu_add" />
-
-</FrameLayout>
diff --git a/templates/other/CustomView/root/res/values/attrs.xml.ftl b/templates/other/CustomView/root/res/values/attrs.xml.ftl
deleted file mode 100755
index 89059d2..0000000
--- a/templates/other/CustomView/root/res/values/attrs.xml.ftl
+++ /dev/null
@@ -1,8 +0,0 @@
-<resources>
- <declare-styleable name="${viewClass}">
- <attr name="exampleString" format="string" />
- <attr name="exampleDimension" format="dimension" />
- <attr name="exampleColor" format="color" />
- <attr name="exampleDrawable" format="color|reference" />
- </declare-styleable>
-</resources>
diff --git a/templates/other/CustomView/root/src/app_package/CustomView.java.ftl b/templates/other/CustomView/root/src/app_package/CustomView.java.ftl
deleted file mode 100644
index e1c7e13..0000000
--- a/templates/other/CustomView/root/src/app_package/CustomView.java.ftl
+++ /dev/null
@@ -1,181 +0,0 @@
-package ${packageName};
-
-import android.content.Context;
-import android.content.res.TypedArray;
-import android.graphics.Canvas;
-import android.graphics.Color;
-import android.graphics.Paint;
-import android.graphics.drawable.Drawable;
-import android.text.TextPaint;
-import android.util.AttributeSet;
-import android.view.View;
-
-/**
- * TODO: document your custom view class.
- */
-public class ${viewClass} extends View {
- private String mExampleString; // TODO: use a default from R.string...
- private int mExampleColor = Color.RED; // TODO: use a default from R.color...
- private float mExampleDimension = 0; // TODO: use a default from R.dimen...
- private Drawable mExampleDrawable;
-
- private TextPaint mTextPaint;
- private float mTextWidth;
- private float mTextHeight;
-
- public ${viewClass}(Context context) {
- super(context);
- init(null, 0);
- }
-
- public ${viewClass}(Context context, AttributeSet attrs) {
- super(context, attrs);
- init(attrs, 0);
- }
-
- public ${viewClass}(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- init(attrs, defStyle);
- }
-
- private void init(AttributeSet attrs, int defStyle) {
- // Load attributes
- final TypedArray a = getContext().obtainStyledAttributes(
- attrs, R.styleable.${viewClass}, defStyle, 0);
-
- mExampleString = a.getString(
- R.styleable.${viewClass}_exampleString);
- mExampleColor = a.getColor(
- R.styleable.${viewClass}_exampleColor,
- mExampleColor);
- // Use getDimensionPixelSize or getDimensionPixelOffset when dealing with
- // values that should fall on pixel boundaries.
- mExampleDimension = a.getDimension(
- R.styleable.${viewClass}_exampleDimension,
- mExampleDimension);
-
- if (a.hasValue(R.styleable.${viewClass}_exampleDrawable)) {
- mExampleDrawable = a.getDrawable(
- R.styleable.${viewClass}_exampleDrawable);
- mExampleDrawable.setCallback(this);
- }
-
- a.recycle();
-
- // Set up a default TextPaint object
- mTextPaint = new TextPaint();
- mTextPaint.setFlags(Paint.ANTI_ALIAS_FLAG);
- mTextPaint.setTextAlign(Paint.Align.LEFT);
-
- // Update TextPaint and text measurements from attributes
- invalidateTextPaintAndMeasurements();
- }
-
- private void invalidateTextPaintAndMeasurements() {
- mTextPaint.setTextSize(mExampleDimension);
- mTextPaint.setColor(mExampleColor);
- mTextWidth = mTextPaint.measureText(mExampleString);
-
- Paint.FontMetrics fontMetrics = mTextPaint.getFontMetrics();
- mTextHeight = fontMetrics.bottom;
- }
-
- @Override
- protected void onDraw(Canvas canvas) {
- super.onDraw(canvas);
-
- // TODO: consider storing these as member variables to reduce
- // allocations per draw cycle.
- int paddingLeft = getPaddingLeft();
- int paddingTop = getPaddingTop();
- int paddingRight = getPaddingRight();
- int paddingBottom = getPaddingBottom();
-
- int contentWidth = getWidth() - paddingLeft - paddingRight;
- int contentHeight = getHeight() - paddingTop - paddingBottom;
-
- // Draw the text.
- canvas.drawText(mExampleString,
- paddingLeft + (contentWidth - mTextWidth) / 2,
- paddingTop + (contentHeight + mTextHeight) / 2,
- mTextPaint);
-
- // Draw the example drawable on top of the text.
- if (mExampleDrawable != null) {
- mExampleDrawable.setBounds(paddingLeft, paddingTop,
- paddingLeft + contentWidth, paddingTop + contentHeight);
- mExampleDrawable.draw(canvas);
- }
- }
-
- /**
- * Gets the example string attribute value.
- * @return The example string attribute value.
- */
- public String getExampleString() {
- return mExampleString;
- }
-
- /**
- * Sets the view's example string attribute value. In the example view, this string
- * is the text to draw.
- * @param exampleString The example string attribute value to use.
- */
- public void setExampleString(String exampleString) {
- mExampleString = exampleString;
- invalidateTextPaintAndMeasurements();
- }
-
- /**
- * Gets the example color attribute value.
- * @return The example color attribute value.
- */
- public int getExampleColor() {
- return mExampleColor;
- }
-
- /**
- * Sets the view's example color attribute value. In the example view, this color
- * is the font color.
- * @param exampleColor The example color attribute value to use.
- */
- public void setExampleColor(int exampleColor) {
- mExampleColor = exampleColor;
- invalidateTextPaintAndMeasurements();
- }
-
- /**
- * Gets the example dimension attribute value.
- * @return The example dimension attribute value.
- */
- public float getExampleDimension() {
- return mExampleDimension;
- }
-
- /**
- * Sets the view's example dimension attribute value. In the example view, this dimension
- * is the font size.
- * @param exampleDimension The example dimension attribute value to use.
- */
- public void setExampleDimension(float exampleDimension) {
- mExampleDimension = exampleDimension;
- invalidateTextPaintAndMeasurements();
- }
-
- /**
- * Gets the example drawable attribute value.
- * @return The example drawable attribute value.
- */
- public Drawable getExampleDrawable() {
- return mExampleDrawable;
- }
-
- /**
- * Sets the view's example drawable attribute value. In the example view, this drawable is
- * drawn above the text.
- * @param exampleDrawable The example drawable attribute value to use.
- */
- public void setExampleDrawable(Drawable exampleDrawable) {
- mExampleDrawable = exampleDrawable;
- }
-}
diff --git a/templates/other/CustomView/template.xml b/templates/other/CustomView/template.xml
deleted file mode 100644
index 55f6f3d..0000000
--- a/templates/other/CustomView/template.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0"?>
-<template
- format="1"
- revision="1"
- name="Custom View"
- description="Creates a new custom view that extends android.view.View and exposes custom attributes.">
-
- <category value="UI Components" />
-
- <parameter
- id="packageName"
- name="Package name"
- type="string"
- constraints="package"
- default="com.mycompany.myapp" />
-
- <parameter
- id="viewClass"
- name="View Class"
- type="string"
- constraints="class|unique|nonempty"
- default="MyView"
- help="By convention, should end in 'View'" />
-
- <globals file="globals.xml.ftl" />
- <execute file="recipe.xml.ftl" />
-
-</template>
diff --git a/templates/other/Daydream/globals.xml.ftl b/templates/other/Daydream/globals.xml.ftl
deleted file mode 100644
index 04537f9..0000000
--- a/templates/other/Daydream/globals.xml.ftl
+++ /dev/null
@@ -1,8 +0,0 @@
-<?xml version="1.0"?>
-<globals>
- <global id="srcOut" value="src/${slashedPackageName(packageName)}" />
- <global id="class_name" value="${classToResource(className)}" />
- <global id="info_name" value="${classToResource(className)}_info" />
- <global id="settingsClassName" value="${className}SettingsActivity" />
- <global id="prefs_name" value="${classToResource(className)}_prefs" />
-</globals>
diff --git a/templates/other/Daydream/recipe.xml.ftl b/templates/other/Daydream/recipe.xml.ftl
deleted file mode 100644
index 8db9811..0000000
--- a/templates/other/Daydream/recipe.xml.ftl
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0"?>
-<recipe>
-
- <merge from="AndroidManifest.xml.ftl" />
- <merge from="res/values/strings.xml.ftl" />
-
- <copy from="res/layout-v17/dream.xml"
- to="res/layout-v17/${class_name}.xml" />
-
- <instantiate from="src/app_package/DreamService.java.ftl"
- to="${srcOut}/${className}.java" />
-
-<#if configurable>
- <copy from="res/xml/dream_prefs.xml"
- to="res/xml/${prefs_name}.xml" />
-
- <instantiate from="src/app_package/SettingsActivity.java.ftl"
- to="${srcOut}/${settingsClassName}.java" />
-
- <instantiate from="res/xml/xml_dream.xml.ftl"
- to="res/xml/${info_name}.xml" />
-</#if>
-
- <open file="${srcOut}/${className}.java" />
-
-</recipe>
diff --git a/templates/other/Daydream/root/AndroidManifest.xml.ftl b/templates/other/Daydream/root/AndroidManifest.xml.ftl
deleted file mode 100644
index c23bc6e..0000000
--- a/templates/other/Daydream/root/AndroidManifest.xml.ftl
+++ /dev/null
@@ -1,28 +0,0 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android">
-
- <application>
-
-<#if configurable>
- <activity
- android:name=".${settingsClassName}" />
-</#if>
-
- <!-- This service is only used on devices with API v17+ -->
- <service
- android:name=".${className}"
- android:exported="true" >
- <intent-filter>
- <action android:name="android.service.dreams.DreamService" />
- <category android:name="android.intent.category.DEFAULT" />
- </intent-filter>
-<#if configurable>
-
- <!-- Point to additional information for this dream -->
- <meta-data
- android:name="android.service.dream"
- android:resource="@xml/${info_name}" />
-</#if>
- </service>
- </application>
-
-</manifest>
diff --git a/templates/other/Daydream/root/res/layout-v17/dream.xml b/templates/other/Daydream/root/res/layout-v17/dream.xml
deleted file mode 100644
index 25593f3..0000000
--- a/templates/other/Daydream/root/res/layout-v17/dream.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- android:layout_width="match_parent"
- android:layout_height="match_parent" >
-
- <TextView
- android:id="@+id/dream_text"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:fontFamily="sans-serif-light"
- android:textSize="50sp" />
-
-</FrameLayout>
diff --git a/templates/other/Daydream/root/res/values/strings.xml.ftl b/templates/other/Daydream/root/res/values/strings.xml.ftl
deleted file mode 100644
index b3d208f..0000000
--- a/templates/other/Daydream/root/res/values/strings.xml.ftl
+++ /dev/null
@@ -1,7 +0,0 @@
-<resources>
- <string name="pref_dream_text_key">pref_dream_text</string>
- <string name="pref_dream_text_default">zzzZZZzzz</string>
-<#if configurable>
- <string name="pref_dream_text_title">Ticker text</string>
-</#if>
-</resources>
diff --git a/templates/other/Daydream/root/res/xml/dream_prefs.xml b/templates/other/Daydream/root/res/xml/dream_prefs.xml
deleted file mode 100644
index 997e5b2..0000000
--- a/templates/other/Daydream/root/res/xml/dream_prefs.xml
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android" >
-
- <EditTextPreference
- android:key="@string/pref_dream_text_key"
- android:title="@string/pref_dream_text_title"
- android:defaultValue="@string/pref_dream_text_default" />
-
-</PreferenceScreen>
diff --git a/templates/other/Daydream/root/res/xml/xml_dream.xml.ftl b/templates/other/Daydream/root/res/xml/xml_dream.xml.ftl
deleted file mode 100644
index 5367ae1..0000000
--- a/templates/other/Daydream/root/res/xml/xml_dream.xml.ftl
+++ /dev/null
@@ -1,3 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<dream xmlns:android="http://schemas.android.com/apk/res/android"
- android:settingsActivity="${packageName}/.${settingsClassName}" />
diff --git a/templates/other/Daydream/root/src/app_package/DreamService.java.ftl b/templates/other/Daydream/root/src/app_package/DreamService.java.ftl
deleted file mode 100644
index 30f080f..0000000
--- a/templates/other/Daydream/root/src/app_package/DreamService.java.ftl
+++ /dev/null
@@ -1,140 +0,0 @@
-package ${packageName};
-
-import java.util.Random;
-
-import android.animation.Animator;
-import android.animation.Animator.AnimatorListener;
-import android.animation.AnimatorListenerAdapter;
-import android.animation.TimeInterpolator;
-import android.annotation.TargetApi;
-import android.content.SharedPreferences;
-import android.graphics.Point;
-import android.os.Build;
-import android.preference.PreferenceManager;
-import android.service.dreams.DreamService;
-import android.view.ViewPropertyAnimator;
-import android.view.animation.LinearInterpolator;
-import android.widget.TextView;
-
-/**
- * This class is a sample implementation of a DreamService. When activated, a
- * TextView will repeatedly, move from the left to the right of screen, at a
- * random y-value.
-<#if configurable>
- * The generated {@link BlahDreamServiceSettingsActivity} allows
- * the user to change the text which is displayed.
-</#if>
- * <p />
- * Daydreams are only available on devices running API v17+.
- */
-@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
-public class ${className} extends DreamService {
-
- private static final TimeInterpolator sInterpolator = new LinearInterpolator();
-
- private final AnimatorListener mAnimListener = new AnimatorListenerAdapter() {
-
- @Override
- public void onAnimationEnd(Animator animation) {
- // Start animation again
- startTextViewScrollAnimation();
- }
-
- };
-
- private final Random mRandom = new Random();
- private final Point mPointSize = new Point();
-
- private TextView mDreamTextView;
- private ViewPropertyAnimator mAnimator;
-
- @Override
- public void onAttachedToWindow() {
- super.onAttachedToWindow();
-
- // Exit dream upon user touch?
-<#if isInteractive>
- setInteractive(true);
-<#else>
- setInteractive(false);
-</#if>
-
- // Hide system UI?
-<#if isFullscreen>
- setFullscreen(true);
-<#else>
- setFullscreen(false);
-</#if>
-
- // Keep screen at full brightness?
-<#if isScreenBright>
- setScreenBright(true);
-<#else>
- setScreenBright(false);
-</#if>
-
- // Set the content view, just like you would with an Activity.
- setContentView(R.layout.${class_name});
-
- mDreamTextView = (TextView) findViewById(R.id.dream_text);
- mDreamTextView.setText(getTextFromPreferences());
- }
-
- @Override
- public void onDreamingStarted() {
- super.onDreamingStarted();
-
- // TODO: Begin animations or other behaviors here.
-
- startTextViewScrollAnimation();
- }
-
- @Override
- public void onDreamingStopped() {
- super.onDreamingStopped();
-
- // TODO: Stop anything that was started in onDreamingStarted()
-
- mAnimator.cancel();
- }
-
- @Override
- public void onDetachedFromWindow() {
- super.onDetachedFromWindow();
-
- // TODO: Dismantle resources
- // (for example, detach from handlers and listeners).
- }
-
- private String getTextFromPreferences() {
- SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
- return prefs.getString(getString(R.string.pref_dream_text_key),
- getString(R.string.pref_dream_text_default));
- }
-
- private void startTextViewScrollAnimation() {
- // Refresh Size of Window
- getWindowManager().getDefaultDisplay().getSize(mPointSize);
-
- final int windowWidth = mPointSize.x;
- final int windowHeight = mPointSize.y;
-
- // Move TextView so it's moved all the way to the left
- mDreamTextView.setTranslationX(-mDreamTextView.getWidth());
-
- // Move TextView to random y value
- final int yRange = windowHeight - mDreamTextView.getHeight();
- mDreamTextView.setTranslationY(mRandom.nextInt(yRange));
-
- // Create an Animator and keep a reference to it
- mAnimator = mDreamTextView.animate().translationX(windowWidth)
- .setDuration(3000)
- .setStartDelay(500)
- .setListener(mAnimListener)
- .setInterpolator(sInterpolator);
-
- // Start the animation
- mAnimator.start();
- }
-
-}
diff --git a/templates/other/Daydream/root/src/app_package/SettingsActivity.java.ftl b/templates/other/Daydream/root/src/app_package/SettingsActivity.java.ftl
deleted file mode 100644
index 62d5887..0000000
--- a/templates/other/Daydream/root/src/app_package/SettingsActivity.java.ftl
+++ /dev/null
@@ -1,36 +0,0 @@
-package ${packageName};
-
-import android.annotation.TargetApi;
-import android.os.Build;
-import android.os.Bundle;
-import android.preference.PreferenceActivity;
-import android.preference.PreferenceFragment;
-
-/**
- * A settings Activity for {@link ${className}}.
- * <p />
- * A DreamService can only be used on devices with API v17+, so it is safe
- * for us to use a {@link PreferenceFragment} here.
- */
-@TargetApi(Build.VERSION_CODES.HONEYCOMB)
-public class ${settingsClassName} extends PreferenceActivity {
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
- getFragmentManager().beginTransaction()
- .replace(android.R.id.content, new DreamPreferenceFragment()).commit();
- }
-
- public static class DreamPreferenceFragment extends PreferenceFragment {
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- addPreferencesFromResource(R.xml.${prefs_name});
- }
-
- }
-
-}
diff --git a/templates/other/Daydream/template.xml b/templates/other/Daydream/template.xml
deleted file mode 100644
index 2014eee..0000000
--- a/templates/other/Daydream/template.xml
+++ /dev/null
@@ -1,49 +0,0 @@
-<?xml version="1.0"?>
-<template
- format="3"
- revision="1"
- name="New Daydream"
- description="Creates a new Daydream service component, for use on devices running Android 4.2 and later."
- minBuildApi="17">
-
- <category value="Other" />
-
- <parameter
- id="className"
- name="Class Name"
- type="string"
- constraints="class|unique|nonempty"
- default="MyDaydreamService" />
-
- <parameter
- id="isInteractive"
- name="Interactive?"
- type="boolean"
- default="false"
- help="Whether or not the Daydream is interactive. Touching anywhere on a non-interactive Daydreams dismisses it." />
-
- <parameter
- id="isFullscreen"
- name="Fullscreen?"
- type="boolean"
- default="true"
- help="Whether or not the Daydream should be in fullscreen mode (in which case system UI will be hidden)." />
-
- <parameter
- id="isScreenBright"
- name="Bright Screen?"
- type="boolean"
- default="true"
- help="Whether or not the screen should be bright when this Daydream is running. The screen will be dim otherwise." />
-
- <parameter
- id="configurable"
- name="Configuration Activity"
- type="boolean"
- default="false"
- help="Whether or not to generate an associated settings Activity." />
-
- <globals file="globals.xml.ftl" />
- <execute file="recipe.xml.ftl" />
-
-</template>
diff --git a/templates/other/ListFragment/globals.xml.ftl b/templates/other/ListFragment/globals.xml.ftl
deleted file mode 100644
index 577250d..0000000
--- a/templates/other/ListFragment/globals.xml.ftl
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0"?>
-<globals>
- <global id="srcOut" value="src/${slashedPackageName(packageName)}" />
- <global id="collection_name" value="${extractLetters(objectKind?lower_case)}" />
- <global id="className" value="${extractLetters(objectKind)}Fragment" />
- <global id="fragment_layout" value="fragment_${extractLetters(objectKind?lower_case)}" />
-</globals>
diff --git a/templates/other/ListFragment/recipe.xml.ftl b/templates/other/ListFragment/recipe.xml.ftl
deleted file mode 100644
index 5db4fdb..0000000
--- a/templates/other/ListFragment/recipe.xml.ftl
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0"?>
-<recipe>
-
-<#if switchGrid == true>
- <merge from="res/values/refs.xml.ftl" />
- <merge from="res/values/refs_lrg.xml.ftl"
- to="res/values-large/refs.xml" />
- <merge from="res/values/refs_lrg.xml.ftl"
- to="res/values-sw600dp/refs.xml" />
-
- <instantiate from="res/layout/fragment_grid.xml"
- to="res/layout/${fragment_layout}_grid.xml" />
-
- <instantiate from="res/layout/fragment_list.xml"
- to="res/layout/${fragment_layout}_list.xml" />
-</#if>
-
- <instantiate from="src/app_package/ListFragment.java.ftl"
- to="${srcOut}/${className}.java" />
-
- <instantiate from="src/app_package/dummy/DummyContent.java.ftl"
- to="${srcOut}/dummy/DummyContent.java" />
-
- <open file="${srcOut}/${className}.java" />
-
-</recipe>
diff --git a/templates/other/ListFragment/root/res/layout/fragment_grid.xml b/templates/other/ListFragment/root/res/layout/fragment_grid.xml
deleted file mode 100644
index 87ae969..0000000
--- a/templates/other/ListFragment/root/res/layout/fragment_grid.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- tools:context=".${className}">
-
- <GridView
- android:id="@android:id/list"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:numColumns="2" />
-
- <TextView
- android:id="@android:id/empty"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:gravity="center" />
-
-</FrameLayout> \ No newline at end of file
diff --git a/templates/other/ListFragment/root/res/layout/fragment_list.xml b/templates/other/ListFragment/root/res/layout/fragment_list.xml
deleted file mode 100644
index 5b0e178..0000000
--- a/templates/other/ListFragment/root/res/layout/fragment_list.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:tools="http://schemas.android.com/tools"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- tools:context=".${className}">
-
- <ListView
- android:id="@android:id/list"
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
-
- <TextView
- android:id="@android:id/empty"
- android:layout_width="match_parent"
- android:layout_height="match_parent"
- android:gravity="center" />
-
-</FrameLayout> \ No newline at end of file
diff --git a/templates/other/ListFragment/root/res/values-large/refs_lrg.xml.ftl b/templates/other/ListFragment/root/res/values-large/refs_lrg.xml.ftl
deleted file mode 100644
index fb20a27..0000000
--- a/templates/other/ListFragment/root/res/values-large/refs_lrg.xml.ftl
+++ /dev/null
@@ -1,12 +0,0 @@
-<resources>
-
- <!--
- Layout alias to replace the single-pane version of the layout with a
- two-pane version on Large screens.
-
- For more on layout aliases, see:
- http://developer.android.com/training/multiscreen/screensizes.html#TaskUseAliasFilters
- -->
- <item name="${fragment_layout}" type="layout">@layout/${fragment_layout}_grid</item>
-
-</resources> \ No newline at end of file
diff --git a/templates/other/ListFragment/root/res/values-sw600dp/refs_lrg.xml.ftl b/templates/other/ListFragment/root/res/values-sw600dp/refs_lrg.xml.ftl
deleted file mode 100644
index fb20a27..0000000
--- a/templates/other/ListFragment/root/res/values-sw600dp/refs_lrg.xml.ftl
+++ /dev/null
@@ -1,12 +0,0 @@
-<resources>
-
- <!--
- Layout alias to replace the single-pane version of the layout with a
- two-pane version on Large screens.
-
- For more on layout aliases, see:
- http://developer.android.com/training/multiscreen/screensizes.html#TaskUseAliasFilters
- -->
- <item name="${fragment_layout}" type="layout">@layout/${fragment_layout}_grid</item>
-
-</resources> \ No newline at end of file
diff --git a/templates/other/ListFragment/root/res/values/refs.xml.ftl b/templates/other/ListFragment/root/res/values/refs.xml.ftl
deleted file mode 100644
index 59ca92c..0000000
--- a/templates/other/ListFragment/root/res/values/refs.xml.ftl
+++ /dev/null
@@ -1,12 +0,0 @@
-<resources>
-
- <!--
- Layout alias to replace the single-pane version of the layout with a
- two-pane version on Large screens.
-
- For more on layout aliases, see:
- http://developer.android.com/training/multiscreen/screensizes.html#TaskUseAliasFilters
- -->
- <item name="${fragment_layout}" type="layout">@layout/${fragment_layout}_list</item>
-
-</resources> \ No newline at end of file
diff --git a/templates/other/ListFragment/root/res/values/refs_lrg.xml.ftl b/templates/other/ListFragment/root/res/values/refs_lrg.xml.ftl
deleted file mode 100644
index fb20a27..0000000
--- a/templates/other/ListFragment/root/res/values/refs_lrg.xml.ftl
+++ /dev/null
@@ -1,12 +0,0 @@
-<resources>
-
- <!--
- Layout alias to replace the single-pane version of the layout with a
- two-pane version on Large screens.
-
- For more on layout aliases, see:
- http://developer.android.com/training/multiscreen/screensizes.html#TaskUseAliasFilters
- -->
- <item name="${fragment_layout}" type="layout">@layout/${fragment_layout}_grid</item>
-
-</resources> \ No newline at end of file
diff --git a/templates/other/ListFragment/root/src/app_package/ListFragment.java.ftl b/templates/other/ListFragment/root/src/app_package/ListFragment.java.ftl
deleted file mode 100644
index 6100448..0000000
--- a/templates/other/ListFragment/root/src/app_package/ListFragment.java.ftl
+++ /dev/null
@@ -1,195 +0,0 @@
-package ${packageName};
-
-import android.app.Activity;
-import android.os.Bundle;
-<#if switchGrid == true>
-import android.support.v4.app.Fragment;
-import android.view.LayoutInflater;
-<#else>
-import android.support.v4.app.ListFragment;
-</#if>
-import android.view.View;
-<#if switchGrid == true>
-import android.view.ViewGroup;
-import android.widget.AbsListView;
-import android.widget.AdapterView;
-</#if>
-import android.widget.ArrayAdapter;
-<#if switchGrid == true>
-import android.widget.ListAdapter;
-import android.widget.TextView;
-<#else>
-import android.widget.ListView;
-</#if>
-
-import ${packageName}.dummy.DummyContent;
-
-/**
- * A fragment representing a list of Items.
- * <p />
-<#if switchGrid == true>
- * Large screen devices (such as tablets) are supported by replacing the ListView
- * with a GridView.
-</#if>
- * <p />
- * Activities containing this fragment MUST implement the {@link Callbacks}
- * interface.
- */
-<#if switchGrid == true>
-public class ${className} extends Fragment implements AbsListView.OnItemClickListener {
-<#else>
-public class ${className} extends ListFragment {
-</#if>
-
-<#if includeFactory>
- // TODO: Rename parameter arguments, choose names that match
- // the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
- private static final String ARG_PARAM1 = "param1";
- private static final String ARG_PARAM2 = "param2";
-
- // TODO: Rename and change types of parameters
- private String mParam1;
- private String mParam2;
-
-</#if>
- private OnFragmentInteractionListener mListener;
-
-<#if switchGrid == true>
- /**
- * The fragment's ListView/GridView.
- */
- private AbsListView mListView;
-
- /**
- * The Adapter which will be used to populate the ListView/GridView with
- * Views.
- */
- private ListAdapter mAdapter;
-
-</#if>
-<#if includeFactory>
- // TODO: Rename and change types of parameters
- public static ${className} newInstance(String param1, String param2) {
- ${className} fragment = new ${className}();
- Bundle args = new Bundle();
- args.putString(ARG_PARAM1, param1);
- args.putString(ARG_PARAM2, param2);
- fragment.setArguments(args);
- return fragment;
- }
-
-</#if>
- /**
- * Mandatory empty constructor for the fragment manager to instantiate the
- * fragment (e.g. upon screen orientation changes).
- */
- public ${className}() {
- }
-
- @Override
- public void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
-
-<#if includeFactory>
- if (getArguments() != null) {
- mParam1 = getArguments().getString(ARG_PARAM1);
- mParam2 = getArguments().getString(ARG_PARAM2);
- }
-</#if>
-
- // TODO: Change Adapter to display your content
-<#if switchGrid == true>
- mAdapter = new ArrayAdapter<DummyContent.DummyItem>(getActivity(),
- android.R.layout.simple_list_item_1, android.R.id.text1, DummyContent.ITEMS);
-<#else>
- setListAdapter(new ArrayAdapter<DummyContent.DummyItem>(getActivity(),
- android.R.layout.simple_list_item_1, android.R.id.text1, DummyContent.ITEMS));
-</#if>
- }
-
-<#if switchGrid == true>
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container,
- Bundle savedInstanceState) {
- View view = inflater.inflate(R.layout.${fragment_layout}, container, false);
-
- // Set the adapter
- mListView = (AbsListView) view.findViewById(android.R.id.list);
- ((AdapterView<ListAdapter>) mListView).setAdapter(mAdapter);
-
- // Set OnItemClickListener so we can be notified on item clicks
- mListView.setOnItemClickListener(this);
-
- return view;
- }
-</#if>
-
- @Override
- public void onAttach(Activity activity) {
- super.onAttach(activity);
- try {
- mListener = (OnFragmentInteractionListener) activity;
- } catch (ClassCastException e) {
- throw new ClassCastException(activity.toString()
- + " must implement OnFragmentInteractionListener");
- }
- }
-
- @Override
- public void onDetach() {
- super.onDetach();
- mListener = null;
- }
-
-
-<#if switchGrid == true>
- @Override
- public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
- if (null != mListener) {
- // Notify the active callbacks interface (the activity, if the
- // fragment is attached to one) that an item has been selected.
- mListener.onFragmentInteraction(DummyContent.ITEMS.get(position).id);
- }
- }
-
- /**
- * The default content for this Fragment has a TextView that is shown when
- * the list is empty. If you would like to change the text, call this method
- * to supply the text it should use.
- */
- public void setEmptyText(CharSequence emptyText) {
- View emptyView = mListView.getEmptyView();
-
- if (emptyText instanceof TextView) {
- ((TextView) emptyView).setText(emptyText);
- }
- }
-<#else>
- @Override
- public void onListItemClick(ListView l, View v, int position, long id) {
- super.onListItemClick(l, v, position, id);
-
- if (null != mListener) {
- // Notify the active callbacks interface (the activity, if the
- // fragment is attached to one) that an item has been selected.
- mListener.onFragmentInteraction(DummyContent.ITEMS.get(position).id);
- }
- }
-</#if>
-
- /**
- * This interface must be implemented by activities that contain this
- * fragment to allow an interaction in this fragment to be communicated
- * to the activity and potentially other fragments contained in that
- * activity.
- * <p>
- * See the Android Training lesson <a href=
- * "http://developer.android.com/training/basics/fragments/communicating.html"
- * >Communicating with Other Fragments</a> for more information.
- */
- public interface OnFragmentInteractionListener {
- // TODO: Update argument type and name
- public void onFragmentInteraction(String id);
- }
-
-}
diff --git a/templates/other/ListFragment/root/src/app_package/dummy/DummyContent.java.ftl b/templates/other/ListFragment/root/src/app_package/dummy/DummyContent.java.ftl
deleted file mode 100644
index 3545ba3..0000000
--- a/templates/other/ListFragment/root/src/app_package/dummy/DummyContent.java.ftl
+++ /dev/null
@@ -1,55 +0,0 @@
-package ${packageName}.dummy;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Helper class for providing sample content for user interfaces created by
- * Android template wizards.
- * <p>
- * TODO: Replace all uses of this class before publishing your app.
- */
-public class DummyContent {
-
- /**
- * An array of sample (dummy) items.
- */
- public static List<DummyItem> ITEMS = new ArrayList<DummyItem>();
-
- /**
- * A map of sample (dummy) items, by ID.
- */
- public static Map<String, DummyItem> ITEM_MAP = new HashMap<String, DummyItem>();
-
- static {
- // Add 3 sample items.
- addItem(new DummyItem("1", "Item 1"));
- addItem(new DummyItem("2", "Item 2"));
- addItem(new DummyItem("3", "Item 3"));
- }
-
- private static void addItem(DummyItem item) {
- ITEMS.add(item);
- ITEM_MAP.put(item.id, item);
- }
-
- /**
- * A dummy item representing a piece of content.
- */
- public static class DummyItem {
- public String id;
- public String content;
-
- public DummyItem(String id, String content) {
- this.id = id;
- this.content = content;
- }
-
- @Override
- public String toString() {
- return content;
- }
- }
-}
diff --git a/templates/other/ListFragment/template.xml b/templates/other/ListFragment/template.xml
deleted file mode 100644
index e00257c..0000000
--- a/templates/other/ListFragment/template.xml
+++ /dev/null
@@ -1,52 +0,0 @@
-<?xml version="1.0"?>
-<template
- format="3"
- revision="1"
- name="New List Fragment"
- description="Creates a new empty fragment containing a list that can optionally change to a grid when on large screens. Compatible back to API level 4."
- minApi="7"
- minBuildApi="8">
-
- <dependency name="android-support-v4" revision="8" />
-
- <category value="UI Components" />
-
- <parameter
- id="packageName"
- name="Package name"
- type="string"
- constraints="package"
- default="com.mycompany.myapp" />
-
- <parameter
- id="objectKind"
- name="Object Kind"
- type="string"
- constraints="nonempty"
- default="Item"
- help="Other examples are 'Person', 'Book', etc." />
-
- <parameter
- id="includeFactory"
- name="Include fragment factory methods?"
- type="boolean"
- default="true"
- help="Generate static fragment factory methods for easy instantiation" />
-
- <parameter
- id="switchGrid"
- name="Switch to grid view on large screens?"
- type="boolean"
- default="true" />
-
- <!-- 128x128 thumbnails relative to template.xml -->
- <thumbs>
- <!-- default thumbnail is required -->
- <thumb>templates_list_fragment.png</thumb>
- </thumbs>
-
-
- <globals file="globals.xml.ftl" />
- <execute file="recipe.xml.ftl" />
-
-</template>
diff --git a/templates/other/ListFragment/templates_list_fragment.png b/templates/other/ListFragment/templates_list_fragment.png
deleted file mode 100644
index 92ac799..0000000
--- a/templates/other/ListFragment/templates_list_fragment.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/Notification/globals.xml.ftl b/templates/other/Notification/globals.xml.ftl
deleted file mode 100644
index b302aa9..0000000
--- a/templates/other/Notification/globals.xml.ftl
+++ /dev/null
@@ -1,9 +0,0 @@
-<?xml version="1.0"?>
-<globals>
- <global id="srcOut" value="src/${slashedPackageName(packageName)}" />
- <global id="notificationName" value="${className?replace('notification','','i')}" />
- <global id="notification_name" value="${camelCaseToUnderscore(className?replace('notification','','i'))}" />
- <global id="display_title" value="${camelCaseToUnderscore(className?replace('notification','','i'))?replace('_',' ')?cap_first}" />
-
- <global id="icon_resource" value="ic_stat_${camelCaseToUnderscore(className?replace('notification','','i'))}" />
-</globals>
diff --git a/templates/other/Notification/recipe.xml.ftl b/templates/other/Notification/recipe.xml.ftl
deleted file mode 100644
index bd1c265..0000000
--- a/templates/other/Notification/recipe.xml.ftl
+++ /dev/null
@@ -1,25 +0,0 @@
-<?xml version="1.0"?>
-<recipe>
-
- <merge from="AndroidManifest.xml.ftl" />
-
- <#if expandedStyle == "picture">
- <copy from="res/drawable-nodpi/example_picture_large.png"
- to="res/drawable-nodpi/example_picture.png" />
- <#else>
- <copy from="res/drawable-nodpi/example_picture_small.png"
- to="res/drawable-nodpi/example_picture.png" />
- </#if>
-
- <#if moreActions>
- <copy from="res/drawable-hdpi" />
- <copy from="res/drawable-mdpi" />
- <copy from="res/drawable-xhdpi" />
- </#if>
-
- <merge from="res/values/strings.xml.ftl" />
-
- <instantiate from="src/app_package/NotificationHelper.java.ftl"
- to="${srcOut}/${className}.java" />
- <open file="${srcOut}/${className}.java" />
-</recipe>
diff --git a/templates/other/Notification/root/AndroidManifest.xml.ftl b/templates/other/Notification/root/AndroidManifest.xml.ftl
deleted file mode 100644
index fb564cc..0000000
--- a/templates/other/Notification/root/AndroidManifest.xml.ftl
+++ /dev/null
@@ -1,5 +0,0 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" >
-
- <uses-permission android:name="android.permission.VIBRATE" />
-
-</manifest>
diff --git a/templates/other/Notification/root/res/drawable-hdpi/ic_action_stat_reply.png b/templates/other/Notification/root/res/drawable-hdpi/ic_action_stat_reply.png
deleted file mode 100644
index 835d96f..0000000
--- a/templates/other/Notification/root/res/drawable-hdpi/ic_action_stat_reply.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/Notification/root/res/drawable-hdpi/ic_action_stat_share.png b/templates/other/Notification/root/res/drawable-hdpi/ic_action_stat_share.png
deleted file mode 100644
index c329f58..0000000
--- a/templates/other/Notification/root/res/drawable-hdpi/ic_action_stat_share.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/Notification/root/res/drawable-mdpi/ic_action_stat_reply.png b/templates/other/Notification/root/res/drawable-mdpi/ic_action_stat_reply.png
deleted file mode 100644
index 9e34465..0000000
--- a/templates/other/Notification/root/res/drawable-mdpi/ic_action_stat_reply.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/Notification/root/res/drawable-mdpi/ic_action_stat_share.png b/templates/other/Notification/root/res/drawable-mdpi/ic_action_stat_share.png
deleted file mode 100644
index 056deb5..0000000
--- a/templates/other/Notification/root/res/drawable-mdpi/ic_action_stat_share.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/Notification/root/res/drawable-nodpi/example_picture_large.png b/templates/other/Notification/root/res/drawable-nodpi/example_picture_large.png
deleted file mode 100644
index 1e69424..0000000
--- a/templates/other/Notification/root/res/drawable-nodpi/example_picture_large.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/Notification/root/res/drawable-nodpi/example_picture_small.png b/templates/other/Notification/root/res/drawable-nodpi/example_picture_small.png
deleted file mode 100644
index e0627f5..0000000
--- a/templates/other/Notification/root/res/drawable-nodpi/example_picture_small.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/Notification/root/res/drawable-xhdpi/ic_action_stat_reply.png b/templates/other/Notification/root/res/drawable-xhdpi/ic_action_stat_reply.png
deleted file mode 100644
index 4cc854a..0000000
--- a/templates/other/Notification/root/res/drawable-xhdpi/ic_action_stat_reply.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/Notification/root/res/drawable-xhdpi/ic_action_stat_share.png b/templates/other/Notification/root/res/drawable-xhdpi/ic_action_stat_share.png
deleted file mode 100644
index 15549b0..0000000
--- a/templates/other/Notification/root/res/drawable-xhdpi/ic_action_stat_share.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/Notification/root/res/values/strings.xml.ftl b/templates/other/Notification/root/res/values/strings.xml.ftl
deleted file mode 100644
index 5f3da57..0000000
--- a/templates/other/Notification/root/res/values/strings.xml.ftl
+++ /dev/null
@@ -1,13 +0,0 @@
-<resources>
-
- <string name="${notification_name}_notification_title_template">${escapeXmlString(display_title)}: %1$s</string>
-
- <!-- TODO: remove this placeholder text -->
- <string name="${notification_name}_notification_placeholder_text_template">You said %1$s and lorem ipsum dolor sit amet, consectetur adipiscing elit. Etiam non enim magna. Morbi dictum, velit vel semper venenatis, magna odio volutpat velit, at ullamcorper nulla lacus sed turpis. Pellentesque vitae metus elit, nec tincidunt tellus. Integer sed nisl sem, ullamcorper ornare lacus. Duis ac mauris sed massa congue volutpat. Donec sed erat sit amet turpis viverra rhoncus sit amet nec magna. Donec lacinia ligula at libero volutpat volutpat nec nec tortor.</string>
-
- <#if moreActions>
- <string name="action_share">Share</string>
- <string name="action_reply">Reply</string>
- </#if>
-
-</resources>
diff --git a/templates/other/Notification/root/src/app_package/NotificationHelper.java.ftl b/templates/other/Notification/root/src/app_package/NotificationHelper.java.ftl
deleted file mode 100644
index af69d5a..0000000
--- a/templates/other/Notification/root/src/app_package/NotificationHelper.java.ftl
+++ /dev/null
@@ -1,205 +0,0 @@
-package ${packageName};
-
-import android.annotation.TargetApi;
-import android.app.Notification;
-import android.app.NotificationManager;
-import android.app.PendingIntent;
-import android.content.Context;
-import android.content.Intent;
-import android.content.res.Resources;
-import android.graphics.Bitmap;
-import android.graphics.BitmapFactory;
-import android.net.Uri;
-import android.os.Build;
-import android.support.v4.app.NotificationCompat;
-<#if expandedStyle == 'list'>
-import android.graphics.Color;
-import android.text.SpannableStringBuilder;
-import android.text.style.ForegroundColorSpan;
-</#if>
-
-/**
- * Helper class for showing and canceling ${display_title?lower_case}
- * notifications.
- * <p>
- * This class makes heavy use of the {@link NotificationCompat.Builder} helper
- * class to create notifications in a backward-compatible way.
- */
-public class ${className} {
- /**
- * The unique identifier for this type of notification.
- */
- private static final String NOTIFICATION_TAG = "${notificationName}";
-
- /**
- * Shows the notification, or updates a previously shown notification of
- * this type, with the given parameters.
- * <p>
- * TODO: Customize this method's arguments to present relevant content in
- * the notification.
- * <p>
- * TODO: Customize the contents of this method to tweak the behavior and
- * presentation of ${display_title?lower_case} notifications. Make
- * sure to follow the
- * <a href="https://developer.android.com/design/patterns/notifications.html">
- * Notification design guidelines</a> when doing so.
- *
- * @see #cancel(Context)
- */
- public static void notify(final Context context,
- final String exampleString, final int number) {
- final Resources res = context.getResources();
-
- <#if expandedStyle == "picture">
- // This image is used as the notification's large icon (thumbnail) when
- // the notification is collapsed, and as the big picture to show when
- // the notification is expanded.
- <#else>
- // This image is used as the notification's large icon (thumbnail).
- // TODO: Remove this if your notification has no relevant thumbnail.
- </#if>
- final Bitmap picture = BitmapFactory.decodeResource(res, R.drawable.example_picture);
-
- <#if expandedStyle == 'list'>
- final SpannableStringBuilder exampleItem = new SpannableStringBuilder();
- exampleItem.append("Dummy");
- exampleItem.setSpan(new ForegroundColorSpan(Color.WHITE), 0, exampleItem.length(), 0);
- exampleItem.append(" Example content");
- </#if>
-
- final String ticker = exampleString;
- final String title = res.getString(
- R.string.${notification_name}_notification_title_template, exampleString);
- final String text = res.getString(
- R.string.${notification_name}_notification_placeholder_text_template, exampleString);
-
- final NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
-
- // Set appropriate defaults for the notification light, sound,
- // and vibration.
- .setDefaults(Notification.DEFAULT_ALL)
-
- // Set required fields, including the small icon, the
- // notification title, and text.
- .setSmallIcon(R.drawable.${icon_resource})
- .setContentTitle(title)
- .setContentText(text)
-
- // All fields below this line are optional.
-
- // Use a default priority (recognized on devices running Android
- // 4.1 or later)
- .setPriority(NotificationCompat.PRIORITY_DEFAULT)
-
- // Provide a large icon, shown with the notification in the
- // notification drawer on devices running Android 3.0 or later.
- .setLargeIcon(picture)
-
- // Set ticker text (preview) information for this notification.
- .setTicker(ticker)
-
- // Show a number. This is useful when stacking notifications of
- // a single type.
- .setNumber(number)
-
- // If this notification relates to a past or upcoming event, you
- // should set the relevant time information using the setWhen
- // method below. If this call is omitted, the notification's
- // timestamp will by set to the time at which it was shown.
- // TODO: Call setWhen if this notification relates to a past or
- // upcoming event. The sole argument to this method should be
- // the notification timestamp in milliseconds.
- //.setWhen(...)
-
- // Set the pending intent to be initiated when the user touches
- // the notification.
- .setContentIntent(
- PendingIntent.getActivity(
- context,
- 0,
- new Intent(Intent.ACTION_VIEW, Uri.parse("http://www.google.com")),
- PendingIntent.FLAG_UPDATE_CURRENT))
- <#if expandedStyle == 'picture'>
-
- // Show an expanded photo on devices running Android 4.1 or
- // later.
- .setStyle(new NotificationCompat.BigPictureStyle()<#--
- TODO: .bigLargeIcon(null) when the support library supports it -->
- .bigPicture(picture)
- .setBigContentTitle(title)
- .setSummaryText("Dummy summary text"))
- <#elseif expandedStyle == 'list'>
-
- // Show an expanded list of items on devices running Android 4.1
- // or later.
- .setStyle(new NotificationCompat.InboxStyle()
- .addLine(exampleItem)
- .addLine(exampleItem)
- .addLine(exampleItem)
- .addLine(exampleItem)
- .setBigContentTitle(title)
- .setSummaryText("Dummy summary text"))
- <#elseif expandedStyle == 'text'>
-
- // Show expanded text content on devices running Android 4.1 or
- // later.
- .setStyle(new NotificationCompat.BigTextStyle()
- .bigText(text)
- .setBigContentTitle(title)
- .setSummaryText("Dummy summary text"))
- </#if>
- <#if moreActions>
-
- // Example additional actions for this notification. These will
- // only show on devices running Android 4.1 or later, so you
- // should ensure that the activity in this notification's
- // content intent provides access to the same actions in
- // another way.
- .addAction(
- R.drawable.ic_action_stat_share,
- res.getString(R.string.action_share),
- PendingIntent.getActivity(
- context,
- 0,
- Intent.createChooser(new Intent(Intent.ACTION_SEND)
- .setType("text/plain")
- .putExtra(Intent.EXTRA_TEXT, "Dummy text"), "Dummy title"),
- PendingIntent.FLAG_UPDATE_CURRENT))
- .addAction(
- R.drawable.ic_action_stat_reply,
- res.getString(R.string.action_reply),
- null)
- </#if>
-
- // Automatically dismiss the notification when it is touched.
- .setAutoCancel(true);
-
- notify(context, builder.build());
- }
-
- @TargetApi(Build.VERSION_CODES.ECLAIR)
- private static void notify(final Context context, final Notification notification) {
- final NotificationManager nm = (NotificationManager) context
- .getSystemService(Context.NOTIFICATION_SERVICE);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ECLAIR) {
- nm.notify(NOTIFICATION_TAG, 0, notification);
- } else {
- nm.notify(NOTIFICATION_TAG.hashCode(), notification);
- }
- }
-
- /**
- * Cancels any notifications of this type previously shown using
- * {@link #notify(Context, String, int)}.
- */
- @TargetApi(Build.VERSION_CODES.ECLAIR)
- public static void cancel(final Context context) {
- final NotificationManager nm = (NotificationManager) context
- .getSystemService(Context.NOTIFICATION_SERVICE);
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ECLAIR) {
- nm.cancel(NOTIFICATION_TAG, 0);
- } else {
- nm.cancel(NOTIFICATION_TAG.hashCode());
- }
- }
-} \ No newline at end of file
diff --git a/templates/other/Notification/template.xml b/templates/other/Notification/template.xml
deleted file mode 100644
index 61fbc59..0000000
--- a/templates/other/Notification/template.xml
+++ /dev/null
@@ -1,58 +0,0 @@
-<?xml version="1.0"?>
-<template
- format="3"
- revision="1"
- name="New Notification"
- description="Creates a new helper class that can show or cancel a status bar notification."
- minApi="4">
-
- <dependency name="android-support-v4" revision="10" />
-
- <category value="Other" />
-
- <parameter
- id="className"
- name="Class Name"
- type="string"
- constraints="class|unique|nonempty"
- default="NewMessageNotification"
- help="The name of the notification helper class to create, e.g. 'NewMessageNotification'." />
-
- <parameter
- id="expandedStyle"
- name="Style when Expanded"
- type="enum"
- default="text"
- help="The expanded notification style to use for devices running Android 4.1 or later." >
- <option id="none">None</option>
- <option id="text" default="true">More text</option>
- <option id="picture">Picture</option>
- <option id="list">List</option>
- </parameter>
-
- <parameter
- id="moreActions"
- name="Show Additional Actions"
- type="boolean"
- default="true"
- help="If true, this notification will contain additional actions when expanded on devices running Android 4.1 or later." />
-
- <globals file="globals.xml.ftl" />
- <execute file="recipe.xml.ftl" />
-
- <thumbs>
- <thumb>template_notification_text_actions.png</thumb>
- <thumb expandedStyle="none">template_notification_none.png</thumb>
- <thumb expandedStyle="none" moreActions="true">template_notification_none_actions.png</thumb>
- <thumb expandedStyle="text">template_notification_text.png</thumb>
- <thumb expandedStyle="text" moreActions="true">template_notification_text_actions.png</thumb>
- <thumb expandedStyle="list">template_notification_list.png</thumb>
- <thumb expandedStyle="list" moreActions="true">template_notification_list_actions.png</thumb>
- <thumb expandedStyle="picture">template_notification_picture.png</thumb>
- <thumb expandedStyle="picture" moreActions="true">template_notification_picture_actions.png</thumb>
- </thumbs>
-
- <icons
- type="notification"
- name="ic_stat_${camelCaseToUnderscore(className?replace('notification','','i'))}" />
-</template>
diff --git a/templates/other/Notification/template_notification_list.png b/templates/other/Notification/template_notification_list.png
deleted file mode 100644
index f858daa..0000000
--- a/templates/other/Notification/template_notification_list.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/Notification/template_notification_list_actions.png b/templates/other/Notification/template_notification_list_actions.png
deleted file mode 100644
index a095525..0000000
--- a/templates/other/Notification/template_notification_list_actions.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/Notification/template_notification_none.png b/templates/other/Notification/template_notification_none.png
deleted file mode 100644
index abbee9d..0000000
--- a/templates/other/Notification/template_notification_none.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/Notification/template_notification_none_actions.png b/templates/other/Notification/template_notification_none_actions.png
deleted file mode 100644
index 69a4a50..0000000
--- a/templates/other/Notification/template_notification_none_actions.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/Notification/template_notification_picture.png b/templates/other/Notification/template_notification_picture.png
deleted file mode 100644
index d535661..0000000
--- a/templates/other/Notification/template_notification_picture.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/Notification/template_notification_picture_actions.png b/templates/other/Notification/template_notification_picture_actions.png
deleted file mode 100644
index 300431f..0000000
--- a/templates/other/Notification/template_notification_picture_actions.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/Notification/template_notification_text.png b/templates/other/Notification/template_notification_text.png
deleted file mode 100644
index 790ecc0..0000000
--- a/templates/other/Notification/template_notification_text.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/Notification/template_notification_text_actions.png b/templates/other/Notification/template_notification_text_actions.png
deleted file mode 100644
index 6514069..0000000
--- a/templates/other/Notification/template_notification_text_actions.png
+++ /dev/null
Binary files differ
diff --git a/templates/other/Service/globals.xml.ftl b/templates/other/Service/globals.xml.ftl
deleted file mode 100644
index bfc27eb..0000000
--- a/templates/other/Service/globals.xml.ftl
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0"?>
-<globals>
- <global id="srcOut" value="src/${slashedPackageName(packageName)}" />
-</globals>
diff --git a/templates/other/Service/recipe.xml.ftl b/templates/other/Service/recipe.xml.ftl
deleted file mode 100644
index 6e4bd57..0000000
--- a/templates/other/Service/recipe.xml.ftl
+++ /dev/null
@@ -1,7 +0,0 @@
-<?xml version="1.0"?>
-<recipe>
- <merge from="AndroidManifest.xml.ftl" />
- <instantiate from="src/app_package/Service.java.ftl"
- to="${srcOut}/${className}.java" />
- <open file="${srcOut}/${className}.java" />
-</recipe>
diff --git a/templates/other/Service/root/AndroidManifest.xml.ftl b/templates/other/Service/root/AndroidManifest.xml.ftl
deleted file mode 100644
index 14b0bce..0000000
--- a/templates/other/Service/root/AndroidManifest.xml.ftl
+++ /dev/null
@@ -1,10 +0,0 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android" >
-
- <application>
- <service android:name=".${className}"
- android:exported="${isExported?string}"
- android:enabled="${isEnabled?string}" >
- </service>
- </application>
-
-</manifest>
diff --git a/templates/other/Service/root/src/app_package/Service.java.ftl b/templates/other/Service/root/src/app_package/Service.java.ftl
deleted file mode 100644
index 571d2b8..0000000
--- a/templates/other/Service/root/src/app_package/Service.java.ftl
+++ /dev/null
@@ -1,16 +0,0 @@
-package ${packageName};
-
-import android.app.Service;
-import android.content.Intent;
-import android.os.IBinder;
-
-public class ${className} extends Service {
- public ${className}() {
- }
-
- @Override
- public IBinder onBind(Intent intent) {
- // TODO: Return the communication channel to the service.
- throw new UnsupportedOperationException("Not yet implemented");
- }
-}
diff --git a/templates/other/Service/template.xml b/templates/other/Service/template.xml
deleted file mode 100644
index 481fe74..0000000
--- a/templates/other/Service/template.xml
+++ /dev/null
@@ -1,32 +0,0 @@
-<?xml version="1.0"?>
-<template
- format="1"
- revision="1"
- name="Service"
- description="Creates a new service component and adds it to your Android manifest.">
-
- <parameter
- id="className"
- name="Class Name"
- type="string"
- constraints="class|unique|nonempty"
- default="MyService" />
-
- <parameter
- id="isExported"
- name="Exported"
- type="boolean"
- default="true"
- help="Whether or not components of other applications can invoke the service or interact with it" />
-
- <parameter
- id="isEnabled"
- name="Enabled"
- type="boolean"
- default="true"
- help="Whether or not the service can be instantiated by the system" />
-
- <globals file="globals.xml.ftl" />
- <execute file="recipe.xml.ftl" />
-
-</template>
diff --git a/templates/projects/NewAndroidApplication/globals.xml.ftl b/templates/projects/NewAndroidApplication/globals.xml.ftl
deleted file mode 100644
index bfc27eb..0000000
--- a/templates/projects/NewAndroidApplication/globals.xml.ftl
+++ /dev/null
@@ -1,4 +0,0 @@
-<?xml version="1.0"?>
-<globals>
- <global id="srcOut" value="src/${slashedPackageName(packageName)}" />
-</globals>
diff --git a/templates/projects/NewAndroidApplication/recipe.xml.ftl b/templates/projects/NewAndroidApplication/recipe.xml.ftl
deleted file mode 100644
index bc8f02e..0000000
--- a/templates/projects/NewAndroidApplication/recipe.xml.ftl
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0"?>
-<recipe>
- <instantiate from="AndroidManifest.xml.ftl" />
-
-<#if copyIcons>
- <copy from="res/drawable-hdpi" />
- <copy from="res/drawable-mdpi" />
- <copy from="res/drawable-xhdpi" />
-</#if>
- <instantiate from="res/values/styles.xml.ftl" />
-<#if buildApi gte 11 && baseTheme != "none">
- <instantiate from="res/values-v11/styles_hc.xml.ftl"
- to="res/values-v11/styles.xml" />
-</#if>
-<#if buildApi gte 14 && baseTheme?contains("darkactionbar")>
- <copy from="res/values-v14/styles_ics.xml"
- to="res/values-v14/styles.xml" />
-</#if>
-
- <instantiate from="res/values/strings.xml.ftl" />
-</recipe>
diff --git a/templates/projects/NewAndroidApplication/root/AndroidManifest.xml.ftl b/templates/projects/NewAndroidApplication/root/AndroidManifest.xml.ftl
deleted file mode 100644
index 390a9da..0000000
--- a/templates/projects/NewAndroidApplication/root/AndroidManifest.xml.ftl
+++ /dev/null
@@ -1,15 +0,0 @@
-<manifest xmlns:android="http://schemas.android.com/apk/res/android"
- package="${packageName}"
- android:versionCode="1"
- android:versionName="1.0">
-
- <uses-sdk android:minSdkVersion="${minApi}" <#if buildApi gte 4>android:targetSdkVersion="${targetApi}" </#if>/>
-
- <application <#if minApiLevel gte 4 && buildApi gte 4>android:allowBackup="true"</#if>
- android:label="@string/app_name"
- android:icon="@drawable/ic_launcher"<#if baseTheme != "none">
- android:theme="@style/AppTheme"</#if>>
-
- </application>
-
-</manifest>
diff --git a/templates/projects/NewAndroidApplication/root/res/drawable-hdpi/ic_launcher.png b/templates/projects/NewAndroidApplication/root/res/drawable-hdpi/ic_launcher.png
deleted file mode 100755
index 96a442e..0000000
--- a/templates/projects/NewAndroidApplication/root/res/drawable-hdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/templates/projects/NewAndroidApplication/root/res/drawable-mdpi/ic_launcher.png b/templates/projects/NewAndroidApplication/root/res/drawable-mdpi/ic_launcher.png
deleted file mode 100755
index 359047d..0000000
--- a/templates/projects/NewAndroidApplication/root/res/drawable-mdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/templates/projects/NewAndroidApplication/root/res/drawable-xhdpi/ic_launcher.png b/templates/projects/NewAndroidApplication/root/res/drawable-xhdpi/ic_launcher.png
deleted file mode 100755
index 71c6d76..0000000
--- a/templates/projects/NewAndroidApplication/root/res/drawable-xhdpi/ic_launcher.png
+++ /dev/null
Binary files differ
diff --git a/templates/projects/NewAndroidApplication/root/res/values-v11/styles_hc.xml.ftl b/templates/projects/NewAndroidApplication/root/res/values-v11/styles_hc.xml.ftl
deleted file mode 100644
index f8993c3..0000000
--- a/templates/projects/NewAndroidApplication/root/res/values-v11/styles_hc.xml.ftl
+++ /dev/null
@@ -1,11 +0,0 @@
-<resources>
-
- <!--
- Base application theme for API 11+. This theme completely replaces
- AppBaseTheme from res/values/styles.xml on API 11+ devices.
- -->
- <style name="AppBaseTheme" parent="android:Theme.Holo<#if baseTheme?contains("light")>.Light</#if>">
- <!-- API 11 theme customizations can go here. -->
- </style>
-
-</resources>
diff --git a/templates/projects/NewAndroidApplication/root/res/values-v14/styles_ics.xml b/templates/projects/NewAndroidApplication/root/res/values-v14/styles_ics.xml
deleted file mode 100644
index a91fd03..0000000
--- a/templates/projects/NewAndroidApplication/root/res/values-v14/styles_ics.xml
+++ /dev/null
@@ -1,12 +0,0 @@
-<resources>
-
- <!--
- Base application theme for API 14+. This theme completely replaces
- AppBaseTheme from BOTH res/values/styles.xml and
- res/values-v11/styles.xml on API 14+ devices.
- -->
- <style name="AppBaseTheme" parent="android:Theme.Holo.Light.DarkActionBar">
- <!-- API 14 theme customizations can go here. -->
- </style>
-
-</resources>
diff --git a/templates/projects/NewAndroidApplication/root/res/values/strings.xml.ftl b/templates/projects/NewAndroidApplication/root/res/values/strings.xml.ftl
deleted file mode 100644
index ee03444..0000000
--- a/templates/projects/NewAndroidApplication/root/res/values/strings.xml.ftl
+++ /dev/null
@@ -1,3 +0,0 @@
-<resources>
- <string name="app_name">${escapeXmlString(appTitle)}</string>
-</resources>
diff --git a/templates/projects/NewAndroidApplication/root/res/values/styles.xml.ftl b/templates/projects/NewAndroidApplication/root/res/values/styles.xml.ftl
deleted file mode 100644
index 30fe5b5..0000000
--- a/templates/projects/NewAndroidApplication/root/res/values/styles.xml.ftl
+++ /dev/null
@@ -1,20 +0,0 @@
-<resources>
-
- <!--
- Base application theme, dependent on API level. This theme is replaced
- by AppBaseTheme from res/values-vXX/styles.xml on newer devices.
- -->
- <style name="AppBaseTheme" parent="android:Theme<#if baseTheme?contains("light")>.Light</#if>">
- <!--
- Theme customizations available in newer API levels can go in
- res/values-vXX/styles.xml, while customizations related to
- backward-compatibility can go here.
- -->
- </style>
-
- <!-- Application theme. -->
- <style name="AppTheme" parent="AppBaseTheme">
- <!-- All customizations that are NOT specific to a particular API-level can go here. -->
- </style>
-
-</resources>
diff --git a/templates/projects/NewAndroidApplication/template.xml b/templates/projects/NewAndroidApplication/template.xml
deleted file mode 100644
index a60cfc6..0000000
--- a/templates/projects/NewAndroidApplication/template.xml
+++ /dev/null
@@ -1,82 +0,0 @@
-<?xml version="1.0"?>
-<template
- format="1"
- revision="1"
- name="Android Application"
- description="Creates a new Android application.">
- <dependency name="android-support-v4" revision="8" />
-
- <thumbs>
- <thumb>template_new_project.png</thumb>
- </thumbs>
-
- <category value="Applications" />
-
- <parameter
- id="packageName"
- name="Package name"
- type="string"
- constraints="package"
- default="com.mycompany.myapp" />
-
- <parameter
- id="appTitle"
- name="Application title"
- type="string"
- constraints="nonempty"
- default="My Application" />
-
- <parameter
- id="baseTheme"
- name="Base Theme"
- type="enum"
- default="holo_light_darkactionbar"
- help="The base user interface theme for the application">
- <option id="none">None</option>
- <option id="holo_dark" minBuildApi="11">Holo Dark</option>
- <option id="holo_light" minBuildApi="11">Holo Light</option>
- <option id="holo_light_darkactionbar" minBuildApi="14" default="true">Holo Light with Dark Action Bar</option>
- </parameter>
-
- <parameter
- id="minApi"
- name="Minimum API level"
- type="string"
- constraints="apilevel"
- default="7" />
-
- <!--
- Usually the same as minApi, but when minApi is a code name this will be the corresponding
- API level
- -->
- <parameter
- id="minApiLevel"
- name="Minimum API level"
- type="string"
- constraints="apilevel"
- default="7" />
-
- <parameter
- id="targetApi"
- name="Target API level"
- type="string"
- constraints="apilevel"
- default="16" />
-
- <parameter
- id="buildApi"
- name="Build API level"
- type="string"
- constraints="apilevel"
- default="16" />
-
- <parameter
- id="copyIcons"
- name="Include launcher icons"
- type="boolean"
- default="true" />
-
- <globals file="globals.xml.ftl" />
- <execute file="recipe.xml.ftl" />
-
-</template>
diff --git a/templates/projects/NewAndroidApplication/template_new_project.png b/templates/projects/NewAndroidApplication/template_new_project.png
deleted file mode 100644
index 92e8556..0000000
--- a/templates/projects/NewAndroidApplication/template_new_project.png
+++ /dev/null
Binary files differ