@amazon-devices/kepler-a11y-settings-interface-turbo 1.0.0-rn-83
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +7 -0
- package/README.md +230 -0
- package/dist/kepler/aarch64-debug/lib/libKeplerA11ySettingsInterfaceTurbo.so +0 -0
- package/dist/kepler/aarch64-debug/lib/libKeplerA11ySettingsInterfaceTurbo.so.debug +0 -0
- package/dist/kepler/aarch64-release/lib/libKeplerA11ySettingsInterfaceTurbo.so +0 -0
- package/dist/kepler/aarch64-release/lib/libKeplerA11ySettingsInterfaceTurbo.so.debug +0 -0
- package/dist/kepler/armv7-debug/lib/libKeplerA11ySettingsInterfaceTurbo.so +0 -0
- package/dist/kepler/armv7-debug/lib/libKeplerA11ySettingsInterfaceTurbo.so.debug +0 -0
- package/dist/kepler/armv7-release/lib/libKeplerA11ySettingsInterfaceTurbo.so +0 -0
- package/dist/kepler/armv7-release/lib/libKeplerA11ySettingsInterfaceTurbo.so.debug +0 -0
- package/dist/kepler/tm-manifest.json +1 -0
- package/dist/kepler/x86_64-debug/lib/libKeplerA11ySettingsInterfaceTurbo.so +0 -0
- package/dist/kepler/x86_64-debug/lib/libKeplerA11ySettingsInterfaceTurbo.so.debug +0 -0
- package/dist/kepler/x86_64-release/lib/libKeplerA11ySettingsInterfaceTurbo.so +0 -0
- package/dist/kepler/x86_64-release/lib/libKeplerA11ySettingsInterfaceTurbo.so.debug +0 -0
- package/dist/src/KeplerA11ySettingsInterface.d.ts +309 -0
- package/dist/src/KeplerA11ySettingsInterface.js +836 -0
- package/dist/src/UiScaleSettingContextProvider.d.ts +53 -0
- package/dist/src/UiScaleSettingContextProvider.js +164 -0
- package/dist/src/index.d.ts +12 -0
- package/dist/src/index.js +31 -0
- package/dist/src/turbo-modules/KeplerA11ySettingsInterfaceTurbo.d.ts +214 -0
- package/dist/src/turbo-modules/KeplerA11ySettingsInterfaceTurbo.js +33 -0
- package/dist/src/turbo-modules/__mocks__/KeplerA11ySettingsInterfaceTurbo.d.ts +7 -0
- package/dist/src/turbo-modules/__mocks__/KeplerA11ySettingsInterfaceTurbo.js +8 -0
- package/dist/src/utils/constants.d.ts +18 -0
- package/dist/src/utils/constants.js +21 -0
- package/dist/src/utils/dipUtils.d.ts +30 -0
- package/dist/src/utils/dipUtils.js +63 -0
- package/dist/test/KeplerA11ySettingsInterfaceTurbo.spec.d.ts +1 -0
- package/dist/test/KeplerA11ySettingsInterfaceTurbo.spec.js +7 -0
- package/package.json +61 -0
- package/react-native.config.js +19 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
Copyright 2025 Amazon.com, Inc. or its affiliates. All rights reserved.
|
|
2
|
+
|
|
3
|
+
These materials are licensed as "Program Materials" under the Program Materials License Agreement (the "Agreement"). The Agreement is available at https://developer.amazon.com/support/legal/pml. See the Agreement for the specific terms and conditions of the Agreement. Capitalized terms not defined in this file have the meanings given to them in the Agreement.
|
|
4
|
+
|
|
5
|
+
If you do not agree to the above terms and conditions, you may not use any file in this package.
|
|
6
|
+
|
|
7
|
+
YOUR USE OF THE PROGRAM MATERIALS IN OR ASSOCIATED WITH THIS PACKAGE IS AT YOUR SOLE RISK. IN NO EVENT WILL AMAZON BE LIABLE FOR ANY DAMAGES, INCLUDING WITHOUT LIMITATION ANY DIRECT, INDIRECT, CONSEQUENTIAL, SPECIAL, INCIDENTAL, OR PUNITIVE DAMAGES (INCLUDING FOR ANY LOSS OF GOODWILL, BUSINESS INTERRUPTION, LOST PROFITS OR DATA, OR COMPUTER FAILURE OR MALFUNCTION) ARISING FROM OR RELATING TO SUCH PROGRAM MATERIALS, HOWEVER CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, EVEN IF AMAZON HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. THESE LIMITATIONS AND DISCLAIMERS APPLY EXCEPT TO THE EXTENT PROHIBITED BY APPLICABLE LAW.
|
package/README.md
ADDED
|
@@ -0,0 +1,230 @@
|
|
|
1
|
+
# Overview
|
|
2
|
+
@amazon-devices/kepler-a11y-settings-interface-turbo provides accessibility settings APIs and UI scaling hooks for Kepler applications.
|
|
3
|
+
|
|
4
|
+
# Getting Started
|
|
5
|
+
|
|
6
|
+
## Installation
|
|
7
|
+
In the package.json file, add the @amazon-devices/kepler-a11y-settings-interface-turbo package as a dependency:
|
|
8
|
+
|
|
9
|
+
From the command line, run the following:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install @amazon-devices/kepler-a11y-settings-interface-turbo
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Or, you can manually edit the package.json file as shown:
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
"dependencies": {
|
|
19
|
+
...
|
|
20
|
+
"@amazon-devices/kepler-a11y-settings-interface-turbo": "1.x", // or latest major version
|
|
21
|
+
...
|
|
22
|
+
}
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Then run `npm install`.
|
|
26
|
+
|
|
27
|
+
# Usage
|
|
28
|
+
|
|
29
|
+
## Settings Getters, Setters, and Listeners
|
|
30
|
+
|
|
31
|
+
### Basic Settings Management
|
|
32
|
+
Use the KeplerA11ySettingsInterface to get, set, and listen for accessibility setting changes:
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
import KeplerA11ySettingsInterface from '@amazon-devices/kepler-a11y-settings-interface-turbo';
|
|
36
|
+
|
|
37
|
+
// Get current settings (getter methods return Promises)
|
|
38
|
+
KeplerA11ySettingsInterface.isScreenReaderEnabled().then(isEnabled => {
|
|
39
|
+
console.log('Screen reader enabled:', isEnabled);
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
KeplerA11ySettingsInterface.getUiScaleSetting().then(scale => {
|
|
43
|
+
console.log('Current UI scale:', scale);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
KeplerA11ySettingsInterface.getColorCorrectionMode().then(mode => {
|
|
47
|
+
console.log('Color correction mode:', mode);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// Set settings (requires com.amazon.devconf.privilege.accessibility.write permission)
|
|
51
|
+
await KeplerA11ySettingsInterface.setScreenReaderEnabled(true);
|
|
52
|
+
await KeplerA11ySettingsInterface.setUiScaleSetting(3);
|
|
53
|
+
await KeplerA11ySettingsInterface.setColorCorrectionMode('deuteranomaly');
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
### Event Listeners
|
|
57
|
+
Add listeners to respond to accessibility setting changes. Listener registration and
|
|
58
|
+
removal methods are asynchronous and return Promises:
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
import KeplerA11ySettingsInterface from '@amazon-devices/kepler-a11y-settings-interface-turbo';
|
|
62
|
+
|
|
63
|
+
// Listen for screen reader state changes
|
|
64
|
+
const handleScreenReaderChange = (enabled: boolean) => {
|
|
65
|
+
console.log(`Screen reader ${enabled ? 'enabled' : 'disabled'}`);
|
|
66
|
+
// Respond to screen reader state
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const success = await KeplerA11ySettingsInterface.addScreenReaderStateListener(handleScreenReaderChange);
|
|
70
|
+
if (!success) {
|
|
71
|
+
console.warn('Failed to register screen reader listener');
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
// Remember to remove listeners when component unmounts
|
|
75
|
+
await KeplerA11ySettingsInterface.removeScreenReaderStateListener();
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
### Captioning Preferences
|
|
79
|
+
Manage closed captioning settings:
|
|
80
|
+
|
|
81
|
+
```typescript
|
|
82
|
+
import KeplerA11ySettingsInterface, { CaptioningProps } from '@amazon-devices/kepler-a11y-settings-interface-turbo';
|
|
83
|
+
|
|
84
|
+
// Get current captioning preferences
|
|
85
|
+
KeplerA11ySettingsInterface.getCaptionPreferences().then(captionPrefs => {
|
|
86
|
+
console.log('Current caption preferences:', captionPrefs);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// Set captioning preferences
|
|
90
|
+
const newPrefs: CaptioningProps = {
|
|
91
|
+
textSize: 'large',
|
|
92
|
+
textColor: 'white',
|
|
93
|
+
textFont: 'sans_serif',
|
|
94
|
+
textEdgeStyle: 'drop_shadowed',
|
|
95
|
+
textOpacity: 'percent_100'
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
await KeplerA11ySettingsInterface.setCaptionPreferences(newPrefs);
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
## UI Scale Setting Hooks
|
|
102
|
+
|
|
103
|
+
### React Hooks for Dynamic Scaling
|
|
104
|
+
Use the provided hooks to create responsive UI that automatically adapts to scale setting changes.
|
|
105
|
+
These hooks are necessary where UI sizes are defined, in the case that the associated UI element should
|
|
106
|
+
scale.
|
|
107
|
+
|
|
108
|
+
If you are using UI elements that have already wrapped underlying predefined sizes with these hooks,
|
|
109
|
+
you simply need to wrap your App definition in the UiScaleSettingContextProvider.
|
|
110
|
+
|
|
111
|
+
```typescript
|
|
112
|
+
import React from 'react';
|
|
113
|
+
import { View, StyleSheet } from 'react-native';
|
|
114
|
+
import {
|
|
115
|
+
UiScaleSettingContextProvider,
|
|
116
|
+
useScaledSize,
|
|
117
|
+
useScalingMultiplier,
|
|
118
|
+
useUiScaleSetting
|
|
119
|
+
} from '@amazon-devices/kepler-a11y-settings-interface-turbo';
|
|
120
|
+
|
|
121
|
+
const CONTENT_WIDTH_DEFAULT_BASE = 144;
|
|
122
|
+
const CONTENT_HEIGHT_DEFAULT_BASE = 80;
|
|
123
|
+
const LOGO_DEFAULT_WIDTH = 57;
|
|
124
|
+
const LOGO_DEFAULT_HEIGHT = 24;
|
|
125
|
+
|
|
126
|
+
const styles = StyleSheet.create({
|
|
127
|
+
viewStyle: {
|
|
128
|
+
marginLeft: 8,
|
|
129
|
+
alignItems: 'center',
|
|
130
|
+
zIndex: 0,
|
|
131
|
+
},
|
|
132
|
+
text: {
|
|
133
|
+
fontSize: 14,
|
|
134
|
+
color: '#666',
|
|
135
|
+
fontFamily: 'sans-serif',
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
const App = () => {
|
|
140
|
+
// Get scaled dimensions that automatically update when scale setting changes
|
|
141
|
+
const contentWidthDefault = useScaledSize(CONTENT_WIDTH_DEFAULT_BASE, {
|
|
142
|
+
itemType: 'medium_upscale'
|
|
143
|
+
});
|
|
144
|
+
const contentHeightDefault = useScaledSize(CONTENT_HEIGHT_DEFAULT_BASE, {
|
|
145
|
+
itemType: 'medium_upscale'
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
// Get scaling multiplier for related dimensions
|
|
149
|
+
const assetScalingMultiplier = useScalingMultiplier(LOGO_DEFAULT_WIDTH, {
|
|
150
|
+
itemType: 'image'
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
// Memoize the style sheet so it only updates when the contentWidthDefault or
|
|
154
|
+
// contentHeightDefault change via the useScaledSize hook.
|
|
155
|
+
const viewStyle = React.useMemo(
|
|
156
|
+
() => ({
|
|
157
|
+
...styles.viewStyle,
|
|
158
|
+
width: contentWidthDefault,
|
|
159
|
+
height: contentHeightDefault,
|
|
160
|
+
}),
|
|
161
|
+
[contentWidthDefault, contentHeightDefault],
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
// Memoize the style sheet so it only updates when the assetScalingMultiplier
|
|
165
|
+
// changes via the useScalingMultiplier hook.
|
|
166
|
+
const assetStyle = React.useMemo(
|
|
167
|
+
() => ({
|
|
168
|
+
width: LOGO_DEFAULT_WIDTH * assetScalingMultiplier,
|
|
169
|
+
height: LOGO_DEFAULT_HEIGHT * assetScalingMultiplier,
|
|
170
|
+
marginRight: 12,
|
|
171
|
+
}),
|
|
172
|
+
[assetScalingMultiplier],
|
|
173
|
+
);
|
|
174
|
+
|
|
175
|
+
// Get current scale factor to display below
|
|
176
|
+
const currentScale = useUiScaleSetting();
|
|
177
|
+
|
|
178
|
+
return (
|
|
179
|
+
<View style={viewStyle}>
|
|
180
|
+
<Image style={assetStyle} source={logoSource} />
|
|
181
|
+
<Text style={styles.text}>Current scale: {currentScale}</Text>
|
|
182
|
+
</View>
|
|
183
|
+
);
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
// Wrap your app with the provider. This will cause all UI elements utilizing
|
|
187
|
+
// the useScaledSize and useScalingMultiplier hooks to respond dynamically to
|
|
188
|
+
// UiScaleSetting setting changes, even if the UI element is imported from another
|
|
189
|
+
// library.
|
|
190
|
+
const AppWithProvider = () => (
|
|
191
|
+
<UiScaleSettingContextProvider>
|
|
192
|
+
<App />
|
|
193
|
+
</UiScaleSettingContextProvider>
|
|
194
|
+
);
|
|
195
|
+
|
|
196
|
+
export default AppWithProvider;
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Scaling Types
|
|
200
|
+
The library supports different scaling behaviors for various UI elements:
|
|
201
|
+
|
|
202
|
+
- `'low_upscale'` - Large items that scale minimally (e.g., cards)
|
|
203
|
+
- `'medium_upscale'` - Standard UI elements with moderate scaling
|
|
204
|
+
- `'large_upscale'` - Small elements that need significant scaling (e.g., buttons)
|
|
205
|
+
- `'low_downscale'` - Whitespace that reduces at higher scales
|
|
206
|
+
- `'large_downscale'` - Large padding that reduces dramatically
|
|
207
|
+
- `'text'` - Text elements with corresponding line height scaling
|
|
208
|
+
- `'image'` - Images and visual assets
|
|
209
|
+
|
|
210
|
+
### Advanced Scaling Options
|
|
211
|
+
Control scaling limits with optional parameters:
|
|
212
|
+
|
|
213
|
+
```typescript
|
|
214
|
+
const scaledWidth = useScaledSize(100, {
|
|
215
|
+
itemType: 'medium_upscale',
|
|
216
|
+
maxSize: 200, // Never exceed 200 units
|
|
217
|
+
minSize: 50 // Never go below 50 units
|
|
218
|
+
});
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Density Independent Pixels (DIP)
|
|
222
|
+
|
|
223
|
+
The scaling APIs (`useScaledSize`, `useScalingMultiplier`, `getScaledSize`, `getScalingMultiplier`)
|
|
224
|
+
support both Density Independent Pixel (DIP) and physical pixel inputs, depending on whether the
|
|
225
|
+
consuming application has enabled the `PLATFORM_DENSITY_INDEPENDENT_PIXEL` runtime feature flag
|
|
226
|
+
in its `react-native.config.js`.
|
|
227
|
+
|
|
228
|
+
- **DIP enabled** (`PLATFORM_DENSITY_INDEPENDENT_PIXEL: true`): Size values passed to the scaling
|
|
229
|
+
APIs are expected to be in density-independent pixels.
|
|
230
|
+
- **DIP not enabled**: Size values are expected to be in physical pixels.
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"schema":1,"fileSets":{"native":[{"arch":"aarch64","variant":"release","directoryPath":"aarch64-release"},{"arch":"armv7","variant":"release","directoryPath":"armv7-release"},{"arch":"x86_64","variant":"release","directoryPath":"x86_64-release"},{"arch":"aarch64","variant":"debug","directoryPath":"aarch64-debug"},{"arch":"armv7","variant":"debug","directoryPath":"armv7-debug"},{"arch":"x86_64","variant":"debug","directoryPath":"x86_64-debug"}]}}
|
|
Binary file
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025 - 2026 Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
*
|
|
4
|
+
* PROPRIETARY/CONFIDENTIAL
|
|
5
|
+
*
|
|
6
|
+
* Use is subject to license terms.
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
import type { UiScaleSetting, ScalingProps, ColorCorrectionMode, TimeoutMultiplier, CaptionTextSize, CaptionColor, CaptionFont, CaptionEdgeStyle, CaptionOpacity, CaptioningProps, ItemScalingType } from './turbo-modules/KeplerA11ySettingsInterfaceTurbo';
|
|
10
|
+
declare class KeplerA11ySettingsInterface {
|
|
11
|
+
private __eventEmitter;
|
|
12
|
+
private __uiScaleSettingListener;
|
|
13
|
+
private __screenReaderStateListener;
|
|
14
|
+
private __screenMagnifierStateListener;
|
|
15
|
+
private __textBannerStateListener;
|
|
16
|
+
private __colorInversionStateListener;
|
|
17
|
+
private __colorCorrectionModeListener;
|
|
18
|
+
private __highContrastTextStateListener;
|
|
19
|
+
private __audioDescriptionStateListener;
|
|
20
|
+
private __timeToTakeActionListener;
|
|
21
|
+
private __closedCaptioningStateListener;
|
|
22
|
+
private __captioningPreferencesListener;
|
|
23
|
+
constructor();
|
|
24
|
+
/**
|
|
25
|
+
* Adds a listener for UI scale setting changes.
|
|
26
|
+
* If a listener is already registered, it will be removed and replaced with the new one.
|
|
27
|
+
* @param handler Callback function invoked on the main thread when UI scale setting changes
|
|
28
|
+
* @returns Promise that resolves to boolean representing if listener registered successfully.
|
|
29
|
+
*/
|
|
30
|
+
addUiScaleSettingListener(handler: (newScaleSetting: UiScaleSetting) => void): Promise<boolean>;
|
|
31
|
+
/**
|
|
32
|
+
* Removes the UI scale setting listener.
|
|
33
|
+
* @returns Promise that resolves when the listener has been removed.
|
|
34
|
+
*/
|
|
35
|
+
removeUiScaleSettingListener(): Promise<void>;
|
|
36
|
+
/**
|
|
37
|
+
* Adds a listener for screen reader state changes.
|
|
38
|
+
* If a listener is already registered, it will be removed and replaced with the new one.
|
|
39
|
+
* @param handler Callback function invoked on the main thread when screen reader state changes
|
|
40
|
+
* @returns Promise that resolves to boolean representing if listener registered successfully.
|
|
41
|
+
*/
|
|
42
|
+
addScreenReaderStateListener(handler: (enabled: boolean) => void): Promise<boolean>;
|
|
43
|
+
/**
|
|
44
|
+
* Removes the screen reader state listener.
|
|
45
|
+
* @returns Promise that resolves when the listener has been removed.
|
|
46
|
+
*/
|
|
47
|
+
removeScreenReaderStateListener(): Promise<void>;
|
|
48
|
+
/**
|
|
49
|
+
* Adds a listener for screen magnifier state changes.
|
|
50
|
+
* If a listener is already registered, it will be removed and replaced with the new one.
|
|
51
|
+
* @param handler Callback function invoked on the main thread when screen magnifier state changes
|
|
52
|
+
* @returns Promise that resolves to boolean representing if listener registered successfully.
|
|
53
|
+
*/
|
|
54
|
+
addScreenMagnifierStateListener(handler: (enabled: boolean) => void): Promise<boolean>;
|
|
55
|
+
/**
|
|
56
|
+
* Removes the screen magnifier state listener.
|
|
57
|
+
* @returns Promise that resolves when the listener has been removed.
|
|
58
|
+
*/
|
|
59
|
+
removeScreenMagnifierStateListener(): Promise<void>;
|
|
60
|
+
/**
|
|
61
|
+
* Adds a listener for text banner state changes.
|
|
62
|
+
* If a listener is already registered, it will be removed and replaced with the new one.
|
|
63
|
+
* @param handler Callback function invoked on the main thread when text banner state changes
|
|
64
|
+
* @returns Promise that resolves to boolean representing if listener registered successfully.
|
|
65
|
+
*/
|
|
66
|
+
addTextBannerStateListener(handler: (enabled: boolean) => void): Promise<boolean>;
|
|
67
|
+
/**
|
|
68
|
+
* Removes the text banner state listener.
|
|
69
|
+
* @returns Promise that resolves when the listener has been removed.
|
|
70
|
+
*/
|
|
71
|
+
removeTextBannerStateListener(): Promise<void>;
|
|
72
|
+
/**
|
|
73
|
+
* Adds a listener for color inversion state changes.
|
|
74
|
+
* If a listener is already registered, it will be removed and replaced with the new one.
|
|
75
|
+
* @param handler Callback function invoked on the main thread when color inversion state changes
|
|
76
|
+
* @returns Promise that resolves to boolean representing if listener registered successfully.
|
|
77
|
+
*/
|
|
78
|
+
addColorInversionStateListener(handler: (enabled: boolean) => void): Promise<boolean>;
|
|
79
|
+
/**
|
|
80
|
+
* Removes the color inversion state listener.
|
|
81
|
+
* @returns Promise that resolves when the listener has been removed.
|
|
82
|
+
*/
|
|
83
|
+
removeColorInversionStateListener(): Promise<void>;
|
|
84
|
+
/**
|
|
85
|
+
* Adds a listener for color correction mode changes.
|
|
86
|
+
* If a listener is already registered, it will be removed and replaced with the new one.
|
|
87
|
+
* @param handler Callback function invoked on the main thread when color correction mode changes
|
|
88
|
+
* @returns Promise that resolves to boolean representing if listener registered successfully.
|
|
89
|
+
*/
|
|
90
|
+
addColorCorrectionModeListener(handler: (mode: ColorCorrectionMode) => void): Promise<boolean>;
|
|
91
|
+
/**
|
|
92
|
+
* Removes the color correction mode listener.
|
|
93
|
+
* @returns Promise that resolves when the listener has been removed.
|
|
94
|
+
*/
|
|
95
|
+
removeColorCorrectionModeListener(): Promise<void>;
|
|
96
|
+
/**
|
|
97
|
+
* Adds a listener for high contrast text state changes.
|
|
98
|
+
* If a listener is already registered, it will be removed and replaced with the new one.
|
|
99
|
+
* @param handler Callback function invoked on the main thread when high contrast text state changes
|
|
100
|
+
* @returns Promise that resolves to boolean representing if listener registered successfully.
|
|
101
|
+
*/
|
|
102
|
+
addHighContrastTextStateListener(handler: (enabled: boolean) => void): Promise<boolean>;
|
|
103
|
+
/**
|
|
104
|
+
* Removes the high contrast text state listener.
|
|
105
|
+
* @returns Promise that resolves when the listener has been removed.
|
|
106
|
+
*/
|
|
107
|
+
removeHighContrastTextStateListener(): Promise<void>;
|
|
108
|
+
/**
|
|
109
|
+
* Adds a listener for audio description state changes.
|
|
110
|
+
* If a listener is already registered, it will be removed and replaced with the new one.
|
|
111
|
+
* @param handler Callback function invoked on the main thread when audio description state changes
|
|
112
|
+
* @returns Promise that resolves to boolean representing if listener registered successfully.
|
|
113
|
+
*/
|
|
114
|
+
addAudioDescriptionStateListener(handler: (enabled: boolean) => void): Promise<boolean>;
|
|
115
|
+
/**
|
|
116
|
+
* Removes the audio description state listener.
|
|
117
|
+
* @returns Promise that resolves when the listener has been removed.
|
|
118
|
+
*/
|
|
119
|
+
removeAudioDescriptionStateListener(): Promise<void>;
|
|
120
|
+
/**
|
|
121
|
+
* Adds a listener for time to take action changes.
|
|
122
|
+
* If a listener is already registered, it will be removed and replaced with the new one.
|
|
123
|
+
* @param handler Callback function invoked on the main thread when time to take action changes
|
|
124
|
+
* @returns Promise that resolves to boolean representing if listener registered successfully.
|
|
125
|
+
*/
|
|
126
|
+
addTimeToTakeActionListener(handler: (value: TimeoutMultiplier) => void): Promise<boolean>;
|
|
127
|
+
/**
|
|
128
|
+
* Removes the time to take action listener.
|
|
129
|
+
* @returns Promise that resolves when the listener has been removed.
|
|
130
|
+
*/
|
|
131
|
+
removeTimeToTakeActionListener(): Promise<void>;
|
|
132
|
+
/**
|
|
133
|
+
* Adds a listener for closed captioning state changes.
|
|
134
|
+
* If a listener is already registered, it will be removed and replaced with the new one.
|
|
135
|
+
* @param handler Callback function invoked on the main thread when closed captioning state changes
|
|
136
|
+
* @returns Promise that resolves to boolean representing if listener registered successfully.
|
|
137
|
+
*/
|
|
138
|
+
addClosedCaptioningStateListener(handler: (enabled: boolean) => void): Promise<boolean>;
|
|
139
|
+
/**
|
|
140
|
+
* Removes the closed captioning state listener.
|
|
141
|
+
* @returns Promise that resolves when the listener has been removed.
|
|
142
|
+
*/
|
|
143
|
+
removeClosedCaptioningStateListener(): Promise<void>;
|
|
144
|
+
/**
|
|
145
|
+
* Adds a listener for captioning preferences changes.
|
|
146
|
+
* If a listener is already registered, it will be removed and replaced with the new one.
|
|
147
|
+
* @param handler Callback function invoked on the main thread when captioning preferences change
|
|
148
|
+
* @returns Promise that resolves to boolean representing if listener registered successfully.
|
|
149
|
+
*/
|
|
150
|
+
addCaptioningPreferencesListener(handler: (preferences: CaptioningProps) => void): Promise<boolean>;
|
|
151
|
+
/**
|
|
152
|
+
* Removes the captioning preferences listener.
|
|
153
|
+
* @returns Promise that resolves when the listener has been removed.
|
|
154
|
+
*/
|
|
155
|
+
removeCaptioningPreferencesListener(): Promise<void>;
|
|
156
|
+
/**
|
|
157
|
+
* Gets the scaling multiplier for the given original size and scaling properties.
|
|
158
|
+
*
|
|
159
|
+
* This method should be used to retrieve a scale factor, which can be applied to related
|
|
160
|
+
* values that do not have the same scaling properties, like the height and width of an image.
|
|
161
|
+
*
|
|
162
|
+
* Note: Prefer using the useScalingMultiplier hook from UiScaleSettingContextProvider.
|
|
163
|
+
*
|
|
164
|
+
* @param originalSize The original size to scale (in DIP if PLATFORM_DENSITY_INDEPENDENT_PIXEL
|
|
165
|
+
* is enabled, or in physical pixels otherwise)
|
|
166
|
+
* @param scalingProps Properties that define how scaling should be applied
|
|
167
|
+
* @returns Promise that resolves to the scaling multiplier
|
|
168
|
+
*/
|
|
169
|
+
getScalingMultiplier(originalSize: number, scalingProps: ScalingProps): Promise<number>;
|
|
170
|
+
/**
|
|
171
|
+
* Gets the scaled size for the given original size and scaling properties.
|
|
172
|
+
*
|
|
173
|
+
* Note: Prefer using the useScaledSize hook from UiScaleSettingContextProvider.
|
|
174
|
+
*
|
|
175
|
+
* @param originalSize The original size to scale (in DIP if PLATFORM_DENSITY_INDEPENDENT_PIXEL
|
|
176
|
+
* is enabled, or in physical pixels otherwise)
|
|
177
|
+
* @param scalingProps Properties that define how scaling should be applied
|
|
178
|
+
* @returns Promise that resolves to the scaled size
|
|
179
|
+
*/
|
|
180
|
+
getScaledSize(originalSize: number, scalingProps: ScalingProps): Promise<number>;
|
|
181
|
+
/**
|
|
182
|
+
* Gets the current UI scale setting.
|
|
183
|
+
*
|
|
184
|
+
* Note: Prefer using the useUiScaleSetting hook from UiScaleSettingContextProvider.
|
|
185
|
+
*
|
|
186
|
+
* @returns Promise that resolves to the current UI scale setting
|
|
187
|
+
*/
|
|
188
|
+
getUiScaleSetting(): Promise<UiScaleSetting>;
|
|
189
|
+
/**
|
|
190
|
+
* Checks if screen reader is enabled.
|
|
191
|
+
* @returns Promise that resolves to true if screen reader is enabled, false otherwise
|
|
192
|
+
*/
|
|
193
|
+
isScreenReaderEnabled(): Promise<boolean>;
|
|
194
|
+
/**
|
|
195
|
+
* Checks if screen magnifier is enabled.
|
|
196
|
+
* @returns Promise that resolves to true if screen magnifier is enabled, false otherwise
|
|
197
|
+
*/
|
|
198
|
+
isScreenMagnifierEnabled(): Promise<boolean>;
|
|
199
|
+
/**
|
|
200
|
+
* Checks if text banner is enabled.
|
|
201
|
+
* @returns Promise that resolves to true if text banner is enabled, false otherwise
|
|
202
|
+
*/
|
|
203
|
+
isTextBannerEnabled(): Promise<boolean>;
|
|
204
|
+
/**
|
|
205
|
+
* Checks if color inversion is enabled.
|
|
206
|
+
* @returns Promise that resolves to true if color inversion is enabled, false otherwise
|
|
207
|
+
*/
|
|
208
|
+
isColorInversionEnabled(): Promise<boolean>;
|
|
209
|
+
/**
|
|
210
|
+
* Gets the current color correction mode.
|
|
211
|
+
* @returns Promise that resolves to the current color correction mode
|
|
212
|
+
*/
|
|
213
|
+
getColorCorrectionMode(): Promise<ColorCorrectionMode>;
|
|
214
|
+
/**
|
|
215
|
+
* Checks if high contrast text is enabled.
|
|
216
|
+
* @returns Promise that resolves to true if high contrast text is enabled, false otherwise
|
|
217
|
+
*/
|
|
218
|
+
isHighContrastTextEnabled(): Promise<boolean>;
|
|
219
|
+
/**
|
|
220
|
+
* Checks if audio description is preferred.
|
|
221
|
+
* @returns Promise that resolves to true if audio description is preferred, false otherwise
|
|
222
|
+
*/
|
|
223
|
+
isAudioDescriptionPreferred(): Promise<boolean>;
|
|
224
|
+
/**
|
|
225
|
+
* Gets the current time to take action setting.
|
|
226
|
+
* @returns Promise that resolves to the current timeout multiplier
|
|
227
|
+
*/
|
|
228
|
+
getTimeToTakeAction(): Promise<TimeoutMultiplier>;
|
|
229
|
+
/**
|
|
230
|
+
* Checks if closed captioning is enabled.
|
|
231
|
+
* @returns Promise that resolves to true if closed captioning is enabled, false otherwise
|
|
232
|
+
*/
|
|
233
|
+
isClosedCaptioningEnabled(): Promise<boolean>;
|
|
234
|
+
/**
|
|
235
|
+
* Gets all captioning preferences.
|
|
236
|
+
* @returns Promise that resolves to object containing all captioning preference settings
|
|
237
|
+
*/
|
|
238
|
+
getCaptionPreferences(): Promise<CaptioningProps>;
|
|
239
|
+
/**
|
|
240
|
+
* Sets the screen reader enabled state.
|
|
241
|
+
* Requires com.amazon.devconf.privilege.accessibility.write permission.
|
|
242
|
+
* @param enabled true to enable screen reader, false to disable
|
|
243
|
+
*/
|
|
244
|
+
setScreenReaderEnabled(enabled: boolean): Promise<void>;
|
|
245
|
+
/**
|
|
246
|
+
* Sets the screen magnifier enabled state.
|
|
247
|
+
* Requires com.amazon.devconf.privilege.accessibility.write permission.
|
|
248
|
+
* @param enabled true to enable screen magnifier, false to disable
|
|
249
|
+
*/
|
|
250
|
+
setScreenMagnifierEnabled(enabled: boolean): Promise<void>;
|
|
251
|
+
/**
|
|
252
|
+
* Sets the text banner enabled state.
|
|
253
|
+
* Requires com.amazon.devconf.privilege.accessibility.write permission.
|
|
254
|
+
* @param enabled true to enable text banner, false to disable
|
|
255
|
+
*/
|
|
256
|
+
setTextBannerEnabled(enabled: boolean): Promise<void>;
|
|
257
|
+
/**
|
|
258
|
+
* Sets the color inversion enabled state.
|
|
259
|
+
* Requires com.amazon.devconf.privilege.accessibility.write permission.
|
|
260
|
+
* @param enabled true to enable color inversion, false to disable
|
|
261
|
+
*/
|
|
262
|
+
setColorInversionEnabled(enabled: boolean): Promise<void>;
|
|
263
|
+
/**
|
|
264
|
+
* Sets the color correction mode.
|
|
265
|
+
* Requires com.amazon.devconf.privilege.accessibility.write permission.
|
|
266
|
+
* @param mode The color correction mode to set
|
|
267
|
+
*/
|
|
268
|
+
setColorCorrectionMode(mode: ColorCorrectionMode): Promise<void>;
|
|
269
|
+
/**
|
|
270
|
+
* Sets the high contrast text enabled state.
|
|
271
|
+
* Requires com.amazon.devconf.privilege.accessibility.write permission.
|
|
272
|
+
* @param enabled true to enable high contrast text, false to disable
|
|
273
|
+
*/
|
|
274
|
+
setHighContrastTextEnabled(enabled: boolean): Promise<void>;
|
|
275
|
+
/**
|
|
276
|
+
* Sets the audio description preference.
|
|
277
|
+
* Requires com.amazon.devconf.privilege.accessibility.write permission.
|
|
278
|
+
* @param enabled true to prefer audio description, false otherwise
|
|
279
|
+
*/
|
|
280
|
+
setAudioDescriptionPreferred(enabled: boolean): Promise<void>;
|
|
281
|
+
/**
|
|
282
|
+
* Sets the time to take action multiplier.
|
|
283
|
+
* Requires com.amazon.devconf.privilege.accessibility.write permission.
|
|
284
|
+
* @param multiplier The timeout multiplier to set
|
|
285
|
+
*/
|
|
286
|
+
setTimeToTakeAction(multiplier: TimeoutMultiplier): Promise<void>;
|
|
287
|
+
/**
|
|
288
|
+
* Sets the UI scale setting.
|
|
289
|
+
* Requires com.amazon.devconf.privilege.accessibility.write permission.
|
|
290
|
+
* @param setting The UI scale setting to set
|
|
291
|
+
*/
|
|
292
|
+
setUiScaleSetting(setting: UiScaleSetting): Promise<void>;
|
|
293
|
+
/**
|
|
294
|
+
* Sets the closed captioning enabled state.
|
|
295
|
+
* Requires com.amazon.devconf.privilege.accessibility.write permission.
|
|
296
|
+
* @param enabled true to enable closed captioning, false to disable
|
|
297
|
+
*/
|
|
298
|
+
setClosedCaptioningEnabled(enabled: boolean): Promise<void>;
|
|
299
|
+
/**
|
|
300
|
+
* Sets multiple captioning preferences at once.
|
|
301
|
+
* Requires com.amazon.devconf.privilege.accessibility.write permission.
|
|
302
|
+
* @param prefs Object containing captioning preference settings to update.
|
|
303
|
+
* Only the properties present in the object will be updated.
|
|
304
|
+
*/
|
|
305
|
+
setCaptionPreferences(prefs: CaptioningProps): Promise<void>;
|
|
306
|
+
}
|
|
307
|
+
declare const _default: KeplerA11ySettingsInterface;
|
|
308
|
+
export default _default;
|
|
309
|
+
export type { UiScaleSetting, ItemScalingType, ScalingProps, ColorCorrectionMode, TimeoutMultiplier, CaptionTextSize, CaptionColor, CaptionFont, CaptionEdgeStyle, CaptionOpacity, CaptioningProps };
|