Summary: Ctors | Methods | Inherited Methods | [Expand All]
public class

# MiniControllerFragment

extends Fragment
implements ControlButtonsContainer

java.lang.Object
↳ | android.support.v4.app.Fragment
| ↳ | com.google.android.gms.cast.framework.media.widget.MiniControllerFragment

## Class Overview

A fragment that provides remote control functionality. This fragment provides an image for the album art, a `ProgressBar` for playback progression, and three configurable control buttons. If developers want to use this fragment, they should add it to their layout XML file, and the `CastContext` will automatically manage its state, and handle any user interactions.

     <fragment
         android:id="@+id/cast_mini_controller"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:layout_alignParentBottom="true"
         android:visibility="gone"
         class="com.google.android.gms.cast.framework.media.widget.MiniControllerFragment">

The fragment can show up to three control buttons, from left to right. By default the fragment shows a play/pause toggle button. Developers can use the attribute `castControlButtons` to override what buttons to show. The list of supported control buttons are defined as ID resources:

`@id/cast_button_type_empty`: Not placing a button in this slot.
`@id/cast_button_type_custom`: A custom button.
`@id/cast_button_type_play_pause_toggle`: A button that toggles playback.
`@id/cast_button_type_skip_previous`: A button that skips to the previous item in the queue.
`@id/cast_button_type_skip_next`: A button that skips to the next item in the queue.
`@id/cast_button_type_rewind_30_seconds`: A button that rewinds the playback by 30 seconds.
`@id/cast_button_type_forward_30_seconds`: A button that skips forward the playback by 30 seconds.
`@id/cast_button_type_mute_toggle`: A button that mutes and unmutes the remote receiver.
`@id/cast_button_type_closed_caption`: A button that opens a dialog to select text and audio tracks.

Here is an example of showing a rewind button, a play/pause toggle button and a forward button, from left to right:

     <array name="cast_mini_controller_control_buttons">
         <item>@id/cast_button_type_rewind_30_seconds</item>
         <item>@id/cast_button_type_play_pause_toggle</item>
         <item>@id/cast_button_type_forward_30_seconds</item>
     </array>
     ...
     <fragment
         android:id="@+id/cast_mini_controller"
         ...
         app:castControlButtons="@array/cast_mini_controller_control_buttons"
         class="com.google.android.gms.cast.framework.media.widget.MiniControllerFragment">

The array must contain exactly three items, otherwise a runtime exception will be thrown. If you don't want to show a button in a slot, use `@id/cast_button_type_empty`.

The album art can be hidden by setting attribute `castShowImageThumbnail` to `false`:

     ...
     app:castShowImageThumbnail="false"
     ...

If the album art is shown, then the first control button will not be displayed.

The fragment will be visible when a media session starts, and will be invisible when a media session ends.

## Summary

Public Constructors
| MiniControllerFragment()

Public Methods
final ImageView | getButtonImageViewAt(int slotIndex) Returns the `ImageView` of the button at `slotIndex` in this container.
final int | getButtonSlotCount() Returns the number of slots to hold control buttons in this container.
final int | getButtonTypeAt(int slotIndex) Returns the type of the button at `slotIndex` in this container.
UIMediaController | getUIMediaController() Returns the `UIMediaController` used to bind views in this container.
View | onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
void | onDestroy()
void | onInflate(Context context, AttributeSet attrs, Bundle savedInstanceState)

