Merge "Direct Reply: Allow closing IME separately from DirectReply mode" into nyc-mr1-dev

This commit is contained in:
TreeHugger Robot
2016-07-20 23:29:17 +00:00
committed by Android (Google) Code Review
2 changed files with 20 additions and 11 deletions

View File

@@ -190,6 +190,12 @@ public class StatusBarWindowView extends FrameLayout {
@Override @Override
public boolean dispatchKeyEvent(KeyEvent event) { public boolean dispatchKeyEvent(KeyEvent event) {
if (mService.interceptMediaKey(event)) {
return true;
}
if (super.dispatchKeyEvent(event)) {
return true;
}
boolean down = event.getAction() == KeyEvent.ACTION_DOWN; boolean down = event.getAction() == KeyEvent.ACTION_DOWN;
switch (event.getKeyCode()) { switch (event.getKeyCode()) {
case KeyEvent.KEYCODE_BACK: case KeyEvent.KEYCODE_BACK:
@@ -214,10 +220,7 @@ public class StatusBarWindowView extends FrameLayout {
} }
break; break;
} }
if (mService.interceptMediaKey(event)) { return false;
return true;
}
return super.dispatchKeyEvent(event);
} }
@Override @Override

View File

@@ -366,7 +366,6 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
* @return true if a matching action was found, false otherwise * @return true if a matching action was found, false otherwise
*/ */
public boolean updatePendingIntentFromActions(Notification.Action[] actions) { public boolean updatePendingIntentFromActions(Notification.Action[] actions) {
boolean found = false;
if (mPendingIntent == null || actions == null) { if (mPendingIntent == null || actions == null) {
return false; return false;
} }
@@ -473,14 +472,21 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
} }
@Override @Override
public boolean onKeyPreIme(int keyCode, KeyEvent event) { public boolean onKeyDown(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_UP) { if (keyCode == KeyEvent.KEYCODE_BACK) {
defocusIfNeeded(true /* animate */); // Eat the DOWN event here to prevent any default behavior.
final InputMethodManager imm = InputMethodManager.getInstance();
imm.hideSoftInputFromWindow(getWindowToken(), 0);
return true; return true;
} }
return super.onKeyPreIme(keyCode, event); return super.onKeyDown(keyCode, event);
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_BACK) {
defocusIfNeeded(true /* animate */);
return true;
}
return super.onKeyUp(keyCode, event);
} }
@Override @Override