DisplayFeatureTesting

class DisplayFeatureTesting


Summary

Public functions

@ExperimentalCoroutinesApi FoldingFeature
createFoldingFeature(
    activity: Activity,
    center: Int,
    size: Int,
    state: FoldingFeature.State,
    orientation: FoldingFeature.Orientation
)

A convenience method to get a test fold with default values provided.

Public functions

createFoldingFeature

@ExperimentalCoroutinesApi
fun createFoldingFeature(
    activity: Activity,
    center: Int = activity.windowInfoRepository().currentWindowMetrics.bounds.centerX(),
    size: Int = 0,
    state: FoldingFeature.State = HALF_OPENED,
    orientation: FoldingFeature.Orientation = HORIZONTAL
): @ExperimentalCoroutinesApi FoldingFeature

A convenience method to get a test fold with default values provided. With the default values it returns a FoldingFeature.State.HALF_OPENED feature that splits the screen along the FoldingFeature.Orientation.HORIZONTAL axis.

The bounds of the feature are calculated based on orientation, center, and size. If the feature is VERTICAL then the top-left x-coordinate is center - (size / 2) and the top-right x-coordinate is center + (size / 2). If the feature is HORIZONTAL then the top-left y-coordinate is center - (size / 2) and the bottom-left y-coordinate is center - (size / 2). The folding features always cover the window in one dimension and that determines the other coordinates.

Parameters
activity: Activity

Activity that will host the test FoldingFeature.

center: Int = activity.windowInfoRepository().currentWindowMetrics.bounds.centerX()

The coordinate along the axis matching the Orientation. The default is centered along the HORIZONTAL axis.

size: Int = 0

the smaller dimension of the fold. The larger dimension always covers the entire window.

state: FoldingFeature.State = HALF_OPENED

State of the fold. The default value is HALF_OPENED

orientation: FoldingFeature.Orientation = HORIZONTAL

Orientation of the fold. The default value is HORIZONTAL

Returns
@ExperimentalCoroutinesApi FoldingFeature

FoldingFeature that is splitting if the width is not 0 and runs parallel to the Orientation axis.