[Expand] Inherited Methods
From class android.support.v4.app.Fragment
void | dump(String arg0, FileDescriptor arg1, PrintWriter arg2, String[] arg3)
final boolean | equals(Object arg0)
final FragmentActivity | getActivity()
boolean | getAllowEnterTransitionOverlap()
boolean | getAllowReturnTransitionOverlap()
final Bundle | getArguments()
final FragmentManager | getChildFragmentManager()
Context | getContext()
Object | getEnterTransition()
Object | getExitTransition()
final FragmentManager | getFragmentManager()
final Object | getHost()
final int | getId()
LayoutInflater | getLayoutInflater(Bundle arg0)
LoaderManager | getLoaderManager()
final Fragment | getParentFragment()
Object | getReenterTransition()
final Resources | getResources()
final boolean | getRetainInstance()
Object | getReturnTransition()
Object | getSharedElementEnterTransition()
Object | getSharedElementReturnTransition()
final String | getString(int arg0, Object... arg1)
final String | getString(int arg0)
final String | getTag()
final Fragment | getTargetFragment()
final int | getTargetRequestCode()
final CharSequence | getText(int arg0)
boolean | getUserVisibleHint()
View | getView()
final boolean | hasOptionsMenu()
final int | hashCode()
static Fragment | instantiate(Context arg0, String arg1)
static Fragment | instantiate(Context arg0, String arg1, Bundle arg2)
final boolean | isAdded()
final boolean | isDetached()
final boolean | isHidden()
final boolean | isInLayout()
final boolean | isMenuVisible()
final boolean | isRemoving()
final boolean | isResumed()
final boolean | isVisible()
void | onActivityCreated(Bundle arg0)
void | onActivityResult(int arg0, int arg1, Intent arg2)
void | onAttach(Activity arg0)
void | onAttach(Context arg0)
void | onConfigurationChanged(Configuration arg0)
boolean | onContextItemSelected(MenuItem arg0)
void | onCreate(Bundle arg0)
Animation | onCreateAnimation(int arg0, boolean arg1, int arg2)
void | onCreateContextMenu(ContextMenu arg0, View arg1, ContextMenu.ContextMenuInfo arg2)
void | onCreateOptionsMenu(Menu arg0, MenuInflater arg1)
View | onCreateView(LayoutInflater arg0, ViewGroup arg1, Bundle arg2)
void | onDestroy()
void | onDestroyOptionsMenu()
void | onDestroyView()
void | onDetach()
void | onHiddenChanged(boolean arg0)
void | onInflate(Activity arg0, AttributeSet arg1, Bundle arg2)
void | onInflate(Context arg0, AttributeSet arg1, Bundle arg2)
void | onLowMemory()
boolean | onOptionsItemSelected(MenuItem arg0)
void | onOptionsMenuClosed(Menu arg0)
void | onPause()
void | onPrepareOptionsMenu(Menu arg0)
void | onRequestPermissionsResult(int arg0, String[] arg1, int[] arg2)
void | onResume()
void | onSaveInstanceState(Bundle arg0)
void | onStart()
void | onStop()
void | onViewCreated(View arg0, Bundle arg1)
void | onViewStateRestored(Bundle arg0)
void | registerForContextMenu(View arg0)
final void | requestPermissions(String[] arg0, int arg1)
void | setAllowEnterTransitionOverlap(boolean arg0)
void | setAllowReturnTransitionOverlap(boolean arg0)
void | setArguments(Bundle arg0)
void | setEnterSharedElementCallback(SharedElementCallback arg0)
void | setEnterTransition(Object arg0)
void | setExitSharedElementCallback(SharedElementCallback arg0)
void | setExitTransition(Object arg0)
void | setHasOptionsMenu(boolean arg0)
void | setInitialSavedState(Fragment.SavedState arg0)
void | setMenuVisibility(boolean arg0)
void | setReenterTransition(Object arg0)
void | setRetainInstance(boolean arg0)
void | setReturnTransition(Object arg0)
void | setSharedElementEnterTransition(Object arg0)
void | setSharedElementReturnTransition(Object arg0)
void | setTargetFragment(Fragment arg0, int arg1)
void | setUserVisibleHint(boolean arg0)
boolean | shouldShowRequestPermissionRationale(String arg0)
void | startActivity(Intent arg0)
void | startActivity(Intent arg0, Bundle arg1)
void | startActivityForResult(Intent arg0, int arg1)
void | startActivityForResult(Intent arg0, int arg1, Bundle arg2)
String | toString()
void | unregisterForContextMenu(View arg0)
From class java.lang.Object
Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)
final void | wait()
From interface android.content.ComponentCallbacks
abstract void | onConfigurationChanged(Configuration arg0)
abstract void | onLowMemory()
From interface android.view.View.OnCreateContextMenuListener
abstract void | onCreateContextMenu(ContextMenu arg0, View arg1, ContextMenu.ContextMenuInfo arg2)
From interface com.google.android.gms.cast.framework.media.widget.ControlButtonsContainer
abstract ImageView | getButtonImageViewAt(int slotIndex) Returns the `ImageView` of the button at `slotIndex` in this container.
abstract int | getButtonSlotCount() Returns the number of slots to hold control buttons in this container.
abstract int | getButtonTypeAt(int slotIndex) Returns the type of the button at `slotIndex` in this container.
abstract UIMediaController | getUIMediaController() Returns the `UIMediaController` used to bind views in this container.

## Public Constructors

#### public MiniControllerFragment ()

## Public Methods

#### public final ImageView getButtonImageViewAt (int slotIndex)

Returns the `ImageView` of the button at `slotIndex` in this container. The `ImageView` is defined in the layout of the `Activity` which implements this interface.

##### Parameters

slotIndex | the index of the slot in this container.

##### Throws

IndexOutOfBoundsException |

#### public final int getButtonSlotCount ()

Returns the number of slots to hold control buttons in this container.

#### public final int getButtonTypeAt (int slotIndex)

Returns the type of the button at `slotIndex` in this container.

Button types are defined as one of the ID resources:

- `@id/cast_button_type_empty`: Not placing a button in this slot.
- `@id/cast_button_type_custom`: A custom button.
- `@id/cast_button_type_play_pause_toggle`: A button that toggles playback.
- `@id/cast_button_type_skip_previous`: A button that skips to the previous item in the queue.
- `@id/cast_button_type_skip_next`: A button that skips to the next item in the queue.
- `@id/cast_button_type_rewind_30_seconds`: A button that rewinds the playback by 30 seconds.
- `@id/cast_button_type_forward_30_seconds`: A button that skips forward the playback by 30 seconds.
- `@id/cast_button_type_mute_toggle`: A button that mutes and unmutes the remote receiver.
- `@id/cast_button_type_closed_caption`: A button that opens a dialog to select text and audio tracks.

##### Parameters

slotIndex | the index of the slot in this container.

##### Throws

IndexOutOfBoundsException |

#### public UIMediaController getUIMediaController ()

Returns the `UIMediaController` used to bind views in this container.

#### public View onCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)

#### public void onDestroy ()

#### public void onInflate (Context context, AttributeSet attrs, Bundle savedInstanceState)