fix surfaceview not registered for context menu
This commit is contained in:
parent
d430e7e49b
commit
a7106ca240
|
@ -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) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user