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

Move OverlayView to below the status bar on Oreo+ #165

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down