Browse Source

[공통][Common] 소프트 내비게이션바 유무에 따른 스크린 크기 조절 2
- 소프트 키보드 유무 로직과 통합

hyodong.min 6 years ago
parent
commit
5b76d88503

+ 1 - 1
app/src/main/java/kr/co/zumo/app/lifeplus/helper/ScreenSizeHelper.java

@@ -52,12 +52,12 @@ public class ScreenSizeHelper extends Helper {
       height = metrics.heightPixels;
     }
 
-    Log.w("APP# ScreenSizeHelper | init", "|" + " SCREEN W: " + width + ", H: " + height);
     screenWidth = width;
     screenHeight = height;
     if (false == AppUtil.isFullScreenVersion()) {
       screenHeight = screenHeight - ResourceUtil.getStatusBarHeight();
     }
+    Log.w("APP# ScreenSizeHelper | init", "|" + " SCREEN W: " + screenWidth + ", H: " + screenHeight);
   }
 
 

+ 9 - 26
app/src/main/java/kr/co/zumo/app/lifeplus/view/custom/FullScreenWithKeyBoardLayout.java

@@ -37,8 +37,6 @@ public class FullScreenWithKeyBoardLayout {
     frameLayoutParams = (FrameLayout.LayoutParams) childContent.getLayoutParams();
     decorView = activity.getWindow().getDecorView();
 
-    setOnSystemUiVisibilityChange();
-    setOnSystemUiVisibilityChangeListener();
   }
 
   private void possiblyResizeChildOfContent() {
@@ -55,12 +53,19 @@ public class FullScreenWithKeyBoardLayout {
       if (childContent.getPaddingBottom() < (usableHeightSansKeyboard / 4)) {
         if (heightDifference > (usableHeightSansKeyboard / 4)) {
           //keyboard probably just became visible
-          heightDifference = heightDifference - ResourceUtil.getStatusBarHeightManual() - ResourceUtil.getNavBarHeight();
+          heightDifference = heightDifference - ResourceUtil.getStatusBarHeightManual();
           frameLayoutParams.height = usableHeightSansKeyboard - heightDifference;
         }
         else {
           //keyboard probably just became hidden
-          frameLayoutParams.height = usableHeightSansKeyboard;
+          /**
+           * 화면 크기에 맞게 레이아웃 변경
+           * - 하단 네비바 유무에 따라서 스크린 사이즈 변경 됨
+           */
+          if (AppUtil.isFullScreenVersion()) {
+            usableHeightNow += ResourceUtil.getStatusBarHeight();
+          }
+          frameLayoutParams.height = usableHeightNow;
         }
         childContent.requestLayout();
       }
@@ -78,26 +83,4 @@ public class FullScreenWithKeyBoardLayout {
     childContent.getWindowVisibleDisplayFrame(r);
     return (r.bottom - r.top);
   }
-
-  private void setOnSystemUiVisibilityChangeListener() {
-    decorView.setOnSystemUiVisibilityChangeListener(visibility -> {
-      setOnSystemUiVisibilityChange();
-    });
-  }
-
-  /**
-   * 화면 크기에 맞게 레이아웃 변경
-   * - 하단 네비바 유무에 따라서 스크린 사이즈 변경 됨
-   */
-  private void setOnSystemUiVisibilityChange() {
-    int finalUsableHeightNow = computeUsableHeight();
-
-    // 풀 스크린 버젼은 상단 스테이터스바의 높이가 계산되지 않아서 크기를 더해줌
-    if (AppUtil.isFullScreenVersion()) {
-      finalUsableHeightNow += ResourceUtil.getStatusBarHeight();
-    }
-
-    frameLayoutParams.height = finalUsableHeightNow;
-    childContent.requestLayout();
-  }
 }