|
|
|
|
|
|
private boolean keyboardOpen; |
|
|
|
|
|
|
|
private void setup() { |
|
|
|
Log.i("tag", "On Setup"); |
|
|
|
//Log.i("tag", "On Setup 2"); |
|
|
|
|
|
|
|
keyboardOpen = false; |
|
|
|
viewMetrics = new UIWidgetsViewMetrics(); |
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
|
|
|
|
//Log.i("UIWidgetsDebug", " hasBar: " + hasBar); |
|
|
|
return hasBar; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
unityView.getWindowVisibleDisplayFrame(rect); |
|
|
|
|
|
|
|
//Log.i("UIWidgetsDebug", "calculation: " + unityView.getRootView().getHeight() + " " + rect.bottom + " " + rect.top); |
|
|
|
|
|
|
|
rect.bottom = unityView.getRootView().getHeight() - (rect.bottom - rect.top) - rect.top; |
|
|
|
rect.right = unityView.getRootView().getWidth() - (rect.right - rect.left) - rect.left; |
|
|
|
|
|
|
ZeroSides zeroSides = ZeroSides.NONE; |
|
|
|
if (navigationBarHidden) { |
|
|
|
zeroSides = calculateShouldZeroSides(unityView); |
|
|
|
} else { |
|
|
|
rect.bottom -= getNavigationBarHeight(); |
|
|
|
rect.bottom = rect.bottom > 0 ? rect.bottom : 0; |
|
|
|
} |
|
|
|
|
|
|
|
viewMetrics.padding_top = rect.top; |
|
|
|
|
|
|
viewMetrics.insets_right = 0; |
|
|
|
viewMetrics.insets_bottom = navigationBarHidden? calculateBottomKeyboardInset(rect) : rect.bottom; |
|
|
|
viewMetrics.insets_left = 0; |
|
|
|
|
|
|
|
//Log.i("UIWidgetsDebug", "checks: " + navigationBarHidden + " " + rect.bottom); |
|
|
|
//Log.i("UIWidgetsDebug", " padding: " + viewMetrics.padding_top + " " + viewMetrics.padding_right + " " + viewMetrics.padding_bottom + " " + viewMetrics.padding_left); |
|
|
|
//Log.i("UIWidgetsDebug", " insets: " + viewMetrics.insets_top + " " + viewMetrics.insets_right + " " + viewMetrics.insets_bottom + " " + viewMetrics.insets_left); |
|
|
|
} |
|
|
|
|
|
|
|
public void setupViewMetricsChangedListener() { |
|
|
|