Skip to content
This repository was archived by the owner on Apr 29, 2021. It is now read-only.

Commit ba3393c

Browse files
committed
fix android view bug on Android P
1 parent 2c68aee commit ba3393c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

Runtime/Plugins/platform/android/view/UIWidgetsViewController.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static UIWidgetsViewController getInstance() {
3535
private boolean keyboardOpen;
3636

3737
private void setup() {
38-
Log.i("tag", "On Setup");
38+
//Log.i("tag", "On Setup 2");
3939

4040
keyboardOpen = false;
4141
viewMetrics = new UIWidgetsViewMetrics();
@@ -111,7 +111,7 @@ private boolean hasNavigationBar() {
111111
} catch (Exception e) {
112112
e.printStackTrace();
113113
}
114-
114+
//Log.i("UIWidgetsDebug", " hasBar: " + hasBar);
115115
return hasBar;
116116
}
117117

@@ -120,6 +120,8 @@ public void updateViewMetrics() {
120120
Rect rect = new Rect();
121121
unityView.getWindowVisibleDisplayFrame(rect);
122122

123+
//Log.i("UIWidgetsDebug", "calculation: " + unityView.getRootView().getHeight() + " " + rect.bottom + " " + rect.top);
124+
123125
rect.bottom = unityView.getRootView().getHeight() - (rect.bottom - rect.top) - rect.top;
124126
rect.right = unityView.getRootView().getWidth() - (rect.right - rect.left) - rect.left;
125127

@@ -129,9 +131,6 @@ public void updateViewMetrics() {
129131
ZeroSides zeroSides = ZeroSides.NONE;
130132
if (navigationBarHidden) {
131133
zeroSides = calculateShouldZeroSides(unityView);
132-
} else {
133-
rect.bottom -= getNavigationBarHeight();
134-
rect.bottom = rect.bottom > 0 ? rect.bottom : 0;
135134
}
136135

137136
viewMetrics.padding_top = rect.top;
@@ -143,6 +142,10 @@ public void updateViewMetrics() {
143142
viewMetrics.insets_right = 0;
144143
viewMetrics.insets_bottom = navigationBarHidden? calculateBottomKeyboardInset(rect) : rect.bottom;
145144
viewMetrics.insets_left = 0;
145+
146+
//Log.i("UIWidgetsDebug", "checks: " + navigationBarHidden + " " + rect.bottom);
147+
//Log.i("UIWidgetsDebug", " padding: " + viewMetrics.padding_top + " " + viewMetrics.padding_right + " " + viewMetrics.padding_bottom + " " + viewMetrics.padding_left);
148+
//Log.i("UIWidgetsDebug", " insets: " + viewMetrics.insets_top + " " + viewMetrics.insets_right + " " + viewMetrics.insets_bottom + " " + viewMetrics.insets_left);
146149
}
147150

148151
public void setupViewMetricsChangedListener() {

0 commit comments

Comments
 (0)