Skip to content

Commit f671061

Browse files
committed
Supplement for I772164d9c67e95876c228efcce2
This should be merged with I1519258dd3ce95ad01 Change-Id: I48c5f86ff43f51913eb69d697bb1d75714b67aa3
1 parent ac14351 commit f671061

File tree

5 files changed

+23
-5
lines changed

5 files changed

+23
-5
lines changed

api/current.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,7 @@ package android {
934934
field public static final int summaryOff = 16843248; // 0x10101f0
935935
field public static final int summaryOn = 16843247; // 0x10101ef
936936
field public static final int supportsRtl = 16843688; // 0x10103a8
937+
field public static final int supportsSentenceSpellCheck = 16843698; // 0x10103b2
937938
field public static final int supportsUploading = 16843419; // 0x101029b
938939
field public static final int switchMinWidth = 16843632; // 0x1010370
939940
field public static final int switchPadding = 16843633; // 0x1010371
@@ -25280,11 +25281,13 @@ package android.view.textservice {
2528025281
method public android.view.textservice.SpellCheckerInfo getSpellChecker();
2528125282
method public void getSuggestions(android.view.textservice.TextInfo, int);
2528225283
method public void getSuggestions(android.view.textservice.TextInfo[], int, boolean);
25284+
method public boolean isSentenceSpellCheckSupported();
2528325285
method public boolean isSessionDisconnected();
2528425286
field public static final java.lang.String SERVICE_META_DATA = "android.view.textservice.scs";
2528525287
}
2528625288

2528725289
public static abstract interface SpellCheckerSession.SpellCheckerSessionListener {
25290+
method public abstract void onGetSentenceSuggestions(android.view.textservice.SentenceSuggestionsInfo[]);
2528825291
method public abstract void onGetSuggestions(android.view.textservice.SuggestionsInfo[]);
2528925292
}
2529025293

core/java/android/view/textservice/SpellCheckerInfo.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public final class SpellCheckerInfo implements Parcelable {
4545
private final ResolveInfo mService;
4646
private final String mId;
4747
private final int mLabel;
48+
private final boolean mSupportsSentenceSpellCheck;
4849

4950
/**
5051
* The spell checker setting activity's name, used by the system settings to
@@ -97,6 +98,9 @@ public SpellCheckerInfo(Context context, ResolveInfo service)
9798
label = sa.getResourceId(com.android.internal.R.styleable.SpellChecker_label, 0);
9899
settingsActivityComponent = sa.getString(
99100
com.android.internal.R.styleable.SpellChecker_settingsActivity);
101+
mSupportsSentenceSpellCheck = sa.getBoolean(
102+
com.android.internal.R.styleable.SpellChecker_supportsSentenceSpellCheck,
103+
false);
100104
sa.recycle();
101105

102106
final int depth = parser.getDepth();
@@ -138,6 +142,7 @@ public SpellCheckerInfo(Context context, ResolveInfo service)
138142
*/
139143
public SpellCheckerInfo(Parcel source) {
140144
mLabel = source.readInt();
145+
mSupportsSentenceSpellCheck = source.readInt() != 0;
141146
mId = source.readString();
142147
mSettingsActivityName = source.readString();
143148
mService = ResolveInfo.CREATOR.createFromParcel(source);
@@ -152,6 +157,12 @@ public String getId() {
152157
return mId;
153158
}
154159

160+
/**
161+
* @hide
162+
*/
163+
public boolean isSentenceSpellCheckSupported() {
164+
return mSupportsSentenceSpellCheck;
165+
}
155166

156167
/**
157168
* Return the component of the service that implements.
@@ -177,6 +188,7 @@ public String getPackageName() {
177188
@Override
178189
public void writeToParcel(Parcel dest, int flags) {
179190
dest.writeInt(mLabel);
191+
dest.writeInt(mSupportsSentenceSpellCheck ? 1 : 0);
180192
dest.writeString(mId);
181193
dest.writeString(mSettingsActivityName);
182194
mService.writeToParcel(dest, flags);

core/java/android/view/textservice/SpellCheckerSession.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -436,15 +436,15 @@ public void onGetSentenceSuggestions(SentenceSuggestionsInfo[] results) {
436436
*/
437437
public interface SpellCheckerSessionListener {
438438
/**
439-
* Callback for {@link SpellCheckerSession#getSuggestions(TextInfo[], int, boolean)}
439+
* Callback for {@link SpellCheckerSession#getSuggestions(TextInfo, int)}
440+
* and {@link SpellCheckerSession#getSuggestions(TextInfo[], int, boolean)}
440441
* @param results an array of {@link SuggestionsInfo}s.
441442
* These results are suggestions for {@link TextInfo}s queried by
442-
* {@link SpellCheckerSession#getSuggestions(TextInfo[], int, boolean)}.
443+
* {@link SpellCheckerSession#getSuggestions(TextInfo, int)} or
444+
* {@link SpellCheckerSession#getSuggestions(TextInfo[], int, boolean)}
443445
*/
444446
public void onGetSuggestions(SuggestionsInfo[] results);
445-
// TODO: Remove @hide as soon as the sample spell checker client gets fixed.
446447
/**
447-
* @hide
448448
* Callback for {@link SpellCheckerSession#getSentenceSuggestions(TextInfo[], int)}
449449
* @param results an array of {@link SentenceSuggestionsInfo}s.
450450
* These results are suggestions for {@link TextInfo}s
@@ -494,7 +494,7 @@ public ISpellCheckerSessionListener getSpellCheckerSessionListener() {
494494
}
495495

496496
/**
497-
* @hide
497+
* @return true if the spell checker supports sentence level spell checking APIs
498498
*/
499499
public boolean isSentenceSpellCheckSupported() {
500500
return mSubtype.containsExtraValueKey(SUPPORT_SENTENCE_SPELL_CHECK);

core/res/res/values/attrs.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2349,6 +2349,8 @@
23492349
<!-- Component name of an activity that allows the user to modify
23502350
the settings for this service. -->
23512351
<attr name="settingsActivity"/>
2352+
<!-- Set true when the spell checker supports sentence level spell checking. -->
2353+
<attr name="supportsSentenceSpellCheck" format="boolean" />
23522354
</declare-styleable>
23532355

23542356
<!-- This is the subtype of the spell checker. Subtype can describe locales (e.g. en_US, fr_FR...) -->

core/res/res/values/public.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3578,4 +3578,5 @@
35783578

35793579
<public type="attr" name="parentActivityName" />
35803580

3581+
<public type="attr" name="supportsSentenceSpellCheck" />
35813582
</resources>

0 commit comments

Comments
 (0)