Commit Graph

747 Commits

Author SHA1 Message Date
Neil Fuller
bbf8871e1c Deprecating FloatMath and Time
Bug: https://code.google.com/p/android/issues/detail?id=36199
Bug: https://code.google.com/p/android/issues/detail?id=37653
Bug: https://code.google.com/p/android/issues/detail?id=42750
Bug: https://code.google.com/p/android/issues/detail?id=61137
Bug: https://code.google.com/p/android/issues/detail?id=74754
Bug: https://code.google.com/p/android/issues/detail?id=76386
Bug: https://code.google.com/p/android/issues/detail?id=76439
Bug: https://code.google.com/p/android/issues/detail?id=77836
Change-Id: Ic9b57d8a575f93b2258a5481df0ed6b3a952f636
2014-10-23 13:13:05 +01:00
Newton Allen
8f8a11b7fa Fix some documentation typos.
Change-Id: I747a0ade5c7b9c45d4465bf327952338bbc1cfaa
(cherry picked from commit 4465d1a03e)
2014-09-30 02:52:26 +00:00
Raph Levien
fb0431b525 Up/down arrow moves to beginning/end of buffer
With a hardware keyboard, using up arrow within the top line should
move to the beginning of the buffer, to better match desktop text
editing expectations, and similarly for down arrow on the last line.
This patch implements that behavior.

Bug: 17385784
Change-Id: Ia23c23c9cc2462558bca9aaffec7d83e284d55e8
2014-09-04 15:03:14 -07:00
Raph Levien
875062059c Fix Layout.isRtlCharAt
We weren't getting correct results from Layout.isRtlCharAt, because it
was only testing half of the correct predicate for whether the argument
was inside the run. This patch restores the correct predicate.

Bug: 17381011
Change-Id: Ib0a77cc182f4ca4bfe824e85b7aff7268f465d73
2014-09-04 12:47:03 -07:00
Neil Fuller
7e19fb0d69 Merge "Fixing android.text.format.Time for non-English locales" into lmp-dev 2014-08-29 13:36:02 +00:00
Neil Fuller
16566656cd Fixing android.text.format.Time for non-English locales
The test fixes for bug 17262063 showed up a real issue for
non-English locales with the Time.format() method:
If the Android string resources that contain the pattern use
non-ASCII characters then a '?' would be output instead of
those characters.

For example, in France the pattern for '%c' includes a 'à'
(a with a grave accent) and Japan includes 日.

The problem was due to converting the pattern to bytes using
the US_ASCII character set, which turns non-ASCII characters
into '?'. The code has been changed to use char throughout
and avoid bytes.

Internal documentation has been improved.

Some calls to modifyAndAppend() have been replaced with a
direct call to outputBuilder.append() because the
modify step is guaranteed to a no-op for the literals given.

The formatter has been changed to use Locale.US because it
is only used for outputting numbers. It has been renamed
to make this more obvious and the locale field has been
removed.

Bug: 17262063

(cherry picked from commit 788cb18f65)

Change-Id: I96ee158fbeb01827f0bbf022631625416f872fdb
2014-08-29 14:10:35 +01:00
Raph Levien
26c87cfb58 Ignore width of trailing whitespace for computing ellipsis
We used the full width of a line, including trailing spaces, to compute
ellipsis, sometimes causing spurious ellipsization when the space pushed
it past the layout width. This patch uses only the width up to the last
graphing character.

Fix for bug 17186801 "First line of title text is getting truncated even
if there's space on second line"

Change-Id: I49d07c18c8dd1d3b279f591224d23e10645dc8c0
2014-08-28 12:56:51 -07:00
Niels Egberts
b9f7692ce6 Fixed spelling of android.nominative and updated some comments.
Bug: 17000831
Change-Id: I3a87635a6a894ee8ad1386cde8b59dcd9533b23f
2014-08-21 11:28:29 +01:00
Anish Athalye
ab08c6d38a Make LeadingMarginSpan2 behavior more consistent
This addresses b/16486549.

This change updates public documentation to specify the behavior of
LeadingMarginSpan2s. This change specifies what happens when a
LeadingMarginSpan2 is combined with other LeadingMarginSpans. This
behavior was not previously documented.

LeadingMarginSpan2s specify the number of lines used for the leading
margin. When laying out and rendering, for all LeadingMarginSpans, the
first line margin is applied for the number of lines specified by the
LeadingMarginSpan2.

Previously, this behavior was slightly buggy -- the LeadingMarginSpan2
affected all LeadingMarginSpans when laying out text, but not when
rendering.

This change is designed to cause the least amount of breakage in
existing code while achieving consistency with the way
LeadingMarginSpan2 is handled in layout and drawing.

