|
|
|
|
|
|
private UIWidgetsViewMetrics viewMetrics; |
|
|
|
private boolean keyboardOpen; |
|
|
|
|
|
|
|
private float statusHeight; |
|
|
|
private float navigationBarHeight; |
|
|
|
|
|
|
|
|
|
|
|
setupHeights(); |
|
|
|
} |
|
|
|
|
|
|
|
private void setupHeights() { |
|
|
|
final View unityView = ((ViewGroup)UnityPlayer.currentActivity.findViewById(android.R.id.content)).getChildAt(0); |
|
|
|
Rect rect = new Rect(); |
|
|
|
unityView.getWindowVisibleDisplayFrame(rect); |
|
|
|
|
|
|
|
statusHeight = rect.top; |
|
|
|
navigationBarHeight = unityView.getRootView().getHeight() - rect.bottom; |
|
|
|
} |
|
|
|
|
|
|
|
public static UIWidgetsViewMetrics getMetrics() { |
|
|
|
|
|
|
viewMetrics.insets_right = 0; |
|
|
|
viewMetrics.insets_bottom = navigationBarHidden? calculateBottomKeyboardInset(rect) : rect.bottom; |
|
|
|
viewMetrics.insets_left = 0; |
|
|
|
|
|
|
|
//adjust |
|
|
|
viewMetrics.insets_bottom -= navigationBarHeight; |
|
|
|
viewMetrics.padding_top -= statusHeight; |
|
|
|
|
|
|
|
//Log.i("UIWidgetsDebug", "checks: " + navigationBarHidden + " " + rect.bottom); |
|
|
|
//Log.i("UIWidgetsDebug", " padding: " + viewMetrics.padding_top + " " + viewMetrics.padding_right + " " + viewMetrics.padding_bottom + " " + viewMetrics.padding_left); |
|
|
|