|
25 | 25 | import android.util.AttributeSet; |
26 | 26 | import android.util.Slog; |
27 | 27 | import android.view.Gravity; |
| 28 | +import android.view.KeyEvent; |
28 | 29 | import android.view.LayoutInflater; |
29 | 30 | import android.view.MotionEvent; |
30 | 31 | import android.view.View; |
|
34 | 35 | import android.view.animation.DecelerateInterpolator; |
35 | 36 | import android.view.animation.Interpolator; |
36 | 37 | import android.widget.RelativeLayout; |
37 | | -import android.widget.ScrollView; |
38 | 38 |
|
39 | 39 | import com.android.systemui.ExpandHelper; |
40 | 40 | import com.android.systemui.R; |
@@ -197,6 +197,27 @@ public boolean dispatchHoverEvent(MotionEvent event) { |
197 | 197 | return true; |
198 | 198 | } |
199 | 199 |
|
| 200 | + @Override |
| 201 | + public boolean dispatchKeyEvent(KeyEvent event) { |
| 202 | + final int keyCode = event.getKeyCode(); |
| 203 | + switch (keyCode) { |
| 204 | + // We exclusively handle the back key by hiding this panel. |
| 205 | + case KeyEvent.KEYCODE_BACK: { |
| 206 | + if (event.getAction() == KeyEvent.ACTION_UP) { |
| 207 | + mBar.animateCollapse(); |
| 208 | + } |
| 209 | + return true; |
| 210 | + } |
| 211 | + // We react to the home key but let the system handle it. |
| 212 | + case KeyEvent.KEYCODE_HOME: { |
| 213 | + if (event.getAction() == KeyEvent.ACTION_UP) { |
| 214 | + mBar.animateCollapse(); |
| 215 | + } |
| 216 | + } break; |
| 217 | + } |
| 218 | + return super.dispatchKeyEvent(event); |
| 219 | + } |
| 220 | + |
200 | 221 | /* |
201 | 222 | @Override |
202 | 223 | protected void onLayout(boolean changed, int l, int t, int r, int b) { |
|
0 commit comments