Example usage for android.view KeyEvent KEYCODE_H

List of usage examples for android.view KeyEvent KEYCODE_H

Introduction

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

Prototype

int KEYCODE_H

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

Click Source Link

Document

Key code constant: 'H' key.

Usage

From source file:nl.sogeti.android.gpstracker.viewer.LoggerMap.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    boolean propagate = true;
    switch (keyCode) {
    case KeyEvent.KEYCODE_T:
        propagate = this.mMapView.getController().zoomIn();
        break;/*from ww w. j  a  v  a 2s .  c o  m*/
    case KeyEvent.KEYCODE_G:
        propagate = this.mMapView.getController().zoomOut();
        break;
    case KeyEvent.KEYCODE_S:
        setSatelliteOverlay(!this.mMapView.isSatellite());
        propagate = false;
        break;
    case KeyEvent.KEYCODE_A:
        setTrafficOverlay(!this.mMapView.isTraffic());
        propagate = false;
        break;
    case KeyEvent.KEYCODE_F:
        mAverageSpeed = 0.0;
        moveToTrack(this.mTrackId - 1, true);
        propagate = false;
        break;
    case KeyEvent.KEYCODE_H:
        mAverageSpeed = 0.0;
        moveToTrack(this.mTrackId + 1, true);
        propagate = false;
        break;
    default:
        propagate = super.onKeyDown(keyCode, event);
        break;
    }
    return propagate;
}

From source file:com.bernard.beaconportal.activities.activity.MessageList.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    // Shortcuts that work no matter what is selected
    switch (keyCode) {
    case KeyEvent.KEYCODE_Q: {
        onAccounts();/*  www  . j  a  v  a  2 s .  c  om*/
        return true;
    }

    case KeyEvent.KEYCODE_S: {
        onEditAccount();
        return true;
    }

    case KeyEvent.KEYCODE_H: {
        Toast toast = Toast.makeText(this, R.string.folder_list_help_key, Toast.LENGTH_LONG);
        toast.show();
        return true;
    }

    case KeyEvent.KEYCODE_1: {
        setDisplayMode(FolderMode.FIRST_CLASS);
        return true;
    }
    case KeyEvent.KEYCODE_2: {
        setDisplayMode(FolderMode.FIRST_AND_SECOND_CLASS);
        return true;
    }
    case KeyEvent.KEYCODE_3: {
        setDisplayMode(FolderMode.NOT_SECOND_CLASS);
        return true;
    }
    case KeyEvent.KEYCODE_4: {
        setDisplayMode(FolderMode.ALL);
        return true;
    }
    }// switch

    return super.onKeyDown(keyCode, event);
}

From source file:com.bernard.beaconportal.activities.activity.MessageList.java

