From 3cf0f1460bf335b0fa979a78e4af3a651a7fbe4d Mon Sep 17 00:00:00 2001 From: Page Asgardius Date: Sun, 28 Aug 2022 05:13:00 -0700 Subject: [PATCH] immersive video player --- .../asgardius/page/s3manager/VideoPlayer.java | 17 +++++++++++++++++ .../main/res/layout/activity_video_player.xml | 4 +++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/asgardius/page/s3manager/VideoPlayer.java b/app/src/main/java/asgardius/page/s3manager/VideoPlayer.java index 552af46..25e6047 100644 --- a/app/src/main/java/asgardius/page/s3manager/VideoPlayer.java +++ b/app/src/main/java/asgardius/page/s3manager/VideoPlayer.java @@ -3,6 +3,7 @@ package asgardius.page.s3manager; import androidx.appcompat.app.AppCompatActivity; import android.os.Bundle; +import android.view.View; import com.google.android.exoplayer2.ExoPlayer; import com.google.android.exoplayer2.MediaItem; @@ -50,6 +51,22 @@ public class VideoPlayer extends AppCompatActivity { } } + @Override + public void onWindowFocusChanged(boolean hasFocus) { + super.onWindowFocusChanged(hasFocus); + + + View decorView = getWindow().getDecorView(); + decorView.setSystemUiVisibility( + View.SYSTEM_UI_FLAG_LAYOUT_STABLE + | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION + | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN + | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION + | View.SYSTEM_UI_FLAG_FULLSCREEN + | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY); + + } + public void onBackPressed() { player.release(); finish(); diff --git a/app/src/main/res/layout/activity_video_player.xml b/app/src/main/res/layout/activity_video_player.xml index 5a7b4e1..b4b9ba5 100644 --- a/app/src/main/res/layout/activity_video_player.xml +++ b/app/src/main/res/layout/activity_video_player.xml @@ -14,7 +14,9 @@ + android:layout_height="match_parent" + android:keepScreenOn="true" + android:padding="0dp"/> \ No newline at end of file