Example usage for android.view KeyEvent KEYCODE_PROG_RED

List of usage examples for android.view KeyEvent KEYCODE_PROG_RED

Introduction

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

Prototype

int KEYCODE_PROG_RED

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

Click Source Link

Document

Key code constant: Red "programmable" key.

Usage

From source file:com.vuze.android.remote.activity.TorrentViewActivity.java

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {

    if (AndroidUtilsUI.sendOnKeyToFragments(this, keyCode, event)) {
        return true;
    }/*from   w  w w .j a  v  a  2s  .com*/

    switch (keyCode) {
    case KeyEvent.KEYCODE_PROG_RED: {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
            finishAffinity();
        }
        break;
    }
    case KeyEvent.KEYCODE_MENU: {
        if (super.onKeyUp(keyCode, event)) {
            return true;
        }
        if (toolbar != null) {
            return toolbar.showOverflowMenu();
        }

        break;
    }
    }
    return super.onKeyUp(keyCode, event);
}