diff options
author | Tor Norbye <tnorbye@google.com> | 2012-10-15 13:03:40 -0700 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2012-10-15 17:46:37 -0700 |
commit | a1e7aa7cc973adaba4f31673c897724eb8d9f399 (patch) | |
tree | a882deff58ea4fd638421369053660fbc8d21d44 /lint/cli | |
parent | 1e6c45d826478a9621f433c28cce38786b890f52 (diff) | |
download | sdk-a1e7aa7cc973adaba4f31673c897724eb8d9f399.zip sdk-a1e7aa7cc973adaba4f31673c897724eb8d9f399.tar.gz sdk-a1e7aa7cc973adaba4f31673c897724eb8d9f399.tar.bz2 |
Misc improvements to the multi-configuration editing
* Fix bug in switching to preview configurations
* Don't draw drop shadows for thumbnails in Dialog themes
* Move the preview title labels to sit above each preview
thumbnail
* Make error thumbnails include rendering error messages
(and wrap if necessary), plus tweak appearance
* Make switch animation show rectangles animating in
both directions
Change-Id: I0995617fa277b48419a88c5203abf5b1d49af711
Diffstat (limited to 'lint/cli')
-rw-r--r-- | lint/cli/src/com/android/tools/lint/Main.java | 45 |
1 files changed, 3 insertions, 42 deletions
diff --git a/lint/cli/src/com/android/tools/lint/Main.java b/lint/cli/src/com/android/tools/lint/Main.java index a33890d..ad086c7 100644 --- a/lint/cli/src/com/android/tools/lint/Main.java +++ b/lint/cli/src/com/android/tools/lint/Main.java @@ -16,9 +16,9 @@ package com.android.tools.lint; +import static com.android.SdkConstants.DOT_XML; import static com.android.tools.lint.client.api.IssueRegistry.LINT_ERROR; import static com.android.tools.lint.client.api.IssueRegistry.PARSER_ERROR; -import static com.android.SdkConstants.DOT_XML; import static com.android.tools.lint.detector.api.LintUtils.endsWith; import com.android.annotations.NonNull; @@ -40,6 +40,7 @@ import com.android.tools.lint.detector.api.Location; import com.android.tools.lint.detector.api.Position; import com.android.tools.lint.detector.api.Project; import com.android.tools.lint.detector.api.Severity; +import com.android.utils.SdkUtils; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.io.Closeables; @@ -873,47 +874,7 @@ public class Main extends LintClient { } static String wrap(String explanation, int lineWidth, String hangingIndent) { - int explanationLength = explanation.length(); - StringBuilder sb = new StringBuilder(explanationLength * 2); - int index = 0; - - while (index < explanationLength) { - int lineEnd = explanation.indexOf('\n', index); - int next; - - if (lineEnd != -1 && (lineEnd - index) < lineWidth) { - next = lineEnd + 1; - } else { - // Line is longer than available width; grab as much as we can - lineEnd = Math.min(index + lineWidth, explanationLength); - if (lineEnd - index < lineWidth) { - next = explanationLength; - } else { - // then back up to the last space - int lastSpace = explanation.lastIndexOf(' ', lineEnd); - if (lastSpace > index) { - lineEnd = lastSpace; - next = lastSpace + 1; - } else { - // No space anywhere on the line: it contains something wider than - // can fit (like a long URL) so just hard break it - next = lineEnd + 1; - } - } - } - - if (sb.length() > 0) { - sb.append(hangingIndent); - } else { - lineWidth -= hangingIndent.length(); - } - - sb.append(explanation.substring(index, lineEnd)); - sb.append('\n'); - index = next; - } - - return sb.toString(); + return SdkUtils.wrap(explanation, lineWidth, hangingIndent); } private static void printUsage(PrintStream out) { |