Example usage for android.view View SYSTEM_UI_FLAG_IMMERSIVE_STICKY

List of usage examples for android.view View SYSTEM_UI_FLAG_IMMERSIVE_STICKY

Introduction

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

Prototype

int SYSTEM_UI_FLAG_IMMERSIVE_STICKY

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

Click Source Link

Document

Flag for #setSystemUiVisibility(int) : View would like to remain interactive when hiding the status bar with #SYSTEM_UI_FLAG_FULLSCREEN and/or hiding the navigation bar with #SYSTEM_UI_FLAG_HIDE_NAVIGATION .

Usage

From source file:com.askjeffreyliu.camera2barcode.CameraActivity.java

private void hideSystemUI() {
    // Set the IMMERSIVE flag.
    // 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
            | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}

From source file:ca.hoogit.garagepi.Main.MainActivity.java

public void toggleFullscreen() {
    int newUiOptions = getWindow().getDecorView().getSystemUiVisibility();
    newUiOptions ^= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
    newUiOptions ^= View.SYSTEM_UI_FLAG_FULLSCREEN;
    newUiOptions ^= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;

    getWindow().getDecorView().setSystemUiVisibility(newUiOptions);
}

From source file:com.stemsc.bt.BarcodeCaptureActivity.java

/**
 * Initializes the UI and creates the detector pipeline.
 *//*from   w ww .j  a v a2s . c  o  m*/
@Override
public void onCreate(Bundle icicle) {
    super.onCreate(icicle);

    //   
    //        requestWindowFeature(Window.FEATURE_NO_TITLE);
    // ?? ?
    //        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
    //                WindowManager.LayoutParams.FLAG_FULLSCREEN);

    View view = this.getWindow().getDecorView();
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN
                | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
    }

    setContentView(R.layout.barcode_capture);
    mPreview = (CameraSourcePreview) findViewById(R.id.preview);
    mGraphicOverlay = (GraphicOverlay<BarcodeGraphic>) findViewById(R.id.graphicOverlay);

    // read parameters from the intent used to launch the activity.
    //        boolean autoFocus = getIntent().getBooleanExtra(AutoFocus, false);
    //        boolean useFlash = getIntent().getBooleanExtra(UseFlash, false);
    //    ?
    sPref = PreferenceManager.getDefaultSharedPreferences(this.getApplicationContext());
    autoFocus = sPref.getBoolean("af", true);
    useFlash = sPref.getBoolean("fl", false);
    mRaw = sPref.getBoolean("raw", false);
    mPV = sPref.getBoolean("pv", false);
    mS = sPref.getInt("s", 50);
    mH = sPref.getInt("h", 360);
    mW = sPref.getInt("v", 640);
    //        Log.d(TAG,"=== mS === "+mS);
    //        Log.d(TAG,"=== mH === "+mH);
    //        Log.d(TAG,"=== mW === "+mW);

    // 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(autoFocus, useFlash);
    } else {
        requestCameraPermission();
    }

    //        gestureDetector = new GestureDetector(this, new CaptureGestureListener());
    //        scaleGestureDetector = new ScaleGestureDetector(this, new ScaleListener());

    //        Snackbar.make(mGraphicOverlay, "Tap to capture. Pinch/Stretch to zoom",
    //                Snackbar.LENGTH_LONG)
    //                .show();

    tvSost = (TextView) findViewById(R.id.tvSost);
    lLay = (RelativeLayout) findViewById(R.id.lLayout1);

    if (mPV) {
        mPreview.setVisibility(View.VISIBLE);
    } else {
        mPreview.setVisibility(View.INVISIBLE);
    }

    sbS = (SeekBar) findViewById(R.id.seekBarS);
    sbW = (SeekBar) findViewById(R.id.seekBarW);
    sbH = (SeekBar) findViewById(R.id.seekBarH);

    sbS.setOnSeekBarChangeListener(this);
    sbW.setOnSeekBarChangeListener(this);
    sbH.setOnSeekBarChangeListener(this);

    target = (TextView) findViewById(R.id.target);
    RelativeLayout.LayoutParams MyParams = new RelativeLayout.LayoutParams(64 * mS / 10, 72 * mS / 10);
    MyParams.addRule(RelativeLayout.ALIGN_PARENT_TOP);
    MyParams.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
    MyParams.topMargin = mW;
    MyParams.leftMargin = mH;
    target.setLayoutParams(MyParams);

    sbS.setProgress(mS);
    sbW.setProgress(mW);
    sbH.setProgress(mH);
    ((TextView) findViewById(R.id.taPar)).setText("" + mS + " " + mW + " " + mH);

    // create instance
    _displayControl = new DisplayControl(this);
    // get current display condition
    _mode = _displayControl.getMode();
    //        _backlight = _displayControl.getBacklight();

    if (_mode == DisplayControl.DISPLAY_MODE_2D) {
        _mode = DisplayControl.DISPLAY_MODE_3D;
        _displayControl.setMode(_mode, true);
    }

    if (mRaw) {
        tvSost.setText("?(raw) ");
        lLay.setVisibility(View.INVISIBLE);

        return; // !!!!!!!!!  !!!!!!!

    }

    lLay2 = (RelativeLayout) findViewById(R.id.lLayout2);

    tvNeed = (TextView) findViewById(R.id.tvNeed);
    tvNeedT = (TextView) findViewById(R.id.tvNeedT);
    tvNeedAT = (TextView) findViewById(R.id.tvNeedAT);
    tvNeedA = (TextView) findViewById(R.id.tvNeedA);
    tvNeedBT = (TextView) findViewById(R.id.tvNeedBT);
    tvNeedB = (TextView) findViewById(R.id.tvNeedB);
    tvNeedQT = (TextView) findViewById(R.id.tvNeedQT);
    tvNeedQ = (TextView) findViewById(R.id.tvNeedQ);

    tvCellT = (TextView) findViewById(R.id.tvCellT);
    tvCell = (TextView) findViewById(R.id.tvCell);
    tvTrayT = (TextView) findViewById(R.id.tvTrayT);
    tvTray = (TextView) findViewById(R.id.tvTray);
    pb1 = (ProgressBar) findViewById(R.id.pb1);

    tvNeedAT.setVisibility(View.INVISIBLE);
    tvNeedA.setVisibility(View.INVISIBLE);
    tvNeedBT.setVisibility(View.INVISIBLE);
    tvNeedB.setVisibility(View.INVISIBLE);
    tvNeedQT.setVisibility(View.INVISIBLE);
    tvNeedQ.setVisibility(View.INVISIBLE);

    tvCellT.setVisibility(View.INVISIBLE);
    tvCell.setVisibility(View.INVISIBLE);
    tvTrayT.setVisibility(View.INVISIBLE);
    tvTray.setVisibility(View.INVISIBLE);

    //  json
    //        AsyncTask<Void, Void, String> tmp = new ParseTask("http://onbqth.com/route2.json");
    //        AsyncTask<Void, Void, String> dStr = tmp.execute();
    new ParseTask("http://onbqth.com/order.json").execute();
}

