Example usage for android.view View setSystemUiVisibility

List of usage examples for android.view View setSystemUiVisibility

Introduction

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

Prototype

public void setSystemUiVisibility(int visibility) 

Source Link

Document

Request that the visibility of the status bar or other screen/window decorations be changed.

Usage

From source file:com.swiftnav.piksidroid.MainActivity.java

private void setupUI() {
    TabHost tabHost = (TabHost) findViewById(R.id.tabHost);
    tabHost.setup();/*from w  w  w .j a  v  a  2  s.co m*/

    TabHost.TabSpec tabSpec = tabHost.newTabSpec("Piksi");
    tabSpec.setContent(R.id.piksi);
    tabSpec.setIndicator("Piksi");
    tabHost.addTab(tabSpec);

    tabSpec = tabHost.newTabSpec("Tracking");
    tabSpec.setContent(R.id.tracking);
    tabSpec.setIndicator("Tracking");
    tabHost.addTab(tabSpec);

    tabSpec = tabHost.newTabSpec("Map");
    tabSpec.setContent(R.id.map);
    tabSpec.setIndicator("Map");
    tabHost.addTab(tabSpec);

    tabSpec = tabHost.newTabSpec("Observation");
    tabSpec.setContent(R.id.observation);
    tabSpec.setIndicator("Observation");
    tabHost.addTab(tabSpec);

    tabSpec = tabHost.newTabSpec("RTK");
    tabSpec.setContent(R.id.rtk);
    tabSpec.setIndicator("RTK");
    tabHost.addTab(tabSpec);

    tabHost.setOnTabChangedListener(tabChanger);

    ((EditText) findViewById(R.id.console)).setText("Piksi not connected!");
    ((EditText) findViewById(R.id.console)).setTextIsSelectable(false);
    findViewById(R.id.console).setClickable(false);

    findViewById(R.id.scrollView).setClickable(false);
    findViewById(R.id.scrollView).setFocusable(false);
    findViewById(R.id.scrollView).setOnTouchListener(null);
    findViewById(R.id.scrollView).setPressed(false);

    com.swiftnav.piksidroid.MapFragment mFrag = ((com.swiftnav.piksidroid.MapFragment) getFragmentManager()
            .findFragmentById(R.id.map_fragment));
    com.google.android.gms.maps.MapFragment mGFrag = (com.google.android.gms.maps.MapFragment) mFrag
            .getChildFragmentManager().findFragmentById(R.id.gmap_fragment);
    mGFrag.getMapAsync(mFrag);

    View decorView = getWindow().getDecorView();
    int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
    decorView.setSystemUiVisibility(uiOptions);
}

From source file:support.plus.reportit.splashscreen.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_splashscreen);

    View decorView = getWindow().getDecorView();
    // Hide the status bar.
    int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
    decorView.setSystemUiVisibility(uiOptions);

    // intro/* w w w.  j  a  v a  2s.c  om*/
    TextView by = (TextView) findViewById(R.id.by);
    TextView appname = (TextView) findViewById(R.id.appname);
    ImageView logo = (ImageView) findViewById(R.id.logo);
    ImageView supportlogo = (ImageView) findViewById(R.id.supportlogo);

    SharedPreferences pref = getSharedPreferences("IntroStat", Context.MODE_PRIVATE);
    SharedPreferences.Editor editor = pref.edit();
    int countMe = pref.getInt("startCount", 0);
    countMe++;
    editor.putInt("startCount", countMe);
    editor.commit();

    YoYo.with(Techniques.Tada).duration(2000).playOn(logo);
    YoYo.with(Techniques.Landing).duration(2500).playOn(supportlogo);
    YoYo.with(Techniques.Landing).duration(2500).playOn(appname);
    YoYo.with(Techniques.Landing).duration(3000).playOn(by);

    boolean hasPermission = (ContextCompat.checkSelfPermission(this,
            Manifest.permission.WRITE_EXTERNAL_STORAGE) == PackageManager.PERMISSION_GRANTED);
    if (!hasPermission) {
        SharedPreferences pref2 = getSharedPreferences("IntroStat", Context.MODE_PRIVATE);
        SharedPreferences.Editor editor2 = pref2.edit();
        editor2.putBoolean("intro_executed", false);
        editor2.commit();
    }
    // Splashscreen Options
    myHandler = new Handler();

    myHandler.postDelayed(new Runnable() {
        @Override
        public void run() {
            SharedPreferences pref = getSharedPreferences("Fingerprint", Context.MODE_PRIVATE);
            boolean fingerprint_True = pref.getBoolean("fingerprintSet", false);
            if (fingerprint_True == true) {
                FingerprintDialog dialog = new FingerprintDialog();
                dialog.setStyle(DialogFragment.STYLE_NORMAL, R.style.DialogTheme);
                dialog.setCancelable(false);
                dialog.show(splashscreen.this, getString(R.string.app_name), 69);

            } else {
                Intent intent = new Intent(splashscreen.this, IntroActivity.class);
                startActivity(intent);
                finishAffinity();
            }
        }
    }, SPLASH_DURATION);
}

