Remove layoutopt; replaced by the more generic "lint" tool.
Change-Id: Ia6dc357106aa49fa5c27c6283eac62c4cc19967b
diff --git a/build/tools.atree b/build/tools.atree
index eb273eb..a7a5dd7 100644
--- a/build/tools.atree
+++ b/build/tools.atree
@@ -57,7 +57,6 @@
bin/ddms tools/ddms
bin/hierarchyviewer tools/hierarchyviewer
bin/draw9patch tools/draw9patch
-bin/layoutopt tools/layoutopt
bin/traceview tools/traceview
bin/android tools/android
bin/monkeyrunner tools/monkeyrunner
@@ -94,7 +93,6 @@
framework/hierarchyviewer2.jar tools/lib/hierarchyviewer2.jar
framework/hierarchyviewerlib.jar tools/lib/hierarchyviewerlib.jar
framework/draw9patch.jar tools/lib/draw9patch.jar
-framework/layoutopt.jar tools/lib/layoutopt.jar
framework/uix.jar tools/lib/uix.jar
framework/traceview.jar tools/lib/traceview.jar
framework/anttasks.jar tools/lib/anttasks.jar
@@ -111,7 +109,6 @@
framework/lint_checks.jar tools/lib/lint_checks.jar
# 3rd Party java libraries
-framework/groovy-all-1.7.0.jar tools/lib/groovy-all-1.7.0.jar
framework/commons-compress-1.0.jar tools/lib/commons-compress-1.0.jar
framework/httpclient-4.1.1.jar tools/lib/httpclient-4.1.1.jar
framework/httpcore-4.1.jar tools/lib/httpcore-4.1.jar
diff --git a/build/tools.windows.atree b/build/tools.windows.atree
index 1340498..cd3db99 100755
--- a/build/tools.windows.atree
+++ b/build/tools.windows.atree
@@ -63,9 +63,6 @@
rm tools/hprof-conv
bin/hprof-conv.exe strip tools/hprof-conv.exe
-rm tools/layoutopt
-sdk/layoutopt/app/etc/layoutopt.bat tools/layoutopt.bat
-
rm tools/mksdcard
bin/mksdcard.exe strip tools/mksdcard.exe
diff --git a/changes.txt b/changes.txt
index fcb0f3c..af7bab8 100644
--- a/changes.txt
+++ b/changes.txt
@@ -1,5 +1,15 @@
Change log for Android SDK Tools.
+Revision 16:
+* New "lint" tool which scans Android project trees for potential
+ problems such as missing translations, duplicate ids between layouts
+ that include each other, using px instead of dp units, hardcoded
+ strings, missing contentDescriptions, obsolete Proguard
+ configuration files, etc. For a full list of available issues run
+ "lint --show" (and see eclipse/changes.txt for further details).
+* layoutopt was removed; its functionality is replaced by the new lint
+ tool
+
Revision 14:
- Build performance improvements:
diff --git a/docs/gscripts.txt b/docs/gscripts.txt
deleted file mode 100755
index e3f5d18..0000000
--- a/docs/gscripts.txt
+++ /dev/null
@@ -1,49 +0,0 @@
-This file describes the "gscripts" folder in ADT (Android Eclipse Plugin).
-
-
-----------
-- Overview
-----------
-
-ADT is the Android Eclipse Plugin. The plugin delivers a new editor, called
-the the Graphical Layout Editor (a.k.a. GLE2), to visually edit Android layout
-XML files.
-
-Details on how to handle the various Android views and layouts is not
-hardcoded in the GLE2 itself. Instead it is differed to a bunch of Groovy
-scripts.
-
-
-(TODO: expand/replace with a better overview of implementation... goal is
-to use this a doc for 3rd-party projects to implement their own rules.)
-
-
-
--------------
-- Groovy tips
--------------
-
-
-- Debugging:
-
-If you run ADT in debug mode and want to trace into Groovy
-methods, you need to tell Eclipse where to find the Groovy source code.
-
-To do this:
-- in Eclipse, import an existing project
-- Select the project at <android-source-tree>/prebuilt/common/groovy/
-- This will add a new Eclipse project named "GroovySrc" which contains
- a single zip file with the groovy source.
-- ADT is already pre-configured to find the Groovy source in the GroovySrc
- project.
-
-
-
-- Private methods:
-
-Be careful when adding new helper methods in the BaseView
-or BaseLayout classes.
-
-Due to the way Groovy looks up methods, private methods will *not* be found by
-same-class methods if invoked by a derived class in the context of a closure
-(which is about the case of all these helper methods.)
diff --git a/eclipse/changes.txt b/eclipse/changes.txt
index 2dd69cd..7fbed5b 100644
--- a/eclipse/changes.txt
+++ b/eclipse/changes.txt
@@ -1,4 +1,16 @@
-14.0.0 (In development)
+16.0.0:
+* New "lint" feature which scans the Android projects for potential
+ problems such as missing translations, duplicate ids between layouts
+ that include each other, using px instead of dp units, hardcoded
+ strings, missing contentDescriptions, obsolete Proguard
+ configuration files, etc. Lint can be run on the command line, but
+ it is also integrated into the Problems view in Eclipse, and there
+ are also quickfixes available for many of the reported errors.
+
+15.0.0
+Critical bug fixes only.
+
+14.0.0
- Build system:
- (TODO: More info) Improved library projects
- Improved incremental builds
diff --git a/eclipse/features/com.android.ide.eclipse.adt/feature.xml b/eclipse/features/com.android.ide.eclipse.adt/feature.xml
index 2b0171e..5064787 100644
--- a/eclipse/features/com.android.ide.eclipse.adt/feature.xml
+++ b/eclipse/features/com.android.ide.eclipse.adt/feature.xml
@@ -16,7 +16,6 @@
<license url="http://www.eclipse.org/org/documents/epl-v10.php">
Note: kxml2-2.3.0.jar is under the BSD license rather than the EPL. You can find a copy of the BSD License at http://www.opensource.org/licenses/bsd-license.php
- Note: groovy-all-1.7.0.jar is under a BSD/Apache license rather than the EPL. For details, please see http://groovy.codehaus.org/faq.html#licence .
Eclipse Public License - v 1.0
diff --git a/layoutopt/Android.mk b/layoutopt/Android.mk
deleted file mode 100644
index 43b2dcf..0000000
--- a/layoutopt/Android.mk
+++ /dev/null
@@ -1,5 +0,0 @@
-# Copyright 2009 The Android Open Source Project
-#
-LAYOUTOPT_LOCAL_DIR := $(call my-dir)
-include $(LAYOUTOPT_LOCAL_DIR)/libs/Android.mk
-include $(LAYOUTOPT_LOCAL_DIR)/app/Android.mk
diff --git a/layoutopt/MODULE_LICENSE_APACHE2 b/layoutopt/MODULE_LICENSE_APACHE2
deleted file mode 100644
index e69de29..0000000
--- a/layoutopt/MODULE_LICENSE_APACHE2
+++ /dev/null
diff --git a/layoutopt/NOTICE b/layoutopt/NOTICE
deleted file mode 100644
index c5b1efa..0000000
--- a/layoutopt/NOTICE
+++ /dev/null
@@ -1,190 +0,0 @@
-
- Copyright (c) 2005-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.
-
- 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.
-
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
diff --git a/layoutopt/app/Android.mk b/layoutopt/app/Android.mk
deleted file mode 100644
index 3fae340..0000000
--- a/layoutopt/app/Android.mk
+++ /dev/null
@@ -1,5 +0,0 @@
-# Copyright 2009 The Android Open Source Project
-#
-LAYOUTOPT_LOCAL_DIR := $(call my-dir)
-include $(LAYOUTOPT_LOCAL_DIR)/etc/Android.mk
-include $(LAYOUTOPT_LOCAL_DIR)/src/Android.mk
diff --git a/layoutopt/app/README b/layoutopt/app/README
deleted file mode 100644
index c118022..0000000
--- a/layoutopt/app/README
+++ /dev/null
@@ -1,3 +0,0 @@
-Layout optimizer.
-
-Simple command line front end for the uix library.
\ No newline at end of file
diff --git a/layoutopt/app/etc/Android.mk b/layoutopt/app/etc/Android.mk
deleted file mode 100644
index ae08f9d..0000000
--- a/layoutopt/app/etc/Android.mk
+++ /dev/null
@@ -1,8 +0,0 @@
-# Copyright 2009 The Android Open Source Project
-#
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_PREBUILT_EXECUTABLES := layoutopt
-include $(BUILD_HOST_PREBUILT)
-
diff --git a/layoutopt/app/etc/layoutopt b/layoutopt/app/etc/layoutopt
deleted file mode 100755
index 22ebb67..0000000
--- a/layoutopt/app/etc/layoutopt
+++ /dev/null
@@ -1,63 +0,0 @@
-#!/bin/sh
-# Copyright 2009, 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.
-
-# Set up prog to be the path of this script, including following symlinks,
-# and set up progdir to be the fully-qualified pathname of its directory.
-prog="$0"
-while [ -h "${prog}" ]; do
- newProg=`/bin/ls -ld "${prog}"`
- newProg=`expr "${newProg}" : ".* -> \(.*\)$"`
- if expr "x${newProg}" : 'x/' >/dev/null; then
- prog="${newProg}"
- else
- progdir=`dirname "${prog}"`
- prog="${progdir}/${newProg}"
- fi
-done
-oldwd=`pwd`
-progdir=`dirname "${prog}"`
-cd "${progdir}"
-progdir=`pwd`
-prog="${progdir}"/`basename "${prog}"`
-cd "${oldwd}"
-
-jarfile=layoutopt.jar
-frameworkdir="$progdir"
-if [ ! -r "$frameworkdir/$jarfile" ]
-then
- frameworkdir=`dirname "$progdir"`/tools/lib
- libdir=`dirname "$progdir"`/tools/lib
-fi
-if [ ! -r "$frameworkdir/$jarfile" ]
-then
- frameworkdir=`dirname "$progdir"`/framework
- libdir=`dirname "$progdir"`/lib
-fi
-if [ ! -r "$frameworkdir/$jarfile" ]
-then
- echo `basename "$prog"`": can't find $jarfile"
- exit 1
-fi
-
-if [ "$OSTYPE" = "cygwin" ] ; then
- jarpath=`cygpath -w "$frameworkdir/$jarfile"`
- progdir=`cygpath -w "$progdir"`
-else
- jarpath="$frameworkdir/$jarfile"
-fi
-
-# need to use "java.ext.dirs" because "-jar" causes classpath to be ignored
-# might need more memory, e.g. -Xmx128M
-exec java -Djava.ext.dirs="$frameworkdir" -jar "$jarpath" "$@"
diff --git a/layoutopt/app/etc/layoutopt.bat b/layoutopt/app/etc/layoutopt.bat
deleted file mode 100755
index 9200227..0000000
--- a/layoutopt/app/etc/layoutopt.bat
+++ /dev/null
@@ -1,53 +0,0 @@
-@echo off
-rem Copyright (C) 2009 The Android Open Source Project
-rem
-rem Licensed under the Apache License, Version 2.0 (the "License");
-rem you may not use this file except in compliance with the License.
-rem You may obtain a copy of the License at
-rem
-rem http://www.apache.org/licenses/LICENSE-2.0
-rem
-rem Unless required by applicable law or agreed to in writing, software
-rem distributed under the License is distributed on an "AS IS" BASIS,
-rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-rem See the License for the specific language governing permissions and
-rem limitations under the License.
-
-rem don't modify the caller's environment
-setlocal
-
-rem Set up prog to be the path of this script, including following symlinks,
-rem and set up progdir to be the fully-qualified pathname of its directory.
-set prog=%~f0
-
-rem Change current directory and drive to where the script is, to avoid
-rem issues with directories containing whitespaces.
-cd /d %~dp0
-
-rem Check we have a valid Java.exe in the path.
-set java_exe=
-call lib\find_java.bat
-if not defined java_exe goto :EOF
-
-set jarfile=layoutopt.jar
-set frameworkdir=
-
-if exist %frameworkdir%%jarfile% goto JarFileOk
- set frameworkdir=lib\
-
-if exist %frameworkdir%%jarfile% goto JarFileOk
- set frameworkdir=..\framework\
-
-:JarFileOk
-
-if debug NEQ "%1" goto NoDebug
- set java_debug=-agentlib:jdwp=transport=dt_socket,server=y,address=8050,suspend=y
- shift 1
-:NoDebug
-
-set jarpath=%frameworkdir%%jarfile%
-
-set javaextdirs=%swt_path%;%frameworkdir%
-
-call %java_exe% %java_debug% -Djava.ext.dirs=%javaextdirs% -jar %jarpath% %*
-
diff --git a/layoutopt/app/etc/manifest.txt b/layoutopt/app/etc/manifest.txt
deleted file mode 100644
index d107744..0000000
--- a/layoutopt/app/etc/manifest.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-Main-Class: com.android.layoutopt.cli.Main
-Class-Path: groovy-all-1.7.0.jar
diff --git a/layoutopt/app/src/Android.mk b/layoutopt/app/src/Android.mk
deleted file mode 100644
index abead4a..0000000
--- a/layoutopt/app/src/Android.mk
+++ /dev/null
@@ -1,15 +0,0 @@
-# Copyright 2009 The Android Open Source Project
-#
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-#LOCAL_JAVA_RESOURCE_DIRS := resources
-
-LOCAL_JAR_MANIFEST := ../etc/manifest.txt
-LOCAL_JAVA_LIBRARIES := \
- uix
-LOCAL_MODULE := layoutopt
-
-include $(BUILD_HOST_JAVA_LIBRARY)
-
diff --git a/layoutopt/app/src/com/android/layoutopt/cli/Main.java b/layoutopt/app/src/com/android/layoutopt/cli/Main.java
deleted file mode 100644
index ed937d5..0000000
--- a/layoutopt/app/src/com/android/layoutopt/cli/Main.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (C) 2009 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.layoutopt.cli;
-
-import com.android.layoutopt.uix.LayoutAnalyzer;
-import com.android.layoutopt.uix.LayoutAnalysis;
-
-import java.io.File;
-import java.util.List;
-import java.util.ArrayList;
-
-/**
- * Command line utility for the uix library.
- *
- * This is a simple CLI front-end for the uix library, used to
- * analyze and optimize Android layout files.
- */
-public class Main {
- /**
- * Main entry point of the application.
- *
- * @param args One mandatory parameter, a path (absolute or relative)
- * to an Android XML layout file
- */
- public static void main(String[] args) {
- Parameters p = checkParameters(args);
- if (!p.valid) {
- displayHelpMessage();
- displayObsoleteMessage();
- exit();
- }
-
- analyzeFiles(p.files);
-
- displayObsoleteMessage();
- }
-
- private static void analyzeFiles(File[] files) {
- LayoutAnalyzer analyzer = new LayoutAnalyzer();
- for (File file : files) {
- if (file.isFile() && file.getName().endsWith(".xml")) {
- analyze(analyzer, file);
- } else if (file.isDirectory()) {
- analyzeFiles(file.listFiles());
- }
- }
- }
-
- private static void analyze(LayoutAnalyzer analyzer, File file) {
- LayoutAnalysis analysis = analyzer.analyze(file);
- System.out.println(analysis.getName());
- for (LayoutAnalysis.Issue issue : analysis.getIssues()) {
- System.out.print(String.format("\t%d:%d ", issue.getStartLine(), issue.getEndLine()));
- System.out.println(issue.getDescription());
- }
- }
-
- /**
- * Exits the tool.
- */
- private static void exit() {
- System.exit(0);
- }
-
- /**
- * Displays this tool's help message on the standard output.
- */
- private static void displayHelpMessage() {
- System.out.println("usage: layoutopt <directories/files to analyze>");
- }
-
- /** Layoutopt is obsolete; inform user */
- private static void displayObsoleteMessage() {
- System.err.println("\"layoutopt\" is obsolete; use \"lint\" instead which includes layout analysis.");
- }
-
- /**
- * Builds a valid Parameters object. Parses the paramters if necessary
- * and checks for errors.
- *
- * @param args The parameters passed from the CLI.
- */
- private static Parameters checkParameters(String[] args) {
- Parameters p = new Parameters();
-
- if (args.length < 1) {
- p.valid = false;
- } else {
- List<File> files = new ArrayList<File>();
- for (String path : args) {
- File file = new File(path);
- if (file.exists() && (file.isDirectory() || file.getName().endsWith(".xml"))) {
- files.add(file);
- }
- }
- p.files = files.toArray(new File[files.size()]);
- p.valid = true;
- }
-
- return p;
- }
-
- /**
- * Parameters parsed from the CLI.
- */
- private static class Parameters {
- /**
- * True if this list of parameters is valid, false otherwise.
- */
- boolean valid;
-
- /**
- * Paths (absolute or relative) to the files to be analyzed.
- */
- File[] files;
- }
-}
diff --git a/layoutopt/libs/Android.mk b/layoutopt/libs/Android.mk
deleted file mode 100644
index 058299a..0000000
--- a/layoutopt/libs/Android.mk
+++ /dev/null
@@ -1,5 +0,0 @@
-# Copyright 2009 The Android Open Source Project
-#
-UIX_LOCAL_DIR := $(call my-dir)
-include $(UIX_LOCAL_DIR)/uix/Android.mk
-
diff --git a/layoutopt/libs/uix/Android.mk b/layoutopt/libs/uix/Android.mk
deleted file mode 100644
index 8344e57..0000000
--- a/layoutopt/libs/uix/Android.mk
+++ /dev/null
@@ -1,4 +0,0 @@
-# Copyright 2009 The Android Open Source Project
-#
-UIX_LOCAL_DIR := $(call my-dir)
-include $(UIX_LOCAL_DIR)/src/Android.mk
diff --git a/layoutopt/libs/uix/src/Android.mk b/layoutopt/libs/uix/src/Android.mk
deleted file mode 100644
index c41b09e..0000000
--- a/layoutopt/libs/uix/src/Android.mk
+++ /dev/null
@@ -1,13 +0,0 @@
-# Copyright 2009 The Android Open Source Project
-#
-LOCAL_PATH := $(call my-dir)
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := $(call all-subdir-java-files)
-LOCAL_JAVA_RESOURCE_DIRS := resources
-
-LOCAL_MODULE := uix
-LOCAL_JAVA_LIBRARIES := \
- groovy-all-1.7.0
-
-include $(BUILD_HOST_JAVA_LIBRARY)
diff --git a/layoutopt/libs/uix/src/com/android/layoutopt/uix/LayoutAnalysis.java b/layoutopt/libs/uix/src/com/android/layoutopt/uix/LayoutAnalysis.java
deleted file mode 100644
index bc6f0b6..0000000
--- a/layoutopt/libs/uix/src/com/android/layoutopt/uix/LayoutAnalysis.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/*
- * Copyright (C) 2009 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.layoutopt.uix;
-
-import org.w3c.dom.Node;
-
-import java.util.List;
-import java.util.ArrayList;
-
-import com.android.layoutopt.uix.groovy.LayoutAnalysisCategory;
-
-/**
- * Contains the results of a layout analysis. Instances of this class are
- * generated by {@link com.android.layoutopt.uix.LayoutAnalyzer}.
- *
- * @see com.android.layoutopt.uix.LayoutAnalyzer
- */
-public class LayoutAnalysis {
- /**
- * Default layout analysis used to describe a problem with the
- * analysis process.
- */
- static final LayoutAnalysis ERROR = new LayoutAnalysis("");
- static {
- ERROR.mAnalyzed = false;
- ERROR.addIssue("The layout could not be analyzed. Check if you specified a valid "
- + "XML layout, if the specified file exists, etc.");
- }
-
- private final List<Issue> mIssues = new ArrayList<Issue>();
- private String mName;
- private boolean mAnalyzed;
- private Node mNode;
-
- /**
- * Creates a new analysis. An analysis is always considered invalid by default.
- *
- * @see #validate()
- * @see #isValid()
- */
- LayoutAnalysis(String name) {
- mName = name;
- }
-
- /**
- * Returns the name of this analysis.
- */
- public String getName() {
- return mName;
- }
-
- void setName(String name) {
- mName = name;
- }
-
- /**
- * Adds an issue to the layout analysis.
- *
- * @param issue The issue to add.
- */
- public void addIssue(Issue issue) {
- mIssues.add(issue);
- }
-
- /**
- * Adds an issue to the layout analysis.
- *
- * @param description Description of the issue.
- */
- public void addIssue(String description) {
- mIssues.add(new Issue(mNode, description));
- }
-
- /**
- * Adds an issue to the layout analysis.
- *
- * @param node The node containing the issue.
- * @param description Description of the issue.
- */
- public void addIssue(Node node, String description) {
- mIssues.add(new Issue(node, description));
- }
-
- /**
- * Returns the list of issues found during the analysis.
- *
- * @return A non-null array of {@link com.android.layoutopt.uix.LayoutAnalysis.Issue}.
- */
- public Issue[] getIssues() {
- return mIssues.toArray(new Issue[mIssues.size()]);
- }
-
- /**
- * Indicates whether the layout was analyzed. If this method returns false,
- * a probleme occured during the analysis (missing file, invalid document, etc.)
- *
- * @return True if the layout was analyzed, false otherwise.
- */
- public boolean isValid() {
- return mAnalyzed;
- }
-
- /**
- * Validates the analysis. This must be call before this analysis can
- * be considered valid. Calling this method resets the current node to null.
- *
- * @see #setCurrentNode(org.w3c.dom.Node)
- */
- void validate() {
- mAnalyzed = true;
- mNode = null;
- }
-
- /**
- * Sets the current node to be automatically added to created issues.
- *
- * @param node An XML node.
- */
- void setCurrentNode(Node node) {
- mNode = node;
- }
-
- /**
- * Represents an issue discovered during the analysis process.
- * An issue provides a human-readable description as well as optional solutions.
- */
- public static class Issue {
- private final String mDescription;
- private final Node mNode;
-
- /**
- * Creates a new issue with the specified description.
- *
- * @param description The description of the issue.
- */
- public Issue(String description) {
- mNode = null;
- if (description == null) {
- throw new IllegalArgumentException("The description must be non-null");
- }
- mDescription = description;
- }
-
- /**
- * Creates a new issue with the specified description.
- *
- * @param node The node in which the issue was found.
- * @param description The description of the issue.
- */
- public Issue(Node node, String description) {
- mNode = node;
- if (description == null) {
- throw new IllegalArgumentException("The description must be non-null");
- }
- mDescription = description;
- }
-
- /**
- * Describes this issue to the user.
- *
- * @return A String describing the issue, always non-null.
- */
- public String getDescription() {
- return mDescription;
- }
-
-
- /**
- * Returns the start line of this node.
- *
- * @return The start line or -1 if the line is unknown.
- */
- public int getStartLine() {
- return LayoutAnalysisCategory.getStartLine(mNode);
- }
-
- /**
- * Returns the end line of this node.
- *
- * @return The end line or -1 if the line is unknown.
- */
- public int getEndLine() {
- return LayoutAnalysisCategory.getEndLine(mNode);
- }
- }
-}
diff --git a/layoutopt/libs/uix/src/com/android/layoutopt/uix/LayoutAnalyzer.java b/layoutopt/libs/uix/src/com/android/layoutopt/uix/LayoutAnalyzer.java
deleted file mode 100644
index da27414..0000000
--- a/layoutopt/libs/uix/src/com/android/layoutopt/uix/LayoutAnalyzer.java
+++ /dev/null
@@ -1,249 +0,0 @@
-/*
- * Copyright (C) 2009 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.layoutopt.uix;
-
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
-
-import java.io.File;
-import java.io.InputStream;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.util.zip.ZipFile;
-import java.util.zip.ZipEntry;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.ArrayList;
-
-import com.android.layoutopt.uix.xml.XmlDocumentBuilder;
-import com.android.layoutopt.uix.rules.Rule;
-import com.android.layoutopt.uix.rules.GroovyRule;
-import com.android.layoutopt.uix.util.IOUtilities;
-import groovy.lang.GroovyClassLoader;
-import groovy.lang.GroovyShell;
-import groovy.lang.Script;
-
-/**
- * Analysis engine used to discover inefficiencies in Android XML
- * layout documents.
- *
- * Anaylizing an Android XML layout produces a list of explicit messages
- * as well as possible solutions.
- */
-public class LayoutAnalyzer {
- private static final String RULES_PREFIX = "rules/";
-
- private final XmlDocumentBuilder mBuilder = new XmlDocumentBuilder();
- private final List<Rule> mRules = new ArrayList<Rule>();
-
- /**
- * Creates a new layout analyzer. This constructor takes no argument
- * and will use the default options.
- */
- public LayoutAnalyzer() {
- loadRules();
- }
-
- private void loadRules() {
- ClassLoader parent = getClass().getClassLoader();
- GroovyClassLoader loader = new GroovyClassLoader(parent);
- GroovyShell shell = new GroovyShell(loader);
-
- URL jar = getClass().getProtectionDomain().getCodeSource().getLocation();
- ZipFile zip = null;
- try {
- zip = new ZipFile(new File(jar.toURI()));
- Enumeration<? extends ZipEntry> entries = zip.entries();
- while (entries.hasMoreElements()) {
- ZipEntry entry = entries.nextElement();
- if (!entry.isDirectory() && entry.getName().startsWith(RULES_PREFIX)) {
- loadRule(shell, entry.getName(), zip.getInputStream(entry));
- }
- }
- } catch (IOException e) {
- e.printStackTrace();
- } catch (URISyntaxException e) {
- e.printStackTrace();
- } finally {
- try {
- if (zip != null) zip.close();
- } catch (IOException e) {
- // Ignore
- }
- }
- }
-
- private void loadRule(GroovyShell shell, String name, InputStream stream) {
- try {
- Script script = shell.parse(stream);
- mRules.add(new GroovyRule(name, script));
- } catch (Exception e) {
- System.err.println("Could not load rule " + name + ":");
- e.printStackTrace();
- } finally {
- IOUtilities.close(stream);
- }
- }
-
- public void addRule(Rule rule) {
- if (rule == null) {
- throw new IllegalArgumentException("A rule must be non-null");
- }
- mRules.add(rule);
- }
-
- /**
- * Analyzes the specified file.
- *
- * @param file The file to analyze.
- *
- * @return A {@link com.android.layoutopt.uix.LayoutAnalysis} which
- * cannot be null.
- */
- public LayoutAnalysis analyze(File file) {
- if (file != null && file.exists()) {
- InputStream in = null;
- try {
- in = new FileInputStream(file);
- return analyze(file.getPath(), in);
- } catch (FileNotFoundException e) {
- // Ignore, cannot happen
- } finally {
- IOUtilities.close(in);
- }
- }
-
- return LayoutAnalysis.ERROR;
- }
-
- /**
- * Analyzes the specified XML stream.
- *
- * @param stream The stream to analyze.
- * @return A {@link com.android.layoutopt.uix.LayoutAnalysis} which
- * cannot be null.
- */
- public LayoutAnalysis analyze(InputStream stream) {
- return analyze("<unknown>", stream);
- }
-
- private LayoutAnalysis analyze(String name, InputStream stream) {
- try {
- Document document = mBuilder.parse(stream);
- return analyze(name, document);
- } catch (SAXException e) {
- // Ignore
- } catch (IOException e) {
- // Ignore
- }
- return LayoutAnalysis.ERROR;
- }
-
- /**
- * Analyzes the specified XML document.
- *
- * @param content The XML document to analyze.
- *
- * @return A {@link com.android.layoutopt.uix.LayoutAnalysis} which
- * cannot be null.
- */
- public LayoutAnalysis analyze(String content) {
- return analyze("<unknown>", content);
- }
-
- /**
- * Analyzes the specified XML document.
- *
- * @param name The name of the document.
- * @param content The XML document to analyze.
- *
- * @return A {@link com.android.layoutopt.uix.LayoutAnalysis} which
- * cannot be null.
- */
- public LayoutAnalysis analyze(String name, String content) {
- try {
- Document document = mBuilder.parse(content);
- return analyze(name, document);
- } catch (SAXException e) {
- // Ignore
- } catch (IOException e) {
- // Ignore
- }
- return LayoutAnalysis.ERROR;
- }
-
- /**
- * Analyzes the specified XML document.
- *
- * @param document The XML document to analyze.
- *
- * @return A {@link com.android.layoutopt.uix.LayoutAnalysis} which
- * cannot be null.
- */
- public LayoutAnalysis analyze(Document document) {
- return analyze("<unknown>", document);
- }
-
- /**
- * Analyzes the specified XML document.
- *
- * @param name The name of the document.
- * @param document The XML document to analyze.
- *
- * @return A {@link com.android.layoutopt.uix.LayoutAnalysis} which
- * cannot be null.
- */
- public LayoutAnalysis analyze(String name, Document document) {
- LayoutAnalysis analysis = new LayoutAnalysis(name);
-
- try {
- Element root = document.getDocumentElement();
- analyze(analysis, root);
- } finally {
- analysis.validate();
- }
-
- return analysis;
- }
-
- private void analyze(LayoutAnalysis analysis, Node node) {
- NodeList list = node.getChildNodes();
- int count = list.getLength();
-
- applyRules(analysis, node);
-
- for (int i = 0; i < count; i++) {
- Node child = list.item(i);
- if (child.getNodeType() == Node.ELEMENT_NODE) {
- analyze(analysis, child);
- }
- }
- }
-
- private void applyRules(LayoutAnalysis analysis, Node node) {
- analysis.setCurrentNode(node);
- for (Rule rule : mRules) {
- rule.run(analysis, node);
- }
- }
-}
diff --git a/layoutopt/libs/uix/src/com/android/layoutopt/uix/groovy/LayoutAnalysisCategory.java b/layoutopt/libs/uix/src/com/android/layoutopt/uix/groovy/LayoutAnalysisCategory.java
deleted file mode 100644
index 898df52..0000000
--- a/layoutopt/libs/uix/src/com/android/layoutopt/uix/groovy/LayoutAnalysisCategory.java
+++ /dev/null
@@ -1,215 +0,0 @@
-/*
- * Copyright (C) 2009 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.layoutopt.uix.groovy;
-
-import com.android.layoutopt.uix.LayoutAnalysis;
-import com.android.layoutopt.uix.xml.XmlDocumentBuilder;
-
-import java.util.Map;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Arrays;
-
-import groovy.lang.GString;
-import groovy.xml.dom.DOMCategory;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.w3c.dom.Element;
-
-/**
- * Support class for Groovy rules. This class adds new Groovy capabilities
- * to {@link com.android.layoutopt.uix.LayoutAnalysis} and {@link org.w3c.dom.Node}.
- */
-public class LayoutAnalysisCategory {
- private static final String ANDROID_PADDING = "android:padding";
- private static final String ANDROID_PADDING_LEFT = "android:paddingLeft";
- private static final String ANDROID_PADDING_TOP = "android:paddingTop";
- private static final String ANDROID_PADDING_RIGHT = "android:paddingRight";
- private static final String ANDROID_PADDING_BOTTOM = "android:paddingBottom";
- private static final String ANDROID_LAYOUT_WIDTH = "android:layout_width";
- private static final String ANDROID_LAYOUT_HEIGHT = "android:layout_height";
- private static final String VALUE_FILL_PARENT = "fill_parent";
- private static final String VALUE_MATCH_PARENT = "match_parent";
- private static final String VALUE_WRAP_CONTENT = "wrap_content";
-
- private static final String[] sContainers = new String[] {
- "FrameLayout", "LinearLayout", "RelativeLayout", "SlidingDrawer",
- "AbsoluteLayout", "TableLayout", "Gallery", "GridView", "ListView",
- "RadioGroup", "ScrollView", "HorizontalScrollView", "Spinner",
- "ViewSwitcher", "ViewFlipper", "ViewAnimator", "ImageSwitcher",
- "TextSwitcher", "android.gesture.GestureOverlayView", "TabHost"
- };
- static {
- Arrays.sort(sContainers);
- }
-
- /**
- * xmlNode.isContainer()
- *
- * @return True if the specified node corresponds to a container widget.
- */
- public static boolean isContainer(Element element) {
- return Arrays.binarySearch(sContainers, element.getNodeName()) >= 0;
- }
-
- /**
- * xmlNode.all()
- *
- * Same as xmlNode.'**' but excludes xmlNode from the results.
- *
- * @return All descendants, this node excluded.
- */
- public static List<Node> all(Element element) {
- NodeList list = DOMCategory.depthFirst(element);
- int count = list.getLength();
- List<Node> nodes = new ArrayList<Node>(count - 1);
- for (int i = 1; i < count; i++) {
- nodes.add(list.item(i));
- }
- return nodes;
- }
-
- /**
- * Returns the start line of this node.
- *
- * @return The start line or -1 if the line is unknown.
- */
- public static int getStartLine(Node node) {
- final Object data = node == null ? null :
- node.getUserData(XmlDocumentBuilder.NODE_START_LINE);
- return data == null ? -1 : (Integer) data;
- }
-
- /**
- * Returns the end line of this node.
- *
- * @return The end line or -1 if the line is unknown.
- */
- public static int getEndLine(Node node) {
- final Object data = node == null ? null :
- node.getUserData(XmlDocumentBuilder.NODE_END_LINE);
- return data == null ? -1 : (Integer) data;
- }
-
- /**
- * xmlNode.hasPadding()
- *
- * @return True if the node has one ore more padding attributes.
- */
- public static boolean hasPadding(Element element) {
- return element.getAttribute(ANDROID_PADDING).length() > 0 ||
- element.getAttribute(ANDROID_PADDING_LEFT).length() > 0 ||
- element.getAttribute(ANDROID_PADDING_TOP).length() > 0 ||
- element.getAttribute(ANDROID_PADDING_BOTTOM).length() > 0 ||
- element.getAttribute(ANDROID_PADDING_RIGHT).length() > 0;
- }
-
- /**
- * Returns whether this node's width is match_parent.
- */
- public static boolean isWidthFillParent(Element element) {
- final String attribute = element.getAttribute(ANDROID_LAYOUT_WIDTH);
- return attribute.equals(VALUE_FILL_PARENT) || attribute.equals(VALUE_MATCH_PARENT);
- }
-
- /**
- * Returns whether this node's width is wrap_content.
- */
- public static boolean isWidthWrapContent(Element element) {
- return element.getAttribute(ANDROID_LAYOUT_WIDTH).equals(VALUE_WRAP_CONTENT);
- }
-
- /**
- * Returns whether this node's height is match_parent.
- */
- public static boolean isHeightFillParent(Element element) {
- final String attribute = element.getAttribute(ANDROID_LAYOUT_HEIGHT);
- return attribute.equals(VALUE_FILL_PARENT) || attribute.equals(VALUE_MATCH_PARENT);
- }
-
- /**
- * Returns whether this node's height is wrap_content.
- */
- public static boolean isHeightWrapContent(Element element) {
- return element.getAttribute(ANDROID_LAYOUT_HEIGHT).equals(VALUE_WRAP_CONTENT);
- }
-
- /**
- * xmlNode.isRoot()
- *
- * @return True if xmlNode is the root of the document, false otherwise
- */
- public static boolean isRoot(Node node) {
- return node.getOwnerDocument().getDocumentElement() == node;
- }
-
- /**
- * xmlNode.is("tagName")
- *
- * @return True if xmlNode.getNodeName().equals(name), false otherwise.
- */
- public static boolean is(Node node, String name) {
- return node.getNodeName().equals(name);
- }
-
- /**
- * xmlNode.depth()
- *
- * @return The maximum depth of the node.
- */
- public static int depth(Node node) {
- int maxDepth = 0;
- NodeList list = node.getChildNodes();
- int count = list.getLength();
-
- for (int i = 0; i < count; i++) {
- maxDepth = Math.max(maxDepth, depth(list.item(i)));
- }
-
- return maxDepth + 1;
- }
-
- /**
- * analysis << "The issue"
- *
- * @return The analysis itself to chain calls.
- */
- public static LayoutAnalysis leftShift(LayoutAnalysis analysis, GString description) {
- analysis.addIssue(description.toString());
- return analysis;
- }
-
- /**
- * analysis << "The issue"
- *
- * @return The analysis itself to chain calls.
- */
- public static LayoutAnalysis leftShift(LayoutAnalysis analysis, String description) {
- analysis.addIssue(description);
- return analysis;
- }
-
- /**
- * analysis << [node: node, description: "The issue"]
- *
- * @return The analysis itself to chain calls.
- */
- public static LayoutAnalysis leftShift(LayoutAnalysis analysis, Map issue) {
- analysis.addIssue((Node) issue.get("node"), issue.get("description").toString());
- return analysis;
- }
-}
diff --git a/layoutopt/libs/uix/src/com/android/layoutopt/uix/rules/GroovyRule.java b/layoutopt/libs/uix/src/com/android/layoutopt/uix/rules/GroovyRule.java
deleted file mode 100644
index 785b8f4..0000000
--- a/layoutopt/libs/uix/src/com/android/layoutopt/uix/rules/GroovyRule.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Copyright (C) 2009 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.layoutopt.uix.rules;
-
-import groovy.lang.Script;
-import groovy.lang.Binding;
-import groovy.lang.Closure;
-import groovy.xml.dom.DOMCategory;
-import com.android.layoutopt.uix.LayoutAnalysis;
-import com.android.layoutopt.uix.groovy.LayoutAnalysisCategory;
-import org.w3c.dom.Node;
-import org.codehaus.groovy.runtime.GroovyCategorySupport;
-
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Collections;
-
-/**
- * Implementation of a rule using a Groovy script.
- */
-public class GroovyRule implements Rule {
- private final String mName;
- private final Script mScript;
- private final Binding mBinding;
- private final Closure mClosure;
- private final List<Class> mCategories;
-
- public GroovyRule(String name, Script script) {
- mName = name;
- mScript = script;
- mBinding = new Binding();
- mScript.setBinding(mBinding);
- mClosure = new Closure(this) {
- @Override
- public Object call() {
- return mScript.run();
- }
- };
- mCategories = new ArrayList<Class>();
- Collections.addAll(mCategories, DOMCategory.class, LayoutAnalysisCategory.class);
- }
-
- public String getName() {
- return mName;
- }
-
- public void run(LayoutAnalysis analysis, Node node) {
- mBinding.setVariable("analysis", analysis);
- mBinding.setVariable("node", node);
-
- GroovyCategorySupport.use(mCategories, mClosure);
- }
-}
diff --git a/layoutopt/libs/uix/src/com/android/layoutopt/uix/rules/Rule.java b/layoutopt/libs/uix/src/com/android/layoutopt/uix/rules/Rule.java
deleted file mode 100644
index 0168992..0000000
--- a/layoutopt/libs/uix/src/com/android/layoutopt/uix/rules/Rule.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2009 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.layoutopt.uix.rules;
-
-import com.android.layoutopt.uix.LayoutAnalysis;
-import org.w3c.dom.Node;
-
-/**
- * Interface that define an analysis rule.
- */
-public interface Rule {
- /**
- * Returns the name of the rule.
- *
- * @return A non-null String.
- */
- String getName();
-
- /**
- * Runs the rule for the specified node. The rule must add any detected
- * issue to the analysis.
- *
- * @param analysis The resulting analysis.
- * @param node The original XML node.
- */
- void run(LayoutAnalysis analysis, Node node);
-}
diff --git a/layoutopt/libs/uix/src/com/android/layoutopt/uix/util/IOUtilities.java b/layoutopt/libs/uix/src/com/android/layoutopt/uix/util/IOUtilities.java
deleted file mode 100644
index 69ac30f..0000000
--- a/layoutopt/libs/uix/src/com/android/layoutopt/uix/util/IOUtilities.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright (C) 2009 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.layoutopt.uix.util;
-
-import java.io.Closeable;
-import java.io.IOException;
-
-/**
- * Various utilities related to I/O operations.
- */
-public class IOUtilities {
- private IOUtilities() {
- }
-
- /**
- * Safely close a Closeable object, like an InputStream.
- *
- * @param stream The object to close.
- *
- * @return True if the object is null or was closed properly,
- * false otherwise.
- */
- public static boolean close(Closeable stream) {
- if (stream != null) {
- try {
- stream.close();
- } catch (IOException e) {
- return false;
- }
- }
- return true;
- }
-}
diff --git a/layoutopt/libs/uix/src/com/android/layoutopt/uix/xml/XmlDocumentBuilder.java b/layoutopt/libs/uix/src/com/android/layoutopt/uix/xml/XmlDocumentBuilder.java
deleted file mode 100644
index f5779ff..0000000
--- a/layoutopt/libs/uix/src/com/android/layoutopt/uix/xml/XmlDocumentBuilder.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*
- * Copyright (C) 2009 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.layoutopt.uix.xml;
-
-import com.sun.org.apache.xerces.internal.parsers.DOMParser;
-import com.sun.org.apache.xerces.internal.xni.XMLLocator;
-import com.sun.org.apache.xerces.internal.xni.NamespaceContext;
-import com.sun.org.apache.xerces.internal.xni.Augmentations;
-import com.sun.org.apache.xerces.internal.xni.XNIException;
-import com.sun.org.apache.xerces.internal.xni.QName;
-import com.sun.org.apache.xerces.internal.xni.XMLAttributes;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.w3c.dom.Node;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXNotRecognizedException;
-import org.xml.sax.SAXNotSupportedException;
-import org.xml.sax.SAXException;
-import org.xml.sax.InputSource;
-
-import java.io.InputStream;
-import java.io.IOException;
-import java.io.File;
-import java.io.FileInputStream;
-import java.util.LinkedList;
-
-/**
- * Parses XML documents. This class tries to add meta-data in the resulting DOM
- * trees to indicate the start and end line numbers of each node.
- */
-public class XmlDocumentBuilder {
- /**
- * Name of the node user data containing the start line number of the node.
- *
- * @see Node#getUserData(String)
- */
- public static final String NODE_START_LINE = "startLine";
-
- /**
- * Name of the node user data containing the end line number of the node.
- *
- * @see Node#getUserData(String)
- */
- public static final String NODE_END_LINE = "endLine";
-
- private final DocumentBuilder mBuilder;
- private boolean mHasLineNumbersSupport;
-
- /**
- * Creates a new XML document builder.
- */
- public XmlDocumentBuilder() {
- try {
- Class.forName("com.sun.org.apache.xerces.internal.parsers.DOMParser");
- mHasLineNumbersSupport = true;
- } catch (ClassNotFoundException e) {
- // Ignore
- }
-
- if (!mHasLineNumbersSupport) {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- try {
- mBuilder = factory.newDocumentBuilder();
- } catch (ParserConfigurationException e) {
- throw new IllegalStateException("Could not initialize the XML parser");
- }
- } else {
- mBuilder = null;
- }
- }
-
- /**
- * Indicates whether the XML documents created by this class are annotated
- * with line numbers.
- *
- * @return True if the parsed documents contain line numbers meta-data,
- * false otherwise.
- *
- * @see #NODE_START_LINE
- * @see #NODE_END_LINE
- */
- public boolean isHasLineNumbersSupport() {
- return mHasLineNumbersSupport;
- }
-
- public Document parse(InputStream inputStream) throws SAXException, IOException {
- if (!mHasLineNumbersSupport) {
- return mBuilder.parse(inputStream);
- } else {
- DOMParser parser = new LineNumberDOMParser();
- parser.parse(new InputSource(inputStream));
- return parser.getDocument();
- }
- }
-
- public Document parse(String content) throws SAXException, IOException {
- if (!mHasLineNumbersSupport) {
- return mBuilder.parse(content);
- } else {
- DOMParser parser = new LineNumberDOMParser();
- parser.parse(content);
- return parser.getDocument();
- }
- }
-
- public Document parse(File file) throws SAXException, IOException {
- return parse(new FileInputStream(file));
- }
-
- private static class LineNumberDOMParser extends DOMParser {
- private static final String FEATURE_NODE_EXPANSION =
- "http://apache.org/xml/features/dom/defer-node-expansion";
- private static final String CURRENT_NODE =
- "http://apache.org/xml/properties/dom/current-element-node";
-
- private XMLLocator mLocator;
- private LinkedList<Node> mStack = new LinkedList<Node>();
-
- private LineNumberDOMParser() {
- try {
- setFeature(FEATURE_NODE_EXPANSION, false);
- } catch (SAXNotRecognizedException e) {
- e.printStackTrace();
- } catch (SAXNotSupportedException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public void startDocument(XMLLocator xmlLocator, String s,
- NamespaceContext namespaceContext, Augmentations augmentations)
- throws XNIException {
- super.startDocument(xmlLocator, s, namespaceContext, augmentations);
-
- mLocator = xmlLocator;
- mStack.add(setNodeLineNumber(NODE_START_LINE));
- }
-
- private Node setNodeLineNumber(String tag) {
- Node node = null;
- try {
- node = (Node) getProperty(CURRENT_NODE);
- } catch (SAXNotRecognizedException e) {
- e.printStackTrace();
- } catch (SAXNotSupportedException e) {
- e.printStackTrace();
- }
-
- if (node != null) {
- node.setUserData(tag, mLocator.getLineNumber(), null);
- }
-
- return node;
- }
-
- @Override
- public void startElement(QName qName, XMLAttributes xmlAttributes,
- Augmentations augmentations) throws XNIException {
- super.startElement(qName, xmlAttributes, augmentations);
- mStack.add(setNodeLineNumber(NODE_START_LINE));
- }
-
- @Override
- public void endElement(QName qName, Augmentations augmentations) throws XNIException {
- super.endElement(qName, augmentations);
- Node node = mStack.removeLast();
- if (node != null) {
- node.setUserData(NODE_END_LINE, mLocator.getLineNumber(), null);
- }
- }
- }
-}
diff --git a/layoutopt/libs/uix/src/resources/rules/IncorrectHeightInScrollView.rule b/layoutopt/libs/uix/src/resources/rules/IncorrectHeightInScrollView.rule
deleted file mode 100644
index 36d3c2e..0000000
--- a/layoutopt/libs/uix/src/resources/rules/IncorrectHeightInScrollView.rule
+++ /dev/null
@@ -1,11 +0,0 @@
-// Rule: IncorrectHeightInScrollView
-//
-// Description: Checks whether a scrollview's child has the wrong dimension.
-//
-// Conditions:
-// - The node has a ScrollView parent
-// - The node has a height set to match_parent
-
-if (node.'..'.is("ScrollView") && node.isHeightFillParent()) {
- analysis << "This ${node.name()} tag should use android:layout_height=\"wrap_content\""
-}
diff --git a/layoutopt/libs/uix/src/resources/rules/IncorrectWidthInHorizontalScrollView.rule b/layoutopt/libs/uix/src/resources/rules/IncorrectWidthInHorizontalScrollView.rule
deleted file mode 100644
index b96e034..0000000
--- a/layoutopt/libs/uix/src/resources/rules/IncorrectWidthInHorizontalScrollView.rule
+++ /dev/null
@@ -1,11 +0,0 @@
-// Rule: IncorrectWidthInScrollView
-//
-// Description: Checks whether a scrollview's child has the wrong dimension.
-//
-// Conditions:
-// - The node has a HorizontalScrollView parent
-// - The node has a width set to match_parent
-
-if (node.'..'.is("HorizontalScrollView") && node.isWidthFillParent()) {
- analysis << "This ${node.name()} tag should use android:layout_width=\"wrap_content\""
-}
diff --git a/layoutopt/libs/uix/src/resources/rules/InefficientWeight.rule b/layoutopt/libs/uix/src/resources/rules/InefficientWeight.rule
deleted file mode 100644
index 928d7a1..0000000
--- a/layoutopt/libs/uix/src/resources/rules/InefficientWeight.rule
+++ /dev/null
@@ -1,19 +0,0 @@
-// Rule: InefficientWeight
-//
-// Description: Checks whether a layout_weight is declared inefficiently.
-//
-// Conditions:
-// - The node has a LinearLayout parent
-// - The node is the only sibling with a weight
-// - The node has a height/width != 0
-
-def parent = node.'..'
-if (parent.is("LinearLayout") && node.'@android:layout_weight' &&
- parent.'*'.findAll{ it.'@android:layout_weight' }.size() == 1) {
- def dimension = parent.'@android:orientation' == "vertical" ?
- "android:layout_height" : "android:layout_width"
- if (node."@${dimension}"[0] != '0') {
- analysis << "Use an ${dimension} of 0dip instead of ${node."@${dimension}"} " +
- "for better performance"
- }
-}
diff --git a/layoutopt/libs/uix/src/resources/rules/MergeRootFrameLayout.rule b/layoutopt/libs/uix/src/resources/rules/MergeRootFrameLayout.rule
deleted file mode 100644
index c477155..0000000
--- a/layoutopt/libs/uix/src/resources/rules/MergeRootFrameLayout.rule
+++ /dev/null
@@ -1,18 +0,0 @@
-// Rule: MergeRootFrameLayout
-//
-// Description: Checks whether the root node of the XML document can be
-// replaced with a <merge /> tag.
-//
-// Conditions:
-// - The node is the root of the document
-// - The node is a FrameLayout
-// - The node is match_parent in both orientation *or* it has no layout_gravity
-// - The node does not have a background nor a foreground
-// - The node does not have padding
-
-if (node.isRoot() && node.is("FrameLayout") && !node.'@android:background' &&
- !node.'@android:foreground' && ((node.isWidthFillParent() &&
- node.isHeightFillParent()) || !node.'@android:layout_gravity') &&
- !node.hasPadding()) {
- analysis << "The root-level <FrameLayout/> can be replaced with <merge/>"
-}
diff --git a/layoutopt/libs/uix/src/resources/rules/NestedScrollingWidgets.rule b/layoutopt/libs/uix/src/resources/rules/NestedScrollingWidgets.rule
deleted file mode 100644
index f48c24e..0000000
--- a/layoutopt/libs/uix/src/resources/rules/NestedScrollingWidgets.rule
+++ /dev/null
@@ -1,19 +0,0 @@
-// Rule: NestedScrollingWidgets
-//
-// Description: Checks whether a scrolling widget has nested scrolling widgets.
-//
-// Conditions:
-// - The node is a scrolling widget
-// - The node has a descendant who is also a scrolling widget
-
-def widgets = ["ScrollView", "ListView", "GridView"]
-if (node.name() in widgets && node.all().any{ it.name() in widgets }) {
- analysis << "The vertically scrolling ${node.name()} should not contain another " +
- "vertically scrolling widget"
-}
-
-widgets = ["HorizontalScrollView", "Gallery"]
-if (node.name() in widgets && node.all().any{ it.name() in widgets }) {
- analysis << "The horizontally scrolling ${node.name()} should not contain another " +
- "horizontally scrolling widget"
-}
diff --git a/layoutopt/libs/uix/src/resources/rules/TooManyChildren.rule b/layoutopt/libs/uix/src/resources/rules/TooManyChildren.rule
deleted file mode 100644
index 516d91f..0000000
--- a/layoutopt/libs/uix/src/resources/rules/TooManyChildren.rule
+++ /dev/null
@@ -1,15 +0,0 @@
-// Rule: TooManyChildren
-//
-// Description: Checks whether the layout has too many children.
-//
-// Conditions:
-// - The layout is a ScrollView and has more than 1 child
-// - The layout is a list or grid ans has at least 1 child
-
-if (node.name() in ["ScrollView", "HorizontalScrollView"] && node.'*'.size() > 1) {
- analysis << "A scroll view can have only one child"
-}
-
-if (node.name() in ["ListView", "GridView"] && node.'*'.size() > 0) {
- analysis << "A list/grid should have no children declared in node"
-}
diff --git a/layoutopt/libs/uix/src/resources/rules/TooManyLevels.rule b/layoutopt/libs/uix/src/resources/rules/TooManyLevels.rule
deleted file mode 100644
index f04e082..0000000
--- a/layoutopt/libs/uix/src/resources/rules/TooManyLevels.rule
+++ /dev/null
@@ -1,11 +0,0 @@
-// Rule: TooManyLevels
-//
-// Description: Checks whether the layout has too many nested groups.
-//
-// Conditions:
-// - The depth of the layout is > 10
-
-if (node.isRoot() && (depth = node.depth()) > 10) {
- analysis << [node: null, description: "This layout has too many nested layouts: " +
- "${depth} levels, it should have <= 10!"]
-}
diff --git a/layoutopt/libs/uix/src/resources/rules/TooManyViews.rule b/layoutopt/libs/uix/src/resources/rules/TooManyViews.rule
deleted file mode 100644
index 544a888..0000000
--- a/layoutopt/libs/uix/src/resources/rules/TooManyViews.rule
+++ /dev/null
@@ -1,11 +0,0 @@
-// Rule: TooManyViews
-//
-// Description: Checks whether the layout has too many views.
-//
-// Conditions:
-// - The document contains more than 80 views
-
-if (node.isRoot && (size = node.'**'.size()) > 80) {
- analysis << [node: null,
- description: "This layout has too many views: ${size} views, it should have <= 80!"]
-}
diff --git a/layoutopt/libs/uix/src/resources/rules/UseCompoundDrawables.rule b/layoutopt/libs/uix/src/resources/rules/UseCompoundDrawables.rule
deleted file mode 100644
index 4e4a6ba..0000000
--- a/layoutopt/libs/uix/src/resources/rules/UseCompoundDrawables.rule
+++ /dev/null
@@ -1,15 +0,0 @@
-// Rule: UseCompoundDrawables
-//
-// Description: Checks whether the current node can be replaced by a TextView
-// using compound drawables.
-//
-// Conditions:
-// - The node is a LinearLayout
-// - The node has two children, ImageView and TextView
-// - The ImageView does not have a weight
-
-if (node.is("LinearLayout") && node.'*'.size() == 2 && node.'TextView'.size() == 1 &&
- node.'ImageView'.size() == 1 && !node.'ImageView'[0].'@android:layout_weight') {
- analysis << "This tag and its children can be replaced by one <TextView/> and " +
- "a compound drawable"
-}
diff --git a/layoutopt/libs/uix/src/resources/rules/UselessLayout.rule b/layoutopt/libs/uix/src/resources/rules/UselessLayout.rule
deleted file mode 100644
index 9326333..0000000
--- a/layoutopt/libs/uix/src/resources/rules/UselessLayout.rule
+++ /dev/null
@@ -1,19 +0,0 @@
-// Rule: UselessLayout
-//
-// Description: Checks whether current node can be removed.
-//
-// Conditions:
-// - The node has children
-// - The node does not have siblings
-// - The node's parent is not a scroll view (horizontal or vertical)
-// - The node does not have a background or its parent does not have a
-// background or neither the node and its parent have a background
-// - The parent is not a <merge/>
-
-if (!node.isRoot() && !(node['..'].name() in ["ScrollView", "HorizontalScrollView"]) &&
- node['..']['*'].size() == 1 && node['*'].size() > 0 && ((node.'@android:background' ||
- node['..'].'@android:background') || (!node.'@android:background' &&
- !node['..'].'@android:background'))) {
- analysis << "This ${node.name()} layout or its ${node['..'].name()} parent is " +
- "${node['..'].'@android:id' ? "possibly useless" : "useless"}"
-}
diff --git a/layoutopt/libs/uix/src/resources/rules/UselessView.rule b/layoutopt/libs/uix/src/resources/rules/UselessView.rule
deleted file mode 100644
index c3a77e5..0000000
--- a/layoutopt/libs/uix/src/resources/rules/UselessView.rule
+++ /dev/null
@@ -1,14 +0,0 @@
-// Rule: UselessView
-//
-// Description: Checks whether a container view can be removed.
-//
-// Conditions:
-// - The node is a container view (LinearLayout, etc.)
-// - The node has no id
-// - The node has no background
-// - The node has no children
-
-if (node.isContainer() && node.'*'.size() == 0 && !node.'@android:id' &&
- !node.'@android:background') {
- analysis << "This ${node.name()} view is useless (no children, no background, no id)"
-}
diff --git a/layoutopt/samples/compound.xml b/layoutopt/samples/compound.xml
deleted file mode 100644
index f7b28ef..0000000
--- a/layoutopt/samples/compound.xml
+++ /dev/null
@@ -1,17 +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="match_parent">
-
- <ImageView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content" />
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content" />
-
-</LinearLayout>
diff --git a/layoutopt/samples/has_children.xml b/layoutopt/samples/has_children.xml
deleted file mode 100644
index 3e663b2..0000000
--- a/layoutopt/samples/has_children.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<ListView
- xmlns:android="http://schemas.android.com/apk/res/android"
-
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <ListView
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
-
-</ListView>
\ No newline at end of file
diff --git a/layoutopt/samples/inefficient_weight.xml b/layoutopt/samples/inefficient_weight.xml
deleted file mode 100644
index 81c8b71..0000000
--- a/layoutopt/samples/inefficient_weight.xml
+++ /dev/null
@@ -1,44 +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="match_parent">
-
- <Button
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1.0" />
-
- <LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
-
- android:layout_width="match_parent"
- android:layout_height="match_parent"
-
- android:orientation="vertical">
-
- <Button
- android:layout_width="match_parent"
- android:layout_height="wrap_content"
- android:layout_weight="1.0" />
-
- </LinearLayout>
-
- <LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
-
- android:layout_width="match_parent"
- android:layout_height="match_parent"
-
- android:orientation="vertical">
-
- <Button
- android:layout_width="match_parent"
- android:layout_height="0dip"
- android:layout_weight="1.0" />
-
- </LinearLayout>
-
-</LinearLayout>
\ No newline at end of file
diff --git a/layoutopt/samples/scrolling.xml b/layoutopt/samples/scrolling.xml
deleted file mode 100644
index 9eb862f..0000000
--- a/layoutopt/samples/scrolling.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<ScrollView
- xmlns:android="http://schemas.android.com/apk/res/android"
-
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <ListView
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
-
- </LinearLayout>
-
-</ScrollView>
diff --git a/layoutopt/samples/simple.xml b/layoutopt/samples/simple.xml
deleted file mode 100644
index d462c69..0000000
--- a/layoutopt/samples/simple.xml
+++ /dev/null
@@ -1,7 +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" />
diff --git a/layoutopt/samples/too_deep.xml b/layoutopt/samples/too_deep.xml
deleted file mode 100644
index 0c617b8..0000000
--- a/layoutopt/samples/too_deep.xml
+++ /dev/null
@@ -1,85 +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="match_parent">
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- </LinearLayout>
-
- </LinearLayout>
-
- </LinearLayout>
-
- </LinearLayout>
-
- </LinearLayout>
-
- </LinearLayout>
-
- </LinearLayout>
-
- </LinearLayout>
-
- </LinearLayout>
-
- </LinearLayout>
-
- </LinearLayout>
-
-</LinearLayout>
diff --git a/layoutopt/samples/too_many.xml b/layoutopt/samples/too_many.xml
deleted file mode 100644
index 2ea266d..0000000
--- a/layoutopt/samples/too_many.xml
+++ /dev/null
@@ -1,413 +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">
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- </LinearLayout>
-
- </LinearLayout>
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- <Button
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- android:text="Ok" />
-
- </LinearLayout>
-
- </LinearLayout>
-
-</FrameLayout>
diff --git a/layoutopt/samples/useless.xml b/layoutopt/samples/useless.xml
deleted file mode 100644
index 61b70af..0000000
--- a/layoutopt/samples/useless.xml
+++ /dev/null
@@ -1,19 +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">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <TextView
- android:layout_width="wrap_content"
- android:layout_height="wrap_content" />
-
- </LinearLayout>
-
-</FrameLayout>
diff --git a/layoutopt/samples/wrong_dimension.xml b/layoutopt/samples/wrong_dimension.xml
deleted file mode 100644
index 79b922b..0000000
--- a/layoutopt/samples/wrong_dimension.xml
+++ /dev/null
@@ -1,13 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-
-<HorizontalScrollView
- xmlns:android="http://schemas.android.com/apk/res/android"
-
- android:layout_width="match_parent"
- android:layout_height="match_parent">
-
- <LinearLayout
- android:layout_width="match_parent"
- android:layout_height="match_parent" />
-
-</HorizontalScrollView>