@@ -78,9 +78,11 @@ fun FixKeyEventActionBottomSheet(
7878 ) {
7979 Column (
8080 modifier = Modifier
81+ .animateContentSize()
82+ .verticalScroll(rememberScrollState())
8183 .padding(16 .dp)
8284 .fillMaxWidth(),
83- verticalArrangement = Arrangement .spacedBy(16 .dp),
85+ verticalArrangement = Arrangement .spacedBy(8 .dp),
8486 ) {
8587 Text (
8688 modifier = Modifier .align(Alignment .CenterHorizontally ),
@@ -90,24 +92,68 @@ fun FixKeyEventActionBottomSheet(
9092 overflow = TextOverflow .Ellipsis ,
9193 )
9294
93- Column (
94- modifier = Modifier
95- .animateContentSize()
96- .verticalScroll(rememberScrollState()),
97- verticalArrangement = Arrangement .spacedBy(8 .dp),
95+ Text (stringResource(R .string.fix_key_event_action_text))
96+
97+ FixKeyEventActionOptionCard (
98+ onClick = onSelectInputMethod,
99+ selected = state is FixKeyEventActionState .InputMethod ,
100+ title = stringResource(R .string.fix_key_event_action_input_method_title),
101+ icon = Icons .Rounded .Keyboard ,
98102 ) {
99- Text (stringResource(R .string.fix_key_event_action_text))
103+ val annotatedText = buildAnnotatedString {
104+ appendInlineContent(" icon" , " [icon]" )
105+ append(" " )
106+ append(stringResource(R .string.fix_key_event_action_input_method_text))
107+ }
108+ val inlineContent = mapOf (
109+ Pair (
110+ " icon" ,
111+ InlineTextContent (
112+ Placeholder (
113+ width = MaterialTheme .typography.bodyLarge.fontSize,
114+ height = MaterialTheme .typography.bodyLarge.fontSize,
115+ placeholderVerticalAlign = PlaceholderVerticalAlign .TextCenter ,
116+ ),
117+ ) {
118+ Icon (
119+ imageVector = Icons .Rounded .Remove ,
120+ contentDescription = null ,
121+ tint = MaterialTheme .colorScheme.error,
122+ )
123+ },
124+ ),
125+ )
126+ Text (
127+ annotatedText,
128+ inlineContent = inlineContent,
129+ style = MaterialTheme .typography.bodyMedium,
130+ )
131+ }
100132
101- FixKeyEventActionOptionCard (
102- onClick = onSelectInputMethod,
103- selected = state is FixKeyEventActionState .InputMethod ,
104- title = stringResource(R .string.fix_key_event_action_input_method_title),
105- icon = Icons .Rounded .Keyboard ,
106- ) {
133+ val isExpertModeUnsupported = state.expertModeStatus == ExpertModeStatus .UNSUPPORTED
134+
135+ FixKeyEventActionOptionCard (
136+ onClick = onSelectExpertMode,
137+ selected = state is FixKeyEventActionState .ExpertMode ,
138+ title = stringResource(R .string.expert_mode_app_bar_title),
139+ icon = Icons .Outlined .OfflineBolt ,
140+ enabled = ! isExpertModeUnsupported,
141+ ) {
142+ if (isExpertModeUnsupported) {
143+ Text (
144+ stringResource(R .string.trigger_setup_expert_mode_unsupported),
145+ style = MaterialTheme .typography.bodyMedium,
146+ color = MaterialTheme .colorScheme.error,
147+ )
148+ } else {
107149 val annotatedText = buildAnnotatedString {
108150 appendInlineContent(" icon" , " [icon]" )
109151 append(" " )
110- append(stringResource(R .string.fix_key_event_action_input_method_text))
152+ append(stringResource(R .string.fix_key_event_action_expert_mode_text_1))
153+ appendLine()
154+ appendInlineContent(" icon" , " [icon]" )
155+ append(" " )
156+ append(stringResource(R .string.fix_key_event_action_expert_mode_text_2))
111157 }
112158 val inlineContent = mapOf (
113159 Pair (
@@ -116,13 +162,14 @@ fun FixKeyEventActionBottomSheet(
116162 Placeholder (
117163 width = MaterialTheme .typography.bodyLarge.fontSize,
118164 height = MaterialTheme .typography.bodyLarge.fontSize,
119- placeholderVerticalAlign = PlaceholderVerticalAlign .TextCenter ,
165+ placeholderVerticalAlign =
166+ PlaceholderVerticalAlign .TextCenter ,
120167 ),
121168 ) {
122169 Icon (
123- imageVector = Icons .Rounded .Remove ,
170+ imageVector = Icons .Rounded .Add ,
124171 contentDescription = null ,
125- tint = MaterialTheme .colorScheme.error ,
172+ tint = LocalCustomColorsPalette .current.green ,
126173 )
127174 },
128175 ),
@@ -133,65 +180,13 @@ fun FixKeyEventActionBottomSheet(
133180 style = MaterialTheme .typography.bodyMedium,
134181 )
135182 }
136-
137- val isExpertModeUnsupported = state.expertModeStatus == ExpertModeStatus .UNSUPPORTED
138-
139- FixKeyEventActionOptionCard (
140- onClick = onSelectExpertMode,
141- selected = state is FixKeyEventActionState .ExpertMode ,
142- title = stringResource(R .string.expert_mode_app_bar_title),
143- icon = Icons .Outlined .OfflineBolt ,
144- enabled = ! isExpertModeUnsupported,
145- ) {
146- if (isExpertModeUnsupported) {
147- Text (
148- stringResource(R .string.trigger_setup_expert_mode_unsupported),
149- style = MaterialTheme .typography.bodyMedium,
150- color = MaterialTheme .colorScheme.error,
151- )
152- } else {
153- val annotatedText = buildAnnotatedString {
154- appendInlineContent(" icon" , " [icon]" )
155- append(" " )
156- append(stringResource(R .string.fix_key_event_action_expert_mode_text_1))
157- appendLine()
158- appendInlineContent(" icon" , " [icon]" )
159- append(" " )
160- append(stringResource(R .string.fix_key_event_action_expert_mode_text_2))
161- }
162- val inlineContent = mapOf (
163- Pair (
164- " icon" ,
165- InlineTextContent (
166- Placeholder (
167- width = MaterialTheme .typography.bodyLarge.fontSize,
168- height = MaterialTheme .typography.bodyLarge.fontSize,
169- placeholderVerticalAlign =
170- PlaceholderVerticalAlign .TextCenter ,
171- ),
172- ) {
173- Icon (
174- imageVector = Icons .Rounded .Add ,
175- contentDescription = null ,
176- tint = LocalCustomColorsPalette .current.green,
177- )
178- },
179- ),
180- )
181- Text (
182- annotatedText,
183- inlineContent = inlineContent,
184- style = MaterialTheme .typography.bodyMedium,
185- )
186- }
187- }
188-
189- Text (
190- stringResource(R .string.fix_key_event_action_change_in_settings_caption),
191- style = MaterialTheme .typography.labelMedium,
192- )
193183 }
194184
185+ Text (
186+ stringResource(R .string.fix_key_event_action_change_in_settings_caption),
187+ style = MaterialTheme .typography.labelMedium,
188+ )
189+
195190 HeaderText (text = stringResource(R .string.fix_key_event_action_setup_title))
196191
197192 AccessibilityServiceRequirementRow (
@@ -234,7 +229,10 @@ fun FixKeyEventActionBottomSheet(
234229 }
235230 }
236231
237- Button (modifier = Modifier .align(Alignment .End ), onClick = onDoneClick) {
232+ Button (
233+ modifier = Modifier .align(Alignment .End ),
234+ onClick = onDoneClick,
235+ ) {
238236 Text (stringResource(R .string.pos_done))
239237 }
240238 }
0 commit comments