Class GeckoDisplay.SurfaceInfo.Builder

Object
org.mozilla.geckoview.GeckoDisplay.SurfaceInfo.Builder
Enclosing class:
GeckoDisplay.SurfaceInfo

public static class GeckoDisplay.SurfaceInfo.Builder extends Object
Helper class for constructing a GeckoDisplay.SurfaceInfo object.
  • Constructor Details

    • Builder

      public Builder(@NonNull Surface surface)
      Creates a new Builder and sets the new Surface.
      Parameters:
      surface - The new Surface.
  • Method Details

    • surfaceControl

      @UiThread @NonNull public GeckoDisplay.SurfaceInfo.Builder surfaceControl(@Nullable SurfaceControl surfaceControl)
      Sets the SurfaceControl associated with the new Surface's SurfaceView.

      This must be called when rendering in to a SurfaceView on SDK level 29 or above. On earlier SDK levels, or when rendering in to something other than a SurfaceView, this call can be omitted or the value can be null.

      Parameters:
      surfaceControl - The SurfaceControl associated with the new Surface's SurfaceView, or null.
      Returns:
      The builder object
    • newSurfaceProvider

      @UiThread @NonNull public GeckoDisplay.SurfaceInfo.Builder newSurfaceProvider(@Nullable GeckoDisplay.NewSurfaceProvider newSurfaceProvider)
      Sets a NewSurfaceProvider from which Gecko can request a new Surface.

      This allows Gecko to recover from situations where the current Surface is for whatever reason invalid and Gecko is unable to render in to it. Failure to set this field correctly may result in Gecko either crashing or not rendering correctly should it encounter an invalid Surface.

      Parameters:
      newSurfaceProvider - A NewSurfaceProvider from which Gecko can request a new Surface.
      Returns:
      The builder object
    • offset

      @UiThread @NonNull public GeckoDisplay.SurfaceInfo.Builder offset(int left, int top)
      Sets the new compositor origin offset.
      Parameters:
      left - The compositor origin offset in the X axis. Can not be negative.
      top - The compositor origin offset in the Y axis. Can not be negative.
      Returns:
      The builder object
    • size

      @UiThread @NonNull public GeckoDisplay.SurfaceInfo.Builder size(int width, int height)
      Sets the new surface size.
      Parameters:
      width - New width of the Surface. Can not be negative.
      height - New height of the Surface. Can not be negative.
      Returns:
      The builder object
    • build

      @UiThread @NonNull public GeckoDisplay.SurfaceInfo build()
      Builds the GeckoDisplay.SurfaceInfo object with the specified properties.
      Returns:
      The SurfaceInfo object