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
a232930d
Commit
a232930d
authored
12 years ago
by
Tadashi G. Takaoka
Browse files
Options
Downloads
Patches
Plain Diff
Straighten an if-else-if blocks into if-return blocks
Change-Id: If3eede1257658f27384e3efc72586fabbed19f7b
parent
01f6a61e
No related branches found
No related tags found
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
+28
-28
28 additions, 28 deletions
.../src/com/android/inputmethod/keyboard/PointerTracker.java
with
28 additions
and
28 deletions
java/src/com/android/inputmethod/keyboard/PointerTracker.java
+
28
−
28
View file @
a232930d
...
...
@@ -1165,38 +1165,38 @@ public final class PointerTracker implements PointerTrackerQueue.Element {
final
Key
curKey
=
mCurrentKey
;
if
(
newKey
==
curKey
)
{
return
false
;
}
else
if
(
curKey
!=
null
)
{
final
int
keyHysteresisDistanceSquared
=
mKeyDetector
.
getKeyHysteresisDistanceSquared
(
mIsInSlidingKeyInputFromModifier
);
final
int
distanceFromKeyEdgeSquared
=
curKey
.
squaredDistanceToEdge
(
x
,
y
);
if
(
distanceFromKeyEdgeSquared
>=
keyHysteresisDistanceSquared
)
{
if
(
DEBUG_MODE
)
{
final
float
distanceToEdgeRatio
=
(
float
)
Math
.
sqrt
(
distanceFromKeyEdgeSquared
)
/
mKeyboard
.
mMostCommonKeyWidth
;
Log
.
d
(
TAG
,
String
.
format
(
"[%d] isMajorEnoughMoveToBeOnNewKey:"
+
" %.2f key width from key edge"
,
mPointerId
,
distanceToEdgeRatio
));
}
return
true
;
}
if
(
curKey
==
null
/* && newKey != null */
)
{
return
true
;
}
// Here curKey points to the different key from newKey.
final
int
keyHysteresisDistanceSquared
=
mKeyDetector
.
getKeyHysteresisDistanceSquared
(
mIsInSlidingKeyInputFromModifier
);
final
int
distanceFromKeyEdgeSquared
=
curKey
.
squaredDistanceToEdge
(
x
,
y
);
if
(
distanceFromKeyEdgeSquared
>=
keyHysteresisDistanceSquared
)
{
if
(
DEBUG_MODE
)
{
final
float
distanceToEdgeRatio
=
(
float
)
Math
.
sqrt
(
distanceFromKeyEdgeSquared
)
/
mKeyboard
.
mMostCommonKeyWidth
;
Log
.
d
(
TAG
,
String
.
format
(
"[%d] isMajorEnoughMoveToBeOnNewKey:"
+
" %.2f key width from key edge"
,
mPointerId
,
distanceToEdgeRatio
));
}
if
(
sNeedsProximateBogusDownMoveUpEventHack
&&
!
mIsAllowedSlidingKeyInput
&&
sTimeRecorder
.
isInFastTyping
(
eventTime
)
&&
m
BogusMoveEvent
Detector
.
hasTraveledLongDistance
(
x
,
y
))
{
if
(
DEBUG_MODE
)
{
final
float
keyDiagonal
=
(
float
)
Math
.
hypot
(
mKeyboard
.
mMostCommonKeyWidth
,
mKeyboard
.
mMostCommonKeyHeight
);
final
float
lengthFromDownRatio
=
mBogusMoveEventDetector
.
mAccumulatedDistanceFromDownKey
/
keyDiagonal
;
Log
.
d
(
TAG
,
String
.
format
(
"[%d] isMajorEnoughMoveToBeOnNewKey:"
+
" %.2f key diagonal from virtual down point"
,
mPointerId
,
lengthFromDownRatio
));
}
return
true
;
return
true
;
}
if
(
sNeedsProximate
Bogus
Down
Move
Up
Event
Hack
&&
!
mIsAllowedSlidingKeyInput
&&
sTimeRecorder
.
isInFastTyping
(
eventTime
)
&&
mBogusMoveEventDetector
.
hasTraveledLongDistance
(
x
,
y
))
{
if
(
DEBUG_MODE
)
{
final
float
keyDiagonal
=
(
float
)
Math
.
hypot
(
mKeyboard
.
mMostCommonKeyWidth
,
mKeyboard
.
mMostCommonKeyHeight
)
;
final
float
lengthFromDownRatio
=
mBogusMoveEventDetector
.
mAccumulatedDistanceFromDownKey
/
keyDiagonal
;
Log
.
d
(
TAG
,
String
.
format
(
"[%d] isMajorEnoughMoveToBeOnNewKey:"
+
" %.2f key diagonal from virtual down point"
,
mPointerId
,
lengthFromDownRatio
))
;
}
return
false
;
}
else
{
// curKey == null && newKey != null
return
true
;
}
return
false
;
}
private
void
startLongPressTimer
(
final
Key
key
)
{
...
...
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