15
15
import android .view .View ;
16
16
import android .view .ViewTreeObserver ;
17
17
import android .view .ViewTreeObserver .OnGlobalLayoutListener ;
18
+ import android .view .Window ;
18
19
import android .view .inputmethod .InputMethodManager ;
19
20
20
21
// import additionally required classes for calculating screen height
@@ -125,13 +126,7 @@ else if ( pixelHeightDiff != previousHeightDiff && ( previousHeightDiff - pixelH
125
126
private void possiblyResizeChildOfContent () {
126
127
int usableHeightNow = computeUsableHeight ();
127
128
if (usableHeightNow != usableHeightPrevious ) {
128
- int usableHeightSansKeyboard = mChildOfContent .getRootView ().getHeight ();
129
- int heightDifference = usableHeightSansKeyboard - usableHeightNow ;
130
- if (heightDifference > (usableHeightSansKeyboard /4 )) {
131
- frameLayoutParams .height = usableHeightSansKeyboard - heightDifference ;
132
- } else {
133
- frameLayoutParams .height = usableHeightSansKeyboard ;
134
- }
129
+ frameLayoutParams .height = usableHeightNow ;
135
130
mChildOfContent .requestLayout ();
136
131
usableHeightPrevious = usableHeightNow ;
137
132
}
@@ -140,7 +135,14 @@ private void possiblyResizeChildOfContent() {
140
135
private int computeUsableHeight () {
141
136
Rect r = new Rect ();
142
137
mChildOfContent .getWindowVisibleDisplayFrame (r );
143
- return (r .bottom - r .top );
138
+ return isFullScreen () ? r .bottom - r .top : r .height ();
139
+ }
140
+
141
+ private boolean isFullScreen () {
142
+ final Window window = cordova .getActivity ().getWindow ();
143
+ // Flag set by status bar plugin to make content full screen
144
+ int fullScreenFlag = View .SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN ;
145
+ return (window .getDecorView ().getSystemUiVisibility () & fullScreenFlag ) == fullScreenFlag ;
144
146
}
145
147
};
146
148
0 commit comments