LowLatencyCanvasView


@RequiresApi(value = 29)
class LowLatencyCanvasView : ViewGroup


View implementation that leverages a "front buffered" rendering system. This allows for lower latency graphics by leveraging a combination of front buffered alongside multi-buffered content layers. This class provides similar functionality to CanvasFrontBufferedRenderer, however, leverages the traditional View system for implementing the multi buffered content instead of a separate SurfaceControlCompat instance and entirely abstracts all SurfaceView usage for simplicity.

Drawing of this View's content is handled by a consumer specified LowLatencyCanvasView.Callback implementation instead of View.onDraw. Rendering here is done with a Canvas into a single buffer that is presented on screen above the rest of the View hierarchy content. This overlay is transient and will only be visible after LowLatencyCanvasView.renderFrontBufferedLayer is called and hidden after LowLatencyCanvasView.commit is invoked. After LowLatencyCanvasView.commit is invoked, this same buffer is wrapped into a bitmap and drawn within this View's View.onDraw implementation.

Calls to LowLatencyCanvasView.renderFrontBufferedLayer will trigger LowLatencyCanvasView.Callback.onDrawFrontBufferedLayer to be invoked to handle drawing of content with the provided Canvas.

After LowLatencyCanvasView.commit is called, the overlay is hidden and the buffer is drawn within the View hierarchy, similar to traditional View implementations.

A common use case would be a drawing application that intends to minimize the amount of latency when content is drawn with a stylus. In this case, touch events between MotionEvent.ACTION_DOWN and MotionEvent.ACTION_MOVE can trigger calls to LowLatencyCanvasView.renderFrontBufferedLayer which will minimize the delay between then the content is visible on screen. Finally when the gesture is complete on MotionEvent.ACTION_UP, a call to LowLatencyCanvasView.commit would be invoked to hide the transient overlay and render the scene within the View hierarchy like a traditional View. This helps provide a balance of low latency guarantees while mitigating potential tearing artifacts.

This helps support low latency rendering for simpler use cases at the expensive of configuration customization of the multi buffered layer content.

import androidx.annotation.WorkerThread
import androidx.graphics.lowlatency.LowLatencyCanvasView

LowLatencyCanvasView(context).apply {
    setBackgroundColor(Color.WHITE)

    data class Line(
        val x1: Float,
        val y1: Float,
        val x2: Float,
        val y2: Float,
    )
    // Thread safe collection to support creation of new lines from the UI thread as well as
    // consumption of lines from the background drawing thread
    val lines = Collections.synchronizedList(ArrayList<Line>())
    setRenderCallback(object : LowLatencyCanvasView.Callback {

        val mAllLines = ArrayList<Line>()

        private val mPaint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
            strokeWidth = 15f
            color = Color.CYAN
            alpha = 128
        }

        @WorkerThread
        override fun onRedrawRequested(
            canvas: Canvas,
            width: Int,
            height: Int
        ) {
            for (line in mAllLines) {
                canvas.drawLine(line.x1, line.y1, line.x2, line.y2, mPaint)
            }
        }

        @WorkerThread
        override fun onDrawFrontBufferedLayer(
            canvas: Canvas,
            width: Int,
            height: Int
        ) {
            lines.removeFirstOrNull()?.let { line ->
                mAllLines.add(line)
                canvas.drawLine(line.x1, line.y1, line.x2, line.y2, mPaint)
            }
        }
    })
    setOnTouchListener(object : View.OnTouchListener {

        var mCurrentX = -1f
        var mCurrentY = -1f
        var mPreviousX = -1f
        var mPreviousY = -1f

        override fun onTouch(v: View?, event: MotionEvent?): Boolean {
            if (event == null) return false
            when (event.action) {
                MotionEvent.ACTION_DOWN -> {
                    requestUnbufferedDispatch(event)
                    mCurrentX = event.x
                    mCurrentY = event.y
                }
                MotionEvent.ACTION_MOVE -> {
                    mPreviousX = mCurrentX
                    mPreviousY = mCurrentY
                    mCurrentX = event.x
                    mCurrentY = event.y

                    val line = Line(mPreviousX, mPreviousY, mCurrentX, mCurrentY)
                    lines.add(line)
                    renderFrontBufferedLayer()
                }
                MotionEvent.ACTION_CANCEL -> {
                    cancel()
                }
                MotionEvent.ACTION_UP -> {
                    commit()
                }
            }
            return true
        }
    })
}

