tubi_tv_drawable_subtitles_off_selector.xml


Overview

`tubi_tv_drawable_subtitles_off_selector.xml` is an Android **drawable selector resource** file that defines a state-dependent image for a UI component, specifically for a "subtitles off" button or icon within the Tubi TV application. Its primary purpose is to specify different drawable resources to display based on the button's interaction state (e.g., pressed or not pressed). This enhances user experience by providing visual feedback when interacting with the subtitles toggle control.


Detailed Explanation

File Type and Location

XML Structure

<selector xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@drawable/tubi_tv_subtitles_off" android:state_pressed="false"></item>
    <item android:drawable="@drawable/tubi_tv_subtitles_off_faded" android:state_pressed="true"></item>
    <!-- default -->
    <item android:drawable="@drawable/tubi_tv_subtitles_off" />
</selector>

Elements:


States and Drawable Mapping

State Condition

Drawable Resource

Description

`android:state_pressed="false"`

`@drawable/tubi_tv_subtitles_off`

Default appearance when the button is not pressed

`android:state_pressed="true"`

`@drawable/tubi_tv_subtitles_off_faded`

Appearance when the button is pressed (touched)

(No state specified)

`@drawable/tubi_tv_subtitles_off`

Fallback/default drawable for any other state


Usage

This selector file can be used as the `android:background` or `android:src` attribute for a Button, ImageButton, or ImageView in layout XML or programmatically. When the user presses the button, the drawable switches to a faded version to indicate interaction.

**Example usage in a layout XML:**

<ImageButton
    android:id="@+id/subtitles_off_button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/tubi_tv_drawable_subtitles_off_selector"
    android:contentDescription="@string/subtitles_off_description" />

Important Implementation Details


Interaction with the System / Application


Visual Diagram

flowchart TD
    A[UI Component<br/>(Button/ImageButton)] -->|Uses| B[tubi_tv_drawable_subtitles_off_selector.xml]
    B --> C[tubi_tv_subtitles_off<br/>(Drawable Resource)]
    B --> D[tubi_tv_subtitles_off_faded<br/>(Drawable Resource)]

    subgraph State Handling
        direction LR
        S1[Pressed = false] -->|Shows| C
        S2[Pressed = true] -->|Shows| D
        S3[Default] -->|Shows| C
    end

Summary


*End of documentation for* `tubi_tv_drawable_subtitles_off_selector.xml`