| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
package android.view.inputmethod; |
| 18 |
|
| 19 |
import android.os.Parcel; |
| 20 |
import android.os.Parcelable; |
| 21 |
import android.text.TextUtils; |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
public final class CorrectionInfo implements Parcelable { |
| 28 |
private final int mOffset; |
| 29 |
private final CharSequence mOldText; |
| 30 |
private final CharSequence mNewText; |
| 31 |
|
| 32 |
|
| 33 |
|
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
public CorrectionInfo(int offset, CharSequence oldText, CharSequence newText) { |
| 38 |
mOffset = offset; |
| 39 |
mOldText = oldText; |
| 40 |
mNewText = newText; |
| 41 |
} |
| 42 |
|
| 43 |
private CorrectionInfo(Parcel source) { |
| 44 |
mOffset = source.readInt(); |
| 45 |
mOldText = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source); |
| 46 |
mNewText = TextUtils.CHAR_SEQUENCE_CREATOR.createFromParcel(source); |
| 47 |
} |
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
|
| 53 |
public int getOffset() { |
| 54 |
return mOffset; |
| 55 |
} |
| 56 |
|
| 57 |
|
| 58 |
|
| 59 |
|
| 60 |
public CharSequence getOldText() { |
| 61 |
return mOldText; |
| 62 |
} |
| 63 |
|
| 64 |
|
| 65 |
|
| 66 |
|
| 67 |
public CharSequence getNewText() { |
| 68 |
return mNewText; |
| 69 |
} |
| 70 |
|
| 71 |
@Override |
| 72 |
public String toString() { |
| 73 |
return "CorrectionInfo{#" + mOffset + " \"" + mOldText + "\" -> \"" + mNewText + "\"}"; |
| 74 |
} |
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
|
| 81 |
|
| 82 |
public void writeToParcel(Parcel dest, int flags) { |
| 83 |
dest.writeInt(mOffset); |
| 84 |
TextUtils.writeToParcel(mOldText, dest, flags); |
| 85 |
TextUtils.writeToParcel(mNewText, dest, flags); |
| 86 |
} |
| 87 |
|
| 88 |
|
| 89 |
|
| 90 |
|
| 91 |
public static final @android.annotation.NonNull Parcelable.Creator<CorrectionInfo> CREATOR = |
| 92 |
new Parcelable.Creator<CorrectionInfo>() { |
| 93 |
public CorrectionInfo createFromParcel(Parcel source) { |
| 94 |
return new CorrectionInfo(source); |
| 95 |
} |
| 96 |
public CorrectionInfo[] newArray(int size) { |
| 97 |
return new CorrectionInfo[size]; |
| 98 |
} |
| 99 |
}; |
| 100 |
|
| 101 |
public int describeContents() { |
| 102 |
return 0; |
| 103 |
} |
| 104 |
} |