Java Code Examples for android.view.View.SYSTEM_UI_FLAG_FULLSCREEN

The following are Jave code examples for showing how to use SYSTEM_UI_FLAG_FULLSCREEN of the android.view.View class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: miaosou   File: PictureShowActivity.java   Source Code and License Vote up 7 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if(Build.VERSION.SDK_INT < 16){
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }else {
        View decorView = getWindow().getDecorView();
        int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
        decorView.setSystemUiVisibility(uiOptions);
    }

    setContentView(R.layout.activity_picture_show);
    Intent intent = getIntent();
    pictureWebUrl = intent.getStringExtra(PICTUREURL);
    pictureId = pictureWebUrl.substring(pictureWebUrl.lastIndexOf("/") + 1);
    progressBar = (ProgressBar) findViewById(R.id.pb_progress);
    getPictureUrl();
}
 
Example 2
Project: Instincts-2k17   File: GalleryActivity.java   Source Code and License Vote up 7 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    ActivityCompat.setExitSharedElementCallback(this, exitTransitionCallback);
    super.onCreate(savedInstanceState);

    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_gallery);
    ButterKnife.bind(this);

    setSupportActionBar(toolbar);
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowHomeEnabled(true);

    ArrayList<String> imagesList = new ArrayList<>();
    for (int i = 1; i <= 23; i++)
        imagesList.add("http://ssninstincts.org.in/img/gallery/big/" + i + ".jpg");

    galleryAdapter = new GalleryAdapter(this, imagesList);
    StaggeredGridLayoutManager gridLayoutManager =
            new StaggeredGridLayoutManager(2, StaggeredGridLayoutManager.VERTICAL);
    gridLayoutManager.setGapStrategy(StaggeredGridLayoutManager.GAP_HANDLING_MOVE_ITEMS_BETWEEN_SPANS);
    galleryRecyclerView.setHasFixedSize(true);
    galleryRecyclerView.setLayoutManager(gridLayoutManager);
    galleryRecyclerView.setAdapter(galleryAdapter);
}
 
Example 3
Project: Perfect-Day   File: LoginActivity.java   Source Code and License Vote up 7 votes
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_login);
    View decorView = getWindow().getDecorView();
    int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
    decorView.setSystemUiVisibility(uiOptions);
    ActionBar actionBar = getActionBar();
    if (null != actionBar) actionBar.hide();
    ButterKnife.bind(this);
    FirebaseAuth auth = FirebaseAuth.getInstance();
    if (auth.getCurrentUser() != null) {
        showWhiteSnackBar(R.string.sign_in_successful);
        googleLoginButton.setVisibility(View.INVISIBLE);
        Intent intent = new Intent(getApplicationContext(), MainActivity.class);
        intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP | Intent.FLAG_ACTIVITY_NEW_TASK);
        startActivity(intent);
        finish();
    }

}
 
Example 4
Project: Pocket-Plays-for-Twitch   File: VideoCastControllerActivity.java   Source Code and License Vote up 7 votes
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void setImmersive() {
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
        return;
    }
    int newUiOptions = getWindow().getDecorView().getSystemUiVisibility();

    // Navigation bar hiding:  Backwards compatible to ICS.
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        newUiOptions ^= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
    }

    // Status bar hiding: Backwards compatible to Jellybean
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        newUiOptions ^= View.SYSTEM_UI_FLAG_FULLSCREEN;
    }

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
        newUiOptions ^= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
    }

    getWindow().getDecorView().setSystemUiVisibility(newUiOptions);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
        setImmersive(true);
    }
}
 
Example 5
Project: KrGallery   File: MainActivity.java   Source Code and License Vote up 7 votes
/**
 * 隐藏状态栏
 * <p>
 * 在setContentView前调用
 */
protected void hideStatusBar() {
    final int sdkVer = Build.VERSION.SDK_INT;
    if (sdkVer < 16) {
        //4.0及一下
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    } else {
        View decorView = getWindow().getDecorView();
        int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
        decorView.setSystemUiVisibility(uiOptions);
        ActionBar actionBar = getActionBar();
        if (actionBar != null) {
            actionBar.hide();
        }
    }
}
 
Example 6
Project: COB   File: CordovaActivity.java   Source Code and License Vote up 6 votes
/**
 * Called when view focus is changed
 */
@Override
public void onWindowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);
    if (hasFocus && immersiveMode) {
        final int uiOptions = 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;

        getWindow().getDecorView().setSystemUiVisibility(uiOptions);
    }
}
 
