Home | History | Annotate | Download | only in immersive
      1 /*
      2  * Copyright 2013 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *     http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.example.android.immersive;
     18 
     19 import android.app.Activity;
     20 import android.os.Bundle;
     21 import android.os.Handler;
     22 import android.os.Message;
     23 import android.view.GestureDetector;
     24 import android.view.MotionEvent;
     25 import android.view.View;
     26 
     27 public class ImmersiveStickyActivity extends Activity {
     28     private View mDecorView;
     29 
     30     @Override
     31     protected void onCreate(Bundle savedInstanceState) {
     32         super.onCreate(savedInstanceState);
     33         setContentView(R.layout.immersive_sticky_activity);
     34         mDecorView = getWindow().getDecorView();
     35     }
     36 
     37     @Override
     38     public void onWindowFocusChanged(boolean hasFocus) {
     39         super.onWindowFocusChanged(hasFocus);
     40         if (hasFocus) {
     41             mDecorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
     42                     | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
     43                     | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
     44                     | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
     45                     | View.SYSTEM_UI_FLAG_FULLSCREEN
     46                     | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
     47         }
     48     }
     49 }
     50