1 package com.android.car.media.common; 2 3 import android.view.ViewGroup; 4 5 /** 6 * Custom view that can be used to display playback controls. It accepts a {@link PlaybackModel} 7 * as its data source, automatically reacting to changes in playback state. 8 */ 9 public interface PlaybackControls { 10 /** 11 * Sets the {@link PlaybackModel} to use as the view model for this view. 12 */ setModel(PlaybackModel model)13 void setModel(PlaybackModel model); 14 15 /** 16 * Collapses the playback controls if they were expanded. 17 */ close()18 void close(); 19 20 /** 21 * Defines the root {@link ViewGroup} used to animate the expand/collapse layout transitions. 22 * If this method is not used, only this view will be animated. 23 * If other elements of the screen have a layout relative to this view, their container 24 * layout should be passed to this method. 25 */ setAnimationViewGroup(ViewGroup animationViewGroup)26 void setAnimationViewGroup(ViewGroup animationViewGroup); 27 28 /** 29 * Sets whether the media queue is currently visible or not 30 */ setQueueVisible(boolean visible)31 void setQueueVisible(boolean visible); 32 33 /** 34 * Sets a listener for playback control events. Consumers of this method must remember to 35 * invoke it with null to avoid memory leaks. 36 */ setListener(Listener listener)37 void setListener(Listener listener); 38 39 /** 40 * Listener for this playback controls 41 */ 42 interface Listener { 43 /** 44 * Method invoked when the user requests to hide/show the media queue. 45 */ onToggleQueue()46 void onToggleQueue(); 47 } 48 }