diff options
author | Dianne Hackborn <hackbod@google.com> | 2009-09-12 23:38:30 -0700 |
---|---|---|
committer | Dianne Hackborn <hackbod@google.com> | 2009-09-14 17:53:52 -0700 |
commit | 83fe3f559249451706957b1a5f660b2b8272f114 (patch) | |
tree | 1693c610256fbe8fea20da55c21458d65ced98ef /core/java/android/inputmethodservice/SoftInputWindow.java | |
parent | c2974809373697147cbe5754835cc871fb93aef1 (diff) | |
download | frameworks_base-83fe3f559249451706957b1a5f660b2b8272f114.zip frameworks_base-83fe3f559249451706957b1a5f660b2b8272f114.tar.gz frameworks_base-83fe3f559249451706957b1a5f660b2b8272f114.tar.bz2 |
Last big work on #1991910: Make swipes work with capacitive keys
This takes care of allowing us to cancel the back button. The
back button is a bear because it is strewn all over the place --
everywhere you can close something, there is some code looking
for the back button that now needs to deal with being canceled.
The main things changed are activity (of course), dialog,
input method, search dialog. There are some other misc places
in the framework (and some I missed here that I will get in a
second pass).
To facility all of this, the key dispatching APIs now provide
a lot more support for dealing with looking for cancelled keys,
and incidentally also provide an actual API for catching long
key presses. This also helped clean up the code in PhoneWindow
where it deals with all of the combinations of key pressed and
releases. (And also allows people to override
Activity.onKeyLongPress() to provide a different long press
action for a standard key like search.)
And while I was doing this, I reworked how we detect long
presses by having this be part of the key event delivered by
the window manager. This should greatly reduce (hopefully
outright eliminate) the problems with long presses being
mis-detected when an application is being slow.
Change-Id: Ia19066b8d588d573df3eee6d96e1c90fdc19f57d
Diffstat (limited to 'core/java/android/inputmethodservice/SoftInputWindow.java')
-rw-r--r-- | core/java/android/inputmethodservice/SoftInputWindow.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/core/java/android/inputmethodservice/SoftInputWindow.java b/core/java/android/inputmethodservice/SoftInputWindow.java index d91ace6..6a54846 100644 --- a/core/java/android/inputmethodservice/SoftInputWindow.java +++ b/core/java/android/inputmethodservice/SoftInputWindow.java @@ -21,6 +21,7 @@ import android.content.Context; import android.content.pm.ActivityInfo; import android.os.IBinder; import android.view.Gravity; +import android.view.KeyEvent; import android.view.WindowManager; /** @@ -30,7 +31,8 @@ import android.view.WindowManager; * always visible. */ class SoftInputWindow extends Dialog { - + final KeyEvent.DispatcherState mDispatcherState; + public void setToken(IBinder token) { WindowManager.LayoutParams lp = getWindow().getAttributes(); lp.token = token; @@ -49,11 +51,19 @@ class SoftInputWindow extends Dialog { * using styles. This theme is applied on top of the current theme in * <var>context</var>. If 0, the default dialog theme will be used. */ - public SoftInputWindow(Context context, int theme) { + public SoftInputWindow(Context context, int theme, + KeyEvent.DispatcherState dispatcherState) { super(context, theme); + mDispatcherState = dispatcherState; initDockWindow(); } + @Override + public void onWindowFocusChanged(boolean hasFocus) { + super.onWindowFocusChanged(hasFocus); + mDispatcherState.reset(); + } + /** * Get the size of the DockWindow. * |