/**
 * Handle hotkeys/*from ww  w.j  a  va 2  s  . c om*/
 * 
 * <p>
 * This method is called by {@link #dispatchKeyEvent(KeyEvent)} before any
 * view had the chance to consume this key event.
 * </p>
 * 
 * @param keyCode
 *            The value in {@code event.getKeyCode()}.
 * @param event
 *            Description of the key event.
 * 
 * @return {@code true} if this event was consumed.
 */
public boolean onCustomKeyDown(final int keyCode, final KeyEvent event) {
    switch (keyCode) {
    case KeyEvent.KEYCODE_VOLUME_UP: {
        if (mMessageViewFragment != null && mDisplayMode != DisplayMode.MESSAGE_LIST
                && K9.useVolumeKeysForNavigationEnabled()) {
            showPreviousMessage();
            return true;
        } else if (mDisplayMode != DisplayMode.MESSAGE_VIEW && K9.useVolumeKeysForListNavigationEnabled()) {
            mMessageListFragment.onMoveUp();
            return true;
        }

        break;
    }
    case KeyEvent.KEYCODE_VOLUME_DOWN: {
        if (mMessageViewFragment != null && mDisplayMode != DisplayMode.MESSAGE_LIST
                && K9.useVolumeKeysForNavigationEnabled()) {
            showNextMessage();
            return true;
        } else if (mDisplayMode != DisplayMode.MESSAGE_VIEW && K9.useVolumeKeysForListNavigationEnabled()) {
            mMessageListFragment.onMoveDown();
            return true;
        }

        break;
    }
    case KeyEvent.KEYCODE_C: {
        mMessageListFragment.onCompose();
        return true;
    }
    case KeyEvent.KEYCODE_Q: {
        if (mMessageListFragment != null && mMessageListFragment.isSingleAccountMode()) {
            onShowFolderList();
        }
        return true;
    }
    case KeyEvent.KEYCODE_O: {
        mMessageListFragment.onCycleSort();
        return true;
    }
    case KeyEvent.KEYCODE_I: {
        mMessageListFragment.onReverseSort();
        return true;
    }
    case KeyEvent.KEYCODE_DEL:
    case KeyEvent.KEYCODE_D: {
        if (mDisplayMode == DisplayMode.MESSAGE_LIST) {
            mMessageListFragment.onDelete();
        } else if (mMessageViewFragment != null) {
            mMessageViewFragment.onDelete();
        }
        return true;
    }
    case KeyEvent.KEYCODE_S: {
        mMessageListFragment.toggleMessageSelect();
        return true;
    }
    case KeyEvent.KEYCODE_G: {
        if (mDisplayMode == DisplayMode.MESSAGE_LIST) {
            mMessageListFragment.onToggleFlagged();
        } else if (mMessageViewFragment != null) {
            mMessageViewFragment.onToggleFlagged();
        }
        return true;
    }
    case KeyEvent.KEYCODE_M: {
        if (mDisplayMode == DisplayMode.MESSAGE_LIST) {
            mMessageListFragment.onMove();
        } else if (mMessageViewFragment != null) {
            mMessageViewFragment.onMove();
        }
        return true;
    }
    case KeyEvent.KEYCODE_V: {
        if (mDisplayMode == DisplayMode.MESSAGE_LIST) {
            mMessageListFragment.onArchive();
        } else if (mMessageViewFragment != null) {
            mMessageViewFragment.onArchive();
        }
        return true;
    }
    case KeyEvent.KEYCODE_Y: {
        if (mDisplayMode == DisplayMode.MESSAGE_LIST) {
            mMessageListFragment.onCopy();
        } else if (mMessageViewFragment != null) {
            mMessageViewFragment.onCopy();
        }
        return true;
    }
    case KeyEvent.KEYCODE_Z: {
        if (mDisplayMode == DisplayMode.MESSAGE_LIST) {
            mMessageListFragment.onToggleRead();
        } else if (mMessageViewFragment != null) {
            mMessageViewFragment.onToggleRead();
        }
        return true;
    }
    case KeyEvent.KEYCODE_F: {
        if (mMessageViewFragment != null) {
            mMessageViewFragment.onForward();
        }
        return true;
    }
    case KeyEvent.KEYCODE_A: {
        if (mMessageViewFragment != null) {
            mMessageViewFragment.onReplyAll();
        }
        return true;
    }
    case KeyEvent.KEYCODE_R: {
        if (mMessageViewFragment != null) {
            mMessageViewFragment.onReply();
        }
        return true;
    }
    case KeyEvent.KEYCODE_J:
    case KeyEvent.KEYCODE_P: {
        if (mMessageViewFragment != null) {
            showPreviousMessage();
        }
        return true;
    }
    case KeyEvent.KEYCODE_N:
    case KeyEvent.KEYCODE_K: {
        if (mMessageViewFragment != null) {
            showNextMessage();
        }
        return true;
    }
    /*
     * FIXME case KeyEvent.KEYCODE_Z: { mMessageViewFragment.zoom(event);
     * return true; }
     */
    case KeyEvent.KEYCODE_H: {
        Toast toast = Toast.makeText(this, R.string.message_list_help_key, Toast.LENGTH_LONG);
        toast.show();
        return true;
    }

    }

    return false;
}