Example 7
Project: PictureShow   File: PhotoActivity.java   Source Code and License Vote up 6 votes
private void enterFullScreen() {
    if(mToolbar == null || rootView == null || bottomView == null) return;

    //bottomView.setVisibility(View.GONE);

    int flag = View.SYSTEM_UI_FLAG_LOW_PROFILE;
    if(ApiHelper.HAS_VIEW_SYSTEM_UI_FLAG_LAYOUT_STABLE)
        flag = View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE;

    mToolbar.setVisibility(View.INVISIBLE);
    rootView.setSystemUiVisibility(flag);
    fullScreen = true;
}
 
Example 8
Project: DinningShare   File: CordovaActivity.java   Source Code and License Vote up 6 votes
/**
 * Called when view focus is changed
 */
@Override
public void onWindowFocusChanged(boolean hasFocus) {
    super.onWindowFocusChanged(hasFocus);
    if (hasFocus && immersiveMode) {
        final int uiOptions = 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;

        getWindow().getDecorView().setSystemUiVisibility(uiOptions);
    }
}
 
Example 9
Project: Cluttr   File: ViewActivity.java   Source Code and License Vote up 6 votes
@Override
public void onSystemUiVisibilityChange(int i) {
    if ((i & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
        toggleToolbar(true);
    } else {
        // The system bars are NOT visible.
    }
}
 
Example 10
Project: AppRTC-Android   File: CallActivity.java   Source Code and License Vote up 6 votes
@TargetApi(19)
private static int getSystemUiVisibility() {
  int flags = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION | View.SYSTEM_UI_FLAG_FULLSCREEN;
  if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
    flags |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
  }
  return flags;
}
 
Example 11
Project: Amazing   File: ConstraintActivity.java   Source Code and License Vote up 6 votes
private void fullscreen() {
    View decorView = getWindow().getDecorView();
    // Hide the status bar.
    int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
    decorView.setSystemUiVisibility(uiOptions);
    // Remember that you should never show the action bar if the
    // status bar is hidden, so hide that too if necessary.
    //        ActionBar actionBar = getActionBar();
    //        actionBar.hide();
}
 
Example 12
Project: Android-Development   File: SplashScreenActivity.java   Source Code and License Vote up 6 votes
private void hideStatusBar() {
    // If the Android version is lower than Jellybean, use this call to hide
    // the status bar.
    if (Build.VERSION.SDK_INT < 16) {
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }

    //Hide the Status Bar on Android 4.1 and Higher
    View decorView = getWindow().getDecorView();
    // Hide the status bar.
    int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
    decorView.setSystemUiVisibility(uiOptions);
}
 
Example 13
Project: mv-android-client   File: WebPlayerActivity.java   Source Code and License Vote up 6 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (BuildConfig.BACK_BUTTON_QUITS) {
        createQuitDialog();
    }

    mSystemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        mSystemUiVisibility |= View.SYSTEM_UI_FLAG_FULLSCREEN;
        mSystemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE;
        mSystemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
        mSystemUiVisibility |= View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
            mSystemUiVisibility |= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
        }
    }

    mPlayer = PlayerHelper.create(this);
    mPlayer.setKeepScreenOn();
    setContentView(mPlayer.getView());

    if (!addBootstrapInterface(mPlayer)) {
        Uri.Builder projectURIBuilder = Uri.fromFile(new File(getString(R.string.mv_project_index))).buildUpon();
        Bootstrapper.appendQuery(projectURIBuilder, getString(R.string.query_noaudio));
        if (BuildConfig.SHOW_FPS) {
            Bootstrapper.appendQuery(projectURIBuilder, getString(R.string.query_showfps));
        }
        mPlayer.loadUrl(projectURIBuilder.build().toString());
    }
}
 
Example 14
Project: Perfect-Day   File: MainActivity.java   Source Code and License Vote up 6 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ButterKnife.bind(this);
    View decorView = getWindow().getDecorView();
    int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
    decorView.setSystemUiVisibility(uiOptions);
    ActionBar actionBar = getActionBar();
    if (null != actionBar) actionBar.hide();
    mBottomBar.setOnTabSelectListener(
            new OnTabSelectListener() {
                @Override
                public void onTabSelected(@IdRes int tabId) {
                    Fragment fragment;
                    switch (tabId) {
                        case R.id.bot_bar_today:
                            fragment = new TodayTasksFragment();
                            break;
                        case R.id.bot_bar_list:
                            fragment = new ListTasksFragment();
                            break;
                        case R.id.bot_bar_more:
                            fragment = new MoreInfoFragment();
                            break;
                        default:
                            fragment = new TodayTasksFragment();
                    }
                    FragmentManager fragmentManager = getSupportFragmentManager();
                    FragmentTransaction ft = fragmentManager.beginTransaction();
                    ft.replace(R.id.flContent, fragment, fragment.getClass().getName());
                    ft.commit();
                }
            });
}
 
