Skip to content
Helper for dealing with Android System UI visibility
Branch: master
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
gradle/wrapper Update dependencies; Untrack .idea. Apr 24, 2016
library Update dependencies; Untrack .idea. Apr 24, 2016
sample Update dependencies; Untrack .idea. Apr 24, 2016
screenshot Add screenshot. Nov 30, 2015
.gitignore Update dependencies; Untrack .idea. Apr 24, 2016
README.md [Feature] Update GitHub username. May 16, 2019
build.gradle
gradle-mvn-push.gradle Initial commit; Project skeleton. Nov 30, 2015
gradle.properties [Feature] Update GitHub username. May 16, 2019
gradlew Initial commit; Project skeleton. Nov 30, 2015
gradlew.bat Initial commit; Project skeleton. Nov 30, 2015
settings.gradle Initial commit; Project skeleton. Nov 30, 2015

README.md

SystemUiHelper

Helper for dealing with Android System UI visibility. Authored by Roman Nurik and Chris Banes.

Original Blog post: SystemUiHelper · Chris Banes

Original Gist: chrisbanes/SystemUiHelper

Why SystemUiHelper?

Android has introduced a lot of different API for controlling system UI visibility throughout its evolution. In order to simplify such complexity, SystemUiHelper categorized the possible behavior into LEVEL_LOW_PROFILE, LEVEL_HIDE_STATUS_BAR, LEVEL_LEAN_BACK and LEVEL_IMMERSIVE. Each one is pretty self explanatory.

Why this library?

Although there have been some other projects available, I created this library because this way I can always try to track the latest upstream changes. Third-party fixes are also welcomed to be incorporated.

This library has already included a fix for delayed system UI visibility change from myself.

What's more, a sample application is given on how to use the SystemUiHelper with Toolbar from appcompat-v7.

Sample application

Sample APK

Integration

Gradle:

compile 'me.zhanghai.android.systemuihelper:library:1.0.0'

Usage

In Activity.onCreate():

mSystemUiHelper = new SystemUiHelper(this, SystemUiHelper.LEVEL_IMMERSIVE,
        SystemUiHelper.FLAG_IMMERSIVE_STICKY,
        new SystemUiHelper.OnVisibilityChangeListener() {
            @Override
            public void onVisibilityChange(boolean visible) {
                ...
            }
        });
// This will set up window flags.
mSystemUiHelper.show();

You can refer to the sample app's MainActivity for detail.

License

Copyright 2015 Zhang Hai

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
You can’t perform that action at this time.