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; | |
8 import android.content.Context; | 7 import android.content.Context; |
9 import android.os.Build; | 8 import android.os.Build; |
10 import android.os.IBinder; | 9 import android.os.IBinder; |
11 import android.os.ResultReceiver; | 10 import android.os.ResultReceiver; |
12 import android.view.View; | 11 import android.view.View; |
13 import android.view.inputmethod.CursorAnchorInfo; | 12 import android.view.inputmethod.CursorAnchorInfo; |
14 import android.view.inputmethod.InputMethodManager; | 13 import android.view.inputmethod.InputMethodManager; |
15 | 14 |
16 /** | 15 /** |
17 * Wrapper around Android's InputMethodManager | 16 * Wrapper around Android's InputMethodManager |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 public void updateSelection(View view, int selStart, int selEnd, | 61 public void updateSelection(View view, int selStart, int selEnd, |
63 int candidatesStart, int candidatesEnd) { | 62 int candidatesStart, int candidatesEnd) { |
64 getInputMethodManager().updateSelection(view, selStart, selEnd, candidat
esStart, | 63 getInputMethodManager().updateSelection(view, selStart, selEnd, candidat
esStart, |
65 candidatesEnd); | 64 candidatesEnd); |
66 } | 65 } |
67 | 66 |
68 /** | 67 /** |
69 * @see android.view.inputmethod.InputMethodManager#updateCursorAnchorInfo(V
iew, | 68 * @see android.view.inputmethod.InputMethodManager#updateCursorAnchorInfo(V
iew, |
70 * CursorAnchorInfo) | 69 * CursorAnchorInfo) |
71 */ | 70 */ |
72 @TargetApi(Build.VERSION_CODES.LOLLIPOP) | 71 public void updateCursorAnchorInfo(View view, CursorAnchorInfoWrapper cursor
AnchorInfo) { |
73 public void updateCursorAnchorInfo(View view, CursorAnchorInfo cursorAnchorI
nfo) { | 72 if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) return; |
74 if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { | 73 if (cursorAnchorInfo == null) return; |
75 getInputMethodManager().updateCursorAnchorInfo(view, cursorAnchorInf
o); | 74 Object realObject = cursorAnchorInfo.unwrap(); |
| 75 if (realObject instanceof CursorAnchorInfo) { |
| 76 getInputMethodManager().updateCursorAnchorInfo(view, (CursorAnchorIn
fo) realObject); |
76 } | 77 } |
77 } | 78 } |
78 } | 79 } |
OLD | NEW |