Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
LatinIME
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
keyboard
LatinIME
Commits
da498229
Commit
da498229
authored
10 years ago
by
Yohei Yukawa
Committed by
Android (Google) Code Review
10 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Plumbing for ProductionFlag.USES_CURSOR_ANCHOR_MONITOR"
parents
4f4770cb
fab4ce43
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
java/src/com/android/inputmethod/compat/InputMethodServiceCompatUtils.java
+28
-1
28 additions, 1 deletion
...oid/inputmethod/compat/InputMethodServiceCompatUtils.java
java/src/com/android/inputmethod/latin/LatinIME.java
+14
-0
14 additions, 0 deletions
java/src/com/android/inputmethod/latin/LatinIME.java
with
42 additions
and
1 deletion
java/src/com/android/inputmethod/compat/InputMethodServiceCompatUtils.java
+
28
−
1
View file @
da498229
...
...
@@ -17,11 +17,12 @@
package
com.android.inputmethod.compat
;
import
android.inputmethodservice.InputMethodService
;
import
com.android.inputmethod.latin.define.ProductionFlag
;
import
java.lang.reflect.Method
;
public
final
class
InputMethodServiceCompatUtils
{
// Note that InputMethodService
.
enableHardwareAcceleration
()
has been introduced
// Note that
{@link
InputMethodService
#
enableHardwareAcceleration
}
has been introduced
// in API level 17 (Build.VERSION_CODES.JELLY_BEAN_MR1).
private
static
final
Method
METHOD_enableHardwareAcceleration
=
CompatUtils
.
getMethod
(
InputMethodService
.
class
,
"enableHardwareAcceleration"
);
...
...
@@ -34,4 +35,30 @@ public final class InputMethodServiceCompatUtils {
return
(
Boolean
)
CompatUtils
.
invoke
(
ims
,
false
/* defaultValue */
,
METHOD_enableHardwareAcceleration
);
}
public
static
void
setCursorAnchorMonitorMode
(
final
InputMethodService
ims
,
final
int
mode
)
{
if
(
ProductionFlag
.
USES_CURSOR_ANCHOR_MONITOR
)
{
ExperimentalAPIUtils
.
setCursorAnchorMonitorMode
(
ims
,
mode
);
}
}
/*
* For unreleased APIs. ProGuard will strip this class entirely, unless used explicitly.
*/
private
static
final
class
ExperimentalAPIUtils
{
// Note that {@link InputMethodManager#setCursorAnchorMonitorMode} is not yet available as
// an official API as of API level 19 (Build.VERSION_CODES.KITKAT).
private
static
final
Method
METHOD_setCursorAnchorMonitorMode
=
CompatUtils
.
getMethod
(
InputMethodService
.
class
,
"setCursorAnchorMonitorMode"
,
int
.
class
);
private
ExperimentalAPIUtils
()
{
// This utility class is not publicly instantiable.
}
public
static
void
setCursorAnchorMonitorMode
(
final
InputMethodService
ims
,
final
int
mode
)
{
CompatUtils
.
invoke
(
ims
,
null
/* defaultValue */
,
METHOD_setCursorAnchorMonitorMode
,
mode
);
}
}
}
This diff is collapsed.
Click to expand it.
java/src/com/android/inputmethod/latin/LatinIME.java
+
14
−
0
View file @
da498229
...
...
@@ -367,6 +367,12 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
if
(
latinIme
!=
null
)
{
executePendingImsCallback
(
latinIme
,
editorInfo
,
restarting
);
latinIme
.
onStartInputInternal
(
editorInfo
,
restarting
);
if
(
ProductionFlag
.
USES_CURSOR_ANCHOR_MONITOR
)
{
// Currently we need to call this every time when the IME is attached to
// new application.
// TODO: Consider if we can do this automatically in the framework.
InputMethodServiceCompatUtils
.
setCursorAnchorMonitorMode
(
latinIme
,
1
);
}
}
}
}
...
...
@@ -931,6 +937,14 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
mSubtypeState
.
currentSubtypeUsed
();
}
@Override
public
void
onUpdateCursor
(
Rect
rect
)
{
if
(
DEBUG
)
{
Log
.
i
(
TAG
,
"onUpdateCursor:"
+
rect
.
toShortString
());
}
super
.
onUpdateCursor
(
rect
);
}
/**
* This is called when the user has clicked on the extracted text view,
* when running in fullscreen mode. The default implementation hides
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment