aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/com/android/inputmethod/voice/VoiceInput.java
diff options
context:
space:
mode:
authorsatok <satok@google.com>2010-12-27 20:13:16 +0900
committersatok <satok@google.com>2010-12-27 20:13:16 +0900
commitd12def6dc8ba3a2f47b90e6d5d442f315152c6d4 (patch)
tree7274b29f518f94d31cd5c995d1b46bfc323de818 /java/src/com/android/inputmethod/voice/VoiceInput.java
parentb80f171623a11bceb99b563594162d0034b9bde8 (diff)
parentbfe2b534457d946645d483e311249787ba4fc3ae (diff)
downloadlatinime-d12def6dc8ba3a2f47b90e6d5d442f315152c6d4.tar.gz
latinime-d12def6dc8ba3a2f47b90e6d5d442f315152c6d4.tar.xz
latinime-d12def6dc8ba3a2f47b90e6d5d442f315152c6d4.zip
Merge remote branch 'goog/master' into merge
Conflicts: java/res/values-cs/strings.xml java/res/values-da/strings.xml java/res/values-de/strings.xml java/res/values-el/strings.xml java/res/values-es-rUS/strings.xml java/res/values-es/strings.xml java/res/values-fr/strings.xml java/res/values-it/strings.xml java/res/values-ja/strings.xml java/res/values-ko/strings.xml java/res/values-nb/strings.xml java/res/values-nl/strings.xml java/res/values-pl/strings.xml java/res/values-pt-rPT/strings.xml java/res/values-pt/strings.xml java/res/values-ru/strings.xml java/res/values-sv/strings.xml java/res/values-tr/strings.xml java/res/values-xlarge/dimens.xml java/res/values-zh-rCN/strings.xml java/res/values-zh-rTW/strings.xml java/res/values/bools.xml java/res/xml/kbd_qwerty_rows.xml java/res/xml/method.xml java/res/xml/prefs.xml Change-Id: I8768d16965e6e82c14ee742b9ada56438497eb86
Diffstat (limited to 'java/src/com/android/inputmethod/voice/VoiceInput.java')
-rw-r--r--java/src/com/android/inputmethod/voice/VoiceInput.java26
1 files changed, 19 insertions, 7 deletions
diff --git a/java/src/com/android/inputmethod/voice/VoiceInput.java b/java/src/com/android/inputmethod/voice/VoiceInput.java
index 4c54dd3c5..f77b4dd0d 100644
--- a/java/src/com/android/inputmethod/voice/VoiceInput.java
+++ b/java/src/com/android/inputmethod/voice/VoiceInput.java
@@ -16,7 +16,7 @@
package com.android.inputmethod.voice;
-import com.android.inputmethod.latin.EditingUtil;
+import com.android.inputmethod.latin.EditingUtils;
import com.android.inputmethod.latin.R;
import android.content.ContentResolver;
@@ -28,12 +28,12 @@ import android.os.Handler;
import android.os.Message;
import android.os.Parcelable;
import android.speech.RecognitionListener;
-import android.speech.SpeechRecognizer;
import android.speech.RecognizerIntent;
+import android.speech.SpeechRecognizer;
import android.util.Log;
-import android.view.inputmethod.InputConnection;
import android.view.View;
import android.view.View.OnClickListener;
+import android.view.inputmethod.InputConnection;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
@@ -86,6 +86,7 @@ public class VoiceInput implements OnClickListener {
private static final String ALTERNATES_BUNDLE = "alternates_bundle";
// This is copied from the VoiceSearch app.
+ @SuppressWarnings("unused")
private static final class AlternatesBundleKeys {
public static final String ALTERNATES = "alternates";
public static final String CONFIDENCE = "confidence";
@@ -240,7 +241,7 @@ public class VoiceInput implements OnClickListener {
}
public void incrementTextModificationInsertPunctuationCount(int count){
- mAfterVoiceInputInsertPunctuationCount += 1;
+ mAfterVoiceInputInsertPunctuationCount += count;
if (mAfterVoiceInputSelectionSpan > 0) {
// If text was highlighted before inserting the char, count this as
// a delete.
@@ -405,6 +406,7 @@ public class VoiceInput implements OnClickListener {
/**
* Handle the cancel button.
*/
+ @Override
public void onClick(View view) {
switch(view.getId()) {
case R.id.button:
@@ -427,8 +429,7 @@ public class VoiceInput implements OnClickListener {
public void logTextModifiedByChooseSuggestion(String suggestion, int index,
String wordSeparators, InputConnection ic) {
- EditingUtil.Range range = new EditingUtil.Range();
- String wordToBeReplaced = EditingUtil.getWordAtCursor(ic, wordSeparators, range);
+ String wordToBeReplaced = EditingUtils.getWordAtCursor(ic, wordSeparators);
// If we enable phrase-based alternatives, only send up the first word
// in suggestion and wordToBeReplaced.
mLogger.textModifiedByChooseSuggestion(suggestion.length(), wordToBeReplaced.length(),
@@ -556,36 +557,45 @@ public class VoiceInput implements OnClickListener {
int mSpeechStart;
private boolean mEndpointed = false;
+ @Override
public void onReadyForSpeech(Bundle noiseParams) {
mRecognitionView.showListening();
}
+ @Override
public void onBeginningOfSpeech() {
mEndpointed = false;
mSpeechStart = mWaveBuffer.size();
}
+ @Override
public void onRmsChanged(float rmsdB) {
mRecognitionView.updateVoiceMeter(rmsdB);
}
+ @Override
public void onBufferReceived(byte[] buf) {
try {
mWaveBuffer.write(buf);
- } catch (IOException e) {}
+ } catch (IOException e) {
+ // ignore.
+ }
}
+ @Override
public void onEndOfSpeech() {
mEndpointed = true;
mState = WORKING;
mRecognitionView.showWorking(mWaveBuffer, mSpeechStart, mWaveBuffer.size());
}
+ @Override
public void onError(int errorType) {
mState = ERROR;
VoiceInput.this.onError(errorType, mEndpointed);
}
+ @Override
public void onResults(Bundle resultsBundle) {
List<String> results = resultsBundle
.getStringArrayList(SpeechRecognizer.RESULTS_RECOGNITION);
@@ -638,10 +648,12 @@ public class VoiceInput implements OnClickListener {
mRecognitionView.finish();
}
+ @Override
public void onPartialResults(final Bundle partialResults) {
// currently - do nothing
}
+ @Override
public void onEvent(int eventType, Bundle params) {
// do nothing - reserved for events that might be added in the future
}