Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

keyboard resize fix for android with status bar overlay: issue#132 #134

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/android/CDVIonicKeyboard.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,13 @@
import org.json.JSONException;

import android.content.Context;
import android.graphics.Color;
import android.graphics.Rect;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.ViewTreeObserver;
import android.view.ViewTreeObserver.OnGlobalLayoutListener;
import android.view.Window;
import android.view.inputmethod.InputMethodManager;

// import additionally required classes for calculating screen height
Expand Down Expand Up @@ -140,7 +142,14 @@ private void possiblyResizeChildOfContent() {
private int computeUsableHeight() {
Rect r = new Rect();
mChildOfContent.getWindowVisibleDisplayFrame(r);
return (r.bottom - r.top);
if ( checkStatusBarTransparent() ) return r.bottom;
return r.height();
}

private boolean checkStatusBarTransparent() {
final Window window = cordova.getActivity().getWindow();
return ( window.getStatusBarColor() == Color.TRANSPARENT
|| window.getDecorView().getSystemUiVisibility() == View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN );
}
};

Expand Down