From source file:com.example.maxuan.photoutils.ViewPagerActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_select_viewpager);
    mViewPager = (HackyViewPager) findViewById(R.id.view_pager);
    recyclerView = (RecyclerView) findViewById(R.id.recyclerView);
    cancelBtn = (ImageView) findViewById(R.id.selectCancel);
    cancelBtn.setOnClickListener(this);
    selectCheckBox = (CheckBox) findViewById(R.id.checkbox);
    selectCheckBox.setOnClickListener(this);
    completeBtn = (Button) findViewById(R.id.completeBtn);
    completeBtn.setOnClickListener(this);
    photos = new ArrayList<>();
    posArray = new SparseIntArray(10);
    adapter = new PhotoPagerAdapter(this, photos);
    mViewPager.setAdapter(adapter);/*  w ww .j  a  v a  2  s . c om*/
    mViewPager.addOnPageChangeListener(this);
    Intent intent = getIntent();
    if (intent != null) {
        Bundle bundle = intent.getBundleExtra("data");
        if (bundle == null)
            return;
        selectedPhotoArray = bundle.getSparseParcelableArray("selectedPhotos");
        completeBtn.setText(String.format(format, selectedPhotoArray.size()));
        List<Photo> list = bundle.getParcelableArrayList("photos");
        if (list != null)
            photos.addAll(list);
        for (int i = 0; i < photos.size(); ++i) {
            posArray.put(photos.get(i).id, i);
        }
        position = bundle.getInt("position", 0);
        maxCount = bundle.getInt("maxCount", 9);
        adapter.notifyDataSetChanged();
        mViewPager.setCurrentItem(position);
        selectCheckBox.setChecked(selectedPhotoArray.indexOfKey(photos.get(position).id) >= 0);
    }

    selectedPhotoAdapter = new SelectedPhotoAdapter(this);
    LinearLayoutManager layoutManager = new LinearLayoutManager(this);
    layoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
    layoutManager.setReverseLayout(true);
    recyclerView.setLayoutManager(layoutManager);
    recyclerView.setAdapter(selectedPhotoAdapter);
    recyclerView.setVisibility(selectedPhotoArray.size() > 0 ? View.VISIBLE : View.GONE);
    if (savedInstanceState != null) {
        boolean isLocked = savedInstanceState.getBoolean(ISLOCKED_ARG, false);
        ((HackyViewPager) mViewPager).setLocked(isLocked);
    }

    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT)
        return;
    getWindow().getDecorView()
            .setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                    | View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);

}

