tubi_tv_drawable_pause_selector_tv.xml
Overview
`tubi_tv_drawable_pause_selector_tv.xml` is an Android **drawable selector resource file** designed to define the visual state changes of a UI element in the Tubi TV application, likely a pause/play control button optimized for TV devices. This XML file associates different drawable resources (images or drawable selectors) with specific UI states such as pressed and focused states, enabling dynamic visual feedback to the user when interacting with playback controls via a remote or other input devices.
By specifying these drawable states, the file helps improve user experience on TV platforms by ensuring the UI responds visually to user focus and interaction, which is critical for non-touch navigation.
Detailed Explanation
XML Structure and Attributes
Root element:
<selector>Defines a state list drawable resource that changes the displayed drawable based on the state of the view.
Namespace:
xmlns:android="http://schemas.android.com/apk/res/android"Standard Android XML namespace.
Child Elements: <item>
Each `` defines a drawable resource and optionally associates it with one or more view states.
Attribute | Description | Value in this file |
|---|---|---|
`android:drawable` | The drawable resource to show when the state(s) match. | References to drawable resources (`@drawable/...`) |
True if the view is currently pressed (clicked). | `true` for first item | |
True or false if the view is (or is not) currently focused. | `true` for second item, `false` for third item |
Items in this selector
Item No. | State(s) | Drawable Resource | Description |
|---|---|---|---|
1 | Shows when the button is pressed (actively clicked). | ||
2 | `@drawable/tubi_tv_pause_large` | Shows when the button has focus (e.g., highlighted by TV remote). | |
3 | Default state when button is not focused. |
Usage Example
This selector is typically referenced in a layout XML or programmatically assigned as the **background** or **source drawable** of an ImageView or Button representing the playback control on TV.
<ImageView
android:id="@+id/play_pause_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/tubi_tv_drawable_pause_selector_tv"
android:focusable="true"
android:clickable="true"/>
When the user navigates to this button using a remote control, the UI will:
Display a large pause icon when focused.
Show a play selector icon when pressed or unfocused.
Important Implementation Details
State Priority: Android evaluates
<item>elements in order. The first matching state is used. Here:Pressed state has the highest priority.
Then focus state.
Then default state.
Drawable References: The file references other drawable resources:
tubi_tv_play_selector(likely another selector handling play button states)tubi_tv_pause_large(probably a static image representing pause in a large size)
Focus and Pressed States: These states are crucial for TV UIs where navigation is via remote controls rather than touch. They provide visual cues to indicate which control is active or being interacted with.
Interaction with Other Parts of the System
UI Layer: This drawable selector is part of the UI presentation layer, specifically controlling visual feedback for playback controls.
Drawable Resources: Relies on other drawable files (
tubi_tv_play_selector,tubi_tv_pause_large) which define the actual images or animations.Playback Controls: Used by playback control components (buttons or image views) in activity or fragment layouts related to video playback.
Focus Handling: Works in conjunction with Android's focus management system on TV platforms, enabling smooth navigation and highlighting.
Visual Diagram: Component Interaction
componentDiagram
component "Playback Control UI Element\n(ImageView/Button)" as PlaybackControl
component "tubi_tv_drawable_pause_selector_tv.xml\n(State List Drawable)" as DrawableSelector
component "tubi_tv_play_selector\n(Drawable Selector)" as PlaySelector
component "tubi_tv_pause_large\n(Static Drawable)" as PauseDrawable
PlaybackControl --> DrawableSelector : uses as src/background
DrawableSelector --> PlaySelector : references drawable
DrawableSelector --> PauseDrawable : references drawable
note right of PlaybackControl
Handles user interaction (focus, press)
Displays visual feedback based on state
end
Summary
`tubi_tv_drawable_pause_selector_tv.xml` is a simple yet essential Android drawable selector resource enabling dynamic visual feedback for playback controls on TV devices. It manages different drawable states for pressed and focused UI conditions, enhancing user navigation experience by tying UI states to appropriate icons (play or pause). This file is part of a broader drawable resource system and integrates tightly with the TV UI components for media playback control.
If you need additional details on the referenced drawable files or how this integrates with the playback logic code, those would be covered in their respective documentation files.