Android coding: using Jetpack Compose, build a UI similar to the Google Translate app home page
Asked in the phone screen (Android coding) stage. Compose UI coding round.
For grading, implement the pure state-building logic that feeds the Compose screen. Given available languages, selected languages, and recent translations, return a render model containing the language bar, swap availability, input area, and recent items. Preserve language order and do not mutate inputs.
Function: build_translate_home_state(languages, source, target, recent)
languages is a non-empty list of strings, source and target are language names, and recent is a list of objects with source_text, translated_text, source, and target. Return a dictionary with keys languages, source, target, can_swap, input_text, and recent.
def build_translate_home_state(languages, source, target, recent):