+ protected void onPostCreate(Bundle savedInstanceState) {
+ super.onPostCreate(savedInstanceState);
+
+ // Trigger the initial hide() shortly after the activity has been
+ // created, to briefly hint to the user that UI controls
+ // are available
+ delayedHide(INITIAL_HIDE_DELAY);
+
+ }
+
+ Handler mHideSystemUiHandler = new Handler() {
+ @Override
+ public void handleMessage(Message msg) {
+ if (isHoneycombOrHigher()) {
+ hideSystemUI(mFullScreenAnchorView);
+ }
+ getSupportActionBar().hide();
+ }
+ };
+
+ private void delayedHide(int delayMillis) {
+ mHideSystemUiHandler.removeMessages(0);
+ mHideSystemUiHandler.sendEmptyMessageDelayed(0, delayMillis);
+ }
+
+
+ /// handle Window Focus changes
+ @Override
+ public void onWindowFocusChanged(boolean hasFocus) {
+ super.onWindowFocusChanged(hasFocus);
+
+ // When the window loses focus (e.g. the action overflow is shown),
+ // cancel any pending hide action.
+ if (!hasFocus) {
+ mHideSystemUiHandler.removeMessages(0);
+ }
+ }
+
+
+