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:com.tealeaf.TeaLeaf.java

@Override
public void onWindowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);
    if (hasFocus) {
        logger.log("{focus} Gained focus");
        ActivityState.onWindowFocusAcquired();
        if (ActivityState.hasResumed(true)) {
            onRealResume();/*from  w  ww  .j a  va2s .c  om*/
        }
        registerScreenOffReceiver();

        // always send acquired focus event
        EventQueue.pushEvent(new WindowFocusAcquiredEvent());

        // games are inherently full screen and immersive, hide OS UI bars
        if (isFullScreen && Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
            int uiFlag = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
                uiFlag |= View.SYSTEM_UI_FLAG_FULLSCREEN;
                uiFlag |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
                uiFlag |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
                uiFlag |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
                    uiFlag |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
                }
            }
            getWindow().getDecorView().setSystemUiVisibility(uiFlag);
        }
    } else {
        logger.log("{focus} Lost focus");
        ActivityState.onWindowFocusLost();
        pause();
        unregisterReceiver(screenOffReciever);
        if (jsRunning) {
            //always send lost focus event
            String[] events = { new WindowFocusLostEvent().pack() };

            // DANGER: Calling dispatchEvents() is NOT thread-safe.
            // Doing it here because the GLThread is paused.
            NativeShim.dispatchEvents(events);
        }
    }
}

From source file:com.nbplus.vbroadlauncher.RealtimeBroadcastActivity.java

private void hideSystemUI() {
    // Set the IMMERSIVE flag.m
    // Set the content to appear under the system bars so that the content
    // doesn't resize when the system bars hide and show.
    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 // hide nav bar
                    | View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
                    | View.SYSTEM_UI_FLAG_IMMERSIVE);
}

From source file:org.fossasia.phimpme.leafpic.activities.PlayerActivity.java

private void hideSystemBars() {
    toolbar.animate().translationY(-toolbar.getHeight()).setInterpolator(new AccelerateInterpolator())
            .setDuration(200).start();/*from  www .j  a  v  a2  s  .  c  om*/

    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 // hide nav bar
                    | View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
                    | View.SYSTEM_UI_FLAG_IMMERSIVE);
}

From source file:com.horaapps.leafpic.PlayerActivity.java

private void hideControls() {
    mediaController.hide();//from  w  w w . ja va2  s.  c o  m
    toolbar.animate().translationY(-toolbar.getHeight()).setInterpolator(new AccelerateInterpolator())
            .setDuration(200).start();

    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 // hide nav bar
                    | View.SYSTEM_UI_FLAG_FULLSCREEN // hide status bar
                    | View.SYSTEM_UI_FLAG_IMMERSIVE);
    fullscreen = true;
}

From source file:com.nbplus.vbroadlauncher.RealtimeBroadcastActivity.java

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

From source file:org.navitproject.navit.Navit.java

@Override
public void onResume() {
    super.onResume();
    Log.d("Navit", "OnResume");
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.LOLLIPOP) {
        /* Required to make system bars fully transparent */
        getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
    }/*  w ww  .  j  av  a 2s.c o  m*/
    //InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    // DEBUG
    // intent_data = "google.navigation:q=Wien Burggasse 27";
    // intent_data = "google.navigation:q=48.25676,16.643";
    // intent_data = "google.navigation:ll=48.25676,16.643&q=blabla-strasse";
    // intent_data = "google.navigation:ll=48.25676,16.643";
    if (startup_intent != null) {
        if (System.currentTimeMillis() <= Navit.startup_intent_timestamp + 4000L) {
            Log.e("Navit", "**2**A " + startup_intent.getAction());
            Log.e("Navit", "**2**D " + startup_intent.getDataString());
            String navi_scheme = startup_intent.getScheme();
            if (navi_scheme != null && navi_scheme.equals("google.navigation")) {
                parseNavigationURI(startup_intent.getData().getSchemeSpecificPart());
            }
        } else {
            Log.e("Navit", "timestamp for navigate_to expired! not using data");
        }
    }
    Log.d(TAG, "onResume");
    if (show_soft_keyboard_now_showing) {
        /* Calling showNativeKeyboard() directly won't work here, we need to use the message queue */
        View cf = getCurrentFocus();
        if (cf == null)
            Log.e(TAG, "no view in focus, can't get a handler");
        else
            cf.getHandler().post(new SoftInputRestorer());
    }
}

