InputConnectionWrapper.java revision f1e484acb594a726fb57ad0ae4cfe902c7f35858
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 * Wrapper around InputConnection interface, calling through to another 24 * implementation of it. 25 */ 26public class InputConnectionWrapper implements InputConnection { 27 InputConnection mBase; 28 29 /** 30 * Create a new wrapper around an existing InputConnection implementation. 31 */ 32 public InputConnectionWrapper(InputConnection base) { 33 mBase = base; 34 } 35 36 /** 37 * Return the base InputConnection that this class is wrapping. 38 */ 39 InputConnection getBase() { 40 return mBase; 41 } 42 43 public CharSequence getTextBeforeCursor(int n) { 44 return mBase.getTextBeforeCursor(n); 45 } 46 47 public CharSequence getTextAfterCursor(int n) { 48 return mBase.getTextAfterCursor(n); 49 } 50 51 public int getCursorCapsMode(int reqModes) { 52 return mBase.getCursorCapsMode(reqModes); 53 } 54 55 public ExtractedText getExtractedText(ExtractedTextRequest request, 56 int flags) { 57 return mBase.getExtractedText(request, flags); 58 } 59 60 public boolean deleteSurroundingText(int leftLength, int rightLength) { 61 return mBase.deleteSurroundingText(leftLength, rightLength); 62 } 63 64 public boolean setComposingText(CharSequence text, int newCursorPosition) { 65 return mBase.setComposingText(text, newCursorPosition); 66 } 67 68 public boolean finishComposingText() { 69 return mBase.finishComposingText(); 70 } 71 72 public boolean commitText(CharSequence text, int newCursorPosition) { 73 return mBase.commitText(text, newCursorPosition); 74 } 75 76 public boolean commitCompletion(CompletionInfo text) { 77 return mBase.commitCompletion(text); 78 } 79 80 public boolean beginBatchEdit() { 81 return mBase.beginBatchEdit(); 82 } 83 84 public boolean endBatchEdit() { 85 return mBase.endBatchEdit(); 86 } 87 88 public boolean sendKeyEvent(KeyEvent event) { 89 return mBase.sendKeyEvent(event); 90 } 91 92 public boolean clearMetaKeyStates(int states) { 93 return mBase.clearMetaKeyStates(states); 94 } 95 96 public boolean performPrivateCommand(String action, Bundle data) { 97 return mBase.performPrivateCommand(action, data); 98 } 99 100 public boolean showStatusIcon(String packageName, int resId) { 101 return mBase.showStatusIcon(packageName, resId); 102 } 103 104 public boolean hideStatusIcon() { 105 return mBase.hideStatusIcon(); 106 } 107} 108