Java 类android.view.View.OnSystemUiVisibilityChangeListener 实例源码

项目:FMTech    文件:PhotoViewController.java   
public PhotoViewController(ActivityInterface paramActivityInterface)
{
  this.mActivity = paramActivityInterface;
  if (Build.VERSION.SDK_INT < 11) {}
  for (this.mSystemUiVisibilityChangeListener = null;; this.mSystemUiVisibilityChangeListener = new View.OnSystemUiVisibilityChangeListener()
      {
        public final void onSystemUiVisibilityChange(int paramAnonymousInt)
        {
          if ((Build.VERSION.SDK_INT >= 19) && (paramAnonymousInt == 0) && (PhotoViewController.this.mLastFlags == 3846)) {
            PhotoViewController.this.setFullScreen(false, true);
          }
        }
      })
  {
    this.mAccessibilityManager = ((AccessibilityManager)paramActivityInterface.getContext().getSystemService("accessibility"));
    return;
  }
}
项目:NoticeDog    文件:InboxViewManager.java   
private void createListenerView() {
    this.listenerView = new View(this.context) {
        protected boolean fitSystemWindows(Rect insets) {
            if (insets.top == 0) {
                InboxViewManager.this.logger.info("fitSystemWindows : 0");
                InboxViewManager.this.setTabVisibility(Boolean.valueOf(false), eVisibilityReason.FullScreenMode);
            } else {
                InboxViewManager.this.logger.info("fitSystemWindows : != 0");
                InboxViewManager.this.setTabVisibility(Boolean.valueOf(true), eVisibilityReason.FullScreenMode);
            }
            return super.fitSystemWindows(insets);
        }

        public boolean dispatchKeyEvent(KeyEvent event) {
            if (event.getKeyCode() == 4) {
            }
            return super.dispatchKeyEvent(event);
        }
    };
    this.listenerView.setOnSystemUiVisibilityChangeListener(new OnSystemUiVisibilityChangeListener() {
        public void onSystemUiVisibilityChange(int visibility) {
            if ((visibility & 4) == 0) {
                InboxViewManager.this.setTabVisibility(Boolean.valueOf(true), eVisibilityReason.FullScreenMode);
            } else {
                InboxViewManager.this.setTabVisibility(Boolean.valueOf(false), eVisibilityReason.FullScreenMode);
            }
        }
    });
    WindowManager.LayoutParams params = new WindowManager.LayoutParams(-2, -2, 2002, 65816, -3);
    params.width = 1;
    params.height = 1;
    params.gravity = 51;
    getWindowManager().addView(this.listenerView, params);
}
项目:Common-Android    文件:FullscreenFragment.java   
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void registerSystemUiVisibility() {
    final View decorView = getActivity().getWindow().getDecorView();
    decorView.setOnSystemUiVisibilityChangeListener(new OnSystemUiVisibilityChangeListener() {

        @Override
        public void onSystemUiVisibilityChange(int visibility) {
            if ((visibility & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
                setFullscreen();
            }
        }
    });
}
项目:365browser    文件:WebappActivity.java   
/**
 * Sets activity's decor view into an immersive mode.
 * If immersive mode is not supported, this method no-ops.
 */
private void enterImmersiveMode() {
    // Immersive mode is only supported in API 19+.
    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) return;

    if (mSetImmersiveRunnable == null) {

        final View decor = getWindow().getDecorView();

        mSetImmersiveRunnable = new Runnable() {
            @Override
            public void run() {
                int currentFlags = decor.getSystemUiVisibility();
                int desiredFlags = currentFlags | IMMERSIVE_MODE_UI_FLAGS;
                if (currentFlags != desiredFlags) {
                    decor.setSystemUiVisibility(desiredFlags);
                }
            }
        };

        // When we enter immersive mode for the first time, register a
        // SystemUiVisibilityChangeListener that restores immersive mode. This is necessary
        // because user actions like focusing a keyboard will break out of immersive mode.
        decor.setOnSystemUiVisibilityChangeListener(new OnSystemUiVisibilityChangeListener() {
            @Override
            public void onSystemUiVisibilityChange(int newFlags) {
                if ((newFlags & View.SYSTEM_UI_FLAG_FULLSCREEN) == 0) {
                    asyncSetImmersive(RESTORE_IMMERSIVE_MODE_DELAY_MILLIS);
                }
            }
        });
    }

    asyncSetImmersive(0);
}
项目:Cardboard    文件:CardboardActivity.java   
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    requestWindowFeature(1);

    getWindow().addFlags(128);

    this.mMagnetSensor = new MagnetSensor(this);
    this.mMagnetSensor.setOnCardboardTriggerListener(this);

    this.mNfcSensor = NfcSensor.getInstance(this);
    this.mNfcSensor.addOnCardboardNfcListener(this);

    onNfcIntent(getIntent());

    setVolumeKeysMode(2);
    if (Build.VERSION.SDK_INT < 19) {
        final Handler handler = new Handler();
        getWindow().getDecorView().setOnSystemUiVisibilityChangeListener(
                new View.OnSystemUiVisibilityChangeListener() {
                    public void onSystemUiVisibilityChange(int visibility) {
                        if ((visibility & 0x2) == 0) {
                            handler.postDelayed(new Runnable() {
                                public void run() {
                                    CardboardActivity.this
                                            .setFullscreenMode();
                                }
                            }, 2000L);
                        }
                    }
                });
    }
}
项目:RedditInPictures    文件:ImageViewerActivity.java   
public OnSystemUiVisibilityChangeListener getOnSystemUiVisibilityChangeListener() {
    return new OnSystemUiVisibilityChangeListener() {

        @Override
        public void onSystemUiVisibilityChange(int visibility) {
            if ((visibility & View.SYSTEM_UI_FLAG_LOW_PROFILE) != 0) {
                getActionBar().hide();
            } else {
                getActionBar().show();
            }
        }
    };
}
项目:AndroidViewHelper    文件:ViewWrapper.java   
/**
* @see View#setOnSystemUiVisibilityChangeListener(OnSystemUiVisibilityChangeListener)
*/
 public W setOnSystemUiVisibilityChangeListener(OnSystemUiVisibilityChangeListener l) {
     mView.setOnSystemUiVisibilityChangeListener(l);
     return (W)this;
 }