Summary

Nested types

Provides callbacks for consumers to draw into the front buffered overlay as well as provide opportunities to synchronize SurfaceControlCompat.Transactions to submit the layers to the hardware compositor

Public constructors

LowLatencyCanvasView(context: Context, attrs: AttributeSet?, defStyle: Int)

Public functions

open Unit
addView(child: View?)
open Unit
addView(child: View?, index: Int)
open Unit
addView(child: View?, params: ViewGroup.LayoutParams?)
open Unit
addView(child: View?, index: Int, params: ViewGroup.LayoutParams?)
open Unit
addView(child: View?, width: Int, height: Int)
Unit

Cancels any in progress request to render to the front buffer and hides the front buffered overlay.

Unit

Clears the content of the buffer and hides the front buffered overlay.

Unit

Invalidates this View and draws the buffer within View#onDraw.

Unit
execute(runnable: Runnable)

Dispatches a runnable to be executed on the background rendering thread.

Unit

Render content to the front buffered layer.

Unit

Configures the Callback used to render contents to the front buffered overlay as well as optionally configuring the SurfaceControlCompat.Transaction used to update contents on screen.

Protected functions

open Unit
open Unit
onDraw(canvas: Canvas)
open Unit
onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int)

Inherited functions

From android.view.View
open Unit
open Unit
open Unit
open Unit
open ViewPropertyAnimator
open Unit
open Unit
open Unit
open Boolean
open Boolean
open Boolean
open Unit
open Unit

This function is deprecated. Deprecated in Java

open Unit

This function is deprecated. Deprecated in Java

open Unit
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
Unit
open Unit
Unit
open Boolean
open Unit
open Unit
open Int
open Int
open Int
open Unit
open WindowInsets
open Int
open Int
open Int
open AccessibilityNodeInfo
open Unit
open Unit

This function is deprecated. Deprecated in Java

open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
dispatchNestedPreScroll(p0: Int, p1: Int, p2: IntArray?, p3: IntArray?)
open Boolean
dispatchNestedScroll(p0: Int, p1: Int, p2: Int, p3: Int, p4: IntArray?)
open Boolean
open Unit
draw(p0: Canvas)
open Unit
OnBackInvokedDispatcher?
T
<T : View> findViewById(p0: Int)
T
<T : View> findViewWithTag(p0: Any)
open Boolean

This function is deprecated. Deprecated in Java

open View
open Unit
open Unit
open Unit
generateDisplayHash(
    p0: String,
    p1: Rect?,
    p2: Executor,
    p3: DisplayHashResultCallback
)
open View.AccessibilityDelegate
open Int
open AccessibilityNodeProvider
open CharSequence?
open Int
open Int
open String?
open String?
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getAlpha()
open Animation
open Matrix?
open IBinder
open IntArray
open MutableMap<IntInt>
open Array<String>?
AutofillId
open Int
open AutofillValue?
open Drawable
open BlendMode?
open ColorStateList?
open PorterDuff.Mode?
open Int
@ViewDebug.ExportedProperty(category = "layout")
getBaseline()
Int
open Float
open Int
open Float
open Rect
open Boolean
Boolean
ContentCaptureSession?
open CharSequence
@ViewDebug.ExportedProperty(category = "accessibility")
getContentDescription()
Context
open ContextMenu.ContextMenuInfo
Boolean
open Display
IntArray
open Bitmap

This function is deprecated. Deprecated in Java

open Bitmap

This function is deprecated. Deprecated in Java

open Int

This function is deprecated. Deprecated in Java

open Int

This function is deprecated. Deprecated in Java

