From 7529f2b05a5d856c2e9e30fcaae5bbce581264c8 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Sun, 7 Jun 2026 20:42:32 +0000 Subject: [PATCH] feat: Set initial content description for dynamic TextView Interactive elements with dynamic text and secondary actions must have their full actionable `contentDescription` set during initialization for their placeholder state to provide context to screen readers before the first data update. This commit initializes the content description for the IP address TextView before the asynchronous fetch completes. Co-authored-by: manupawickramasinghe <73810867+manupawickramasinghe@users.noreply.github.com> --- .Jules/palette.md | 4 ++++ .../com/samsung/android/scan3d/fragments/CameraFragment.kt | 3 +++ 2 files changed, 7 insertions(+) diff --git a/.Jules/palette.md b/.Jules/palette.md index dd03210..7d18199 100644 --- a/.Jules/palette.md +++ b/.Jules/palette.md @@ -150,3 +150,7 @@ ## 2026-05-30 - User-Facing System Notifications **Learning:** Foreground service notifications and channels are exposed directly to users within their system drawer and app settings. Hardcoding technical or aggressive terminology (e.g., naming a channel ID as the visible name or using "Kill" as an action button) degrades the user experience and violates UX standards. Furthermore, failing to extract these strings to `strings.xml` prevents localization and accessibility optimizations. **Action:** Always avoid hardcoded, technical, or aggressive terminology in user-facing system notifications and foreground service controls. Utilize standard mobile UX phrasing (e.g., "Stop", "Tap") and ensure all notification text (titles, descriptions, actions) is extracted to localized string resources. + +## 2026-05-31 - Initial Content Descriptions for Secondary Actions +**Learning:** Interactive elements with dynamic text that also perform a secondary action (e.g., an IP address `TextView` that copies its text to the clipboard when clicked) must have their actionable `contentDescription` set immediately upon view creation. If the content description is only assigned dynamically *after* an asynchronous data fetch completes, screen readers will incorrectly announce the raw placeholder text (e.g., "0.0.0.0:8080/cam.mjpeg") without any interaction context if the user focuses the view before the fetch finishes. +**Action:** Always programmatically set the initial, actionable `contentDescription` (e.g., combining the default placeholder text with the action tooltip) during view initialization (like in `onCreateView` or `onViewCreated`) to ensure interaction context is available before the first dynamic update occurs. diff --git a/app/src/main/java/com/samsung/android/scan3d/fragments/CameraFragment.kt b/app/src/main/java/com/samsung/android/scan3d/fragments/CameraFragment.kt index 8f8bfc9..5a3fb7f 100644 --- a/app/src/main/java/com/samsung/android/scan3d/fragments/CameraFragment.kt +++ b/app/src/main/java/com/samsung/android/scan3d/fragments/CameraFragment.kt @@ -85,6 +85,9 @@ class CameraFragment : Fragment() { ): View { _fragmentCameraBinding = FragmentCameraBinding.inflate(inflater, container, false) + val defaultIpText = getString(R.string.default_ip) + _fragmentCameraBinding?.textView6?.contentDescription = getString(R.string.actionable_content_description_format, defaultIpText, getString(R.string.copy_ip_tooltip)) + // Get the local ip address viewLifecycleOwner.lifecycleScope.launch { val localIp = IpUtil.getLocalIpAddress()