From source file:pct.droid.fragments.VideoPlayerFragment.java

@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public void showOverlay() {
    if (!mOverlayVisible) {
        updatePlayPauseState();//from w  w  w .j  a  v a2 s .co  m

        AnimUtils.fadeIn(mControlLayout);
        AnimUtils.fadeIn(mToolbar);

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            int uiOptions = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                    | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
            mDecorView.setSystemUiVisibility(uiOptions);
        } else {
            getAppCompatActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
            getAppCompatActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
        }

        mLastSystemShowTime = System.currentTimeMillis();
    }

    mOverlayVisible = true;
    mDisplayHandler.removeCallbacks(mOverlayHideRunnable);
    mDisplayHandler.postDelayed(mOverlayHideRunnable, FADE_OUT_OVERLAY);
}

From source file:com.segma.trim.MainActivity.java

private void hideNavigationBar() {

    //TODO: 11-4-2016 FIX: Hide Navigation Bar
    final int flags = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_FULLSCREEN
            //| View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
            | View.SYSTEM_UI_FLAG_IMMERSIVE | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
    final View decorView = getWindow().getDecorView();
    decorView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
        @Override/*from   w  ww . ja  v  a  2  s . c  o m*/
        public void onSystemUiVisibilityChange(int visibility) {
            // Note that system bars will only be "visible" if none of the
            // LOW_PROFILE, HIDE_NAVIGATION, or FULLSCREEN flags are set.
            if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
                // TODO: The system bars are visible. Make any desired
                // adjustments to your UI, such as showing the action bar or
                // other navigational controls.

                //decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
                //decorView.setSystemUiVisibility(decorView.getSystemUiVisibility());
                //getWindow().setFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE, WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE);
                decorView.setSystemUiVisibility(flags);
                getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                        WindowManager.LayoutParams.FLAG_FULLSCREEN);
            } else {
                // TODO: The system bars are NOT visible. Make any desired
                // adjustments to your UI, such as hiding the action bar or
                // other navigational controls.
            }
        }
    });
    decorView.setSystemUiVisibility(flags);
}

From source file:org.fossasia.phimpme.leafpic.activities.PlayerActivity.java

