From eb73f9fb52960d6ad3a1582127ea64db9c3a907f Mon Sep 17 00:00:00 2001 From: Saket Narayan Date: Thu, 14 Sep 2017 17:54:51 +0530 Subject: [PATCH] Move OverlayView to below status bar on Oreo and above --- .../main/java/com/jakewharton/telecine/OverlayView.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/telecine/src/main/java/com/jakewharton/telecine/OverlayView.java b/telecine/src/main/java/com/jakewharton/telecine/OverlayView.java index 7247d8c..fcbbac1 100644 --- a/telecine/src/main/java/com/jakewharton/telecine/OverlayView.java +++ b/telecine/src/main/java/com/jakewharton/telecine/OverlayView.java @@ -4,6 +4,8 @@ import android.animation.AnimatorListenerAdapter; import android.annotation.SuppressLint; import android.content.Context; +import android.os.Build.VERSION; +import android.os.Build.VERSION_CODES; import android.support.annotation.NonNull; import android.view.Gravity; import android.view.View; @@ -116,6 +118,13 @@ private OverlayView(Context context, Listener listener, boolean showCountDown) { ViewGroup.LayoutParams lp = getLayoutParams(); lp.height = insets.getSystemWindowInsetTop(); + boolean canReceiveTouchEventsUnderStatusBar = VERSION.SDK_INT < VERSION_CODES.O; + if (!canReceiveTouchEventsUnderStatusBar) { + int statusBarHeight = insets.getSystemWindowInsetTop(); + lp.height += statusBarHeight; + setPaddingRelative(getPaddingStart(), getPaddingTop() + statusBarHeight, getPaddingEnd(), getPaddingBottom()); + } + listener.onResize(); return insets.consumeSystemWindowInsets();