안 드 로 이 드 5.1 시스템 맞 춤 형 응용 전체 화면 인터페이스 금지 상태 표시 줄 드 롭 다운 실현

4511 단어 Androidframeworks
참조 하 다.http://www.tuicool.com/articles/iEb6Jb기초 위 에서 수정 하 다
Activity 에 추가:
private static final int SYSTEM_UI_FLAG_IMMERSIVE_GESTURE_ISOLATED = 0x00002000;

findViewById(R.id.scrollView1).setSystemUiVisibility(SYSTEM_UI_FLAG_IMMERSIVE_GESTURE_ISOLATED);

frameworks/base 패 치 는 다음 과 같 습 니 다.
From c58540f82c51ba7b6846e447bc3328ee91d5379f Mon Sep 17 00:00:00 2001
From: weitf 
Date: Thu, 12 Nov 2015 10:31:06 +0800
Subject: [PATCH] Prohibit state bar drop-down

---
 core/java/android/view/View.java                   |    8 ++++++
 .../internal/policy/impl/PhoneWindowManager.java   |   29 ++++++++++++++++++++
 2 files changed, 37 insertions(+)
 mode change 100644 => 100755 core/java/android/view/View.java

diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java
old mode 100644
new mode 100755
index b01201a..c6e3332
--- a/core/java/android/view/View.java
+++ b/core/java/android/view/View.java
@@ -2599,6 +2599,14 @@ public class View implements Drawable.Callback, KeyEvent.Callback,
      * with one or both of those flags.
      */
     public static final int SYSTEM_UI_FLAG_IMMERSIVE_STICKY = 0x00001000;
+    
+    /**
+     * @hide
+     *
+     * NOTE: Flag for {@link #setSystemUiVisibility(int)}: It help user to disable transient
+     * status bar triggered by gesture
+     */
+    public static final int SYSTEM_UI_FLAG_IMMERSIVE_GESTURE_ISOLATED = 0x00002000;

     /**
      * @deprecated Use {@link #SYSTEM_UI_FLAG_LOW_PROFILE} instead.
diff --git a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
index f6d58ba..a0fba7b 100755
--- a/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
+++ b/policy/src/com/android/internal/policy/impl/PhoneWindowManager.java
@@ -1385,6 +1385,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                 new SystemGesturesPointerEventListener.Callbacks() {
                     @Override
                     public void onSwipeFromTop() {
+
+                        //aded by inet_weitf @20151109
+                        if (isGestureIsolated())
+                           return;
+                        //added end
+
                         if (mStatusBar != null) {
                             requestTransientBars(mStatusBar);
                         }
@@ -1394,6 +1400,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                     }
                     @Override
                     public void onSwipeFromBottom() {
+
+                        //aded by inet_weitf @20151109
+                        if (isGestureIsolated())
+                           return;
+                        //added end
+
                         if (mNavigationBar != null && mNavigationBarOnBottom) {
                             requestTransientBars(mNavigationBar);
                         }
@@ -1403,6 +1415,12 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                     }
                     @Override
                     public void onSwipeFromRight() {
+
+                        //aded by inet_weitf @20151109
+                        if (isGestureIsolated())
+                           return;
+                        //added end
+
                         if (mNavigationBar != null && !mNavigationBarOnBottom) {
                             requestTransientBars(mNavigationBar);
                         }
@@ -1411,6 +1429,17 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                     public void onDebug() {
                         // no-op
                     }
+
+                    //aded by inet_weitf @20151109
+                    private boolean isGestureIsolated() {
+                       WindowState win = mFocusedWindow != null ? mFocusedWindow : mTopFullscreenOpaqueWindowState;
+                       if (win != null && (win.getSystemUiVisibility() & View.SYSTEM_UI_FLAG_IMMERSIVE_GESTURE_ISOLATED) != 0)
+                           return true;
+                       else
+                           return false;
+                   }
+                   //added end
+                   
                 });
         mImmersiveModeConfirmation = new ImmersiveModeConfirmation(mContext);
         mWindowManagerFuncs.registerPointerEventListener(mSystemGestures);
-- 
1.7.9.5

좋은 웹페이지 즐겨찾기