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
f501e4db
Commit
f501e4db
authored
12 years ago
by
Tadashi G. Takaoka
Browse files
Options
Downloads
Patches
Plain Diff
Remove hack algorithm from GestureStroke
Change-Id: Idd1c150677b989415e6fee4f543ff7639e98bed8
parent
c9923430
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/internal/GestureStroke.java
+0
-32
0 additions, 32 deletions
.../android/inputmethod/keyboard/internal/GestureStroke.java
with
0 additions
and
32 deletions
java/src/com/android/inputmethod/keyboard/internal/GestureStroke.java
+
0
−
32
View file @
f501e4db
...
@@ -25,7 +25,6 @@ public class GestureStroke {
...
@@ -25,7 +25,6 @@ public class GestureStroke {
private
final
ResizableIntArray
mXCoordinates
=
new
ResizableIntArray
(
DEFAULT_CAPACITY
);
private
final
ResizableIntArray
mXCoordinates
=
new
ResizableIntArray
(
DEFAULT_CAPACITY
);
private
final
ResizableIntArray
mYCoordinates
=
new
ResizableIntArray
(
DEFAULT_CAPACITY
);
private
final
ResizableIntArray
mYCoordinates
=
new
ResizableIntArray
(
DEFAULT_CAPACITY
);
private
float
mLength
;
private
float
mLength
;
private
float
mAngle
;
private
int
mIncrementalRecognitionSize
;
private
int
mIncrementalRecognitionSize
;
private
int
mLastIncrementalBatchSize
;
private
int
mLastIncrementalBatchSize
;
private
long
mLastPointTime
;
private
long
mLastPointTime
;
...
@@ -40,9 +39,6 @@ public class GestureStroke {
...
@@ -40,9 +39,6 @@ public class GestureStroke {
private
static
final
int
MIN_GESTURE_DURATION
=
100
;
// msec
private
static
final
int
MIN_GESTURE_DURATION
=
100
;
// msec
private
static
final
float
MIN_GESTURE_SAMPLING_RATIO_TO_KEY_WIDTH
=
1.0f
/
6.0f
;
private
static
final
float
MIN_GESTURE_SAMPLING_RATIO_TO_KEY_WIDTH
=
1.0f
/
6.0f
;
private
static
final
float
GESTURE_RECOG_SPEED_THRESHOLD
=
0.4f
;
// dip/msec
private
static
final
float
GESTURE_RECOG_SPEED_THRESHOLD
=
0.4f
;
// dip/msec
private
static
final
float
GESTURE_RECOG_CURVATURE_THRESHOLD
=
(
float
)(
Math
.
PI
/
4.0f
);
private
static
final
float
DOUBLE_PI
=
(
float
)(
2.0f
*
Math
.
PI
);
public
GestureStroke
(
final
int
pointerId
)
{
public
GestureStroke
(
final
int
pointerId
)
{
mPointerId
=
pointerId
;
mPointerId
=
pointerId
;
...
@@ -62,7 +58,6 @@ public class GestureStroke {
...
@@ -62,7 +58,6 @@ public class GestureStroke {
public
void
reset
()
{
public
void
reset
()
{
mLength
=
0
;
mLength
=
0
;
mAngle
=
0
;
mIncrementalRecognitionSize
=
0
;
mIncrementalRecognitionSize
=
0
;
mLastIncrementalBatchSize
=
0
;
mLastIncrementalBatchSize
=
0
;
mLastPointTime
=
0
;
mLastPointTime
=
0
;
...
@@ -97,16 +92,6 @@ public class GestureStroke {
...
@@ -97,16 +92,6 @@ public class GestureStroke {
mXCoordinates
.
add
(
x
);
mXCoordinates
.
add
(
x
);
mYCoordinates
.
add
(
y
);
mYCoordinates
.
add
(
y
);
mLength
+=
dist
;
mLength
+=
dist
;
final
float
angle
=
getAngle
(
lastX
,
lastY
,
x
,
y
);
if
(
size
>
1
)
{
final
float
curvature
=
getAngleDiff
(
angle
,
mAngle
);
if
(
curvature
>
GESTURE_RECOG_CURVATURE_THRESHOLD
)
{
if
(
size
>
mIncrementalRecognitionSize
)
{
mIncrementalRecognitionSize
=
size
;
}
}
}
mAngle
=
angle
;
}
}
if
(!
isHistorical
)
{
if
(!
isHistorical
)
{
...
@@ -146,21 +131,4 @@ public class GestureStroke {
...
@@ -146,21 +131,4 @@ public class GestureStroke {
// java.lang.Math due to the way the JIT optimizes java.lang.Math.
// java.lang.Math due to the way the JIT optimizes java.lang.Math.
return
(
float
)
Math
.
sqrt
(
dx
*
dx
+
dy
*
dy
);
return
(
float
)
Math
.
sqrt
(
dx
*
dx
+
dy
*
dy
);
}
}
private
static
float
getAngle
(
final
int
x1
,
final
int
y1
,
final
int
x2
,
final
int
y2
)
{
final
int
dx
=
x1
-
x2
;
final
int
dy
=
y1
-
y2
;
if
(
dx
==
0
&&
dy
==
0
)
return
0
;
// Would it be faster to call atan2f() directly via JNI? Not sure about what the JIT
// does with Math.atan2().
return
(
float
)
Math
.
atan2
(
dy
,
dx
);
}
private
static
float
getAngleDiff
(
final
float
a1
,
final
float
a2
)
{
final
float
diff
=
Math
.
abs
(
a1
-
a2
);
if
(
diff
>
Math
.
PI
)
{
return
DOUBLE_PI
-
diff
;
}
return
diff
;
}
}
}
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