Example usage for android.view View SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION

List of usage examples for android.view View SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION

Introduction

In this page you can find the example usage for android.view View SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION.

Prototype

int SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION

To view the source code for android.view View SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION.

Click Source Link

Document

Flag for #setSystemUiVisibility(int) : View would like its window to be laid out as if it has requested #SYSTEM_UI_FLAG_HIDE_NAVIGATION , even if it currently hasn't.

Usage

From source file:io.v.moments.ux.ShowPhotoActivity.java

private void legacyHideControls() {
    mImageView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
}

From source file:com.pimp.instincts.activities.GalleryViewPagerActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    ActivityCompat.postponeEnterTransition(this);
    ActivityCompat.setEnterSharedElementCallback(this, enterTransitionCallback);

    int mUIFlag = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LOW_PROFILE
            | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;

    getWindow().getDecorView().setSystemUiVisibility(mUIFlag);

    setContentView(R.layout.activity_view_pager_gallery);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    toolbar.setTitle("Gallery");
    setSupportActionBar(toolbar);// ww  w .j  ava 2s  .co  m
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    galleryViewPagerAdapter = new GalleryViewPagerAdapter(this);

    viewPager = (ViewPager) findViewById(R.id.container);
    viewPager.setAdapter(galleryViewPagerAdapter);

    int position = selectedIndex = getIntent().getIntExtra(EXTRA_POSITION, 0);
    viewPager.setCurrentItem(position);
    viewPager.setOnPageChangeListener(pageChangeListener);
    viewPager.getViewTreeObserver().addOnGlobalLayoutListener(pagerLayoutListener);
}

