Skip to content

Commit

Permalink
removing StatusBarHeight from heightDiff calc
Browse files Browse the repository at this point in the history
closes issue yshrsmz#41
  • Loading branch information
arquimago committed Jul 5, 2019
1 parent fbde29a commit 6851b9d
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@

import android.app.Activity;
import android.graphics.Rect;
import android.view.View;
import android.view.ViewGroup;
import android.view.ViewTreeObserver;

import android.view.WindowManager;
import android.view.*;

import net.yslibrary.android.keyboardvisibilityevent.util.UIUtil;

Expand Down Expand Up @@ -109,10 +105,17 @@ public static boolean isKeyboardVisible(Activity activity) {

View activityRoot = getActivityRoot(activity);


activityRoot.getWindowVisibleDisplayFrame(r);

int statusBarHeight = 0;
int resourceId = activityRoot.getResources().getIdentifier("status_bar_height", "dimen", "android");
if (resourceId > 0) {
statusBarHeight = activityRoot.getResources().getDimensionPixelSize(resourceId);
}

int screenHeight = activityRoot.getRootView().getHeight();
int heightDiff = screenHeight - r.height();
int heightDiff = screenHeight - statusBarHeight - r.height();

return heightDiff > screenHeight * KEYBOARD_MIN_HEIGHT_RATIO;
}
Expand Down

0 comments on commit 6851b9d

Please sign in to comment.