diff options
author | 2011-01-18 15:49:17 +0000 | |
---|---|---|
committer | 2011-01-18 15:49:17 +0000 | |
commit | bbd651a00898dabf6b2ae0e715d99953ea81063f (patch) | |
tree | f586647143ff2df64dfb44e57533599f86e66d0a /java/src/com/android/inputmethod/voice/VoiceInput.java | |
parent | da9eb5946c0b0a9050f63c5caf13cc50011c0caf (diff) | |
download | latinime-bbd651a00898dabf6b2ae0e715d99953ea81063f.tar.gz latinime-bbd651a00898dabf6b2ae0e715d99953ea81063f.tar.xz latinime-bbd651a00898dabf6b2ae0e715d99953ea81063f.zip |
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
Diffstat (limited to 'java/src/com/android/inputmethod/voice/VoiceInput.java')
-rw-r--r-- | java/src/com/android/inputmethod/voice/VoiceInput.java | 13 |
1 files changed, 10 insertions, 3 deletions
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(); |