open Unit
open Long
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getElevation()
open Int
open Boolean
open Boolean
open Int
@ViewDebug.ExportedProperty(mapping = [@ViewDebug.IntToString(from = 0, to = "NOT_FOCUSABLE"), @ViewDebug.IntToString(from = 1, to = "FOCUSABLE"), @ViewDebug.IntToString(from = 16, to = "FOCUSABLE_AUTO")], category = "focus")
getFocusable()
open ArrayList<View>
open Unit
open Drawable
open Int
open BlendMode?
open ColorStateList?
open PorterDuff.Mode?
Boolean
open Boolean
open Handler
open Float
open Float
open Float
open Float
open Runnable?
Boolean
Int
@ViewDebug.ExportedProperty(category = "layout")
getHeight()
open Unit
open Int
open Int
open Drawable?
open Drawable?
open Int
open Int
@ViewDebug.ExportedProperty(category = "accessibility", mapping = [@ViewDebug.IntToString(from = 0, to = "auto"), @ViewDebug.IntToString(from = 1, to = "yes"), @ViewDebug.IntToString(from = 2, to = "no"), @ViewDebug.IntToString(from = 4, to = "noHideDescendants")])
getImportantForAccessibility()
open Int
@ViewDebug.ExportedProperty(mapping = [@ViewDebug.IntToString(from = 0, to = "auto"), @ViewDebug.IntToString(from = 1, to = "yes"), @ViewDebug.IntToString(from = 2, to = "no"), @ViewDebug.IntToString(from = 4, to = "yesExcludeDescendants"), @ViewDebug.IntToString(from = 8, to = "noExcludeDescendants")])
getImportantForAutofill()
open Int
@ViewDebug.ExportedProperty(mapping = [@ViewDebug.IntToString(from = 0, to = "auto"), @ViewDebug.IntToString(from = 1, to = "yes"), @ViewDebug.IntToString(from = 2, to = "no"), @ViewDebug.IntToString(from = 4, to = "yesExcludeDescendants"), @ViewDebug.IntToString(from = 8, to = "noExcludeDescendants")])
getImportantForContentCapture()
open Boolean
open KeyEvent.DispatcherState
open Int
@ViewDebug.ExportedProperty(category = "accessibility")
getLabelFor()
open Int
open Int
@ViewDebug.ExportedProperty(category = "layout", mapping = [@ViewDebug.IntToString(from = 0, to = "RESOLVED_DIRECTION_LTR"), @ViewDebug.IntToString(from = 1, to = "RESOLVED_DIRECTION_RTL")])
getLayoutDirection()
open ViewGroup.LayoutParams
@ViewDebug.ExportedProperty(deepExport = true, prefix = "layout_")
getLayoutParams()
Int
open Float
open Int
Boolean
open Unit
open Unit
open Unit
open Matrix
Int
Int
@ViewDebug.ExportedProperty(category = "measurement", flagMapping = [@ViewDebug.FlagToString(mask = -16777216, equals = 16777216, name = "MEASURED_STATE_TOO_SMALL")])
getMeasuredHeightAndState()
Int
Int
Int
@ViewDebug.ExportedProperty(category = "measurement", flagMapping = [@ViewDebug.FlagToString(mask = -16777216, equals = 16777216, name = "MEASURED_STATE_TOO_SMALL")])
getMeasuredWidthAndState()
open Int
open Int
open Int
open Int
open Int
open Int
open Int
open Int
open View.OnFocusChangeListener
open Int
open ViewOutlineProvider
open Int
open Int
open Int
open Int
open Int
open Int
open Int
open Int
ViewParent
open ViewParent
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getPivotX()
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getPivotY()
open PointerIcon
MutableList<Rect>
open Array<String>?
open Resources
Boolean
Int
open Float
open Int
open AttachedSurfaceControl?
open View
open WindowInsets
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getRotation()
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getRotationX()
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getRotationY()
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getScaleX()
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getScaleY()
open Int
open Int
open Int
open Int
@ViewDebug.ExportedProperty(mapping = [@ViewDebug.IntToString(from = 0, to = "INSIDE_OVERLAY"), @ViewDebug.IntToString(from = 16777216, to = "INSIDE_INSET"), @ViewDebug.IntToString(from = 33554432, to = "OUTSIDE_OVERLAY"), @ViewDebug.IntToString(from = 50331648, to = "OUTSIDE_INSET")])
getScrollBarStyle()
open Int
open Int
Int
Int
open Int
@ViewDebug.ExportedProperty(category = "drawing")
getSolidColor()
open Int
CharSequence?
@ViewDebug.ExportedProperty(category = "accessibility")
getStateDescription()
open StateListAnimator
open Int
open Int
open MutableList<Rect>
open Int

