Skip to content

Commit

Permalink
Add transparency helpers to FlutterView.java (flutter#6172)
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Klimushyn authored Sep 5, 2018
1 parent f6ad3e0 commit 108e0a6
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions shell/platform/android/io/flutter/view/FlutterView.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import android.content.pm.ApplicationInfo;
import android.content.res.Configuration;
import android.database.ContentObserver;
import android.graphics.PixelFormat;
import android.provider.Settings;
import android.net.Uri;
import android.os.Handler;
Expand Down Expand Up @@ -276,6 +277,26 @@ public void removeFirstFrameListener(FirstFrameListener listener) {
mFirstFrameListeners.remove(listener);
}

/**
* Updates this to support rendering as a transparent {@link SurfaceView}.
*
* Sets it on top of its window. The background color still needs to be
* controlled from within the Flutter UI itself.
*/
public void enableTransparentBackground() {
setZOrderOnTop(true);
getHolder().setFormat(PixelFormat.TRANSPARENT);
}

/**
* Reverts this back to the {@link SurfaceView} defaults, at the back of its
* window and opaque.
*/
public void disableTransparentBackground() {
setZOrderOnTop(false);
getHolder().setFormat(PixelFormat.OPAQUE);
}

public void setInitialRoute(String route) {
mFlutterNavigationChannel.invokeMethod("setInitialRoute", route);
}
Expand Down

0 comments on commit 108e0a6

Please sign in to comment.