OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.content.browser.input; | 5 package org.chromium.content.browser.input; |
6 | 6 |
| 7 import android.annotation.TargetApi; |
7 import android.content.Context; | 8 import android.content.Context; |
| 9 import android.os.Build; |
8 import android.os.IBinder; | 10 import android.os.IBinder; |
9 import android.os.ResultReceiver; | 11 import android.os.ResultReceiver; |
10 import android.view.View; | 12 import android.view.View; |
| 13 import android.view.inputmethod.CursorAnchorInfo; |
11 import android.view.inputmethod.InputMethodManager; | 14 import android.view.inputmethod.InputMethodManager; |
12 | 15 |
13 /** | 16 /** |
14 * Wrapper around Android's InputMethodManager | 17 * Wrapper around Android's InputMethodManager |
15 */ | 18 */ |
16 public class InputMethodManagerWrapper { | 19 public class InputMethodManagerWrapper { |
17 private final Context mContext; | 20 private final Context mContext; |
18 | 21 |
19 public InputMethodManagerWrapper(Context context) { | 22 public InputMethodManagerWrapper(Context context) { |
20 mContext = context; | 23 mContext = context; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 /** | 59 /** |
57 * @see android.view.inputmethod.InputMethodManager#updateSelection(View, in
t, int, int, int) | 60 * @see android.view.inputmethod.InputMethodManager#updateSelection(View, in
t, int, int, int) |
58 */ | 61 */ |
59 public void updateSelection(View view, int selStart, int selEnd, | 62 public void updateSelection(View view, int selStart, int selEnd, |
60 int candidatesStart, int candidatesEnd) { | 63 int candidatesStart, int candidatesEnd) { |
61 getInputMethodManager().updateSelection(view, selStart, selEnd, candidat
esStart, | 64 getInputMethodManager().updateSelection(view, selStart, selEnd, candidat
esStart, |
62 candidatesEnd); | 65 candidatesEnd); |
63 } | 66 } |
64 | 67 |
65 /** | 68 /** |
66 * @see android.view.inputmethod.InputMethodManager#isWatchingCursor(View) | 69 * @see android.view.inputmethod.InputMethodManager#updateCursorAnchorInfo(V
iew, |
| 70 * CursorAnchorInfo) |
67 */ | 71 */ |
68 @SuppressWarnings("deprecation") | 72 @TargetApi(Build.VERSION_CODES.LOLLIPOP) |
69 public boolean isWatchingCursor(View view) { | 73 public void updateCursorAnchorInfo(View view, CursorAnchorInfo cursorAnchorI
nfo) { |
70 // TODO(aurimas): InputMethodManager.isWatchingCursor() was deprecated i
n L. Fix | 74 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { |
71 // this once the final Android L SDK is released. | 75 getInputMethodManager().updateCursorAnchorInfo(view, cursorAnchorInf
o); |
72 return getInputMethodManager().isWatchingCursor(view); | 76 } |
73 } | |
74 | |
75 /** | |
76 * @see android.view.inputmethod.InputMethodManager#updateCursor(View, int,
int, int, int) | |
77 */ | |
78 @SuppressWarnings("deprecation") | |
79 public void updateCursor(View view, int left, int top, int right, int bottom
) { | |
80 // TODO(aurimas): InputMethodManager.updateCursor() was deprecated in L.
Fix | |
81 // this once the final Android L SDK is released. | |
82 getInputMethodManager().updateCursor(view, left, top, right, bottom); | |
83 } | 77 } |
84 } | 78 } |
OLD | NEW |