tubi_tv_drawable_subtitles_on_selector_tv.xml


Overview

This XML file defines a **state list drawable** resource used in the Tubi TV Android application. It controls how a subtitles-on icon appears on a TV interface when the user interacts with the UI element that toggles subtitles. Specifically, it switches the drawable image shown based on the element's interaction state: pressed, focused, or default (unfocused).

This file helps provide visual feedback to the user by changing the subtitle icon's appearance depending on interaction context, enhancing usability and accessibility on TV devices where keyboard or remote navigation is common.


Detailed Explanation

Purpose


XML Structure and Elements

This file uses a [](/projects/288/68408) element as the root, which acts as a container for multiple `` elements. Each `` specifies a drawable resource to use when its associated state conditions are met.

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/tubi_tv_subtitles_on_faded" android:state_pressed="true"></item>
    <item android:drawable="@drawable/tubi_tv_subtitles_on" android:state_focused="true"></item>
    <item android:drawable="@drawable/tubi_tv_subtitles_on_faded" android:state_focused="false"></item>
</selector>

Explanation of <item> attributes:


State Matching Logic


Usage Example

This drawable selector can be applied to a UI component in XML like this:

<ImageView
    android:id="@+id/subtitles_toggle"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/tubi_tv_drawable_subtitles_on_selector_tv"
    android:focusable="true"
    android:clickable="true" />

Implementation Details


Interaction with Other System Components


Mermaid Diagram: Component Diagram of State Drawable Selector

componentDiagram
    component "tubi_tv_drawable_subtitles_on_selector_tv.xml" {
        [State Selector]
        [Drawable: tubi_tv_subtitles_on_faded]
        [Drawable: tubi_tv_subtitles_on]
    }

    component "Subtitles Toggle UI Component" {
        [ImageView or Button]
    }

    [Subtitles Toggle UI Component] --> [State Selector] : uses drawable selector
    [State Selector] --> [Drawable: tubi_tv_subtitles_on_faded] : pressed, unfocused states
    [State Selector] --> [Drawable: tubi_tv_subtitles_on] : focused state

Summary

This XML file is a simple yet crucial part of the Tubi TV app’s UI system, ensuring that users can clearly identify when subtitles are enabled and what state the toggle button is in, using consistent visual cues.