Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I change the repeat mode icon? #6779

Closed
xuanthebui opened this issue Dec 18, 2019 · 4 comments
Closed

How can I change the repeat mode icon? #6779

xuanthebui opened this issue Dec 18, 2019 · 4 comments
Assignees
Labels

Comments

@xuanthebui
Copy link

    <ImageButton
        android:id="@id/exo_repeat_toggle"
        style="@style/ExoMediaButton"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/ic_replay_24px" />

Please help me!!!

@xuanthebui xuanthebui changed the title Can not change icon repeat_mode_toggle. He;p me Can not change icon repeat_mode_toggle. Help me Dec 18, 2019
@Samrobbo Samrobbo changed the title Can not change icon repeat_mode_toggle. Help me repeat_mode_toggle icon can not be changed. Dec 18, 2019
@Samrobbo Samrobbo self-assigned this Dec 18, 2019
@Samrobbo
Copy link
Contributor

Hi, the exoplayer.dev UI components section provides some guidance on this.

@xuanthebui
Copy link
Author

@Samrobbo Thanks.
next and previous changed,, but repeat_mode_toggle not change. ;((

@Samrobbo
Copy link
Contributor

@ojw28 What are your thoughts?

@ojw28
Copy link
Contributor

ojw28 commented Dec 19, 2019

If you just want to change the icons without modifying the layout, then you can do so directly. The list of icon drawables that you can override can be found here:

https://github.com/google/ExoPlayer/blob/r2.11.0/library/ui/src/main/res/values/drawables.xml.

So, for example, if you want to replace the play icon with your own custom_play_icon drawable, you could specify the following in your application's drawables.xml:

<drawable name="exo_controls_play">@drawable/custom_play_icon</drawable>

For the repeat mode there are actually three icons you need to override (see the list). Note also that for the repeat mode the icons can only be overridden from ExoPlayer 2.11.0, since we fixed this recently (#6709).

If you want to change both the icons and the layout then for the repeat mode you'll need to override both together. This is because the PlayerControlView updates the icon on the ImageButton programmatically to be one of the three available icons, depending on the current player state.

@ojw28 ojw28 changed the title repeat_mode_toggle icon can not be changed. How can I change the repeat mode icon? Dec 19, 2019
@ojw28 ojw28 closed this as completed Dec 22, 2019
ojw28 added a commit that referenced this issue Jan 2, 2020
ojw28 added a commit that referenced this issue Jan 17, 2020
@google google locked and limited conversation to collaborators Feb 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants