-
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 |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ | |
| import android.view.textservice.TextInfo; | ||
| import android.view.textservice.TextServicesManager; | ||
| import androidx.annotation.NonNull; | ||
| import androidx.annotation.VisibleForTesting; | ||
| import io.flutter.embedding.engine.systemchannels.SpellCheckChannel; | ||
| import java.util.ArrayList; | ||
| import java.util.Locale; | ||
|
|
@@ -23,19 +24,20 @@ public class SpellCheckPlugin implements SpellCheckerSession.SpellCheckerSession | |
| @NonNull private final SpellCheckChannel mSpellCheckChannel; | ||
| @NonNull private final TextServicesManager tsm; | ||
| private SpellCheckerSession mSpellCheckerSession; | ||
| @VisibleForTesting @NonNull final SpellCheckChannel.SpellCheckMethodHandler mSpellCheckMethodHandler; | ||
|
|
||
| public SpellCheckPlugin(@NonNull Context context, @NonNull SpellCheckChannel spellCheckChannel) { | ||
| mContext = context; | ||
| mSpellCheckChannel = spellCheckChannel; | ||
| tsm = (TextServicesManager) mContext.getSystemService(Context.TEXT_SERVICES_MANAGER_SERVICE); | ||
|
|
||
| mSpellCheckChannel.setSpellCheckMethodHandler( | ||
| new SpellCheckChannel.SpellCheckMethodHandler() { | ||
| @Override | ||
| public void initiateSpellCheck(String locale, String text) { | ||
| performSpellCheck(locale, text); | ||
| } | ||
| }); | ||
| mSpellCheckMethodHandler = new SpellCheckChannel.SpellCheckMethodHandler() { | ||
| @Override | ||
| public void initiateSpellCheck(String locale, String text) { | ||
| performSpellCheck(locale, text); | ||
| }}; | ||
|
|
||
| mSpellCheckChannel.setSpellCheckMethodHandler(mSpellCheckMethodHandler); | ||
| } | ||
|
|
||
| public void destroy() { | ||
camsim99 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
@@ -64,8 +66,6 @@ public void performSpellCheck(String locale, String text) { | |
| } | ||
| mSpellCheckerSession = tsm.newSpellCheckerSession(null, parsedLocale, this, true); | ||
|
||
|
|
||
|
|
||
| SpellCheckerInfo infoChecker = mSpellCheckerSession.getSpellChecker(); | ||
| TextInfo[] textInfos = new TextInfo[] {new TextInfo(text)}; | ||
| mSpellCheckerSession.getSentenceSuggestions(textInfos, 3); | ||
|
||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit maybe
mTextManager?