Open ghost opened 5 years ago
`
<!--<item name="android:overlapAnchor">false</item>-->
<!--<item name="android:dropDownHorizontalOffset">-16dp</item>-->
<!--<item name="android:dropDownVerticalOffset">16dp</item>-->
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
<item name="android:fitsSystemWindows">true</item>
</style>`
This property works for normal Navigation menu, but not supporting while using Reside menu
This issue is been resolved boolean PermanentMenuKey = ViewConfiguration.get(getContext()).hasPermanentMenuKey(); if (!PermanentMenuKey) {//there's a navigation bar bottomPadding = 0; } else { bottomPadding += getNavigationBarHeight(); } Add this code ResideMenu Java class and you are good to go
This issue is been resolved boolean PermanentMenuKey = ViewConfiguration.get(getContext()).hasPermanentMenuKey(); if (!PermanentMenuKey) {//there's a navigation bar bottomPadding = 0; } else { bottomPadding += getNavigationBarHeight(); } Add this code ResideMenu Java class and you are good to go
Hi! Where should this code be added?
This method did the trick for me. I tested on both devices with virtual navigation buttons and with phisical ones. I`ll post it here just in case someone needs it.
` @Override
protected boolean fitSystemWindows(Rect insets) {
Point appUsableSize = getAppUsableScreenSize(activity.getApplicationContext());
Point realScreenSize = getRealScreenSize(activity.getApplicationContext());
// This is added to fix soft navigationBar's overlapping to content above LOLLIPOP
int bottomPadding = viewActivity.getPaddingBottom() + insets.bottom;
//this line did the trick
bottomPadding=realScreenSize.y-appUsableSize.y;
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;
}
public static Point getAppUsableScreenSize(Context context) {
WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = windowManager.getDefaultDisplay();
Point size = new Point();
display.getSize(size);
return size;
}
public static Point getRealScreenSize(Context context) {
WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
Display display = windowManager.getDefaultDisplay();
Point size = new Point();
if (Build.VERSION.SDK_INT >= 17) {
display.getRealSize(size);
} else if (Build.VERSION.SDK_INT >= 14) {
try {
size.x = (Integer) Display.class.getMethod("getRawWidth").invoke(display);
size.y = (Integer) Display.class.getMethod("getRawHeight").invoke(display);
} catch (IllegalAccessException e) {} catch (InvocationTargetException e) {} catch (NoSuchMethodException e) {}
}
return size;
}`
This issue is been resolved boolean PermanentMenuKey = ViewConfiguration.get(getContext()).hasPermanentMenuKey(); if (!PermanentMenuKey) {//there's a navigation bar bottomPadding = 0; } else { bottomPadding += getNavigationBarHeight(); } Add this code ResideMenu Java class and you are good to go
Hi! Where should this code be added?
Thanks man I replaced your code with ``
boolean hasBackKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_BACK);
boolean hasHomeKey = KeyCharacterMap.deviceHasKey(KeyEvent.KEYCODE_HOME);
if (!hasBackKey || !hasHomeKey) {//there's a navigation bar
bottomPadding += getNavigationBarHeight();
}` and problem dissapeared. you saved my hours.
old question but that's how I did it and it worked just like we all want.
resideMenu.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() { @Override public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) { mainLLL.setPadding(0,insets.getSystemWindowInsetTop(),0, insets.getSystemWindowInsetBottom()); return insets; } });
add this after initializing ResideMenu.
Space at the bottom of devices which are either flagship or new android phones . Especially those devices where you can hide the navigation bar from settings and navigate through gesture.