[app] Fix crash on #1207 (#1230)

This commit is contained in:
LoveSy 2021-10-06 23:41:34 +08:00 committed by GitHub
parent 8e9fa6eb5b
commit e2651eb4b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 1 deletions

View File

@ -78,7 +78,9 @@ public class BaseActivity extends MaterialActivity {
window.setStatusBarColor(Color.TRANSPARENT);
window.getDecorView().post(() -> {
if (window.getDecorView().getRootWindowInsets().getSystemWindowInsetBottom() >= Resources.getSystem().getDisplayMetrics().density * 40) {
var rootWindowInsets = window.getDecorView().getRootWindowInsets();
if (rootWindowInsets != null &&
rootWindowInsets.getSystemWindowInsetBottom() >= Resources.getSystem().getDisplayMetrics().density * 40) {
window.setNavigationBarColor(ResourceUtils.resolveColor(getTheme(), android.R.attr.navigationBarColor) & 0x00ffffff | -0x20000000);
} else {
window.setNavigationBarColor(Color.TRANSPARENT);