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
dd8ca1f8
Commit
dd8ca1f8
authored
12 years ago
by
Satoshi Kataoka
Committed by
Android Git Automerger
12 years ago
Browse files
Options
Downloads
Plain Diff
am
bc586fb1
: am
0b327101
: Merge "Fix possible NPE"
* commit '
bc586fb1
': Fix possible NPE
parents
56b1bd86
bc586fb1
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/LatinIME.java
+21
-19
21 additions, 19 deletions
java/src/com/android/inputmethod/latin/LatinIME.java
with
21 additions
and
19 deletions
java/src/com/android/inputmethod/latin/LatinIME.java
+
21
−
19
View file @
dd8ca1f8
...
@@ -156,7 +156,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
...
@@ -156,7 +156,7 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
private
PositionalInfoForUserDictPendingAddition
private
PositionalInfoForUserDictPendingAddition
mPositionalInfoForUserDictPendingAddition
=
null
;
mPositionalInfoForUserDictPendingAddition
=
null
;
private
final
WordComposer
mWordComposer
=
new
WordComposer
();
private
final
WordComposer
mWordComposer
=
new
WordComposer
();
private
RichInputConnection
mConnection
=
new
RichInputConnection
(
this
);
private
final
RichInputConnection
mConnection
=
new
RichInputConnection
(
this
);
// Keep track of the last selection range to decide if we need to show word alternatives
// Keep track of the last selection range to decide if we need to show word alternatives
private
static
final
int
NOT_A_CURSOR_POSITION
=
-
1
;
private
static
final
int
NOT_A_CURSOR_POSITION
=
-
1
;
...
@@ -2297,25 +2297,27 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
...
@@ -2297,25 +2297,27 @@ public final class LatinIME extends InputMethodService implements KeyboardAction
// expect to receive non-words.
// expect to receive non-words.
if
(!
mSettings
.
getCurrent
().
mCorrectionEnabled
)
return
null
;
if
(!
mSettings
.
getCurrent
().
mCorrectionEnabled
)
return
null
;
final
Suggest
suggest
=
mSuggest
;
final
UserHistoryDictionary
userHistoryDictionary
=
mUserHistoryDictionary
;
final
UserHistoryDictionary
userHistoryDictionary
=
mUserHistoryDictionary
;
if
(
userHistoryDictionary
!=
null
)
{
if
(
suggest
==
null
||
userHistoryDictionary
==
null
)
{
final
String
prevWord
// Avoid concurrent issue
=
mConnection
.
getNthPreviousWord
(
mSettings
.
getCurrent
().
mWordSeparators
,
2
);
return
null
;
final
String
secondWord
;
}
if
(
mWordComposer
.
wasAutoCapitalized
()
&&
!
mWordComposer
.
isMostlyCaps
())
{
final
String
prevWord
secondWord
=
suggestion
.
toLowerCase
(
mSubtypeSwitcher
.
getCurrentSubtypeLocale
());
=
mConnection
.
getNthPreviousWord
(
mSettings
.
getCurrent
().
mWordSeparators
,
2
);
}
else
{
final
String
secondWord
;
secondWord
=
suggestion
;
if
(
mWordComposer
.
wasAutoCapitalized
()
&&
!
mWordComposer
.
isMostlyCaps
())
{
}
secondWord
=
suggestion
.
toLowerCase
(
mSubtypeSwitcher
.
getCurrentSubtypeLocale
());
// We demote unrecognized words (frequency < 0, below) by specifying them as "invalid".
}
else
{
// We don't add words with 0-frequency (assuming they would be profanity etc.).
secondWord
=
suggestion
;
final
int
maxFreq
=
AutoCorrection
.
getMaxFrequency
(
}
mSuggest
.
getUnigramDictionaries
(),
suggestion
);
// We demote unrecognized words (frequency < 0, below) by specifying them as "invalid".
if
(
maxFreq
==
0
)
return
null
;
// We don't add words with 0-frequency (assuming they would be profanity etc.).
userHistoryDictionary
.
addToUserHistory
(
prevWord
,
secondWord
,
maxFreq
>
0
);
final
int
maxFreq
=
AutoCorrection
.
getMaxFrequency
(
return
prevWord
;
suggest
.
getUnigramDictionaries
(),
suggestion
);
}
if
(
maxFreq
==
0
)
return
null
;
return
null
;
userHistoryDictionary
.
addToUserHistory
(
prevWord
,
secondWord
,
maxFreq
>
0
);
return
prevWord
;
}
}
/**
/**
...
...
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