---
id: "0156"
title: "matrix-client-android composer: markdown, replies, edits, reactions, media"
status: pending
priority: high
created: 2026-05-24
related_flows: ["0011"]
related_issues: ["0155", "0157"]
dependencies: ["0155"]
tags: [matrix, android, compose, composer, markdown, media, voice]
---

## Objetivo

Composer Compose con markdown shortcuts, replies, edits, reactions emoji, threads, upload media (camara nativa, galeria, voice msg con `MediaRecorder` opus). Drag&drop archivos compartidos via share sheet Android.

## Tareas

1. ViewModel:
   - `ComposerViewModel(matrixClient, roomId)` — methods `sendText`, `sendReply`, `editMessage`, `sendReaction`, `uploadMedia`, `recordVoice`.
2. Compose:
   - `Composer` con `OutlinedTextField` + toolbar (markdown shortcuts B/I/code).
   - Hotkeys soft keyboard: Send action en IME.
   - `AttachmentMenu`: botones camara, galeria, file, voice.
   - `EmojiPicker` overlay (reusar libreria existente o componente propio).
   - `ReactionBar` debajo de `EventBubble` con aggregates.
   - `ThreadScreen` — nueva pantalla full para thread (no panel lateral como en PC, por screen real estate movil).
   - Voice recording UI: hold-to-record con waveform preview + cancelar al deslizar.
3. Backend:
   - Upload media: comprimir imagenes si >2MB antes de upload (`androidx.exifinterface` para preservar orientacion).
   - Voice: `MediaRecorder` con OPUS, 32kbps, ogg container.
   - Markdown -> HTML local con `markwon` library (lightweight, no Goldmark equivalente).
4. Share intent:
   - `IntentFilter` para `android.intent.action.SEND` + tipos image/video/text/file -> abre composer del room seleccionado.
5. Tests:
   - Instrumented `SendMarkdownTest` — `**bold**` formateado en Element Web.
   - Instrumented `EditMessageTest` — edicion in-place propagada.
   - Instrumented `VoiceMsgTest` — graba 5s + upload + play en Element Web.

## Funciones del registry a crear

- `markdown_to_matrix_html_kotlin_core` — wrapper markwon con sanitizer.
- `image_compress_kotlin_core` — resize + recompress JPEG.
- `voice_record_kotlin_infra` — MediaRecorder opus wrapper.
- `Composer_kotlin_ui` — Compose composer + toolbar + attachment menu.
- `ReactionBar_kotlin_ui` — composable reactions.
- `ThreadScreen_kotlin_ui` — pantalla thread.

## Acceptance

- [ ] Mensaje markdown se ve formateado en Element Web.
- [ ] Reply con quote del msg padre.
- [ ] Edit in-place propagado en ambos clientes.
- [ ] Reaccion emoji bidireccional.
- [ ] Upload imagen 5MB -> compresion a ~1MB -> envio + thumbnail OK.
- [ ] Voice msg 5s reproducible en Element Web.
- [ ] Share intent desde galeria abre composer con imagen pre-cargada.

## Notas

- Sanitizer HTML server-side delegado a matrix-rust-sdk (mismo allowlist que cliente PC).
- Voice msg: encode opus 32kbps, max 5min.
- Markwon vs goldmark: ambos cumplen el rol equivalente en su stack. Salida HTML compatible Matrix.
- Drag&drop: en Android = share sheet o picker, no drag&drop nativo como en PC.
