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
f640a975
Commit
f640a975
authored
13 years ago
by
Tadashi G. Takaoka
Browse files
Options
Downloads
Patches
Plain Diff
Fix NPE
Bug: 5067161 Change-Id: I466d40fc1bffa01efc1205a47b3330ae6f30bc66
parent
f3e76883
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/deprecated/VoiceProxy.java
+44
-21
44 additions, 21 deletions
java/src/com/android/inputmethod/deprecated/VoiceProxy.java
with
44 additions
and
21 deletions
java/src/com/android/inputmethod/deprecated/VoiceProxy.java
+
44
−
21
View file @
f640a975
...
...
@@ -158,7 +158,10 @@ public class VoiceProxy implements VoiceInput.UiListener {
}
public
void
flushVoiceInputLogs
(
boolean
configurationChanged
)
{
if
(
VOICE_INSTALLED
&&
!
configurationChanged
)
{
if
(!
VOICE_INSTALLED
)
{
return
;
}
if
(!
configurationChanged
)
{
if
(
mAfterVoiceInput
)
{
mVoiceInput
.
flushAllTextModificationCounters
();
mVoiceInput
.
logInputEnded
();
...
...
@@ -301,6 +304,9 @@ public class VoiceProxy implements VoiceInput.UiListener {
}
public
void
showPunctuationHintIfNecessary
()
{
if
(!
VOICE_INSTALLED
)
{
return
;
}
InputConnection
ic
=
mService
.
getCurrentInputConnection
();
if
(!
mImmediatelyAfterVoiceInput
&&
mAfterVoiceInput
&&
ic
!=
null
)
{
if
(
mHints
.
showPunctuationHintIfNecessary
(
ic
))
{
...
...
@@ -375,9 +381,6 @@ public class VoiceProxy implements VoiceInput.UiListener {
}
private
void
revertVoiceInput
()
{
if
(!
VOICE_INSTALLED
)
{
return
;
}
InputConnection
ic
=
mService
.
getCurrentInputConnection
();
if
(
ic
!=
null
)
ic
.
commitText
(
""
,
1
);
mService
.
updateSuggestions
();
...
...
@@ -394,7 +397,10 @@ public class VoiceProxy implements VoiceInput.UiListener {
}
public
boolean
logAndRevertVoiceInput
()
{
if
(
VOICE_INSTALLED
&&
mVoiceInputHighlighted
)
{
if
(!
VOICE_INSTALLED
)
{
return
false
;
}
if
(
mVoiceInputHighlighted
)
{
mVoiceInput
.
incrementTextModificationDeleteCount
(
mVoiceResults
.
candidates
.
get
(
0
).
toString
().
length
());
revertVoiceInput
();
...
...
@@ -505,7 +511,10 @@ public class VoiceProxy implements VoiceInput.UiListener {
}
public
void
handleClose
()
{
if
(
VOICE_INSTALLED
&
mRecognizing
)
{
if
(!
VOICE_INSTALLED
)
{
return
;
}
if
(
mRecognizing
)
{
mVoiceInput
.
cancel
();
}
}
...
...
@@ -553,6 +562,9 @@ public class VoiceProxy implements VoiceInput.UiListener {
}
public
void
switchToRecognitionStatusView
(
final
Configuration
configuration
)
{
if
(!
VOICE_INSTALLED
)
{
return
;
}
mHandler
.
post
(
new
Runnable
()
{
@Override
public
void
run
()
{
...
...
@@ -597,6 +609,9 @@ public class VoiceProxy implements VoiceInput.UiListener {
}
private
void
switchToLastInputMethod
()
{
if
(!
VOICE_INSTALLED
)
{
return
;
}
final
IBinder
token
=
mService
.
getWindow
().
getWindow
().
getAttributes
().
token
;
new
AsyncTask
<
Void
,
Void
,
Boolean
>()
{
@Override
...
...
@@ -662,14 +677,15 @@ public class VoiceProxy implements VoiceInput.UiListener {
}
public
void
startListening
(
final
boolean
swipe
,
IBinder
token
)
{
if
(!
VOICE_INSTALLED
)
{
return
;
}
// TODO: remove swipe which is no longer used.
if
(
VOICE_INSTALLED
)
{
if
(
needsToShowWarningDialog
())
{
// Calls reallyStartListening if user clicks OK, does nothing if user clicks Cancel.
showVoiceWarningDialog
(
swipe
,
token
);
}
else
{
reallyStartListening
(
swipe
);
}
if
(
needsToShowWarningDialog
())
{
// Calls reallyStartListening if user clicks OK, does nothing if user clicks Cancel.
showVoiceWarningDialog
(
swipe
,
token
);
}
else
{
reallyStartListening
(
swipe
);
}
}
...
...
@@ -704,17 +720,18 @@ public class VoiceProxy implements VoiceInput.UiListener {
mLocaleSupportedForVoiceInput
=
SubtypeSwitcher
.
getInstance
().
isVoiceSupported
(
SubtypeSwitcher
.
getInstance
().
getInputLocaleStr
());
if
(
VOICE_INSTALLED
)
{
final
String
voiceMode
=
sp
.
getString
(
PREF_VOICE_MODE
,
mService
.
getString
(
R
.
string
.
voice_mode_main
));
mVoiceButtonEnabled
=
!
voiceMode
.
equals
(
mService
.
getString
(
R
.
string
.
voice_mode_off
))
&&
shouldShowVoiceButton
(
makeFieldContext
(),
attribute
);
mVoiceButtonOnPrimary
=
voiceMode
.
equals
(
mService
.
getString
(
R
.
string
.
voice_mode_main
));
}
final
String
voiceMode
=
sp
.
getString
(
PREF_VOICE_MODE
,
mService
.
getString
(
R
.
string
.
voice_mode_main
));
mVoiceButtonEnabled
=
!
voiceMode
.
equals
(
mService
.
getString
(
R
.
string
.
voice_mode_off
))
&&
shouldShowVoiceButton
(
makeFieldContext
(),
attribute
);
mVoiceButtonOnPrimary
=
voiceMode
.
equals
(
mService
.
getString
(
R
.
string
.
voice_mode_main
));
}
public
void
destroy
()
{
if
(
VOICE_INSTALLED
&&
mVoiceInput
!=
null
)
{
if
(!
VOICE_INSTALLED
)
{
return
;
}
if
(
mVoiceInput
!=
null
)
{
mVoiceInput
.
destroy
();
}
}
...
...
@@ -826,10 +843,16 @@ public class VoiceProxy implements VoiceInput.UiListener {
}
public
void
cancel
()
{
if
(!
VOICE_INSTALLED
)
{
return
;
}
if
(
mVoiceInput
!=
null
)
mVoiceInput
.
cancel
();
}
public
void
reset
()
{
if
(!
VOICE_INSTALLED
)
{
return
;
}
if
(
mVoiceInput
!=
null
)
mVoiceInput
.
reset
();
}
}
...
...
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