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
6256ec05
Commit
6256ec05
authored
10 years ago
by
Keisuke Kuroyanagi
Committed by
Android (Google) Code Review
10 years ago
Browse files
Options
Downloads
Plain Diff
Merge "Fix: Typed word is not included in more suggestions."
parents
91db602b
a8c4731e
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/MoreSuggestions.java
+22
-4
22 additions, 4 deletions
...ndroid/inputmethod/latin/suggestions/MoreSuggestions.java
with
22 additions
and
4 deletions
java/src/com/android/inputmethod/latin/suggestions/MoreSuggestions.java
+
22
−
4
View file @
6256ec05
...
@@ -74,7 +74,13 @@ public final class MoreSuggestions extends Keyboard {
...
@@ -74,7 +74,13 @@ public final class MoreSuggestions extends Keyboard {
int
rowStartIndex
=
fromIndex
;
int
rowStartIndex
=
fromIndex
;
final
int
size
=
Math
.
min
(
suggestedWords
.
size
(),
SuggestedWords
.
MAX_SUGGESTIONS
);
final
int
size
=
Math
.
min
(
suggestedWords
.
size
(),
SuggestedWords
.
MAX_SUGGESTIONS
);
while
(
index
<
size
)
{
while
(
index
<
size
)
{
final
String
word
=
suggestedWords
.
getLabel
(
index
);
final
String
word
;
if
(
isIndexSubjectToAutoCorrection
(
suggestedWords
,
index
))
{
// INDEX_OF_AUTO_CORRECTION and INDEX_OF_TYPED_WORD got swapped.
word
=
suggestedWords
.
getLabel
(
SuggestedWords
.
INDEX_OF_TYPED_WORD
);
}
else
{
word
=
suggestedWords
.
getLabel
(
index
);
}
// TODO: Should take care of text x-scaling.
// TODO: Should take care of text x-scaling.
mWidths
[
index
]
=
(
int
)(
TypefaceUtils
.
getStringWidth
(
word
,
paint
)
+
padding
);
mWidths
[
index
]
=
(
int
)(
TypefaceUtils
.
getStringWidth
(
word
,
paint
)
+
padding
);
final
int
numColumn
=
index
-
rowStartIndex
+
1
;
final
int
numColumn
=
index
-
rowStartIndex
+
1
;
...
@@ -172,6 +178,11 @@ public final class MoreSuggestions extends Keyboard {
...
@@ -172,6 +178,11 @@ public final class MoreSuggestions extends Keyboard {
}
}
}
}
private
static
boolean
isIndexSubjectToAutoCorrection
(
final
SuggestedWords
suggestedWords
,
final
int
index
)
{
return
suggestedWords
.
mWillAutoCorrect
&&
index
==
SuggestedWords
.
INDEX_OF_AUTO_CORRECTION
;
}
public
static
final
class
Builder
extends
KeyboardBuilder
<
MoreSuggestionsParam
>
{
public
static
final
class
Builder
extends
KeyboardBuilder
<
MoreSuggestionsParam
>
{
private
final
MoreSuggestionsView
mPaneView
;
private
final
MoreSuggestionsView
mPaneView
;
private
SuggestedWords
mSuggestedWords
;
private
SuggestedWords
mSuggestedWords
;
...
@@ -189,7 +200,6 @@ public final class MoreSuggestions extends Keyboard {
...
@@ -189,7 +200,6 @@ public final class MoreSuggestions extends Keyboard {
final
int
xmlId
=
R
.
xml
.
kbd_suggestions_pane_template
;
final
int
xmlId
=
R
.
xml
.
kbd_suggestions_pane_template
;
load
(
xmlId
,
parentKeyboard
.
mId
);
load
(
xmlId
,
parentKeyboard
.
mId
);
mParams
.
mVerticalGap
=
mParams
.
mTopPadding
=
parentKeyboard
.
mVerticalGap
/
2
;
mParams
.
mVerticalGap
=
mParams
.
mTopPadding
=
parentKeyboard
.
mVerticalGap
/
2
;
mPaneView
.
updateKeyboardGeometry
(
mParams
.
mDefaultRowHeight
);
mPaneView
.
updateKeyboardGeometry
(
mParams
.
mDefaultRowHeight
);
final
int
count
=
mParams
.
layout
(
suggestedWords
,
fromIndex
,
maxWidth
,
minWidth
,
maxRow
,
final
int
count
=
mParams
.
layout
(
suggestedWords
,
fromIndex
,
maxWidth
,
minWidth
,
maxRow
,
mPaneView
.
newLabelPaint
(
null
/* key */
),
mResources
);
mPaneView
.
newLabelPaint
(
null
/* key */
),
mResources
);
...
@@ -206,8 +216,16 @@ public final class MoreSuggestions extends Keyboard {
...
@@ -206,8 +216,16 @@ public final class MoreSuggestions extends Keyboard {
final
int
x
=
params
.
getX
(
index
);
final
int
x
=
params
.
getX
(
index
);
final
int
y
=
params
.
getY
(
index
);
final
int
y
=
params
.
getY
(
index
);
final
int
width
=
params
.
getWidth
(
index
);
final
int
width
=
params
.
getWidth
(
index
);
final
String
word
=
mSuggestedWords
.
getLabel
(
index
);
final
String
word
;
final
String
info
=
mSuggestedWords
.
getDebugString
(
index
);
final
String
info
;
if
(
isIndexSubjectToAutoCorrection
(
mSuggestedWords
,
index
))
{
// INDEX_OF_AUTO_CORRECTION and INDEX_OF_TYPED_WORD got swapped.
word
=
mSuggestedWords
.
getLabel
(
SuggestedWords
.
INDEX_OF_TYPED_WORD
);
info
=
mSuggestedWords
.
getDebugString
(
SuggestedWords
.
INDEX_OF_TYPED_WORD
);
}
else
{
word
=
mSuggestedWords
.
getLabel
(
index
);
info
=
mSuggestedWords
.
getDebugString
(
index
);
}
final
int
indexInMoreSuggestions
=
index
+
SUGGESTION_CODE_BASE
;
final
int
indexInMoreSuggestions
=
index
+
SUGGESTION_CODE_BASE
;
final
Key
key
=
new
Key
(
word
,
KeyboardIconsSet
.
ICON_UNDEFINED
,
final
Key
key
=
new
Key
(
word
,
KeyboardIconsSet
.
ICON_UNDEFINED
,
indexInMoreSuggestions
,
null
/* outputText */
,
info
,
0
/* labelFlags */
,
indexInMoreSuggestions
,
null
/* outputText */
,
info
,
0
/* labelFlags */
,
...
...
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