This function is deprecated. Deprecated in Java

open Any
open Any
getTag(p0: Int)
open Int
@ViewDebug.ExportedProperty(category = "text", mapping = [@ViewDebug.IntToString(from = 0, to = "INHERIT"), @ViewDebug.IntToString(from = 1, to = "GRAVITY"), @ViewDebug.IntToString(from = 2, to = "TEXT_START"), @ViewDebug.IntToString(from = 3, to = "TEXT_END"), @ViewDebug.IntToString(from = 4, to = "CENTER"), @ViewDebug.IntToString(from = 5, to = "VIEW_START"), @ViewDebug.IntToString(from = 6, to = "VIEW_END")])
getTextAlignment()
open Int
@ViewDebug.ExportedProperty(category = "text", mapping = [@ViewDebug.IntToString(from = 0, to = "INHERIT"), @ViewDebug.IntToString(from = 1, to = "FIRST_STRONG"), @ViewDebug.IntToString(from = 2, to = "ANY_RTL"), @ViewDebug.IntToString(from = 3, to = "LTR"), @ViewDebug.IntToString(from = 4, to = "RTL"), @ViewDebug.IntToString(from = 5, to = "LOCALE"), @ViewDebug.IntToString(from = 6, to = "FIRST_STRONG_LTR"), @ViewDebug.IntToString(from = 7, to = "FIRST_STRONG_RTL")])
getTextDirection()
open CharSequence?
Int
open Float
open Int
open TouchDelegate
open ArrayList<View>
open Float
open String
open Float
open Float
open Float
open Long
open Int
open Int
open Drawable?
open Drawable?
open Int
open ViewTranslationResponse?
open ViewTreeObserver
open Int
@ViewDebug.ExportedProperty(mapping = [@ViewDebug.IntToString(from = 0, to = "VISIBLE"), @ViewDebug.IntToString(from = 4, to = "INVISIBLE"), @ViewDebug.IntToString(from = 8, to = "GONE")])
getVisibility()
Int
@ViewDebug.ExportedProperty(category = "layout")
getWidth()
open Int
open WindowId
open WindowInsetsController?
open Int

This function is deprecated. Deprecated in Java

open IBinder
open Int
open Unit
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getX()
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getY()
open Float
@ViewDebug.ExportedProperty(category = "drawing")
getZ()
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Unit
open Unit

This function is deprecated. Deprecated in Java

open Unit
invalidate(p0: Int, p1: Int, p2: Int, p3: Int)

This function is deprecated. Deprecated in Java

open Unit
open Unit
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean

This function is deprecated. Deprecated in Java

