Prevent nav bar from showing up. am: ef50b81c92
am: 1bf59e5f77

Change-Id: Ie41c26ed7410759642d6897a4f92f1432c657ec3
diff --git a/src/com/android/retaildemo/DemoPlayer.java b/src/com/android/retaildemo/DemoPlayer.java
index 58d9a4e..c45a5e2 100644
--- a/src/com/android/retaildemo/DemoPlayer.java
+++ b/src/com/android/retaildemo/DemoPlayer.java
@@ -211,23 +211,29 @@
     @Override
     public void onResume() {
         super.onResume();
-        // Make view fullscreen.
-        // And since flags SYSTEM_UI_FLAG_HIDE_NAVIGATION and SYSTEM_UI_FLAG_HIDE_NAVIGATION might
-        // get cleared on user interaction, we do this here instead of onCreate.
-        getWindow().getDecorView().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
-                        | View.STATUS_BAR_DISABLE_BACK);
         // Resume video playing
         if (mVideoView != null) {
             mVideoView.start();
         }
     }
 
+    @Override
+    public void onWindowFocusChanged(boolean hasFocus) {
+        if (hasFocus) {
+            // Make view fullscreen.
+            // And since flags SYSTEM_UI_FLAG_HIDE_NAVIGATION and SYSTEM_UI_FLAG_HIDE_NAVIGATION
+            // might get cleared on user interaction, we do this here.
+            getWindow().getDecorView().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
+                            | View.STATUS_BAR_DISABLE_BACK);
+        }
+    }
+
     private void setVideoPath(String videoPath) {
         // Load the video from resource
         try {