Example 15
Project: whatanime-android   File: VideoPreviewActivity.java   Source Code and License Vote up 6 votes
private int getFullscreenUiFlags() {
    int flags = View.SYSTEM_UI_FLAG_LOW_PROFILE | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;

    flags |= View.SYSTEM_UI_FLAG_LAYOUT_STABLE
            | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
            | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
            | View.SYSTEM_UI_FLAG_FULLSCREEN
            | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;

    return flags;
}
 
Example 16
Project: Oblique   File: Utils.java   Source Code and License Vote up 6 votes
public static void hideStatusbar(Activity context) {
    if (Build.VERSION.SDK_INT < 16) {
        context.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                WindowManager.LayoutParams.FLAG_FULLSCREEN);
    } else {
        View decorView = context.getWindow().getDecorView();
        int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
        decorView.setSystemUiVisibility(uiOptions);
    }
}
 
Example 17
Project: hack-nanjing-2017   File: CameraActivity.java   Source Code and License Vote up 5 votes
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    extra_bg = getIntent().getIntExtra(EXTRA_BG, -1);
    View decorView = getWindow().getDecorView();
    int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
    decorView.setSystemUiVisibility(uiOptions);

    if (extra_bg >= 0) {
        Bitmap background = BitmapFactory.decodeResource(getResources(), extra_bg);
        int width = background.getWidth(), height = background.getHeight();
        background.recycle();
        Picasso.with(this).load(extra_bg).rotate(width > height ? 90 : 0).into(originPhoto);

        Picasso.with(this).load(R.drawable.group_photo).into(ivCamera);
    } else {
        Picasso.with(this).load(R.drawable.camera).into(ivCamera);
    }
    camera = getCameraInstance();
   /* camera.autoFocus(new Camera.AutoFocusCallback() {
        @Override
        public void onAutoFocus(boolean success, Camera camera) {
            Camera.Parameters parameters = camera.getParameters();
            camera.setParameters(parameters);
        }
    });*/

    // Create our Preview view and set it as the content of our activity.
    svHolder = svPreview.getHolder();
    svHolder.addCallback(this);

    ivCamera.setOnClickListener(v -> {
        camera.takePicture(null, null, (data, camera1) -> {
            BitmapFactory.Options options = new BitmapFactory.Options();
            options.inSampleSize = 5;
            BitmapFactory.decodeByteArray(data, 0, data.length, options);

            if (extra_bg < 0) {
                finish();
            }
            Bitmap bitmap = BitmapFactory.decodeByteArray(data, 0, data.length, options);
            Bitmap origin = BitmapFactory.decodeResource(getResources(), extra_bg);


            try {
                save(bitmap, origin);
            } catch (IOException e) {
                e.printStackTrace();
            } finally {
                finish();
            }
        });
    });
}
 
Example 18
Project: ShotsNewsApp   File: PptWebViewActivity.java   Source Code and License Vote up 5 votes
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        View decorView = getWindow().getDecorView();
// Hide the status bar.
        int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
        decorView.setSystemUiVisibility(uiOptions);
// Remember that you should never show the action bar if the
// status bar is hidden, so hide that too if necessary.
        //android.app.ActionBar actionBar = getActionBar();
        // actionBar.hide();
        setContentView(R.layout.activity_ppt_web_view);

