Add transparency helpers to FlutterView.java (flutter/engine#6172)
Fixes #9627
This commit is contained in:
committed by
GitHub
parent
f49ef002ca
commit
0282e85726
@@ -12,6 +12,7 @@ import android.content.IntentFilter;
|
||||
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;
|
||||
@@ -276,6 +277,26 @@ public class FlutterView extends SurfaceView
|
||||
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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user