tubi_tv_fwd_15_selector.xml


Overview

`tubi_tv_fwd_15_selector.xml` is an **Android drawable selector resource file** used to define different visual states for a UI component, specifically for a "forward 15 seconds" button in the Tubi TV application. The file determines which drawable image (icon) to display based on the button's pressed state, enhancing user experience by providing visual feedback upon interaction.


Purpose and Functionality

In Android UI development, selector XML files are a standard way to specify various images or colors for different states of a widget, such as pressed, focused, or default. This selector:

By doing this, the app visually indicates the button's state, making the interface intuitive and responsive.


Structure and Contents

The file uses the [](/projects/288/68408) tag as the root element, containing multiple `` elements, each representing a drawable resource linked to a particular state:

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

Explanation of each <item>:

Item

Attributes

Role

1st ``

`android:drawable="@drawable/tubi_tv_fwd_15"`, `android:state_pressed="false"`

Drawable for the **unpressed** state of the button. When the button is not pressed, this icon is shown.

2nd ``

`android:drawable="@drawable/tubi_tv_fwd_15_pressed"`, `android:state_pressed="true"`

Drawable for the **pressed** state of the button. When the user taps the button, this icon indicates the pressed state.

3rd ``

`android:drawable="@drawable/tubi_tv_fwd_15"`

The **default drawable** used if no state conditions match. Acts as fallback, here same as unpressed state.


Important Implementation Details


Usage Example

This selector is typically referenced in a layout XML or programmatically to set the button icon:

<ImageButton
    android:id="@+id/forward_15_button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:src="@drawable/tubi_tv_fwd_15_selector"
    android:contentDescription="@string/forward_15_seconds" />

In this example:


Interaction with Other System Components


Visual Diagram

Below is a flowchart representing the **state evaluation workflow** of the selector file:

flowchart TD
    A[Button State Change] --> B{Is Button Pressed?}
    B -- Yes --> C[Show drawable: tubi_tv_fwd_15_pressed]
    B -- No --> D[Show drawable: tubi_tv_fwd_15]
    C --> E[Render Button]
    D --> E

**Diagram Explanation:**


Summary

This file is a small but essential part of the Tubi TV app's UI layer, improving usability and visual consistency for media playback controls.