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
c9716b28
Commit
c9716b28
authored
14 years ago
by
Tadashi G. Takaoka
Browse files
Options
Downloads
Patches
Plain Diff
Disable suggestion selection preview popup
Bug: 3048642 Bug: 3004920 Change-Id: Ibfb495a246c9e2da6ebf3c03d10ed8acff00f54b
parent
179ada95
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/latin/CandidateView.java
+56
-49
56 additions, 49 deletions
java/src/com/android/inputmethod/latin/CandidateView.java
with
56 additions
and
49 deletions
java/src/com/android/inputmethod/latin/CandidateView.java
+
56
−
49
View file @
c9716b28
...
@@ -149,61 +149,69 @@ public class CandidateView extends View {
...
@@ -149,61 +149,69 @@ public class CandidateView extends View {
mDescent
=
(
int
)
mPaint
.
descent
();
mDescent
=
(
int
)
mPaint
.
descent
();
mMinTouchableWidth
=
(
int
)
res
.
getDimension
(
R
.
dimen
.
candidate_min_touchable_width
);
mMinTouchableWidth
=
(
int
)
res
.
getDimension
(
R
.
dimen
.
candidate_min_touchable_width
);
// Slightly reluctant to scroll to be able to easily choose the suggestion
mGestureDetector
=
new
GestureDetector
(
final
int
touchSlopSquare
=
mMinTouchableWidth
*
mMinTouchableWidth
;
new
CandidateStripGestureListener
(
mMinTouchableWidth
));
mGestureDetector
=
new
GestureDetector
(
new
GestureDetector
.
SimpleOnGestureListener
()
{
setWillNotDraw
(
false
);
@Override
setHorizontalScrollBarEnabled
(
false
);
public
void
onLongPress
(
MotionEvent
me
)
{
setVerticalScrollBarEnabled
(
false
);
if
(
mSuggestions
.
size
()
>
0
)
{
scrollTo
(
0
,
getScrollY
());
if
(
me
.
getX
()
+
getScrollX
()
<
mWordWidth
[
0
]
&&
getScrollX
()
<
10
)
{
}
longPressFirstWord
();
}
private
class
CandidateStripGestureListener
extends
GestureDetector
.
SimpleOnGestureListener
{
private
final
int
mTouchSlopSquare
;
public
CandidateStripGestureListener
(
int
touchSlop
)
{
// Slightly reluctant to scroll to be able to easily choose the suggestion
mTouchSlopSquare
=
touchSlop
*
touchSlop
;
}
@Override
public
void
onLongPress
(
MotionEvent
me
)
{
if
(
mSuggestions
.
size
()
>
0
)
{
if
(
me
.
getX
()
+
getScrollX
()
<
mWordWidth
[
0
]
&&
getScrollX
()
<
10
)
{
longPressFirstWord
();
}
}
}
}
}
@Override
@Override
public
boolean
onDown
(
MotionEvent
e
)
{
public
boolean
onDown
(
MotionEvent
e
)
{
mScrolled
=
false
;
mScrolled
=
false
;
return
false
;
return
false
;
}
}
@Override
@Override
public
boolean
onScroll
(
MotionEvent
e1
,
MotionEvent
e2
,
public
boolean
onScroll
(
MotionEvent
e1
,
MotionEvent
e2
,
float
distanceX
,
float
distanceY
)
{
float
distanceX
,
float
distanceY
)
{
if
(!
mScrolled
)
{
if
(!
mScrolled
)
{
// This is applied only when we recognize that scrolling is starting.
// This is applied only when we recognize that scrolling is starting.
final
int
deltaX
=
(
int
)
(
e2
.
getX
()
-
e1
.
getX
());
final
int
deltaX
=
(
int
)
(
e2
.
getX
()
-
e1
.
getX
());
final
int
deltaY
=
(
int
)
(
e2
.
getY
()
-
e1
.
getY
());
final
int
deltaY
=
(
int
)
(
e2
.
getY
()
-
e1
.
getY
());
final
int
distance
=
(
deltaX
*
deltaX
)
+
(
deltaY
*
deltaY
);
final
int
distance
=
(
deltaX
*
deltaX
)
+
(
deltaY
*
deltaY
);
if
(
distance
<
touchSlopSquare
)
{
if
(
distance
<
mTouchSlopSquare
)
{
return
true
;
return
true
;
}
mScrolled
=
true
;
}
}
final
int
width
=
getWidth
();
mScrolled
=
true
;
mScrolled
=
true
;
int
scrollX
=
getScrollX
();
scrollX
+=
(
int
)
distanceX
;
if
(
scrollX
<
0
)
{
scrollX
=
0
;
}
if
(
distanceX
>
0
&&
scrollX
+
width
>
mTotalWidth
)
{
scrollX
-=
(
int
)
distanceX
;
}
mTargetScrollX
=
scrollX
;
scrollTo
(
scrollX
,
getScrollY
());
hidePreview
();
invalidate
();
return
true
;
}
}
});
setWillNotDraw
(
false
);
final
int
width
=
getWidth
();
setHorizontalScrollBarEnabled
(
false
);
mScrolled
=
true
;
setVerticalScrollBarEnabled
(
false
);
int
scrollX
=
getScrollX
();
scrollTo
(
0
,
getScrollY
());
scrollX
+=
(
int
)
distanceX
;
if
(
scrollX
<
0
)
{
scrollX
=
0
;
}
if
(
distanceX
>
0
&&
scrollX
+
width
>
mTotalWidth
)
{
scrollX
-=
(
int
)
distanceX
;
}
mTargetScrollX
=
scrollX
;
scrollTo
(
scrollX
,
getScrollY
());
hidePreview
();
invalidate
();
return
true
;
}
}
}
/**
/**
* A connection back to the service to communicate with the text field
* A connection back to the service to communicate with the text field
* @param listener
* @param listener
...
@@ -282,7 +290,6 @@ public class CandidateView extends View {
...
@@ -282,7 +290,6 @@ public class CandidateView extends View {
mSelectionHighlight
.
setBounds
(
0
,
bgPadding
.
top
,
wordWidth
,
height
);
mSelectionHighlight
.
setBounds
(
0
,
bgPadding
.
top
,
wordWidth
,
height
);
mSelectionHighlight
.
draw
(
canvas
);
mSelectionHighlight
.
draw
(
canvas
);
canvas
.
translate
(-
x
,
0
);
canvas
.
translate
(-
x
,
0
);
showPreview
(
i
,
null
);
}
}
mSelectedString
=
suggestion
;
mSelectedString
=
suggestion
;
mSelectedIndex
=
i
;
mSelectedIndex
=
i
;
...
@@ -443,7 +450,6 @@ public class CandidateView extends View {
...
@@ -443,7 +450,6 @@ public class CandidateView extends View {
mSelectedIndex
=
-
1
;
mSelectedIndex
=
-
1
;
removeHighlight
();
removeHighlight
();
requestLayout
();
requestLayout
();
mHandler
.
dismissPreview
(
mDelayAfterPreview
);
break
;
break
;
}
}
return
true
;
return
true
;
...
@@ -501,6 +507,7 @@ public class CandidateView extends View {
...
@@ -501,6 +507,7 @@ public class CandidateView extends View {
if
(
word
.
length
()
<
2
)
return
;
if
(
word
.
length
()
<
2
)
return
;
if
(
mService
.
addWordToDictionary
(
word
.
toString
()))
{
if
(
mService
.
addWordToDictionary
(
word
.
toString
()))
{
showPreview
(
0
,
getContext
().
getResources
().
getString
(
R
.
string
.
added_word
,
word
));
showPreview
(
0
,
getContext
().
getResources
().
getString
(
R
.
string
.
added_word
,
word
));
mHandler
.
dismissPreview
(
mDelayAfterPreview
);
}
}
}
}
...
...
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