From source file:de.storyquest.client.ContentActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // enable immersive mode
    getWindow().getDecorView()/*from   w w w .jav  a 2  s . c  o m*/
            .setSystemUiVisibility(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);
    getWindow().addFlags(
            WindowManager.LayoutParams.FLAG_FULLSCREEN | WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);

    // load initial layout
    setContentView(R.layout.activity_content);
    NavigationView navigationView = (NavigationView) findViewById(R.id.nav_view);
    navigationView.setNavigationItemSelectedListener(this);
    View header = navigationView.getHeaderView(0);

    // apply theme
    try {
        Drawable d = Drawable.createFromStream(getAssets().open("sidebar.jpg"), null);
        navigationView.setBackground(d);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }

    // wire the drawer open event to the character sheet refresh
    DrawerLayout drawer = (DrawerLayout) findViewById(R.id.drawer_layout);
    if (drawer != null) {
        drawer.addDrawerListener(new DrawerLayout.SimpleDrawerListener() {
            @Override
            public void onDrawerOpened(View drawerView) {
                super.onDrawerOpened(drawerView);
                execJavaScriptInCharactersheet("if(typeof refresh!='undefined')refresh()");
            }
        });
    }

    // get extra data with bookmark to load
    Intent intent = getIntent();
    if (intent.hasExtra(BOOKMARKID))
        bookmarkId = intent.getStringExtra(BOOKMARKID);

    // set the cover image from assets
    ImageView coverImage = (ImageView) header.findViewById(R.id.coverImage);
    try {
        InputStream ims = getAssets().open("cover.png");
        Drawable d = Drawable.createFromStream(ims, null);
        coverImage.setImageDrawable(d);
    } catch (Exception e) {
        throw new RuntimeException("Error loading cover image. Is 'cover.png' available in assets?", e);
    }

    // make the web content debuggable from external chrome tools
    WebView.setWebContentsDebuggingEnabled(true);

    // enable script interfaces
    scriptSystem = new ScriptSystem(this);
    scriptStorage = new ScriptStorage(this,
            getApplicationContext().getSharedPreferences(ScriptStorage.CONTEXT, Context.MODE_PRIVATE));
    scriptSound = new ScriptSound(this);
    scriptGameServices = new ScriptGameServices(this);

    // setup character webview
    character = (WebView) header.findViewById(R.id.characterView);
    character.getSettings().setJavaScriptEnabled(true);
    character.getSettings().setDomStorageEnabled(true);
    character.getSettings().setAllowFileAccess(true);
    character.getSettings().setAppCacheEnabled(true);
    character.addJavascriptInterface(scriptSystem, "sqSystem");
    character.addJavascriptInterface(scriptStorage, "nativeStorage");
    character.addJavascriptInterface(scriptSound, "sqSound");
    character.addJavascriptInterface(scriptGameServices, "sqGameServices");
    character.loadUrl("file:///android_asset/character.html");

    // setup web view
    web = (WebView) findViewById(R.id.webView);
    web.getSettings().setJavaScriptEnabled(true);
    web.getSettings().setDomStorageEnabled(true);
    web.getSettings().setAllowFileAccess(true);
    web.getSettings().setAppCacheEnabled(true);
    web.addJavascriptInterface(scriptSystem, "sqSystem");
    web.addJavascriptInterface(scriptStorage, "nativeStorage");
    web.addJavascriptInterface(scriptSound, "sqSound");
    web.addJavascriptInterface(scriptGameServices, "sqGameServices");

    // adding event overrides for the web view
    web.setWebChromeClient(new WebChromeClient());
    web.setWebViewClient(new WebViewClient() {
        public boolean shouldOverrideUrlLoading(WebView view, String urlText) {
            if (urlText.startsWith("http")) { // Could be cleverer and use a regex
                Log.d(LOGTAG, "Opening standard web intent window for " + urlText);
                Intent i = new Intent(Intent.ACTION_VIEW, Uri.parse(urlText));
                startActivity(i);
                return true;
            } else {
                Log.d(LOGTAG, "Loading in webview: " + urlText);
                web.loadUrl(urlText);
                return true;
            }
        }

        @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            Log.d(LOGTAG, "Page rendering started: " + url + ".");
            displaySpinner(R.string.loading);
            super.onPageStarted(view, url, favicon);
        }

        @Override
        public void onPageFinished(WebView view, String url) {
            Log.d(LOGTAG, "Page rendering finished: " + url + ".");
            hideSpinner();
            if (bookmarkId != null && url.startsWith("file:///android_asset/content.html")) {
                Log.i(LOGTAG, "Loading bookmark " + bookmarkId + ".");
                execJavaScriptInContent("loadBookmark('" + bookmarkId + "')");
                bookmarkId = null;
            }
            super.onPageFinished(view, url);
        }

        @Override
        public WebResourceResponse shouldInterceptRequest(WebView view, String url) {
            Log.d(LOGTAG, "Intercepted call: " + url + ".");
            return null;
        }
    });
    web.setWebChromeClient(new WebChromeClient() {
        public boolean onConsoleMessage(ConsoleMessage cm) {
            Log.d(LOGTAG, cm.message() + " - from line " + cm.lineNumber() + " of " + cm.sourceId());
            return true;
        }
    });
    web.getSettings().setRenderPriority(WebSettings.RenderPriority.HIGH);
    web.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
    web.requestFocus(View.FOCUS_DOWN);

    // finally loading content bootstrap
    Log.i(LOGTAG, "Loading index.html");
    web.loadUrl("file:///android_asset/index.html");
}

From source file:com.s8launch.cheil.facetracker.MultiTrackerActivity.java

/**
 * Initializes the UI and creates the detector pipeline.
 *///www.  jav  a  2  s.c om
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    requestWindowFeature(Window.FEATURE_NO_TITLE);
    getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
            WindowManager.LayoutParams.FLAG_FULLSCREEN);
    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);

    setContentView(R.layout.main);

    mPreview = (CameraSourcePreview) findViewById(R.id.preview);
    mGraphicOverlay = (GraphicOverlay) findViewById(R.id.faceOverlay);

    // Check for the camera permission before accessing the camera.  If the
    // permission is not granted yet, request permission.
    int rc = ActivityCompat.checkSelfPermission(this, Manifest.permission.CAMERA);
    if (rc == PackageManager.PERMISSION_GRANTED) {
        createCameraSource();
    } else {
        requestCameraPermission();
    }
}

