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
1451a0fb
Commit
1451a0fb
authored
12 years ago
by
Tadashi G. Takaoka
Committed by
Android (Google) Code Review
12 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Optimize gesture preview trail drawing a bit" into jb-mr1-dev
parents
76951d8e
1c2f3322
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
java/res/values/config.xml
+1
-1
1 addition, 1 deletion
java/res/values/config.xml
java/src/com/android/inputmethod/keyboard/internal/GesturePreviewTrail.java
+15
-10
15 additions, 10 deletions
...id/inputmethod/keyboard/internal/GesturePreviewTrail.java
with
16 additions
and
11 deletions
java/res/values/config.xml
+
1
−
1
View file @
1451a0fb
...
...
@@ -51,7 +51,7 @@
<integer
name=
"config_key_preview_linger_timeout"
>
70
</integer>
<integer
name=
"config_gesture_floating_preview_text_linger_timeout"
>
200
</integer>
<integer
name=
"config_gesture_preview_trail_fadeout_start_delay"
>
100
</integer>
<integer
name=
"config_gesture_preview_trail_fadeout_duration"
>
10
00
</integer>
<integer
name=
"config_gesture_preview_trail_fadeout_duration"
>
8
00
</integer>
<integer
name=
"config_gesture_preview_trail_update_interval"
>
20
</integer>
<!--
Configuration for MainKeyboardView
...
...
This diff is collapsed.
Click to expand it.
java/src/com/android/inputmethod/keyboard/internal/GesturePreviewTrail.java
+
15
−
10
View file @
1451a0fb
...
...
@@ -32,6 +32,7 @@ class GesturePreviewTrail {
private
final
ResizableIntArray
mEventTimes
=
new
ResizableIntArray
(
DEFAULT_CAPACITY
);
private
int
mCurrentStrokeId
=
-
1
;
private
long
mCurrentDownTime
;
private
int
mTrailStartIndex
;
// Use this value as imaginary zero because x-coordinates may be zero.
private
static
final
int
DOWN_EVENT_MARKER
=
-
128
;
...
...
@@ -80,7 +81,7 @@ class GesturePreviewTrail {
if
(
isNewStroke
)
{
final
int
elapsedTime
=
(
int
)(
downTime
-
mCurrentDownTime
);
final
int
[]
eventTimes
=
mEventTimes
.
getPrimitiveArray
();
for
(
int
i
=
0
;
i
<
trailSize
;
i
++)
{
for
(
int
i
=
mTrailStartIndex
;
i
<
trailSize
;
i
++)
{
eventTimes
[
i
]
-=
elapsedTime
;
}
...
...
@@ -122,13 +123,14 @@ class GesturePreviewTrail {
final
int
lingeringDuration
=
mPreviewParams
.
mFadeoutStartDelay
+
mPreviewParams
.
mFadeoutDuration
;
int
startIndex
;
for
(
startIndex
=
0
;
startIndex
<
trailSize
;
startIndex
++)
{
for
(
startIndex
=
mTrailStartIndex
;
startIndex
<
trailSize
;
startIndex
++)
{
final
int
elapsedTime
=
sinceDown
-
eventTimes
[
startIndex
];
// Skip too old trail points.
if
(
elapsedTime
<
lingeringDuration
)
{
break
;
}
}
mTrailStartIndex
=
startIndex
;
if
(
startIndex
<
trailSize
)
{
int
lastX
=
getXCoordValue
(
xCoords
[
startIndex
]);
...
...
@@ -147,15 +149,18 @@ class GesturePreviewTrail {
}
}
// TODO: Implement ring buffer to avoid moving points.
// Discard faded out points.
final
int
newSize
=
trailSize
-
startIndex
;
System
.
arraycopy
(
eventTimes
,
startIndex
,
eventTimes
,
0
,
newSize
);
System
.
arraycopy
(
xCoords
,
startIndex
,
xCoords
,
0
,
newSize
);
System
.
arraycopy
(
yCoords
,
startIndex
,
yCoords
,
0
,
newSize
);
mEventTimes
.
setLength
(
newSize
);
mXCoordinates
.
setLength
(
newSize
);
mYCoordinates
.
setLength
(
newSize
);
if
(
newSize
<
startIndex
)
{
mTrailStartIndex
=
0
;
if
(
newSize
>
0
)
{
System
.
arraycopy
(
eventTimes
,
startIndex
,
eventTimes
,
0
,
newSize
);
System
.
arraycopy
(
xCoords
,
startIndex
,
xCoords
,
0
,
newSize
);
System
.
arraycopy
(
yCoords
,
startIndex
,
yCoords
,
0
,
newSize
);
}
mEventTimes
.
setLength
(
newSize
);
mXCoordinates
.
setLength
(
newSize
);
mYCoordinates
.
setLength
(
newSize
);
}
return
newSize
>
0
;
}
}
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