Hide controls when entering PiP
This commit is contained in:
parent
d42330bc7e
commit
8ab64d516a
|
@ -331,12 +331,14 @@ public class VideoplayerActivity extends MediaplayerActivity {
|
|||
}
|
||||
|
||||
@SuppressLint("NewApi")
|
||||
private void hideVideoControls() {
|
||||
private void hideVideoControls(boolean showAnimation) {
|
||||
if (showAnimation) {
|
||||
final Animation animation = AnimationUtils.loadAnimation(this, R.anim.fade_out);
|
||||
if (animation != null) {
|
||||
videoOverlay.startAnimation(animation);
|
||||
controls.startAnimation(animation);
|
||||
}
|
||||
}
|
||||
if (Build.VERSION.SDK_INT >= 14) {
|
||||
int videoviewFlag = (Build.VERSION.SDK_INT >= 16) ? View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION : 0;
|
||||
getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE | View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
|
@ -347,6 +349,10 @@ public class VideoplayerActivity extends MediaplayerActivity {
|
|||
controls.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
private void hideVideoControls() {
|
||||
hideVideoControls(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getContentViewResourceId() {
|
||||
return R.layout.videoplayer_activity;
|
||||
|
@ -375,6 +381,8 @@ public class VideoplayerActivity extends MediaplayerActivity {
|
|||
public boolean onOptionsItemSelected(MenuItem item) {
|
||||
if (item.getItemId() == R.id.player_go_to_picture_in_picture) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
getSupportActionBar().hide();
|
||||
hideVideoControls(false);
|
||||
enterPictureInPictureMode();
|
||||
}
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue