aboutsummaryrefslogtreecommitdiffstats
path: root/src/com/android/inputmethod/voice/RecognitionView.java
diff options
context:
space:
mode:
authorAmith Yamasani <yamasani@google.com>2010-03-07 07:27:05 -0800
committerAmith Yamasani <yamasani@google.com>2010-03-08 16:16:08 -0800
commit81c52293f84ce475ac6b1661f4a4b92703405247 (patch)
tree127716a490d59ff6bfc8d49f3b5193bea0076f9f /src/com/android/inputmethod/voice/RecognitionView.java
parentabd5e5867c25273f32a6ffa63812b62b69d91f2d (diff)
downloadlatinime-81c52293f84ce475ac6b1661f4a4b92703405247.tar.gz
latinime-81c52293f84ce475ac6b1661f4a4b92703405247.tar.xz
latinime-81c52293f84ce475ac6b1661f4a4b92703405247.zip
Retain voice input across orientation changes. Fixes 2428545
If an configuration change happens when voice is being captured or processed, it keeps the voice input state intact and reattaches the recognition view to the input method.
Diffstat (limited to 'src/com/android/inputmethod/voice/RecognitionView.java')
-rw-r--r--src/com/android/inputmethod/voice/RecognitionView.java28
1 files changed, 20 insertions, 8 deletions
diff --git a/src/com/android/inputmethod/voice/RecognitionView.java b/src/com/android/inputmethod/voice/RecognitionView.java
index 5d4a0e0e1..1e99c3cf7 100644
--- a/src/com/android/inputmethod/voice/RecognitionView.java
+++ b/src/com/android/inputmethod/voice/RecognitionView.java
@@ -16,7 +16,12 @@
package com.android.inputmethod.voice;
-import com.android.inputmethod.latin.R;
+import java.io.ByteArrayOutputStream;
+import java.nio.ByteBuffer;
+import java.nio.ByteOrder;
+import java.nio.ShortBuffer;
+import java.util.ArrayList;
+import java.util.List;
import android.content.ContentResolver;
import android.content.Context;
@@ -35,14 +40,10 @@ import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup.MarginLayoutParams;
import android.widget.ImageView;
+import android.widget.ProgressBar;
import android.widget.TextView;
-import java.io.ByteArrayOutputStream;
-import java.nio.ByteBuffer;
-import java.nio.ByteOrder;
-import java.nio.ShortBuffer;
-import java.util.ArrayList;
-import java.util.List;
+import com.android.inputmethod.latin.R;
/**
* The user interface for the "Speak now" and "working" states.
@@ -103,7 +104,6 @@ public class RecognitionView {
LayoutInflater inflater = (LayoutInflater) context.getSystemService(
Context.LAYOUT_INFLATER_SERVICE);
mView = inflater.inflate(R.layout.recognition_status, null);
-
ContentResolver cr = context.getContentResolver();
mMinMicrophoneLevel = SettingsUtil.getSettingsFloat(
cr, SettingsUtil.LATIN_IME_MIN_MICROPHONE_LEVEL, 15.f);
@@ -139,6 +139,18 @@ public class RecognitionView {
return mView;
}
+ public void restoreState() {
+ mUiHandler.post(new Runnable() {
+ public void run() {
+ // Restart the spinner
+ if (mState == State.WORKING) {
+ ((ProgressBar)mProgress).setIndeterminate(false);
+ ((ProgressBar)mProgress).setIndeterminate(true);
+ }
+ }
+ });
+ }
+
public void showInitializing() {
mUiHandler.post(new Runnable() {
public void run() {