InputConnectionWrapper.java revision b2a3dd88a53cc8c6d19f6dc8ec4f3d6c4abd9b54
1/*
2 * Copyright (C) 2007-2008 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License. You may obtain a copy of
6 * 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, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
14 * the License.
15 */
16
17package android.view.inputmethod;
18
19import android.os.Bundle;
20import android.view.KeyEvent;
21
22/**
23 * <p>Wrapper class for proxying calls to another InputConnection.  Subclass
24 * and have fun!
25 */
26public class InputConnectionWrapper implements InputConnection {
27    private final InputConnection mTarget;
28
29    public InputConnectionWrapper(InputConnection target) {
30        mTarget = target;
31    }
32
33    public CharSequence getTextBeforeCursor(int n, int flags) {
34        return mTarget.getTextBeforeCursor(n, flags);
35    }
36
37    public CharSequence getTextAfterCursor(int n, int flags) {
38        return mTarget.getTextAfterCursor(n, flags);
39    }
40
41    public int getCursorCapsMode(int reqModes) {
42        return mTarget.getCursorCapsMode(reqModes);
43    }
44
45    public ExtractedText getExtractedText(ExtractedTextRequest request,
46            int flags) {
47        return mTarget.getExtractedText(request, flags);
48    }
49
50    public boolean deleteSurroundingText(int leftLength, int rightLength) {
51        return mTarget.deleteSurroundingText(leftLength, rightLength);
52    }
53
54    public boolean setComposingText(CharSequence text, int newCursorPosition) {
55        return mTarget.setComposingText(text, newCursorPosition);
56    }
57
58    public boolean finishComposingText() {
59        return mTarget.finishComposingText();
60    }
61
62    public boolean commitText(CharSequence text, int newCursorPosition) {
63        return mTarget.commitText(text, newCursorPosition);
64    }
65
66    public boolean commitCompletion(CompletionInfo text) {
67        return mTarget.commitCompletion(text);
68    }
69
70    public boolean setSelection(int start, int end) {
71        return mTarget.setSelection(start, end);
72    }
73
74    public boolean performEditorAction(int editorAction) {
75        return mTarget.performEditorAction(editorAction);
76    }
77
78    public boolean performContextMenuAction(int id) {
79        return mTarget.performContextMenuAction(id);
80    }
81
82    public boolean beginBatchEdit() {
83        return mTarget.beginBatchEdit();
84    }
85
86    public boolean endBatchEdit() {
87        return mTarget.endBatchEdit();
88    }
89
90    public boolean sendKeyEvent(KeyEvent event) {
91        return mTarget.sendKeyEvent(event);
92    }
93
94    public boolean clearMetaKeyStates(int states) {
95        return mTarget.clearMetaKeyStates(states);
96    }
97
98    public boolean reportFullscreenMode(boolean enabled) {
99        return mTarget.reportFullscreenMode(enabled);
100    }
101
102    public boolean performPrivateCommand(String action, Bundle data) {
103        return mTarget.performPrivateCommand(action, data);
104    }
105}
106