From bbd651a00898dabf6b2ae0e715d99953ea81063f Mon Sep 17 00:00:00 2001 From: Luca Zanolin Date: Tue, 18 Jan 2011 15:49:17 +0000 Subject: Change the UI of Voice IME to be more like Voice Search. There has been a bit of refactoring in RecognitionView in particular to fix the portrait layout. The main issues found were: - the size of the keyboard is specified in inches, and (cm)(inches + inches) != ((cm) inches) + ((cm) inches)) - the height of keyboard background is high as the landscape keyboard, but it higher than the portrait keyboard. This is not an issue on LatinKeyboard, as it overwrite the onMeasure method. However, if I use the same image background in RelativeLayout the Relative layout height is set to the height of the background, thus higher than the keyboard - the change configuration was not propageted correctly Change-Id: Id5dca425826997c573ccae7a085d5ddc9719733b --- java/src/com/android/inputmethod/voice/VoiceInput.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'java/src/com/android/inputmethod/voice/VoiceInput.java') diff --git a/java/src/com/android/inputmethod/voice/VoiceInput.java b/java/src/com/android/inputmethod/voice/VoiceInput.java index f77b4dd0d..ffa349fde 100644 --- a/java/src/com/android/inputmethod/voice/VoiceInput.java +++ b/java/src/com/android/inputmethod/voice/VoiceInput.java @@ -22,6 +22,7 @@ import com.android.inputmethod.latin.R; import android.content.ContentResolver; import android.content.Context; import android.content.Intent; +import android.content.res.Configuration; import android.os.Build; import android.os.Bundle; import android.os.Handler; @@ -129,12 +130,17 @@ public class VoiceInput implements OnClickListener { private final static int MSG_CLOSE_ERROR_DIALOG = 1; + private final static int MSG_RESET = 2; + private final Handler mHandler = new Handler() { @Override public void handleMessage(Message msg) { - if (msg.what == MSG_CLOSE_ERROR_DIALOG) { + if (msg.what == MSG_RESET || msg.what == MSG_CLOSE_ERROR_DIALOG) { mState = DEFAULT; mRecognitionView.finish(); + } + + if (msg.what == MSG_CLOSE_ERROR_DIALOG) { mUiListener.onCancelVoice(); } } @@ -277,8 +283,9 @@ public class VoiceInput implements OnClickListener { * The configuration of the IME changed and may have caused the views to be layed out * again. Restore the state of the recognition view. */ - public void onConfigurationChanged() { + public void onConfigurationChanged(Configuration configuration) { mRecognitionView.restoreState(); + mRecognitionView.getView().dispatchConfigurationChanged(configuration); } /** @@ -509,7 +516,7 @@ public class VoiceInput implements OnClickListener { mState = DEFAULT; // Remove all pending tasks (e.g., timers to cancel voice input) - mHandler.removeMessages(MSG_CLOSE_ERROR_DIALOG); + mHandler.removeMessages(MSG_RESET); mSpeechRecognizer.cancel(); mUiListener.onCancelVoice(); -- cgit v1.2.3-83-g751a