Example usage for android.view KeyEvent KEYCODE_MUTE

List of usage examples for android.view KeyEvent KEYCODE_MUTE

Introduction

In this page you can find the example usage for android.view KeyEvent KEYCODE_MUTE.

Prototype

int KEYCODE_MUTE

To view the source code for android.view KeyEvent KEYCODE_MUTE.

Click Source Link

Document

Key code constant: Mute key.

Usage

From source file:com.rfo.basic.Run.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) { // The user hit a key
    // Log.v(LOGTAG, "onKeyDown" + keyCode);

    // Eat the MENU key Down event, will handle the Up event.
    if (keyCode == KeyEvent.KEYCODE_MENU)
        return true;

    // If event is null, we called this directly from runLoop(),
    // so the return value does not matter.
    if (event == null)
        return true;

    // Alternate: if the user program has set mBlockVolKeys, block everything but BACK
    // if (mBlockVolKeys && (keyCode != KeyEvent.KEYCODE_BACK)) return true;

    // If the user program has set mBlockVolKeys, block volume and headset keys.
    if (mBlockVolKeys && ((keyCode == KeyEvent.KEYCODE_VOLUME_UP) || (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)
            || (keyCode == KeyEvent.KEYCODE_VOLUME_MUTE) || (keyCode == KeyEvent.KEYCODE_MUTE)
            || (keyCode == KeyEvent.KEYCODE_HEADSETHOOK))) {
        return true;
    }// w w  w. j  a  va  2 s  . c o  m

    // Otherwise pass the KeyEvent up the chain.
    return super.onKeyDown(keyCode, event);
}