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
ec8b27fe
Commit
ec8b27fe
authored
12 years ago
by
Jean Chalard
Browse files
Options
Downloads
Patches
Plain Diff
Cut out a method for clarity
Change-Id: I1dc668698a5cd840297e713a26a525f5e32d35d6
parent
0131170d
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/Suggest.java
+25
-13
25 additions, 13 deletions
java/src/com/android/inputmethod/latin/Suggest.java
with
25 additions
and
13 deletions
java/src/com/android/inputmethod/latin/Suggest.java
+
25
−
13
View file @
ec8b27fe
...
...
@@ -427,26 +427,38 @@ public class Suggest {
return
true
;
}
final
StringBuilder
sb
=
new
StringBuilder
(
getApproxMaxWordLength
());
if
(
mIsAllUpperCase
)
{
sb
.
append
(
word
.
toString
().
toUpperCase
(
mLocale
));
}
else
if
(
mIsFirstCharCapitalized
)
{
sb
.
append
(
StringUtils
.
toTitleCase
(
word
.
toString
(),
mLocale
));
}
else
{
sb
.
append
(
word
);
}
for
(
int
i
=
mTrailingSingleQuotesCount
-
1
;
i
>=
0
;
--
i
)
{
sb
.
appendCodePoint
(
Keyboard
.
CODE_SINGLE_QUOTE
);
}
suggestions
.
add
(
pos
,
new
SuggestedWordInfo
(
sb
,
score
,
wordInfo
.
mKind
));
final
SuggestedWordInfo
transformedWordInfo
=
getTransformedSuggestedWordInfo
(
wordInfo
,
mLocale
,
mIsAllUpperCase
,
mIsFirstCharCapitalized
,
mTrailingSingleQuotesCount
);
suggestions
.
add
(
pos
,
transformedWordInfo
);
if
(
suggestions
.
size
()
>
prefMaxSuggestions
)
{
suggestions
.
remove
(
prefMaxSuggestions
);
}
else
{
LatinImeLogger
.
onAddSuggestedWord
(
sb
.
toString
(),
dicTypeId
,
dataTypeForLog
);
LatinImeLogger
.
onAddSuggestedWord
(
transformedWordInfo
.
mWord
.
toString
(),
dicTypeId
,
dataTypeForLog
);
}
return
true
;
}
private
static
SuggestedWordInfo
getTransformedSuggestedWordInfo
(
final
SuggestedWordInfo
wordInfo
,
final
Locale
locale
,
final
boolean
isAllUpperCase
,
final
boolean
isFirstCharCapitalized
,
final
int
trailingSingleQuotesCount
)
{
if
(!
isFirstCharCapitalized
&&
!
isAllUpperCase
&&
0
==
trailingSingleQuotesCount
)
{
return
wordInfo
;
}
final
StringBuilder
sb
=
new
StringBuilder
(
getApproxMaxWordLength
());
if
(
isAllUpperCase
)
{
sb
.
append
(
wordInfo
.
mWord
.
toString
().
toUpperCase
(
locale
));
}
else
if
(
isFirstCharCapitalized
)
{
sb
.
append
(
StringUtils
.
toTitleCase
(
wordInfo
.
mWord
.
toString
(),
locale
));
}
else
{
sb
.
append
(
wordInfo
.
mWord
);
}
for
(
int
i
=
trailingSingleQuotesCount
-
1
;
i
>=
0
;
--
i
)
{
sb
.
appendCodePoint
(
Keyboard
.
CODE_SINGLE_QUOTE
);
}
return
new
SuggestedWordInfo
(
sb
,
wordInfo
.
mScore
,
wordInfo
.
mKind
);
}
public
void
close
()
{
final
HashSet
<
Dictionary
>
dictionaries
=
new
HashSet
<
Dictionary
>();
dictionaries
.
addAll
(
mDictionaries
.
values
());
...
...
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