blob: bf0bef3124763cebbd02ccb6a16084da54d0b4a6 [file] [log] [blame]
Kenny Root15a4d2f2010-03-11 18:20:12 -08001/*
2 * Copyright (C) 2008 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
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080017package android.view.inputmethod;
18
19import android.os.Parcel;
20import android.os.Parcelable;
The Android Open Source Project9066cfe2009-03-03 19:31:44 -080021
22/**
23 * Description of what an input method would like from an application when
24 * extract text from its input editor.
25 */
26public class ExtractedTextRequest implements Parcelable {
27 /**
28 * Arbitrary integer that can be supplied in the request, which will be
29 * delivered back when reporting updates.
30 */
31 public int token;
32
33 /**
34 * Additional request flags, having the same possible values as the
35 * flags parameter of {@link InputConnection#getTextBeforeCursor
36 * InputConnection.getTextBeforeCursor()}.
37 */
38 public int flags;
39
40 /**
41 * Hint for the maximum number of lines to return.
42 */
43 public int hintMaxLines;
44
45 /**
46 * Hint for the maximum number of characters to return.
47 */
48 public int hintMaxChars;
49
50 /**
51 * Used to package this object into a {@link Parcel}.
52 *
53 * @param dest The {@link Parcel} to be written.
54 * @param flags The flags used for parceling.
55 */
56 public void writeToParcel(Parcel dest, int flags) {
57 dest.writeInt(token);
58 dest.writeInt(this.flags);
59 dest.writeInt(hintMaxLines);
60 dest.writeInt(hintMaxChars);
61 }
62
63 /**
64 * Used to make this class parcelable.
65 */
66 public static final Parcelable.Creator<ExtractedTextRequest> CREATOR
67 = new Parcelable.Creator<ExtractedTextRequest>() {
68 public ExtractedTextRequest createFromParcel(Parcel source) {
69 ExtractedTextRequest res = new ExtractedTextRequest();
70 res.token = source.readInt();
71 res.flags = source.readInt();
72 res.hintMaxLines = source.readInt();
73 res.hintMaxChars = source.readInt();
74 return res;
75 }
76
77 public ExtractedTextRequest[] newArray(int size) {
78 return new ExtractedTextRequest[size];
79 }
80 };
81
82 public int describeContents() {
83 return 0;
84 }
85}