Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Preserve the alpha for VD content by setting a transparent background. #9849

Merged
merged 1 commit into from
Jul 16, 2019
Merged
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 @@ -9,6 +9,7 @@
import android.content.Context;
import android.content.ContextWrapper;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
Expand Down Expand Up @@ -96,11 +97,7 @@ public SingleViewPresentation(
Object createParams,
OnFocusChangeListener focusChangeListener
) {
// By default alpha is not preserved for the VD's contents.
// We make the window translucent as a side effect of doing so is preserving alpha.
// There should not be extra performance cost for setting the window to be translucent as
// there is only a single window within the VD.
super(outerContext, display, android.R.style.Theme_Translucent_NoTitleBar_Fullscreen);
super(outerContext, display);
this.viewFactory = viewFactory;
this.accessibilityEventsDelegate = accessibilityEventsDelegate;
this.viewId = viewId;
Expand Down Expand Up @@ -129,11 +126,7 @@ public SingleViewPresentation(
OnFocusChangeListener focusChangeListener,
boolean startFocused
) {
// By default alpha is not preserved for the VD's contents.
// We make the window translucent as a side effect of doing so is preserving alpha.
// There should not be extra performance cost for setting the window to be translucent as
// there is only a single window within the VD.
super(outerContext, display, android.R.style.Theme_Translucent_NoTitleBar_Fullscreen);
super(outerContext, display);
this.accessibilityEventsDelegate = accessibilityEventsDelegate;
viewFactory = null;
this.state = state;
Expand All @@ -148,6 +141,8 @@ public SingleViewPresentation(
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// This makes sure we preserve alpha for the VD's content.
getWindow().setBackgroundDrawable(new ColorDrawable(android.graphics.Color.TRANSPARENT));
if (state.fakeWindowViewGroup == null) {
state.fakeWindowViewGroup = new FakeWindowViewGroup(getContext());
}
Expand Down