From source file:org.anothermonitor.ActivityPreferences.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_preferences);
    mPrefs = getSharedPreferences(getString(R.string.app_name) + "Prefs", MODE_PRIVATE);
    res = getResources();/*  w  w  w.  j  a v a 2 s  . com*/
    navigationBarHeight = res
            .getDimensionPixelSize(res.getIdentifier("navigation_bar_height", "dimen", "android"));

    mLTabs = (LinearLayout) findViewById(R.id.LTabs);

    if (Build.VERSION.SDK_INT >= 19) {
        getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);

        sSW = res.getConfiguration().smallestScreenWidthDp;

        int statusBarHeight = res
                .getDimensionPixelSize(res.getIdentifier("status_bar_height", "dimen", "android"));

        if (!ViewConfiguration.get(this).hasPermanentMenuKey()
                && (res.getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT || sSW > 560)) {
            getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
            FrameLayout nb = (FrameLayout) findViewById(R.id.LNavigationBar);
            nb.setVisibility(View.VISIBLE);
            ((FrameLayout.LayoutParams) nb.getLayoutParams()).height = navigationBarHeight;
        }

        int paddingTop = mLTabs.getPaddingTop();
        int paddingBottom = mLTabs.getPaddingBottom();
        int paddingLeft = mLTabs.getPaddingLeft();
        int paddingRight = mLTabs.getPaddingRight();
        mLTabs.setPadding(paddingLeft, paddingTop + statusBarHeight, paddingRight, paddingBottom);
    }

    findViewById(R.id.TVTabMain).setActivated(true);
    findViewById(R.id.TVTabMain).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mVP.setCurrentItem(0);
        }
    });
    findViewById(R.id.TVTabShowRecord).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mVP.setCurrentItem(1);
        }
    });

    mVP = (ViewPager) findViewById(R.id.VP);
    mVP.setAdapter(new MyPreferencesAdapter());
    //      mVP.setOffscreenPageLimit(2);
    mVP.setOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        @Override
        public void onPageSelected(int position) {
            int currentItem = 0;
            if (position == 1)
                currentItem = 2;
            mLTabs.getChildAt(currentItem).setActivated(true);
            mLTabs.getChildAt(previousSelected).setActivated(false);
            previousSelected = currentItem;
        }

        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
        }

        @Override
        public void onPageScrollStateChanged(int arg0) {
        }
    });
    mVP.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            mVP.getViewTreeObserver().removeGlobalOnLayoutListener(this);
            if (currentItem != -1)
                mVP.setCurrentItem(currentItem, false);
        }
    });

    if (savedInstanceState != null && !savedInstanceState.isEmpty()) {
        mB = savedInstanceState;
        currentItem = savedInstanceState.getInt(C.currentItem);

        currentItem = savedInstanceState.getInt(C.currentItem);
        currentItem = savedInstanceState.getInt(C.currentItem);
        currentItem = savedInstanceState.getInt(C.currentItem);
    }
}

From source file:com.google.android.apps.muzei.settings.SettingsActivity.java

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
    setContentView(R.layout.settings_activity);

    if (getIntent() != null && getIntent().getCategories() != null
            && getIntent().getCategories().contains(Notification.INTENT_CATEGORY_NOTIFICATION_PREFERENCES)) {
        mStartSection = START_SECTION_ADVANCED;
    }//ww  w.  j ava 2  s . c  om

    // Set up UI widgets
    setupAppBar();

    ((DrawInsetsFrameLayout) findViewById(R.id.draw_insets_frame_layout))
            .setOnInsetsCallback(new DrawInsetsFrameLayout.OnInsetsCallback() {
                @Override
                public void onInsetsChanged(Rect insets) {
                    View container = findViewById(R.id.container);
                    ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) container
                            .getLayoutParams();
                    lp.leftMargin = insets.left;
                    lp.topMargin = insets.top;
                    lp.rightMargin = insets.right;
                    lp.bottomMargin = insets.bottom;
                    container.setLayoutParams(lp);
                }
            });

    if (mBackgroundAnimator != null) {
        mBackgroundAnimator.cancel();
    }

    mBackgroundAnimator = ObjectAnimator.ofFloat(this, "backgroundOpacity", 0, 1);
    mBackgroundAnimator.setDuration(1000);
    mBackgroundAnimator.start();
}