open Boolean
open Boolean
Boolean
@ViewDebug.ExportedProperty(category = "focus")
isFocusable()
Boolean
open Boolean
@ViewDebug.ExportedProperty(category = "focus")
isFocused()
Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
Boolean
Boolean
open Boolean
open Boolean
open Boolean
Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
@ViewDebug.ExportedProperty(category = "drawing")
isOpaque()
open Boolean
open Boolean
open Boolean
Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
Boolean
open Boolean
open Boolean
Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open View
Unit
measure(p0: Int, p1: Int)
open Unit
open Unit
open Unit
open Unit
open WindowInsets
open Unit
open Boolean
open Boolean
open Unit
open Unit
open InputConnection
open Unit
open Unit
open Unit
open Boolean
open Unit
Unit
open Boolean
open Unit
open Unit
open Unit
onFocusChanged(p0: Boolean, p1: Int, p2: Rect?)
open Boolean
open Unit
open Boolean
open Unit
open Unit
open Boolean
onKeyDown(p0: Int, p1: KeyEvent)
open Boolean
open Boolean
onKeyMultiple(p0: Int, p1: Int, p2: KeyEvent)
open Boolean
onKeyPreIme(p0: Int, p1: KeyEvent)
open Boolean
open Boolean
onKeyUp(p0: Int, p1: KeyEvent)
open Unit
onMeasure(p0: Int, p1: Int)
open Unit
onOverScrolled(p0: Int, p1: Int, p2: Boolean, p3: Boolean)
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open ContentInfo?
open Unit
open Unit
open Parcelable?
open Unit
open Unit
onScrollCaptureSearch(
    p0: Rect,
    p1: Point,
    p2: Consumer<ScrollCaptureTarget>
)
open Unit
onScrollChanged(p0: Int, p1: Int, p2: Int, p3: Int)
open Boolean
open Unit
onSizeChanged(p0: Int, p1: Int, p2: Int, p3: Int)
open Unit
open Boolean
open Boolean
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit

This function is deprecated. Deprecated in Java

open Unit
open Boolean
overScrollBy(
    p0: Int,
    p1: Int,
    p2: Int,
    p3: Int,
    p4: Int,
    p5: Int,
    p6: Int,
    p7: Int,
    p8: Boolean
)
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open ContentInfo?
open Unit
open Boolean
open Boolean
open Unit
open Unit
postInvalidate(p0: Int, p1: Int, p2: Int, p3: Int)
open Unit
open Unit
postInvalidateDelayed(p0: Long, p1: Int, p2: Int, p3: Int, p4: Int)
open Unit
open Unit
postInvalidateOnAnimation(p0: Int, p1: Int, p2: Int, p3: Int)
open Unit
open Unit
open Unit
open Unit
open Boolean
open Unit
open Unit
open Unit
open Unit
open Unit

This function is deprecated. Deprecated in Java

Boolean
Boolean
Boolean
open Unit
open Unit
open Boolean
open Boolean
Unit
Unit
T
<T : View> requireViewById(p0: Int)
open Unit
open Unit
Unit
saveAttributeDataForStyleable(
    p0: Context,
    p1: IntArray,
    p2: AttributeSet?,
    p3: TypedArray,
    p4: Int,
    p5: Int
)
open Unit
open Unit
open Unit
scrollBy(p0: Int, p1: Int)
open Unit
scrollTo(p0: Int, p1: Int)
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
setAutofillHints(vararg p0: String?)
open Unit
open Unit
open Unit
open Unit

This function is deprecated. Deprecated in Java

open Unit
open Unit
open Unit
open Unit
Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit

This function is deprecated. Deprecated in Java

open Unit

This function is deprecated. Deprecated in Java

open Unit

This function is deprecated. Deprecated in Java

open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
setId(p0: Int)
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
setLayerType(p0: Int, p1: Paint?)
open Unit
open Unit
Unit
setLeft(p0: Int)
Unit
setLeftTopRightBottom(p0: Int, p1: Int, p2: Int, p3: Int)
open Unit
Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit

This function is deprecated. Deprecated in Java

open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
setPadding(p0: Int, p1: Int, p2: Int, p3: Int)
open Unit
setPaddingRelative(p0: Int, p1: Int, p2: Int, p3: Int)
open Unit
open Unit
open Unit
Unit
Unit
open Unit
open Unit
Unit
Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit

This function is deprecated. Deprecated in Java

open Unit
setTag(p0: Any)
open Unit
setTag(p0: Int, p1: Any)
open Unit
open Unit
open Unit
Unit
setTop(p0: Int)
open Unit
open Unit
Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit

This function is deprecated. Deprecated in Java

