Skip to content
This repository has been archived by the owner on Feb 3, 2020. It is now read-only.

Commit

Permalink
Merge pull request #112 from recruit-lifestyle/develop
Browse files Browse the repository at this point in the history
Ver 2.4.3
  • Loading branch information
YoshihideSogawa authored Mar 5, 2019
2 parents 353e19f + 060c79c commit bef16b9
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import android.view.HapticFeedbackConstants;
import android.view.MotionEvent;
import android.view.View;
import android.view.WindowInsets;
import android.view.WindowManager;
import android.widget.FrameLayout;

Expand Down Expand Up @@ -616,8 +617,14 @@ public static Rect findCutoutSafeArea(@NonNull Activity activity) {
return safeInsetRect;
}

// Fix: getDisplayCutout() on a null object reference (issue #110)
final WindowInsets windowInsets = activity.getWindow().getDecorView().getRootWindowInsets();
if (windowInsets == null) {
return safeInsetRect;
}

// set safeInsetRect
final DisplayCutout displayCutout = activity.getWindow().getDecorView().getRootWindowInsets().getDisplayCutout();
final DisplayCutout displayCutout = windowInsets.getDisplayCutout();
if (displayCutout != null) {
safeInsetRect.set(displayCutout.getSafeInsetLeft(), displayCutout.getSafeInsetTop(), displayCutout.getSafeInsetRight(), displayCutout.getSafeInsetBottom());
}
Expand Down

0 comments on commit bef16b9

Please sign in to comment.