summaryrefslogtreecommitdiff
path: root/core/java/android/text/Html.java
Commit message (Collapse)AuthorAgeFilesLines
* Bold StyleSpan further for auto-boldsallyyuen2021-12-061-3/+14
| | | | | | | | | | | | | StyleSpan with Typeface.BOLD will only bold if the text doesn't already have a BOLD style. But auto-bolded text needs to be further bolded. If the Typeface style is BOLD, bold more for auto-bold. (The fake bold works for Typefaces with weight < 700) Test: manual - settings page, example StyleSpans, atest StyleSpanTest TextViewTests Bug: 175177807 Change-Id: Iec7db7eadd18ed6a2efc6ee39b49c1d6cb15d870
* Add maxTargetSdk restriction to unused APIs.Mathew Inwood2020-10-291-1/+2
| | | | | | | | | | | | | | | | | | | These are APIs that have @UnsupportedAppUsage but for which we don't have any evidence of them currently being used, so should be safe to remove from the unsupported list. This is a resubmit of ag/12929664 with some APIs excluded that caused test failures; see bugs 171886397, 171888296, 171864568. APIs excluded: Landroid/bluetooth/le/ScanRecord;->parseFromBytes([B)Landroid/bluetooth/le/ScanRecord; Landroid/os/Process;->myPpid()I Landroid/os/SharedMemory;->getFd()I Landroid/hardware/input/InputManager;->INJECT_INPUT_EVENT_MODE_WAIT_FOR_FINISH:I Bug: 170729553 Test: Treehugger Change-Id: I8285daa8530260251ecad6f3f38f98e263629ca7
* Revert "Add maxTargetSdk restriction to unused APIs."Hongwei Wang2020-10-281-2/+1
| | | | | | | | | This reverts commit 72f07d6a8a32db4a0dedd7682a0b3385be2b9cd6. Reason for revert: Droidcop-triggered revert due to breakage https://android-build.googleplex.com/builds/quarterdeck?testMethod=testAppZygotePreload&testClass=android.app.cts.ServiceTest&atpConfigName=suite%2Ftest-mapping-presubmit-retry_cloud-tf&testModule=CtsAppTestCases&fkbb=6936597&lkbb=6936969&lkgb=6936551&testResults=true&branch=git_master&target=cf_x86_phone-userdebug>, bug b/171886397 Bug: 171886397 Change-Id: Ibe0f0430a3451477c1ee8ef56a596e91ea1e7672
* Add maxTargetSdk restriction to unused APIs.Mathew Inwood2020-10-271-1/+2
| | | | | | | | | | These are APIs that have @UnsupportedAppUsage but for which we don't have any evidence of them currently being used, so should be safe to remove from the unsupported list. Bug: 170729553 Test: Treehugger Change-Id: I4c8fd0006f950de9955242e93968fb0996ceb372
* Merge "Update language to comply with Android’s inclusive language ↵Treehugger Robot2020-07-231-1/+1
|\ | | | | | | | | | | | | | | guidance" am: dce2f1c04b am: c686b1f21c am: 50015ad612 am: 7ee1dc7321 am: 0ead0fc382 Original change: https://android-review.googlesource.com/c/platform/frameworks/base/+/1371481 Change-Id: Ib0e78ce48eaa0be5cc8dc69d3e5674ac8722a287
| * Update language to comply with Android’s inclusive language guidanceSeigo Nonaka2020-07-221-1/+1
| | | | | | | | | | | | | | | | See https://source.android.com/setup/contribute/respectful-code for reference Bug: 161896447 Test: atest TextViewTest Change-Id: I83f253f6edfb2724972793b3495835540b7b52e4
| * Use new UnsupportedAppUsage annotation.Artur Satayev2020-01-091-1/+1
| | | | | | | | | | | | | | | | | | Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library. Bug: 145132366 Test: m && diff unsupportedappusage_index.csv Change-Id: I288969b0c22fa3a63bc2e71bb5009fe4a927e154 Merged-In: I288969b0c22fa3a63bc2e71bb5009fe4a927e154
| * Add @UnsupportedAppUsage annotationsMathew Inwood2018-08-151-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For packages: android.text.util android.text.style android.text.method android.text.format android.text This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: I5be178ad05f2ff98bcf31e24cd4eb33961887c38 Merged-In: I9afbd4ca8826c37cb70db43252e39b9a674e5ae0
* | Remove @hide from android.graphics.ColorLeon Scroggins III2020-05-141-1/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Bug: 156505010 Test: HtmlTest Test: I060478a4e46f4ed153007d42cb5b7c5eae04de27 Remove Color#getHtmlColor, which was marked as @hide. Its only caller was outside the in-progress UI rendering module, so it would no longer be able to access it after the move. Make the calling code call either the already-public Color#parseColor or the (@hide, which is okay from android.text) XmlUtils.convertValueToInt directly to achieve the same effect as before. Change-Id: I8fde97bb866689849ba49932c6d7ca10bbd618c5
* | Use new UnsupportedAppUsage annotation.Artur Satayev2020-01-071-1/+1
| | | | | | | | | | | | | | | | Existing annotations in libcore/ and frameworks/ will deleted after the migration. This also means that any java library that compiles @UnsupportedAppUsage requires a direct dependency on "unsupportedappusage" java_library. Bug: 145132366 Test: m && diff unsupportedappusage_index.csv Change-Id: I288969b0c22fa3a63bc2e71bb5009fe4a927e154
* | Add @UnsupportedAppUsage annotationsMathew Inwood2018-08-151-0/+2
|/ | | | | | | | | | | | | | | | | | | | For packages: android.text.util android.text.style android.text.method android.text.format android.text This is an automatically generated CL. See go/UnsupportedAppUsage for more details. Exempted-From-Owner-Approval: Mechanical changes to the codebase which have been approved by Android API council and announced on android-eng@ Bug: 110868826 Test: m Change-Id: I9afbd4ca8826c37cb70db43252e39b9a674e5ae0
* Use TextDirectionHeuristics to detect text direction in HtmlRoozbeh Pournader2016-12-141-15/+4
| | | | | | | | | | Previously, AndroidBidi was used instead, whch did a lot of extra work just to detect a paragraph's direction. TextDirectionHeuristics stops as soon as the direction is found, and avoids JNI too. Bug: 21455837 Test: cts-tradefed run cts-dev --module CtsTextTestCases --test android.text.cts.HtmlTest Change-Id: Iea196fb5ca43dca99e65a367a2da701b1c1b98b8
* Fix imports in android.text package.Aurimas Liutikas2016-10-111-12/+11
| | | | | | | This change also removes trailing whitespaces. Test: code still compiles Change-Id: I65f79a34288d01616808fa9cd6732ae4ef0f1377
* Adopt HTML/CSS color values in fromHtml()Daniel U2016-02-111-57/+62
| | | | | | | | | | | | | | | | | - "green", "gray/grey", "lightgray/lightgrey", and "darkgray/darkgrey" have different values in HTML/CSS. - Adopt HTML/CSS color values according to user specified option flag. - Remove support to "@color" notation as it is not standard HTML/CSS. - Replace SPAN_MARK_MARK with SPAN_INCLUSIVE_EXCLUSIVE consistency. BUG:26950749 Change-Id: I5b33282368042f74f1b4768e096aae3e5bf45de6
* Tweak toHtml() paragraph conversion behaviorDaniel U2016-02-111-47/+80
| | | | | | | | | | | | | | | | For mode TO_HTML_PARAGRAPH_LINES_INDIVIDUAL: 1) Empty line outputs <br> instead of <p><br></p> 2) A <ul> element is closed if it is followed by a <br> 3) Explicit zero vertical margin is applied to <ul> instead of <li>'s 4) More deterministic way to encode AlignmentSpans: only spans with SPAN_PARAGRAPH flag is used. If multiple spans exist, the last one (which is added most recently) is used. BUG: 26224878 Change-Id: I86a2aeced9965ae465daac1ace64e5e41cf45caf
* Handle <span>, <ul>, and <li> tags in fromHtml()Daniel U2016-02-101-0/+127
| | | | | | | | | The vertical spacing of <ul> and <li> are determined by the FROM_HTML_SEPARATOR_* flags. Foreground color, background color, and text-decoration CSS attributes are parsed and converted into the corresponding spans. Change-Id: I93b232de15753ae510392cbacf45e7453d1ae067
* Allow different paragraph breaks in fromHtml()Daniel U2016-02-101-88/+176
| | | | | | | | | | | | - Separate block-level elements with different numbers of newline characters according to the user specified option flag. - Parse the ALIGN attribute and the CSS TEXT-ALIGN property to handle text alignment. - Rename "header" to the correct term "heading" Change-Id: I446fa97155e761623a1da6632a0d872a5e47e8af
* Encode BulletSpan in toHtml() conversionDaniel U2016-01-271-29/+125
| | | | | | | | | | | | | | | | | | Changes in toHtml() conversion with TO_HTML_PARAGRAPH_LINES_INDIVIDUAL: - Wrap each paragraph inside a block-level element Each paragraph delimited by '\n' is now wrapped individually inside either a <p> or a <li> block to allow per-paragraph formatting. - Wrap paragraphs covered by BulletSpans as <li> instead of <p> blocks - Encode text alignment at paragraph level Instead of creating <div> blocks outside of the block quote level. - Encode AlignmentSpan as CSS style instead of the ALIGN attribute The ALIGN attribute is obsolete. Change-Id: I3a8b315224b762af99eda69cb19f5cf6b3f05dac
* Enhance support to text size spans in toHtml()Daniel U2016-01-271-4/+19
| | | | | | | | | | | | Convert AbsoluteSizeSpan to <span> with CSS font-size property with CSS px as the unit of measurement. Sizes measured in Android px are converted to dip, since there is no CSS unit which conveys the idea of a device pixel. Add support to RelativeSizeSpan, which converts to <span> with CSS font-size property with em as the unit of measurement. Change-Id: I9104cc5f9b00ab1a31929565dc49e0026466cc75
* Support more CharacterStyles in toHtml() conversionDaniel U2016-01-271-17/+18
| | | | | | | | - Add support to convert BackgroundColorSpan - Convert StrikethroughSpan to <span> with CSS styling instead of <strike> - Convert ForegroundColorSpan to <span> with CSS styling instead of <font> Change-Id: I05ff6b97534df9ee586a552c7e6435aabca152ac
* Overload toHtml() & fromHtml() to accept option flagsDaniel U2016-01-271-19/+126
| | | | | | | Overload the methods to take int option flags indicating the conversion behavior. This guards against large disruptions in legacy applications. Change-Id: I0f47180bbb78884b67aa200fe5156e903eeaa6f6
* Support strikethrough text in Html.fromHtml().Roozbeh Pournader2015-08-121-0/+13
| | | | | | | | All the three tags, <del>, <s>, and <strike> are now converted to strikethrough text. Bug: 21025743 Change-Id: I62dc9793223e266f6e2181169766fde8be0e2aa7
* Improve Html.toHtml() documentationRaph Levien2015-07-101-1/+6
| | | | | | | | | | | The existing documentation is very terse and users were getting confused whether the method escapes HTML metacharacters or not. Expand the description a bit and explicitly state that metacharacters are escaped. Bug: 17456925 Change-Id: Icaae7fe1344629de5c0860674f3913781de18013
* Fix NPE in Html.inParagraph()Raph Levien2015-05-051-1/+1
| | | | | | | | The typeface in a TypefaceSpan can be the null string. This patch fixes the string comparison to not throw a NullPointerException. Bug: 20849738 Change-Id: Ied049305794966bcbca00cfd11fe97a91b685d79
* Make Html#toHTML() generate correct bidi directions.Roozbeh Pournader2015-03-231-7/+9
| | | | | | | | | Previously, after the first paragraph, the the detected bidi direction of the text in the last paragraph was used, nstead of the detected bidi direction of the current one. Bug: 12027356 Change-Id: I51622a3156f1e321f53f7ca1855bc37aa6f77319
* Replace usages of deprecated Resources.getColor() and getColorStateList()Alan Viverette2015-03-181-1/+1
| | | | Change-Id: I8f64fe6c4c44a92ff6d07250223ba590a1d691b0
* resolved conflicts for merge of 2008cff7 to lmp-dev-plus-aospElliott Hughes2014-09-081-1/+1
|\ | | | | | | Change-Id: I5148eda624e8504f12dbc1288cd4a7a5b7c10850
| * Small documentation fixes across many files.Mark Doliner2014-09-051-1/+1
| | | | | | | | Change-Id: I3e8787ce4bc6018ea1dc9aef2a2cd4e0a8dde663
* | Uses VMRuntime.newUnpaddedArray for ideal array sizesAdam Lesinski2014-03-271-1/+1
| | | | | | | | | | | | Bug:13028925 Change-Id: I0a9301248b10a339afbdc5e4ffe3310ac4fa1fb7
* | Remove unused imports from frameworks/base.John Spurlock2013-11-201-3/+0
|/ | | | Change-Id: Ia1f99bd2c1105b0b0f70aa614f1f4a67b2840906
* Handle surrogate pairs in Html.toHtml()Victoria Lease2013-10-291-0/+9
| | | | | Bug: 11338711 Change-Id: Ia44187cbfe3db82d6bc11c1ae3a0fb59c0a6d371
* Add support for face attribute to HTML string resourcesRomain Guy2012-11-271-51/+7
| | | | | | | | | | Bug #7480719 This change also adds the alias "color" for the attribute "fgcolor". This change also unifies HTML colors parsing between the Html class and StringBlock for consistency. Change-Id: I696a6e080387901d88e9baf7cb989b892f14b9db
* Fix for 7301594 Html.toHtml creating potentially invalid htmlRaph Levien2012-10-071-2/+2
| | | | | | | Generate <p dir="rtl"> instead of <p dir=rtl>. The form with the quotes is cleaner and will reduce warnings in apps that consume the output. Change-Id: Ic9879c8c882c42079598b741e897a24415d96374
* Add direct support for HTML formatted text in ClipData etc.Dianne Hackborn2012-04-131-1/+10
| | | | | | | | | | | When using the clipboard, ACTION_SEND, etc., you can now supply HTML formatted text as one of the representations. This is exposed as a set of methods on ClipData for building items with HTML formatted text, and retrieving and coercing to HTML (and styled) text. In addtion, there is a new EXTRA_HTML_TEXT for interoperating with the old ACTION_SEND protocol. Change-Id: I8846520a480c8a5f829ec1e693aeebd425ac170d
* Fix bug #5371909 Hebrew & Arabic mails are sent as LTR intead of RTLFabrice Di Meglio2012-02-291-5/+20
| | | | | | - make paragraphs aware of text direction Change-Id: I0b0cf5a47c7da870dea836cb6150aa83e9de0e90
* Prevent crash when using <em> or <strong> in spanned stringsRomain Guy2011-09-061-2/+2
| | | | | | Bug #5258853 Change-Id: Ifde1efe9ba3b44cfa0be55d51b2c9696cbe096f5
* Italic should be italic and bold should be bold.Romain Guy2011-08-291-2/+2
| | | | Change-Id: I68933a7d7c32951c4d52d945baaedcb2583caef4
* Re-arrange android-common so framework no longer links with it.Dianne Hackborn2010-02-251-1/+2
| | | | | | | This is the framework part, moving classes around so the framework no longer needs to link to android-common. Makes some APIs public, others that didn't need to be public are private in the framework, some small things are copied.
* Update imports to android-commonTom Taylor2009-12-211-1/+1
| | | | | Several files were moved to android-common. Update all the references to import those files from the new location.
* Allow system colors in <font> tagsBjorn Bringert2009-07-151-45/+62
| | | | Fixes http://b/issue?id=1970693
* Automated import from //branches/donutburger/...@142700,142700Eric Fischer2009-03-251-2/+5
|
* Automated import from //branches/donutburger/...@141195,141195Satoshi Kataoka2009-03-241-9/+5
|
* auto import from //branches/cupcake_rel/...@140373The Android Open Source Project2009-03-181-3/+66
|
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-0/+784
|
* auto import from //depot/cupcake/@135843The Android Open Source Project2009-03-031-784/+0
|
* auto import from //branches/cupcake/...@130745The Android Open Source Project2009-02-101-1/+35
|
* Initial ContributionThe Android Open Source Project2008-10-211-0/+750