Skip to content

Commit 2bc5c3c

Browse files
Update accessibility dialog text and button functionality
- Changed the descriptive text in the accessibility info card. - Added a 'Don't activate and close' button to the card, which closes the app. - Modified the Send button: when accessibility is off, it now shows a toast message 'The Accessibility Service is not activated' instead of opening settings.
1 parent b50bfea commit 2bc5c3c

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

app/src/main/kotlin/com/google/ai/sample/feature/multimodal/PhotoReasoningScreen.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -350,12 +350,16 @@ fun PhotoReasoningScreen(
350350
Column(modifier = Modifier.padding(16.dp)) {
351351
Text("Accessibility Service is not enabled", color = MaterialTheme.colorScheme.error, style = MaterialTheme.typography.titleMedium)
352352
Spacer(modifier = Modifier.height(8.dp))
353-
Text("The click functionality requires the Accessibility Service. Please enable it in the settings.", color = MaterialTheme.colorScheme.error)
353+
Text("In order for a vision LLM to be able to operate the screen (click, scroll) using this app, the Accessibility service authorization is required, which must be activated in the settings.", color = MaterialTheme.colorScheme.error)
354354
Spacer(modifier = Modifier.height(8.dp))
355355
TextButton(onClick = {
356356
onEnableAccessibilityService()
357357
Toast.makeText(context, "Open Accessibility Settings..." as CharSequence, Toast.LENGTH_SHORT).show()
358358
}) { Text("Activate Accessibility Service") }
359+
TextButton(onClick = {
360+
val activity = context as? Activity
361+
activity?.finish()
362+
}) { Text("Don't activate and close") }
359363
}
360364
}
361365
}
@@ -441,8 +445,8 @@ fun PhotoReasoningScreen(
441445
// If accessibility is ON but userQuestion is BLANK, no action is needed here as the button's enabled state and tint convey this.
442446
} else {
443447
// Accessibility is OFF
444-
onEnableAccessibilityService()
445-
Toast.makeText(context, "Enable the Accessibility service for Screen Operator", Toast.LENGTH_LONG).show()
448+
// onEnableAccessibilityService()
449+
Toast.makeText(context, "The Accessibility Service is not activated", Toast.LENGTH_LONG).show()
446450
} // Closes the else block
447451
},
448452
enabled = isInitialized && ((isAccessibilityServiceEnabled && userQuestion.isNotBlank()) || !isAccessibilityServiceEnabled),

0 commit comments

Comments
 (0)