diff options
author | Christine Chen <christinech@google.com> | 2013-09-20 17:46:37 -0700 |
---|---|---|
committer | Christine Chen <christinech@google.com> | 2013-09-23 12:22:36 -0700 |
commit | c60103d277b6656729b8f8c3f7168da31c7bffa7 (patch) | |
tree | ab7c7ba1b22016bd75c960140e6b2f9c052ef760 /InCallUI/src/com/android/incallui/InCallActivity.java | |
parent | d9ba6ebfeb47fa94e19271179fbe295b381cc7bc (diff) |
Adds hardware keyboard support for DTMF
Bug: 10808399
Change-Id: Id12acee7baf11335916a38c50a266f83f578e0bd
Diffstat (limited to 'InCallUI/src/com/android/incallui/InCallActivity.java')
-rw-r--r-- | InCallUI/src/com/android/incallui/InCallActivity.java | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/InCallUI/src/com/android/incallui/InCallActivity.java b/InCallUI/src/com/android/incallui/InCallActivity.java index d2a7f21ab..41e01fff7 100644 --- a/InCallUI/src/com/android/incallui/InCallActivity.java +++ b/InCallUI/src/com/android/incallui/InCallActivity.java @@ -82,7 +82,7 @@ public class InCallActivity extends Activity { @Override protected void onResume() { - Log.d(this, "onResume()..."); + Log.i(this, "onResume()..."); super.onResume(); mIsForegroundActivity = true; @@ -102,6 +102,9 @@ public class InCallActivity extends Activity { super.onPause(); mIsForegroundActivity = false; + + mDialpadFragment.onDialerKeyUp(null); + InCallPresenter.getInstance().onUiShowing(false); } @@ -189,6 +192,18 @@ public class InCallActivity extends Activity { } @Override + public boolean onKeyUp(int keyCode, KeyEvent event) { + // push input to the dialer. + if ((mDialpadFragment.isVisible()) && (mDialpadFragment.onDialerKeyUp(event))){ + return true; + } else if (keyCode == KeyEvent.KEYCODE_CALL) { + // Always consume CALL to be sure the PhoneWindow won't do anything with it + return true; + } + return super.onKeyUp(keyCode, event); + } + + @Override public boolean onKeyDown(int keyCode, KeyEvent event) { switch (keyCode) { case KeyEvent.KEYCODE_CALL: @@ -238,9 +253,33 @@ public class InCallActivity extends Activity { break; } + if (event.getRepeatCount() == 0 && handleDialerKeyDown(keyCode, event)) { + return true; + } + return super.onKeyDown(keyCode, event); } + private boolean handleDialerKeyDown(int keyCode, KeyEvent event) { + Log.v(this, "handleDialerKeyDown: keyCode " + keyCode + ", event " + event + "..."); + + // As soon as the user starts typing valid dialable keys on the + // keyboard (presumably to type DTMF tones) we start passing the + // key events to the DTMFDialer's onDialerKeyDown. + if (mDialpadFragment.isVisible()) { + return mDialpadFragment.onDialerKeyDown(event); + + // TODO: If the dialpad isn't currently visible, maybe + // consider automatically bringing it up right now? + // (Just to make sure the user sees the digits widget...) + // But this probably isn't too critical since it's awkward to + // use the hard keyboard while in-call in the first place, + // especially now that the in-call UI is portrait-only... + } + + return false; + } + @Override public void onConfigurationChanged(Configuration config) { InCallPresenter.getInstance().getProximitySensor().onConfigurationChanged(config); |