[go: nahoru, domu]

blob: a61ddab61db1dd550d1642f79d2ab5f4cd50a3cc [file] [log] [blame]
Andrey Kulikov70e28bd2020-05-20 13:22:57 +01001/*
2 * Copyright 2020 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
17package androidx.ui.core
18
Louis Pullen-Freilich5bb0c4712020-07-20 22:01:15 +010019import androidx.compose.animation.core.AnimationClockObservable
Andrey Kulikov70e28bd2020-05-20 13:22:57 +010020import androidx.compose.ambientOf
Andrey Kulikov70e28bd2020-05-20 13:22:57 +010021import androidx.compose.staticAmbientOf
22import androidx.ui.autofill.Autofill
23import androidx.ui.autofill.AutofillTree
24import androidx.ui.core.clipboard.ClipboardManager
25import androidx.ui.core.hapticfeedback.HapticFeedback
26import androidx.ui.core.texttoolbar.TextToolbar
Louis Pullen-Freilichab194752020-07-21 22:21:22 +010027import androidx.compose.ui.text.input.TextInputService
Andrey Kulikov70e28bd2020-05-20 13:22:57 +010028import androidx.ui.platform.UriHandler
Louis Pullen-Freilichab194752020-07-21 22:21:22 +010029import androidx.compose.ui.text.font.Font
Andrey Kulikov70e28bd2020-05-20 13:22:57 +010030import androidx.ui.unit.Density
31import kotlin.coroutines.CoroutineContext
32
33/**
34 * The default animation clock used for animations when an explicit clock isn't provided.
35 */
36val AnimationClockAmbient = staticAmbientOf<AnimationClockObservable>()
37
38/**
39 * The ambient that can be used to trigger autofill actions. Eg. [Autofill.requestAutofillForNode].
40 */
41val AutofillAmbient = staticAmbientOf<Autofill?>()
42
43/**
44 * The ambient that can be used to add
45 * [AutofillNode][import androidx.ui.autofill.AutofillNode]s to the autofill tree. The
46 * [AutofillTree] is a temporary data structure that will be replaced by Autofill Semantics
47 * (b/138604305).
48 */
49val AutofillTreeAmbient = staticAmbientOf<AutofillTree>()
50
51/**
52 * The ambient to provide communication with platform clipboard service.
53 */
54val ClipboardManagerAmbient = staticAmbientOf<ClipboardManager>()
55
56/**
57 * Don't use this.
58 * @suppress
59 */
60@Deprecated(message = "This will be replaced with something more appropriate when suspend works.")
61val CoroutineContextAmbient = ambientOf<CoroutineContext>()
62
63/**
64 * Provides the [Density] to be used to transform between [density-independent pixel
65 * units (DP)][androidx.ui.unit.Dp] and [pixel units][androidx.ui.unit.Px] or
66 * [scale-independent pixel units (SP)][androidx.ui.unit.TextUnit] and
67 * [pixel units][androidx.ui.unit.Px]. This is typically used when a [DP][androidx.ui.unit.Dp]
68 * is provided and it must be converted in the body of [Layout] or [DrawModifier].
69 */
70val DensityAmbient = staticAmbientOf<Density>()
71
72/**
73 * The ambient to provide platform font loading methods.
74 *
75 * Use [androidx.ui.res.fontResource] instead.
76 * @suppress
77 */
78val FontLoaderAmbient = staticAmbientOf<Font.ResourceLoader>()
79
80/**
81 * The ambient to provide haptic feedback to the user.
82 */
83val HapticFeedBackAmbient = staticAmbientOf<HapticFeedback>()
84
85/**
86 * The ambient to provide communication with platform text input service.
87 */
88val TextInputServiceAmbient = staticAmbientOf<TextInputService?>()
89
90/**
91 * The ambient to provide text-related toolbar.
92 */
93val TextToolbarAmbient = staticAmbientOf<TextToolbar>()
94
95/**
96 * The ambient to provide functionality related to URL, e.g. open URI.
97 */
Nikolay Igotti98f34502020-06-22 17:21:17 +030098val UriHandlerAmbient = staticAmbientOf<UriHandler>()