open Unit
open Unit
setX(p0: Float)
open Unit
setY(p0: Float)
open Unit
setZ(p0: Float)
open Boolean
open Boolean
open ActionMode
open ActionMode
open Unit
Boolean
startDrag(p0: ClipData, p1: View.DragShadowBuilder, p2: Any, p3: Int)

This function is deprecated. Deprecated in Java

Boolean
open Boolean
open Unit
open String
open Unit
open Unit
open Unit
open Unit
Unit
open Boolean
open Boolean

This function is deprecated. Deprecated in Java

open Boolean
@ViewDebug.ExportedProperty(category = "drawing")
willNotDraw()
From android.view.ViewGroup
open Unit
open Unit
open Unit
addFocusables(p0: ArrayList<View>, p1: Int, p2: Int)
open Unit
open Boolean
open Unit
open Boolean
open Boolean
open Unit
attachLayoutAnimationParameters(
    p0: View,
    p1: ViewGroup.LayoutParams,
    p2: Int,
    p3: Int
)
open Unit
open Unit
open Boolean
open Boolean
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
debug(p0: Int)
open Unit
open Unit
open Unit
open Unit
open WindowInsets
open Boolean
open Unit
open Unit
open Unit
open Boolean
open Unit
open Unit
open Unit
open Unit
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Boolean
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
dispatchScrollCaptureSearch(
    p0: Rect,
    p1: Point,
    p2: Consumer<ScrollCaptureTarget>
)
open Unit
open Unit
open Unit
open Unit
open Unit

This function is deprecated. Deprecated in Java

open Unit
open Boolean
open Boolean
open Boolean
open Unit
open Unit
open Unit
open Unit
open WindowInsets
open WindowInsetsAnimation.Bounds
open Unit

This function is deprecated. Deprecated in Java

open Unit
open Boolean
drawChild(p0: Canvas, p1: View, p2: Long)
open Unit
open Unit
open View
open OnBackInvokedDispatcher?
open Unit
open View
focusSearch(p0: View, p1: Int)
open Unit
open Boolean
open ViewGroup.LayoutParams
open ViewGroup.LayoutParams
open ViewGroup.LayoutParams
open CharSequence
open View
open Int
Int
open Int
open Boolean
open Boolean
getChildVisibleRect(p0: View, p1: Rect, p2: Point)
open Boolean
open Boolean
open Int
@ViewDebug.ExportedProperty(category = "focus", mapping = [@ViewDebug.IntToString(from = 131072, to = "FOCUS_BEFORE_DESCENDANTS"), @ViewDebug.IntToString(from = 262144, to = "FOCUS_AFTER_DESCENDANTS"), @ViewDebug.IntToString(from = 393216, to = "FOCUS_BLOCK_DESCENDANTS")])
getDescendantFocusability()
open View
open LayoutAnimationController
open Animation.AnimationListener
open Int
open LayoutTransition
open Int
open ViewGroupOverlay
open Int
@ViewDebug.ExportedProperty(category = "drawing", mapping = [@ViewDebug.IntToString(from = 0, to = "NONE"), @ViewDebug.IntToString(from = 1, to = "ANIMATION"), @ViewDebug.IntToString(from = 2, to = "SCROLLING"), @ViewDebug.IntToString(from = 3, to = "ALL")])
getPersistentDrawingCache()

This function is deprecated. Deprecated in Java

open Boolean
open Boolean
open Boolean
open Int
final Unit

This function is deprecated. Deprecated in Java

open ViewParent

This function is deprecated. Deprecated in Java

open Boolean

This function is deprecated. Deprecated in Java

open Boolean

This function is deprecated. Deprecated in Java

open Boolean
open Boolean

This function is deprecated. Deprecated in Java

