0

I'm using the Android ResideMenu library, which has generally been good except the issue with mis-calculating the size of my main "content activity".

I've tested with several devices but it seems to be a bit off in each one, which causes a problem when i'm trying to display items from the bottom of the activity such as a snackbar or a custom pop up (see picture).

From what i've read, it could be related to the protected boolean fitSystemWindows(Rect insets) method in ResideMenu.java, but it just seems trivial to me for this to be working.

Any ideas?

enter image description here

royherma
  • 4,095
  • 1
  • 31
  • 42

1 Answers1

0

When I used this library ResideMenu and I had the same problem. In the ResideMenu.java file I had a change in two functions.

Functions:

@Override
protected boolean fitSystemWindows(Rect insets) {

    int bottomPadding = viewActivity.getPaddingBottom() + insets.bottom;
    boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);
    boolean hasHomeKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_HOME);

    if (!hasBackKey || !hasHomeKey) {//there's a navigation bar
        bottomPadding += getNavigationBarHeight();

    }
    this.setPadding(viewActivity.getPaddingLeft() + insets.left,
            viewActivity.getPaddingTop() + insets.top,
            viewActivity.getPaddingRight() + insets.right,
            bottomPadding);
    insets.left = insets.top = insets.right = insets.bottom = 0;
    return true;
}



private int getNavigationBarHeight() {
    Resources resources = getResources();
    int resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
    if (resourceId > 0) {
        return resources.getDimensionPixelSize(resourceId);
    }
    return 0;
}
Roma Darvish
  • 257
  • 5
  • 19