Andrey Kulikov | 70e28bd | 2020-05-20 13:22:57 +0100 | [diff] [blame] | 1 | /* |
| 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 | |
| 17 | package androidx.ui.core |
| 18 | |
Louis Pullen-Freilich | 5bb0c471 | 2020-07-20 22:01:15 +0100 | [diff] [blame] | 19 | import androidx.compose.animation.core.AnimationClockObservable |
Andrey Kulikov | 70e28bd | 2020-05-20 13:22:57 +0100 | [diff] [blame] | 20 | import androidx.compose.ambientOf |
Andrey Kulikov | 70e28bd | 2020-05-20 13:22:57 +0100 | [diff] [blame] | 21 | import androidx.compose.staticAmbientOf |
| 22 | import androidx.ui.autofill.Autofill |
| 23 | import androidx.ui.autofill.AutofillTree |
| 24 | import androidx.ui.core.clipboard.ClipboardManager |
| 25 | import androidx.ui.core.hapticfeedback.HapticFeedback |
| 26 | import androidx.ui.core.texttoolbar.TextToolbar |
Louis Pullen-Freilich | ab19475 | 2020-07-21 22:21:22 +0100 | [diff] [blame] | 27 | import androidx.compose.ui.text.input.TextInputService |
Andrey Kulikov | 70e28bd | 2020-05-20 13:22:57 +0100 | [diff] [blame] | 28 | import androidx.ui.platform.UriHandler |
Louis Pullen-Freilich | ab19475 | 2020-07-21 22:21:22 +0100 | [diff] [blame] | 29 | import androidx.compose.ui.text.font.Font |
Andrey Kulikov | 70e28bd | 2020-05-20 13:22:57 +0100 | [diff] [blame] | 30 | import androidx.ui.unit.Density |
| 31 | import kotlin.coroutines.CoroutineContext |
| 32 | |
| 33 | /** |
| 34 | * The default animation clock used for animations when an explicit clock isn't provided. |
| 35 | */ |
| 36 | val AnimationClockAmbient = staticAmbientOf<AnimationClockObservable>() |
| 37 | |
| 38 | /** |
| 39 | * The ambient that can be used to trigger autofill actions. Eg. [Autofill.requestAutofillForNode]. |
| 40 | */ |
| 41 | val 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 | */ |
| 49 | val AutofillTreeAmbient = staticAmbientOf<AutofillTree>() |
| 50 | |
| 51 | /** |
| 52 | * The ambient to provide communication with platform clipboard service. |
| 53 | */ |
| 54 | val 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.") |
| 61 | val 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 | */ |
| 70 | val 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 | */ |
| 78 | val FontLoaderAmbient = staticAmbientOf<Font.ResourceLoader>() |
| 79 | |
| 80 | /** |
| 81 | * The ambient to provide haptic feedback to the user. |
| 82 | */ |
| 83 | val HapticFeedBackAmbient = staticAmbientOf<HapticFeedback>() |
| 84 | |
| 85 | /** |
| 86 | * The ambient to provide communication with platform text input service. |
| 87 | */ |
| 88 | val TextInputServiceAmbient = staticAmbientOf<TextInputService?>() |
| 89 | |
| 90 | /** |
| 91 | * The ambient to provide text-related toolbar. |
| 92 | */ |
| 93 | val TextToolbarAmbient = staticAmbientOf<TextToolbar>() |
| 94 | |
| 95 | /** |
| 96 | * The ambient to provide functionality related to URL, e.g. open URI. |
| 97 | */ |
Nikolay Igotti | 98f3450 | 2020-06-22 17:21:17 +0300 | [diff] [blame] | 98 | val UriHandlerAmbient = staticAmbientOf<UriHandler>() |