If you think the Android project tdpforce listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
Java Source Code
package org.telugudesam.cadre.util;
/*www.java2s.com*/import android.app.Activity;
import android.view.View;
import android.view.WindowManager;
/**
* A base implementation of {@link SystemUiHider}. Uses APIs available in all
* API levels to show and hide the status bar.
*/publicclass SystemUiHiderBase extends SystemUiHider {
/**
* Whether or not the system UI is currently visible. This is a cached value
* from calls to {@link #hide()} and {@link #show()}.
*/privateboolean mVisible = true;
/**
* Constructor not intended to be called by clients. Use
* {@link SystemUiHider#getInstance} to obtain an instance.
*/protected SystemUiHiderBase(Activity activity, View anchorView, int flags) {
super(activity, anchorView, flags);
}
@Override
publicvoid setup() {
if ((mFlags & FLAG_LAYOUT_IN_SCREEN_OLDER_DEVICES) == 0) {
mActivity.getWindow().setFlags(
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS,
WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN
| WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
}
}
@Override
publicboolean isVisible() {
return mVisible;
}
@Override
publicvoid hide() {
if ((mFlags & FLAG_FULLSCREEN) != 0) {
mActivity.getWindow().setFlags(
WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
mOnVisibilityChangeListener.onVisibilityChange(false);
mVisible = false;
}
@Override
publicvoid show() {
if ((mFlags & FLAG_FULLSCREEN) != 0) {
mActivity.getWindow().setFlags(0,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
mOnVisibilityChangeListener.onVisibilityChange(true);
mVisible = true;
}
}