@Override protected void onResume() { super.onResume(); if (!mMp.hasActiveVideo()) { // There is no video to play. // So, exit from video player // (Video player doens't have any interface for starting new videos) finish(); return; } setController(true); // This is for workaround SlidingDrawer bug of Android Widget. // // Even if Visibility of SlidingDrawer is set to "GONE" here or "layout xml" // 'handler' of SlidingDrawer is still shown!! // Without below code, handler View of SlidingDrawer is always shown // even if after 'hideController()' is called. // Step for issues. // - enter this activity by viewing video // - touching outside controller to hide controller. // - turn off backlight by pushing power key // - turn on backlight again and this activity is resumed. // ==> Handler View of SlidingDrawer is shown. // // To workaround above issue, visibility of user-interface is set at onWindowFocusChanged. mDelayedSetIfVisibility = true; }
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); UnexpectedExceptionHandler.get().registerModule(this); setContentView(R.layout.videoplayer); mSurfv = (SurfaceView) findViewById(R.id.surface); mMp.setSurfaceHolder(mSurfv.getHolder()); findViewById(R.id.touch_ground) .setOnClickListener( new View.OnClickListener() { @Override public void onClick(View v) { if (DBG) P.v("touch_ground : On Click"); updateUserInterfaceVisibility(!isUserInterfaceVisible()); } }); if (mMp.hasActiveVideo()) getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON); if (sNavUiCanBeHidden) setOnSystemUiVisibilityChangeListener(); mMp.addPlayerStateListener(this, this); mMp.addVideosStateListener(this, this); }