Merge "Allow menu to hide upon pressing ESC." into rvc-dev

This commit is contained in:
TreeHugger Robot
2020-03-06 01:41:27 +00:00
committed by Android (Google) Code Review

View File

@@ -60,6 +60,7 @@ import android.os.RemoteException;
import android.os.UserHandle; import android.os.UserHandle;
import android.util.Log; import android.util.Log;
import android.util.Pair; import android.util.Pair;
import android.view.KeyEvent;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
@@ -225,6 +226,15 @@ public class PipMenuActivity extends Activity {
getWindow().setExitTransition(null); getWindow().setExitTransition(null);
} }
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
if (keyCode == KeyEvent.KEYCODE_ESCAPE) {
hideMenu();
return true;
}
return super.onKeyUp(keyCode, event);
}
@Override @Override
protected void onNewIntent(Intent intent) { protected void onNewIntent(Intent intent) {
super.onNewIntent(intent); super.onNewIntent(intent);