Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.content.browser; | 5 package org.chromium.content.browser; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.graphics.Color; | 8 import android.graphics.Color; |
| 9 import android.view.KeyEvent; | 9 import android.view.KeyEvent; |
| 10 import android.view.MotionEvent; | 10 import android.view.MotionEvent; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 120 } else if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP | 120 } else if (keyCode == KeyEvent.KEYCODE_MEDIA_STOP |
| 121 || keyCode == KeyEvent.KEYCODE_MEDIA_PAUSE) { | 121 || keyCode == KeyEvent.KEYCODE_MEDIA_PAUSE) { |
| 122 if (isPlaying()) { | 122 if (isPlaying()) { |
| 123 pause(); | 123 pause(); |
| 124 mMediaController.show(); | 124 mMediaController.show(); |
| 125 } | 125 } |
| 126 return true; | 126 return true; |
| 127 } else { | 127 } else { |
| 128 toggleMediaControlsVisiblity(); | 128 toggleMediaControlsVisiblity(); |
| 129 } | 129 } |
| 130 } else if (keyCode == KeyEvent.KEYCODE_BACK && | 130 } else if (keyCode == KeyEvent.KEYCODE_BACK && |
|
jdduke (slow)
2014/08/22 18:01:43
Can you combine the ESCAPE keyCode check with this
divya.bansal
2014/08/25 06:53:03
Done.
| |
| 131 event.getAction() == KeyEvent.ACTION_UP) { | 131 event.getAction() == KeyEvent.ACTION_UP) { |
| 132 exitFullscreen(false); | 132 exitFullscreen(false); |
| 133 return true; | 133 return true; |
| 134 } else if (keyCode == KeyEvent.KEYCODE_ESCAPE && | |
| 135 event.getAction() == KeyEvent.ACTION_UP) { | |
| 136 exitFullscreen(false); | |
| 137 return true; | |
| 134 } else if (keyCode == KeyEvent.KEYCODE_MENU || keyCode == KeyEve nt.KEYCODE_SEARCH) { | 138 } else if (keyCode == KeyEvent.KEYCODE_MENU || keyCode == KeyEve nt.KEYCODE_SEARCH) { |
| 135 return true; | 139 return true; |
| 136 } | 140 } |
| 137 return false; | 141 return false; |
| 138 } | 142 } |
| 139 }); | 143 }); |
| 140 setOnTouchListener(new OnTouchListener() { | 144 setOnTouchListener(new OnTouchListener() { |
| 141 @Override | 145 @Override |
| 142 public boolean onTouch(View v, MotionEvent event) { | 146 public boolean onTouch(View v, MotionEvent event) { |
| 143 if (isInPlaybackState() && mMediaController != null && | 147 if (isInPlaybackState() && mMediaController != null && |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 293 /** | 297 /** |
| 294 * Sets the MediaControlsVisibilityListener that wants to listen to visibili ty change events. | 298 * Sets the MediaControlsVisibilityListener that wants to listen to visibili ty change events. |
| 295 * | 299 * |
| 296 * @param listener the listener to send the events to. | 300 * @param listener the listener to send the events to. |
| 297 */ | 301 */ |
| 298 public void setListener(MediaControlsVisibilityListener listener) { | 302 public void setListener(MediaControlsVisibilityListener listener) { |
| 299 mListener = listener; | 303 mListener = listener; |
| 300 } | 304 } |
| 301 | 305 |
| 302 } | 306 } |
| OLD | NEW |