From source file:org.ulteo.ovd.AndRdpActivity.java

@TargetApi(Build.VERSION_CODES.KITKAT)
private void hideSystemUi() {
    if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.KITKAT) {
        view.setSystemUiVisibility(//from  w w  w . j a v a2  s. co m
                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);
    } else {
        view.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
    }
}

From source file:pulseanddecibels.jp.yamatenki.activity.SplashActivity.java

private void goFullScreen() {
    if (Build.VERSION.SDK_INT < 19) { //19 or above api
        View v = this.getWindow().getDecorView();
        v.setSystemUiVisibility(View.GONE);
    } else {/*from   w  ww  .  ja v  a2  s .  c  om*/
        //for lower api versions.
        View decorView = getWindow().getDecorView();
        int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
        decorView.setSystemUiVisibility(uiOptions);
    }
}

From source file:com.cranberrygame.cordova.plugin.navigationbar.NavigationBar.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void _hideNavigationBar() {
    Activity activity = cordova.getActivity();
    activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION//
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            //| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            //| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
}

From source file:com.wowza.gocoder.sdk.sampleapp.GoCoderSDKActivityBase.java

/**
 * Enable Android's sticky immersive full-screen mode
 * See http://developer.android.com/training/system-ui/immersive.html#sticky
 *//*from ww  w .ja  v  a  2 s  .co  m*/
