• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.android.systemui.scene.ui.composable
18 
19 import com.android.compose.animation.scene.UserAction
20 import com.android.compose.animation.scene.UserActionResult
21 import kotlinx.coroutines.flow.Flow
22 
23 /** Defines interface for content that can respond to user-actions. */
24 interface ActionableContent {
25     /**
26      * The mapping between [UserAction] and destination [UserActionResult]s.
27      *
28      * When the scene framework detects a user action, if the current scene has a map entry for that
29      * user action, the framework starts a transition to the content specified in the map.
30      *
31      * Once the content is shown, the scene framework will read this property and set up a collector
32      * to watch for new mapping values. For each map entry, the scene framework will set up user
33      * input handling for its [UserAction] and, if such a user action is detected, initiate a
34      * transition to the specified [UserActionResult].
35      *
36      * Note that reading from this method does _not_ mean that any user action has occurred.
37      * Instead, the property is read before any user action/gesture is detected so that the
38      * framework can decide whether to set up gesture/input detectors/listeners in case user actions
39      * of the given types ever occur.
40      *
41      * A missing value for a specific [UserAction] means that the user action of the given type is
42      * not currently active in the top-most content (in z-index order) and should be ignored by the
43      * framework until the top-most content changes.
44      */
45     val userActions: Flow<Map<UserAction, UserActionResult>>
46 }
47