-
Notifications
You must be signed in to change notification settings - Fork 6k
Add Spell Check Support for Android Engine #30858
Changes from 1 commit
dc93719
cd234ad
f463846
3dfae0a
546692b
5f43ff5
ee73219
624f68b
846b195
b27704c
64f0ac7
0cc3776
33f2f40
eb3c731
1877242
5372aaa
d9adbdc
34809db
10d154d
00c228e
e08171f
5ccc144
87ab60f
f4083d7
ce45427
6972b0b
3eba4de
963d9ae
6ea2ede
32c7702
e9ebd5b
8298436
993b6c8
4179f42
f999488
ade72bc
c20b62c
49583d4
49939aa
0cf00f3
48a4354
510f83a
d8e333b
61908d3
29b095f
ee28058
4f0a074
6c4d437
d73b915
66c24ed
04a2ce1
15d17f5
e6414b2
2882e3b
dfe4689
cdc6b9c
65b8850
036b15b
188c2ad
8198d4e
a2b6c90
2aac372
894f4e9
2a4ea66
c2a6550
6125e74
74d1477
cc8bf5e
5a175ec
1c02784
3e74d61
975673c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,30 +38,36 @@ public void initiateSpellCheck(String locale, String text) { | |
| }); | ||
| } | ||
|
|
||
| /** Calls on the Android spell check API to spell check specified text. */ | ||
|
|
||
| public void destroy() { | ||
| mSpellCheckChannel.setSpellCheckMethodHandler(null); | ||
|
|
||
| if (mSpellCheckerSession != null) { | ||
| mSpellCheckerSession.close(); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Calls on the Android spell check API to spell check specified text. | ||
| */ | ||
| public void performSpellCheck(String locale, String text) { | ||
camsim99 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| String[] localeCodes = locale.split("-"); | ||
| Locale localeToUse; | ||
| Locale parsedLocale; | ||
|
|
||
| if (localeCodes.length == 3) { | ||
|
||
| localeToUse = new Locale(localeCodes[0], localeCodes[1], localeCodes[2]); | ||
| parsedLocale = new Locale(localeCodes[0], localeCodes[1], localeCodes[2]); | ||
| } else if (localeCodes.length == 2) { | ||
| localeToUse = new Locale(localeCodes[0], localeCodes[1]); | ||
| parsedLocale = new Locale(localeCodes[0], localeCodes[1]); | ||
| } else { | ||
| localeToUse = new Locale(localeCodes[0]); | ||
| parsedLocale = new Locale(localeCodes[0]); | ||
| } | ||
|
|
||
| // TODO(camillesimon): Figure out proper session management. | ||
| if (mSpellCheckerSession != null) { | ||
| mSpellCheckerSession.close(); | ||
| mSpellCheckerSession = tsm.newSpellCheckerSession(null, Locale.ENGLISH, this, true); | ||
| } else { | ||
| mSpellCheckerSession = tsm.newSpellCheckerSession(null, Locale.ENGLISH, this, true); | ||
| if (mSpellCheckerSession == null) { | ||
| mSpellCheckerSession = tsm.newSpellCheckerSession(null, parsedLocale, this, true); | ||
| } | ||
| SpellCheckerInfo infoChecker = mSpellCheckerSession.getSpellChecker(); | ||
|
|
||
| SpellCheckerInfo infoChecker = mSpellCheckerSession.getSpellChecker(); | ||
| TextInfo[] textInfos = new TextInfo[] {new TextInfo(text)}; | ||
|
|
||
| mSpellCheckerSession.getSentenceSuggestions(textInfos, 3); | ||
|
||
| } | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.