//        mVisible = true;
//        mControlsView = findViewById(R.id.fullscreen_content_controls);
//        mContentView = findViewById(R.id.fullscreen_content);
//
//
//        // Set up the user interaction to manually show or hide the system UI.
//        mContentView.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View view) {
//                toggle();
//            }
//        });

        Intent intent=getIntent();
        String url=intent.getStringExtra("modulelink");
        url=url.replaceAll(" ","%20");
        webView = (WebView)findViewById(R.id.webView2);
        webView.getSettings().setJavaScriptEnabled(true);
        Uri uri = Uri.parse("https://www.example.com");
        //  webView.loadUrl("https://view.officeapps.live.com/op/view.aspx?src=http%3a%2f%2fvideo.ch9.ms%2fbuild%2f2011%2fslides%2fTOOL-532T_Sutter.pptx");
        // webView.loadUrl("https://view.officeapps.live.com/op/view.aspx?src=https://www.dropbox.com/s/2scazhwg7o5l2z3/SE1.pptx?dl=1");
        //   webView.loadUrl("https://view.officeapps.live.com/op/view.aspx?src=https://www.dropbox.com/s/n775vtevnwlqzlg/test.pptx?dl=1");


        webView.getSettings().setLoadsImagesAutomatically(true);
        webView.getSettings().setJavaScriptEnabled(true);
        webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
        webView.setWebViewClient(new WebViewClient());
        webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY);
//        webView.loadUrl("https://view.officeapps.live.com/op/view.aspx?src=http%3a%2f%2fvideo.ch9.ms%2fbuild%2f2011%2fslides%2fTOOL-532T_Sutter.pptx");
        webView.loadUrl("https://view.officeapps.live.com/op/view.aspx?src="+url);


        // Upon interacting with UI controls, delay any scheduled hide()
        // operations to prevent the jarring behavior of controls going away
        // while interacting with the UI.
        // findViewById(R.id.dummy_button).setOnTouchListener(mDelayHideTouchListener);
    }
 
Example 19
Project: SuperVideoPlayer   File: Tools.java   Source Code and License Vote up 5 votes
/**
* 隐藏虚拟键
* @param context
*/
public static void toggleHideyBar(Activity context) {

       // BEGIN_INCLUDE (get_current_ui_flags)
       // BEGIN_INCLUDE (get_current_ui_flags)
       // getSystemUiVisibility() gives us that bitfield.
       int uiOptions = context.getWindow().getDecorView().getSystemUiVisibility();
       int newUiOptions = uiOptions;
       // END_INCLUDE (get_current_ui_flags)
       // BEGIN_INCLUDE (toggle_ui_flags)
       boolean isImmersiveModeEnabled =
               ((uiOptions | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY) == uiOptions);
       if (isImmersiveModeEnabled) {
           Log.i("TAG", "Turning immersive mode mode off. ");
       } else {
           Log.i("TAG", "Turning immersive mode mode on.");
       }

       // Navigation bar hiding:  Backwards compatible to ICS.
       if (Build.VERSION.SDK_INT >= 14) {
           newUiOptions ^= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
       }

       // Status bar hiding: Backwards compatible to Jellybean
       if (Build.VERSION.SDK_INT >= 16) {
           newUiOptions ^= View.SYSTEM_UI_FLAG_FULLSCREEN;
       }

       // Immersive mode: Backward compatible to KitKat.
       // Note that this flag doesn't do anything by itself, it only augments the behavior
       // of HIDE_NAVIGATION and FLAG_FULLSCREEN.  For the purposes of this sample
       // all three flags are being toggled together.
       // Note that there are two immersive mode UI flags, one of which is referred to as "sticky".
       // Sticky immersive mode differs in that it makes the navigation and status bars
       // semi-transparent, and the UI flag does not get cleared when the user interacts with
       // the screen.
       if (Build.VERSION.SDK_INT >= 18) {
           newUiOptions ^= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
       }

       context.getWindow().getDecorView().setSystemUiVisibility(newUiOptions);
       //END_INCLUDE (set_ui_flags)
   }
 
Example 20
Project: Instincts-2k17   File: RegisterActivity.java   Source Code and License Vote up 5 votes
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    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_register);
    ButterKnife.bind(this);

    getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);

    ShowEnterAnimation();

    fab.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            animateRevealClose();
        }
    });

    databaseReference = FirebaseDatabase.getInstance().getReference();
    currentUser = FirebaseAuth.getInstance().getCurrentUser();
    auth = FirebaseAuth.getInstance();
    authStateListener = new FirebaseAuth.AuthStateListener() {
        @Override
        public void onAuthStateChanged(@NonNull FirebaseAuth firebaseAuth) {
            FirebaseUser user = firebaseAuth.getCurrentUser();
            if (user != null) {
                Log.d(TAG, "onAuthStateChanged:signed_in:" + user.getUid());
            } else {
                Log.d(TAG, "onAuthStateChanged:signed_out");
            }
        }
    };

    try {
        populateProfile();
    } catch (Exception e) {
        LogHelper.e(TAG, e.toString());
    }
}