• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2011 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package android.text.style;
18 
19 import android.compat.annotation.UnsupportedAppUsage;
20 import android.os.Parcel;
21 import android.text.ParcelableSpan;
22 import android.text.TextUtils;
23 
24 /**
25  * A SpellCheckSpan is an internal data structure created by the TextView's SpellChecker to
26  * annotate portions of the text that are about to or currently being spell checked. They are
27  * automatically removed once the spell check is completed.
28  *
29  * @hide
30  */
31 @android.ravenwood.annotation.RavenwoodKeepWholeClass
32 public class SpellCheckSpan implements ParcelableSpan {
33 
34     private boolean mSpellCheckInProgress;
35 
36     @UnsupportedAppUsage
SpellCheckSpan()37     public SpellCheckSpan() {
38         mSpellCheckInProgress = false;
39     }
40 
41     @UnsupportedAppUsage
SpellCheckSpan(Parcel src)42     public SpellCheckSpan(Parcel src) {
43         mSpellCheckInProgress = (src.readInt() != 0);
44     }
45 
46     @UnsupportedAppUsage
setSpellCheckInProgress(boolean inProgress)47     public void setSpellCheckInProgress(boolean inProgress) {
48         mSpellCheckInProgress = inProgress;
49     }
50 
51     @UnsupportedAppUsage
isSpellCheckInProgress()52     public boolean isSpellCheckInProgress() {
53         return mSpellCheckInProgress;
54     }
55 
56     @Override
describeContents()57     public int describeContents() {
58         return 0;
59     }
60 
61     @Override
writeToParcel(Parcel dest, int flags)62     public void writeToParcel(Parcel dest, int flags) {
63         writeToParcelInternal(dest, flags);
64     }
65 
66     /** @hide */
writeToParcelInternal(Parcel dest, int flags)67     public void writeToParcelInternal(Parcel dest, int flags) {
68         dest.writeInt(mSpellCheckInProgress ? 1 : 0);
69     }
70 
71     @Override
getSpanTypeId()72     public int getSpanTypeId() {
73         return getSpanTypeIdInternal();
74     }
75 
76     /** @hide */
getSpanTypeIdInternal()77     public int getSpanTypeIdInternal() {
78         return TextUtils.SPELL_CHECK_SPAN;
79     }
80 }
81