private void showSystemBars() {
    int rotation = (((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay()).getRotation();
    if (rotation == Surface.ROTATION_90 || rotation == Surface.ROTATION_270) { //Landscape
        getWindow().getDecorView().setSystemUiVisibility(
                View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
        mediaController.setPaddingRelative(0, 0, 0, 0);
    } else {/*ww w . j  a  v a  2  s .  c om*/
        getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
        mediaController.setPaddingRelative(0, 0, 0, Measure.getNavBarHeight(getApplicationContext()));
    }
    toolbar.animate().translationY(Measure.getStatusBarHeight(getResources()))
            .setInterpolator(new DecelerateInterpolator()).setDuration(240).start();
}

From source file:org.godotengine.godot.Godot.java

@Override
protected void onCreate(Bundle icicle) {

    super.onCreate(icicle);
    Window window = getWindow();// w  ww  .  j a v a 2  s.c o m
    //window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
    window.addFlags(WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
    mClipboard = (ClipboardManager) getSystemService(Context.CLIPBOARD_SERVICE);

    //check for apk expansion API
    if (true) {
        boolean md5mismatch = false;
        command_line = getCommandLine();
        String main_pack_md5 = null;
        String main_pack_key = null;

        List<String> new_args = new LinkedList<String>();

        for (int i = 0; i < command_line.length; i++) {

            boolean has_extra = i < command_line.length - 1;
            if (command_line[i].equals("--use_depth_32")) {
                use_32_bits = true;
            } else if (command_line[i].equals("--debug_opengl")) {
                use_debug_opengl = true;
            } else if (command_line[i].equals("--use_immersive")) {
                use_immersive = true;
                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { // check if the application runs on an android 4.4+
                    window.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 | // hide nav bar
                            View.SYSTEM_UI_FLAG_FULLSCREEN | // hide status bar
                            View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);

                    UiChangeListener();
                }
            } else if (command_line[i].equals("--use_apk_expansion")) {
                use_apk_expansion = true;
            } else if (has_extra && command_line[i].equals("--apk_expansion_md5")) {
                main_pack_md5 = command_line[i + 1];
                i++;
            } else if (has_extra && command_line[i].equals("--apk_expansion_key")) {
                main_pack_key = command_line[i + 1];
                SharedPreferences prefs = getSharedPreferences("app_data_keys", MODE_PRIVATE);
                Editor editor = prefs.edit();
                editor.putString("store_public_key", main_pack_key);

                editor.apply();
                i++;
            } else if (command_line[i].trim().length() != 0) {
                new_args.add(command_line[i]);
            }
        }

        if (new_args.isEmpty()) {
            command_line = null;
        } else {

            command_line = new_args.toArray(new String[new_args.size()]);
        }
        if (use_apk_expansion && main_pack_md5 != null && main_pack_key != null) {
            //check that environment is ok!
            if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
                //show popup and die
            }

            // Build the full path to the app's expansion files
            try {
                expansion_pack_path = Helpers.getSaveFilePath(getApplicationContext());
                expansion_pack_path += "/main."
                        + getPackageManager().getPackageInfo(getPackageName(), 0).versionCode + "."
                        + this.getPackageName() + ".obb";
            } catch (Exception e) {
                e.printStackTrace();
            }

            File f = new File(expansion_pack_path);

            boolean pack_valid = true;

            if (!f.exists()) {

                pack_valid = false;

            } else if (obbIsCorrupted(expansion_pack_path, main_pack_md5)) {
                pack_valid = false;
                try {
                    f.delete();
                } catch (Exception e) {
                }
            }

            if (!pack_valid) {

                Intent notifierIntent = new Intent(this, this.getClass());
                notifierIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TOP);

                PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, notifierIntent,
                        PendingIntent.FLAG_UPDATE_CURRENT);

                int startResult;
                try {
                    startResult = DownloaderClientMarshaller.startDownloadServiceIfRequired(
                            getApplicationContext(), pendingIntent, GodotDownloaderService.class);

                    if (startResult != DownloaderClientMarshaller.NO_DOWNLOAD_REQUIRED) {
                        // This is where you do set up to display the download
                        // progress (next step)
                        mDownloaderClientStub = DownloaderClientMarshaller.CreateStub(this,
                                GodotDownloaderService.class);

                        setContentView(com.godot.game.R.layout.downloading_expansion);
                        mPB = (ProgressBar) findViewById(com.godot.game.R.id.progressBar);
                        mStatusText = (TextView) findViewById(com.godot.game.R.id.statusText);
                        mProgressFraction = (TextView) findViewById(com.godot.game.R.id.progressAsFraction);
                        mProgressPercent = (TextView) findViewById(com.godot.game.R.id.progressAsPercentage);
                        mAverageSpeed = (TextView) findViewById(com.godot.game.R.id.progressAverageSpeed);
                        mTimeRemaining = (TextView) findViewById(com.godot.game.R.id.progressTimeRemaining);
                        mDashboard = findViewById(com.godot.game.R.id.downloaderDashboard);
                        mCellMessage = findViewById(com.godot.game.R.id.approveCellular);
                        mPauseButton = (Button) findViewById(com.godot.game.R.id.pauseButton);
                        mWiFiSettingsButton = (Button) findViewById(com.godot.game.R.id.wifiSettingsButton);

                        return;
                    } else {
                    }
                } catch (NameNotFoundException e) {
                    // TODO Auto-generated catch block
                }
            }
        }
    }

    mCurrentIntent = getIntent();

    initializeGodot();

    //instanceSingleton( new GodotFacebook(this) );
}