@Override
public void onWindowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);

    if (sFullScreenActivity && hasFocus) {
        View rootView = getWindow().getDecorView().findViewById(android.R.id.content);
        if (rootView != null)
            rootView.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:io.github.calvinmikael.anymanga.WebViewFragment.java

@SuppressLint("SetJavaScriptEnabled")
@Override/*from ww w  .ja  v a 2s  .  c om*/
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_web_view, container, false);
    mProgressBar = (ProgressBar) view.findViewById(R.id.progressBar);
    mProgressBar.setVisibility(View.GONE);

    mWebView = (ObservableWebView) view.findViewById(R.id.webView);
    mWebView.setScrollViewCallbacks(this);
    WebSettings settings = mWebView.getSettings();

    settings.setLoadsImagesAutomatically(true);
    settings.setJavaScriptEnabled(true);
    settings.setDomStorageEnabled(true);
    mWebView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
    settings.setBuiltInZoomControls(true);
    settings.setDisplayZoomControls(false);
    mWebView.setWebViewClient(new WebViewClient() {
        @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            super.onPageStarted(view, url, favicon);
            if (!mProgressBar.isShown()) {
                mProgressBar.setVisibility(View.VISIBLE);
            }
        }

        @Override
        public void onPageFinished(WebView view, String url) {
            super.onPageFinished(view, url);
            if (mProgressBar.isShown()) {
                mProgressBar.setVisibility(View.GONE);
            }
        }
    });
    mWebView.setWebChromeClient(new WebChromeClient() {
        @Override
        public void onShowCustomView(View view, CustomViewCallback callback) {
            // if a view already exists then immediately terminate the new one
            if (mCustomView != null) {
                onHideCustomView();
                return;
            }

            // Save the current state
            mCustomView = view;
            mOriginalSystemUiVisibility = getActivity().getWindow().getDecorView().getSystemUiVisibility();

            // Save the custom view callback
            mCustomViewCallback = callback;

            // Add the custom view to the view hierarchy
            FrameLayout decorView = (FrameLayout) getActivity().getWindow().getDecorView();
            decorView.addView(mCustomView, new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                    ViewGroup.LayoutParams.MATCH_PARENT));

            mTabStrip = (PagerSlidingTabStrip) getActivity().findViewById(R.id.tabs);
            mTabStrip.setVisibility(View.GONE);

            // Go fullscreen
            if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN) {
                getActivity().getWindow().getDecorView()
                        .setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
            } else if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT
                    && Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
                getActivity().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);
            } else if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
                getActivity().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);
            }
        }

        @Override
        public void onHideCustomView() {
            // Remove the custom view
            FrameLayout decorView = (FrameLayout) getActivity().getWindow().getDecorView();
            decorView.removeView(mCustomView);
            mCustomView = null;

            mTabStrip.setVisibility(View.VISIBLE);
            // Restore the original form
            getActivity().getWindow().getDecorView().setSystemUiVisibility(mOriginalSystemUiVisibility);

            // Call the custom view callback
            mCustomViewCallback.onCustomViewHidden();
            mCustomViewCallback = null;
        }
    });
    // The back button must be handled within the mWebView for the
    // mWebView to have back behavior based on the current mPage
    // if back behavior is not handled with this listener then
    // back behavior will be entirely dependent on the first mPage
    mWebView.setOnKeyListener(new OnKeyListener() {
        @Override
        public boolean onKey(View view, int keyCode, KeyEvent keyEvent) {
            if ((keyCode == KeyEvent.KEYCODE_BACK) && mWebView.canGoBack()
                    && keyEvent.getAction() == KeyEvent.ACTION_DOWN) {
                mWebView.goBack();
                return true;
            }

            return false;
        }
    });

    if (savedInstanceState != null) {
        mWebView.restoreState(savedInstanceState);
    } else {
        if (mPage == 1) {
            mWebView.loadUrl(getString(R.string.website_kissmanga));
        } else if (mPage == 2) {
            mWebView.loadUrl(getString(R.string.website_mangapark));
        } else if (mPage == 3) {
            mWebView.loadUrl(getString(R.string.website_line_webtoon));
        }
    }

    return view;
}

From source file:com.example.android.advancedimmersivemode.AdvancedImmersiveModeFragment.java

/**
 * Helper method to dump flag state to the log.
 * @param uiFlags Set of UI flags to inspect
 *///from  www.java 2  s .  com
public void dumpFlagStateToLog(int uiFlags) {
    if ((uiFlags & View.SYSTEM_UI_FLAG_LOW_PROFILE) != 0) {
        Log.i(TAG, "SYSTEM_UI_FLAG_LOW_PROFILE is set");
    } else {
        Log.i(TAG, "SYSTEM_UI_FLAG_LOW_PROFILE is unset");
    }

    if ((uiFlags & View.SYSTEM_UI_FLAG_FULLSCREEN) != 0) {
        Log.i(TAG, "SYSTEM_UI_FLAG_FULLSCREEN is set");
    } else {
        Log.i(TAG, "SYSTEM_UI_FLAG_FULLSCREEN is unset");
    }

    if ((uiFlags & View.SYSTEM_UI_FLAG_HIDE_NAVIGATION) != 0) {
        Log.i(TAG, "SYSTEM_UI_FLAG_HIDE_NAVIGATION is set");
    } else {
        Log.i(TAG, "SYSTEM_UI_FLAG_HIDE_NAVIGATION is unset");
    }

    if ((uiFlags & View.SYSTEM_UI_FLAG_IMMERSIVE) != 0) {
        Log.i(TAG, "SYSTEM_UI_FLAG_IMMERSIVE is set");
    } else {
        Log.i(TAG, "SYSTEM_UI_FLAG_IMMERSIVE is unset");
    }

    if ((uiFlags & View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY) != 0) {
        Log.i(TAG, "SYSTEM_UI_FLAG_IMMERSIVE_STICKY is set");
    } else {
        Log.i(TAG, "SYSTEM_UI_FLAG_IMMERSIVE_STICKY is unset");
    }
}