Skip to content

Commit

Permalink
Hide System UI correctly, when user is watching media
Browse files Browse the repository at this point in the history
  • Loading branch information
astarivi committed Jun 18, 2023
1 parent 025b5ea commit 105e8a5
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -252,13 +252,11 @@ protected void onDestroy() {
@Override
protected void onPostCreate(@Nullable Bundle savedInstanceState) {
super.onPostCreate(savedInstanceState);
hideSystemUI();
}

@Override
public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
if (hasFocus) hideSystemUI();
}

@Override
Expand All @@ -270,22 +268,6 @@ public boolean onTouchEvent(MotionEvent event) {
return super.onTouchEvent(event);
}

private void hideSystemUI(){
// if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R) {
// WindowInsetsControllerCompat windowInsetsController = WindowCompat.getInsetsController(getWindow(), getWindow().getDecorView());
// windowInsetsController.hide(WindowInsetsCompat.Type.systemBars());
// } else {
// getWindow().getDecorView().setSystemUiVisibility(
// View.SYSTEM_UI_FLAG_FULLSCREEN
// | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
// | View.SYSTEM_UI_FLAG_IMMERSIVE
// | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
// | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
// | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
// );
// }
}

private void delayedExit(){
final Handler handler = new Handler(Looper.getMainLooper());
handler.postDelayed(this::finish, 5000);
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/bottom_sheet_app_theme.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
android:paddingRight="8dp"
android:showDividers="middle"
android:divider="@drawable/empty_divider"
android:paddingBottom="10dp"
>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/layout/bottom_sheet_episodes.xml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
android:paddingRight="8dp"
android:showDividers="middle"
android:divider="@drawable/empty_divider"
android:paddingBottom="10dp"
>
</LinearLayout>
</androidx.core.widget.NestedScrollView>
Expand Down

0 comments on commit 105e8a5

Please sign in to comment.