From source file:com.coinblesk.client.ui.authview.AuthenticationDialog.java

private void showSystemUI() {
    View decorView = getDecorView();
    if (decorView == null) {
        return;/*from   w  w  w .j a  v a  2 s.c  o m*/
    }

    decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
}

From source file:com.eggwall.SoundSleep.SleepActivity.java

/**
 * Set the full screen view, and also request a wake lock.
 *///from w  w  w  .ja  v  a  2 s.  c om
private void setGlobalScreenSettings() {
    final View topLevel = findViewById(R.id.toplevel);
    // Hide the System status bar
    if (SDK >= 11) {
        topLevel.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LOW_PROFILE);
    }
    // Keep the screen always on, irrespective of power state.
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);
}

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 w w w . j  a  va2 s.c  o  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:com.coinblesk.client.ui.authview.AuthenticationDialog.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.
    View decorView = getDecorView();
    if (decorView == null) {
        return;//from   w  w w.j  av a  2  s . c o m
    }

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

}

From source file:org.protocoderrunner.base.BaseActivity.java

public void lightsOutMode() {
    lightsOutMode = true;// ww w. j a v  a 2 s.co m
    final View rootView = getWindow().getDecorView();
    rootView.setSystemUiVisibility(View.STATUS_BAR_VISIBLE);
    rootView.setSystemUiVisibility(View.STATUS_BAR_HIDDEN);

    rootView.setOnSystemUiVisibilityChangeListener(new View.OnSystemUiVisibilityChangeListener() {
        @Override
        public void onSystemUiVisibilityChange(int visibility) {
            MLog.d(TAG, "" + visibility);
            rootView.setSystemUiVisibility(View.STATUS_BAR_VISIBLE);
            rootView.setSystemUiVisibility(View.STATUS_BAR_HIDDEN);
        }
    });
}

From source file:com.guodong.sun.guodong.activity.ZhiHuDetailActivity.java

@Override
protected void initViews(Bundle savedInstanceState) {

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        View decorView = getWindow().getDecorView();
        int option = View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
        decorView.setSystemUiVisibility(option);
        getWindow().setStatusBarColor(Color.TRANSPARENT);
    }//ww  w  .  ja v a2 s .  com

    //        mToolbar.setNavigationIcon(R.drawable.ic_arrow_back);
    setSupportActionBar(mToolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);

    ViewCompat.setTransitionName(mImageView, TRANSIT_PIC);

    initWebView();
    initShare();

    //        mAlertDialog = new AlertDialog.Builder(this).create();
    //        mAlertDialog.setView(getLayoutInflater().inflate(R.layout.loading_layout, null));

    mZhihuDetailPresenter = new ZhihuDetailPresenterImpl(this, this.bindToLifecycle());
    mId = getIntent().getIntExtra(EXTRA_ID, 0);
    mZhihuDetailPresenter.getZhihuDetailData(mId);

    mFButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ShareBoardConfig config = new ShareBoardConfig();
            config.setMenuItemBackgroundShape(ShareBoardConfig.BG_SHAPE_NONE);
            mShareAction.open(config);
        }
    });
}

