Example usage for android.view KeyEvent KEYCODE_BUTTON_A

List of usage examples for android.view KeyEvent KEYCODE_BUTTON_A

Introduction

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

Prototype

int KEYCODE_BUTTON_A

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

Click Source Link

Document

Key code constant: A Button key.

Usage

From source file:com.ibm.mil.readyapps.telco.onboarding.appintrolib.AppIntro.java

@Override
public boolean onKeyDown(int code, KeyEvent kvent) {
    if (code == KeyEvent.KEYCODE_ENTER || code == KeyEvent.KEYCODE_BUTTON_A) {
        ViewPager vp = (ViewPager) this.findViewById(R.id.view_pager);
        if (vp.getCurrentItem() == vp.getAdapter().getCount() - 1) {
            onDonePressed();//ww  w.  ja  v a 2 s.com
        } else {
            vp.setCurrentItem(vp.getCurrentItem() + 1);
        }
        return false;
    }
    return super.onKeyDown(code, kvent);
}

From source file:com.google.android.apps.santatracker.rocketsleigh.EndGameActivity.java

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

    switch (keyCode) {
    case KeyEvent.KEYCODE_BUTTON_A:
        //fall through
    case KeyEvent.KEYCODE_DPAD_CENTER:
        performPlayClick();//  ww w .ja va  2  s  .  c o m
        return true;
    }
    return super.onKeyDown(keyCode, event);
}

From source file:info.bartowski.easteregg.LLand.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent ev) {
    if (DEBUG)/*  w  ww  .j  a va2s  .  c om*/
        L("keyDown: %d", keyCode);
    switch (keyCode) {
    case KeyEvent.KEYCODE_DPAD_CENTER:
    case KeyEvent.KEYCODE_DPAD_UP:
    case KeyEvent.KEYCODE_SPACE:
    case KeyEvent.KEYCODE_ENTER:
    case KeyEvent.KEYCODE_BUTTON_A:
        poke();
        return true;
    }
    return false;
}

From source file:info.bartowski.easteregg.LLand.java

@Override
public boolean onKeyUp(int keyCode, KeyEvent ev) {
    if (DEBUG)/*from  w  ww.  j av a 2  s .c  o m*/
        L("keyDown: %d", keyCode);
    switch (keyCode) {
    case KeyEvent.KEYCODE_DPAD_CENTER:
    case KeyEvent.KEYCODE_DPAD_UP:
    case KeyEvent.KEYCODE_SPACE:
    case KeyEvent.KEYCODE_ENTER:
    case KeyEvent.KEYCODE_BUTTON_A:
        unpoke();
        return true;
    }
    return false;
}

From source file:info.bartowski.easteregg.MLand.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent ev) {
    L("keyDown: %d", keyCode);
    switch (keyCode) {
    case KeyEvent.KEYCODE_DPAD_CENTER:
    case KeyEvent.KEYCODE_DPAD_UP:
    case KeyEvent.KEYCODE_SPACE:
    case KeyEvent.KEYCODE_ENTER:
    case KeyEvent.KEYCODE_BUTTON_A:
        int player = getControllerPlayer(ev.getDeviceId());
        poke(player);/* w ww.  java  2s  . c o m*/
        return true;
    }
    return false;
}

From source file:info.bartowski.easteregg.MLand.java

@Override
public boolean onKeyUp(int keyCode, KeyEvent ev) {
    L("keyDown: %d", keyCode);
    switch (keyCode) {
    case KeyEvent.KEYCODE_DPAD_CENTER:
    case KeyEvent.KEYCODE_DPAD_UP:
    case KeyEvent.KEYCODE_SPACE:
    case KeyEvent.KEYCODE_ENTER:
    case KeyEvent.KEYCODE_BUTTON_A:
        int player = getControllerPlayer(ev.getDeviceId());
        unpoke(player);/*from w  ww  .j  a  v  a 2  s . c  o  m*/
        return true;
    }
    return false;
}

From source file:com.google.android.apps.santatracker.rocketsleigh.RocketSleighActivity.java

@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
    switch (keyCode) {
    case KeyEvent.KEYCODE_DPAD_CENTER:
        //fall through
    case KeyEvent.KEYCODE_BUTTON_A:
        if (mIsPlaying) {
            mElfAccelY = mThrustAccelY;/*from  www.  j a v  a 2  s.c  om*/
            if (!mElfIsHit) {
                updateElfThrust(1);
            }
            mJetThrustStream = mSoundPool.play(mJetThrustSound, 1.0f, 1.0f, 1, -1, 1.0f);
        } else if (!mCountdownStarted && !mMoviePlaying) {
            //game is paused. resume it.
            mBigPlayButton.setPressed(true);
        }
        return true;
    }
    return super.onKeyDown(keyCode, event);
}

From source file:com.google.android.apps.santatracker.rocketsleigh.RocketSleighActivity.java

@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
    switch (keyCode) {
    case KeyEvent.KEYCODE_DPAD_CENTER:
        //fall through
    case KeyEvent.KEYCODE_BUTTON_A:
        if (mIsPlaying) {
            mElfAccelY = 0.0f;//from   ww w. ja v  a2 s .  c  o m
            if (!mElfIsHit) {
                updateElfThrust(0);
            }
            if (mJetThrustStream > 0) {
                mSoundPool.stop(mJetThrustStream);
                mJetThrustStream = 0;
            }
        } else if (mMoviePlaying) {
            endIntro();
        } else if (mBigPlayButton.isPressed()) {
            mBigPlayButton.setPressed(false);
            mBigPlayButton.performClick();
        }
        return true;
    case KeyEvent.KEYCODE_BUTTON_B:
        onBackPressed();
        return true;
    }
    return super.onKeyUp(keyCode, event);
}