项目:Mizuu    文件:ImageViewer.java   
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (MizLib.hasKitKat()) {
        setTheme(R.style.Mizuu_Theme_Translucent_FullScreen);
    } else {
        setTheme(R.style.Mizuu_Theme_Transparent_FullScreen);
    }

    ViewUtils.setupWindowFlagsForStatusbarOverlay(getWindow(), true);

    mToolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(mToolbar);

    ViewUtils.setProperToolbarSize(this, mToolbar);

    getSupportActionBar().setBackgroundDrawable(getResources().getDrawable(R.drawable.transparent_actionbar));

    mBus = MizuuApplication.getBus();

    mPortraitPhotos = getIntent().getBooleanExtra("portraitPhotos", true);
    mPhotos = getIntent().getStringArrayExtra("photos");

    getSupportActionBar().setTitle((getIntent().getIntExtra("selectedIndex", 0) + 1) + " " + getString(R.string.of) + " " + mPhotos.length);

    mViewPager = (ViewPager) findViewById(R.id.awesomepager);
    mViewPager.setPageMargin(MizLib.convertDpToPixels(getApplicationContext(), 16));
    mViewPager.setAdapter(new ActorPhotosAdapter(getSupportFragmentManager()));
    mViewPager.setOnPageChangeListener(new SimpleOnPageChangeListener() {
        @Override
        public void onPageSelected(int arg0) {
            getSupportActionBar().setTitle((arg0 + 1) + " " + getString(R.string.of) + " " + mPhotos.length);
        }

    });
    mViewPager.setCurrentItem(getIntent().getIntExtra("selectedIndex", 0));

    View decorView = getWindow().getDecorView();
    decorView.setOnSystemUiVisibilityChangeListener(new OnSystemUiVisibilityChangeListener() {
        @Override
        public void onSystemUiVisibilityChange(int visibility) {
            if (visibility == 0) {
                // The UI is visible due to user interaction - let's hide it again after three seconds
                mHandler.postDelayed(mHideSystemUiRunnable, 3000);
            }
        }
    });
}