For the most common use of LeadingMarginSpan2 -- getting a multi-line
first margin in the first paragraph of text in a layout -- this should
cause no change in behavior. For any other uses, the old (buggy)
implementation most likely did not exhibit correct behavior to begin
with, so developers were most likely not relying on that functionality.

Change-Id: I6f69df09c0130e703458e65bf3eaac4a905df56e
2014-08-14 11:58:37 -07:00
Alan Viverette
029942f77d Add API for obtaining max text length for accessibility
BUG: 16736956
Change-Id: I15ffb9bf68e074adf3e0dbcd230367e115c03e3c
2014-08-12 14:55:56 -07:00
Niels Egberts
2a236a6466 Simplify generics, and make Builder concrete.
Change-Id: I3e14966527c254d2c15dddefc2ef60cdde30421f
2014-08-01 11:46:16 +01:00
Narayan Kamath
31e6b1445f Switch TextUtils over to new ICU API.
.. and use Locale.getScript() instead of ICU.getScript.

bug: 15876704

(cherry picked from commit 08b3516984)

Change-Id: Ifac179e0577d66062f32c95372b631bf574dfdf9
2014-07-31 12:55:49 +01:00
Anish Athalye
c14b3ada5c Fix bug in measurement of paragraphs
This fixes b/16510772.

When measuring paragraphs, leading margins should be taken into account.
When computing line width, the margin should be added to the absolute
value of the extent (there were missing parenthesis). Both of these
caused views with leading margins to be rendered incorrectly.

Change-Id: I5029b2790a249192a858eb226d7b793d0622a70d
2014-07-25 17:55:46 +00:00
Neil Fuller
3b852e3489 Rewriting android.text.format.Time without the native _tz functions
(cherry picked from commit d7f0849b8c)
Bug: 15765976

Change-Id: I00f72bd1043ef20f22d25559206b2f741334ba9c
2014-07-24 11:37:20 +01:00
Niels Egberts
1d44e0ccec New TtsSpan builders for money, electronic and telephone.
Change-Id: Idb6a66725395dbd665e17c00678901d54b4b1753
2014-07-21 11:17:49 +01:00
Niels Egberts
5e413470e5 Merge "Add money as a new TtsSpan type." into lmp-dev 2014-07-17 19:55:10 +00:00
Niels Egberts
b1a092c772 Add money as a new TtsSpan type.
Added ARG_QUANTITY to decimal so money and measure can 'inherit' it.

Change-Id: I0f9f464d198a9875df4a01e8a5c95a3d19ed6f7f
2014-07-18 18:46:20 +01:00
Niels Egberts
6e7c8995dd New TtsSpan builders for types measure, time, date, digits and verbatim.
Change-Id: I60022aa72c64f454261a0b69c21c45ce6351b9e7
2014-07-18 16:36:11 +01:00
Niels Egberts
a896363400 Add builders for TtsSpans of type ordinal, decimal and fraction.
Also document the possibility to give phone numbers in parts.

Change-Id: Ie1cdf56cc3b6c221c9410fb02dcba2568ea337b7
2014-07-18 13:43:22 +01:00
Niels Egberts
36e08484ab TtsSpan builders for each TtsSpan type. DO NOT MERGE
The reason for separate classes for each type, instead of a more flat
structure is to enable easy discovery of the available arguments that
can be set. For L we'll have about 12 types with 30 arguments and
almost all of the arguments are type specific. In future releases
we'll introduce more arguments. With editors that have code completion
one can construct a span without having to consult the documentation.

For now it only contains Text and Cardinal types.

Change-Id: I94531e600133d9f4f59a4170cceef1ee7a360ca7
(cherry picked from commit 90b095aabd8a5c43723821dda37354fd2beb38fb)
2014-07-17 17:17:07 +00:00
Niels Egberts
ca7b0277d7 New convenience method that takes a CharSequence and an Object as the
span that is applied to the appended text.

Change-Id: Ibdc4a71346e5691bcfe6af23f34beff69d642908
2014-07-11 09:55:44 +00:00
Niels Egberts
2e3f2c6727 Add more semiotic class types for TtsSpan.
Change-Id: I4c5f141f56d6ec679be59634693f591e3386f152
2014-07-10 15:29:56 +00:00
Niels Egberts
4f4ead4812 Add TtsSpan class.
The TtsSpan can be used to provide addtional data for  TTS engines.

For now it only includes the types text and cardinals, but more will follow.

