项目作者: zhanghai

项目描述 :
Helper for dealing with Android System UI visibility
高级语言: Java
项目地址: git://github.com/zhanghai/SystemUiHelper.git
创建时间: 2015-11-30T09:56:50Z
项目社区:https://github.com/zhanghai/SystemUiHelper

开源协议:

下载


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:

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

Usage

In Activity.onCreate():

  1. mSystemUiHelper = new SystemUiHelper(this, SystemUiHelper.LEVEL_IMMERSIVE,
  2. SystemUiHelper.FLAG_IMMERSIVE_STICKY,
  3. new SystemUiHelper.OnVisibilityChangeListener() {
  4. @Override
  5. public void onVisibilityChange(boolean visible) {
  6. ...
  7. }
  8. });
  9. // This will set up window flags.
  10. mSystemUiHelper.show();

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

License

  1. Copyright 2015 Zhang Hai
  2. Licensed under the Apache License, Version 2.0 (the "License");
  3. you may not use this file except in compliance with the License.
  4. You may obtain a copy of the License at
  5. http://www.apache.org/licenses/LICENSE-2.0
  6. Unless required by applicable law or agreed to in writing, software
  7. distributed under the License is distributed on an "AS IS" BASIS,
  8. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  9. See the License for the specific language governing permissions and
  10. limitations under the License.