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
891e4860
Commit
891e4860
authored
11 years ago
by
Tadashi G. Takaoka
Committed by
Android (Google) Code Review
11 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Stop overriding SuggestionStripView.dispatchTouchEvent"
parents
1751615f
e32548f3
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/latin/suggestions/SuggestionStripView.java
+23
-24
23 additions, 24 deletions
...id/inputmethod/latin/suggestions/SuggestionStripView.java
with
23 additions
and
24 deletions
java/src/com/android/inputmethod/latin/suggestions/SuggestionStripView.java
+
23
−
24
View file @
891e4860
...
@@ -327,7 +327,6 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
...
@@ -327,7 +327,6 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
final
int
pointY
=
-
layoutHelper
.
mMoreSuggestionsBottomGap
;
final
int
pointY
=
-
layoutHelper
.
mMoreSuggestionsBottomGap
;
moreKeysPanel
.
showMoreKeysPanel
(
this
,
mMoreSuggestionsController
,
pointX
,
pointY
,
moreKeysPanel
.
showMoreKeysPanel
(
this
,
mMoreSuggestionsController
,
pointX
,
pointY
,
mMoreSuggestionsListener
);
mMoreSuggestionsListener
);
mMoreSuggestionsMode
=
MORE_SUGGESTIONS_CHECKING_MODAL_OR_SLIDING
;
mOriginX
=
mLastX
;
mOriginX
=
mLastX
;
mOriginY
=
mLastY
;
mOriginY
=
mLastY
;
for
(
int
i
=
0
;
i
<
mSuggestionsCountInStrip
;
i
++)
{
for
(
int
i
=
0
;
i
<
mSuggestionsCountInStrip
;
i
++)
{
...
@@ -336,11 +335,8 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
...
@@ -336,11 +335,8 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
return
true
;
return
true
;
}
}
// Working variables for onLongClick and dispatchTouchEvent.
// Working variables for {@link #onLongClick(View)} and
private
int
mMoreSuggestionsMode
=
MORE_SUGGESTIONS_IN_MODAL_MODE
;
// {@link onInterceptTouchEvent(MotionEvent)}.
private
static
final
int
MORE_SUGGESTIONS_IN_MODAL_MODE
=
0
;
private
static
final
int
MORE_SUGGESTIONS_CHECKING_MODAL_OR_SLIDING
=
1
;
private
static
final
int
MORE_SUGGESTIONS_IN_SLIDING_MODE
=
2
;
private
int
mLastX
;
private
int
mLastX
;
private
int
mLastY
;
private
int
mLastY
;
private
int
mOriginX
;
private
int
mOriginX
;
...
@@ -360,36 +356,39 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
...
@@ -360,36 +356,39 @@ public final class SuggestionStripView extends RelativeLayout implements OnClick
};
};
@Override
@Override
public
boolean
dispatch
TouchEvent
(
final
MotionEvent
me
)
{
public
boolean
onIntercept
TouchEvent
(
final
MotionEvent
me
)
{
if
(!
mMoreSuggestionsView
.
isShowingInParent
())
{
if
(!
mMoreSuggestionsView
.
isShowingInParent
())
{
mLastX
=
(
int
)
me
.
getX
();
mLastX
=
(
int
)
me
.
getX
();
mLastY
=
(
int
)
me
.
getY
();
mLastY
=
(
int
)
me
.
getY
();
if
(
mMoreSuggestionsSlidingDetector
.
onTouchEvent
(
me
))
{
return
mMoreSuggestionsSlidingDetector
.
onTouchEvent
(
me
);
return
true
;
}
return
super
.
dispatchTouchEvent
(
me
);
}
}
final
int
action
=
me
.
getAction
();
final
int
action
=
me
.
getAction
();
final
int
index
=
me
.
getActionIndex
();
final
int
index
=
me
.
getActionIndex
();
final
int
x
=
(
int
)
me
.
getX
(
index
);
final
int
x
=
(
int
)
me
.
getX
(
index
);
final
int
y
=
(
int
)
me
.
getY
(
index
);
final
int
y
=
(
int
)
me
.
getY
(
index
);
if
(
Math
.
abs
(
x
-
mOriginX
)
>=
mMoreSuggestionsModalTolerance
if
(
mMoreSuggestionsMode
==
MORE_SUGGESTIONS_CHECKING_MODAL_OR_SLIDING
)
{
||
mOriginY
-
y
>=
mMoreSuggestionsModalTolerance
)
{
if
(
Math
.
abs
(
x
-
mOriginX
)
>=
mMoreSuggestionsModalTolerance
// Decided to be in the sliding input mode only when the touch point has been moved
||
mOriginY
-
y
>=
mMoreSuggestionsModalTolerance
)
{
// upward. Further {@link MotionEvent}s will be delivered to
// Decided to be in the sliding input mode only when the touch point has been moved
// {@link #onTouchEvent(MotionEvent)}.
// upward.
mMoreSuggestionsMode
=
MORE_SUGGESTIONS_IN_SLIDING_MODE
;
}
else
if
(
action
==
MotionEvent
.
ACTION_UP
||
action
==
MotionEvent
.
ACTION_POINTER_UP
)
{
// Decided to be in the modal input mode
mMoreSuggestionsMode
=
MORE_SUGGESTIONS_IN_MODAL_MODE
;
mMoreSuggestionsView
.
adjustVerticalCorrectionForModalMode
();
}
return
true
;
return
true
;
}
}
// MORE_SUGGESTIONS_IN_SLIDING_MODE
if
(
action
==
MotionEvent
.
ACTION_UP
||
action
==
MotionEvent
.
ACTION_POINTER_UP
)
{
// Decided to be in the modal input mode.
mMoreSuggestionsView
.
adjustVerticalCorrectionForModalMode
();
}
return
false
;
}
@Override
public
boolean
onTouchEvent
(
final
MotionEvent
me
)
{
// In the sliding input mode. {@link MotionEvent} should be forwarded to
// {@link MoreSuggestionsView}.
final
int
index
=
me
.
getActionIndex
();
final
int
x
=
(
int
)
me
.
getX
(
index
);
final
int
y
=
(
int
)
me
.
getY
(
index
);
me
.
setLocation
(
mMoreSuggestionsView
.
translateX
(
x
),
mMoreSuggestionsView
.
translateY
(
y
));
me
.
setLocation
(
mMoreSuggestionsView
.
translateX
(
x
),
mMoreSuggestionsView
.
translateY
(
y
));
mMoreSuggestionsView
.
onTouchEvent
(
me
);
mMoreSuggestionsView
.
onTouchEvent
(
me
);
return
true
;
return
true
;
...
...
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