直播系統平臺原始碼隱藏虛擬導航欄,禁止下拉通知欄,禁止上滑出虛擬導航欄

zhibo系統開發發表於2021-12-03

直播系統平臺原始碼隱藏虛擬導航欄,禁止下拉通知欄,禁止上滑出虛擬導航欄實現的相關程式碼

1.Android 隱藏虛擬導航欄

        View decorView = getWindow().getDecorView();
        decorView.setSystemUiVisibility(
                View.SYSTEM_UI_FLAG_LAYOUT_STABLE
                        | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
                        | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                        | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
                        | View.SYSTEM_UI_FLAG_FULLSCREEN
                        | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);

2.禁止下拉通知欄

        if (disable) {
            mStatusBarManager.disable(StatusBarManager.DISABLE_EXPAND);
        } else {
            mStatusBarManager.disable(StatusBarManager.DISABLE_NONE);
        }

3.隱藏導航欄時 禁止上滑出導航欄

frameworks / base/services/core/java/com/android/server/wm/DisplayPolicy.java
                    @Override
                    public void onSwipeFromBottom() {
                        synchronized (mLock) {
                            if (mNavigationBar != null
                                    && mNavigationBarPosition == NAV_BAR_BOTTOM) {
                                /* add for factorymode test begin */
                                if (getTestStatus()) { 判斷條件
                                    Slog.i(TAG, "onSwipeFromBottom Test, not requestTransientBars");
                                    return;
                                }
                                /* add for factorymode test end */
                                requestTransientBars(mNavigationBar);
                            }
                        }
                    }

4.禁止下拉欄也可以這樣改

 
                    @Override
                    public void onSwipeFromTop() {
                        synchronized (mLock) {
                            if (mStatusBar != null) {
                                /* add for factorymode test begin */
                                if (getTestStatus()) {判斷條件
                                    Slog.i(TAG, "onSwipeFromTop Test, not requestTransientBars");
                                    return;
                                }
                                /* add for factorymode test end */
 
                                requestTransientBars(mStatusBar);
                            }
                        }
                    }

以上就是直播系統平臺原始碼隱藏虛擬導航欄,禁止下拉通知欄,禁止上滑出虛擬導航欄實現的相關程式碼, 更多內容歡迎關注之後的文章


來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/69978258/viewspace-2845643/,如需轉載,請註明出處,否則將追究法律責任。

相關文章