open Boolean
open Boolean
open Boolean
open Unit
final Unit
layout(p0: Int, p1: Int, p2: Int, p3: Int)
open Unit
measureChild(p0: View, p1: Int, p2: Int)
open Unit
measureChildWithMargins(p0: View, p1: Int, p2: Int, p3: Int, p4: Int)
open Unit
measureChildren(p0: Int, p1: Int)
open Unit
Unit
Unit
open IntArray
open Unit
open Unit
open Boolean
open Boolean
open Boolean
onNestedFling(p0: View, p1: Float, p2: Float, p3: Boolean)
open Boolean
onNestedPreFling(p0: View, p1: Float, p2: Float)
open Boolean
open Unit
onNestedPreScroll(p0: View, p1: Int, p2: Int, p3: IntArray)
open Unit
onNestedScroll(p0: View, p1: Int, p2: Int, p3: Int, p4: Int)
open Unit
onNestedScrollAccepted(p0: View, p1: View, p2: Int)
open Boolean
open Boolean
open PointerIcon
open Boolean
onStartNestedScroll(p0: View, p1: View, p2: Int)
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
removeViews(p0: Int, p1: Int)
open Unit
open Unit
open Boolean
open Unit
open Boolean
requestFocus(p0: Int, p1: Rect)
open Boolean
open Unit
open Boolean
open Unit
open Unit
open Unit

This function is deprecated. Deprecated in Java

open Unit

This function is deprecated. Deprecated in Java

open Unit

This function is deprecated. Deprecated in Java

open Unit
open Unit

This function is deprecated. Deprecated in Java

open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit
open Unit

This function is deprecated. Deprecated in Java

open Unit
open Unit
open Unit
open Unit
open Boolean
open Boolean
open Boolean
open ActionMode
open ActionMode
open Unit
open Unit
open Unit
open Unit

Public constructors

LowLatencyCanvasView

Added in 1.0.2
LowLatencyCanvasView(
    context: Context,
    attrs: AttributeSet? = null,
    defStyle: Int = 0
)

Public functions

addView

open fun addView(child: View?): Unit

addView

open fun addView(child: View?, index: Int): Unit

addView

open fun addView(child: View?, params: ViewGroup.LayoutParams?): Unit

addView

open fun addView(child: View?, index: Int, params: ViewGroup.LayoutParams?): Unit

addView

open fun addView(child: View?, width: Int, height: Int): Unit

cancel

Added in 1.0.2
fun cancel(): Unit

Cancels any in progress request to render to the front buffer and hides the front buffered overlay. Cancellation is a "best-effort" approach and any in progress rendering will still be applied.

clear

Added in 1.0.2
fun clear(): Unit

Clears the content of the buffer and hides the front buffered overlay. This will cancel all pending requests to render. This is similar to cancel, however in addition to cancelling the pending render requests, this also clears the contents of the buffer. Similar to commit this will also hide the front buffered overlay.

commit

Added in 1.0.2
fun commit(): Unit

Invalidates this View and draws the buffer within View#onDraw. This will synchronously hide the front buffered overlay when drawing the buffer to this View. Consumers are encouraged to invoke this method when a user gesture that requires low latency rendering is complete. For example in response to a MotionEvent.ACTION_UP event in an implementation of View.onTouchEvent.

execute

Added in 1.0.2
fun execute(runnable: Runnable): Unit

Dispatches a runnable to be executed on the background rendering thread. This is useful for updating data structures used to issue drawing instructions on the same thread that Callback.onDrawFrontBufferedLayer is invoked on.

renderFrontBufferedLayer

Added in 1.0.2
fun renderFrontBufferedLayer(): Unit

Render content to the front buffered layer. This triggers a call to Callback.onDrawFrontBufferedLayer. Callback implementations can also configure the corresponding SurfaceControlCompat.Transaction that updates the contents on screen by implementing the optional Callback.onFrontBufferedLayerRenderComplete callback

setRenderCallback

Added in 1.0.2
fun setRenderCallback(callback: LowLatencyCanvasView.Callback?): Unit

Configures the Callback used to render contents to the front buffered overlay as well as optionally configuring the SurfaceControlCompat.Transaction used to update contents on screen.

Protected functions

onAttachedToWindow

protected open fun onAttachedToWindow(): Unit

onDraw

protected open fun onDraw(canvas: Canvas): Unit

onLayout

protected open fun onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int): Unit