Example usage for android.view View setSoundEffectsEnabled

List of usage examples for android.view View setSoundEffectsEnabled

Introduction

In this page you can find the example usage for android.view View setSoundEffectsEnabled.

Prototype

public void setSoundEffectsEnabled(boolean soundEffectsEnabled) 

Source Link

Document

Set whether this view should have sound effects enabled for events such as clicking and touching.

Usage

From source file:com.github.kimikage.uguisuan.MainActivity.java

private void setPlayAndPauseButton() {
    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    if (toolbar == null) {
        return;//from   www.jav  a  2  s . com
    }
    if (toolbar.getMenu() == null) {
        return;
    }
    boolean playing = isPlaying();

    MenuItem menuItem = (MenuItem) toolbar.getMenu().findItem(R.id.action_play_pause);
    menuItem.setTitle(getResources().getString(playing ? R.string.action_pause : R.string.action_play));
    menuItem.setIcon(playing ? R.drawable.ic_pause_circle_filled_white_48dp
            : R.drawable.ic_play_circle_filled_white_48dp);
    View v = findViewById(R.id.action_play_pause);
    if (v != null) {
        v.setSoundEffectsEnabled(playing);
    }
}