fix surfaceview not registered for context menu

This commit is contained in:
Andrew Dolgov 2015-12-03 13:47:29 +03:00
parent d430e7e49b
commit a7106ca240

View File

@ -56,6 +56,7 @@ public class VideoPlayerActivity extends CommonActivity {
getSupportActionBar().hide(); getSupportActionBar().hide();
surfaceView = (SurfaceView) findViewById(R.id.video_player); surfaceView = (SurfaceView) findViewById(R.id.video_player);
registerForContextMenu(surfaceView);
setTitle(getIntent().getStringExtra("title")); setTitle(getIntent().getStringExtra("title"));
@ -215,20 +216,22 @@ public class VideoPlayerActivity extends CommonActivity {
e.printStackTrace(); e.printStackTrace();
} }
mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() { mediaPlayer.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
@Override @Override
public void onPrepared(MediaPlayer mp) { public void onPrepared(MediaPlayer mp) {
View loadingBar = findViewById(R.id.video_loading); View loadingBar = findViewById(R.id.video_loading);
if (loadingBar != null) loadingBar.setVisibility(View.GONE); if (loadingBar != null)
loadingBar.setVisibility(View.GONE);
View coverView = findViewById(R.id.video_player_cover); View coverView = findViewById(R.id.video_player_cover);
if (coverView != null) coverView.setVisibility(View.GONE); if (coverView != null)
coverView.setVisibility(View.GONE);
resizeSurface(); resizeSurface();
mp.setLooping(true); mp.setLooping(true);
mp.start(); mp.start();
} }
} }
); );
} }
@ -245,7 +248,8 @@ public class VideoPlayerActivity extends CommonActivity {
}); });
mediaController.setAnchorView(surfaceView); mediaController.setAnchorView(surfaceView);
} }
public void onConfigurationChanged(Configuration newConfig) { public void onConfigurationChanged(Configuration newConfig) {