Fix nav bar spacing and coloring.

This commit is contained in:
Alex Hart
2025-04-10 13:10:37 -03:00
parent 9d6e7560f0
commit 6613d5fccb
4 changed files with 58 additions and 21 deletions

View File

@@ -385,15 +385,19 @@ public final class ViewUtil {
if (Build.VERSION.SDK_INT > 29 && rootWindowInsets != null) {
return rootWindowInsets.getInsets(WindowInsetsCompat.Type.navigationBars()).bottom;
} else {
int result = 0;
int resourceId = view.getResources().getIdentifier("navigation_bar_height", "dimen", "android");
if (resourceId > 0) {
result = view.getResources().getDimensionPixelSize(resourceId);
}
return result;
return getNavigationBarHeight(view.getResources());
}
}
public static int getNavigationBarHeight(@NonNull Resources resources) {
int result = 0;
int resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android");
if (resourceId > 0) {
result = resources.getDimensionPixelSize(resourceId);
}
return result;
}
public static void hideKeyboard(@NonNull Context context, @NonNull View view) {
InputMethodManager inputManager = (InputMethodManager) context.getSystemService(Activity.INPUT_METHOD_SERVICE);
inputManager.hideSoftInputFromWindow(view.getWindowToken(), 0);