Change-Id: I31392dd413c0902ba4ce702fa3307253c90c618f
2014-07-07 20:25:44 +00:00
Anish Athalye
677490eac4 Merge "Fix line breaking for clusters in narrow views" 2014-07-01 19:15:58 +00:00
Anish Athalye
9cd3bccdb2 Fix line breaking for clusters in narrow views
Clusters were broken incorrectly when in narrow views (when the width of
the cluster was greater than the width of a view). Also, out() calls
were modifying fm, so clusters that were too wide were not positioned
correctly.

Change-Id: I521f8dc6338f5f1de6858af3f0c0bd320aa46bc0
2014-07-01 16:39:39 +00:00
Sujith Ramakrishnan
cc32bd83e4 Add support for mouse-based text selection.
Incorporate patch from Logitech (donated under AOSP license) to the
framework to add mouse-based text selection to ArrowKeyMovementMethod.

Bug: 14652753

Change-Id: Iab264bb954b72ccedfada763eba8f13ef37a4578
2014-07-01 15:57:45 -07:00
Anish Athalye
88b5b0be88 Implement line breaking using ICU break iterator
Change-Id: I4ad98757aa2eab5dbc2ae44c0391e900ef20c4d0
2014-06-30 22:14:05 +00:00
Raph Levien
051910b9f9 Clean up dirFlags / bidiFlags confusion
The dirFlags and bidiFlags enums are distinct, and have different
meanings. The former is a determined direction for a run of text, while
the latter is a request for the bidi algorithm. They have been used
interchangeably, and this has caused some problems, notably running the
bidi algorithm needlessly when the direction for a run is already
determined.

This patch cleans up the confusion, by always naming each occurrence
explicitly "boolean isRtl" or "int bidiFlags" (the previous code often
just used "int flags", which added to the confusion), and converts
between the meanings when a function takes an isRtl argument but passes
it to another function expecting bidiFlags.

Fixes b/15089607 Clean up bidi flag mess

Change-Id: I410b6604376e853dd12c255e7f5a9d2b9a310dd9
2014-06-16 14:36:08 -07:00
Narayan Kamath
97df96d8eb am 2ecc4dc8: am f36fe3f8: am 1083573c: Merge "Track changes to libcore ICU apis."
* commit '2ecc4dc88fc209f75f5dfe815d6a1fbb5fd49ef2':
  Track changes to libcore ICU apis.
2014-06-16 11:10:00 +00:00
Narayan Kamath
2ecc4dc88f am f36fe3f8: am 1083573c: Merge "Track changes to libcore ICU apis."
* commit 'f36fe3f85daaf9e3b3270143d6648394768bb324':
  Track changes to libcore ICU apis.
2014-06-16 11:01:29 +00:00
Narayan Kamath
2c9d2005ec Track changes to libcore ICU apis.
All private APIs that earlier accepted Locale.toString
now accept Locale instances.

Change-Id: I80df88d0c928e921320b6545b1267adecefe64af
2014-06-12 13:42:05 +01:00
Jean Chalard
11abbdcb78 am 7d8b87f0: Merge "Fix a CTS test" into lmp-preview-dev
* commit '7d8b87f0d9b35694099d5f57777d27f577496960':
  Fix a CTS test
2014-06-12 19:58:08 +00:00
Jean Chalard
0a993100f9 Fix a CTS test
SpannableStringBuilder should throw an exception when the
parameters to #insert and related methods are in the wrong
order.
We'll have to reopen b/9570771 and deal with it separately.

Bug: 14965397
Change-Id: I01847e0010d23f98ad3def8ba030d36570528900
2014-06-11 18:03:05 +09:00
Justin Koh
41a2c47e65 am 44195b4f: am 42c53fd6: Merge "Catch OperationUnsupportedException when linkifying using WebView" into klp-modular-dev
* commit '44195b4f90d035533c879672891e7e169972d95d':
  Catch OperationUnsupportedException when linkifying using WebView
2014-06-11 19:33:46 +00:00
Justin Koh
44195b4f90 am 42c53fd6: Merge "Catch OperationUnsupportedException when linkifying using WebView" into klp-modular-dev
* commit '42c53fd64641d3c2974b3b8f25a2c600f4c4dd7d':
  Catch OperationUnsupportedException when linkifying using WebView
2014-06-10 18:35:20 +00:00
Aaron Whyte
83955cb260 Catch OperationUnsupportedException when linkifying using WebView
This fixes a CTS test for Wearable. We cannot check for FEATURE_WEBVIEW, because
there's no way to get a PackageManager from within these static methods.
Bug: 15131296

