The previous AccessibilityDelegateCompat approach had two fatal flaws:
1. The delegate was only set when isTouchExplorationEnabled() returned
true AT BIND TIME — a timing bug that caused TalkBack to see no
actions if the view was bound before TalkBack fully initialised.
2. Even when set, the delegate/custom-action-ID approach did not
reliably produce an "Actions" submenu in the TalkBack local context
menu on Android 14+.
Replace the entire mechanism with ViewCompat.addAccessibilityAction(),
the modern API (androidx.core 1.5.0+) that TalkBack always surfaces
under "Actions". Actions are registered unconditionally at bind time;
stale actions from recycled views are removed via
ViewCompat.removeAccessibilityAction() before re-registration.
Delete the now-unused LinkAccessibilityDelegate class.
Agent-Logs-Url: https://github.com/ArcaneChat/android/sessions/95854760-c8e5-43d8-b7b4-55879a7c5dea
Co-authored-by: adbenitez <24558636+adbenitez@users.noreply.github.com>
The previous code used View.AccessibilityDelegate (raw framework) and
AccessibilityNodeInfoCompat.wrap() which is deprecated and does not
reliably propagate addAction() to the real AccessibilityNodeInfo that
TalkBack reads.
Switch to AccessibilityDelegateCompat (AndroidX) set via
ViewCompat.setAccessibilityDelegate(). Its onInitializeAccessibilityNodeInfo
callback receives a properly-backed AccessibilityNodeInfoCompat so
info.addAction() reliably surfaces custom actions in the TalkBack
context menu (L-gesture) on all Android versions including API 36.
Also clear the delegate in the CALL/empty-text branch to prevent a
stale delegate remaining on a recycled view.
Agent-Logs-Url: https://github.com/ArcaneChat/android/sessions/87aa7735-a87e-473d-b80c-67e697cd4fa7
Co-authored-by: adbenitez <24558636+adbenitez@users.noreply.github.com>
- Explain why accessibility delegate is not set during batch selection
- Explain why map is cleared and rebuilt on each accessibility update
- Improves code maintainability and readability
Co-authored-by: adbenitez <24558636+adbenitez@users.noreply.github.com>
- Reuse LinkAccessibilityDelegate instance instead of creating new one each time
- Add detailed comment explaining the magic number for action IDs
- Improves performance by avoiding unnecessary object allocations
Co-authored-by: adbenitez <24558636+adbenitez@users.noreply.github.com>
- Added accessibility_link_action string resource
- Updated LinkAccessibilityDelegate to accept Context and use resource
- Updated ConversationItem to pass context to delegate
Co-authored-by: adbenitez <24558636+adbenitez@users.noreply.github.com>
- Created LinkAccessibilityDelegate to expose links as custom actions
- Updated ConversationItem to use delegate when TalkBack is enabled
- Each link becomes a separate accessible action with clear label
Co-authored-by: adbenitez <24558636+adbenitez@users.noreply.github.com>