From source file:com.keylesspalace.tusky.ViewMediaActivity.java

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_view_media);

    supportPostponeEnterTransition();//from   ww  w.  j a va  2 s .  c o m

    // Obtain the views.
    toolbar = findViewById(R.id.toolbar);
    viewPager = findViewById(R.id.view_pager);
    anyView = toolbar;

    // Gather the parameters.
    Intent intent = getIntent();
    attachments = intent.getParcelableArrayListExtra(EXTRA_ATTACHMENTS);
    int initialPosition = intent.getIntExtra(EXTRA_ATTACHMENT_INDEX, 0);

    final PagerAdapter adapter;

    if (attachments != null) {
        List<Attachment> realAttachs = CollectionsKt.map(attachments, AttachmentViewData::getAttachment);
        // Setup the view pager.
        adapter = new ImagePagerAdapter(getSupportFragmentManager(), realAttachs, initialPosition);

    } else {
        String avatarUrl = intent.getStringExtra(EXTRA_AVATAR_URL);

        if (avatarUrl == null) {
            throw new IllegalArgumentException("attachment list or avatar url has to be set");
        }

        adapter = new AvatarImagePagerAdapter(getSupportFragmentManager(), avatarUrl);
    }

    viewPager.setAdapter(adapter);
    viewPager.setCurrentItem(initialPosition);
    viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
        @Override
        public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
        }

        @Override
        public void onPageSelected(int position) {
            CharSequence title = adapter.getPageTitle(position);
            toolbar.setTitle(title);
        }

        @Override
        public void onPageScrollStateChanged(int state) {
        }
    });

    // Setup the toolbar.
    setSupportActionBar(toolbar);
    ActionBar actionBar = getSupportActionBar();
    if (actionBar != null) {
        actionBar.setDisplayHomeAsUpEnabled(true);
        actionBar.setDisplayShowHomeEnabled(true);
        actionBar.setTitle(adapter.getPageTitle(initialPosition));
    }
    toolbar.setNavigationOnClickListener(v -> supportFinishAfterTransition());
    toolbar.setOnMenuItemClickListener(item -> {
        int id = item.getItemId();
        switch (id) {
        case R.id.action_download:
            downloadImage();
            break;
        case R.id.action_open_status:
            onOpenStatus();
            break;
        }
        return true;
    });

    View decorView = getWindow().getDecorView();
    int uiOptions = View.SYSTEM_UI_FLAG_LOW_PROFILE;
    decorView.setSystemUiVisibility(uiOptions);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        getWindow().setStatusBarColor(Color.BLACK);
    }
}

From source file:com.manning.androidhacks.hack044.MainActivity3X.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);//w w w  . java 2s.c  om

    final View contentView = findViewById(R.id.content);

    contentView.setOnSystemUiVisibilityChangeListener(new OnSystemUiVisibilityChangeListener() {
        @Override
        public void onSystemUiVisibilityChange(int visibility) {
            final ActionBar actionBar = getActionBar();
            if (actionBar != null) {
                contentView.setSystemUiVisibility(visibility);

                if (visibility == View.STATUS_BAR_VISIBLE) {
                    actionBar.show();
                } else {
                    actionBar.hide();
                }
            }
        }
    });

    contentView.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            if (contentView.getSystemUiVisibility() == View.STATUS_BAR_VISIBLE) {
                contentView.setSystemUiVisibility(View.STATUS_BAR_HIDDEN);
            } else {
                contentView.setSystemUiVisibility(View.STATUS_BAR_VISIBLE);
            }
        }
    });
}