Change-Id: I7bf7564b6209f330a413ed54a94be1e07fedb30d
2014-06-09 17:59:03 -07:00
Raph Levien
df8427c324 Merge "Fix android.text.cts.TextUtilsTest#testRegionMatches" 2014-06-06 20:15:27 +00:00
Jeff Brown
b86b1027a3 am 9777fdb7: am b0a7f84b: am 63bf04d8: Merge "Fix NullException in QwertyKeyListener.KeyDown"
* commit '9777fdb7af696ca15906d03ad8aa7a3d8d51e4b3':
  Fix NullException in QwertyKeyListener.KeyDown
2014-05-20 20:47:29 +00:00
Jeff Brown
9777fdb7af am b0a7f84b: am 63bf04d8: Merge "Fix NullException in QwertyKeyListener.KeyDown"
* commit 'b0a7f84b6de20edc6337163a4a07e3c524991ddb':
  Fix NullException in QwertyKeyListener.KeyDown
2014-05-20 20:44:21 +00:00
Jeff Brown
b0a7f84b6d am 63bf04d8: Merge "Fix NullException in QwertyKeyListener.KeyDown"
* commit '63bf04d88bcc00876c30c9f2848da8c44b42185b':
  Fix NullException in QwertyKeyListener.KeyDown
2014-05-20 20:40:20 +00:00
Jeff Brown
63bf04d88b Merge "Fix NullException in QwertyKeyListener.KeyDown" 2014-05-20 20:37:44 +00:00
Raph Levien
8d2aa19977 Fix android.text.cts.TextUtilsTest#testRegionMatches
The CTS test expects an ArrayIndexOutOfBounds exception when passing in
an unreasonably large value for len. Since the actual implementation was
causing an integer overflow, we were getting a different exception.
Since integer overflow is potentially dangerous, this patch tests for it
and throws an exception explicitly.

Change-Id: I0420c06185d33d130853861d25d4f65b06fe0dfa
2014-05-14 15:46:47 -07:00
Dianne Hackborn
1de6b101e5 Merge "Implement better computing of battery drain time, actual charge time." 2014-04-29 18:30:08 +00:00
Dianne Hackborn
260c5020ae Implement better computing of battery drain time, actual charge time.
Also move time formatter in to framework for use elsewhere.

Change-Id: I42b6a44414b68754af65c522bef5591da5643909
2014-04-29 11:23:16 -07:00
Yuling Liang
54dacbe7ca am 3914a33c: am 26a5c2dd: Merge "Followon fix for 14276128 Clipping at bottom of TextView" into klp-modular-dev
* commit '3914a33c01102f5de51e33d006c0aeedf2693af0':
  Followon fix for 14276128 Clipping at bottom of TextView
2014-04-28 23:22:54 +00:00
Raph Levien
d97b097a5b Followon fix for 14276128 Clipping at bottom of TextView
The previous fix did not work when the text was ellipsized, because the
test for whether the line was the last line was incorrect. The new test
handles both the end of the buffer and the case where it is the last
line because of ellipsizing.

So this should be the proper fix for bug 14276128 Clipping at bottom of
TextView when lineSpacingMultiplier < 1

This version of the patch also handles the single-line case (which is
computed in BoringLayout rather than StaticLayout).

Change-Id: I88791acc2aa493cc8c599b374f4d213571260b4b
2014-04-28 18:02:27 +00:00
Yuling Liang
2be1f8c3f4 am 69a9d925: am eea94f06: Merge "Revert "Followon fix for 14276128 Clipping at bottom of TextView"" into klp-modular-dev
* commit '69a9d92502428a4cf6eb6b5bf6577d9e525796a2':
  Revert "Followon fix for 14276128 Clipping at bottom of TextView"
2014-04-25 17:38:00 +00:00
Yuling Liang
10973c7776 Revert "Followon fix for 14276128 Clipping at bottom of TextView"
This reverts commit a10e19845c.

Change-Id: I6d40451c9eb6285859e16d251b55947663a3553a
2014-04-25 17:32:08 +00:00
Yuling Liang
ec2b7d6dd7 am 60f8349b: am 243e551a: Merge "Followon fix for 14276128 Clipping at bottom of TextView" into klp-modular-dev
* commit '60f8349b9819130e81e28106a35bf3362d337045':
  Followon fix for 14276128 Clipping at bottom of TextView
2014-04-25 16:41:07 +00:00
Raph Levien
a10e19845c Followon fix for 14276128 Clipping at bottom of TextView
The previous fix did not work when the text was ellipsized, because the
test for whether the line was the last line was incorrect. The new test
handles both the end of the buffer and the case where it is the last
line because of ellipsizing.

So this should be the proper fix for bug 14276128 Clipping at bottom of
TextView when lineSpacingMultiplier < 1

Change-Id: Iac5c96f2273142031c18a27f504f7d6d5fcf823e
2014-04-24 20:00:05 +00:00