Skip to content

Commit

Permalink
fix(activity/fragmentactivity): cover the case of the page is extends…
Browse files Browse the repository at this point in the history
… Activity or FragmentActivity (not AppCompatActivity)

Closes #24
  • Loading branch information
Jacksgong committed Apr 20, 2016
1 parent 2656344 commit c737e97
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,12 @@ private void calculateKeyboardShowing(final int displayHeight) {

// the height of content parent = contentView.height + actionBar.height
final View actionBarOverlayLayout = (View)contentView.getParent();
final int actionBarOverlayLayoutHeight = actionBarOverlayLayout.getHeight();
// in the case of FragmentLayout, this is not real ActionBarOverlayLayout, it is
// LinearLayout, and is a child of DecorView, and in this case, its top-padding would be
// equal to the height of status bar, and its height would equal to ScreenHeight -
// NavigationBarHeight.
final int actionBarOverlayLayoutHeight = actionBarOverlayLayout.getHeight() -
actionBarOverlayLayout.getPaddingTop();

if (isFullScreen) {
if (actionBarOverlayLayoutHeight - displayHeight == this.statusBarHeight) {
Expand All @@ -263,8 +268,7 @@ private void calculateKeyboardShowing(final int displayHeight) {
} else {

final int phoneDisplayHeight = contentView.getResources().getDisplayMetrics().heightPixels;
if (phoneDisplayHeight == actionBarOverlayLayoutHeight &&
actionBarOverlayLayout.getPaddingTop() == 0) {
if (phoneDisplayHeight == actionBarOverlayLayoutHeight) {
// no space to settle down the status bar, switch to fullscreen,
// only in the case of paused and opened the fullscreen page.
Log.w(TAG, String.format("skip the keyboard status calculate, the current" +
Expand Down

0 comments on commit c737e97

Please sign in to comment.