view_tubi_player_controller_subtitles_btn.xml


Overview

`view_tubi_player_controller_subtitles_btn.xml` is an Android drawable selector XML file used to define the visual states of the subtitles toggle button in the Tubi Player Controller UI. This file manages how the subtitles button's icon changes depending on whether subtitles are enabled or disabled by the user.

Specifically, it switches between two drawable resources:

This approach provides visual feedback to users, making it clear whether subtitles are currently active during video playback.


Detailed Explanation

File Type

This type of XML file is used for defining different drawable resources to be used under different states of a UI component, generally for buttons or toggles.

Structure and Elements

Items in this selector

XML Element

Description

Drawable shown when the subtitles button is in the "checked" (enabled) state.

Drawable shown when the subtitles button is in the "unchecked" (disabled) state.


Usage Example

This selector is typically used as the `android:background` or `android:src` attribute of a `ToggleButton`, `CheckBox`, or `ImageButton` in a layout XML that controls subtitles toggling.

Example usage in a layout XML:

<ImageButton
    android:id="@+id/subtitles_button"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@drawable/view_tubi_player_controller_subtitles_btn"
    android:checkable="true"
    android:contentDescription="@string/subtitles_toggle" />

In the Tubi player controller, when the user toggles subtitles:


Important Implementation Details


Interaction with Other Components


Visual Diagram

The following Mermaid diagram represents the relationship between the selector and its drawable states:

classDiagram
    class view_tubi_player_controller_subtitles_btn {
        <<selector>>
        +state_checked: true -> tubi_tv_subtitles_on (drawable)
        +state_checked: false -> tubi_tv_subtitles_off (drawable)
    }
    view_tubi_player_controller_subtitles_btn --> tubi_tv_subtitles_on : uses
    view_tubi_player_controller_subtitles_btn --> tubi_tv_subtitles_off : uses

Summary

This resource is a small but crucial part of the Tubi player UI, ensuring intuitive interaction with subtitle controls.