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
29d2d481
Commit
29d2d481
authored
12 years ago
by
Tadashi G. Takaoka
Browse files
Options
Downloads
Patches
Plain Diff
Temporarily suppress key popup preview after gesture input
Bug: 7244317 Change-Id: I39cdb0fbda51f3e4339301d9cc53403b1ad15409
parent
a36c5953
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
java/src/com/android/inputmethod/keyboard/PointerTracker.java
+21
-7
21 additions, 7 deletions
.../src/com/android/inputmethod/keyboard/PointerTracker.java
with
21 additions
and
7 deletions
java/src/com/android/inputmethod/keyboard/PointerTracker.java
+
21
−
7
View file @
29d2d481
...
...
@@ -48,6 +48,9 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
private
static
boolean
sGestureHandlingEnabledByUser
=
false
;
private
static
boolean
sGestureOffWhileFastTyping
=
false
;
// TODO: Move this to resource.
private
static
final
int
SUPPRESS_KEY_PREVIEW_AFTER_LAST_BATCH_INPUT_DURATION
=
1000
;
// msec
public
interface
KeyEventHandler
{
/**
* Get KeyDetector object that is used for this PointerTracker.
...
...
@@ -169,6 +172,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
private
boolean
mIsDetectingGesture
=
false
;
// per PointerTracker.
private
static
boolean
sInGesture
=
false
;
private
static
long
sGestureFirstDownTime
;
private
static
long
sLastBatchInputTime
;
private
static
long
sLastLetterTypingUpTime
;
private
static
final
InputPointers
sAggregratedPointers
=
new
InputPointers
(
GestureStroke
.
DEFAULT_CAPACITY
);
...
...
@@ -360,6 +364,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
}
// Even if the key is disabled, it should respond if it is in the altCodeWhileTyping state.
if
(
key
.
isEnabled
()
||
altersCode
)
{
sLastBatchInputTime
=
0
;
// reset time
if
(
code
==
Keyboard
.
CODE_OUTPUT_TEXT
)
{
mListener
.
onTextInput
(
key
.
getOutputText
());
mTimerProxy
.
startGestureOffWhileFastTypingTimer
();
...
...
@@ -469,7 +474,15 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
}
}
private
void
setPressedKeyGraphics
(
final
Key
key
)
{
private
static
boolean
needsToSuppressKeyPreviewPopup
(
final
long
eventTime
)
{
if
(!
sShouldHandleGesture
)
return
false
;
if
(
sLastBatchInputTime
==
0
)
return
false
;
final
long
elapsedTimeAfterTheLastBatchInput
=
eventTime
-
sLastBatchInputTime
;
return
elapsedTimeAfterTheLastBatchInput
<
SUPPRESS_KEY_PREVIEW_AFTER_LAST_BATCH_INPUT_DURATION
;
}
private
void
setPressedKeyGraphics
(
final
Key
key
,
final
long
eventTime
)
{
if
(
key
==
null
)
{
return
;
}
...
...
@@ -481,7 +494,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
return
;
}
if
(!
key
.
noKeyPreview
()
&&
!
sInGesture
)
{
if
(!
key
.
noKeyPreview
()
&&
!
sInGesture
&&
!
needsToSuppressKeyPreviewPopup
(
eventTime
)
)
{
mDrawingProxy
.
showKeyPreview
(
this
);
}
updatePressKeyGraphics
(
key
);
...
...
@@ -596,7 +609,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
mDrawingProxy
.
showGesturePreviewTrail
(
this
,
isOldestTracker
);
}
private
void
mayEndBatchInput
()
{
private
void
mayEndBatchInput
(
final
long
eventTime
)
{
synchronized
(
sAggregratedPointers
)
{
mGestureStrokeWithPreviewPoints
.
appendAllBatchPoints
(
sAggregratedPointers
);
mGestureStrokeWithPreviewPoints
.
reset
();
...
...
@@ -606,6 +619,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
+
sAggregratedPointers
.
getPointerSize
());
}
sInGesture
=
false
;
sLastBatchInputTime
=
eventTime
;
mListener
.
onEndBatchInput
(
sAggregratedPointers
);
clearBatchInputPointsOfAllPointerTrackers
();
}
...
...
@@ -731,7 +745,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
startRepeatKey
(
key
);
startLongPressTimer
(
key
);
setPressedKeyGraphics
(
key
);
setPressedKeyGraphics
(
key
,
eventTime
);
}
}
...
...
@@ -809,7 +823,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
}
onMoveToNewKey
(
key
,
x
,
y
);
startLongPressTimer
(
key
);
setPressedKeyGraphics
(
key
);
setPressedKeyGraphics
(
key
,
eventTime
);
}
else
if
(
isMajorEnoughMoveToBeOnNewKey
(
x
,
y
,
key
))
{
// The pointer has been slid in to the new key from the previous key, we must call
// onRelease() first to notify that the previous key has been released, then call
...
...
@@ -828,7 +842,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
}
onMoveToNewKey
(
key
,
x
,
y
);
startLongPressTimer
(
key
);
setPressedKeyGraphics
(
key
);
setPressedKeyGraphics
(
key
,
eventTime
);
}
else
{
// HACK: On some devices, quick successive touches may be translated to sudden
// move by touch panel firmware. This hack detects the case and translates the
...
...
@@ -939,7 +953,7 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
if
(
currentKey
!=
null
)
{
callListenerOnRelease
(
currentKey
,
currentKey
.
mCode
,
true
);
}
mayEndBatchInput
();
mayEndBatchInput
(
eventTime
);
return
;
}
// This event will be recognized as a regular code input. Clear unused possible batch points
...
...
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