• 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.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 public class SpellCheckSpan implements ParcelableSpan {
32 
33     private boolean mSpellCheckInProgress;
34 
35     @UnsupportedAppUsage
SpellCheckSpan()36     public SpellCheckSpan() {
37         mSpellCheckInProgress = false;
38     }
39 
40     @UnsupportedAppUsage
SpellCheckSpan(Parcel src)41     public SpellCheckSpan(Parcel src) {
42         mSpellCheckInProgress = (src.readInt() != 0);
43     }
44 
45     @UnsupportedAppUsage
setSpellCheckInProgress(boolean inProgress)46     public void setSpellCheckInProgress(boolean inProgress) {
47         mSpellCheckInProgress = inProgress;
48     }
49 
50     @UnsupportedAppUsage
isSpellCheckInProgress()51     public boolean isSpellCheckInProgress() {
52         return mSpellCheckInProgress;
53     }
54 
55     @Override
describeContents()56     public int describeContents() {
57         return 0;
58     }
59 
60     @Override
writeToParcel(Parcel dest, int flags)61     public void writeToParcel(Parcel dest, int flags) {
62         writeToParcelInternal(dest, flags);
63     }
64 
65     /** @hide */
writeToParcelInternal(Parcel dest, int flags)66     public void writeToParcelInternal(Parcel dest, int flags) {
67         dest.writeInt(mSpellCheckInProgress ? 1 : 0);
68     }
69 
70     @Override
getSpanTypeId()71     public int getSpanTypeId() {
72         return getSpanTypeIdInternal();
73     }
74 
75     /** @hide */
getSpanTypeIdInternal()76     public int getSpanTypeIdInternal() {
77         return TextUtils.SPELL_CHECK_SPAN;
78     }
79 }
80