aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/latin/Suggest.java
diff options
context:
space:
mode:
authorJean Chalard <jchalard@google.com>2011-08-22 23:05:51 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-08-22 23:05:51 -0700
commitd6834c8125031b3ba0c1f6671debb15a4232ff77 (patch)
treef1eac790bbb8b075e0136ddf979e6196d8305dda /java/src/com/android/inputmethod/latin/Suggest.java
parent6dde878d515f7bf5268d16a8fe4921d8821c5ae7 (diff)
parenta6e912cf9849f5c979303042ce83820a8dc560d0 (diff)
downloadlatinime-d6834c8125031b3ba0c1f6671debb15a4232ff77.tar.gz
latinime-d6834c8125031b3ba0c1f6671debb15a4232ff77.tar.xz
latinime-d6834c8125031b3ba0c1f6671debb15a4232ff77.zip
Merge "Fix a bug with the string pool."
Diffstat (limited to 'java/src/com/android/inputmethod/latin/Suggest.java')
-rw-r--r--java/src/com/android/inputmethod/latin/Suggest.java9
1 files changed, 8 insertions, 1 deletions
diff --git a/java/src/com/android/inputmethod/latin/Suggest.java b/java/src/com/android/inputmethod/latin/Suggest.java
index e3cb6987a..29b629576 100644
--- a/java/src/com/android/inputmethod/latin/Suggest.java
+++ b/java/src/com/android/inputmethod/latin/Suggest.java
@@ -284,7 +284,14 @@ public class Suggest implements Dictionary.WordCallback {
}
protected void addBigramToSuggestions(CharSequence bigram) {
- mSuggestions.add(bigram);
+ // TODO: Try to be a little more shrewd with resource allocation.
+ // At the moment we copy this object because the StringBuilders are pooled (see
+ // StringBuilderPool.java) and when we are finished using mSuggestions and
+ // mBigramSuggestions we will take everything from both and insert them back in the
+ // pool, so we can't allow the same object to be in both lists at the same time.
+ final StringBuilder sb = StringBuilderPool.getStringBuilder(getApproxMaxWordLength());
+ sb.append(bigram);
+ mSuggestions.add(sb);
}
// TODO: cleanup dictionaries looking up and suggestions building with SuggestedWords.Builder