WearComposeFoundationFlags

@ExperimentalWearFoundationApi
object WearComposeFoundationFlags


This is a collection of flags which are used to guard against regressions in some of the "riskier" refactors or new feature support that is added to this module. These flags are always "on" in the published artifact of this module, however these flags allow end consumers of this module to toggle them "off" in case this new path is causing a regression.

These flags are considered temporary, and there should be no expectation for these flags being around for an extended period of time. If you have a regression that one of these flags fixes, it is strongly encouraged for you to file a bug ASAP.

Usage:

In order to turn a feature off in a debug environment, it is recommended to set this to false in as close to the initial loading of the application as possible. Changing this value after compose library code has already been loaded can result in undefined behavior.

class MyApplication : Application() {
    override fun onCreate() {
        WearComposeFoundationFlags.SomeFeatureEnabled = false
        super.onCreate()
    }
}

In order to turn this off in a release environment, it is recommended to additionally utilize R8 rules which force a single value for the entire build artifact. This can result in the new code paths being completely removed from the artifact, which can often have nontrivial positive performance impact.

-assumevalues class androidx.wear.compose.foundation.WearComposeFoundationFlags {
    public static boolean SomeFeatureEnabled return false
}

Summary

Public properties

Boolean

Whether to use Modifier.Node for Modifier.edgeSwipeToDismiss.

Boolean

Whether segment-based snapping is enabled for androidx.wear.compose.foundation.lazy.TransformingLazyColumn.

Public properties

isNewEdgeSwipeToDismissNodeEnabled

Added in 1.8.0-alpha04
var isNewEdgeSwipeToDismissNodeEnabled: Boolean

Whether to use Modifier.Node for Modifier.edgeSwipeToDismiss. If false, the legacy Modifier.composed implementation will be used instead.

isTransformingLazyColumnSnapSegmentsEnabled

Added in 1.8.0-alpha04
var isTransformingLazyColumnSnapSegmentsEnabled: Boolean

Whether segment-based snapping is enabled for androidx.wear.compose.foundation.lazy.TransformingLazyColumn.

When true, androidx.wear.compose.foundation.lazy.TransformingLazyColumnDefaults.snapFlingBehavior and androidx.wear.compose.foundation.rotary.RotaryScrollableDefaults.snapBehavior split items taller than their snap segment threshold (see androidx.wear.compose.foundation.lazy.TransformingLazyColumnItemScope.snapSegmentThreshold) into equal snap segments and track snap targets across item transformations.

When false, snapping reverts to item-based snapping (one snap point per item at its center), and androidx.wear.compose.foundation.lazy.TransformingLazyColumnItemScope.snapSegmentThreshold has no effect.