From source file:org.centum.android.learn.LearnActivity.java

@Override
public void onWindowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);
    if (hasFocus && Build.VERSION.SDK_INT >= 16) {
        viewPager.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);
    }// w  ww.j a  v  a  2s . c  o  m
}

From source file:it.cammino.risuscito.LUtils.java

public void goFullscreen() {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
        mActivity.requestWindowFeature(Window.FEATURE_NO_TITLE);
        mActivity.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
    } else/*from ww  w  . j  av a 2  s .  co m*/
        mActivity.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);
}

From source file:com.avolatile.randomdaily.IntroductionActivity.java

@Override
protected void onResume() {

    /* The following code will enable immersive mode for the introduction screen
     * for devices running on Android 3.0 Honeycomb or higher. This will effectively
     * enable immersive mode all of the app's instances as the app is only compatible
     * with devices running on Android 4.1 Jelly Bean or higher */

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        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);
    }//from  w w w  .j  a  va  2s .  co  m

    super.onResume();
}

From source file:liam.franco.selene.activities.AboutActivity.java

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_about);
    ButterKnife.bind(this);
    App.BUS.register(this);

    setSupportActionBar(toolbar);// ww  w  .j  a v  a 2s .  c  o  m
    if (getSupportActionBar() != null) {
        getSupportActionBar().setDisplayHomeAsUpEnabled(true);
        getSupportActionBar().setDisplayShowHomeEnabled(true);
        getSupportActionBar().setHomeAsUpIndicator(R.drawable.ic_close_white_24dp);
    }

    UIUtils.setTranslucentNavigationFlag(this, true);
    UIUtils.setTranslucentStatusFlag(this, true);

    parentLayout.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);

    parentLayout.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
        @Override
        public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
            int navBarHeight = UIUtils.getNavigationBarHeight(App.CONTEXT);

            // 1 = portrait, 2 = landscape
            int orientation = App.RESOURCES.getConfiguration().orientation;

            ViewGroup.MarginLayoutParams bar = (ViewGroup.MarginLayoutParams) toolbar.getLayoutParams();
            bar.topMargin += insets.getSystemWindowInsetTop();
            bar.rightMargin += insets.getSystemWindowInsetRight();
            toolbar.setLayoutParams(bar);

            // making sure it's all inside bounds because of our transparent status and nav bars
            scrollableLayout.setPadding(scrollableLayout.getPaddingLeft(), scrollableLayout.getPaddingTop(),
                    scrollableLayout.getPaddingRight()
                            + (orientation == 1 ? insets.getSystemWindowInsetRight() : navBarHeight),
                    scrollableLayout.getPaddingBottom()
                            + (orientation == 1 ? navBarHeight : insets.getSystemWindowInsetBottom()));

            parentLayout.setOnApplyWindowInsetsListener(null);
            return insets.consumeSystemWindowInsets();
        }
    });

    liamList.addItemDecoration(new SimpleDividerItemDecoration(this));
    liamAdapter = new FastItemAdapter<>();
    liamList.setLayoutManager(new UnscrollableLinearLayoutManager(this));
    liamList.setAdapter(liamAdapter);

    franciscoList.addItemDecoration(new SimpleDividerItemDecoration(this));
    franciscoAdapter = new FastItemAdapter<>();
    franciscoList.setLayoutManager(new UnscrollableLinearLayoutManager(this));
    franciscoList.setAdapter(franciscoAdapter);

    libsList.addItemDecoration(new SimpleDividerItemDecoration(this));
    libsAdapter = new FastItemAdapter<>();
    libsList.setLayoutManager(new UnscrollableLinearLayoutManager(this));
    libsList.setAdapter(libsAdapter);

    mutateMoreList.addItemDecoration(new SimpleDividerItemDecoration(this));
    mutateMoreAdapter = new FastItemAdapter<>();
    mutateMoreList.setLayoutManager(new UnscrollableLinearLayoutManager(this));
    mutateMoreList.setAdapter(mutateMoreAdapter);

    initAboutEntries();
}