History log of /packages/apps/ContactsCommon/src/com/android/contacts/common/util/SearchUtil.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
4aa2f3e0fec6e8d58a1c32a232925770faeaa550 09-Jan-2013 Jay Shrauner <shrauner@google.com> Fix string overrun exception

Fix SearchUtil::contains() so doesn't overrun string buffer when trying
to match query that partially matches end of the buffer.

Bug:7971792
Change-Id: Ifff09049b0a82af17413a7e56b9e5de938ff009d
/packages/apps/ContactsCommon/src/com/android/contacts/common/util/SearchUtil.java
cae605bed4d43e1925fc8c1803def0ef1d0924a5 28-Dec-2012 Chiao Cheng <chiaocheng@google.com> Find proper snippet in multi-line and large result.

Previous CL removed the use ContactsContract.snippetize(). This method
found the proper line in a multi-line results and then snippetized the
line if it was too long.

This CL adds that functionality back without using snippetize(). This
new code is faster because it only does text intensive processing when
the text is long. The previous snippetize method did processing for all
strings. In addition, the old method iterated over the snippet multiple
times (i.e. first with contains, then subsequently tokenizes, etc). This
change re-uses the initial search results and remembers the search
information so multiple iterations are not necessary. In addition,
tokenizing has been optimized based on the match. We only need to
chop off excess content rather than tokenizing the whole string.

This CL also makes snippet more friend to landscape mode. Previously,
the number of snippet tokens shown was hard-coded to 2 on each side.
Furthermore, this caused longer tokens to exceed screen real estate. Now
the number of tokens shown are determined more accurately by character
count versus real estate. In landscape mode, this allows us to show
much more of the search result.

Finally, fixed a highlight problem when the search query contained
punctuation. For example, a search for {.ben.} would not match {ben}.
This Cl resolves that issue by cleaning the search query.

Bug: 5929143
Change-Id: I5c368e6de8b34ca912f86926f862a02f95199fa7
/packages/apps/ContactsCommon/src/com/android/contacts/common/util/SearchUtil.java