tubi_tv_drawable_play_selector.xml


Overview

The `tubi_tv_drawable_play_selector.xml` file is an Android **drawable selector resource** used to define different visual states for a play button within the Tubi TV application. It specifies which drawable image to display based on the button's interaction state (e.g., pressed or not pressed). This file enables a seamless user experience by visually indicating when the play button is pressed, improving user feedback and interactivity.


Detailed Explanation

Purpose and Functionality

XML Structure and Elements

Element

<item> Elements

Each `` specifies:

In this file:

Item

Drawable Resource

State Condition

Description

1

`@drawable/tubi_tv_play_large`

android:state_pressed="false"

Play button in default (not pressed) state

2

`@drawable/tubi_tv_play_large_pressed`

android:state_pressed="true"

Play button in pressed state

3

`@drawable/tubi_tv_play_large`

(default - no state specified)

Fallback drawable for any other state


Usage

This drawable selector is typically applied as the background or source image of a play button UI component, such as:

<Button
    android:id="@+id/play_button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/tubi_tv_drawable_play_selector" />

Or for an `ImageButton` or `ImageView`:

<ImageButton
    android:id="@+id/play_button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/tubi_tv_drawable_play_selector"
    android:background="@null" />

When the user presses the button, Android automatically changes the drawable displayed based on the defined states.


Important Implementation Details


Interaction with the System


Visual Diagram: Component Interaction

The following Mermaid component diagram illustrates the relationship between the selector file, drawable resources, and the UI component that uses it.

componentDiagram
    component "tubi_tv_drawable_play_selector.xml" as Selector
    component "tubi_tv_play_large.png" as DrawableDefault
    component "tubi_tv_play_large_pressed.png" as DrawablePressed
    component "Play Button UI Component" as PlayButton

    Selector --> DrawableDefault : references
    Selector --> DrawablePressed : references
    PlayButton --> Selector : uses as background/src

Summary

This lightweight yet essential resource supports polished UI behavior consistent with Android design best practices.