下面是我的活动代码。在一个具有可拖动面板的面板上,附加了exoplayer片段。如果我将视频最小化,视频将继续在左下角(如youtube)上运行。在视频后面会显示空白屏幕。相反,如果我最小化视频,则视频应在左下角播放,并且需要显示prevoius活动之后。我该怎么办?
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
draggablepanel = (DraggablePanel)findViewById(R.id.draggable_panel);
rl = (RelativeLayout)findViewById(R.id.rl);
rl.setVisibility(View.INVISIBLE);
hookDraggableListener();
initializeDraggablepanel();
}
public void hookDraggableListener(){
draggablepanel.setDraggableListener(new DraggableListener() {
@Override
public void onMaximized() {
rl.setVisibility(View.INVISIBLE);
}
@Override
public void onMinimized() {
}
@Override
public void onClosedToLeft() {
closePlayer();
Intent i = new Intent(MainActivity.this,HomeScreen.class);
startActivity(i);
}
@Override
public void onClosedToRight() {
closePlayer();
Intent i = new Intent(MainActivity.this,HomeScreen.class);
startActivity(i);
}
});
}
public void initializeDraggablepanel(){
draggablepanel.setFragmentManager(getSupportFragmentManager());
draggablepanel.setTopFragment(new DragpanelFragOne());
draggablepanel.setBottomFragment(new DragPanelTwo());
draggablepanel.setTopViewHeight(550);
draggablepanel.initializeView();
}
@Override
public void onPause() {
super.onPause();
}
@Override
public void onStop() {
super.onStop();
}
@Override
public void onBackPressed() {
Intent i = new Intent(MainActivity.this,HomeScreen.class);
startActivity(i);
}
public static void closePlayer() {
if (DragpanelFragOne.exoplayer != null) {
DragpanelFragOne.exoplayer.setPlayWhenReady(false);
DragpanelFragOne.exoplayer.stop();
DragpanelFragOne.exoplayer.seekTo(0);
}
DragpanelFragOne.exoplayer.clearVideoSurface(); }
}